~nik90/ubuntu-clock-app/custom-swipe-delete

« back to all changes in this revision

Viewing changes to app/ubuntu-clock-app.qml

  • Committer: Nekhelesh Ramananthan
  • Date: 2014-06-06 18:45:49 UTC
  • Revision ID: krnekhelesh@gmail.com-20140606184549-l8qpmg55pwqqurjd
Initial commit of files

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2014 Canonical Ltd
 
3
 *
 
4
 * This program is free software: you can redistribute it and/or modify
 
5
 * it under the terms of the GNU General Public License version 3 as
 
6
 * published by the Free Software Foundation.
 
7
 *
 
8
 * This program is distributed in the hope that it will be useful,
 
9
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
 * GNU General Public License for more details.
 
12
 *
 
13
 * You should have received a copy of the GNU General Public License
 
14
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
15
 */
 
16
 
 
17
import QtQuick 2.0
 
18
import Ubuntu.Components 1.1
 
19
import "clock"
 
20
import "components"
 
21
 
 
22
MainView {
 
23
    id: clockApp
 
24
 
 
25
    /*
 
26
      Property to store the state of an application (active or suspended)
 
27
     */
 
28
      property bool applicationState: Qt.application.active
 
29
 
 
30
    /*
 
31
      objectName for functional testing purposes (autopilot-qt5)
 
32
     */
 
33
    objectName: "clock"
 
34
 
 
35
    /*
 
36
      applicationName for click packages (used as an unique app identifier)
 
37
     */
 
38
    applicationName: "com.ubuntu.clock"
 
39
 
 
40
    /*
 
41
      This property enables the application to change orientation when the
 
42
      device is rotated. This has been set to false since we are currently
 
43
      only focussing on the phone interface.
 
44
     */
 
45
    automaticOrientation: false
 
46
 
 
47
    /*
 
48
      The width and height defined below are the same dimension used by the
 
49
      designers in the clock visual spec.
 
50
 
 
51
      #NOTE: Do not change without a compelling reason.
 
52
     */
 
53
    width: units.gu(40)
 
54
    height: units.gu(70)
 
55
 
 
56
    backgroundColor: "#F5F5F5"
 
57
 
 
58
    useDeprecatedToolbar: false
 
59
 
 
60
    onApplicationStateChanged: {
 
61
        // Update Clock time immediately when the clock app is brought from suspend
 
62
        // instead of waiting for the next minute to update.
 
63
        if(applicationState)
 
64
            updateTime()
 
65
    }
 
66
 
 
67
    function updateTime() {
 
68
        clock.time = Qt.formatTime(new Date(), "hh:mm")
 
69
    }
 
70
 
 
71
    Background {}
 
72
 
 
73
    Timer {
 
74
        id: clockTimer
 
75
        interval: 60000
 
76
        repeat: true
 
77
        running: true
 
78
        onTriggered: updateTime()
 
79
    }
 
80
 
 
81
    Clock {
 
82
        id: clock
 
83
    }
 
84
}