33.2.1
by Kunal Parmar
Code refactoring |
1 |
import QtQuick 2.0 |
2 |
import Ubuntu.Components 0.1 |
|
3 |
||
4 |
import "dateExt.js" as DateExt |
|
5 |
import "colorUtils.js" as Color |
|
6 |
||
7 |
Item { |
|
8 |
id: baseView
|
|
9 |
||
10 |
property var dayStart: new Date() |
|
11 |
property alias eventModel: model; |
|
33.2.3
by Kunal Parmar
Typo flickble->flickable fixed |
12 |
property Flickable flickableChild; |
33.2.1
by Kunal Parmar
Code refactoring |
13 |
|
14 |
state: "COMPRESSED" |
|
15 |
||
16 |
signal newEvent() |
|
17 |
signal modelRefreshed(); |
|
18 |
||
19 |
clip: true |
|
20 |
||
21 |
EventListModel { |
|
22 |
id: model
|
|
23 |
termStart: dayStart |
|
24 |
termLength: Date.msPerDay |
|
25 |
||
26 |
onReload: { |
|
27 |
modelRefreshed(); |
|
28 |
}
|
|
29 |
}
|
|
30 |
||
31 |
Connections{ |
|
33.2.3
by Kunal Parmar
Typo flickble->flickable fixed |
32 |
target: flickableChild |
33.2.1
by Kunal Parmar
Code refactoring |
33 |
|
33.2.7
by Kunal Parmar
expand() and compress() remove and using state instead |
34 |
onContentYChanged: { |
33.2.3
by Kunal Parmar
Typo flickble->flickable fixed |
35 |
if (state == "COMPRESSING" || state == "EXPANDING" || !flickableChild.dragging ) return |
33.2.1
by Kunal Parmar
Code refactoring |
36 |
|
33.2.3
by Kunal Parmar
Typo flickble->flickable fixed |
37 |
if ( state == "EXPANDED" && flickableChild.contentY < -units.gu(0.5) ) { |
33.2.1
by Kunal Parmar
Code refactoring |
38 |
state = "COMPRESSING"; |
39 |
}
|
|
33.2.3
by Kunal Parmar
Typo flickble->flickable fixed |
40 |
else if (flickableChild.contentY < -units.gu(0.5)) { |
33.2.1
by Kunal Parmar
Code refactoring |
41 |
state = "EXPANDING"; |
33.2.7
by Kunal Parmar
expand() and compress() remove and using state instead |
42 |
}
|
33.2.1
by Kunal Parmar
Code refactoring |
43 |
}
|
44 |
||
45 |
onDraggingChanged: { |
|
33.2.3
by Kunal Parmar
Typo flickble->flickable fixed |
46 |
if (flickableChild.dragging) return; |
33.2.1
by Kunal Parmar
Code refactoring |
47 |
|
48 |
if( state == "EXPANDING" ) { |
|
49 |
state = "EXPANDED"; |
|
50 |
} else if ( state == "COMPRESSING") { |
|
51 |
state = "COMPRESSED"; |
|
33.2.7
by Kunal Parmar
expand() and compress() remove and using state instead |
52 |
}
|
33.2.1
by Kunal Parmar
Code refactoring |
53 |
}
|
54 |
}
|
|
55 |
||
56 |
states: [ |
|
57 |
State { |
|
58 |
name: "EXPANDING" |
|
59 |
},
|
|
60 |
State { |
|
61 |
name: "COMPRESSING" |
|
62 |
},
|
|
63 |
State { |
|
64 |
name: "EXPANDED" |
|
65 |
},
|
|
66 |
State { |
|
67 |
name: "COMPRESSED" |
|
68 |
}
|
|
69 |
]
|
|
70 |
}
|