5.2.3
by Nekhelesh Ramananthan
Added bottom edge |
1 |
/*
|
2 |
* Copyright (C) 2014 Canonical Ltd
|
|
3 |
*
|
|
23.1.22
by Nekhelesh Ramananthan
Fixed license headers |
4 |
* This file is part of Ubuntu Clock App
|
5 |
*
|
|
6 |
* Ubuntu Clock App is free software: you can redistribute it and/or modify
|
|
5.2.3
by Nekhelesh Ramananthan
Added bottom edge |
7 |
* it under the terms of the GNU General Public License version 3 as
|
8 |
* published by the Free Software Foundation.
|
|
9 |
*
|
|
23.1.22
by Nekhelesh Ramananthan
Fixed license headers |
10 |
* Ubuntu Clock App is distributed in the hope that it will be useful,
|
5.2.3
by Nekhelesh Ramananthan
Added bottom edge |
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13 |
* GNU General Public License for more details.
|
|
14 |
*
|
|
15 |
* You should have received a copy of the GNU General Public License
|
|
16 |
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17 |
*/
|
|
18 |
||
5.2.1
by Nekhelesh Ramananthan
Moved clock page into a separate file and also added it into a pagestack |
19 |
import QtQuick 2.0 |
20.4.2
by Nekhelesh Ramananthan
Remember the clock mode of the user |
20 |
import U1db 1.0 as U1db |
5.2.1
by Nekhelesh Ramananthan
Moved clock page into a separate file and also added it into a pagestack |
21 |
import Ubuntu.Components 1.1 |
22 |
import "../components" |
|
26.1.12
by Nekhelesh Ramananthan
Moved user world clock list to the proper folder |
23 |
import "../worldclock" |
5.2.3
by Nekhelesh Ramananthan
Added bottom edge |
24 |
import "../components/Utils.js" as Utils |
5.2.1
by Nekhelesh Ramananthan
Moved clock page into a separate file and also added it into a pagestack |
25 |
|
5.2.3
by Nekhelesh Ramananthan
Added bottom edge |
26 |
PageWithBottomEdge { |
5.3.8
by Nekhelesh Ramananthan
Changed internal variable names to start with underscore |
27 |
id: _clockPage |
5.2.1
by Nekhelesh Ramananthan
Moved clock page into a separate file and also added it into a pagestack |
28 |
|
29 |
/*
|
|
30 |
Property to set the minimum drag distance before activating the add
|
|
31 |
city signal
|
|
32 |
*/
|
|
15.2.3
by Nekhelesh Ramananthan
Tweaked the threshold values of the pulltoadd button |
33 |
property int _minThreshold: addCityButton.maxThreshold + units.gu(2) |
5.2.1
by Nekhelesh Ramananthan
Moved clock page into a separate file and also added it into a pagestack |
34 |
|
15.4.5
by Nekhelesh Ramananthan
Updated timer interval to depend on the clock mode for performance optimization |
35 |
// Property to keep track of the clock mode
|
20.4.3
by Nekhelesh Ramananthan
Fixed reviewer comments |
36 |
property alias isDigital: clock.isDigital |
15.4.5
by Nekhelesh Ramananthan
Updated timer interval to depend on the clock mode for performance optimization |
37 |
|
5.2.1
by Nekhelesh Ramananthan
Moved clock page into a separate file and also added it into a pagestack |
38 |
flickable: null |
39 |
||
5.2.3
by Nekhelesh Ramananthan
Added bottom edge |
40 |
Component.onCompleted: Utils.log(debugMode, "Clock Page loaded") |
41 |
||
5.2.1
by Nekhelesh Ramananthan
Moved clock page into a separate file and also added it into a pagestack |
42 |
Flickable { |
5.3.8
by Nekhelesh Ramananthan
Changed internal variable names to start with underscore |
43 |
id: _flickable |
5.2.1
by Nekhelesh Ramananthan
Moved clock page into a separate file and also added it into a pagestack |
44 |
|
45 |
anchors.fill: parent |
|
46 |
contentWidth: parent.width |
|
47 |
contentHeight: clock.height + date.height + locationRow.height |
|
26.1.1
by Nekhelesh Ramananthan
Implemented support for adding world cities to u1db database |
48 |
+ worldCityColumn.height + units.gu(20) |
5.2.1
by Nekhelesh Ramananthan
Moved clock page into a separate file and also added it into a pagestack |
49 |
|
5.4.2
by Nekhelesh Ramananthan
Converted clock page to use generic pulltoadd component |
50 |
PullToAdd { |
5.2.1
by Nekhelesh Ramananthan
Moved clock page into a separate file and also added it into a pagestack |
51 |
id: addCityButton
|
5.4.2
by Nekhelesh Ramananthan
Converted clock page to use generic pulltoadd component |
52 |
|
5.2.1
by Nekhelesh Ramananthan
Moved clock page into a separate file and also added it into a pagestack |
53 |
anchors.top: parent.top |
15.2.3
by Nekhelesh Ramananthan
Tweaked the threshold values of the pulltoadd button |
54 |
anchors.topMargin: -labelHeight - units.gu(3) |
5.2.1
by Nekhelesh Ramananthan
Moved clock page into a separate file and also added it into a pagestack |
55 |
anchors.horizontalCenter: parent.horizontalCenter |
5.4.2
by Nekhelesh Ramananthan
Converted clock page to use generic pulltoadd component |
56 |
|
57 |
leftLabel: i18n.tr("Add") |
|
58 |
rightLabel: i18n.tr("City") |
|
5.2.1
by Nekhelesh Ramananthan
Moved clock page into a separate file and also added it into a pagestack |
59 |
}
|
60 |
||
23.1.2
by Nekhelesh Ramananthan
Added a very basic draft UI |
61 |
Icon { |
62 |
id: settingsIcon
|
|
63 |
||
64 |
Component.onCompleted: anchors.topMargin = units.gu(2) |
|
65 |
||
66 |
width: units.gu(3) |
|
67 |
height: width |
|
68 |
||
69 |
anchors { |
|
70 |
top: parent.top |
|
71 |
topMargin: units.gu(6) |
|
72 |
right: parent.right |
|
73 |
rightMargin: units.gu(2) |
|
74 |
}
|
|
75 |
||
76 |
name: "settings" |
|
77 |
color: "Grey" |
|
78 |
||
79 |
Behavior on anchors.topMargin { |
|
80 |
UbuntuNumberAnimation { duration: 900 } |
|
81 |
}
|
|
82 |
||
83 |
MouseArea { |
|
84 |
anchors.fill: parent |
|
23.1.6
by Nekhelesh Ramananthan
Added a basic connection dbus interface (not working) |
85 |
onClicked: mainStack.push( |
86 |
Qt.resolvedUrl("../alarm/AlarmSettingsPage.qml")) |
|
23.1.2
by Nekhelesh Ramananthan
Added a very basic draft UI |
87 |
}
|
88 |
}
|
|
89 |
||
30.1.1
by Nekhelesh Ramananthan
First commit |
90 |
MainClock { |
5.2.1
by Nekhelesh Ramananthan
Moved clock page into a separate file and also added it into a pagestack |
91 |
id: clock
|
20.4.2
by Nekhelesh Ramananthan
Remember the clock mode of the user |
92 |
|
5.2.1
by Nekhelesh Ramananthan
Moved clock page into a separate file and also added it into a pagestack |
93 |
anchors.verticalCenter: parent.top |
5.3.1
by Nekhelesh Ramananthan
Updated font sizes and clock positioning |
94 |
anchors.verticalCenterOffset: units.gu(20) |
5.2.1
by Nekhelesh Ramananthan
Moved clock page into a separate file and also added it into a pagestack |
95 |
anchors.horizontalCenter: parent.horizontalCenter |
96 |
}
|
|
97 |
||
98 |
Label { |
|
99 |
id: date
|
|
100 |
||
5.3.1
by Nekhelesh Ramananthan
Updated font sizes and clock positioning |
101 |
Component.onCompleted: anchors.topMargin = units.gu(40) |
5.2.1
by Nekhelesh Ramananthan
Moved clock page into a separate file and also added it into a pagestack |
102 |
|
103 |
anchors.top: parent.top |
|
5.3.1
by Nekhelesh Ramananthan
Updated font sizes and clock positioning |
104 |
anchors.topMargin: units.gu(36) |
5.2.1
by Nekhelesh Ramananthan
Moved clock page into a separate file and also added it into a pagestack |
105 |
anchors.horizontalCenter: parent.horizontalCenter |
106 |
||
30.2.2
by Nekhelesh Ramananthan
Initial working version |
107 |
text: Qt.formatDate(clock.analogTime, "dddd, d MMMM yyyy") |
5.4.6
by Nekhelesh Ramananthan
Changed font size to xx-small |
108 |
fontSize: "xx-small" |
5.2.1
by Nekhelesh Ramananthan
Moved clock page into a separate file and also added it into a pagestack |
109 |
|
110 |
Behavior on anchors.topMargin { |
|
111 |
UbuntuNumberAnimation { duration: 900 } |
|
112 |
}
|
|
113 |
}
|
|
114 |
||
115 |
Row { |
|
116 |
id: locationRow
|
|
117 |
||
118 |
spacing: units.gu(1) |
|
119 |
||
120 |
anchors.top: date.bottom |
|
121 |
anchors.topMargin: units.gu(1) |
|
122 |
anchors.horizontalCenter: parent.horizontalCenter |
|
123 |
||
124 |
Image { |
|
125 |
id: locationIcon
|
|
126 |
source: "../graphics/Location_Pin.png" |
|
127 |
width: units.gu(1.2) |
|
128 |
height: units.gu(2.2) |
|
129 |
}
|
|
130 |
||
131 |
Label { |
|
132 |
id: location
|
|
133 |
text: "Location" |
|
5.3.1
by Nekhelesh Ramananthan
Updated font sizes and clock positioning |
134 |
fontSize: "medium" |
5.2.1
by Nekhelesh Ramananthan
Moved clock page into a separate file and also added it into a pagestack |
135 |
anchors.verticalCenter: locationIcon.verticalCenter |
136 |
color: UbuntuColors.midAubergine |
|
137 |
}
|
|
138 |
}
|
|
139 |
||
26.1.9
by Nekhelesh Ramananthan
Moved entire world clock ui to its own file |
140 |
UserWorldCityList { |
26.1.1
by Nekhelesh Ramananthan
Implemented support for adding world cities to u1db database |
141 |
id: worldCityColumn
|
142 |
}
|
|
143 |
||
5.2.1
by Nekhelesh Ramananthan
Moved clock page into a separate file and also added it into a pagestack |
144 |
onDragEnded: { |
15.2.3
by Nekhelesh Ramananthan
Tweaked the threshold values of the pulltoadd button |
145 |
if(contentY < _minThreshold) { |
20.1.1
by Nekhelesh Ramananthan
Basic world clock list |
146 |
mainStack.push(Qt.resolvedUrl("../worldclock/WorldCityList.qml")) |
15.2.3
by Nekhelesh Ramananthan
Tweaked the threshold values of the pulltoadd button |
147 |
}
|
5.2.1
by Nekhelesh Ramananthan
Moved clock page into a separate file and also added it into a pagestack |
148 |
}
|
149 |
||
150 |
onContentYChanged: { |
|
151 |
if(contentY < 0 && atYBeginning) { |
|
152 |
addCityButton.dragPosition = contentY.toFixed(0) |
|
153 |
}
|
|
154 |
}
|
|
155 |
}
|
|
156 |
}
|