2018-09-06 13:57:36 +02:00
|
|
|
#include "../ScreenPlaySDK/screenplaysdk.h"
|
2019-03-10 21:20:55 +01:00
|
|
|
|
|
|
|
#if defined(Q_OS_WIN)
|
|
|
|
#include "src/winwindow.h"
|
|
|
|
#endif
|
|
|
|
|
2018-01-31 21:54:25 +01:00
|
|
|
#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-01-31 21:54:25 +01:00
|
|
|
|
2018-02-18 16:46:47 +01:00
|
|
|
int main(int argc, char* argv[])
|
2018-01-31 21:54:25 +01:00
|
|
|
{
|
2018-09-06 13:57:36 +02:00
|
|
|
|
2018-02-18 16:46:47 +01:00
|
|
|
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
2018-12-01 18:01:17 +01:00
|
|
|
|
2019-03-10 21:20:55 +01:00
|
|
|
QApplication app(argc, argv);
|
|
|
|
|
2018-09-13 20:23:12 +02:00
|
|
|
QtWebEngine::initialize();
|
2018-01-31 21:54:25 +01:00
|
|
|
|
2019-03-14 18:56:19 +01:00
|
|
|
bool debug = false;
|
|
|
|
if (debug) {
|
|
|
|
QVector<int> list;
|
|
|
|
list.append(0);
|
|
|
|
WinWindow window(list, "D:/672870/_tmp_135011", "argumentList.at(3)", "1");
|
|
|
|
return app.exec();
|
|
|
|
}
|
|
|
|
|
2018-09-06 13:57:36 +02:00
|
|
|
// 6 parameter + 1 OS working directory default paramter
|
2019-03-10 21:20:55 +01:00
|
|
|
QStringList argumentList = app.arguments();
|
2019-03-14 18:56:19 +01:00
|
|
|
qDebug() << argumentList;
|
2018-08-20 15:18:56 +02:00
|
|
|
if (argumentList.length() != 7) {
|
2018-02-18 16:46:47 +01:00
|
|
|
return -3;
|
|
|
|
}
|
|
|
|
|
2019-03-10 21:20:55 +01:00
|
|
|
ScreenPlaySDK sdk;
|
|
|
|
sdk.setAppID(argumentList.at(3));
|
2018-02-18 16:46:47 +01:00
|
|
|
|
2019-03-10 21:20:55 +01:00
|
|
|
QString monitorNumbers = argumentList.at(1);
|
|
|
|
QVector<int> list;
|
|
|
|
|
|
|
|
if (monitorNumbers.length() == 1) {
|
|
|
|
bool canParseMonitorNumber = false;
|
|
|
|
int monitor = monitorNumbers.toInt(&canParseMonitorNumber);
|
2019-03-14 18:56:19 +01:00
|
|
|
if (!canParseMonitorNumber) {
|
|
|
|
qFatal("Could not parse monitor id to diplay wallpaper");
|
|
|
|
}
|
2019-03-10 21:20:55 +01:00
|
|
|
list.append(monitor);
|
|
|
|
} else {
|
|
|
|
QStringList activeScreensList = monitorNumbers.split(",");
|
|
|
|
for (QString s : activeScreensList) {
|
|
|
|
bool ok = false;
|
|
|
|
int val = s.toInt(&ok);
|
|
|
|
if (!ok) {
|
|
|
|
qFatal("Could not parse monitor id to diplay wallpaper");
|
|
|
|
}
|
|
|
|
list.append(val);
|
|
|
|
}
|
2018-02-18 16:46:47 +01:00
|
|
|
}
|
2018-02-14 10:21:15 +01:00
|
|
|
|
2019-03-10 21:20:55 +01:00
|
|
|
// Args: which monitor, (2) path to project, (3)wallpaper secret to identify the connected socket, (5) volume
|
2018-09-06 13:57:36 +02:00
|
|
|
// See screenplay.h @ScreenPlayWallpaper constructor how the args get created
|
2018-02-22 15:22:10 +01:00
|
|
|
|
2019-03-10 21:20:55 +01:00
|
|
|
#if defined(Q_OS_WIN)
|
2019-03-14 18:56:19 +01:00
|
|
|
WinWindow window(list, argumentList.at(2), argumentList.at(3), argumentList.at(5));
|
2019-03-10 21:20:55 +01:00
|
|
|
QObject::connect(&sdk, &ScreenPlaySDK::sdkDisconnected, &window, &WinWindow::destroyThis);
|
|
|
|
QObject::connect(&sdk, &ScreenPlaySDK::incommingMessage, &window, &WinWindow::messageReceived);
|
|
|
|
#endif
|
2018-09-06 13:57:36 +02:00
|
|
|
|
2019-03-10 21:20:55 +01:00
|
|
|
return app.exec();
|
2018-01-31 21:54:25 +01:00
|
|
|
}
|