diff options
author | jan Iversen <jan@casacondor.com> | 2020-01-13 18:18:22 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2020-01-26 16:42:35 -0800 |
commit | df9164f7e545ff2bcd19826240a4ec1aac409c4d (patch) | |
tree | 60e4f793c09cb7a335693e2bc2aa08fa7cbbe772 | |
parent | 3c93ee862b712e1238a9ceacff2c7178fd9c16d1 (diff) | |
download | subsurface-df9164f7e545ff2bcd19826240a4ec1aac409c4d.tar.gz |
mobile-widgets/qml: integrate ThemeNew in qml
Update Settings to use ThemeNew (for theme change)
Reduce subsurfaceTheme in main
Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | mobile-widgets/qml/DiveDetails.qml | 4 | ||||
-rw-r--r-- | mobile-widgets/qml/main.qml | 141 |
2 files changed, 15 insertions, 130 deletions
diff --git a/mobile-widgets/qml/DiveDetails.qml b/mobile-widgets/qml/DiveDetails.qml index a94de4f51..5f6e6a823 100644 --- a/mobile-widgets/qml/DiveDetails.qml +++ b/mobile-widgets/qml/DiveDetails.qml @@ -188,8 +188,8 @@ Kirigami.Page { actions.main: Kirigami.Action { icon { - name: state !== "view" ? ":/icons" + subsurfaceTheme.iconStyle + "/document-save.svg" : - ":/icons" + subsurfaceTheme.iconStyle + "/document-edit.svg" + name: state !== "view" ? ThemeNew.iconStyle + "/document-save.svg" : + ThemeNew.iconStyle + "/document-edit.svg" color: subsurfaceTheme.primaryColor } text: state !== "view" ? qsTr("Save edits") : qsTr("Edit dive") diff --git a/mobile-widgets/qml/main.qml b/mobile-widgets/qml/main.qml index 11fcad171..f914cf205 100644 --- a/mobile-widgets/qml/main.qml +++ b/mobile-widgets/qml/main.qml @@ -560,71 +560,11 @@ if you have network connectivity and want to sync your data to cloud storage."), ] // end actions Image { fillMode: Image.PreserveAspectFit - source: "qrc:///icons/" + (subsurfaceTheme.currentTheme != "" ? subsurfaceTheme.currentTheme : "Blue") + "_gps.svg" + source: "qrc:///icons/" + (ThemeNew.currentTheme !== "" ? ThemeNew.currentTheme : "Blue") + "_gps.svg" visible: locationServiceEnabled } } - function blueTheme() { - Material.theme = Material.Light - Material.accent = subsurfaceTheme.bluePrimaryColor - subsurfaceTheme.currentTheme = "Blue" - subsurfaceTheme.darkerPrimaryColor = subsurfaceTheme.blueDarkerPrimaryColor - subsurfaceTheme.darkerPrimaryTextColor= subsurfaceTheme.blueDarkerPrimaryTextColor - subsurfaceTheme.primaryColor = subsurfaceTheme.bluePrimaryColor - subsurfaceTheme.primaryTextColor = subsurfaceTheme.bluePrimaryTextColor - subsurfaceTheme.lightPrimaryColor = subsurfaceTheme.blueLightPrimaryColor - subsurfaceTheme.lightPrimaryTextColor = subsurfaceTheme.blueLightPrimaryTextColor - subsurfaceTheme.backgroundColor = subsurfaceTheme.blueBackgroundColor - subsurfaceTheme.textColor = subsurfaceTheme.blueTextColor - subsurfaceTheme.secondaryTextColor = subsurfaceTheme.blueSecondaryTextColor - manager.setStatusbarColor(subsurfaceTheme.darkerPrimaryColor) - subsurfaceTheme.drawerColor = subsurfaceTheme.blueLightDrawerColor - subsurfaceTheme.contrastAccentColor = subsurfaceTheme.blueContrastAccentColor - subsurfaceTheme.lightDrawerColor = subsurfaceTheme.blueLightDrawerColor - subsurfaceTheme.iconStyle = "-dark" - } - - function pinkTheme() { - Material.theme = Material.Light - Material.accent = subsurfaceTheme.pinkPrimaryColor - subsurfaceTheme.currentTheme = "Pink" - subsurfaceTheme.darkerPrimaryColor = subsurfaceTheme.pinkDarkerPrimaryColor - subsurfaceTheme.darkerPrimaryTextColor = subsurfaceTheme.pinkDarkerPrimaryTextColor - subsurfaceTheme.primaryColor = subsurfaceTheme.pinkPrimaryColor - subsurfaceTheme.primaryTextColor = subsurfaceTheme.pinkPrimaryTextColor - subsurfaceTheme.lightPrimaryColor = subsurfaceTheme.pinkLightPrimaryColor - subsurfaceTheme.lightPrimaryTextColor = subsurfaceTheme.pinkLightPrimaryTextColor - subsurfaceTheme.backgroundColor = subsurfaceTheme.pinkBackgroundColor - subsurfaceTheme.textColor = subsurfaceTheme.pinkTextColor - subsurfaceTheme.secondaryTextColor = subsurfaceTheme.pinkSecondaryTextColor - manager.setStatusbarColor(subsurfaceTheme.darkerPrimaryColor) - subsurfaceTheme.drawerColor = subsurfaceTheme.pinkLightDrawerColor - subsurfaceTheme.contrastAccentColor = subsurfaceTheme.pinkContrastAccentColor - subsurfaceTheme.lightDrawerColor = subsurfaceTheme.pinkLightDrawerColor - subsurfaceTheme.iconStyle = "" - } - - function darkTheme() { - Material.theme = Material.Dark - Material.accent = subsurfaceTheme.darkPrimaryColor - subsurfaceTheme.currentTheme = "Dark" - subsurfaceTheme.darkerPrimaryColor = subsurfaceTheme.darkDarkerPrimaryColor - subsurfaceTheme.darkerPrimaryTextColor= subsurfaceTheme.darkDarkerPrimaryTextColor - subsurfaceTheme.primaryColor = subsurfaceTheme.darkPrimaryColor - subsurfaceTheme.primaryTextColor = subsurfaceTheme.darkPrimaryTextColor - subsurfaceTheme.lightPrimaryColor = subsurfaceTheme.darkLightPrimaryColor - subsurfaceTheme.lightPrimaryTextColor = subsurfaceTheme.darkLightPrimaryTextColor - subsurfaceTheme.backgroundColor = subsurfaceTheme.darkBackgroundColor - subsurfaceTheme.textColor = subsurfaceTheme.darkTextColor - subsurfaceTheme.secondaryTextColor = subsurfaceTheme.darkSecondaryTextColor - manager.setStatusbarColor(subsurfaceTheme.darkerPrimaryColor) - subsurfaceTheme.drawerColor = subsurfaceTheme.darkDrawerColor - subsurfaceTheme.contrastAccentColor = subsurfaceTheme.darkContrastAccentColor - subsurfaceTheme.lightDrawerColor = subsurfaceTheme.darkLightDrawerColor - subsurfaceTheme.iconStyle = "-dark" - } - function setupUnits() { // some screens are too narrow for Subsurface-mobile to render well // try to hack around that by making sure that we can fit at least 21 gridUnits in a row @@ -667,65 +607,19 @@ if you have network connectivity and want to sync your data to cloud storage."), property double headingPointSize: regularPointSize * 1.2 property double smallPointSize: regularPointSize * 0.8 - // icon Theme - property string iconStyle: "" - // colors currently in use - property string currentTheme - property color darkerPrimaryColor - property color darkerPrimaryTextColor - property color primaryColor - property color primaryTextColor - property color lightPrimaryColor - property color lightPrimaryTextColor - property color backgroundColor - property color textColor - property color secondaryTextColor - property color drawerColor - property color contrastAccentColor: "#FF5722" // used for delete button - property color lightDrawerColor: "#FFFFFF" - - // colors for the blue theme - property color blueDarkerPrimaryColor: "#303F9f" - property color blueDarkerPrimaryTextColor: "#ECECEC" - property color bluePrimaryColor: "#3F51B5" - property color bluePrimaryTextColor: "#FFFFFF" - property color blueLightPrimaryColor: "#C5CAE9" - property color blueLightPrimaryTextColor: "#212121" - property color blueBackgroundColor: "#eff0f1" - property color blueTextColor: blueLightPrimaryTextColor - property color blueSecondaryTextColor: "#757575" - property color blueLightDrawerColor: "#FFFFFF" - property color blueDrawerColor: blueLightDrawerColor - property color blueContrastAccentColor: "#FF5722" // used for delete button - - // colors for the pink theme - property color pinkDarkerPrimaryColor: "#C2185B" - property color pinkDarkerPrimaryTextColor: "#ECECEC" - property color pinkPrimaryColor: "#FF69B4" - property color pinkPrimaryTextColor: "#212121" - property color pinkLightPrimaryColor: "#FFDDF4" - property color pinkLightPrimaryTextColor: "#212121" - property color pinkBackgroundColor: "#eff0f1" - property color pinkTextColor: pinkLightPrimaryTextColor - property color pinkSecondaryTextColor: "#757575" - property color pinkLightDrawerColor: "#FFFFFF" - property color pinkDrawerColor: pinkLightDrawerColor - property color pinkContrastAccentColor: "#FF5722" // used for delete button - - // colors for the dark theme - property color darkDarkerPrimaryColor: "#303F9f" - property color darkDarkerPrimaryTextColor: "#ECECEC" - property color darkPrimaryColor: "#3F51B5" - property color darkPrimaryTextColor: "#ECECEC" - property color darkLightPrimaryColor: "#C5CAE9" - property color darkLightPrimaryTextColor: "#ECECEC" - property color darkBackgroundColor: "#303030" - property color darkTextColor: darkPrimaryTextColor - property color darkSecondaryTextColor: "#757575" - property color darkDrawerColor: "#424242" - property color darkLightDrawerColor: "#FFFFFF" - property color darkContrastAccentColor: "#FF5722" // used for delete button + property color darkerPrimaryColor: ThemeNew.darkerPrimaryColor + property color darkerPrimaryTextColor: ThemeNew.darkerPrimaryTextColor + property color primaryColor: ThemeNew.primaryColor + property color primaryTextColor: ThemeNew.primaryTextColor + property color lightPrimaryColor: ThemeNew.lightPrimaryColor + property color lightPrimaryTextColor: ThemeNew.lightPrimaryTextColor + property color backgroundColor: ThemeNew.backgroundColor + property color textColor: ThemeNew.textColor + property color secondaryTextColor: ThemeNew.secondaryTextColor + property color drawerColor: ThemeNew.drawerColor + property color contrastAccentColor: ThemeNew.contrastAccentColor + property color lightDrawerColor: ThemeNew.lightDrawerColor property int initialWidth: rootItem.width property int initialHeight: rootItem.height @@ -738,15 +632,6 @@ if you have network connectivity and want to sync your data to cloud storage."), setupUnits() // but don't count this as a change (after all, it's not) else manager.appendTextToLog("Already adjusted size, ignoring this") - - // this needs to pick the theme from persistent preference settings - var theme = PrefDisplay.theme - if (theme === "Blue") - blueTheme() - else if (theme === "Pink") - pinkTheme() - else - darkTheme() } } |