Implement inverted theme mode
authorLuciano Montanaro <mikelima@cirulla.net>
Sun, 29 Sep 2013 11:26:48 +0000 (13:26 +0200)
committerLuciano Montanaro <mikelima@cirulla.net>
Sun, 29 Sep 2013 11:26:48 +0000 (13:26 +0200)
Implement the theme switching, dark background color tweaked.

application/resources/harmattan/qml/AboutPage.qml
application/resources/harmattan/qml/StationListPage.qml
application/resources/harmattan/qml/StationPage.qml
application/resources/harmattan/qml/StationScheduleDelegate.qml
application/resources/harmattan/qml/main.qml

index f2edfed..273ce34 100644 (file)
@@ -7,7 +7,10 @@ Page {
 
     tools: ToolBarLayout {
         id: toolBar
-        ToolIcon { iconId: "icon-m-toolbar-back"; onClicked: pageStack.pop(); }
+        ToolIcon {
+            iconId: "icon-m-toolbar-back" + (theme.inverted ? "-white": "")
+            onClicked: pageStack.pop()
+        }
     }
     PageHeader {
         id: header
@@ -28,7 +31,7 @@ Page {
                    "Quando Parte" + "</a></h2>" +"<p style='font-size:small;'>version ") +
               settings.versionString +
               qsTr("</p>" +
-                   "<p>Copyright (c) 2010, 2011, 2012</p>" +
+                   "<p>Copyright (c) 2010, 2011, 2012, 2013</p>" +
                    "<p>Luciano Montanaro " +
                    "(<a href='mailto:mikelima@cirulla.net'>mikelima@cirulla.net</a>)</p>" +
                    "<p>Licensed under the GNU Public License v2 or above</p>" +
index feff382..04751c3 100644 (file)
@@ -10,8 +10,14 @@ Page {
     id: stationListPage
     tools: ToolBarLayout {
         id: toolBar
-        ToolIcon { iconId: "icon-m-toolbar-search"; onClicked: searchField.open = !searchField.open; }
-        ToolIcon { iconId: "icon-m-toolbar-view-menu"; onClicked: menu.open() }
+        ToolIcon {
+            iconId: "icon-m-toolbar-search" + (theme.inverted ? "-white": "")
+            onClicked: searchField.open = !searchField.open
+        }
+        ToolIcon {
+            iconId: "icon-m-toolbar-view-menu" + (theme.inverted ? "-white": "")
+            onClicked: menu.open()
+        }
     }
     Menu {
         id: menu
@@ -25,6 +31,7 @@ Page {
                         right: parent.right
                         rightMargin: UiConstants.DefaultMargin
                     }
+                    checked: settings.autoUpdate
                     onCheckedChanged: settings.autoUpdate = checked
                 }
             }
@@ -37,7 +44,11 @@ Page {
                         right: parent.right
                         rightMargin: UiConstants.DefaultMargin
                     }
-                    onCheckedChanged: settings.useDarkTheme = checked
+                    checked: settings.darkThemePreferred
+                    onCheckedChanged: {
+                        settings.darkThemePreferred = checked
+                        theme.inverted = checked
+                    }
                 }
             }
             MenuItem {
@@ -103,7 +114,7 @@ Page {
                     anchors.fill: parent
                     // Fill page borders
                     visible: mouseArea.pressed
-                    source: "image://theme/meegotouch-list-fullwidth-background-pressed"
+                    source: "image://theme/meegotouch-list-fullwidth-" + (theme.inverted ? "inverted-" : "") + "background-pressed"
                 }
                 Row {
                     anchors.fill: parent
@@ -126,7 +137,7 @@ Page {
                         left: parent.left
                         right: parent.right
                     }
-                    source: "image://theme/meegotouch-separator-background-horizontal"
+                    source: "image://theme/meegotouch-separator-" + (theme.inverted ? "inverted-" : "") + "background-horizontal"
                 }
                 MouseArea {
                     id: mouseArea
index 14acf25..cce8f3e 100644 (file)
@@ -9,9 +9,17 @@ Page {
 
     tools: ToolBarLayout {
         id: toolBar
-        ToolIcon { iconId: "icon-m-toolbar-back"; onClicked: pageStack.pop() }
-        ToolIcon { iconId: "icon-m-toolbar-refresh"; onClicked: updateStation() }
-        ToolIcon { iconId: "icon-m-toolbar-view-menu"; onClicked: menu.open() }
+        ToolIcon {
+            iconId: "icon-m-toolbar-back" + (theme.inverted ? "-white": "")
+            onClicked: pageStack.pop()
+        }
+        ToolIcon {
+            iconId: "icon-m-toolbar-refresh" + (theme.inverted ? "-white": "")
+            onClicked: updateStation() }
+        ToolIcon {
+            iconId: "icon-m-toolbar-view-menu" + (theme.inverted ? "-white": "")
+            onClicked: menu.open()
+        }
     }
     PageHeader {
         id: header
index 1ffda9f..1fdf75d 100644 (file)
@@ -23,7 +23,7 @@ Item {
         anchors.fill: parent
         // Fill page borders
         visible: mouseArea.pressed
-        source: "image://theme/meegotouch-list-background-pressed-center"
+        source: "image://theme/meegotouch-list-fullwidth-" + (theme.inverted ? "inverted-" : "") + "background-pressed"
     }
     Item {
         id: bodyRow
@@ -119,7 +119,7 @@ Item {
             left: parent.left
             right: parent.right
         }
-        source: "image://theme/meegotouch-separator-background-horizontal"
+        source: "image://theme/meegotouch-separator-"+ (theme.inverted ? "inverted-" : "") + "background-horizontal"
     }
     MouseArea {
         id: mouseArea
@@ -135,11 +135,11 @@ Item {
         if (actual === "--") {
             return qsTr("Platform %1").arg(expected)
         } else if (actual === expected || expected === "--") {
-            return qsTr("Platform <span style='font-weight:bold;color:#080'>%2</span>").arg(actual)
+            return qsTr("Platform <span style='font-weight:bold;color:%2'>%1</span>").arg(actual).arg(theme.inverted ? "#0f0" : "#080")
         } else {
             return qsTr("Platform " +
                         "<span style='text-decoration:line-through'>%1</span> " +
-                        "<span style='font-weight:bold;color:#800'>%2</span>").arg(expected).arg(actual)
+                        "<span style='font-weight:bold;color:%3'>%2</span>").arg(expected).arg(actual).arg(theme.inverted ? "#f00" : "#800")
         }
     }
 }
index 89eafab..698414d 100644 (file)
@@ -6,8 +6,17 @@ PageStackWindow {
     id: window
     showToolBar: true
     showStatusBar: screen.currentOrientation === Screen.Landscape ? false : true
+/*
+    platformStyle: PageStackWindowStyle {
+        background: "image://theme/meegotouch-applicationpage" +
+                    (screen.currentOrientation === Screen.Landscape ? "" : "-portrait") +
+                    "-background" +
+                    (theme.inverted ? "-inverted" : "")
+    }
+*/
     initialPage: StationListPage {
     }
+
     AlignedTimer {
         id: updateTimer
         minimumInterval: 120
@@ -15,5 +24,7 @@ PageStackWindow {
     }
     Component.onCompleted: {
         if (settings.checkingInterval > 0) updateTimer.start()
+        theme.inverted = settings.darkThemePreferred
+        theme.colorScheme = 3
     }
 }