Changeset 206df22 in subsurface


Ignore:
Timestamp:
Jun 23, 2017, 7:49:57 PM (4 weeks ago)
Author:
Dirk Hohndel <dirk@…>
Branches:
master
Children:
94bc7563
Parents:
26b206a
git-author:
Dirk Hohndel <dirk@…> (06/23/17 19:35:48)
git-committer:
Dirk Hohndel <dirk@…> (06/23/17 19:49:57)
Message:

QML UI: remember the theme

Signed-off-by: Dirk Hohndel <dirk@…>

Location:
mobile-widgets
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • mobile-widgets/qml/Preferences.qml

    r26b206a r206df22  
    1818                                manager.distanceThreshold = distanceThreshold.text
    1919                                manager.timeThreshold = timeThreshold.text
     20                                manager.theme = subsurfaceTheme.currentTheme
    2021                                manager.savePreferences()
    2122                                stackView.pop()
  • mobile-widgets/qml/main.qml

    r8ba581a0 r206df22  
    405405
    406406                        // this needs to pick the theme from persistent preference settings
    407                         blueTheme()
     407                        var theme = manager.theme
     408                        if (theme == "Blue")
     409                                blueTheme()
     410                        else if (theme == "Pink")
     411                                pinkTheme()
     412                        else
     413                                darkTheme()
    408414                }
    409415        }
  • mobile-widgets/qmlmanager.cpp

    r57e3652 r206df22  
    12511251}
    12521252
     1253void QMLManager::setTheme(QString theme)
     1254{
     1255        QSettings s;
     1256        s.beginGroup("Theme");
     1257        s.setValue("currentTheme", theme);
     1258        emit themeChanged();
     1259}
     1260
     1261QString QMLManager::theme() const
     1262{
     1263        QSettings s;
     1264        s.beginGroup("Theme");
     1265        return s.value("currentTheme", "Blue").toString();
     1266}
     1267
    12531268bool QMLManager::loadFromCloud() const
    12541269{
  • mobile-widgets/qmlmanager.h

    r57e3652 r206df22  
    2626        Q_PROPERTY(int distanceThreshold READ distanceThreshold WRITE setDistanceThreshold NOTIFY distanceThresholdChanged)
    2727        Q_PROPERTY(int timeThreshold READ timeThreshold WRITE setTimeThreshold NOTIFY timeThresholdChanged)
     28        Q_PROPERTY(QString theme READ theme WRITE setTheme NOTIFY themeChanged)
    2829        Q_PROPERTY(bool loadFromCloud READ loadFromCloud WRITE setLoadFromCloud NOTIFY loadFromCloudChanged)
    2930        Q_PROPERTY(QString startPageText READ startPageText WRITE setStartPageText NOTIFY startPageTextChanged)
     
    7980        int timeThreshold() const;
    8081        void setTimeThreshold(int time);
     82
     83        QString theme() const;
     84        void setTheme(QString theme);
    8185
    8286        bool loadFromCloud() const;
     
    210214        void logTextChanged();
    211215        void timeThresholdChanged();
     216        void themeChanged();
    212217        void distanceThresholdChanged();
    213218        void loadFromCloudChanged();
Note: See TracChangeset for help on using the changeset viewer.