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 width: surfaceItem.width
52 height: surfaceItem.height + decorationHeight * previewScale
53 x: (model.window.position.x - screen.position.x) * previewScale
54 y: (model.window.position.y - screen.position.y - decorationHeight) * previewScale
55 z: topLevelSurfaceRepeater.count - index
56 visible: model.window.state !== Mir.MinimizedState && model.window.state !== Mir.HiddenState
58 property int decorationHeight: units.gu(3)
61 width: surfaceItem.implicitWidth
62 height: parent.decorationHeight
69 title: model.window && model.window.surface ? model.window.surface.name : ""
75 y: parent.decorationHeight * previewScale
76 width: implicitWidth * previewScale
77 height: implicitHeight * previewScale
80 surface: model.window.surface
89 border.color: LomiriColors.ash
90 border.width: units.gu(.5)
92 visible: previewSpace.isActive
97 border.color: LomiriColors.blue
98 border.width: units.gu(.5)
100 visible: previewSpace.isSelected
105 anchors.rightMargin: parent.width / 2
107 visible: previewSpace.containsDragLeft
110 anchors.centerIn: parent
113 source: "../graphics/multi-monitor_drop-here.png"
116 anchors.horizontalCenter: parent.horizontalCenter
119 text: qsTr("Drop here")
126 anchors.leftMargin: parent.width / 2
128 visible: previewSpace.containsDragRight
131 anchors.centerIn: parent
134 source: "../graphics/multi-monitor_leave.png"
137 anchors.horizontalCenter: parent.horizontalCenter
140 text: qsTr("Drop and go")