From 13896d0c29caadfc20949cec0ce95045af66cde8 Mon Sep 17 00:00:00 2001 From: Luciano Montanaro Date: Sun, 29 Sep 2013 13:26:48 +0200 Subject: [PATCH] Implement inverted theme mode Implement the theme switching, dark background color tweaked. --- application/resources/harmattan/qml/AboutPage.qml | 7 +++++-- .../resources/harmattan/qml/StationListPage.qml | 21 +++++++++++++++----- .../resources/harmattan/qml/StationPage.qml | 14 ++++++++++--- .../harmattan/qml/StationScheduleDelegate.qml | 8 ++++---- application/resources/harmattan/qml/main.qml | 11 ++++++++++ 5 files changed, 47 insertions(+), 14 deletions(-) diff --git a/application/resources/harmattan/qml/AboutPage.qml b/application/resources/harmattan/qml/AboutPage.qml index f2edfed..273ce34 100644 --- a/application/resources/harmattan/qml/AboutPage.qml +++ b/application/resources/harmattan/qml/AboutPage.qml @@ -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" + "" +"

version ") + settings.versionString + qsTr("

" + - "

Copyright (c) 2010, 2011, 2012

" + + "

Copyright (c) 2010, 2011, 2012, 2013

" + "

Luciano Montanaro " + "(mikelima@cirulla.net)

" + "

Licensed under the GNU Public License v2 or above

" + diff --git a/application/resources/harmattan/qml/StationListPage.qml b/application/resources/harmattan/qml/StationListPage.qml index feff382..04751c3 100644 --- a/application/resources/harmattan/qml/StationListPage.qml +++ b/application/resources/harmattan/qml/StationListPage.qml @@ -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 diff --git a/application/resources/harmattan/qml/StationPage.qml b/application/resources/harmattan/qml/StationPage.qml index 14acf25..cce8f3e 100644 --- a/application/resources/harmattan/qml/StationPage.qml +++ b/application/resources/harmattan/qml/StationPage.qml @@ -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 diff --git a/application/resources/harmattan/qml/StationScheduleDelegate.qml b/application/resources/harmattan/qml/StationScheduleDelegate.qml index 1ffda9f..1fdf75d 100644 --- a/application/resources/harmattan/qml/StationScheduleDelegate.qml +++ b/application/resources/harmattan/qml/StationScheduleDelegate.qml @@ -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 %2").arg(actual) + return qsTr("Platform %1").arg(actual).arg(theme.inverted ? "#0f0" : "#080") } else { return qsTr("Platform " + "%1 " + - "%2").arg(expected).arg(actual) + "%2").arg(expected).arg(actual).arg(theme.inverted ? "#f00" : "#800") } } } diff --git a/application/resources/harmattan/qml/main.qml b/application/resources/harmattan/qml/main.qml index 89eafab..698414d 100644 --- a/application/resources/harmattan/qml/main.qml +++ b/application/resources/harmattan/qml/main.qml @@ -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 } } -- 1.7.9.5