2017-03-27 16:38:42 +02:00
|
|
|
|
#include <QDebug>
|
|
|
|
|
#include <QDir>
|
|
|
|
|
#include <QGuiApplication>
|
2017-05-13 10:50:15 +02:00
|
|
|
|
#include <QIcon>
|
2017-03-27 16:38:42 +02:00
|
|
|
|
#include <QLibrary>
|
2017-04-05 13:04:13 +02:00
|
|
|
|
#include <QModelIndex>
|
2017-03-25 18:44:26 +01:00
|
|
|
|
#include <QQmlApplicationEngine>
|
2017-04-05 13:04:13 +02:00
|
|
|
|
#include <QQmlContext>
|
2017-04-23 12:53:00 +02:00
|
|
|
|
#include <QQmlEngine>
|
2017-05-13 10:50:15 +02:00
|
|
|
|
#include <QQuickStyle>
|
2017-03-25 18:44:26 +01:00
|
|
|
|
#include <QQuickView>
|
2017-03-27 15:38:25 +02:00
|
|
|
|
#include <QScreen>
|
|
|
|
|
#include <QUrl>
|
2017-04-05 13:04:13 +02:00
|
|
|
|
#include <QVariant>
|
2017-03-27 16:38:42 +02:00
|
|
|
|
#include <QWindow>
|
2017-06-26 22:00:51 +02:00
|
|
|
|
#include <QObject>
|
2017-05-13 10:50:15 +02:00
|
|
|
|
#include <QtQuick/QQuickItem>
|
2017-03-27 16:38:42 +02:00
|
|
|
|
#include <qt_windows.h>
|
2017-03-25 18:44:26 +01:00
|
|
|
|
|
2017-04-23 12:53:00 +02:00
|
|
|
|
#include "backend.h"
|
2017-04-03 18:48:34 +02:00
|
|
|
|
#include "installedlistmodel.h"
|
2017-04-28 14:43:43 +02:00
|
|
|
|
#include "monitorlistmodel.h"
|
2017-06-06 12:51:53 +02:00
|
|
|
|
#include "packagefilehandler.h"
|
2017-04-05 13:04:13 +02:00
|
|
|
|
#include "screenplay.h"
|
2017-05-02 21:26:43 +02:00
|
|
|
|
#include "settings.h"
|
2017-06-06 12:51:53 +02:00
|
|
|
|
#include "profilelistmodel.h"
|
2017-03-25 18:44:26 +01:00
|
|
|
|
|
2017-03-27 16:38:42 +02:00
|
|
|
|
int main(int argc, char* argv[])
|
2017-03-25 18:44:26 +01:00
|
|
|
|
{
|
2017-06-06 12:51:53 +02:00
|
|
|
|
|
|
|
|
|
Q_INIT_RESOURCE(qml);
|
|
|
|
|
|
2017-03-25 18:44:26 +01:00
|
|
|
|
QGuiApplication app(argc, argv);
|
|
|
|
|
|
2017-06-26 22:00:51 +02:00
|
|
|
|
|
2017-04-28 14:43:43 +02:00
|
|
|
|
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
2017-03-27 16:38:42 +02:00
|
|
|
|
QCoreApplication::setOrganizationName("Aimber");
|
|
|
|
|
QCoreApplication::setOrganizationDomain("aimber.net");
|
|
|
|
|
QCoreApplication::setApplicationName("ScreenPlay");
|
2017-04-17 12:54:53 +02:00
|
|
|
|
app.setWindowIcon(QIcon(":/assets/icons/favicon.ico"));
|
2017-05-13 10:50:15 +02:00
|
|
|
|
QQuickStyle::setStyle("Material");
|
2017-03-27 15:38:25 +02:00
|
|
|
|
|
2017-04-28 14:43:43 +02:00
|
|
|
|
InstalledListModel installedListModel;
|
|
|
|
|
MonitorListModel monitorListModel;
|
2017-06-06 12:51:53 +02:00
|
|
|
|
PackageFileHandler packageFileHandler;
|
|
|
|
|
ProfileListModel profileListModel;
|
|
|
|
|
// Create settings at the end because for now it depends on
|
|
|
|
|
// such things as the profile list model to complete
|
2017-06-27 18:42:38 +02:00
|
|
|
|
Settings settings(&profileListModel, &monitorListModel, &installedListModel);
|
2017-06-26 22:00:51 +02:00
|
|
|
|
|
2017-04-03 18:48:34 +02:00
|
|
|
|
|
2017-06-26 22:00:51 +02:00
|
|
|
|
QQmlApplicationEngine mainWindowEngine;
|
|
|
|
|
|
2017-06-30 10:04:19 +02:00
|
|
|
|
installedListModel.loadScreens();
|
2017-06-26 22:00:51 +02:00
|
|
|
|
mainWindowEngine.rootContext()->setContextProperty("monitorListModel", &monitorListModel);
|
|
|
|
|
mainWindowEngine.rootContext()->setContextProperty("installedListModel", &installedListModel);
|
|
|
|
|
mainWindowEngine.rootContext()->setContextProperty("settings", &settings);
|
|
|
|
|
mainWindowEngine.rootContext()->setContextProperty("packageFileHandler", &packageFileHandler);
|
|
|
|
|
mainWindowEngine.rootContext()->setContextProperty("profileListModel", &profileListModel);
|
|
|
|
|
mainWindowEngine.load(QUrl(QStringLiteral("qrc:/qml/main.qml")));
|
2017-04-23 12:53:00 +02:00
|
|
|
|
|
2017-06-21 11:23:55 +02:00
|
|
|
|
// FIXME: Needed workaround to close the app because
|
|
|
|
|
// apparently some thread still runs in the background
|
|
|
|
|
QObject::connect(&app, &QGuiApplication::lastWindowClosed,
|
|
|
|
|
[&](){exit(app.exec()); });
|
2017-04-06 23:12:58 +02:00
|
|
|
|
|
|
|
|
|
|
2017-06-30 10:04:19 +02:00
|
|
|
|
profileListModel.loadProfiles();
|
2017-04-03 18:48:34 +02:00
|
|
|
|
int status = app.exec();
|
|
|
|
|
|
|
|
|
|
//Shutdown
|
2017-04-23 12:53:00 +02:00
|
|
|
|
return app.exec();
|
2017-03-25 18:44:26 +01:00
|
|
|
|
}
|