1 // SPDX-License-Identifier: Apache-2.0
3 * Copyright (C) 2016, 2017 Mentor Graphics Development (Deutschland) GmbH
4 * Copyright (c) 2018 TOYOTA MOTOR CORPORATION
5 * Copyright (C) 2022 Konsulko Group
8 #include <QGuiApplication>
9 #include <QCommandLineParser>
10 #include <QtCore/QUrlQuery>
11 #include <QtGui/QGuiApplication>
12 #include <QtQml/QQmlApplicationEngine>
13 #include <QtQml/QQmlContext>
14 #include <QtQml/qqml.h>
15 #include <QQuickWindow>
18 #include "applicationmodel.h"
20 #include "AppLauncherClient.h"
22 int main(int argc, char *argv[])
24 QString myname = QString("launcher");
25 QGuiApplication app(argc, argv);
27 // necessary to identify correctly by app_id
28 app.setDesktopFileName(myname);
30 QQmlApplicationEngine engine;
32 AppLauncherClient* applauncher = new AppLauncherClient();
33 QList<QMap<QString, QString>> apps;
35 applauncher->listApplications(apps);
36 engine.rootContext()->setContextProperty(QStringLiteral("applauncher"), applauncher);
37 engine.rootContext()->setContextProperty(QStringLiteral("apps_len"), apps.size());
39 qFatal("Could not create AppLauncherClient");
42 ApplicationModel *appmodel = new ApplicationModel();
44 appmodel->initAppList(apps);
45 qmlRegisterSingletonType<ApplicationModel>("AppModel", 1, 0, "ApplicationModel",
46 [appmodel](QQmlEngine *, QJSEngine *) -> QObject * { return appmodel; });
48 qFatal("Could not create ApplicationModel");
50 engine.load(QUrl(QStringLiteral("qrc:/Launcher.qml")));