summaryrefslogtreecommitdiffstats
path: root/src/application-lib/applicationinterface.cpp
blob: aff2658c9583a35f891703360d48e8607973cd70 (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
190
191
192
193
194
195
196
197
/****************************************************************************
**
** Copyright (C) 2019 Luxoft Sweden AB
** Copyright (C) 2018 Pelagicore AG
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Luxoft Application Manager.
**
** $QT_BEGIN_LICENSE:LGPL-QTAS$
** Commercial License Usage
** Licensees holding valid commercial Qt Automotive Suite licenses may use
** this file in accordance with the commercial license agreement provided
** with the Software or, alternatively, in accordance with the terms
** contained in a written agreement between you and The Qt Company.  For
** licensing terms and conditions see https://www.qt.io/terms-conditions.
** For further information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
** SPDX-License-Identifier: LGPL-3.0
**
****************************************************************************/

/*!
    \qmltype ApplicationInterface
    \inqmlmodule QtApplicationManager.Application
    \ingroup app-singletons
    \brief The main interface between apps and the application-manager.

    This item is available for QML applications using the root context property
    \c ApplicationInterface. For other native applications, the same interface
    - minus the notification functionality - is available on a private peer-to-peer
    D-Bus interface.

    For every application that is started in multi-process mode, the application-manager creates
    a private P2P D-Bus connection and communicates the connection address to the application's
    process via the environment variable \c AM_DBUS_PEER_ADDRESS.

    Using this connection, you will have access to different interfaces (note that due to
    this not being a bus, the service name is always an empty string):

    \table
    \header
        \li Path \br Name
        \li Description
    \row
        \li \b /ApplicationInterface \br \e io.qt.ApplicationManager.ApplicationInterface
        \li Exactly this interface in D-Bus form. The definition is in the source distribution at
            \c{src/dbus/io.qt.applicationmanager.applicationinterface.xml}
    \row
        \li \b /RuntimeInterface \br \e io.qt.ApplicationManager.RuntimeInterface
        \li The direct interface between the application-manager and the launcher process, used to
            implement custom launchers: the definition is in the source distribution at
            \c{src/dbus/io.qt.applicationmanager.runtimeinterface.xml}
    \row
        \li \b /ExtensionInterfaces/<ext_name> \br \e <ext.name>
        \li Any IPC interface registered via the ApplicationIPCManager (and matching the corresponding
            filter), will be exported on this P2P connection. The path name is constructed from the
            interface name by replacing every character that is not alpha-numeric with an underscore
            (\c{_}).
    \endtable

    If you are re-implementing the client side, note that the remote interfaces are not
    available immediately after connecting: they are registered on the server side only after the
    client connects. This is a limitation of the D-Bus design - the default implementation attempts
    to connect for 100ms before throwing an error.
*/

/*!
    \qmlproperty string ApplicationInterface::applicationId
    \readonly

    The application id of your application.
*/

/*!
    \qmlproperty var ApplicationInterface::name
    \readonly

    An object containing language (\c string) to application name (\c string) mapppings. See
    \l{application-name-map}{name} in the manifest (info.yaml) definition.
*/

/*!
    \qmlproperty url ApplicationInterface::icon
    \readonly

    The URL of the application's icon as given in the manifest. This can be used as the source
    property of an Image.
*/

/*!
    \qmlproperty string ApplicationInterface::version
    \readonly

    The version of the application as specified in the manifest.
*/

/*!
    \qmlproperty var ApplicationInterface::systemProperties
    \readonly

    Returns the project specific \l{system properties} that were set via the config file.
*/

/*!
    \qmlproperty var ApplicationInterface::applicationProperties
    \readonly

    Returns an object with properties that have been listed under the \c applicationProperties field in the
    \l{Manifest Definition}{manifest} file (info.yaml) of the application.
*/

/*!
    \qmlmethod Notification ApplicationInterface::createNotification()

    Calling this function lets you create a \l Notification object dynamically at runtime.
*/

/*!
    \qmlmethod ApplicationInterface::acknowledgeQuit()

    This method should be called in response to the \l quit() signal, once the application
    is ready to be terminated (e.g. persistent data has been written).

    \note This method should be called instead of \c Qt.quit() to obtain the same
    behavior in single- and multi-process mode (it does nothing in single process mode).

    \sa quit()
*/


/*!
    \qmlsignal ApplicationInterface::quit()

    The application-manager will send out this signal to an application to request a
    controlled shutdown. The application is given a certain amount of time defined in
    the configuration (\c quitTime). If the time elapses before acknowledgeQuit() is
    called, the application will simply be killed.

    \sa acknowledgeQuit()
*/

/*!
    \qmlsignal ApplicationInterface::memoryLowWarning()

    This signal will be sent out whenever a system dependent free-memory threshold has
    been crossed. Your application is expected to free up as many resources as
    possible in this case: this will most likely involve clearing internal caches.

    \sa memoryCriticalWarning()
*/

/*!
    \qmlsignal ApplicationInterface::memoryCriticalWarning()

    This signal will be sent out whenever a system dependent free-memory threshold has
    been crossed. It is usually sent after a \c memoryLowWarninig and should
    be perceived as a last notice to urgently free as many resources as possible to
    keep the system stable.

    \sa memoryLowWarning()
*/

/*!
    \qmlsignal ApplicationInterface::openDocument(string documentUrl, string mimeType)

    Whenever an already running application is started again with an argument, the
    already running instance will just receive this signal, instead of starting a
    separate application instance.
    The \a documentUrl parameter received by this function can either be the
    \c documentUrl argument of ApplicationManager::startApplication, the \c documentUrl
    field of the \l{Manifest definition}{info.yaml} manifest when calling
    ApplicationManager::startApplication without a \c documentUrl argument or
    the \c target argument of Qt::openUrlExternally, when your application matches
    a MIME-type request. In the latter case \a mimeType contains the MIME-type detected
    by the ApplicationManager.
*/