Merge lp:~neokore/ubuntu-weather-app/settingsDialog into lp:ubuntu-weather-app/obsolete.trunk

Proposed by Raúl Yeguas on 2013-06-12
Status: Merged
Approved by: Martin Borho on 2013-06-12
Approved revision: 35
Merged at revision: 34
Proposed branch: lp:~neokore/ubuntu-weather-app/settingsDialog
Merge into: lp:ubuntu-weather-app/obsolete.trunk
Diff against target: 107 lines (+81/-0)
3 files modified
components/LocationTab.qml (+10/-0)
components/SettingsDialog.qml (+67/-0)
ubuntu-weather-app.qml (+4/-0)
To merge this branch: bzr merge lp:~neokore/ubuntu-weather-app/settingsDialog
Reviewer Review Type Date Requested Status
Martin Borho 2013-06-12 Approve on 2013-06-12
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve on 2013-06-12
Review via email: mp+169014@code.launchpad.net

Commit message

Added the settingsDialog for setting units (by now).

Description of the change

Added the settingsDialog for setting units (by now).

To post a comment you must log in.
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'components/LocationTab.qml'
2--- components/LocationTab.qml 2013-06-04 21:11:27 +0000
3+++ components/LocationTab.qml 2013-06-12 17:15:33 +0000
4@@ -93,6 +93,16 @@
5 mainView.refreshData();
6 }
7 }
8+
9+ Action {
10+ id: configAction
11+ iconSource: Qt.resolvedUrl("../resources/images/refresh_icon.png")
12+ text: i18n.tr("Configuration")
13+
14+ onTriggered: {
15+ PopupUtils.open(settingsDialog, locationTab);
16+ }
17+ }
18 }
19 }
20
21
22=== added file 'components/SettingsDialog.qml'
23--- components/SettingsDialog.qml 1970-01-01 00:00:00 +0000
24+++ components/SettingsDialog.qml 2013-06-12 17:15:33 +0000
25@@ -0,0 +1,67 @@
26+import QtQuick 2.0
27+import Ubuntu.Components 0.1
28+import Ubuntu.Components.Popups 0.1
29+
30+// Dialog for settings (units by now)
31+Component {
32+ id: settingsDialog
33+
34+ Dialog {
35+ id: settingsDialogue
36+ height: units.gu(10)
37+ title: i18n.tr("Settings")
38+
39+ Row {
40+ Label {
41+ id: imperialString
42+ width: units.gu(21)
43+ anchors.verticalCenter: parent.verticalCenter
44+ text: i18n.tr("Use imperial units")
45+ }
46+ Switch {
47+ id: imperialSwitch
48+ Component.onCompleted: {
49+ storage.getSettings(function(storedSettings) {
50+ if (storedSettings['units'] === 'imperial')
51+ imperialSwitch.checked = true;
52+ else
53+ imperialSwitch.checked = false;
54+ });
55+ }
56+ }
57+ }
58+
59+ Button {
60+ id: settingsOkButton
61+ text: i18n.tr("Save")
62+ onClicked: {
63+ if(imperialSwitch.checked){
64+ console.debug("Saving imperial units");
65+ storage.saveSetting("units","imperial");
66+ }else{
67+ console.debug("Saving metric units");
68+ storage.saveSetting("units","metric");
69+ }
70+ PopupUtils.close(settingsDialogue);
71+ //Loading tab
72+ var tabsString = "import QtQuick 2.0; import Ubuntu.Components 0.1; import Ubuntu.Components.Popups 0.1;"
73+ + "Tabs {id: tabs; anchors.fill: parent; Tab { title: 'Loading...'; LoadingComponent{id:bigLoading; anchors.fill: parent; z: 2;}}}"
74+ tabsObject = Qt.createQmlObject(tabsString, tabPage, "tabs");
75+ // Refresh settings and Data
76+ storage.getSettings(function(storedSettings) {
77+ for(var settingName in storedSettings) {
78+ settings[settingName] = storedSettings[settingName];
79+ }
80+ refreshData();
81+ });
82+ }
83+ }
84+
85+ Button {
86+ id:settingsCancelButton
87+ text: i18n.tr("Cancel")
88+ color: "#C00000"
89+ onClicked: PopupUtils.close(settingsDialogue)
90+ }
91+ }
92+}
93
94=== modified file 'ubuntu-weather-app.qml'
95--- ubuntu-weather-app.qml 2013-06-09 15:42:41 +0000
96+++ ubuntu-weather-app.qml 2013-06-12 17:15:33 +0000
97@@ -106,6 +106,10 @@
98 Components.AddLocationDialog {
99 id: addLocationDialog
100 }
101+
102+ Components.SettingsDialog {
103+ id: settingsDialog
104+ }
105
106 Components.Storage{
107 id: storage

Subscribers

People subscribed via source and target branches