-
Notifications
You must be signed in to change notification settings - Fork 15
/
TasksFinishedView.qml
269 lines (222 loc) · 8.03 KB
/
TasksFinishedView.qml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
import QtQuick 1.1
Rectangle {
id: root
property alias tasks_finished_listmodel: tasks_finished_listmodel
property alias tasks_finished_see_more: tasks_finished_see_more
property alias listview_rect: listview_rect
color: styl.panel_back_color
width: 400
height: tasks_finished_listview.count !== 0 ? listview_rect.height + 40 : 0
Text {
id: tasks_finished_d
color: styl.text_color_secondary
x: parent.width/2 - width - 4
anchors {
top: parent.top
topMargin: 10
}
text: qsTr("Tasks finished:")
font {family: "Ubuntu"; pixelSize: 14}
}
Text {
id: tasks_finished
color: styl.text_color_primary
x: parent.width/2 + 4
anchors {
baseline: tasks_finished_d.baseline
}
text: tasks_finished_listview.count
font {family: "Ubuntu"; pixelSize: 18}
}
Image {
id: tasks_finished_see_more
Behavior on rotation {NumberAnimation { duration: 300 }}
Behavior on scale {NumberAnimation { duration: 50 }}
source: styl.arrow_right_icon
scale: tasks_finished_see_more_ma.containsMouse ? 1.2 : 1
anchors {
right: parent.right
rightMargin: 6
verticalCenter: tasks_finished_d.verticalCenter
}
smooth: true
}
MouseArea {
id: tasks_finished_see_more_ma
anchors {
top: tasks_finished.top
left: tasks_finished_d.left
right: tasks_finished_see_more.right
bottom: tasks_finished_see_more.bottom
}
hoverEnabled: true
onClicked: {
if(listview_rect.height == 0){
tasks_finished_see_more.rotation = 90
listview_rect.height = tasks_finished_listmodel.count * tasks_finished_listview.currentItem.height
}
else {
tasks_finished_see_more.rotation = 0
listview_rect.height = 0
}
}
}
Rectangle {
id: listview_rect
color: styl.panel_back_color
width: parent.width
height: 0
anchors {
left: parent.left
top: tasks_finished.bottom
topMargin: 10
}
Behavior on height {
NumberAnimation { duration: 300 }
}
ListView {
id: tasks_finished_listview
width: parent.width
height: parent.height
interactive: false
anchors {
top: listview_rect.top
}
keyNavigationWraps: true
boundsBehavior: Flickable.StopAtBounds
clip: true
delegate: Item {
id: finished_task_item
width: parent.width
height: todo_name.height + list_name.height + units_done.height + 24
Behavior on height {NumberAnimation { duration: 100 }}
// Hide notes when tasks not visible to prevent messing with height
Connections {
target: tasks_finished_see_more_ma
onClicked: {
if(listview_rect.height != 0 && todo_note.visible == true){
todo_note.visible = false;
finished_task_item.height = finished_task_item.height - todo_note.height - 12
}
}
}
Rectangle {
id: task_color_rect
color: task_color
width: 6
height: parent.height - 4
anchors {
left: parent.left
leftMargin: 2
verticalCenter: parent.verticalCenter
verticalCenterOffset: - small_divider.height/2
}
}
Text {
id: todo_name
property string todotimestamp_string: todotimestamp
color: styl.text_color_primary
width: parent.width - 10
anchors {
left: parent.left
leftMargin: 12
top: parent.top
topMargin: 6
}
text: todoname
elide: Text.ElideRight
font {family: "Ubuntu"; pixelSize: 14}
}
Text {
id: list_name
color: styl.text_color_secondary
width: parent.width - 10
anchors {
top: todo_name.bottom
topMargin: 6
left: parent.left
leftMargin: 12
}
text: tasklistname
elide: Text.ElideRight
font {family: "Ubuntu"; pixelSize: 12}
}
Text {
id: units_done
color: styl.text_color_secondary
anchors {
top: list_name.bottom
topMargin: 6
left: parent.left
leftMargin: 12
}
text: unitsdone
font {family: "Ubuntu"; pixelSize: 12}
}
Text {
id: units_planned
color: styl.text_color_secondary
anchors {
top: list_name.bottom
topMargin: 6
right: parent.right
rightMargin: 6
}
text: unitsplanned
font {family: "Ubuntu"; pixelSize: 12}
}
Rectangle {
id: todo_see_more
visible: visibility
color: "#f1c40f"
width: 14
height: 20
anchors {
right: parent.right
rightMargin: 6
top: todo_name.top
}
MouseArea {
anchors.fill: parent
onClicked: {
if (todo_note.visible) {
todo_note.visible = false;
finished_task_item.height = finished_task_item.height - todo_note.height - 12
listview_rect.height = listview_rect.height - todo_note.height - 12
}
else {
todo_note.visible = true;
finished_task_item.height = finished_task_item.height + todo_note.height + 12
listview_rect.height = listview_rect.height + todo_note.height + 12
}
}
}
}
/*==================== Task Note ========================*/
Text {
id: todo_note
visible: false
color: styl.task_note_text_color
width: parent.width - 24
anchors {
top: units_planned.bottom
topMargin: 10
left: parent.left
leftMargin: 12
}
text: todonote
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
font {family: "Ubuntu"; pixelSize: 14}
}
DividerSmallHor {
id: small_divider
width: parent.width
anchors.bottom: parent.bottom
}
}
model: ListModel {
id: tasks_finished_listmodel
}
}
}
}