on xenial help sign in
split it up
84a5759Michael Zanetti
qml/Stage/Spread/ScreensAndWorkspaces.qml+5−53
@@ -11,64 +11,16 @@ Item {
11 Rectangle { anchors.fill: parent; color: "blue"; opacity: .3 }
11 Rectangle { anchors.fill: parent; color: "blue"; opacity: .3 }
12
12
13 Row {
13 Row {
14− anchors.centerIn: parent
14+ anchors.bottom: parent.bottom
15+ anchors.bottomMargin: units.gu(1)
16+ anchors.horizontalCenter: parent.horizontalCenter
15 spacing: units.gu(1)
17 spacing: units.gu(1)
16
18
17 Repeater {
19 Repeater {
18 model: Screens
20 model: Screens
19
21
20− delegate: Rectangle {
22+ delegate: WorkspacePreview {
21− id: previewSpace
22− height: root.height * .5
23+ height: root.height - units.gu(6)
23− width: height * 1.4
24− color: "red"
25−
26− property int screenWidth: model.geometry.width
27− property int screenHeight: model.geometry.height
28−
29− Label {
30− text: model.name + "," + model.geometry.width
31− }
32−
33− Rectangle {
34− anchors.fill: parent
35− anchors.topMargin: units.gu(4)
36−
37− Repeater {
38− id: topLevelSurfaceRepeater
39− model: topLevelSurfaceList
40− delegate: Rectangle {
41− width: surfaceItem.width
42− height: surfaceItem.height
43− x: model.window.position.x * surfaceItem.previewScale
44− y: model.window.position.y * surfaceItem.previewScale
45− color: "blue"
46− z: topLevelSurfaceRepeater.count - index
47−
48−
49− MirSurfaceItem {
50− id: surfaceItem
51−
52− property real previewScale: previewSpace.width / previewSpace.screenWidth
53−
54− width: implicitWidth * previewScale
55− height: implicitHeight * previewScale
56−// fillMode: MirSurfaceItem.Stretch
57− surfaceWidth: -1
58− surfaceHeight: -1
59− onImplicitHeightChanged: print("item", surfaceItem, "height changed", implicitHeight)
60− // surfaceWidth: 100
61− // surfaceHeight: 100
62− // requestedHeight: 100// -1// !counterRotate ? root.requestedHeight - d.requestedDecorationHeight : root.requestedWidth
63− // requestedWidth: 100// -1// !counterRotate ? root.requestedWidth : root.requestedHeight - d.requestedDecorationHeight
64−
65− // application: model.application
66− surface: model.window.surface
67− }
68− }
69− }
70− }
71−
72 }
24 }
73 }
25 }
74 }
26 }
qml/Stage/WorkspacePreview.qmlnew file+50
@@ -0,0 +1,50 @@
1+import QtQuick 2.4
2+import Ubuntu.Components 1.3
3+import Unity.Application 0.1
4+
5+UbuntuShape {
6+ id: previewSpace
7+
8+ // Set the height. this preview will then automatically adjust the width, keeping aspect ratio of the screen
9+ width: model.geometry.width * previewScale
10+ color: "white"
11+
12+ property int screenWidth: model.geometry.width
13+ property int screenHeight: model.geometry.height
14+ property real previewScale: previewSpace.height / previewSpace.screenHeight
15+
16+ Label {
17+ text: model.name + "," + model.geometry.width
18+ color: "black"
19+ }
20+
21+ Rectangle {
22+ anchors.fill: parent
23+ anchors.topMargin: units.gu(4)
24+
25+ Repeater {
26+ id: topLevelSurfaceRepeater
27+ model: topLevelSurfaceList
28+ delegate: Rectangle {
29+ width: surfaceItem.width
30+ height: surfaceItem.height
31+ x: model.window.position.x * previewSpace.previewScale
32+ y: model.window.position.y * previewSpace.previewScale
33+ color: "blue"
34+ z: topLevelSurfaceRepeater.count - index
35+
36+
37+ MirSurfaceItem {
38+ id: surfaceItem
39+
40+ width: implicitWidth * previewScale
41+ height: implicitHeight * previewScale
42+ surfaceWidth: -1
43+ surfaceHeight: -1
44+ onImplicitHeightChanged: print("item", surfaceItem, "height changed", implicitHeight)
45+ surface: model.window.surface
46+ }
47+ }
48+ }
49+ }
50+}