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/>.
18import Lomiri.Components 1.3
19import QtMir.Application 0.1
20import WindowManager 1.0
22import "../../Components"
28 property var workspace
30 property QtObject screen
31 property string background
32 property int screenHeight
34 property real previewScale: previewSpace.height / previewSpace.screenHeight
36 property bool containsDragLeft: false
37 property bool containsDragRight: false
38 property bool isActive: false
39 property bool isSelected: false
42 source: previewSpace.background
44 sourceSize.width: width
45 sourceSize.height: height
48 id: topLevelSurfaceRepeater
49 model: visible ? workspace.windowModel : null
51 readonly property bool isMaximized : model.window.state === Mir.MaximizedState
52 width: surfaceItem.width * previewScale
53 height: surfaceItem.height + decorationHeight * previewScale
54 x: isMaximized ? 0 : (model.window.position.x - screen.position.x) * previewScale
55 y: isMaximized ? 0 : (model.window.position.y - screen.position.y - decorationHeight) * previewScale
56 z: topLevelSurfaceRepeater.count - index
57 visible: model.window.state !== Mir.MinimizedState && model.window.state !== Mir.HiddenState
59 property int decorationHeight: units.gu(3)
62 width: surfaceItem.implicitWidth
63 height: parent.decorationHeight
70 title: model.window && model.window.surface ? model.window.surface.name : ""
76 y: parent.decorationHeight * previewScale
78 height: implicitHeight
79 surface: model.window.surface
94 border.color: LomiriColors.ash
95 border.width: units.gu(.5)
97 visible: previewSpace.isActive
102 border.color: LomiriColors.blue
103 border.width: units.gu(.5)
105 visible: previewSpace.isSelected
110 anchors.rightMargin: parent.width / 2
112 visible: previewSpace.containsDragLeft
115 anchors.centerIn: parent
118 source: "../graphics/multi-monitor_drop-here.png"
121 anchors.horizontalCenter: parent.horizontalCenter
124 text: qsTr("Drop here")
131 anchors.leftMargin: parent.width / 2
133 visible: previewSpace.containsDragRight
136 anchors.centerIn: parent
139 source: "../graphics/multi-monitor_leave.png"
142 anchors.horizontalCenter: parent.horizontalCenter
145 text: qsTr("Drop and go")