← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

[Merge] lp:~mpredotka/ubuntu-clock-app/app-window-size into lp:ubuntu-clock-app

 

Michal Predotka has proposed merging lp:~mpredotka/ubuntu-clock-app/app-window-size into lp:ubuntu-clock-app.

Commit message:
Set min and max size for the app window

Requested reviews:
  Ubuntu Clock Developers (ubuntu-clock-dev)
Related bugs:
  Bug #1200542 in Ubuntu Clock App: "Clock app window should not be allowed to resize below a certain width or height"
  https://bugs.launchpad.net/ubuntu-clock-app/+bug/1200542
  Bug #1543470 in Ubuntu Clock App: "No min/max default size should be locked to 50GU size"
  https://bugs.launchpad.net/ubuntu-clock-app/+bug/1543470

For more details, see:
https://code.launchpad.net/~mpredotka/ubuntu-clock-app/app-window-size/+merge/299980

Added Window component with min width 40gu, max width 50gu and min height 70gu. Tested only on desktop.
-- 
Your team Ubuntu Clock Developers is requested to review the proposed merge of lp:~mpredotka/ubuntu-clock-app/app-window-size into lp:ubuntu-clock-app.
=== modified file 'app/alarm/AlarmSettingsPage.qml'
--- app/alarm/AlarmSettingsPage.qml	2016-03-03 10:24:42 +0000
+++ app/alarm/AlarmSettingsPage.qml	2016-07-13 17:38:30 +0000
@@ -33,7 +33,7 @@
     }
 
     Connections {
-        target: clockApp
+        target: rootWindow
         onApplicationStateChanged: {
             localTimeSource.update()
         }
@@ -100,6 +100,7 @@
                         }
 
                         Slider {
+                            width: Math.min(parent.width, units.gu(40))
                             minimumValue: 1
                             maximumValue: 100
                             live: true

=== modified file 'app/alarm/AlarmSound.qml'
--- app/alarm/AlarmSound.qml	2016-03-16 16:14:15 +0000
+++ app/alarm/AlarmSound.qml	2016-07-13 17:38:30 +0000
@@ -139,7 +139,7 @@
     }
 
     Connections {
-        target: clockApp
+        target: rootWindow
         onApplicationStateChanged: {
             previewAlarmSound.stop()
         }

=== modified file 'app/clock/ClockPage.qml'
--- app/clock/ClockPage.qml	2016-03-21 19:03:05 +0000
+++ app/clock/ClockPage.qml	2016-07-13 17:38:30 +0000
@@ -119,7 +119,7 @@
     }
 
     Connections {
-        target: clockApp
+        target: rootWindow
         onApplicationStateChanged: {
             /*
              If Clock App is brought from background after more than 30 mins,

=== modified file 'app/ubuntu-clock-app.qml'
--- app/ubuntu-clock-app.qml	2016-02-26 09:46:21 +0000
+++ app/ubuntu-clock-app.qml	2016-07-13 17:38:30 +0000
@@ -22,109 +22,111 @@
 import Alarm 1.0
 import Ubuntu.Components 1.3
 import "components"
+import QtQuick.Window 2.2
 
-MainView {
-    id: clockApp
+Window {
+    id: rootWindow
 
     // Property to store the state of an application (active or suspended)
     property bool applicationState: Qt.application.active
 
-    // objectName for functional testing purposes (autopilot-qt5)
-    objectName: "clockMainView"
-
-    // applicationName for click packages (used as an unique app identifier)
-    applicationName: "com.ubuntu.clock"
-
-    /*
-      This property enables the application to change orientation when the
-      device is rotated. This has been set to false since we are currently
-      only focussing on the phone interface.
-    */
-    automaticOrientation: false
-
-    /*
-      The width and height defined below are the same dimension used by the
-      designers in the clock visual spec.
-    */
-    width: units.gu(40)
-    height: units.gu(70)
-
-    backgroundColor: "#FFFFFF"
-
-    anchorToKeyboard: true
-
-    // Database to store the user preferences locally
-    U1db.Database {
-        id: clockDB
-        path: "user-preferences"
-    }
-
-    // Document to store clock mode chosen by user
-    U1db.Document {
-        id: clockModeDocument
-        create: true
-        database: clockDB
-        docId: "clockModeDocument"
-        defaults: { "digitalMode": false }
-    }
-
-    U1db.Document {
-        id: userLocationDocument
-        create: true
-        database: clockDB
-        docId: "userLocationDocument"
-        defaults: { "lat": "NaN", "long": "Nan", "location": "Null" }
-    }
-
-    DateTime {
-        id: localTimeSource
-        updateInterval: 1000
-    }
-
-    AlarmSound {
-        id: alarmSoundHelper
-        // Create CustomSounds directory if it does not exist on app startup
-        Component.onCompleted: createCustomAlarmSoundDirectory()
-    }
+    /*
+  The width and height defined below are the same dimension used by the
+  designers in the clock visual spec.
+*/
+
+    minimumWidth: units.gu(40)
+    minimumHeight: units.gu(70)
+    maximumWidth: units.gu(50)
 
     onApplicationStateChanged: {
         localTimeSource.update()
         /*
-         Reload the alarm model when the clock app gains focus to refresh
-         the alarm page UI in the case of alarm notifications.
-        */
+     Reload the alarm model when the clock app gains focus to refresh
+     the alarm page UI in the case of alarm notifications.
+    */
         if(applicationState && !mainPage.isColdStart && (mainStack.currentPage.isMainPage
-                || mainStack.currentPage.isAlarmPage)) {
+                                                         || mainStack.currentPage.isAlarmPage)) {
             console.log("[LOG]: Alarm Database unloaded")
             alarmModelLoader.source = ""
             alarmModelLoader.source = Qt.resolvedUrl("alarm/AlarmModelComponent.qml")
         }
     }
 
-    PageStack {
-        id: mainStack
-
-        Component.onCompleted: push(mainPage)
-
-        MainPage {
-            id: mainPage
-
-            readonly property bool isMainPage: true
-
-            Loader {
-                id: alarmModelLoader
-                asynchronous: false
-            }
-
-            alarmModel: alarmModelLoader.item
-            /*
+    MainView {
+        id: clockApp
+
+        // objectName for functional testing purposes (autopilot-qt5)
+        objectName: "clockMainView"
+
+        // applicationName for click packages (used as an unique app identifier)
+        applicationName: "com.ubuntu.clock"
+
+        backgroundColor: "#FFFFFF"
+
+        anchors.fill: parent
+
+        anchorToKeyboard: true
+
+        // Database to store the user preferences locally
+        U1db.Database {
+            id: clockDB
+            path: "user-preferences"
+        }
+
+        // Document to store clock mode chosen by user
+        U1db.Document {
+            id: clockModeDocument
+            create: true
+            database: clockDB
+            docId: "clockModeDocument"
+            defaults: { "digitalMode": false }
+        }
+
+        U1db.Document {
+            id: userLocationDocument
+            create: true
+            database: clockDB
+            docId: "userLocationDocument"
+            defaults: { "lat": "NaN", "long": "Nan", "location": "Null" }
+        }
+
+        DateTime {
+            id: localTimeSource
+            updateInterval: 1000
+        }
+
+        AlarmSound {
+            id: alarmSoundHelper
+            // Create CustomSounds directory if it does not exist on app startup
+            Component.onCompleted: createCustomAlarmSoundDirectory()
+        }
+
+        PageStack {
+            id: mainStack
+
+            Component.onCompleted: push(mainPage)
+
+            MainPage {
+                id: mainPage
+
+                readonly property bool isMainPage: true
+
+                Loader {
+                    id: alarmModelLoader
+                    asynchronous: false
+                }
+
+                alarmModel: alarmModelLoader.item
+                /*
                FIXME: When the upstream QT bug at
                https://bugreports.qt-project.org/browse/QTBUG-40275 is fixed
                it will be possible to receive a datetime object directly for notLocalizedDateTimeString variable.
             */
-            notLocalizedDateTimeString: localTimeSource.notLocalizedCurrentDateTimeString
-            localizedTimeString: localTimeSource.localizedCurrentTimeString
-            localizedDateString: localTimeSource.localizedCurrentDateString
+                notLocalizedDateTimeString: localTimeSource.notLocalizedCurrentDateTimeString
+                localizedTimeString: localTimeSource.localizedCurrentTimeString
+                localizedDateString: localTimeSource.localizedCurrentDateString
+            }
         }
     }
 }

=== modified file 'app/worldclock/WorldCityList.qml'
--- app/worldclock/WorldCityList.qml	2016-03-21 19:10:42 +0000
+++ app/worldclock/WorldCityList.qml	2016-07-13 17:38:30 +0000
@@ -144,7 +144,7 @@
     }
 
     Connections {
-        target: clockApp
+        target: rootWindow
         onApplicationStateChanged: {
             /*
               Update world city list immediately when the clock app is brought


Follow ups