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

Proposed by Raúl Yeguas
Status: Merged
Approved by: Martin Borho
Approved revision: 44
Merged at revision: 44
Proposed branch: lp:~neokore/ubuntu-weather-app/SettingsPage
Merge into: lp:ubuntu-weather-app/obsolete.trunk
Diff against target: 172 lines (+67/-57)
3 files modified
components/LocationTab.qml (+2/-2)
components/SettingsPage.qml (+59/-53)
ubuntu-weather-app.qml (+6/-2)
To merge this branch: bzr merge lp:~neokore/ubuntu-weather-app/SettingsPage
Reviewer Review Type Date Requested Status
Martin Borho Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Review via email: mp+169921@code.launchpad.net

Commit message

SettingsDialog conversion to Page.

Description of the change

SettingsDialog conversion to Page.

To post a comment you must log in.
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Martin Borho (martin-borho) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'components/LocationTab.qml'
--- components/LocationTab.qml 2013-06-14 13:11:16 +0000
+++ components/LocationTab.qml 2013-06-17 19:25:31 +0000
@@ -77,10 +77,10 @@
77 Action {77 Action {
78 id: configAction78 id: configAction
79 iconSource: Qt.resolvedUrl("../resources/images/refresh_icon.png")79 iconSource: Qt.resolvedUrl("../resources/images/refresh_icon.png")
80 text: i18n.tr("Configuration")80 text: i18n.tr("Settings")
8181
82 onTriggered: {82 onTriggered: {
83 PopupUtils.open(settingsDialog, locationTab);83 mainView.showSettingsPage();
84 }84 }
85 }85 }
86 }86 }
8787
=== renamed file 'components/SettingsDialog.qml' => 'components/SettingsPage.qml'
--- components/SettingsDialog.qml 2013-06-14 10:09:37 +0000
+++ components/SettingsPage.qml 2013-06-17 19:25:31 +0000
@@ -2,66 +2,72 @@
2import Ubuntu.Components 0.12import Ubuntu.Components 0.1
3import Ubuntu.Components.Popups 0.13import Ubuntu.Components.Popups 0.1
44
5// Dialog for settings (units by now)5// Page for settings (units by now)
6Component {6Page {
7 id: settingsDialog7 id: settingsPage
88 objectName: "SettingsPage"
9 Dialog {9 title: i18n.tr("Settings")
10 id: settingsDialogue10 visible:false
11 height: units.gu(10)11
12 title: i18n.tr("Settings")12 property bool settingsChanged: false
1313
14 Row {14 tools: ToolbarActions {
15 Label {15 locked: true
16 id: imperialString16 opened: true
17 width: units.gu(21)17 back.onTriggered: {
18 anchors.verticalCenter: parent.verticalCenter18 if(settingsChanged) {
19 text: i18n.tr("Use imperial units")
20 }
21 Switch {
22 id: imperialSwitch
23 Component.onCompleted: {
24 storage.getSettings(function(storedSettings) {
25 if (storedSettings['units'] === 'imperial')
26 imperialSwitch.checked = true;
27 else
28 imperialSwitch.checked = false;
29 });
30 }
31 }
32 }
33
34 Button {
35 id: settingsOkButton
36 text: i18n.tr("Save")
37 onClicked: {
38 if(imperialSwitch.checked){19 if(imperialSwitch.checked){
39 console.debug("Saving imperial units");20 storage.saveSetting("units","imperial");
40 storage.saveSetting("units","imperial");
41 }else{21 }else{
42 console.debug("Saving metric units");22 storage.saveSetting("units","metric");
43 storage.saveSetting("units","metric");
44 }23 }
45 PopupUtils.close(settingsDialogue);
46 //Loading tab
47 var tabsString = "import QtQuick 2.0; import Ubuntu.Components 0.1; import Ubuntu.Components.Popups 0.1;"
48 + "Tabs {id: tabs; anchors.fill: parent; Tab { title: 'Loading...'; LoadingComponent{id:bigLoading; anchors.fill: parent; z: 2;}}}"
49 tabsObject = Qt.createQmlObject(tabsString, tabPage, "tabs");
50 // Refresh settings and Data
51 storage.getSettings(function(storedSettings) {24 storage.getSettings(function(storedSettings) {
52 for(var settingName in storedSettings) {25 for(var settingName in storedSettings) {
53 settings[settingName] = storedSettings[settingName];26 settings[settingName] = storedSettings[settingName];
54 }27 }
55 refreshData(true);28 refreshData();
56 });29 });
57 }30 settingsChanged = false;
58 }31 }
5932 }
60 Button {33 }
61 id:settingsCancelButton34
62 text: i18n.tr("Cancel")35 Rectangle {
63 color: "#C00000"36 anchors {
64 onClicked: PopupUtils.close(settingsDialogue)37 right: parent.right
38 rightMargin: units.gu(1)
39 left: parent.left
40 leftMargin: units.gu(1)
41 top: parent.top
42 topMargin: units.gu(3)
43 }
44 Label {
45 id: imperialString
46 width: units.gu(21)
47 anchors {
48 verticalCenter: parent.verticalCenter
49 left: parent.left
50 }
51
52 text: i18n.tr("Use imperial units")
53 }
54 Switch {
55 id: imperialSwitch
56 anchors {
57 verticalCenter: parent.verticalCenter
58 right: parent.right
59 }
60 Component.onCompleted: {
61 storage.getSettings(function(storedSettings) {
62 if (storedSettings['units'] === 'imperial')
63 imperialSwitch.checked = true;
64 else
65 imperialSwitch.checked = false;
66 });
67 }
68 onCheckedChanged: {
69 settingsChanged = true;
70 }
65 }71 }
66 }72 }
67}73}
6874
=== modified file 'ubuntu-weather-app.qml'
--- ubuntu-weather-app.qml 2013-06-14 13:11:16 +0000
+++ ubuntu-weather-app.qml 2013-06-17 19:25:31 +0000
@@ -91,6 +91,10 @@
91 locationManager.loadData()91 locationManager.loadData()
92 }92 }
9393
94 function showSettingsPage() {
95 pageStack.push(settingsPage)
96 }
97
94 Component.onCompleted: {98 Component.onCompleted: {
95 //storage.clearDB();99 //storage.clearDB();
96 //storage.clearSetting('units');100 //storage.clearSetting('units');
@@ -107,8 +111,8 @@
107 id: addLocationDialog111 id: addLocationDialog
108 }112 }
109113
110 Components.SettingsDialog {114 Components.SettingsPage {
111 id: settingsDialog115 id: settingsPage
112 }116 }
113 117
114 Components.Storage{118 Components.Storage{

Subscribers

People subscribed via source and target branches