1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-11-07 03:22:33 +01:00
ScreenPlay/main.cpp
2017-04-17 12:54:53 +02:00

50 lines
1.4 KiB
C++

#include <QDebug>
#include <QDir>
#include <QGuiApplication>
#include <QLibrary>
#include <QModelIndex>
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include <QQuickView>
#include <QScreen>
#include <QUrl>
#include <QVariant>
#include <QWindow>
#include <qt_windows.h>
#include "installedlistmodel.h"
#include "screenplay.h"
#include "mainwindow.h"
int main(int argc, char* argv[])
{
QGuiApplication app(argc, argv);
QCoreApplication::setOrganizationName("Aimber");
QCoreApplication::setOrganizationDomain("aimber.net");
QCoreApplication::setApplicationName("ScreenPlay");
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
app.setWindowIcon(QIcon(":/assets/icons/favicon.ico"));
InstalledListModel ilm;
QQmlApplicationEngine mainWindow;
mainWindow.rootContext()->setContextProperty("installedListModel", &ilm);
mainWindow.load(QUrl(QStringLiteral("qrc:/qml/main.qml")));
ScreenPlay sp(GetSystemMetrics(SM_CXSCREEN),GetSystemMetrics(SM_CYSCREEN));
sp.context()->setContextProperty("installedListModel",&ilm);
sp.loadQQuickView(QUrl(QStringLiteral("qrc:/qml/Components/ScreenPlay.qml")));
sp.showQQuickView(GetSystemMetrics(SM_CXSCREEN),GetSystemMetrics(SM_CYSCREEN));
QObject::connect(&ilm, &InstalledListModel::setScreenVisible,
&sp,&ScreenPlay::setVisible);
int status = app.exec();
//Shutdown
return status;
}