File indexing completed on 2024-04-21 03:49:53

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2009 Bastian Holst <bastianholst@gmx.de>
0004 //
0005 
0006 #ifndef MARBLE_QTMARBLECONFIGDIALOG_H
0007 #define MARBLE_QTMARBLECONFIGDIALOG_H
0008 
0009 #include <QDialog>
0010 
0011 #include "marble_export.h"
0012 #include "MarbleGlobal.h"
0013 #include "MarbleLocale.h"
0014 
0015 namespace Marble
0016 {
0017 
0018 class MarbleWidget;
0019 class CloudSyncManager;
0020 
0021 class QtMarbleConfigDialogPrivate;
0022 
0023 class MARBLE_EXPORT QtMarbleConfigDialog : public QDialog
0024 {
0025     Q_OBJECT
0026     
0027     public:
0028     explicit QtMarbleConfigDialog(MarbleWidget *marbleWidget, CloudSyncManager *syncManager = nullptr,
0029                                    QWidget *parent = nullptr );
0030     ~QtMarbleConfigDialog() override;
0031 
0032     // View Settings
0033     
0034     MarbleLocale::MeasurementSystem measurementSystem() const;
0035     Marble::AngleUnit angleUnit() const;
0036     void setAngleUnit(Marble::AngleUnit unit);
0037     Marble::MapQuality stillQuality() const;
0038     Marble::MapQuality animationQuality() const;
0039     QFont mapFont() const;
0040 
0041     // Navigation Settings
0042     int onStartup() const;
0043     bool animateTargetVoyage() const;
0044     QString externalMapEditor() const;
0045     bool inertialEarthRotation() const;
0046     bool mouseViewRotation() const;
0047 
0048     // Cache Settings
0049     int volatileTileCacheLimit() const;
0050     int persistentTileCacheLimit() const;
0051     QString proxyUrl() const;
0052     int proxyPort() const;
0053 
0054     QString proxyUser() const;
0055     QString proxyPass() const;
0056     bool proxyType() const;
0057     bool proxyAuth() const;
0058 
0059     // Time Settings
0060     /**
0061      * Read the value of 'Time/systemTime' key from settings
0062      */
0063     bool systemTime() const;
0064 
0065     /**
0066      * Read the value of 'Time/lastSessionTime' key from settings
0067      */
0068     bool lastSessionTime() const;
0069 
0070     /**
0071      * Read the value of 'Time/systemTimezone' key from settings
0072      */
0073     bool systemTimezone() const;
0074 
0075     /**
0076      * Read the value of 'Time/UTC' key from settings
0077      */
0078     bool UTC() const;
0079 
0080     /**
0081      * Read the value of 'Time/customTimezone' key from settings
0082      */
0083     bool customTimezone() const;
0084 
0085     /**
0086      * Read the value of 'Time/chosenTimezone' key from settings
0087      */
0088     int chosenTimezone() const;
0089     
0090     void initializeCustomTimezone();
0091     
0092     // CloudSync settings
0093     bool syncEnabled() const;
0094     QString syncBackend() const;
0095     bool syncBookmarks() const;
0096     bool syncRoutes() const;
0097     QString owncloudServer() const;
0098     QString owncloudUsername() const;
0099     QString owncloudPassword() const;
0100 
0101     Q_SIGNALS:
0102     /**
0103      * This signal is emitted when the loaded settings were changed.
0104      * Either by the user or by loading them initially from disk.
0105      */
0106     void settingsChanged();
0107 
0108     /**
0109      * The user clicked on the button to clear volatile tile cache.
0110      */
0111     void clearVolatileCacheClicked();
0112 
0113     /**
0114      * The user clicked on the button to clear persistent tile cache.
0115      */
0116     void clearPersistentCacheClicked();
0117 
0118     /**
0119      * The user clicked on the button to manually synchronize bookmarks.
0120      */
0121     void syncNowClicked();
0122 
0123     public Q_SLOTS:
0124     /**
0125      * Disable "Sync Now" button while sync or for 30 sec of timout
0126      */
0127     void disableSyncNow();
0128     void enableSyncNow();
0129 
0130     /**
0131      * Sets new title for the "Last Sync" label indicator
0132      */
0133     void updateLastSync();
0134 
0135     /**
0136      * Read settings and update interface.
0137      */
0138     void readSettings();
0139 
0140     /**
0141      * Show status on cloud sync settings tab
0142      */
0143     void updateCloudSyncStatus( const QString &status );
0144 
0145     /**
0146      * Write settings to disk.
0147      */
0148     void writeSettings();
0149     
0150     private Q_SLOTS:
0151     /**
0152      * Synchronize the loaded settings with the file on hard disk.
0153      */
0154     void syncSettings();
0155 
0156     void updateCloudSyncCredentials();
0157 
0158     private:
0159     Q_DISABLE_COPY( QtMarbleConfigDialog )
0160 
0161     QtMarbleConfigDialogPrivate * const d;
0162 };
0163 
0164 } // Marble namespace
0165 
0166 #endif