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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
|
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
pragma ComponentBehavior: Bound
import QtQuick
import QtQuick.Window
import QtLauncher
import QtLauncher.QtImageProviders
Item {
id: mainWindow
anchors.fill: parent
required property LauncherCompositor compositor
required property ListModel shellSurfaces
required property Window window
required property real pageMargin
ApplicationsModel {
id: applicationsModel
onReady: {
engine.markApplicationsModelReady();
contentLoader.active = true
}
Component.onCompleted: {
//Set the directory to parse for apps
initialize(mainWindow.compositor.appsRoot);
}
function launchFromIndex(index: int) {
demoInfoPopup.description = applicationsModel.query(index, "description")
demoInfoPopup.title = applicationsModel.query(index, "name")
demoHeader.title = applicationsModel.query(index, "name")
mainWindow.compositor.scalableDemo = applicationsModel.query(index, "scalable")
var iconFile = "" + applicationsModel.query(index, "icon")
//We don't have thumbnail image for this demo, let's schedule a screenshot
if (iconFile.endsWith("_missing")) {
demoSurface.scheduleScreenshot(iconFile.replace("_missing", ""))
}
appLoadScreen.applicationName = applicationsModel.query(index, "name")
appLoadScreen.visible = true
engine.launchApplication(applicationsModel.query(index, "binary"),
applicationsModel.query(index, "arguments"),
applicationsModel.query(index, "environment")
)
}
}
Background {
engine: engine
BootScreen {
id: appLoadScreen
visible: false
anchors.fill: parent
}
}
Component {
id: gridComponent
LaunchScreen {
id: launchScreen
appsModel: applicationsModel
pageMargin: mainWindow.pageMargin
}
}
Component {
id: detailComponent
DetailView {
id: detailView
appsModel: applicationsModel
pageMargin: mainWindow.pageMargin
}
}
Engine {
id: engine
}
Item {
id: root
anchors.fill: parent
Loader {
id: contentLoader
visible: engine.state === "running"
anchors.fill: parent
anchors.topMargin: header.height + mainWindow.pageMargin
sourceComponent: SettingsManager.gridSelected ? gridComponent : detailComponent
active: false
}
Header {
id: header
pageMargin: mainWindow.pageMargin
visible: engine.state === "running"
}
DemoSurface {
id: demoSurface
model: mainWindow.shellSurfaces
anchors.fill: parent
onSurfaceVisible: (visible)=> { appLoadScreen.visible = visible; }
onSurfaceDestroyed: (index)=> { mainWindow.shellSurfaces.remove(index); }
}
DemoHeader {
id: demoHeader
engine: engine
pageMargin: mainWindow.pageMargin
visible: engine.state === "app-running"
onInfoClicked: demoInfoPopup.open()
onCloseClicked: engine.closeApplication();
}
DemoInfoPopup {
id: demoInfoPopup
pageMargin: mainWindow.pageMargin
visible: false
height: mainWindow.height
width: mainWindow.width
z: demoHeader.z + 1
}
}
}
|