1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-11-07 11:32:42 +01:00
ScreenPlay/ScreenPlayWindow/SPWmain.cpp

42 lines
1.5 KiB
C++
Raw Normal View History

2018-09-06 13:57:36 +02:00
#include "../ScreenPlaySDK/screenplaysdk.h"
#include "src/SPWmainwindow.h"
#include <QApplication>
2018-09-06 13:57:36 +02:00
#include <QObject>
2018-02-18 16:46:47 +01:00
#include <QStringList>
2018-09-13 20:23:12 +02:00
#include <QtWebEngine>
2018-02-18 16:46:47 +01:00
int main(int argc, char* argv[])
{
2018-09-06 13:57:36 +02:00
2018-02-18 16:46:47 +01:00
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
2018-11-26 22:31:07 +01:00
QApplication a(argc, argv);
2018-09-06 13:57:36 +02:00
ScreenPlaySDK sdk;
2018-09-13 20:23:12 +02:00
QtWebEngine::initialize();
2018-09-06 13:57:36 +02:00
// 6 parameter + 1 OS working directory default paramter
QStringList argumentList = a.arguments();
if (argumentList.length() != 7) {
2018-02-18 16:46:47 +01:00
return -3;
}
2018-09-06 13:57:36 +02:00
bool canParseMonitorNumber = false;
int monitor = argumentList.at(1).toInt(&canParseMonitorNumber);
2018-02-18 16:46:47 +01:00
2018-09-06 13:57:36 +02:00
if (!canParseMonitorNumber) {
2018-02-18 16:46:47 +01:00
return -4;
}
2018-02-14 10:21:15 +01:00
2018-09-06 13:57:36 +02:00
// Args: which monitor, (2) path to project, (3)wallpaper secret to identify the connected socket, (4) decoder, (5) volume, (6) fillmode
// See screenplay.h @ScreenPlayWallpaper constructor how the args get created
// MainWindow w(0,"D:/672870/827148653","","","","");
2018-09-07 20:56:38 +02:00
sdk.setAppID(argumentList.at(3));
qDebug() << "Starting MainWindow: " << argumentList.at(2) << argumentList.at(3) << argumentList.at(4) << argumentList.at(5) << argumentList.at(6);
MainWindow w(monitor, argumentList.at(2), argumentList.at(3), argumentList.at(4), argumentList.at(5), argumentList.at(6));
2018-09-06 13:57:36 +02:00
QObject::connect(&sdk, &ScreenPlaySDK::sdkDisconnected, &w, &MainWindow::destroyThis);
2018-09-07 20:56:38 +02:00
QObject::connect(&sdk, &ScreenPlaySDK::incommingMessage, &w, &MainWindow::messageReceived);
2018-09-06 13:57:36 +02:00
return a.exec();
}