Remove dependency on old application framework and wayland
[apps/launcher.git] / launcher / src / main.cpp
1 /*
2  * Copyright (C) 2016, 2017 Mentor Graphics Development (Deutschland) GmbH
3  * Copyright (c) 2018 TOYOTA MOTOR CORPORATION
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17
18 #include <QGuiApplication>
19 #include <QCommandLineParser>
20 #include <QtCore/QUrlQuery>
21 #include <QtGui/QGuiApplication>
22 #include <QtQml/QQmlApplicationEngine>
23 #include <QtQml/QQmlContext>
24 #include <QtQml/qqml.h>
25 #include <QQuickWindow>
26 #include <QThread>
27
28 #include "applicationmodel.h"
29 #include "appinfo.h"
30 #include "homescreenhandler.h"
31
32 int main(int argc, char *argv[])
33 {
34     QString myname = QString("launcher");
35     QGuiApplication a(argc, argv);
36
37     // necessary to identify correctly by app_id
38     a.setDesktopFileName(myname);
39
40     // import C++ class to QML
41     qmlRegisterType<ApplicationModel>("AppModel", 1, 0, "ApplicationModel");
42
43     HomescreenHandler* homescreenHandler = new HomescreenHandler();
44
45     // mail.qml loading
46     QQmlApplicationEngine engine;
47     engine.rootContext()->setContextProperty(QStringLiteral("homescreenHandler"), homescreenHandler);
48     engine.load(QUrl(QStringLiteral("qrc:/Launcher.qml")));
49     homescreenHandler->getRunnables();
50
51     return a.exec();
52 }