mirror of
https://gitlab.com/kelteseth/ScreenPlay.git
synced 2024-11-22 18:52:30 +01:00
Fix window closing for now
This commit is contained in:
parent
b3511af3c0
commit
5c93667cd6
29
main.cpp
29
main.cpp
@ -13,6 +13,7 @@
|
||||
#include <QUrl>
|
||||
#include <QVariant>
|
||||
#include <QWindow>
|
||||
#include <QObject>
|
||||
#include <QtQuick/QQuickItem>
|
||||
#include <qt_windows.h>
|
||||
|
||||
@ -31,6 +32,7 @@ int main(int argc, char* argv[])
|
||||
|
||||
QGuiApplication app(argc, argv);
|
||||
|
||||
|
||||
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
QCoreApplication::setOrganizationName("Aimber");
|
||||
QCoreApplication::setOrganizationDomain("aimber.net");
|
||||
@ -44,32 +46,25 @@ int main(int argc, char* argv[])
|
||||
ProfileListModel profileListModel;
|
||||
// Create settings at the end because for now it depends on
|
||||
// such things as the profile list model to complete
|
||||
Settings settings;
|
||||
monitorListModel.loadMonitors();
|
||||
Settings settings(&profileListModel);
|
||||
|
||||
QQmlApplicationEngine mainWindow;
|
||||
mainWindow.rootContext()->setContextProperty("monitorListModel", &monitorListModel);
|
||||
mainWindow.rootContext()->setContextProperty("installedListModel", &installedListModel);
|
||||
mainWindow.rootContext()->setContextProperty("settings", &settings);
|
||||
mainWindow.rootContext()->setContextProperty("packageFileHandler", &packageFileHandler);
|
||||
mainWindow.rootContext()->setContextProperty("profileListModel", &profileListModel);
|
||||
|
||||
mainWindow.load(QUrl(QStringLiteral("qrc:/qml/main.qml")));
|
||||
QQmlApplicationEngine mainWindowEngine;
|
||||
|
||||
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")));
|
||||
|
||||
// FIXME: Needed workaround to close the app because
|
||||
// apparently some thread still runs in the background
|
||||
QObject::connect(&app, &QGuiApplication::lastWindowClosed,
|
||||
[&](){exit(app.exec()); });
|
||||
ScreenPlay sp(GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN));
|
||||
sp.context()->setContextProperty("installedListModel", &installedListModel);
|
||||
sp.context()->setContextProperty("settings", &settings);
|
||||
|
||||
sp.loadQQuickView(QUrl(QStringLiteral("qrc:/qml/Components/ScreenPlay.qml")));
|
||||
sp.showQQuickView(GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN));
|
||||
|
||||
installedListModel.loadScreens();
|
||||
QObject::connect(&installedListModel, &InstalledListModel::setScreenVisible,
|
||||
&sp, &ScreenPlay::setVisible);
|
||||
|
||||
int status = app.exec();
|
||||
|
||||
//Shutdown
|
||||
|
Loading…
Reference in New Issue
Block a user