mirror of
https://github.com/subsurface/subsurface.git
synced 2024-12-03 15:43:09 +00:00
QML UI: remember the theme
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
26b206af1f
commit
206df227f8
4 changed files with 28 additions and 1 deletions
|
@ -17,6 +17,7 @@ Kirigami.Page {
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
manager.distanceThreshold = distanceThreshold.text
|
manager.distanceThreshold = distanceThreshold.text
|
||||||
manager.timeThreshold = timeThreshold.text
|
manager.timeThreshold = timeThreshold.text
|
||||||
|
manager.theme = subsurfaceTheme.currentTheme
|
||||||
manager.savePreferences()
|
manager.savePreferences()
|
||||||
stackView.pop()
|
stackView.pop()
|
||||||
}
|
}
|
||||||
|
|
|
@ -404,7 +404,13 @@ Kirigami.ApplicationWindow {
|
||||||
Kirigami.Theme.buttonHoverColor = Qt.binding(function() { return darkerPrimaryColor })
|
Kirigami.Theme.buttonHoverColor = Qt.binding(function() { return darkerPrimaryColor })
|
||||||
|
|
||||||
// this needs to pick the theme from persistent preference settings
|
// this needs to pick the theme from persistent preference settings
|
||||||
|
var theme = manager.theme
|
||||||
|
if (theme == "Blue")
|
||||||
blueTheme()
|
blueTheme()
|
||||||
|
else if (theme == "Pink")
|
||||||
|
pinkTheme()
|
||||||
|
else
|
||||||
|
darkTheme()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
property Item stackView: pageStack
|
property Item stackView: pageStack
|
||||||
|
|
|
@ -1250,6 +1250,21 @@ void QMLManager::setTimeThreshold(int time)
|
||||||
emit timeThresholdChanged();
|
emit timeThresholdChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QMLManager::setTheme(QString theme)
|
||||||
|
{
|
||||||
|
QSettings s;
|
||||||
|
s.beginGroup("Theme");
|
||||||
|
s.setValue("currentTheme", theme);
|
||||||
|
emit themeChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
QString QMLManager::theme() const
|
||||||
|
{
|
||||||
|
QSettings s;
|
||||||
|
s.beginGroup("Theme");
|
||||||
|
return s.value("currentTheme", "Blue").toString();
|
||||||
|
}
|
||||||
|
|
||||||
bool QMLManager::loadFromCloud() const
|
bool QMLManager::loadFromCloud() const
|
||||||
{
|
{
|
||||||
return m_loadFromCloud;
|
return m_loadFromCloud;
|
||||||
|
|
|
@ -25,6 +25,7 @@ class QMLManager : public QObject {
|
||||||
Q_PROPERTY(bool locationServiceAvailable READ locationServiceAvailable WRITE setLocationServiceAvailable NOTIFY locationServiceAvailableChanged)
|
Q_PROPERTY(bool locationServiceAvailable READ locationServiceAvailable WRITE setLocationServiceAvailable NOTIFY locationServiceAvailableChanged)
|
||||||
Q_PROPERTY(int distanceThreshold READ distanceThreshold WRITE setDistanceThreshold NOTIFY distanceThresholdChanged)
|
Q_PROPERTY(int distanceThreshold READ distanceThreshold WRITE setDistanceThreshold NOTIFY distanceThresholdChanged)
|
||||||
Q_PROPERTY(int timeThreshold READ timeThreshold WRITE setTimeThreshold NOTIFY timeThresholdChanged)
|
Q_PROPERTY(int timeThreshold READ timeThreshold WRITE setTimeThreshold NOTIFY timeThresholdChanged)
|
||||||
|
Q_PROPERTY(QString theme READ theme WRITE setTheme NOTIFY themeChanged)
|
||||||
Q_PROPERTY(bool loadFromCloud READ loadFromCloud WRITE setLoadFromCloud NOTIFY loadFromCloudChanged)
|
Q_PROPERTY(bool loadFromCloud READ loadFromCloud WRITE setLoadFromCloud NOTIFY loadFromCloudChanged)
|
||||||
Q_PROPERTY(QString startPageText READ startPageText WRITE setStartPageText NOTIFY startPageTextChanged)
|
Q_PROPERTY(QString startPageText READ startPageText WRITE setStartPageText NOTIFY startPageTextChanged)
|
||||||
Q_PROPERTY(bool verboseEnabled READ verboseEnabled WRITE setVerboseEnabled NOTIFY verboseEnabledChanged)
|
Q_PROPERTY(bool verboseEnabled READ verboseEnabled WRITE setVerboseEnabled NOTIFY verboseEnabledChanged)
|
||||||
|
@ -79,6 +80,9 @@ public:
|
||||||
int timeThreshold() const;
|
int timeThreshold() const;
|
||||||
void setTimeThreshold(int time);
|
void setTimeThreshold(int time);
|
||||||
|
|
||||||
|
QString theme() const;
|
||||||
|
void setTheme(QString theme);
|
||||||
|
|
||||||
bool loadFromCloud() const;
|
bool loadFromCloud() const;
|
||||||
void setLoadFromCloud(bool done);
|
void setLoadFromCloud(bool done);
|
||||||
void syncLoadFromCloud();
|
void syncLoadFromCloud();
|
||||||
|
@ -209,6 +213,7 @@ signals:
|
||||||
void verboseEnabledChanged();
|
void verboseEnabledChanged();
|
||||||
void logTextChanged();
|
void logTextChanged();
|
||||||
void timeThresholdChanged();
|
void timeThresholdChanged();
|
||||||
|
void themeChanged();
|
||||||
void distanceThresholdChanged();
|
void distanceThresholdChanged();
|
||||||
void loadFromCloudChanged();
|
void loadFromCloudChanged();
|
||||||
void startPageTextChanged();
|
void startPageTextChanged();
|
||||||
|
|
Loading…
Reference in a new issue