blob: 04f0d60fc7798971279cf62dde4630f8f93ef374 (
plain)
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
|
// Copyright (C) 2021 The Qt Company Ltd.
// Copyright (C) 2019 Luxoft Sweden AB
// Copyright (C) 2018 Pelagicore AG
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QUuid>
#include "global.h"
#include "logging.h"
#include "application.h"
#include "abstractruntime.h"
#include "abstractcontainer.h"
#include "globalruntimeconfiguration.h"
#include "exception.h"
/*!
\qmltype Runtime
\inqmlmodule QtApplicationManager.SystemUI
\ingroup system-ui-non-instantiable
\brief The handle for a runtime that is executing an application.
While an \l{ApplicationObject}{Application} is running, the associated Runtime object will be
valid and yield access to runtime related information.
Right now, only the accessor property for the \l Container object is exposed to the QML side.
*/
/*!
\qmlproperty Container Runtime::container
\readonly
This property returns the \l Container object of a running application. Please see the \l{Containers}
{general Container} and the \l Container class documentation for more information on containers
within the application manager.
*/
QT_BEGIN_NAMESPACE_AM
AbstractRuntime::AbstractRuntime(AbstractContainer *container, Application *app, AbstractRuntimeManager *manager)
: QObject(manager)
, m_container(container)
, m_app(app)
, m_manager(manager)
{
Q_STATIC_ASSERT(SecurityTokenSize == sizeof(QUuid));
m_securityToken = QUuid::createUuid().toRfc4122();
}
QVariantMap AbstractRuntime::configuration() const
{
if (m_manager)
return m_manager->configuration();
return QVariantMap();
}
QVariantMap AbstractRuntime::systemProperties() const
{
if (m_app) {
const auto &grc = GlobalRuntimeConfiguration::instance();
return m_app->isBuiltIn() ? grc.systemPropertiesForBuiltInApps
: grc.systemPropertiesForThirdPartyApps;
}
return QVariantMap();
}
RuntimeSignaler *AbstractRuntime::signaler()
{
static RuntimeSignaler rs;
return &rs;
}
QByteArray AbstractRuntime::securityToken() const
{
return m_securityToken;
}
void AbstractRuntime::openDocument(const QString &document, const QString &mimeType)
{
Q_UNUSED(document)
Q_UNUSED(mimeType)
}
void AbstractRuntime::setSlowAnimations(bool slow)
{
// not every runtime needs this information
Q_UNUSED(slow)
}
Application *AbstractRuntime::application() const
{
return m_app.data();
}
AbstractRuntime::~AbstractRuntime()
{
delete m_container;
}
AbstractRuntimeManager *AbstractRuntime::manager() const
{
return m_manager;
}
/*!
\qmlproperty string Runtime::runtimeId
\readonly
\since 6.10
This property returns the \c id of the runtime that is executing the application. The \c id
is a unique identifier for the runtime integration and can be used to reference it in other
parts of the System UI or in configuration files.
*/
QString AbstractRuntime::runtimeId() const
{
return m_manager->identifier();
}
bool AbstractRuntime::isQuickLauncher() const
{
return false;
}
bool AbstractRuntime::attachApplicationToQuickLauncher(Application *app)
{
Q_UNUSED(app)
return false;
}
Am::RunState AbstractRuntime::state() const
{
return m_state;
}
void AbstractRuntime::setState(Am::RunState newState)
{
if (m_state != newState) {
m_state = newState;
emit stateChanged(newState);
}
}
void AbstractRuntime::setInProcessQmlEngine(QQmlEngine *engine)
{
m_inProcessQmlEngine = engine;
}
QQmlEngine *AbstractRuntime::inProcessQmlEngine() const
{
return m_inProcessQmlEngine;
}
AbstractContainer *AbstractRuntime::container() const
{
return m_container;
}
AbstractRuntimeManager::AbstractRuntimeManager(const QString &id, QObject *parent)
: QObject(parent)
, m_id(id)
{ }
QString AbstractRuntimeManager::identifier() const
{
return m_id;
}
bool AbstractRuntimeManager::inProcess() const
{
return false;
}
bool AbstractRuntimeManager::supportsQuickLaunch() const
{
return false;
}
QVariantMap AbstractRuntimeManager::configuration() const
{
return m_configuration;
}
void AbstractRuntimeManager::setConfiguration(const QVariantMap &configuration)
{
m_configuration = configuration;
}
QT_END_NAMESPACE_AM
#include "moc_abstractruntime.cpp"
|