@@ -1,5 +1,6 @@
11import QtQuick 2.0
22import Ubuntu.Components 0.1
3+import Ubuntu.Gestures 0.1
34import Unity.Application 0.1
45import "../Components"
56
@@ -13,6 +14,7 @@ Item {
1314 // Controls to be set from outside
1415 property bool shown: false
1516 property bool moving: false
17+ property int dragAreaWidth
1618
1719 // State information propagated to the outside
1820 readonly property bool painting: mainScreenshotImage.visible || fadeInScreenshotImage.visible || appSplash.visible
@@ -175,4 +177,100 @@ Item {
175177 source: src
176178 visible: false
177179 }
180+
181+ EdgeDragArea {
182+ id: coverFlipDragArea
183+ direction: Direction.Rightwards
184+
185+ //enabled: root.available
186+ anchors { top: parent.top; right: parent.right; bottom: parent.bottom }
187+ width: root.dragAreaWidth
188+
189+ onTouchXChanged: {
190+ print("touchX changed", touchX)
191+ coverFlip.progress = -(touchX - root.dragAreaWidth) / root.width
192+ }
193+// onDraggingChanged: {
194+// if (dragging) {
195+// coverFlip.visible = true
196+// }
197+// }
198+
199+ Rectangle {
200+ anchors.fill: parent
201+ color: "green"
202+ opacity: .4
203+ }
204+ }
205+
206+ Rectangle {
207+ id: coverFlipBackground
208+ anchors.fill: parent
209+ color: "black"
210+ visible: coverFlip.visible
211+ }
212+
213+ Row {
214+ id: coverFlip
215+ height: parent.height
216+ x: 0
217+ visible: coverFlipDragArea.dragging
218+
219+ property real progress: 0
220+ property int maxAngle: 70
221+ onProgressChanged: print("CoverFlip progress changed", progress)
222+
223+ Repeater {
224+ model: ApplicationManager
225+
226+ Item {
227+ height: parent.height
228+ width: appImage.implicitWidth - (coverFlip.progress * appImage.implicitWidth)
229+
230+ Image {
231+ id: appImage
232+ height: parent.height
233+ source: ApplicationManager.get(index).screenshot
234+
235+ transform: [
236+ Rotation {
237+ origin { x: units.gu(5); y: height / 2 }
238+ axis { x: 0; y: 1; z: 0 }
239+ angle: {
240+ switch (index) {
241+ case 0:
242+ if (coverFlip.progress < .5) {
243+ return coverFlip.progress * coverFlip.maxAngle
244+ } else {
245+ return (coverFlip.progress - .5) * coverFlip.maxAngle * 2
246+ }
247+ case 1:
248+ if (coverFlip.progress < .5) {
249+ return coverFlip.maxAngle - (coverFlip.progress * coverFlip.maxAngle * 2)
250+ } else {
251+ return (coverFlip.progress - .5) * coverFlip.maxAngle * 2
252+ }
253+ }
254+ return Math.min(coverFlip.progress, .75) * coverFlip.maxAngle
255+ }
256+ },
257+ Translate {
258+ x: {
259+ switch (index) {
260+ case 1:
261+ if (coverFlip.progress < .5) {
262+ return -root.width * coverFlip.progress;
263+ } else if (coverFlip.progress < .75) {
264+ // relation equation: x : width/2 = progress-.5 : 0.25
265+ return (-root.width * .5) + (root.width/2) * (coverFlip.progress - .5) / 0.25
266+ }
267+ }
268+ return 0;
269+ }
270+ }
271+ ]
272+ }
273+ }
274+ }
275+ }
178276}