• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

marble

  • sources
  • kde-4.14
  • kdeedu
  • marble
  • src
  • lib
  • marble
QtMarbleConfigDialog.cpp
Go to the documentation of this file.
1 //
2 // This file is part of the Marble Virtual Globe.
3 //
4 // This program is free software licensed under the GNU LGPL. You can
5 // find a copy of this license in LICENSE.txt in the top directory of
6 // the source code.
7 //
8 // Copyright 2009 Bastian Holst <bastianholst@gmx.de>
9 // Copyright 2012 Mohammed Nafees <nafees.technocool@gmail.com>
10 //
11 
12 // Own
13 #include "QtMarbleConfigDialog.h"
14 
15 #include "ui_MarbleCacheSettingsWidget.h"
16 #include "ui_MarbleViewSettingsWidget.h"
17 #include "ui_MarbleNavigationSettingsWidget.h"
18 #include "ui_MarbleTimeSettingsWidget.h"
19 #include "ui_MarbleCloudSyncSettingsWidget.h"
20 
21 // Qt
22 #include <QList>
23 #include <QSettings>
24 #include <QNetworkProxy>
25 #include <QApplication>
26 #include <QDialogButtonBox>
27 #include <QMessageBox>
28 #include <QStandardItem>
29 #include <QTabWidget>
30 #include <QVBoxLayout>
31 #include <QWidget>
32 #include <QDateTime>
33 #include <QTimer>
34 
35 // Marble
36 #include "MarbleGlobal.h"
37 #include "DialogConfigurationInterface.h"
38 #include "MarbleDebug.h"
39 #include "MarbleDirs.h"
40 #include "MarblePluginSettingsWidget.h"
41 #include "MarbleLocale.h"
42 #include "MarbleWidget.h"
43 #include "MarbleModel.h"
44 #include "RenderPlugin.h"
45 #include "RenderPluginModel.h"
46 #include "MarbleClock.h"
47 #include "routing/RoutingProfilesWidget.h"
48 #include "BookmarkSyncManager.h"
49 #include "CloudSyncManager.h"
50 
51 namespace Marble
52 {
53 
54 class QtMarbleConfigDialogPrivate
55 {
56  public:
57  QtMarbleConfigDialogPrivate( MarbleWidget *marbleWidget, CloudSyncManager *cloudSyncManager )
58  : ui_viewSettings(),
59  ui_navigationSettings(),
60  ui_timeSettings(),
61  ui_cacheSettings(),
62  w_pluginSettings( 0 ),
63  m_cloudSyncStatusLabel( 0 ),
64  m_marbleWidget( marbleWidget ),
65  m_syncManager( cloudSyncManager ? cloudSyncManager->bookmarkSyncManager() : 0 ),
66  m_cloudSyncManager(cloudSyncManager),
67  m_pluginModel(),
68  m_initialGraphicsSystem(),
69  m_previousGraphicsSystem()
70  {
71  }
72 
73  Ui::MarbleViewSettingsWidget ui_viewSettings;
74  Ui::MarbleNavigationSettingsWidget ui_navigationSettings;
75  Ui::MarbleTimeSettingsWidget ui_timeSettings;
76  Ui::MarbleCacheSettingsWidget ui_cacheSettings;
77  Ui::MarbleCloudSyncSettingsWidget ui_cloudSyncSettings;
78  MarblePluginSettingsWidget *w_pluginSettings;
79 
80  QSettings m_settings;
81 
82  QLabel *m_cloudSyncStatusLabel;
83 
84  MarbleWidget *const m_marbleWidget;
85  BookmarkSyncManager *const m_syncManager;
86  CloudSyncManager *const m_cloudSyncManager;
87 
88  RenderPluginModel m_pluginModel;
89 
90  QHash< int, int > m_timezone;
91 
92  // Information about the graphics system
93  Marble::GraphicsSystem m_initialGraphicsSystem;
94  Marble::GraphicsSystem m_previousGraphicsSystem;
95 };
96 
97 QtMarbleConfigDialog::QtMarbleConfigDialog(MarbleWidget *marbleWidget, CloudSyncManager *cloudSyncManager,
98  QWidget *parent )
99  : QDialog( parent ),
100  d( new QtMarbleConfigDialogPrivate( marbleWidget, cloudSyncManager ) )
101 {
102  QTabWidget *tabWidget = new QTabWidget( this );
103  QDialogButtonBox *buttons =
104  new QDialogButtonBox( QDialogButtonBox::Ok
105  | QDialogButtonBox::Apply
106  | QDialogButtonBox::Cancel,
107  Qt::Horizontal,
108  this );
109 
110  // Connect the signals of the ButtonBox
111  // to the corresponding slots of the dialog.
112  connect( buttons, SIGNAL(accepted()), this, SLOT(accept()) ); // Ok
113  connect( buttons, SIGNAL(rejected()), this, SLOT(reject()) ); // Cancel
114  connect( buttons->button( QDialogButtonBox::Apply ),SIGNAL(clicked()),
115  this, SLOT(writeSettings()) ); // Apply
116  // If the dialog is accepted. Save the settings.
117  connect( this, SIGNAL(accepted()), this, SLOT(writeSettings()) );
118 
119  // view page
120  QWidget *w_viewSettings = new QWidget( this );
121 
122  d->ui_viewSettings.setupUi( w_viewSettings );
123  tabWidget->addTab( w_viewSettings, tr( "View" ) );
124 
125  // It's experimental -- so we remove it for now.
126  // FIXME: Delete the following line once OpenGL support is officially supported.
127  d->ui_viewSettings.kcfg_graphicsSystem->removeItem( Marble::OpenGLGraphics );
128 
129  QString nativeString ( tr("Native") );
130 
131  #ifdef Q_WS_X11
132  nativeString = tr( "Native (X11)" );
133  #endif
134  #ifdef Q_WS_MAC
135  nativeString = tr( "Native (Mac OS X Core Graphics)" );
136  #endif
137 
138  d->ui_viewSettings.kcfg_graphicsSystem->setItemText( Marble::NativeGraphics, nativeString );
139  d->ui_viewSettings.kcfg_labelLocalization->hide();
140  d->ui_viewSettings.label_labelLocalization->hide();
141 
142  // navigation page
143  QWidget *w_navigationSettings = new QWidget( this );
144 
145  d->ui_navigationSettings.setupUi( w_navigationSettings );
146  tabWidget->addTab( w_navigationSettings, tr( "Navigation" ) );
147  d->ui_navigationSettings.kcfg_dragLocation->hide();
148  d->ui_navigationSettings.label_dragLocation->hide();
149 
150  // cache page
151  QWidget *w_cacheSettings = new QWidget( this );
152 
153  d->ui_cacheSettings.setupUi( w_cacheSettings );
154  tabWidget->addTab( w_cacheSettings, tr( "Cache and Proxy" ) );
155  // Forwarding clear button signals
156  connect( d->ui_cacheSettings.button_clearVolatileCache, SIGNAL(clicked()), SIGNAL(clearVolatileCacheClicked()) );
157  connect( d->ui_cacheSettings.button_clearPersistentCache, SIGNAL(clicked()), SIGNAL(clearPersistentCacheClicked()) );
158 
159  // time page
160  QWidget *w_timeSettings = new QWidget( this );
161  d->ui_timeSettings.setupUi( w_timeSettings );
162  tabWidget->addTab( w_timeSettings, tr( "Date and Time" ) );
163 
164  // routing page
165  QWidget *w_routingSettings = new RoutingProfilesWidget( marbleWidget->model() );
166  tabWidget->addTab( w_routingSettings, tr( "Routing" ) );
167 
168  // plugin page
169  d->m_pluginModel.setRenderPlugins( d->m_marbleWidget->renderPlugins() );
170  d->w_pluginSettings = new MarblePluginSettingsWidget( this );
171  d->w_pluginSettings->setModel( &d->m_pluginModel );
172  d->w_pluginSettings->setObjectName( "plugin_page" );
173  tabWidget->addTab( d->w_pluginSettings, tr( "Plugins" ) );
174 
175  // Setting the icons for the plugin dialog.
176  d->w_pluginSettings->setAboutIcon( QIcon(":/icons/help-about.png") );
177  d->w_pluginSettings->setConfigIcon( QIcon(":/icons/settings-configure.png") );
178 
179  connect( this, SIGNAL(rejected()), &d->m_pluginModel, SLOT(retrievePluginState()) );
180  connect( this, SIGNAL(accepted()), &d->m_pluginModel, SLOT(applyPluginState()) );
181 
182  QWidget *w_cloudSyncSettings = new QWidget( this );
183  d->ui_cloudSyncSettings.setupUi( w_cloudSyncSettings );
184  tabWidget->addTab( w_cloudSyncSettings, tr( "Synchronization" ) );
185  d->ui_cloudSyncSettings.button_syncNow->setEnabled( syncBookmarks() );
186  d->m_cloudSyncStatusLabel = d->ui_cloudSyncSettings.cloudSyncStatus;
187  connect( d->ui_cloudSyncSettings.button_syncNow, SIGNAL(clicked()), SIGNAL(syncNowClicked()) );
188  connect( d->ui_cloudSyncSettings.testLoginButton, SIGNAL(clicked()), this, SLOT(updateCloudSyncCredentials()) );
189 
190  if ( d->m_syncManager ) {
191  connect(d->m_syncManager, SIGNAL(syncComplete()), this, SLOT(updateLastSync()));
192  updateLastSync();
193  }
194  if ( d->m_cloudSyncManager ) {
195  connect( d->m_cloudSyncManager, SIGNAL(statusChanged(QString)),
196  this, SLOT(updateCloudSyncStatus(QString)));
197  }
198 
199  // Layout
200  QVBoxLayout *layout = new QVBoxLayout( this );
201  layout->addWidget( tabWidget );
202  layout->addWidget( buttons );
203 
204  this->setLayout( layout );
205 
206  // When the settings have been changed, write to disk.
207  connect( this, SIGNAL(settingsChanged()), this, SLOT(syncSettings()) );
208 
209  initializeCustomTimezone();
210 }
211 
212 QtMarbleConfigDialog::~QtMarbleConfigDialog()
213 {
214  delete d;
215 }
216 
217 void QtMarbleConfigDialog::syncSettings()
218 {
219  d->m_settings.sync();
220 
221  QNetworkProxy proxy;
222 
223  // Make sure that no proxy is used for an empty string or the default value:
224  if ( proxyUrl().isEmpty() || proxyUrl() == "http://" ) {
225  proxy.setType( QNetworkProxy::NoProxy );
226  } else {
227  if ( proxyType() == Marble::Socks5Proxy ) {
228  proxy.setType( QNetworkProxy::Socks5Proxy );
229  }
230  else if ( proxyType() == Marble::HttpProxy ) {
231  proxy.setType( QNetworkProxy::HttpProxy );
232  }
233  else {
234  mDebug() << "Unknown proxy type! Using Http Proxy instead.";
235  proxy.setType( QNetworkProxy::HttpProxy );
236  }
237  }
238 
239  proxy.setHostName( proxyUrl() );
240  proxy.setPort( proxyPort() );
241 
242  if ( proxyAuth() ) {
243  proxy.setUser( proxyUser() );
244  proxy.setPassword( proxyPass() );
245  }
246 
247  QNetworkProxy::setApplicationProxy(proxy);
248 }
249 
250 void QtMarbleConfigDialog::updateCloudSyncCredentials()
251 {
252  if ( d->m_cloudSyncManager ) {
253  d->m_cloudSyncManager->setOwncloudCredentials(
254  d->ui_cloudSyncSettings.kcfg_owncloudServer->text(),
255  d->ui_cloudSyncSettings.kcfg_owncloudUsername->text(),
256  d->ui_cloudSyncSettings.kcfg_owncloudPassword->text() );
257  }
258 }
259 
260 void QtMarbleConfigDialog::disableSyncNow()
261 {
262  if ( !d->m_syncManager ) {
263  return;
264  }
265 
266  d->ui_cloudSyncSettings.button_syncNow->setDisabled(true);
267 
268  QTimer *timeoutTimer = new QTimer(this);
269  connect(timeoutTimer, SIGNAL(timeout()),
270  timeoutTimer, SLOT(stop()));
271  connect(timeoutTimer, SIGNAL(timeout()),
272  this, SLOT(enableSyncNow()));
273 
274  connect(d->m_syncManager, SIGNAL(syncComplete()),
275  this, SLOT(enableSyncNow()));
276  connect(d->m_syncManager, SIGNAL(syncComplete()),
277  timeoutTimer, SLOT(stop()));
278  connect(d->m_syncManager, SIGNAL(syncComplete()),
279  timeoutTimer, SLOT(deleteLater()));
280 
281  timeoutTimer->start(30*1000); // 30 sec
282 }
283 
284 void QtMarbleConfigDialog::enableSyncNow()
285 {
286  if ( !d->m_syncManager ) {
287  return;
288  }
289 
290  d->ui_cloudSyncSettings.button_syncNow->setEnabled(true);
291 }
292 
293 void QtMarbleConfigDialog::updateLastSync()
294 {
295  if ( !d->m_syncManager ) {
296  return;
297  }
298 
299  if (!d->m_syncManager->lastSync().isValid()) {
300  d->ui_cloudSyncSettings.labelLastSync->setText(tr("Never synchronized."));
301  return;
302  }
303 
304  const QString title = tr("Last synchronization: %1")
305  .arg(d->m_syncManager->lastSync().toString());
306 
307  d->ui_cloudSyncSettings.labelLastSync->setText(title);
308 }
309 
310 void QtMarbleConfigDialog::readSettings()
311 {
312  d->m_initialGraphicsSystem = graphicsSystem();
313  d->m_previousGraphicsSystem = d->m_initialGraphicsSystem;
314 
315  // Sync settings to make sure that we read the current settings.
316  syncSettings();
317 
318  // View
319  d->ui_viewSettings.kcfg_distanceUnit->setCurrentIndex( measurementSystem() );
320  d->ui_viewSettings.kcfg_angleUnit->setCurrentIndex( angleUnit() );
321  d->ui_viewSettings.kcfg_stillQuality->setCurrentIndex( stillQuality() );
322  d->ui_viewSettings.kcfg_animationQuality->setCurrentIndex( animationQuality() );
323  d->ui_viewSettings.kcfg_labelLocalization->setCurrentIndex( Marble::Native );
324  d->ui_viewSettings.kcfg_mapFont->setCurrentFont( mapFont() );
325  d->ui_viewSettings.kcfg_graphicsSystem->setCurrentIndex( graphicsSystem() );
326 
327  // Navigation
328  d->ui_navigationSettings.kcfg_dragLocation->setCurrentIndex( Marble::KeepAxisVertically );
329  d->ui_navigationSettings.kcfg_onStartup->setCurrentIndex( onStartup() );
330  d->ui_navigationSettings.kcfg_inertialEarthRotation->setChecked( inertialEarthRotation() );
331  d->ui_navigationSettings.kcfg_animateTargetVoyage->setChecked( animateTargetVoyage() );
332  int editorIndex = 0;
333  if ( externalMapEditor() == "potlatch") {
334  editorIndex = 1;
335  } else if ( externalMapEditor() == "josm") {
336  editorIndex = 2;
337  } else if ( externalMapEditor() == "merkaartor") {
338  editorIndex = 3;
339  }
340  d->ui_navigationSettings.kcfg_externalMapEditor->setCurrentIndex( editorIndex );
341 
342  // Cache
343  d->ui_cacheSettings.kcfg_volatileTileCacheLimit->setValue( volatileTileCacheLimit() );
344  d->ui_cacheSettings.kcfg_persistentTileCacheLimit->setValue( persistentTileCacheLimit() );
345  d->ui_cacheSettings.kcfg_proxyUrl->setText( proxyUrl() );
346  d->ui_cacheSettings.kcfg_proxyPort->setValue( proxyPort() );
347  d->ui_cacheSettings.kcfg_proxyUser->setText( proxyUser() );
348  d->ui_cacheSettings.kcfg_proxyPass->setText( proxyPass() );
349  d->ui_cacheSettings.kcfg_proxyType->setCurrentIndex( proxyType() );
350  d->ui_cacheSettings.kcfg_proxyAuth->setChecked( proxyAuth() );
351 
352  // Time
353  d->ui_timeSettings.kcfg_systemTimezone->setChecked( systemTimezone() );
354  d->ui_timeSettings.kcfg_customTimezone->setChecked( customTimezone() );
355  d->ui_timeSettings.kcfg_chosenTimezone->setCurrentIndex( chosenTimezone() );
356  d->ui_timeSettings.kcfg_utc->setChecked( UTC() );
357  d->ui_timeSettings.kcfg_systemTime->setChecked( systemTime() );
358  d->ui_timeSettings.kcfg_lastSessionTime->setChecked( lastSessionTime() );
359  if( systemTimezone() == true )
360  {
361  QDateTime localTime = QDateTime::currentDateTime().toLocalTime();
362  localTime.setTimeSpec( Qt::UTC );
363  d->m_marbleWidget->model()->setClockTimezone( QDateTime::currentDateTime().toUTC().secsTo( localTime ) );
364  }
365  else if( UTC() == true )
366  {
367  d->m_marbleWidget->model()->setClockTimezone( 0 );
368  }
369  else if( customTimezone() == true )
370  {
371  d->m_marbleWidget->model()->setClockTimezone( d->m_timezone.value( chosenTimezone() ) );
372  }
373 
374  // Routing
375 
376  // ownCloud
377  d->ui_cloudSyncSettings.kcfg_enableSync->setChecked( syncEnabled() );
378  d->ui_cloudSyncSettings.kcfg_syncBookmarks->setChecked( syncBookmarks() );
379  d->ui_cloudSyncSettings.kcfg_syncRoutes->setChecked( syncRoutes() );
380  d->ui_cloudSyncSettings.kcfg_owncloudServer->setText( owncloudServer() );
381  d->ui_cloudSyncSettings.kcfg_owncloudUsername->setText( owncloudUsername() );
382  d->ui_cloudSyncSettings.kcfg_owncloudPassword->setText( owncloudPassword() );
383 
384  // Read the settings of the plugins
385  d->m_marbleWidget->readPluginSettings( d->m_settings );
386 
387  // The settings loaded in the config dialog have been changed.
388  emit settingsChanged();
389 }
390 
391 void QtMarbleConfigDialog::updateCloudSyncStatus( const QString &status )
392 {
393  d->m_cloudSyncStatusLabel->setText(status);
394  CloudSyncManager::Status status_type =
395  d->m_cloudSyncManager ? d->m_cloudSyncManager->status() : CloudSyncManager::Unknown;
396  switch (status_type) {
397  case CloudSyncManager::Success:
398  d->m_cloudSyncStatusLabel->setStyleSheet("QLabel { color : green; }");
399  break;
400  case CloudSyncManager::Error:
401  d->m_cloudSyncStatusLabel->setStyleSheet("QLabel { color : red; }");
402  break;
403  case CloudSyncManager::Unknown:
404  d->m_cloudSyncStatusLabel->setStyleSheet("QLabel { color : grey; }");
405  break;
406  }
407 }
408 
409 void QtMarbleConfigDialog::writeSettings()
410 {
411  syncSettings();
412 
413  // Determining the graphicsSystemString
414  QString graphicsSystemString;
415  switch ( d->ui_viewSettings.kcfg_graphicsSystem->currentIndex() )
416  {
417  case Marble::RasterGraphics :
418  graphicsSystemString = "raster";
419  break;
420  case Marble::OpenGLGraphics :
421  graphicsSystemString = "opengl";
422  break;
423  default:
424  case Marble::NativeGraphics :
425  graphicsSystemString = "native";
426  break;
427  }
428 
429  d->m_settings.beginGroup( "View" );
430  d->m_settings.setValue( "distanceUnit", d->ui_viewSettings.kcfg_distanceUnit->currentIndex() );
431  d->m_settings.setValue( "angleUnit", d->ui_viewSettings.kcfg_angleUnit->currentIndex() );
432  d->m_settings.setValue( "stillQuality", d->ui_viewSettings.kcfg_stillQuality->currentIndex() );
433  d->m_settings.setValue( "animationQuality", d->ui_viewSettings.kcfg_animationQuality->currentIndex() );
434  d->m_settings.setValue( "mapFont", d->ui_viewSettings.kcfg_mapFont->currentFont() );
435  d->m_settings.setValue( "graphicsSystem", graphicsSystemString );
436  d->m_settings.endGroup();
437 
438  d->m_settings.beginGroup( "Navigation" );
439  d->m_settings.setValue( "onStartup", d->ui_navigationSettings.kcfg_onStartup->currentIndex() );
440  d->m_settings.setValue( "inertialEarthRotation", d->ui_navigationSettings.kcfg_inertialEarthRotation->isChecked() );
441  d->m_settings.setValue( "animateTargetVoyage", d->ui_navigationSettings.kcfg_animateTargetVoyage->isChecked() );
442  if( d->ui_navigationSettings.kcfg_externalMapEditor->currentIndex() == 0 ) {
443  d->m_settings.setValue( "externalMapEditor", "" );
444  } else if( d->ui_navigationSettings.kcfg_externalMapEditor->currentIndex() == 1 ) {
445  d->m_settings.setValue( "externalMapEditor", "potlatch" );
446  } else if( d->ui_navigationSettings.kcfg_externalMapEditor->currentIndex() == 2 ) {
447  d->m_settings.setValue( "externalMapEditor", "josm" );
448  } else if( d->ui_navigationSettings.kcfg_externalMapEditor->currentIndex() == 3 ) {
449  d->m_settings.setValue( "externalMapEditor", "merkaartor" );
450  } else {
451  Q_ASSERT( false && "Unexpected index of the external editor setting" );
452  }
453  d->m_settings.endGroup();
454 
455  d->m_settings.beginGroup( "Cache" );
456  d->m_settings.setValue( "volatileTileCacheLimit", d->ui_cacheSettings.kcfg_volatileTileCacheLimit->value() );
457  d->m_settings.setValue( "persistentTileCacheLimit", d->ui_cacheSettings.kcfg_persistentTileCacheLimit->value() );
458  d->m_settings.setValue( "proxyUrl", d->ui_cacheSettings.kcfg_proxyUrl->text() );
459  d->m_settings.setValue( "proxyPort", d->ui_cacheSettings.kcfg_proxyPort->value() );
460  d->m_settings.setValue( "proxyType", d->ui_cacheSettings.kcfg_proxyType->currentIndex() );
461  if ( d->ui_cacheSettings.kcfg_proxyAuth->isChecked() ) {
462  d->m_settings.setValue( "proxyAuth", true );
463  d->m_settings.setValue( "proxyUser", d->ui_cacheSettings.kcfg_proxyUser->text() );
464  d->m_settings.setValue( "proxyPass", d->ui_cacheSettings.kcfg_proxyPass->text() );
465  } else {
466  d->m_settings.setValue( "proxyAuth", false );
467  }
468  d->m_settings.endGroup();
469 
470  d->m_settings.beginGroup( "Time" );
471  d->m_settings.setValue( "systemTimezone", d->ui_timeSettings.kcfg_systemTimezone->isChecked() );
472  d->m_settings.setValue( "UTC", d->ui_timeSettings.kcfg_utc->isChecked() );
473  d->m_settings.setValue( "customTimezone", d->ui_timeSettings.kcfg_customTimezone->isChecked() );
474  d->m_settings.setValue( "systemTime", d->ui_timeSettings.kcfg_systemTime->isChecked() );
475  d->m_settings.setValue( "lastSessionTime", d->ui_timeSettings.kcfg_lastSessionTime->isChecked() );
476  d->m_settings.setValue( "chosenTimezone", d->ui_timeSettings.kcfg_chosenTimezone->currentIndex() );
477  d->m_settings.endGroup();
478 
479  d->m_settings.beginGroup( "CloudSync" );
480  d->m_settings.setValue( "enableSync", d->ui_cloudSyncSettings.kcfg_enableSync->isChecked() );
481  d->m_settings.setValue( "syncBackend", "owncloud" );
482  d->m_settings.setValue( "syncBookmarks", d->ui_cloudSyncSettings.kcfg_syncBookmarks->isChecked() );
483  d->m_settings.setValue( "syncRoutes", d->ui_cloudSyncSettings.kcfg_syncRoutes->isChecked() );
484  d->m_settings.setValue( "owncloudServer", d->ui_cloudSyncSettings.kcfg_owncloudServer->text() );
485  d->m_settings.setValue( "owncloudUsername", d->ui_cloudSyncSettings.kcfg_owncloudUsername->text() );
486  d->m_settings.setValue( "owncloudPassword", d->ui_cloudSyncSettings.kcfg_owncloudPassword->text() );
487  d->m_settings.endGroup();
488 
489  // Plugins
490  d->m_marbleWidget->writePluginSettings( d->m_settings );
491 
492  emit settingsChanged();
493 
494  if ( d->m_initialGraphicsSystem != graphicsSystem()
495  && d->m_previousGraphicsSystem != graphicsSystem() ) {
496  QMessageBox::information (this, tr("Graphics System Change"),
497  tr("You have decided to run Marble with a different graphics system.\n"
498  "For this change to become effective, Marble has to be restarted.\n"
499  "Please close the application and start Marble again.") );
500  }
501  d->m_previousGraphicsSystem = graphicsSystem();
502 }
503 
504 MarbleLocale::MeasurementSystem QtMarbleConfigDialog::measurementSystem() const
505 {
506  if( d->m_settings.contains( "View/distanceUnit" ) ) {
507  return (MarbleLocale::MeasurementSystem)d->m_settings.value( "View/distanceUnit" ).toInt();
508  }
509 
510  MarbleLocale *locale = MarbleGlobal::getInstance()->locale();
511  return locale->measurementSystem();
512 }
513 
514 Marble::AngleUnit QtMarbleConfigDialog::angleUnit() const
515 {
516  return (Marble::AngleUnit) d->m_settings.value( "View/angleUnit", Marble::DMSDegree ).toInt();
517 }
518 
519 Marble::MapQuality QtMarbleConfigDialog::stillQuality() const
520 {
521  return (Marble::MapQuality) d->m_settings.value( "View/stillQuality",
522  Marble::HighQuality ).toInt();
523 }
524 
525 Marble::MapQuality QtMarbleConfigDialog::animationQuality() const
526 {
527  return (Marble::MapQuality) d->m_settings.value( "View/animationQuality",
528  Marble::LowQuality ).toInt();
529 }
530 
531 QFont QtMarbleConfigDialog::mapFont() const
532 {
533  return d->m_settings.value( "View/mapFont", QApplication::font() ).value<QFont>();
534 }
535 
536 Marble::GraphicsSystem QtMarbleConfigDialog::graphicsSystem() const
537 {
538  QString graphicsSystemString = d->m_settings.value( "View/graphicsSystem", "raster" ).toString();
539 
540  if ( graphicsSystemString == "raster" ) return Marble::RasterGraphics;
541  if ( graphicsSystemString == "opengl" ) return Marble::OpenGLGraphics;
542 
543  // default case: graphicsSystemString == "raster"
544  return Marble::NativeGraphics;
545 }
546 
547 int QtMarbleConfigDialog::onStartup() const
548 {
549  bool smallScreen = MarbleGlobal::getInstance()->profiles() & MarbleGlobal::SmallScreen;
550  int defaultValue = smallScreen ? Marble::LastLocationVisited : Marble::ShowHomeLocation;
551  return d->m_settings.value( "Navigation/onStartup", defaultValue ).toInt();
552 }
553 
554 QString QtMarbleConfigDialog::externalMapEditor() const
555 {
556  return d->m_settings.value( "Navigation/externalMapEditor", "" ).toString();
557 }
558 
559 bool QtMarbleConfigDialog::animateTargetVoyage() const
560 {
561  const bool smallScreen = MarbleGlobal::getInstance()->profiles() & MarbleGlobal::SmallScreen;
562  return d->m_settings.value( "Navigation/animateTargetVoyage", smallScreen ).toBool();
563 }
564 
565 bool QtMarbleConfigDialog::inertialEarthRotation() const
566 {
567  return d->m_settings.value( "Navigation/inertialEarthRotation", true ).toBool();
568 }
569 
570 int QtMarbleConfigDialog::volatileTileCacheLimit() const
571 {
572  int defaultValue = MarbleGlobal::getInstance()->profiles() & MarbleGlobal::SmallScreen ? 6 : 100;
573  return d->m_settings.value( "Cache/volatileTileCacheLimit", defaultValue ).toInt();
574 }
575 
576 int QtMarbleConfigDialog::persistentTileCacheLimit() const
577 {
578  return d->m_settings.value( "Cache/persistentTileCacheLimit", 0 ).toInt(); // default to unlimited
579 }
580 
581 QString QtMarbleConfigDialog::proxyUrl() const
582 {
583  return d->m_settings.value( "Cache/proxyUrl", "" ).toString();
584 }
585 
586 int QtMarbleConfigDialog::proxyPort() const
587 {
588  return d->m_settings.value( "Cache/proxyPort", 8080 ).toInt();
589 }
590 
591 QString QtMarbleConfigDialog::proxyUser() const
592 {
593  return d->m_settings.value( "Cache/proxyUser", "" ).toString();
594 }
595 
596 QString QtMarbleConfigDialog::proxyPass() const
597 {
598  return d->m_settings.value( "Cache/proxyPass", "" ).toString();
599 }
600 
601 bool QtMarbleConfigDialog::proxyType() const
602 {
603  return d->m_settings.value( "Cache/proxyType", Marble::HttpProxy ).toInt();
604 }
605 
606 bool QtMarbleConfigDialog::proxyAuth() const
607 {
608  return d->m_settings.value( "Cache/proxyAuth", false ).toBool();
609 }
610 
611 bool QtMarbleConfigDialog::systemTimezone() const
612 {
613  return d->m_settings.value( "Time/systemTimezone", true ).toBool();
614 }
615 
616 bool QtMarbleConfigDialog::customTimezone() const
617 {
618  return d->m_settings.value( "Time/customTimezone", false ).toBool();
619 }
620 
621 bool QtMarbleConfigDialog::UTC() const
622 {
623  return d->m_settings.value( "Time/UTC", false ).toBool();
624 }
625 
626 bool QtMarbleConfigDialog::systemTime() const
627 {
628  return d->m_settings.value( "Time/systemTime", true ).toBool();
629 }
630 
631 bool QtMarbleConfigDialog::lastSessionTime() const
632 {
633  return d->m_settings.value( "Time/lastSessionTime", false ).toBool();
634 }
635 
636 int QtMarbleConfigDialog::chosenTimezone() const
637 {
638  return d->m_settings.value( "Time/chosenTimezone", 0 ).toInt();
639 }
640 
641 void QtMarbleConfigDialog::initializeCustomTimezone()
642 {
643  if( d->m_timezone.count() == 0)
644  {
645  d->m_timezone.insert( 0, 0 );
646  d->m_timezone.insert( 1, 3600 );
647  d->m_timezone.insert( 2, 7200 );
648  d->m_timezone.insert( 3, 7200 );
649  d->m_timezone.insert( 4, 10800 );
650  d->m_timezone.insert( 5, 12600 );
651  d->m_timezone.insert( 6, 14400 );
652  d->m_timezone.insert( 7, 18000 );
653  d->m_timezone.insert( 8, 19800 );
654  d->m_timezone.insert( 9, 21600 );
655  d->m_timezone.insert( 10, 25200 );
656  d->m_timezone.insert( 11, 28800 );
657  d->m_timezone.insert( 12, 32400 );
658  d->m_timezone.insert( 13, 34200 );
659  d->m_timezone.insert( 14, 36000 );
660  d->m_timezone.insert( 15, 39600 );
661  d->m_timezone.insert( 16, 43200 );
662  d->m_timezone.insert( 17, -39600 );
663  d->m_timezone.insert( 18, -36000 );
664  d->m_timezone.insert( 19, -32400 );
665  d->m_timezone.insert( 20, -28800 );
666  d->m_timezone.insert( 21, -25200 );
667  d->m_timezone.insert( 22, -25200 );
668  d->m_timezone.insert( 23, -21600 );
669  d->m_timezone.insert( 24, -18000 );
670  d->m_timezone.insert( 25, -18000 );
671  d->m_timezone.insert( 26, -14400 );
672  d->m_timezone.insert( 27, -12600 );
673  d->m_timezone.insert( 28, -10800 );
674  d->m_timezone.insert( 29, -10800 );
675  d->m_timezone.insert( 30, -3600 );
676  }
677 }
678 
679 bool QtMarbleConfigDialog::syncEnabled() const
680 {
681  return d->m_settings.value( "CloudSync/enableSync", false ).toBool();
682 }
683 
684 QString QtMarbleConfigDialog::syncBackend() const
685 {
686  return d->m_settings.value( "CloudSync/syncBackend", "" ).toString();
687 }
688 
689 bool QtMarbleConfigDialog::syncBookmarks() const
690 {
691  return d->m_settings.value( "CloudSync/syncBookmarks", true ).toBool();
692 }
693 
694 bool QtMarbleConfigDialog::syncRoutes() const
695 {
696  return d->m_settings.value( "CloudSync/syncRoutes", true ).toBool();
697 }
698 
699 QString QtMarbleConfigDialog::owncloudServer() const
700 {
701  return d->m_settings.value( "CloudSync/owncloudServer", "" ).toString();
702 }
703 
704 QString QtMarbleConfigDialog::owncloudUsername() const
705 {
706  return d->m_settings.value( "CloudSync/owncloudUsername", "" ).toString();
707 }
708 
709 QString QtMarbleConfigDialog::owncloudPassword() const
710 {
711  return d->m_settings.value( "CloudSync/owncloudPassword", "" ).toString();
712 }
713 
714 }
715 
716 #include "QtMarbleConfigDialog.moc"
QWidget::layout
QLayout * layout() const
Marble::RasterGraphics
Renders everything onto a pixmap.
Definition: MarbleGlobal.h:95
QWidget
Marble::QtMarbleConfigDialog::clearPersistentCacheClicked
void clearPersistentCacheClicked()
The user clicked on the button to clear persistent tile cache.
Marble::ShowHomeLocation
Show home location on startup.
Definition: MarbleGlobal.h:143
QDialog::reject
virtual void reject()
RenderPluginModel.h
Marble::QtMarbleConfigDialog::animateTargetVoyage
bool animateTargetVoyage() const
Definition: QtMarbleConfigDialog.cpp:559
Marble::QtMarbleConfigDialog::initializeCustomTimezone
void initializeCustomTimezone()
Definition: QtMarbleConfigDialog.cpp:641
Marble::MarbleLocale::measurementSystem
MarbleLocale::MeasurementSystem measurementSystem() const
Definition: MarbleLocale.cpp:45
Marble::QtMarbleConfigDialog::enableSyncNow
void enableSyncNow()
Definition: QtMarbleConfigDialog.cpp:284
MarblePluginSettingsWidget.h
This file contains the multiple inheritance ui-wrapper for the MarblePluginSettingsWidget ui file...
Marble::QtMarbleConfigDialog::proxyPort
int proxyPort() const
Definition: QtMarbleConfigDialog.cpp:586
Marble::KeepAxisVertically
Keep planet axis vertically.
Definition: MarbleGlobal.h:135
Marble::QtMarbleConfigDialog::proxyUser
QString proxyUser() const
Definition: QtMarbleConfigDialog.cpp:591
MarbleModel.h
This file contains the headers for MarbleModel.
QFont
QDialog::rejected
void rejected()
QtMarbleConfigDialog.h
Marble::QtMarbleConfigDialog::owncloudServer
QString owncloudServer() const
Definition: QtMarbleConfigDialog.cpp:699
QNetworkProxy::setUser
void setUser(const QString &user)
QDialog::accepted
void accepted()
Marble::MapQuality
MapQuality
This enum is used to choose the map quality shown in the view.
Definition: MarbleGlobal.h:82
Marble::MarblePluginSettingsWidget
Definition: MarblePluginSettingsWidget.h:39
MarbleDebug.h
Marble::MarbleLocale::MeasurementSystem
MeasurementSystem
Definition: MarbleLocale.h:37
QObject::tr
QString tr(const char *sourceText, const char *disambiguation, int n)
QMessageBox::information
StandardButton information(QWidget *parent, const QString &title, const QString &text, QFlags< QMessageBox::StandardButton > buttons, StandardButton defaultButton)
Marble::OpenGLGraphics
Uses OpenGL.
Definition: MarbleGlobal.h:96
QTabWidget
Marble::QtMarbleConfigDialog::proxyUrl
QString proxyUrl() const
Definition: QtMarbleConfigDialog.cpp:581
Marble::QtMarbleConfigDialog::owncloudPassword
QString owncloudPassword() const
Definition: QtMarbleConfigDialog.cpp:709
Marble::QtMarbleConfigDialog::proxyPass
QString proxyPass() const
Definition: QtMarbleConfigDialog.cpp:596
Marble::NativeGraphics
Uses the native graphics system of the OS.
Definition: MarbleGlobal.h:94
Marble::QtMarbleConfigDialog::onStartup
int onStartup() const
Definition: QtMarbleConfigDialog.cpp:547
Marble::MarbleWidget
A widget class that displays a view of the earth.
Definition: MarbleWidget.h:104
Marble::QtMarbleConfigDialog::updateCloudSyncStatus
void updateCloudSyncStatus(const QString &status)
Show status on cloud sync settings tab.
Definition: QtMarbleConfigDialog.cpp:391
Marble::LowQuality
Low resolution (e.g. interlaced)
Definition: MarbleGlobal.h:84
QDateTime::setTimeSpec
void setTimeSpec(Qt::TimeSpec spec)
QBoxLayout::addWidget
void addWidget(QWidget *widget, int stretch, QFlags< Qt::AlignmentFlag > alignment)
QApplication::font
QFont font()
Marble::QtMarbleConfigDialog::disableSyncNow
void disableSyncNow()
Disable "Sync Now" button while sync or for 30 sec of timout.
Definition: QtMarbleConfigDialog.cpp:260
Marble::QtMarbleConfigDialog::persistentTileCacheLimit
int persistentTileCacheLimit() const
Definition: QtMarbleConfigDialog.cpp:576
QWidget::setLayout
void setLayout(QLayout *layout)
QTimer
Marble::QtMarbleConfigDialog::chosenTimezone
int chosenTimezone() const
Read the value of 'Time/chosenTimezone' key from settings.
Definition: QtMarbleConfigDialog.cpp:636
QHash< int, int >
Marble::MarbleWidget::model
MarbleModel * model()
Return the model that this view shows.
Definition: MarbleWidget.cpp:289
Marble::Native
Display the name in the official language and glyphs of the labeled place.
Definition: MarbleGlobal.h:127
MarbleDirs.h
Marble::QtMarbleConfigDialog::QtMarbleConfigDialog
QtMarbleConfigDialog(MarbleWidget *marbleWidget, CloudSyncManager *syncManager=0, QWidget *parent=0)
Definition: QtMarbleConfigDialog.cpp:97
Marble::CloudSyncManager::Unknown
Definition: CloudSyncManager.h:46
QTabWidget::addTab
int addTab(QWidget *page, const QString &label)
Marble::QtMarbleConfigDialog::inertialEarthRotation
bool inertialEarthRotation() const
Definition: QtMarbleConfigDialog.cpp:565
DialogConfigurationInterface.h
QVBoxLayout
QObject::deleteLater
void deleteLater()
Marble::MarbleGlobal::locale
MarbleLocale * locale() const
Definition: MarbleGlobal.cpp:43
QString
MarbleLocale.h
Marble::QtMarbleConfigDialog::measurementSystem
MarbleLocale::MeasurementSystem measurementSystem() const
Definition: QtMarbleConfigDialog.cpp:504
MarbleGlobal.h
RoutingProfilesWidget.h
Marble::QtMarbleConfigDialog::mapFont
QFont mapFont() const
Definition: QtMarbleConfigDialog.cpp:531
Marble::QtMarbleConfigDialog::~QtMarbleConfigDialog
~QtMarbleConfigDialog()
Definition: QtMarbleConfigDialog.cpp:212
Marble::QtMarbleConfigDialog::proxyAuth
bool proxyAuth() const
Definition: QtMarbleConfigDialog.cpp:606
QDialog::accept
virtual void accept()
QWidget::locale
QLocale locale() const
Marble::CloudSyncManager::Error
Definition: CloudSyncManager.h:46
QSettings
MarbleClock.h
Marble::MarbleGlobal::SmallScreen
Definition: MarbleGlobal.h:287
Marble::MarbleGlobal::getInstance
static MarbleGlobal * getInstance()
Definition: MarbleGlobal.cpp:37
Marble::MarbleLocale
A class that contains all localization stuff for Marble.
Definition: MarbleLocale.h:31
Marble::QtMarbleConfigDialog::customTimezone
bool customTimezone() const
Read the value of 'Time/customTimezone' key from settings.
Definition: QtMarbleConfigDialog.cpp:616
Marble::QtMarbleConfigDialog::syncRoutes
bool syncRoutes() const
Definition: QtMarbleConfigDialog.cpp:694
Marble::LastLocationVisited
Show last location visited on quit.
Definition: MarbleGlobal.h:144
Marble::QtMarbleConfigDialog::syncBackend
QString syncBackend() const
Definition: QtMarbleConfigDialog.cpp:684
Marble::QtMarbleConfigDialog::lastSessionTime
bool lastSessionTime() const
Read the value of 'Time/lastSessionTime' key from settings.
Definition: QtMarbleConfigDialog.cpp:631
QDateTime::currentDateTime
QDateTime currentDateTime()
Marble::CloudSyncManager::Success
Definition: CloudSyncManager.h:46
Marble::QtMarbleConfigDialog::externalMapEditor
QString externalMapEditor() const
Definition: QtMarbleConfigDialog.cpp:554
QNetworkProxy::setPassword
void setPassword(const QString &password)
QNetworkProxy::setType
void setType(QNetworkProxy::ProxyType type)
Marble::HttpProxy
Uses an Http proxy.
Definition: MarbleGlobal.h:103
Marble::DMSDegree
Degrees in DMS notation.
Definition: MarbleGlobal.h:66
Marble::AngleUnit
AngleUnit
This enum is used to choose the unit chosen to measure angles.
Definition: MarbleGlobal.h:65
Marble::HighQuality
High quality (e.g. antialiasing for lines)
Definition: MarbleGlobal.h:86
Marble::QtMarbleConfigDialog::readSettings
void readSettings()
Read settings and update interface.
Definition: QtMarbleConfigDialog.cpp:310
Marble::QtMarbleConfigDialog::systemTimezone
bool systemTimezone() const
Read the value of 'Time/systemTimezone' key from settings.
Definition: QtMarbleConfigDialog.cpp:611
RenderPlugin.h
QDialogButtonBox
Marble::QtMarbleConfigDialog::proxyType
bool proxyType() const
Definition: QtMarbleConfigDialog.cpp:601
Marble::CloudSyncManager::Status
Status
Status enumeration.
Definition: CloudSyncManager.h:46
QWidget::QWidget
QWidget(QWidget *parent, QFlags< Qt::WindowType > f)
Marble::QtMarbleConfigDialog::owncloudUsername
QString owncloudUsername() const
Definition: QtMarbleConfigDialog.cpp:704
Marble::MarbleGlobal::profiles
Profiles profiles() const
Definition: MarbleGlobal.cpp:48
Marble::QtMarbleConfigDialog::updateLastSync
void updateLastSync()
Sets new title for the "Last Sync" label indicator.
Definition: QtMarbleConfigDialog.cpp:293
Marble::Socks5Proxy
Uses a Socks5Proxy.
Definition: MarbleGlobal.h:104
Marble::QtMarbleConfigDialog::settingsChanged
void settingsChanged()
This signal is emitted when when the loaded settings were changed.
QNetworkProxy::setPort
void setPort(quint16 port)
Marble::QtMarbleConfigDialog::syncNowClicked
void syncNowClicked()
The user clicked on the button to manually synchronize bookmarks.
QDialog
Marble::QtMarbleConfigDialog::clearVolatileCacheClicked
void clearVolatileCacheClicked()
The user clicked on the button to clear volatile tile cache.
MarbleWidget.h
This file contains the headers for MarbleWidget.
QTimer::start
void start(int msec)
QDialogButtonBox::button
QPushButton * button(StandardButton which) const
Marble::QtMarbleConfigDialog::systemTime
bool systemTime() const
Read the value of 'Time/systemTime' key from settings.
Definition: QtMarbleConfigDialog.cpp:626
QDateTime::toLocalTime
QDateTime toLocalTime() const
MarbleWidget
Wraps a Marble::MarbleWidget, providing access to important properties and methods.
Definition: MarbleDeclarativeWidget.h:50
Marble::QtMarbleConfigDialog::syncEnabled
bool syncEnabled() const
Definition: QtMarbleConfigDialog.cpp:679
Marble::QtMarbleConfigDialog::UTC
bool UTC() const
Read the value of 'Time/UTC' key from settings.
Definition: QtMarbleConfigDialog.cpp:621
Marble::QtMarbleConfigDialog::writeSettings
void writeSettings()
Write settings to disk.
Definition: QtMarbleConfigDialog.cpp:409
Marble::GraphicsSystem
GraphicsSystem
This enum is used to choose which graphics system Qt is using.
Definition: MarbleGlobal.h:93
QObject::connect
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
Marble::RoutingProfilesWidget
Definition: RoutingProfilesWidget.h:24
QNetworkProxy::setApplicationProxy
void setApplicationProxy(const QNetworkProxy &networkProxy)
QLabel
QNetworkProxy
Marble::CloudSyncManager
Definition: CloudSyncManager.h:24
Marble::QtMarbleConfigDialog::syncBookmarks
bool syncBookmarks() const
Definition: QtMarbleConfigDialog.cpp:689
QString::arg
QString arg(qlonglong a, int fieldWidth, int base, const QChar &fillChar) const
Marble::QtMarbleConfigDialog::angleUnit
Marble::AngleUnit angleUnit() const
Definition: QtMarbleConfigDialog.cpp:514
Marble::QtMarbleConfigDialog::volatileTileCacheLimit
int volatileTileCacheLimit() const
Definition: QtMarbleConfigDialog.cpp:570
CloudSyncManager.h
Marble::QtMarbleConfigDialog::animationQuality
Marble::MapQuality animationQuality() const
Definition: QtMarbleConfigDialog.cpp:525
QNetworkProxy::setHostName
void setHostName(const QString &hostName)
Marble::mDebug
QDebug mDebug()
a function to replace qDebug() in Marble library code
Definition: MarbleDebug.cpp:36
BookmarkSyncManager.h
Marble::QtMarbleConfigDialog::stillQuality
Marble::MapQuality stillQuality() const
Definition: QtMarbleConfigDialog.cpp:519
QIcon
QDateTime
Marble::QtMarbleConfigDialog::graphicsSystem
Marble::GraphicsSystem graphicsSystem() const
Definition: QtMarbleConfigDialog.cpp:536
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:13:41 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

marble

Skip menu "marble"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal