Marble

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

KDE's Doxygen guidelines are available online.