20 #include <QStringList>
24 #include <QFontMetrics>
26 #include <QPrintDialog>
27 #include <QProgressBar>
28 #include <QStandardItemModel>
30 #include <QNetworkProxy>
33 #include <kaboutdata.h>
35 #include <kactioncollection.h>
36 #include <kapplication.h>
37 #include <kcomponentdata.h>
38 #include <kconfigdialog.h>
39 #include <kdeversion.h>
40 #include <kfiledialog.h>
44 #include <kmessagebox.h>
45 #include <kpluginfactory.h>
46 #include <kparts/statusbarextension.h>
47 #include <kstandardaction.h>
48 #include <kstatusbar.h>
49 #include <ktoggleaction.h>
50 #include <ktogglefullscreenaction.h>
51 #include <knewstuff3/knewstuffaction.h>
52 #include <knewstuff3/downloaddialog.h>
53 #include <knewstuff3/uploaddialog.h>
54 #include <KDE/KStandardDirs>
55 #include <kdeprintdialog.h>
56 #include <KDE/KToolBar>
103 using namespace Marble;
105 #include "ui_MarbleCacheSettingsWidget.h"
106 #include "ui_MarbleViewSettingsWidget.h"
107 #include "ui_MarbleNavigationSettingsWidget.h"
108 #include "ui_MarbleTimeSettingsWidget.h"
109 #include "ui_MarbleCloudSyncSettingsWidget.h"
116 const char* POSITION_STRING = I18N_NOOP(
"Position: %1" );
117 const char* DISTANCE_STRING = I18N_NOOP(
"Altitude: %1" );
118 const char* TILEZOOMLEVEL_STRING = I18N_NOOP(
"Tile Zoom Level: %1" );
119 const char* DATETIME_STRING = I18N_NOOP(
"Time: %1" );
122 K_PLUGIN_FACTORY(MarblePartFactory, registerPlugin<MarblePart>();)
123 K_EXPORT_PLUGIN(MarblePartFactory(
"marble"))
126 : KParts::ReadOnlyPart( parent ),
127 m_sunControlDialog( 0 ),
128 m_timeControlDialog( 0 ),
129 m_downloadRegionDialog( 0 ),
130 m_externalMapEditorAction( 0 ),
131 m_recentFilesAction( 0 ),
134 m_tileZoomLevel( i18n( NOT_AVAILABLE ) ),
135 m_positionLabel( 0 ),
139 if ( arguments.count() != 0 && !arguments.first().toString().isEmpty() )
146 KLocale *kLocale = KGlobal::locale();
147 if ( kLocale->measureSystem() == KLocale::Metric ) {
154 migrateNewstuffConfigFiles();
156 m_externalEditorMapping[0] =
"";
157 m_externalEditorMapping[1] =
"potlatch";
158 m_externalEditorMapping[2] =
"josm";
159 m_externalEditorMapping[3] =
"merkaartor";
163 setWidget( m_controlView );
167 setXMLFile(
"marble_part.rc" );
169 m_statusBarExtension =
new KParts::StatusBarExtension(
this );
170 m_statusBarExtension->statusBar()->setUpdatesEnabled(
false );
173 m_controlView->marbleModel()->bookmarkManager()->loadFile(
"bookmarks/bookmarks.kml" );
175 initializeCustomTimezone();
179 m_statusBarExtension->statusBar()->setUpdatesEnabled(
true );
188 m_controlView->marbleWidget()->flyTo( target,
Instant );
192 m_controlView->marbleWidget()->goHome(
Instant );
196 connect( m_controlView, SIGNAL(showUploadDialog()),
this, SLOT(showUploadNewStuffDialog()) );
197 connect( m_controlView, SIGNAL(showMapWizard()),
this, SLOT(showMapWizard()) );
198 connect( m_controlView, SIGNAL(mapThemeDeleted()),
this, SLOT(fallBackToDefaultTheme()) );
206 delete m_configDialog;
211 return m_controlView;
216 return new KAboutData( I18N_NOOP(
"marble_part" ), 0,
217 ki18n(
"A Virtual Globe" ),
223 QFileInfo fileInfo( url.toLocalFile() );
224 if ( fileInfo.isReadable() ) {
226 m_recentFilesAction->addUrl( url );
230 KMessageBox::error( widget(),
231 tr(
"Sorry, unable to open '%1'. The file is not accessible." ).arg( fileInfo.fileName() ),
232 tr(
"File not accessible" ) );
240 QStringList allFileExtensions;
243 if ( plugin->
nameId() ==
"Cache" )
246 const QStringList fileExtensions = plugin->
fileExtensions().replaceInStrings( QRegExp(
"^" ),
"*." );
247 const QString filter = QString(
"%1|%2" ).arg( fileExtensions.join(
" " ) ).arg( plugin->
fileFormatDescription() );
250 allFileExtensions << fileExtensions;
253 allFileExtensions.sort();
254 const QString allFileTypes = QString(
"%1|%2" ).arg( allFileExtensions.join(
" " ) ).arg( i18n(
"All Supported Files" ) );
257 filters.prepend( allFileTypes );
258 const QString filter = filters.join(
"\n" );
260 QStringList fileNames = KFileDialog::getOpenFileNames( m_lastFileOpenPath, filter,
261 widget(), i18n(
"Open File")
264 if ( !fileNames.isEmpty() ) {
265 const QString firstFile = fileNames.first();
266 m_lastFileOpenPath = KUrl::fromLocalFile( QFileInfo( firstFile ).absolutePath() );
269 foreach(
const QString &fileName, fileNames ) {
276 void MarblePart::exportMapScreenShot()
278 QString fileName = KFileDialog::getSaveFileName( QDir::homePath(),
279 i18n(
"Images *.jpg *.png" ),
280 widget(), i18n(
"Export Map") );
282 if ( !fileName.isEmpty() ) {
284 const char * format = 0;
285 if ( !fileName.endsWith(QLatin1String(
"png" ), Qt::CaseInsensitive)
286 && !fileName.endsWith(QLatin1String(
"jpg" ), Qt::CaseInsensitive) )
292 bool success = mapPixmap.save( fileName, format );
294 KMessageBox::error( widget(), i18nc(
"Application name",
"Marble" ),
295 i18n(
"An error occurred while trying to save the file.\n" ),
296 KMessageBox::Notify );
301 void MarblePart::setShowBookmarks(
bool show )
305 m_toggleBookmarkDisplayAction->setChecked( show );
308 void MarblePart::setShowClouds(
bool isChecked )
312 m_showCloudsAction->setChecked( isChecked );
315 void MarblePart::showPositionLabel(
bool isChecked )
317 m_positionLabel->setVisible( isChecked );
320 void MarblePart::showAltitudeLabel(
bool isChecked )
322 m_distanceLabel->setVisible( isChecked );
325 void MarblePart::showTileZoomLevelLabel(
bool isChecked )
327 m_tileZoomLevelLabel->setVisible( isChecked );
330 void MarblePart::showDateTimeLabel(
bool isChecked )
332 m_clockLabel->setVisible( isChecked );
335 void MarblePart::showDownloadProgressBar(
bool isChecked )
339 m_downloadProgressBar->setVisible( isChecked && m_downloadProgressBar->value() >= 0 );
342 void MarblePart::showFullScreen(
bool isChecked )
344 if ( KApplication::activeWindow() )
345 KToggleFullScreenAction::setFullScreen( KApplication::activeWindow(), isChecked );
347 m_fullScreenAct->setChecked( isChecked );
350 void MarblePart::showStatusBar(
bool isChecked )
352 if ( !m_statusBarExtension->statusBar() )
355 m_statusBarExtension->statusBar()->setVisible( isChecked );
358 void MarblePart::controlSun()
360 if ( !m_sunControlDialog ) {
362 connect( m_sunControlDialog, SIGNAL(showSun(
bool)),
363 this, SLOT (showSun(
bool)) );
364 connect( m_sunControlDialog, SIGNAL(showSun(
bool)),
365 m_showShadow, SLOT (setChecked(
bool)) );
366 connect( m_sunControlDialog, SIGNAL(isLockedToSubSolarPoint(
bool)),
367 m_lockToSubSolarPoint, SLOT (setChecked(
bool)) );
368 connect( m_sunControlDialog, SIGNAL(isSubSolarPointIconVisible(
bool)),
369 m_setSubSolarPointIconVisible, SLOT (setChecked(
bool)) );
372 m_sunControlDialog->show();
373 m_sunControlDialog->raise();
374 m_sunControlDialog->activateWindow();
377 void MarblePart::controlTime()
379 if ( !m_timeControlDialog )
383 m_timeControlDialog->show();
384 m_timeControlDialog->raise();
385 m_timeControlDialog->activateWindow();
389 void MarblePart::showSun(
bool active )
395 void MarblePart::lockToSubSolarPoint(
bool lock )
400 void MarblePart::setSubSolarPointIconVisible(
bool show )
405 void MarblePart::workOffline(
bool offline )
408 m_newStuffAction->setEnabled( !offline );
409 m_downloadRegionAction->setEnabled( !offline );
412 void MarblePart::copyMap()
415 QClipboard *clipboard = KApplication::clipboard();
417 clipboard->setPixmap( mapPixmap );
420 void MarblePart::copyCoordinates()
426 QClipboard *clipboard = QApplication::clipboard();
428 clipboard->setText( positionString );
431 void MarblePart::readSettings()
433 kDebug() <<
"Start: MarblePart::readSettings()";
441 if ( mapTheme.isEmpty() ) {
469 m_previousGraphicsSystem = m_initialGraphicsSystem;
478 KSharedConfig::Ptr sharedConfig = KSharedConfig::openConfig( KGlobal::mainComponent() );
479 if ( sharedConfig->hasGroup(
"Routing Profiles" ) ) {
480 QList<RoutingProfile> profiles;
481 KConfigGroup profilesGroup = sharedConfig->group(
"Routing Profiles" );
482 int numProfiles = profilesGroup.readEntry(
"Num", 0 );
483 for (
int i = 0; i < numProfiles; ++i ) {
484 KConfigGroup profileGroup = profilesGroup.group( QString(
"Profile %0" ).arg(i) );
485 QString name = profileGroup.readEntry(
"Name", tr(
"Unnamed" ) );
487 foreach (
const QString& pluginName, profileGroup.groupList() ) {
488 KConfigGroup pluginGroup = profileGroup.group( pluginName );
489 profile.pluginSettings().insert( pluginName, QHash<QString, QVariant>() );
490 foreach (
const QString& key, pluginGroup.keyList() ) {
491 if ( key !=
"Enabled" ) {
492 profile.pluginSettings()[ pluginName ].insert( key, pluginGroup.readEntry( key ) );
503 if ( profileIndex >= 0 && profileIndex < m_controlView->marbleModel()->routingManager()->profilesModel()->rowCount() ) {
509 if ( !positionProvider.isEmpty() ) {
513 if ( plugin->
nameId() == positionProvider ) {
522 readStatusBarSettings();
537 readPluginSettings();
550 void MarblePart::readStatusBarSettings()
553 m_showPositionAction->setChecked( showPos );
554 showPositionLabel( showPos );
557 m_showAltitudeAction->setChecked( showAlt );
558 showAltitudeLabel( showAlt );
561 m_showTileZoomLevelAction->setChecked( showTileZoom );
562 showTileZoomLevelLabel( showTileZoom );
565 m_showDateTimeAction->setChecked( showDateTime );
566 showDateTimeLabel( showDateTime );
569 m_showDownloadProgressAction->setChecked( showProgress );
570 showDownloadProgressBar( showProgress );
573 void MarblePart::writeSettings()
631 volatileTileCacheLimit() / 1024 );
633 persistentTileCacheLimit() / 1024 );
640 writePluginSettings();
642 QString positionProvider;
651 writeStatusBarSettings();
654 KSharedConfig::Ptr sharedConfig = KSharedConfig::openConfig( KGlobal::mainComponent() );
655 m_recentFilesAction->saveEntries( sharedConfig->group(
"RecentFiles" ) );
666 QList<QString>
const editors = m_externalEditorMapping.values();
674 void MarblePart::writeStatusBarSettings()
683 void MarblePart::setupActions()
686 m_recentFilesAction = KStandardAction::openRecent(
this, SLOT(
openUrl(KUrl)),
687 actionCollection() );
688 KSharedConfig::Ptr sharedConfig = KSharedConfig::openConfig( KGlobal::mainComponent() );
689 m_recentFilesAction->loadEntries( sharedConfig->group(
"RecentFiles" ) );
692 m_downloadRegionAction =
new KAction(
this );
693 m_downloadRegionAction->setText( i18nc(
"Action for downloading an entire region of a map",
694 "Download Region..." ));
695 actionCollection()->addAction(
"file_download_region", m_downloadRegionAction );
696 connect( m_downloadRegionAction, SIGNAL(triggered()), SLOT(showDownloadRegionDialog()));
699 m_printMapAction = KStandardAction::print(
this, SLOT(printMapScreenShot()),
700 actionCollection() );
702 m_printPreviewAction = KStandardAction::printPreview( m_controlView, SLOT(printPreview()),
703 actionCollection() );
706 m_exportMapAction =
new KAction(
this );
707 actionCollection()->addAction(
"exportMap", m_exportMapAction );
708 m_exportMapAction->setText( i18nc(
"Action for saving the map to a file",
"&Export Map..." ) );
709 m_exportMapAction->setIcon( KIcon(
"document-save-as" ) );
710 m_exportMapAction->setShortcut( Qt::CTRL + Qt::Key_S );
711 connect( m_exportMapAction, SIGNAL(triggered(
bool)),
712 this, SLOT(exportMapScreenShot()) );
715 m_workOfflineAction =
new KAction(
this );
716 actionCollection()->addAction(
"workOffline", m_workOfflineAction );
717 m_workOfflineAction->setText( i18nc(
"Action for toggling offline mode",
"&Work Offline" ) );
718 m_workOfflineAction->setIcon( KIcon(
"user-offline" ) );
719 m_workOfflineAction->setCheckable(
true );
720 m_workOfflineAction->setChecked(
false );
721 connect( m_workOfflineAction, SIGNAL(triggered(
bool)),
722 this, SLOT(workOffline(
bool)) );
725 m_copyMapAction = KStandardAction::copy(
this, SLOT(copyMap()),
726 actionCollection() );
727 m_copyMapAction->setText( i18nc(
"Action for copying the map to the clipboard",
"&Copy Map" ) );
730 m_copyCoordinatesAction =
new KAction(
this );
731 actionCollection()->addAction(
"edit_copy_coordinates",
732 m_copyCoordinatesAction );
733 m_copyCoordinatesAction->setText( i18nc(
"Action for copying the coordinates to the clipboard",
734 "C&opy Coordinates" ) );
735 m_copyCoordinatesAction->setIcon( KIcon(
":/icons/copy-coordinates.png" ) );
736 connect( m_copyCoordinatesAction, SIGNAL(triggered(
bool)),
737 this, SLOT(copyCoordinates()) );
740 m_openAct = KStandardAction::open(
this, SLOT(
openFile()),
741 actionCollection() );
742 m_openAct->setText( i18nc(
"Action for opening a file",
"&Open..." ) );
745 KStandardAction::quit( kapp, SLOT(closeAllWindows()),
746 actionCollection() );
749 m_newStuffAction = KNS3::standardAction( i18nc(
"Action for downloading maps (GHNS)",
752 SLOT(showNewStuffDialog()),
753 actionCollection(),
"new_stuff" );
754 m_newStuffAction->setStatusTip( i18nc(
"Status tip",
"Download new maps"));
755 m_newStuffAction->setShortcut( Qt::CTRL + Qt::Key_N );
758 m_mapWizardAct =
new KAction( i18nc(
"Action for creating new maps",
759 "&Create a New Map..." ),
761 m_mapWizardAct->setIcon( KIcon(
":/icons/create-new-map.png" ) );
762 actionCollection()->addAction(
"createMap", m_mapWizardAct );
763 m_mapWizardAct->setStatusTip( i18nc(
"Status tip",
764 "A wizard guides you through the creation of your own map theme." ) );
765 connect( m_mapWizardAct, SIGNAL(triggered()), SLOT(showMapWizard()) );
767 KStandardAction::showStatusbar(
this, SLOT(showStatusBar(
bool)),
768 actionCollection() );
770 m_fullScreenAct = KStandardAction::fullScreen( 0, 0, widget(),
771 actionCollection() );
772 connect( m_fullScreenAct, SIGNAL(triggered(
bool)),
773 this, SLOT(showFullScreen(
bool)) );
777 QList<RenderPlugin *>::const_iterator i = pluginList.constBegin();
778 QList<RenderPlugin *>::const_iterator
const end = pluginList.constEnd();
779 for (; i != end; ++i ) {
780 if ( (*i)->nameId() ==
"crosshairs" ) {
781 actionCollection()->addAction(
"show_crosshairs", (*i)->action() );
786 m_showCloudsAction =
new KAction(
this );
787 actionCollection()->addAction(
"show_clouds", m_showCloudsAction );
788 m_showCloudsAction->setCheckable(
true );
789 m_showCloudsAction->setChecked(
true );
790 m_showCloudsAction->setIcon( KIcon(
":/icons/clouds.png" ) );
791 m_showCloudsAction->setText( i18nc(
"Action for toggling clouds",
"&Clouds" ) );
792 connect( m_showCloudsAction, SIGNAL(triggered(
bool)),
793 this, SLOT(setShowClouds(
bool)) );
796 m_controlSunAction =
new KAction(
this );
797 actionCollection()->addAction(
"control_sun", m_controlSunAction );
798 m_controlSunAction->setText( i18nc(
"Action for sun control dialog",
"S&un Control..." ) );
799 connect( m_controlSunAction, SIGNAL(triggered(
bool)),
800 this, SLOT(controlSun()) );
802 KStandardAction::redisplay( m_controlView->
marbleWidget(), SLOT(reloadMap()), actionCollection() );
805 m_controlTimeAction =
new KAction(
this );
806 actionCollection()->addAction(
"control_time", m_controlTimeAction );
807 m_controlTimeAction->setIcon( KIcon(
":/icons/clock.png" ) );
808 m_controlTimeAction->setText( i18nc(
"Action for time control dialog",
"&Time Control..." ) );
809 connect( m_controlTimeAction, SIGNAL(triggered(
bool)),
810 this, SLOT(controlTime()) );
813 m_lockFloatItemsAct =
new KAction (
this );
814 actionCollection()->addAction(
"options_lock_floatitems",
815 m_lockFloatItemsAct );
816 m_lockFloatItemsAct->setText( i18nc(
"Action for locking float items on the map",
818 m_lockFloatItemsAct->setIcon( KIcon(
":/icons/unlock.png" ) );
819 m_lockFloatItemsAct->setCheckable(
true );
820 m_lockFloatItemsAct->setChecked(
false );
821 connect( m_lockFloatItemsAct, SIGNAL(triggered(
bool)),
822 this, SLOT(lockFloatItemPosition(
bool)) );
824 KStandardAction::preferences(
this, SLOT(editSettings()),
825 actionCollection() );
828 m_showShadow =
new KToggleAction( i18n(
"Show Shadow" ),
this );
829 m_showShadow->setIcon( KIcon(
"" ) );
830 actionCollection()->addAction(
"sun_shadow", m_showShadow );
831 m_showShadow->setCheckedState( KGuiItem( i18n(
"Hide Shadow" ) ) );
832 m_showShadow->setToolTip(i18n(
"Shows and hides the shadow of the sun"));
833 connect( m_showShadow, SIGNAL(triggered(
bool)),
this, SLOT(showSun(
bool)));
836 m_setSubSolarPointIconVisible =
new KToggleAction( i18n(
"Show sun icon on the Sub-Solar Point" ),
this );
837 actionCollection()->addAction(
"show_icon_on_subsolarpoint", m_setSubSolarPointIconVisible );
838 m_setSubSolarPointIconVisible->setCheckedState( KGuiItem( i18n(
"Hide sun icon on the Sub-Solar Point" ) ) );
839 m_setSubSolarPointIconVisible->setToolTip( i18n(
"Show sun icon on the sub-solar point" ) );
840 connect( m_setSubSolarPointIconVisible, SIGNAL(triggered(
bool)),
this, SLOT(setSubSolarPointIconVisible(
bool)));
844 m_lockToSubSolarPoint =
new KToggleAction( i18n(
"Lock Globe to the Sub-Solar Point" ),
this );
845 actionCollection()->addAction(
"lock_to_subsolarpoint", m_lockToSubSolarPoint );
846 m_lockToSubSolarPoint->setCheckedState( KGuiItem( i18n(
"Unlock Globe to the Sub-Solar Point" ) ) );
847 m_lockToSubSolarPoint->setToolTip( i18n(
"Lock globe to the sub-solar point" ) );
848 connect( m_lockToSubSolarPoint, SIGNAL(triggered(
bool)),
this, SLOT(lockToSubSolarPoint(
bool)));
851 QList<RenderPlugin *>::const_iterator it = pluginList.constBegin();
852 QList<RenderPlugin *>::const_iterator
const itEnd = pluginList.constEnd();
853 for (; it != itEnd; ++it ) {
854 connect( (*it), SIGNAL(actionGroupsChanged()),
858 m_addBookmarkAction =
new KAction(
this );
859 actionCollection()->addAction(
"add_bookmark", m_addBookmarkAction );
860 m_addBookmarkAction->setText( i18nc(
"Add Bookmark",
"&Add Bookmark" ) );
861 m_addBookmarkAction->setIcon( KIcon(
":/icons/bookmark-new.png" ) );
862 m_addBookmarkAction->setShortcut( Qt::CTRL + Qt::Key_B );
863 connect( m_addBookmarkAction, SIGNAL(triggered()),
864 this, SLOT(openEditBookmarkDialog()) );
866 m_toggleBookmarkDisplayAction =
new KAction(
this );
867 actionCollection()->addAction(
"show_bookmarks", m_toggleBookmarkDisplayAction );
868 m_toggleBookmarkDisplayAction->setText( i18nc(
"Show Bookmarks",
"Show &Bookmarks" ) );
869 m_toggleBookmarkDisplayAction->setStatusTip( tr(
"Show or hide bookmarks in the map" ) );
870 m_toggleBookmarkDisplayAction->setCheckable(
true );
872 connect( m_toggleBookmarkDisplayAction, SIGNAL(toggled(
bool)),
875 m_setHomeAction =
new KAction(
this );
876 actionCollection()->addAction(
"set_home", m_setHomeAction );
877 m_setHomeAction->setText( tr(
"&Set Home Location" ) );
878 m_setHomeAction->setIcon( KIcon(
"go-home" ) );
879 connect( m_setHomeAction, SIGNAL(triggered()),
880 this, SLOT(setHome()) );
882 m_manageBookmarksAction =
new KAction(
this );
883 actionCollection()->addAction(
"manage_bookmarks", m_manageBookmarksAction );
884 m_manageBookmarksAction->setText( i18nc(
"Manage Bookmarks",
"&Manage Bookmarks" ) );
885 m_manageBookmarksAction->setIcon( KIcon(
":/icons/bookmarks-organize.png" ) );
886 connect( m_manageBookmarksAction, SIGNAL(triggered()),
887 this, SLOT(openManageBookmarksDialog()) );
894 m_externalMapEditorAction =
new KAction(
this );
895 actionCollection()->addAction(
"external_editor", m_externalMapEditorAction );
896 m_externalMapEditorAction->setText( i18nc(
"Edit the map in an external application",
"&Edit Map" ) );
897 m_externalMapEditorAction->setIcon( KIcon(
":/icons/edit-map.png" ) );
898 m_externalMapEditorAction->setShortcut( Qt::CTRL + Qt::Key_E );
899 connect( m_externalMapEditorAction, SIGNAL(triggered()),
900 m_controlView, SLOT(launchExternalMapEditor()) );
901 connect( m_controlView->
marbleWidget(), SIGNAL(themeChanged(QString)),
902 this, SLOT(updateMapEditButtonVisibility(QString)) );
908 QList<QAction*> actionList;
911 QVector<GeoDataFolder*>::const_iterator i = folders.constBegin();
912 QVector<GeoDataFolder*>::const_iterator end = folders.constEnd();
914 for (; i != end; ++i ) {
915 QMenu *m_bookmarksListMenu =
new QMenu( (*i)->name() );
917 createBookmarksListMenu( m_bookmarksListMenu, *(*i) );
918 connect( m_bookmarksListMenu, SIGNAL(triggered(QAction*)),
919 this, SLOT(lookAtBookmark(QAction*)) );
921 actionList.append( m_bookmarksListMenu->menuAction() );
923 unplugActionList(
"folders");
924 plugActionList(
"folders", actionList );
927 void MarblePart::createBookmarksListMenu( QMenu *m_bookmarksListMenu,
const GeoDataFolder &folder )
929 m_bookmarksListMenu->clear();
930 QVector<GeoDataPlacemark*> bookmarks = folder.
placemarkList();
932 QVector<GeoDataPlacemark*>::const_iterator i = bookmarks.constBegin();
933 QVector<GeoDataPlacemark*>::const_iterator end = bookmarks.constEnd();
935 for (; i != end; ++i ) {
936 QAction *bookmarkAct =
new QAction( (*i)->name(), this );
942 coordinateToLookAt.
setRange( (*i)->coordinate().altitude() );
944 var.setValue( *lookAt );
946 bookmarkAct->setData( var );
947 m_bookmarksListMenu->addAction( bookmarkAct );
956 QList<QAction*> actionList;
958 QList<AbstractFloatItem *>::const_iterator i = floatItemList.constBegin();
959 QList<AbstractFloatItem *>::const_iterator
const end = floatItemList.constEnd();
960 for (; i != end; ++i ) {
961 actionList.append( (*i)->action() );
964 unplugActionList(
"infobox_actionlist" );
965 plugActionList(
"infobox_actionlist", actionList );
972 QList<QAction*> actionList;
974 QList<RenderPlugin *>::const_iterator i = renderPluginList.constBegin();
975 QList<RenderPlugin *>::const_iterator
const end = renderPluginList.constEnd();
976 for (; i != end; ++i ) {
980 actionList.append( (*i)->action() );
984 unplugActionList(
"onlineservices_actionlist" );
985 plugActionList(
"onlineservices_actionlist", actionList );
992 QList<QAction*> actionList;
994 QList<RenderPlugin *>::const_iterator i = renderPluginList.constBegin();
995 QList<RenderPlugin *>::const_iterator
const end = renderPluginList.constEnd();
996 for (; i != end; ++i ) {
998 actionList.append( (*i)->action() );
1002 unplugActionList(
"themerender_actionlist" );
1003 plugActionList(
"themerender_actionlist", actionList );
1014 m_position = position;
1020 if ( tileLevel == -1 )
1023 m_tileZoomLevel.setNum( tileLevel );
1030 Q_UNUSED( newMapTheme );
1031 updateTileZoomLevel();
1037 unplugActionList(
"plugins_actionlist");
1039 QList<RenderPlugin *>::const_iterator i = renderPluginList.constBegin();
1040 QList<RenderPlugin *>::const_iterator
const end = renderPluginList.constEnd();
1043 for (; i != end; ++i ) {
1044 const QList<QActionGroup*> *tmp_toolbarActionGroups = (*i)->toolbarActionGroups();
1046 if ( tmp_toolbarActionGroups ) {
1048 foreach( QActionGroup* ag, *tmp_toolbarActionGroups ) {
1049 plugActionList(
"plugins_actionlist", ag->actions() );
1056 void MarblePart::updateTileZoomLevel()
1058 const int tileZoomLevel =
1060 if ( tileZoomLevel == -1 )
1063 m_tileZoomLevel.setNum( tileZoomLevel );
1067 void MarblePart::migrateNewstuffConfigFiles()
const
1074 if ( !target.exists() ) {
1075 QString
const source = KStandardDirs::locate(
"data",
"knewstuff3/marble.knsregistry" );
1076 if ( !source.isEmpty() ) {
1077 if ( !target.absoluteDir().exists() ) {
1078 if ( !QDir::root().mkpath( target.absolutePath() ) ) {
1079 mDebug() <<
"Failed to create target directory " << target.absolutePath() <<
" needed for newstuff migration";
1084 QFile registryFile( source );
1085 if ( !registryFile.open( QFile::ReadOnly ) ) {
1086 mDebug() <<
"Cannot parse newstuff xml file";
1090 if ( !xml.setContent( registryFile.readAll() ) ) {
1091 mDebug() <<
"Cannot parse newstuff xml data";
1095 QDomNodeList items = xml.elementsByTagName(
"stuff" );
1096 for (
unsigned int i = 0; i < items.length(); ++i ) {
1097 repairNode( items.item(i),
"summary" );
1098 repairNode( items.item(i),
"author" );
1101 QFile output( target.absoluteFilePath() );
1102 if ( !output.open( QFile::WriteOnly ) ) {
1103 mDebug() <<
"Cannot open " << target.absoluteFilePath() <<
" for writing";
1105 QTextStream outStream( &output );
1106 outStream << xml.toString( 2 );
1114 void MarblePart::repairNode( QDomNode node,
const QString &child )
const
1116 int const size = node.namedItem( child ).toElement().text().size();
1117 if ( size > 1024 ) {
1118 QString
const theme = node.namedItem(
"name" ).toElement().text();
1119 mDebug() <<
"Removing GHNS field " << child <<
" of map theme " << theme <<
": Size " << size <<
" exceeds maximum size (see bug 319542).";
1120 node.removeChild( node.namedItem( child ) );
1124 void MarblePart::updateStatusBar()
1126 if ( m_positionLabel )
1127 m_positionLabel->setText( i18n( POSITION_STRING, m_position ) );
1129 if ( m_distanceLabel )
1132 if ( m_tileZoomLevelLabel )
1133 m_tileZoomLevelLabel->setText( i18n( TILEZOOMLEVEL_STRING,
1134 m_tileZoomLevel ) );
1137 m_clockLabel->setText( i18n( DATETIME_STRING, m_clock ) );
1140 void MarblePart::setupStatusBar()
1142 QFontMetrics statusBarFontMetrics( m_statusBarExtension->statusBar()->fontMetrics() );
1144 QString templatePositionString =
1145 QString(
"%1 000\xb0 00\' 00\"_, 000\xb0 00\' 00\"_" ).arg(POSITION_STRING);
1146 m_positionLabel = setupStatusBarLabel( templatePositionString );
1148 QString templateDistanceString =
1149 QString(
"%1 00.000,0 mu" ).arg(DISTANCE_STRING);
1150 m_distanceLabel = setupStatusBarLabel( templateDistanceString );
1152 QString templateDateTimeString = QString(
"%1 %2" ).arg( DATETIME_STRING , QLocale().toString( QDateTime::fromString (
"01:01:1000",
"dd:mm:yyyy"), QLocale::ShortFormat ) );
1154 m_clockLabel = setupStatusBarLabel( templateDateTimeString );
1156 const QString templateTileZoomLevelString = i18n( TILEZOOMLEVEL_STRING );
1157 m_tileZoomLevelLabel = setupStatusBarLabel( templateTileZoomLevelString );
1159 connect( m_controlView->
marbleWidget(), SIGNAL(mouseMoveGeoPosition(QString)),
1161 connect( m_controlView->
marbleWidget(), SIGNAL(distanceChanged(QString)),
1162 this, SLOT(updateStatusBar()) );
1163 connect( m_controlView->
marbleWidget(), SIGNAL(tileLevelChanged(
int)),
1165 connect( m_controlView->
marbleWidget(), SIGNAL(themeChanged(QString)),
1171 setupDownloadProgressBar();
1173 setupStatusBarActions();
1177 QLabel * MarblePart::setupStatusBarLabel(
const QString& templateString )
1179 QFontMetrics statusBarFontMetrics( m_statusBarExtension->statusBar()->fontMetrics() );
1181 QLabel *
const label =
new QLabel( m_statusBarExtension->statusBar() );
1182 label->setIndent( 5 );
1183 int maxWidth = statusBarFontMetrics.boundingRect( templateString ).width()
1184 + 2 * label->margin() + 2 * label->indent();
1185 label->setFixedWidth( maxWidth );
1186 m_statusBarExtension->addStatusBarItem( label, -1,
false );
1190 void MarblePart::setupDownloadProgressBar()
1193 KStatusBar *
const statusBar = m_statusBarExtension->statusBar();
1194 Q_ASSERT( statusBar );
1196 m_downloadProgressBar =
new QProgressBar;
1198 statusBar->addPermanentWidget( m_downloadProgressBar );
1202 Q_ASSERT( downloadManager );
1203 connect( downloadManager, SIGNAL(jobAdded()), SLOT(downloadJobAdded()) );
1204 connect( downloadManager, SIGNAL(jobRemoved()), SLOT(downloadJobRemoved()) );
1207 void MarblePart::setupStatusBarActions()
1209 KStatusBar *
const statusBar = m_statusBarExtension->statusBar();
1210 Q_ASSERT( statusBar );
1212 statusBar->setContextMenuPolicy( Qt::CustomContextMenu );
1214 connect( statusBar, SIGNAL(customContextMenuRequested(QPoint)),
1215 this, SLOT(showStatusBarContextMenu(QPoint)));
1217 m_showPositionAction =
new KToggleAction( i18nc(
"Action for toggling",
"Show Position" ),
1219 m_showDateTimeAction =
new KToggleAction( i18nc(
"Action for toggling",
"Show Date and Time" ),
1221 m_showAltitudeAction =
new KToggleAction( i18nc(
"Action for toggling",
"Show Altitude" ),
1223 m_showTileZoomLevelAction =
new KToggleAction( i18nc(
"Action for toggling",
1224 "Show Tile Zoom Level" ),
this );
1225 m_showDownloadProgressAction =
new KToggleAction( i18nc(
"Action for toggling",
1226 "Show Download Progress Bar" ),
this );
1228 connect( m_showPositionAction, SIGNAL(triggered(
bool)),
1229 this, SLOT(showPositionLabel(
bool)) );
1230 connect( m_showAltitudeAction, SIGNAL(triggered(
bool)),
1231 this, SLOT(showAltitudeLabel(
bool)) );
1232 connect( m_showTileZoomLevelAction, SIGNAL(triggered(
bool)),
1233 this, SLOT(showTileZoomLevelLabel(
bool)) );
1234 connect( m_showDateTimeAction, SIGNAL(triggered(
bool)),
1235 this, SLOT(showDateTimeLabel(
bool)) );
1236 connect( m_showDownloadProgressAction, SIGNAL(triggered(
bool)),
1237 this, SLOT(showDownloadProgressBar(
bool)) );
1240 void MarblePart::showNewStuffDialog()
1247 void MarblePart::showUploadNewStuffDialog()
1249 QString newStuffConfig = KStandardDirs::locate (
"data",
"marble/marble.knsrc" );
1250 kDebug() <<
"KNS config file:" << newStuffConfig;
1252 QPointer<KNS3::UploadDialog> dialog(
new KNS3::UploadDialog( newStuffConfig, m_controlView ) );
1253 kDebug() <<
"Creating the archive";
1260 void MarblePart::showDownloadRegionDialog()
1263 if ( !m_downloadRegionDialog ) {
1268 connect( m_downloadRegionDialog, SIGNAL(accepted()), SLOT(downloadRegion()));
1269 connect( m_downloadRegionDialog, SIGNAL(applied()), SLOT(downloadRegion()));
1279 m_downloadRegionDialog->show();
1280 m_downloadRegionDialog->raise();
1281 m_downloadRegionDialog->activateWindow();
1284 void MarblePart::downloadRegion()
1286 Q_ASSERT( m_downloadRegionDialog );
1287 QVector<TileCoordsPyramid>
const pyramid = m_downloadRegionDialog->
region();
1288 if ( !pyramid.isEmpty() ) {
1293 void MarblePart::showStatusBarContextMenu(
const QPoint& pos )
1295 KStatusBar *
const statusBar = m_statusBarExtension->statusBar();
1296 Q_ASSERT( statusBar );
1298 KMenu statusBarContextMenu( m_controlView->
marbleWidget() );
1299 statusBarContextMenu.addAction( m_showPositionAction );
1300 statusBarContextMenu.addAction( m_showDateTimeAction );
1301 statusBarContextMenu.addAction( m_showAltitudeAction );
1302 statusBarContextMenu.addAction( m_showTileZoomLevelAction );
1303 statusBarContextMenu.addAction( m_showDownloadProgressAction );
1305 statusBarContextMenu.exec( statusBar->mapToGlobal( pos ));
1308 void MarblePart::showMapWizard()
1311 QPointer<MapWizard> mapWizard =
new MapWizard( m_controlView );
1317 mapWizard->deleteLater();
1320 void MarblePart::editSettings()
1322 if ( KConfigDialog::showDialog(
"settings" ) )
1325 m_configDialog =
new KConfigDialog( m_controlView,
"settings",
1329 Ui_MarbleViewSettingsWidget ui_viewSettings;
1332 w_viewSettings->setObjectName(
"view_page" );
1333 ui_viewSettings.setupUi( w_viewSettings );
1334 m_configDialog->addPage( w_viewSettings, i18n(
"View" ),
"configure" );
1338 ui_viewSettings.kcfg_graphicsSystem->removeItem(
OpenGLGraphics );
1340 QString nativeString ( i18n(
"Native") );
1343 nativeString = i18n(
"Native (X11)" );
1346 nativeString = i18n(
"Native (Mac OS X Core Graphics)" );
1349 ui_viewSettings.kcfg_graphicsSystem->setItemText(
NativeGraphics, nativeString );
1352 Ui_MarbleNavigationSettingsWidget ui_navigationSettings;
1355 w_navigationSettings->setObjectName(
"navigation_page" );
1356 ui_navigationSettings.setupUi( w_navigationSettings );
1357 m_configDialog->addPage( w_navigationSettings, i18n(
"Navigation" ),
1361 Ui_MarbleCacheSettingsWidget ui_cacheSettings;
1364 w_cacheSettings->setObjectName(
"cache_page" );
1365 ui_cacheSettings.setupUi( w_cacheSettings );
1366 m_configDialog->addPage( w_cacheSettings, i18n(
"Cache & Proxy" ),
1367 "preferences-web-browser-cache" );
1368 connect( ui_cacheSettings.button_clearVolatileCache, SIGNAL(clicked()),
1369 m_controlView->
marbleWidget(), SLOT(clearVolatileTileCache()) );
1370 connect( ui_cacheSettings.button_clearPersistentCache, SIGNAL(clicked()),
1371 m_controlView->
marbleModel(), SLOT(clearPersistentTileCache()) );
1374 Ui_MarbleTimeSettingsWidget ui_timeSettings;
1377 w_timeSettings->setObjectName(
"time_page" );
1378 ui_timeSettings.setupUi( w_timeSettings );
1379 m_configDialog->addPage( w_timeSettings, i18n(
"Date & Time" ),
"clock" );
1383 Ui_MarbleCloudSyncSettingsWidget ui_cloudSyncSettings;
1386 w_cloudSyncSettings->setObjectName(
"sync_page" );
1387 ui_cloudSyncSettings.setupUi( w_cloudSyncSettings );
1389 m_configDialog->addPage( w_cloudSyncSettings, i18n(
"Synchronization" ),
"folder-sync" );
1391 connect( ui_cloudSyncSettings.button_syncNow, SIGNAL(clicked()),
1397 w_routingSettings->setObjectName(
"routing_page" );
1398 m_configDialog->addPage( w_routingSettings, i18n(
"Routing" ),
"flag");
1404 w_pluginSettings->
setModel( pluginModel );
1405 w_pluginSettings->setObjectName(
"plugin_page" );
1406 m_configDialog->addPage( w_pluginSettings, i18n(
"Plugins" ),
1407 "preferences-plugin" );
1410 w_pluginSettings->
setAboutIcon( KIcon(
"help-about" ) );
1412 connect( w_pluginSettings, SIGNAL(pluginListViewClicked()),
1413 SLOT(enableApplyButton()) );
1414 connect( m_configDialog, SIGNAL(settingsChanged(QString)),
1415 SLOT(updateSettings()) );
1416 connect( m_configDialog, SIGNAL(applyClicked()),
1417 SLOT(applyPluginState()) );
1418 connect( m_configDialog, SIGNAL(okClicked()),
1419 SLOT(applyPluginState()) );
1420 connect( m_configDialog, SIGNAL(applyClicked()),
1421 pluginModel, SLOT(applyPluginState()) );
1422 connect( m_configDialog, SIGNAL(okClicked()),
1423 pluginModel, SLOT(applyPluginState()) );
1424 connect( m_configDialog, SIGNAL(cancelClicked()),
1425 pluginModel, SLOT(retrievePluginState()) );
1427 m_configDialog->show();
1430 void MarblePart::enableApplyButton()
1432 m_configDialog->enableButtonApply(
true );
1435 void MarblePart::applyPluginState()
1437 QList<RoutingProfile> profiles = m_controlView->
marbleWidget()
1439 KSharedConfig::Ptr sharedConfig = KSharedConfig::openConfig( KGlobal::mainComponent() );
1440 KConfigGroup profilesGroup = sharedConfig->group(
"Routing Profiles" );
1441 profilesGroup.writeEntry(
"Num", profiles.count() );
1442 for (
int i = 0; i < profiles.count(); ++i ) {
1443 KConfigGroup profileGroup = profilesGroup.group( QString(
"Profile %0" ).arg(i) );
1445 profileGroup.writeEntry(
"Name", profile.
name() );
1446 foreach (
const QString &pluginName, profileGroup.groupList() ) {
1447 profileGroup.group( pluginName ).deleteGroup();
1449 foreach (
const QString &key, profile.
pluginSettings().keys() ) {
1450 KConfigGroup pluginGroup = profileGroup.group( key );
1451 pluginGroup.writeEntry(
"Enabled",
true );
1452 foreach (
const QString& settingKey, profile.
pluginSettings()[ key ].keys() ) {
1453 Q_ASSERT( settingKey !=
"Enabled" );
1454 pluginGroup.writeEntry( settingKey, profile.
pluginSettings()[ key ][ settingKey ] );
1460 void MarblePart::updateSettings()
1462 kDebug() <<
"Updating Settings ...";
1492 QNetworkProxy proxy;
1496 proxy.setType( QNetworkProxy::NoProxy );
1505 kDebug() <<
"Unknown proxy type! Using Http Proxy instead.";
1518 QNetworkProxy::setApplicationProxy(proxy);
1523 if ( m_initialGraphicsSystem != graphicsSystem
1524 && m_previousGraphicsSystem != graphicsSystem ) {
1525 KMessageBox::information (m_controlView->
marbleWidget(),
1526 i18n(
"You have decided to run Marble with a different graphics system.\n"
1527 "For this change to become effective, Marble has to be restarted.\n"
1528 "Please close the application and start Marble again."),
1529 i18n(
"Graphics System Change") );
1531 m_previousGraphicsSystem = graphicsSystem;
1536 QDateTime localTime = QDateTime::currentDateTime().toLocalTime();
1537 localTime.setTimeSpec( Qt::UTC );
1576 void MarblePart::writePluginSettings()
1578 KSharedConfig::Ptr sharedConfig = KSharedConfig::openConfig( KGlobal::mainComponent() );
1581 KConfigGroup group = sharedConfig->group( QString(
"plugin_" ) + plugin->
nameId() );
1583 const QHash<QString,QVariant> hash = plugin->
settings();
1585 QHash<QString,QVariant>::const_iterator it = hash.begin();
1586 while( it != hash.end() ) {
1587 group.writeEntry( it.key(), it.value() );
1594 void MarblePart::readPluginSettings()
1596 disconnect( m_controlView->
marbleWidget(), SIGNAL(pluginSettingsChanged()),
1597 this, SLOT(writePluginSettings()) );
1599 KSharedConfig::Ptr sharedConfig = KSharedConfig::openConfig( KGlobal::mainComponent() );
1602 KConfigGroup group = sharedConfig->group( QString(
"plugin_" ) + plugin->
nameId() );
1604 QHash<QString,QVariant> hash;
1606 foreach (
const QString& key, group.keyList() ) {
1607 hash.insert( key, group.readEntry( key ) );
1613 connect( m_controlView->
marbleWidget(), SIGNAL(pluginSettingsChanged()),
1614 this, SLOT(writePluginSettings()) );
1617 void MarblePart::lockFloatItemPosition(
bool enabled )
1621 QList<AbstractFloatItem *>::const_iterator i = floatItemList.constBegin();
1622 QList<AbstractFloatItem *>::const_iterator
const end = floatItemList.constEnd();
1623 for (; i != end; ++i ) {
1626 (*i)->setPositionLocked(enabled);
1630 void MarblePart::downloadJobAdded()
1632 m_downloadProgressBar->setUpdatesEnabled(
false );
1633 if ( m_downloadProgressBar->value() < 0 ) {
1634 m_downloadProgressBar->setMaximum( 1 );
1635 m_downloadProgressBar->setValue( 0 );
1638 m_downloadProgressBar->setMaximum( m_downloadProgressBar->maximum() + 1 );
1644 m_downloadProgressBar->setUpdatesEnabled(
true );
1647 void MarblePart::downloadJobRemoved()
1649 m_downloadProgressBar->setUpdatesEnabled(
false );
1650 m_downloadProgressBar->setValue( m_downloadProgressBar->value() + 1 );
1651 if ( m_downloadProgressBar->value() == m_downloadProgressBar->maximum() ) {
1652 m_downloadProgressBar->reset();
1653 m_downloadProgressBar->setVisible(
false );
1659 m_downloadProgressBar->setUpdatesEnabled(
true );
1662 void MarblePart::openEditBookmarkDialog()
1668 dialog->setMarbleWidget( widget );
1669 dialog->setReverseGeocodeName();
1670 if ( dialog->exec() == QDialog::Accepted ) {
1676 void MarblePart::setHome()
1682 void MarblePart::openManageBookmarksDialog()
1690 void MarblePart::lookAtBookmark( QAction *action)
1696 <<
" distance : " << temp.
range();
1702 if( m_timezone.count() == 0)
1704 m_timezone.insert( 0, 0 );
1705 m_timezone.insert( 1, 3600 );
1706 m_timezone.insert( 2, 7200 );
1707 m_timezone.insert( 3, 7200 );
1708 m_timezone.insert( 4, 10800 );
1709 m_timezone.insert( 5, 12600 );
1710 m_timezone.insert( 6, 14400 );
1711 m_timezone.insert( 7, 18000 );
1712 m_timezone.insert( 8, 19800 );
1713 m_timezone.insert( 9, 21600 );
1714 m_timezone.insert( 10, 25200 );
1715 m_timezone.insert( 11, 28800 );
1716 m_timezone.insert( 12, 32400 );
1717 m_timezone.insert( 13, 34200 );
1718 m_timezone.insert( 14, 36000 );
1719 m_timezone.insert( 15, 39600 );
1720 m_timezone.insert( 16, 43200 );
1721 m_timezone.insert( 17, -39600 );
1722 m_timezone.insert( 18, -36000 );
1723 m_timezone.insert( 19, -32400 );
1724 m_timezone.insert( 20, -28800 );
1725 m_timezone.insert( 21, -25200 );
1726 m_timezone.insert( 22, -25200 );
1727 m_timezone.insert( 23, -21600 );
1728 m_timezone.insert( 24, -18000 );
1729 m_timezone.insert( 25, -18000 );
1730 m_timezone.insert( 26, -14400 );
1731 m_timezone.insert( 27, -12600 );
1732 m_timezone.insert( 28, -10800 );
1733 m_timezone.insert( 29, -10800 );
1734 m_timezone.insert( 30, -3600 );
1738 void MarblePart::printMapScreenShot()
1740 #ifndef QT_NO_PRINTER
1741 QPrinter printer( QPrinter::HighResolution );
1742 QPointer<QPrintDialog> printDialog = KdePrint::createPrintDialog(&printer, widget());
1748 void MarblePart::updateMapEditButtonVisibility(
const QString &mapTheme )
1750 Q_ASSERT( m_externalMapEditorAction );
1751 m_externalMapEditorAction->setVisible( mapTheme ==
"earth/openstreetmap/openstreetmap.dgml" );
1761 #include "marble_part.moc"
static void setDateTime(const QDateTime &v)
Set The date and time of marble clock.
Provides common access to various kinds of plugins without having to know about their details...
QString defaultMapThemeId() const
Returns a default map theme: earth/srtm/srtm.dgml if installed, any other theme id if earth/srtm/srtm...
void printMapScreenShot(QPointer< QPrintDialog > dialog)
void setVisibleTileLevel(int const tileLevel)
PositionProviderPlugin positionProviderPlugin
static void setQuitLatitude(double v)
Set quitLatitude.
static QColor routeColorHighlighted()
Get routeColorHighlighted.
A 3d point representation.
Show home location on startup.
The class that handles Marble's plugins.
static int volatileTileCacheLimit()
Get Cache for tiles reserved in the physical memory.
static bool showDownloadProgressBar()
Get showDownloadProgressBar.
static QStringList staticUrlServers()
Get staticUrlServers.
static bool systemTimezone()
Get systemTimezone.
static bool showPositionLabel()
Get showPositionLabel.
static bool syncRoutes()
Get syncRoutes.
static void setShowSun(bool v)
Set showSun.
static bool workOffline()
Get workOffline.
QList< RoutingProfile > profiles() const
void addBookmark(GeoDataContainer *folder, const GeoDataPlacemark &bookmark)
add bookmark in a folder
void fallBackToDefaultTheme()
static void setMarbleDataPath(const QString &adaptedPath)
static QString proxyUser()
Get Username for authorization.
static void setShowCitylights(bool v)
Set showCitylights.
static bool showDateTimeLabel()
Get showDateTimeLabel.
qreal longitude(GeoDataCoordinates::Unit unit=GeoDataCoordinates::Radian) const
retrieves the longitude of the GeoDataLookAt object use the unit parameter to switch between Radian a...
static void setAngleUnit(int v)
Set The unit chosen to measure angles.
static void setDistanceUnit(int v)
Set The unit chosen to measure distances.
static QColor routeColorAlternative()
Get routeColorAlternative.
static QString createArchive(QWidget *parent, QString mapId)
static QStringList wmsServers()
Get wmsServers.
static bool inertialEarthRotation()
Get inertialEarthRotation.
int clockTimezone() const
static int proxyType()
Get proxyType.
static void setWorkOffline(bool v)
Set workOffline.
This file contains the headers for MarbleModel.
QList< const PositionProviderPlugin * > positionProviderPlugins() const
Returns all available PositionProviderPlugins.
static void setPersistentTileCacheLimit(int v)
Set Maximum space on the hard disk that can be used to store tiles.
static int onStartup()
Get The location shown on application startup.
static double quitRange()
Get quitRange.
void setSpecifiedLatLonAltBox(GeoDataLatLonAltBox const &)
void setCoordinates(const GeoDataCoordinates &coordinates)
static int stillQuality()
Get The quality at which a still map gets painted.
void setOwncloudUsername(const QString &owncloudUsername)
Setter for ownCloud username.
void setMeasurementSystem(QLocale::MeasurementSystem measurementSystem)
void setRouteColorAlternative(QColor color)
Set color for alternative route rendering.
static bool systemTime()
Get systemTime.
const GeoDataLatLonAltBox & viewLatLonAltBox() const
static void setSubSolarPointIconVisible(bool v)
Set subSolarPointIconVisible.
static void setMapFont(const QFont &v)
Set The general font used on the map.
static bool lockFloatItemPositions()
Get lockFloatItemPositions.
void setBookmarkSyncEnabled(bool enabled)
Setter for enabling/disabling bookmark synchronization.
static QString localPath()
static void setMapTheme(const QString &v)
Set mapTheme.
static int proxyPort()
Get Port for the proxy server.
MapQuality
This enum is used to choose the map quality shown in the view.
static QString lastFileOpenDir()
Get The last directory that was opened by File->Open.
static bool showGuidanceModeStartupWarning()
Get showGuidanceModeStartupWarning.
const PluginManager * pluginManager() const
static int routeAlphaStandard()
Get routeAlphaStandard.
static bool utc()
Get utc.
static void setHomeZoom(int v)
Set homeZoom.
CloudSyncManager * cloudSyncManager()
static void setShowClouds(bool v)
Set showClouds.
void setLongitude(qreal longitude, GeoDataCoordinates::Unit unit=GeoDataCoordinates::Radian)
set the longitude in a GeoDataLookAt object
void setProfiles(const QList< RoutingProfile > &profiles)
static void setQuitLongitude(double v)
Set quitLongitude.
qreal range() const
Retrieve the distance (in meters) between the camera and the object looked at.
static bool showBookmarks()
Get showBookmarks.
static bool showClouds()
Get showClouds.
static double quitLongitude()
Get quitLongitude.
Uses the native graphics system of the OS.
This file contains the header for MapWizard.
void setShowBookmarks(bool visible)
static void deleteArchive(QString mapId)
The abstract class that provides position information.
void setVisibleLatLonAltBox(GeoDataLatLonAltBox const &)
static void setShowTileZoomLevelLabel(bool v)
Set showTileZoomLevelLabel.
RouteRequest * routeRequest()
Returns the current route request.
static QString applicationVersion()
Returns the version of the Marble applications (which differs from the Marble library version)...
QVector< TileCoordsPyramid > region() const
static bool animateTargetVoyage()
Get Display animation on voyage to target.
void setRouteSyncEnabled(bool enabled)
Setter for enabling/disabling route synchronization.
void setRouteColorStandard(QColor color)
Set color for standard route rendering.
RoutingProfile routingProfile() const
BookmarkSyncManager bookmarkSyncManager
void addGeoDataFile(const QString &filename)
Handle file loading into the treeModel.
animated view (e.g. while rotating the globe)
RoutingManager * routingManager()
void setMarbleModel(const MarbleModel *)
void setRange(qreal range)
Change the distance (in meters) between the camera and the object looked at.
static void setShowDateTimeLabel(bool v)
Set showDateTimeLabel.
QString externalMapEditor() const
Returns the editor used to launch a map editor application.
static void setShowDownloadProgressBar(bool v)
Set showDownloadProgressBar.
static MarbleSettings * self()
static bool customTimezone()
Get customTimezone.
static QFont mapFont()
Get The general font used on the map.
static void setSpeedSlider(int v)
Set The speed of marble clock.
static void setExternalMapEditor(int v)
Set The external OpenStreetMap editor application.
static bool showSun()
Get showSun.
void home(qreal &lon, qreal &lat, int &zoom) const
get the home point
RouteSyncManager routeSyncManager
void showZoomLevel(const int)
static QString proxyUrl()
Get URL for the proxy server.
QVector< GeoDataFolder * > folders() const
return Vector of folders
void setRouteColorHighlighted(QColor color)
Set color for highlighted route rendering.
RoutingProfilesModel * profilesModel()
Provides access to the model which contains all possible routing profiles.
static QString owncloudUsername()
Get owncloudUsername.
static void setLastFileOpenDir(const QString &v)
Set The last directory that was opened by File->Open.
PositionTracking * positionTracking() const
static QString owncloudPassword()
Get owncloudPassword.
static void setHomeLatitude(double v)
Set homeLatitude.
void setRoutingProfile(const RoutingProfile &profile)
void showPosition(const QString &position)
static double quitLatitude()
Get quitLatitude.
void setRenderPlugins(const QList< RenderPlugin * > &renderPlugins)
Set the RenderPlugins the model should manage.
static bool showAltitudeLabel()
Get showAltitudeLabel.
bool openUrl(const KUrl &url)
QList< const ParseRunnerPlugin * > parsingRunnerPlugins() const
Returns all parse runner plugins.
static void setGraphicsSystem(int v)
Set The graphics system that is used by Qt to render the graphics.
static QString mapTheme()
Get mapTheme.
static const char NOT_AVAILABLE[]
void setShowGuidanceModeStartupWarning(bool show)
Set whether a warning message should be shown to the user before starting guidance mode...
static bool lastSessionTime()
Get lastSessionTime.
qreal latitude(GeoDataCoordinates::Unit unit=GeoDataCoordinates::Radian) const
retrieves the latitude of the GeoDataLookAt object use the unit parameter to switch between Radian an...
static void setShowPositionLabel(bool v)
Set showPositionLabel.
static void setLockFloatItemPositions(bool v)
Set lockFloatItemPositions.
MarbleLocale * locale() const
void setClockTimezone(int timeInSec)
static int routeAlphaHighlighted()
Get routeAlphaHighlighted.
void setAllowedTileLevelRange(int const minimumTileLevel, int const maximumTileLevel)
void readSettings()
Restores a previously saved route request and route from disk, if any.
void setClockDateTime(const QDateTime &datetime)
virtual QStringList fileExtensions() const =0
Returns the file extensions associated with the file format.
static bool proxyAuth()
Get Proxy requires Authentication.
virtual QString nameId() const =0
Returns the unique name of the plugin.
A public class that controls what is visible in the viewport of a Marble map.
virtual QString fileFormatDescription() const =0
Returns a short description of the supported file format.
void loadDefaultProfiles()
static int animationQuality()
Get The quality at which an animated map gets painted.
static void setActivePositionTrackingPlugin(const QString &v)
Set The position tracking plugin used to determine the current location.
Delegates data retrieval and model updates to the appropriate routing provider.
static bool showCitylights()
Get showCitylights.
static double homeLongitude()
Get homeLongitude.
MarbleWidget * marbleWidget() const
static int speedSlider()
Get The speed of marble clock.
QDateTime clockDateTime() const
static void setQuitRange(double v)
Set quitRange.
static void setLockToSubSolarPoint(bool v)
Set lockToSubSolarPoint.
This file contains the headers for ViewportParams.
static MarbleGlobal * getInstance()
A plugin for Marble to execute a parsing task.
A class that contains all localization stuff for Marble.
const QHash< QString, QHash< QString, QVariant > > & pluginSettings() const
static void setAnimationQuality(int v)
Set The quality at which an animated map gets painted.
void setSyncEnabled(bool enabled)
Setter for enabling/disabling synchronization.
void setHome(qreal lon, qreal lat, int zoom=1050)
Set the home point.
static void setVolatileTileCacheLimit(int v)
Set Cache for tiles reserved in the physical memory.
static bool enableSync()
Get enableSync.
The data model (not based on QAbstractModel) for a MarbleWidget.
Show last location visited on quit.
static void setProjection(int v)
Set projection.
void setExternalMapEditor(const QString &editor)
Change the editor to launch via.
void setOwncloudServer(const QString &owncloudServer)
Setter for ownCloud server.
static int currentRoutingProfile()
Get currentRoutingProfile.
AngleUnit
This enum is used to choose the unit chosen to measure angles.
void setOwncloudPassword(const QString &owncloudPassword)
Setter for ownCloud password.
static bool showTileZoomLevelLabel()
Get showTileZoomLevelLabel.
static double homeLatitude()
Get homeLatitude.
static int angleUnit()
Get The unit chosen to measure angles.
QString toString() const
return a string representation of the coordinate this is a convenience function which uses the defaul...
static QColor routeColorStandard()
Get routeColorStandard.
BookmarkManager * bookmarkManager()
return instance of BookmarkManager
static QString proxyPass()
Get Password for authorization.
void writeSettings() const
Saves the current route request and the current route to disk.
Projection
This enum is used to choose the projection shown in the view.
void setWorkOffline(bool workOffline)
static bool lockToSubSolarPoint()
Get lockToSubSolarPoint.
static bool showCloudSyncSettings()
Get showCloudSyncSettings.
static int externalMapEditor()
Get The external OpenStreetMap editor application.
ControlView * controlView() const
static QString owncloudServer()
Get owncloudServer.
static int graphicsSystem()
Get The graphics system that is used by Qt to render the graphics.
static void setAnimateTargetVoyage(bool v)
Set Display animation on voyage to target.
static int homeZoom()
Get homeZoom.
virtual PositionProviderPlugin * newInstance() const =0
Create a new PositionProvider Plugin and return it.
static KAboutData * createAboutData()
static int distanceUnit()
Get The unit chosen to measure distances.
void setPositionProviderPlugin(PositionProviderPlugin *plugin)
Change the position provider to use.
HttpDownloadManager * downloadManager()
Return the downloadmanager to load missing tiles.
Change camera position immediately (no interpolation)
static void setCurrentRoutingProfile(int v)
Set currentRoutingProfile.
static void setShowBookmarks(bool v)
Set showBookmarks.
static void setStillQuality(int v)
Set The quality at which a still map gets painted.
static void setShowGuidanceModeStartupWarning(bool v)
Set showGuidanceModeStartupWarning.
void mapThemeChanged(const QString &newMapTheme)
GeoDataCoordinates coordinates() const
retrieve the lat/lon/alt triple as a GeoDataCoordinates object
GraphicsSystem
This enum is used to choose which graphics system Qt is using.
void createInfoBoxesMenu()
static QString activePositionTrackingPlugin()
Get The position tracking plugin used to determine the current location.
virtual QHash< QString, QVariant > settings() const
Settings of the plugin.
static void setHomeLongitude(double v)
Set homeLongitude.
void createOnlineServicesMenu()
MarbleModel * marbleModel()
static void setShowAltitudeLabel(bool v)
Set showAltitudeLabel.
static QDateTime dateTime()
Get The date and time of marble clock.
QDebug mDebug()
a function to replace qDebug() in Marble library code
The abstract class that creates a renderable item.
static int routeAlphaAlternative()
Get routeAlphaAlternative.
bool showGuidanceModeStartupWarning() const
Returns true (default) if a warning is shown to the user when starting guidance mode.
bool showBookmarks() const
virtual void setSettings(const QHash< QString, QVariant > &settings)
Set the settings of the plugin.
static bool syncBookmarks()
Get syncBookmarks.
static void setWmsServers(const QStringList &v)
Set wmsServers.
static bool subSolarPointIconVisible()
Get subSolarPointIconVisible.
void setClockSpeed(int speed)
void createRenderPluginActions()
void setLatitude(qreal latitude, GeoDataCoordinates::Unit unit=GeoDataCoordinates::Radian)
set the latitude in a GeoDataLookAt object
static void setStaticUrlServers(const QStringList &v)
Set staticUrlServers.
void setCoordinates(const GeoDataCoordinates &coordinates)
set the GeoDataCoordinates object
static int chosenTimezone()
Get chosenTimezone.
This class manages scheduled downloads.
void initializeCustomTimezone()
static int persistentTileCacheLimit()
Get Maximum space on the hard disk that can be used to store tiles.
static int projection()
Get projection.
QVector< GeoDataPlacemark * > placemarkList() const
A convenience function that returns all placemarks in this container.
void setSelectionMethod(SelectionMethod const )