Marble

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

KDE's Doxygen guidelines are available online.