@@ -1,212 +0,0 @@
1−import QtQuick 2.4
2−import Ubuntu.Components 1.3
3−import Unity.Screens 0.1
4−import Unity.Application 0.1
5−import "../Components"
6−
7−UbuntuShape {
8− id: previewSpace
9−
10− // Set the height. this preview will then automatically adjust the width, keeping aspect ratio of the screen
11− width: model.geometry.width * previewScale * 4
12− color: "white"
13− property string background
14−
15− property int screenWidth: model.geometry.width
16− property int screenHeight: model.geometry.height
17− property real previewScale: (previewSpace.height - header.height) / previewSpace.screenHeight
18−
19− Item {
20− id: header
21− anchors { left: parent.left; top: parent.top; right: parent.right }
22− height: units.gu(7)
23−
24− Column {
25− anchors.fill: parent
26− anchors.margins: units.gu(1)
27−
28− Label {
29− text: model.name
30− color: "black"
31− }
32−
33− Label {
34− text: model.outputType === Screens.LVDS ? "Built-in" : "Clone"
35− color: "black"
36− fontSize: "x-small"
37− }
38−
39− Label {
40− text: model.geometry.width + "x" + model.geometry.height
41− color: "black"
42− fontSize: "x-small"
43− }
44− }
45− }
46−
47−
48− Rectangle {
49− anchors.fill: parent
50− anchors.topMargin: header.height
51− color: "blue"
52−
53− Repeater {
54− id: workspaceRepeater
55− model: 15
56−
57− delegate: Item {
58− x: index * previewSpace.screenWidth * previewScale
59− height: previewSpace.screenHeight * previewScale
60− width: previewSpace.screenWidth * previewScale
61− clip: true
62−
63− Wallpaper {
64− source: previewSpace.background
65− anchors.fill: parent
66−
67− // Repeater {
68− // id: topLevelSurfaceRepeater
69− // model: visible ? topLevelSurfaceList : null
70− // delegate: Rectangle {
71− // width: surfaceItem.width
72− // height: surfaceItem.height + decorationHeight * previewScale
73− // x: model.window.position.x * previewScale
74− // y: (model.window.position.y - decorationHeight) * previewScale
75− // color: "blue"
76− // z: topLevelSurfaceRepeater.count - index
77−
78− // property int decorationHeight: units.gu(3)
79−
80− // WindowDecoration {
81− // width: surfaceItem.implicitWidth
82− // height: parent.decorationHeight
83− // transform: Scale {
84− // origin.x: 0
85− // origin.y: 0
86− // xScale: previewScale
87− // yScale: previewScale
88− // }
89− // title: model.window && model.window.surface ? model.window.surface.name : ""
90− // z: 3
91− // }
92−
93− // MirSurfaceItem {
94− // id: surfaceItem
95− // y: parent.decorationHeight * previewScale
96− // width: implicitWidth * previewScale
97− // height: implicitHeight * previewScale
98− // surfaceWidth: -1
99− // surfaceHeight: -1
100− // onImplicitHeightChanged: print("item", surfaceItem, "height changed", implicitHeight)
101− // surface: model.window.surface
102− // }
103− // }
104− // }
105− }
106− }
107−
108−
109−// MouseArea {
110−// id: mouseArea
111−// anchors.centerIn: parent
112−// anchors.verticalCenterOffset: header.height / 2
113−// width: units.gu(8)
114−// height: width
115−// hoverEnabled: true
116−// opacity: containsMouse ? 1 : 0
117−
118−// Rectangle {
119−// anchors.fill: parent
120−// color: "#80000000"
121−// radius: height / 2
122−// }
123−
124−// NumberAnimation {
125−// target: canvas
126−// property: "progress"
127−// duration: 2000
128−// running: mouseArea.containsMouse
129−// from: 0
130−// to: 1
131−// }
132−
133−// Canvas {
134−// id: canvas
135−// height: parent.height
136−// width: height
137−// anchors.centerIn: parent
138−
139−// property real progress: 0.5
140−// property int lineWidth: units.dp(4)
141−// onProgressChanged: {
142−// requestPaint();
143−// if (progress == 1) {
144−// Screens.activateScreen(index);
145−// }
146−// }
147−
148−// rotation: -90
149−
150−// onPaint: {
151−// var ctx = canvas.getContext("2d");
152−// ctx.save();
153−// ctx.reset();
154−
155−// ctx.lineWidth = lineWidth;
156−
157−// ctx.strokeStyle = "#3bffffff"
158−// ctx.beginPath();
159−// ctx.arc(canvas.width/2,canvas.height/2, (canvas.height - ctx.lineWidth) / 2, 0, (Math.PI*2),false);
160−// ctx.stroke();
161−// ctx.closePath();
162−
163−// ctx.strokeStyle = "white"
164−// ctx.beginPath();
165−// ctx.arc(canvas.width/2,canvas.height/2, (canvas.height - ctx.lineWidth) / 2, 0, (Math.PI*2*(progress)),false);
166−// ctx.stroke();
167−// ctx.closePath();
168−
169−// ctx.restore();
170−// }
171−// }
172−
173−// Icon {
174−// source: "graphics/multi-monitor_leave.png"
175−// height: units.gu(4)
176−// width: height
177−// anchors.centerIn: parent
178−// }
179−// }
180− }
181−
182− FloatingFlickable {
183− id: flickable
184− anchors.fill: parent
185− contentWidth: workspaceRepeater.count * previewSpace.screenWidth * previewScale
186− property real progress: contentX / contentWidth
187− onContentXChanged: print("contentX:", contentX, "progress:", progress)
188− }
189−
190− MouseArea {
191− anchors.fill: parent
192− hoverEnabled: true
193− property int scrollAreaWidth: width / 3
194−
195− onMouseXChanged: {
196− var margins = flickable.width * 0.05;
197−
198− // do we need to scroll?
199− if (mouseX < scrollAreaWidth + margins) {
200− var progress = Math.min(1, (scrollAreaWidth + margins - mouseX) / (scrollAreaWidth - margins));
201− var contentX = (1 - progress) * (flickable.contentWidth - flickable.width)
202− flickable.contentX = Math.max(0, Math.min(flickable.contentX, contentX))
203− }
204− if (mouseX > flickable.width - scrollAreaWidth) {
205− var progress = Math.min(1, (mouseX - (flickable.width - scrollAreaWidth)) / (scrollAreaWidth - margins))
206− var contentX = progress * (flickable.contentWidth - flickable.width)
207− flickable.contentX = Math.min(flickable.contentWidth - flickable.width, Math.max(flickable.contentX, contentX))
208− }
209− }
210− }
211− }
212−}