on xenial help sign in
first take on adding screens to the spread
a884ed9Michael Zanetti
qml/Stage/Spread/ScreensAndWorkspaces.qmlnew file+75
@@ -0,0 +1,75 @@
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 ".."
6+
7+Item {
8+ id: root
9+
10+
11+ Rectangle { anchors.fill: parent; color: "blue"; opacity: .3 }
12+
13+ Row {
14+ anchors.centerIn: parent
15+ spacing: units.gu(1)
16+
17+ Repeater {
18+ model: Screens
19+
20+ delegate: Rectangle {
21+ id: previewSpace
22+ height: root.height * .5
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+ }
73+ }
74+ }
75+}
qml/Stage/Spread/Spread.qml+5−5
@@ -28,10 +28,10 @@ Item {
28 property var spreadFlickable
28 property var spreadFlickable
29
29
30 // some config options
30 // some config options
31− property real contentMargin: 0.16 * root.height
31+ property real contentMargin: 0.1 * root.height
32− property real contentTopMargin: contentMargin
32+ property real contentTopMargin: contentMargin + root.y + windowTitle.height
33− property real contentBottomMargin: 0.35 * contentMargin
33+ property real contentBottomMargin: contentMargin
34− property real windowTitleTopMargin: 3/4 * (contentTopMargin - windowTitle.height)
34+ property real windowTitleTopMargin: contentMargin - windowTitle.height
35 property int stackItemCount: 3
35 property int stackItemCount: 3
36 property real leftRotationAngle: 22
36 property real leftRotationAngle: 22
37 property real rightRotationAngle: 32
37 property real rightRotationAngle: 32
@@ -51,7 +51,7 @@ Item {
51
51
52 readonly property real spreadWidth: rightStackXPos - leftStackXPos
52 readonly property real spreadWidth: rightStackXPos - leftStackXPos
53 readonly property real spreadHeight: root.height
53 readonly property real spreadHeight: root.height
54− readonly property real spreadItemHeight: spreadHeight - contentTopMargin - contentBottomMargin
54+ readonly property real spreadItemHeight: spreadHeight - contentMargin * 2
55 readonly property real spreadItemWidth: stackHeight
55 readonly property real spreadItemWidth: stackHeight
56
56
57 readonly property real dynamicLeftRotationAngle: leftRotationAngle * rotationAngleFactor
57 readonly property real dynamicLeftRotationAngle: leftRotationAngle * rotationAngleFactor
qml/Stage/Stage.qml+8−2
@@ -469,7 +469,7 @@ FocusScope {
469 },
469 },
470 State {
470 State {
471 name: "staged"; when: root.mode === "staged"
471 name: "staged"; when: root.mode === "staged"
472− PropertyChanges { target: wallpaper; visible: false }
472+ PropertyChanges { target: wallpaper; visible: priv.focusedAppDelegate && priv.focusedAppDelegate.x === 0 }
473 },
473 },
474 State {
474 State {
475 name: "stagedWithSideStage"; when: root.mode === "stagedWithSideStage"
475 name: "stagedWithSideStage"; when: root.mode === "stagedWithSideStage"
@@ -546,10 +546,16 @@ FocusScope {
546 visible: false
546 visible: false
547 }
547 }
548
548
549+ ScreensAndWorkspaces {
550+ id: screensAndWorkspaces
551+ anchors { left: parent.left; top: parent.top; right: parent.right }
552+ height: parent.height / 3
553+ }
554+
549 Spread {
555 Spread {
550 id: spreadItem
556 id: spreadItem
551 objectName: "spreadItem"
557 objectName: "spreadItem"
552− anchors.fill: appContainer
558+ anchors { left: parent.left; bottom: parent.bottom; right: parent.right; top: screensAndWorkspaces.bottom }
553 leftMargin: root.leftMargin
559 leftMargin: root.leftMargin
554 model: root.topLevelSurfaceList
560 model: root.topLevelSurfaceList
555 spreadFlickable: floatingFlickable
561 spreadFlickable: floatingFlickable
qml/Stage/SurfaceContainer.qml+2
@@ -66,6 +66,8 @@ FocusScope {
66 fillMode: MirSurfaceItem.PadOrCrop
66 fillMode: MirSurfaceItem.PadOrCrop
67 consumesInput: true
67 consumesInput: true
68
68
69+ onSurfaceChanged: print("surface changed", surface, implicitWidth, implicitHeight)
70+
69 surfaceWidth: root.requestedWidth
71 surfaceWidth: root.requestedWidth
70 surfaceHeight: root.requestedHeight
72 surfaceHeight: root.requestedHeight
71
73
tests/mocks/Unity/Application/MirSurfaceItem.cpp+5
@@ -293,6 +293,10 @@ void MirSurfaceItem::setSurface(MirSurfaceInterface* surface)
293 connect(m_qmlSurface, &MirSurface::screenshotUrlChanged, this, &MirSurfaceItem::updateScreenshot);
293 connect(m_qmlSurface, &MirSurface::screenshotUrlChanged, this, &MirSurfaceItem::updateScreenshot);
294 connect(m_qmlSurface, &MirSurface::liveChanged, this, &MirSurfaceItem::liveChanged);
294 connect(m_qmlSurface, &MirSurface::liveChanged, this, &MirSurfaceItem::liveChanged);
295 connect(m_qmlSurface, &MirSurface::stateChanged, this, &MirSurfaceItem::surfaceStateChanged);
295 connect(m_qmlSurface, &MirSurface::stateChanged, this, &MirSurfaceItem::surfaceStateChanged);
296+ connect(m_qmlSurface, &MirSurface::sizeChanged, this, [this] () {
297+ m_qmlItem->setSize(m_qmlSurface->size());
298+ setImplicitSize(m_qmlSurface->width(), m_qmlSurface->height());
299+ });
296
300
297 QUrl qmlComponentFilePath;
301 QUrl qmlComponentFilePath;
298 if (!m_qmlSurface->qmlFilePath().isEmpty()) {
302 if (!m_qmlSurface->qmlFilePath().isEmpty()) {
@@ -387,6 +391,7 @@ void MirSurfaceItem::updateSurfaceSize()
387 m_qmlItem->setWidth(m_surfaceWidth);
391 m_qmlItem->setWidth(m_surfaceWidth);
388 m_qmlItem->setHeight(m_surfaceHeight);
392 m_qmlItem->setHeight(m_surfaceHeight);
389 }
393 }
394+ qDebug() << this << "setting implicitsize" << m_surfaceWidth << m_surfaceHeight;
390 setImplicitSize(m_surfaceWidth, m_surfaceHeight);
395 setImplicitSize(m_surfaceWidth, m_surfaceHeight);
391 }
396 }
392}
397}
tests/mocks/Unity/Screens/screens.cpp+1
@@ -70,6 +70,7 @@ QVariant Screens::data(const QModelIndex &index, int role) const
70
70
71 switch(role) {
71 switch(role) {
72 case ScreenRole:
72 case ScreenRole:
73+ qDebug() << "returning" << m_screenList.at(index.row())->qScreen;
73 return QVariant::fromValue(m_screenList.at(index.row())->qScreen);
74 return QVariant::fromValue(m_screenList.at(index.row())->qScreen);
74 case OutputTypeRole:
75 case OutputTypeRole:
75 return m_screenList.at(index.row())->outputTypes;
76 return m_screenList.at(index.row())->outputTypes;