mobile-widgets: switch to new subsurfaceTheme

Remove subsurfaceTheme from main.qml
Replace ThemeNew -> subsurfaceTheme
change registration ThemeNew -> subsurfaceTheme

Signed-off-by: jan Iversen <jan@casacondor.com>
This commit is contained in:
jan Iversen 2020-01-15 09:40:54 +01:00 committed by Dirk Hohndel
parent 38120d555f
commit 35de9c49a4
5 changed files with 8 additions and 32 deletions

View file

@ -188,8 +188,8 @@ Kirigami.Page {
actions.main: Kirigami.Action { actions.main: Kirigami.Action {
icon { icon {
name: state !== "view" ? ThemeNew.iconStyle + "/document-save.svg" : name: state !== "view" ? subsurfaceTheme.iconStyle + "/document-save.svg" :
ThemeNew.iconStyle + "/document-edit.svg" subsurfaceTheme.iconStyle + "/document-edit.svg"
color: subsurfaceTheme.primaryColor color: subsurfaceTheme.primaryColor
} }
text: state !== "view" ? qsTr("Save edits") : qsTr("Edit dive") text: state !== "view" ? qsTr("Save edits") : qsTr("Edit dive")

View file

@ -145,15 +145,15 @@ TemplatePage {
TemplateComboBox { TemplateComboBox {
editable: false editable: false
Layout.columnSpan: 2 Layout.columnSpan: 2
currentIndex: (ThemeNew.currentTheme === "Blue") ? 0 : currentIndex: (subsurfaceTheme.currentTheme === "Blue") ? 0 :
(ThemeNew.currentTheme === "Pink") ? 1 : 2 (subsurfaceTheme.currentTheme === "Pink") ? 1 : 2
model: ListModel { model: ListModel {
ListElement {text: qsTr("Blue")} ListElement {text: qsTr("Blue")}
ListElement {text: qsTr("Pink")} ListElement {text: qsTr("Pink")}
ListElement {text: qsTr("Dark")} ListElement {text: qsTr("Dark")}
} }
onActivated: { onActivated: {
ThemeNew.currentTheme = currentIndex === 0 ? "Blue" : subsurfaceTheme.currentTheme = currentIndex === 0 ? "Blue" :
currentIndex === 1 ? "Pink" : "Dark" currentIndex === 1 ? "Pink" : "Dark"
} }
} }

View file

@ -69,7 +69,7 @@ Kirigami.Page {
text: "basePointSize:" text: "basePointSize:"
} }
Controls.Label { Controls.Label {
text: ThemeNew.basePointSize text: subsurfaceTheme.basePointSize
} }
Controls.Label { Controls.Label {

View file

@ -563,7 +563,7 @@ if you have network connectivity and want to sync your data to cloud storage."),
] // end actions ] // end actions
Image { Image {
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
source: "qrc:///icons/" + (ThemeNew.currentTheme !== "" ? ThemeNew.currentTheme : "Blue") + "_gps.svg" source: "qrc:///icons/" + (subsurfaceTheme.currentTheme !== "" ? subsurfaceTheme.currentTheme : "Blue") + "_gps.svg"
visible: locationServiceEnabled visible: locationServiceEnabled
} }
} }
@ -607,30 +607,6 @@ if you have network connectivity and want to sync your data to cloud storage."),
} }
} }
QtObject {
id: subsurfaceTheme
property double regularPointSize: ThemeNew.regularPointSize
property double titlePointSize: ThemeNew.titlePointSize
property double headingPointSize: ThemeNew.headingPointSize
property double smallPointSize: ThemeNew.smallPointSize
// colors currently in use
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
}
onWidthChanged: { onWidthChanged: {
manager.appendTextToLog("Window width changed to " + width + " orientation " + Screen.primaryOrientation) manager.appendTextToLog("Window width changed to " + width + " orientation " + Screen.primaryOrientation)
if (placeHolder.initialWidth !== undefined) { if (placeHolder.initialWidth !== undefined) {

View file

@ -74,7 +74,7 @@ themeInterface *themeInterface::instance()
void themeInterface::setup(QQmlContext *ct) void themeInterface::setup(QQmlContext *ct)
{ {
// Register interface class // Register interface class
ct->setContextProperty("ThemeNew", instance()); ct->setContextProperty("subsurfaceTheme", instance());
// get current theme // get current theme
m_currentTheme = qPrefDisplay::theme(); m_currentTheme = qPrefDisplay::theme();