/****************************************************************************
** ScStw Monitor
** Copyright (C) 2020 Itsblue development
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see .
****************************************************************************/
#include
#include
#include
#include
#include
#include
#include
#include
#include "headers/scstwmonitorbackend.h"
#if defined(Q_OS_IOS)
#include "sleepprevent.h"
#endif
int main(int argc, char *argv[])
{
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QGuiApplication app(argc, argv);
app.setOrganizationName("itsblue");
app.setOrganizationDomain("itsblue.de");
qmlRegisterType("de.itsblue.ScStwMonitor", 2, 0, "ScStwMonitorBackend");
QQmlApplicationEngine engine;
ScStwLibraries::init();
ScStwStyling::init(&engine);
QSize size = app.screens().first()->size();
engine.rootContext()->setContextProperty("XscreenHeight", size.height());
engine.rootContext()->setContextProperty("XscreenWidth", size.width());
if(argc > 1 && QString(argv[1]) == "--noControls")
engine.rootContext()->setContextProperty("showControls", false);
else
engine.rootContext()->setContextProperty("showControls", true);
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
if (engine.rootObjects().isEmpty())
return -1;
#if defined(Q_OS_IOS)
SleepPrevent sp;
sp.setTimerDisabled();
#endif
// move the cursor into an invisible position
QScreen *screen = QGuiApplication::primaryScreen();
QRect rect = screen->geometry();
QCursor::setPos(rect.width(),rect.height());
return app.exec();
}