Merge branch 'feature-settings-page' into development
authorLuciano Montanaro <mikelima@cirulla.net>
Sat, 4 Jan 2014 15:34:52 +0000 (16:34 +0100)
committerLuciano Montanaro <mikelima@cirulla.net>
Sat, 4 Jan 2014 15:34:52 +0000 (16:34 +0100)
application/resources/harmattan/qml/main.qml
application/resources/i18n/quandoparte_it.qm
application/resources/i18n/quandoparte_it.ts
application/resources/sailfish/qml/main.qml
application/resources/sailfish/qml/pages/SettingsPage.qml [new file with mode: 0644]
application/resources/sailfish/qml/pages/StationListPage.qml
application/resources/sailfish/qml/pages/StationPage.qml

index 698414d..fbebc69 100644 (file)
@@ -23,6 +23,7 @@ PageStackWindow {
         maximumInterval: 130
     }
     Component.onCompleted: {
+        // FIXME checkingInterval is deprecated use autoUpdate
         if (settings.checkingInterval > 0) updateTimer.start()
         theme.inverted = settings.darkThemePreferred
         theme.colorScheme = 3
index a11f1ff..4345634 100644 (file)
Binary files a/application/resources/i18n/quandoparte_it.qm and b/application/resources/i18n/quandoparte_it.qm differ
index baf45e5..21a49a3 100644 (file)
     </message>
 </context>
 <context>
+    <name>SettingsPage</name>
+    <message>
+        <location filename="../sailfish/qml/pages/SettingsPage.qml" line="23"/>
+        <source>Check Periodically</source>
+        <translation>Aggiorna periodicamente</translation>
+    </message>
+    <message>
+        <location filename="../sailfish/qml/pages/SettingsPage.qml" line="24"/>
+        <source>Update the situation periodically while the station schedule is shown.</source>
+        <translation>Aggiorna la situazione periodicamente quando viene mostrata la previsione della stazione.</translation>
+    </message>
+    <message>
+        <location filename="../sailfish/qml/pages/SettingsPage.qml" line="29"/>
+        <source>Clear Recent Stations</source>
+        <translation>Pulisci le stazioni recenti</translation>
+    </message>
+    <message>
+        <location filename="../sailfish/qml/pages/SettingsPage.qml" line="30"/>
+        <source>Clearing Preferred Stations</source>
+        <translation>Pulizia delle stazioni recenti</translation>
+    </message>
+    <message>
+        <location filename="../sailfish/qml/pages/SettingsPage.qml" line="33"/>
+        <source>Information</source>
+        <translation>Informazioni</translation>
+    </message>
+    <message>
+        <location filename="../sailfish/qml/pages/SettingsPage.qml" line="37"/>
+        <source>About Quando Parte</source>
+        <translation>Informazioni su Quando Parte</translation>
+    </message>
+</context>
+<context>
     <name>StationListModel</name>
     <message>
         <location filename="../../stationlistmodel.cpp" line="67"/>
     </message>
     <message>
         <location filename="../harmattan/qml/StationListPage.qml" line="55"/>
-        <location filename="../sailfish/qml/pages/StationListPage.qml" line="21"/>
         <source>About Quando Parte</source>
         <translation>Informazioni su Quando Parte</translation>
     </message>
     <message>
         <location filename="../harmattan/qml/StationListPage.qml" line="66"/>
-        <location filename="../sailfish/qml/pages/StationListPage.qml" line="25"/>
         <source>Stations by Name</source>
         <translation>Stazioni per nome</translation>
     </message>
     <message>
         <location filename="../harmattan/qml/StationListPage.qml" line="67"/>
-        <location filename="../sailfish/qml/pages/StationListPage.qml" line="29"/>
         <source>Stations by Distance</source>
         <translation>Stazioni per distanza</translation>
     </message>
     <message>
         <location filename="../harmattan/qml/StationListPage.qml" line="68"/>
-        <location filename="../sailfish/qml/pages/StationListPage.qml" line="33"/>
         <source>Stations Recently Seen</source>
         <translation>Stazioni viste di recente</translation>
     </message>
         <translation type="obsolete">Mostra l&apos;ultima stazione all&apos;avvio</translation>
     </message>
     <message>
-        <location filename="../sailfish/qml/pages/StationListPage.qml" line="41"/>
+        <location filename="../sailfish/qml/pages/StationListPage.qml" line="21"/>
+        <source>Settings</source>
+        <translation>Impostazioni</translation>
+    </message>
+    <message>
+        <location filename="../sailfish/qml/pages/StationListPage.qml" line="25"/>
+        <source>Show Stations by Distance</source>
+        <translation>Mostra le stazioni per distanza</translation>
+    </message>
+    <message>
+        <location filename="../sailfish/qml/pages/StationListPage.qml" line="30"/>
+        <source>Show Stations by Name</source>
+        <translation>Mostra le stazioni per nome</translation>
+    </message>
+    <message>
+        <location filename="../sailfish/qml/pages/StationListPage.qml" line="35"/>
+        <source>Show Recent Stations</source>
+        <translation>Mostra le stazioni recenti</translation>
+    </message>
+    <message>
+        <location filename="../sailfish/qml/pages/StationListPage.qml" line="44"/>
         <source>Search station...</source>
         <translation>Cerca stazione...</translation>
     </message>
index baa9b19..aad9970 100644 (file)
@@ -5,13 +5,20 @@ import "pages"
 
 ApplicationWindow {
     id: window
-    initialPage: StationListPage { }
+    initialPage: Qt.resolvedUrl("pages/StationListPage.qml")
     cover: Qt.resolvedUrl("cover/CoverPage.qml")
     Timer { /* XXX This is an AlignedTimer in Harmattan, which should be better for battery */
         id: updateTimer
-        interval: 120
+        interval: 120000
+        repeat: true
+        running: Qt.application.active && settings.autoUpdate
     }
     StationScheduleModel {
         id: schedule
     }
+    Component.onCompleted: {
+        if (Qt.application.active && settings.autoUpdate) {
+            updateTimer.start()
+        }
+    }
 }
diff --git a/application/resources/sailfish/qml/pages/SettingsPage.qml b/application/resources/sailfish/qml/pages/SettingsPage.qml
new file mode 100644 (file)
index 0000000..b629275
--- /dev/null
@@ -0,0 +1,45 @@
+import QtQuick 2.0
+import Sailfish.Silica 1.0
+import net.cirulla.quandoparte 1.0
+
+Page {
+    RemorsePopup {
+        id: remorse
+    }
+    SilicaFlickable {
+        anchors.fill: parent
+        contentHeight: column.height
+        contentWidth: parent.width
+        VerticalScrollDecorator {}
+        Column {
+            id: column
+            width: parent.width
+            spacing: Theme.paddingLarge
+            PageHeader {
+                title: "Settings"
+            }
+            TextSwitch {
+                id: periodicActivation
+                text: qsTr("Check Periodically")
+                description: qsTr("Update the situation periodically while the station schedule is shown.")
+                onCheckedChanged: settings.autoUpdate = checked
+            }
+            Button {
+                anchors.horizontalCenter: parent.horizontalCenter
+                text: qsTr("Clear Recent Stations")
+                onClicked: remorse.execute(qsTr("Clearing Preferred Stations"), function() {settings.recentStations = ""})
+            }
+            SectionHeader {
+                text: qsTr("Information")
+            }
+            Button {
+                anchors.horizontalCenter: parent.horizontalCenter
+                text: qsTr("About Quando Parte")
+                onClicked: pageStack.push(Qt.resolvedUrl("AboutPage.qml"))
+            }
+        }
+    }
+    Component.onCompleted: {
+        periodicActivation.checked = settings.autoUpdate
+    }
+}
index d45fb0e..a75c314 100644 (file)
@@ -18,20 +18,23 @@ Page {
         pressDelay: 0
         PullDownMenu {
             MenuItem {
-                text: qsTr("About Quando Parte")
-                onClicked: pageStack.push(Qt.resolvedUrl("AboutPage.qml"))
+                text: qsTr("Settings")
+                onClicked: pageStack.push(Qt.resolvedUrl("SettingsPage.qml"))
             }
             MenuItem {
-                text: qsTr("Stations by Name")
-                onClicked: stationListProxyModel.sortingMode = StationListProxyModel.AlphaSorting
+                text: qsTr("Show Stations by Distance")
+                onClicked: stationListProxyModel.sortingMode = StationListProxyModel.DistanceSorting
+                enabled: (stationListProxyModel.sortingMode !== StationListProxyModel.DistanceSorting)
             }
             MenuItem {
-                text: qsTr("Stations by Distance")
-                onClicked: stationListProxyModel.sortingMode = StationListProxyModel.DistanceSorting
+                text: qsTr("Show Stations by Name")
+                onClicked: stationListProxyModel.sortingMode = StationListProxyModel.AlphaSorting
+                enabled: (stationListProxyModel.sortingMode !== StationListProxyModel.AlphaSorting)
             }
             MenuItem {
-                text: qsTr("Stations Recently Seen")
+                text: qsTr("Show Recent Stations")
                 onClicked: stationListProxyModel.sortingMode = StationListProxyModel.RecentUsageSorting
+                enabled: (stationListProxyModel.sortingMode !== StationListProxyModel.RecentUsageSorting)
             }
         }
         PageHeader {
@@ -43,6 +46,7 @@ Page {
                 onTextChanged: stationListPage.searchPattern = searchField.text
                 width: stationListPage.width
                 EnterKey.onClicked: searchField.focus = false
+                EnterKey.iconSource: "image://theme/icon-m-enter-close"
             }
         }
         SilicaListView {
index a892462..a2b8fef 100644 (file)
@@ -134,17 +134,8 @@ Page {
             }
         ]
 
-        /*
-        StationScheduleModel {
-            id: schedule
-            onNameChanged: view.updateStation()
-            onLayoutChanged: if (error) view.state = "error"
-                             else view.state = "ready"
-        }
-        */
         Connections {
             target: schedule
-            // onNameChanged: view.updateStation()
             onLayoutChanged: if (schedule.error) view.state = "error"
                              else view.state = "ready"
         }