2 * Copyright (C) 2017 Canonical Ltd.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 import Lomiri.Components 1.3
19 import QtMir.Application 0.1
20 import WindowManager 1.0
22 import "../../Components"
28 property var workspace
30 property string background
31 property int screenHeight
33 property real previewScale: previewSpace.height / previewSpace.screenHeight
35 property bool containsDragLeft: false
36 property bool containsDragRight: false
37 property bool isActive: false
38 property bool isSelected: false
41 source: previewSpace.background
43 sourceSize.width: width
44 sourceSize.height: height
47 id: topLevelSurfaceRepeater
48 model: visible ? workspace.windowModel : null
50 width: surfaceItem.width
51 height: surfaceItem.height + decorationHeight * previewScale
52 x: model.window.position.x * previewScale
53 y: (model.window.position.y - decorationHeight) * previewScale
54 z: topLevelSurfaceRepeater.count - index
55 visible: model.window.state !== Mir.MinimizedState && model.window.state !== Mir.HiddenState
57 property int decorationHeight: units.gu(3)
60 width: surfaceItem.implicitWidth
61 height: parent.decorationHeight
68 title: model.window && model.window.surface ? model.window.surface.name : ""
74 y: parent.decorationHeight * previewScale
75 width: implicitWidth * previewScale
76 height: implicitHeight * previewScale
79 surface: model.window.surface
88 border.color: LomiriColors.ash
89 border.width: units.gu(.5)
91 visible: previewSpace.isActive
96 border.color: LomiriColors.blue
97 border.width: units.gu(.5)
99 visible: previewSpace.isSelected
104 anchors.rightMargin: parent.width / 2
106 visible: previewSpace.containsDragLeft
109 anchors.centerIn: parent
112 source: "../graphics/multi-monitor_drop-here.png"
115 anchors.horizontalCenter: parent.horizontalCenter
118 text: qsTr("Drop here")
125 anchors.leftMargin: parent.width / 2
127 visible: previewSpace.containsDragRight
130 anchors.centerIn: parent
133 source: "../graphics/multi-monitor_leave.png"
136 anchors.horizontalCenter: parent.horizontalCenter
139 text: qsTr("Drop and go")