-
Notifications
You must be signed in to change notification settings - Fork 4
/
QtWaylandCompositorSlide.qml
93 lines (88 loc) · 3.03 KB
/
QtWaylandCompositorSlide.qml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
import QtQuick 2.8
import QtQuick.Window 2.2
import QtWayland.Compositor 1.0
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
Item {
id: slide
property string qmlfile: "minimal-compositor.qml"
property string workingDirectory: settings.srcDir
property bool active: SwipeView.isCurrentItem || SwipeView.isNextItem
function startOrKillClients() {
if (active) {
compositorLauncher.launch()
editorLauncher.launch()
} else {
compositorLauncher.kill()
editorLauncher.kill()
}
}
onActiveChanged: startOrKillClients()
Shortcut {
enabled: slide.SwipeView.isCurrentItem
sequence: "f6"
onActivated: {
var environment = {
WAYLAND_DISPLAY: "wayland-0",
QT_WAYLAND_DISABLE_WINDOWDECORATION: "0"
};
rootCompositor.runApplication("./run-apps.sh", environment, workingDirectory);
}
}
RowLayout {
anchors.fill: parent
spacing: 0
QtShape {
color: "#f3f3f4"
triangleWidth: settings.vh * 4
triangleColor: "white"
Layout.fillHeight: true
Layout.fillWidth: true
ColumnLayout {
anchors.fill: parent
anchors.margins: settings.slideMargin
spacing: 2 * settings.vh
Heading { text: "Qt Wayland Compositor" }
BulletPoint { text: "Qt APIs for writing a compositor" }
IviApplicationLauncher {
id: editorLauncher
Layout.fillHeight: true
Layout.fillWidth: true
application: "nvim-qt --nofork " + qmlfile
environment: ({QT_WAYLAND_DISABLE_WINDOWDECORATION: "1"})
workingDirectory: slide.workingDirectory
autoLaunch: false
}
}
}
Rectangle {
color: "#888"
Layout.fillHeight: true
Layout.fillWidth: true
IviApplicationLauncher {
id: compositorLauncher
Shortcut { enabled: slide.SwipeView.isCurrentItem; sequence: "f5"; onActivated: compositorLauncher.launch() }
x: image.height * 0.18
y: image.height * 0.31
width: image.width * 0.78
height: image.width * 0.47
application: settings.qmlscene + " " + qmlfile
environment: ({QT_WAYLAND_DISABLE_WINDOWDECORATION: "1"})
workingDirectory: slide.workingDirectory
autoLaunch: false
}
Image {
id: image
anchors.fill: parent
fillMode: Image.PreserveAspectCrop
source: "imx6.png"
enabled: false
}
QtShape {
triangleColor: "white"
anchors.fill: parent
triangleWidth: settings.vh * 4
}
}
}
}