2019-03-27 18:38:36 +01:00
|
|
|
#include <QApplication>
|
|
|
|
#include <QObject>
|
|
|
|
#include <QStringList>
|
2020-02-15 17:49:48 +01:00
|
|
|
#include <QVector>
|
2019-03-27 18:38:36 +01:00
|
|
|
#include <QtGlobal>
|
2021-07-15 12:07:39 +02:00
|
|
|
#include <QtWebEngineQuick>
|
2019-03-10 21:20:55 +01:00
|
|
|
|
2021-04-18 17:23:21 +02:00
|
|
|
#include "ScreenPlayUtil/util.h"
|
|
|
|
|
2019-03-10 21:20:55 +01:00
|
|
|
#if defined(Q_OS_WIN)
|
|
|
|
#include "src/winwindow.h"
|
2021-05-12 17:42:38 +02:00
|
|
|
#elif defined(Q_OS_LINUX)
|
2019-04-01 13:42:35 +02:00
|
|
|
#include "src/linuxwindow.h"
|
2021-05-12 17:42:38 +02:00
|
|
|
#elif defined(Q_OS_OSX)
|
2019-04-04 17:20:13 +02:00
|
|
|
#include "src/macwindow.h"
|
2019-03-27 18:38:36 +01:00
|
|
|
#endif
|
|
|
|
|
2018-02-18 16:46:47 +01:00
|
|
|
int main(int argc, char* argv[])
|
2018-01-31 21:54:25 +01:00
|
|
|
{
|
2020-03-27 14:29:44 +01:00
|
|
|
QApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
|
2021-07-15 12:07:39 +02:00
|
|
|
QtWebEngineQuick::initialize();
|
|
|
|
|
2019-03-10 21:20:55 +01:00
|
|
|
QApplication app(argc, argv);
|
2019-11-23 11:40:52 +01:00
|
|
|
|
2019-03-27 18:38:36 +01:00
|
|
|
// This gives us nice clickable output in QtCreator
|
|
|
|
qSetMessagePattern("%{if-category}%{category}: %{endif}%{message}\n Loc: [%{file}:%{line}]");
|
|
|
|
|
2019-03-24 16:52:07 +01:00
|
|
|
// If we start with only one argument (app path)
|
|
|
|
// It means we want to test a single wallpaper
|
2021-05-12 17:42:38 +02:00
|
|
|
const QStringList argumentList = app.arguments();
|
2019-07-27 11:36:33 +02:00
|
|
|
|
2021-05-12 17:42:38 +02:00
|
|
|
// For testing purposes when starting the ScreenPlayWallpaper directly.
|
2021-04-18 17:23:21 +02:00
|
|
|
if (argumentList.length() == 1) {
|
2019-03-27 18:38:36 +01:00
|
|
|
#if defined(Q_OS_WIN)
|
2021-12-11 17:05:41 +01:00
|
|
|
// WinWindow window1({ 0 }, "test", "appID=test", "1", "fill", "videoWallpaper", true, true);
|
|
|
|
WinWindow window1({ 0, 1, 2 }, "C:/Program Files (x86)/Steam/steamapps/workshop/content/672870/hordemp4", "appID=test", "1", "fill", "videoWallpaper", true, true);
|
2021-05-12 17:42:38 +02:00
|
|
|
#elif defined(Q_OS_LINUX)
|
2021-08-24 18:20:40 +02:00
|
|
|
LinuxWindow window({ 0 }, "test", "appID=test", "1", "fill", "videoWallpaper", false, true);
|
2021-05-12 17:42:38 +02:00
|
|
|
#elif defined(Q_OS_OSX)
|
2021-07-25 15:30:37 +02:00
|
|
|
MacWindow window({ 0 }, "test", "appID=test", "1", "fill", "videoWallpaper", true, true);
|
2019-04-04 17:20:13 +02:00
|
|
|
#endif
|
2019-03-14 18:56:19 +01:00
|
|
|
return app.exec();
|
|
|
|
}
|
|
|
|
|
2021-04-18 17:23:21 +02:00
|
|
|
// 8 parameter + 1 OS working directory as the first default paramter
|
2020-05-23 14:37:00 +02:00
|
|
|
if (argumentList.length() != 9) {
|
2018-02-18 16:46:47 +01:00
|
|
|
return -3;
|
|
|
|
}
|
|
|
|
|
2021-04-18 18:03:08 +02:00
|
|
|
const bool debugMode = false;
|
2018-02-14 10:21:15 +01:00
|
|
|
|
2021-04-18 17:23:21 +02:00
|
|
|
const auto activeScreensList = ScreenPlayUtil::parseStringToIntegerList(argumentList.at(1));
|
|
|
|
|
|
|
|
if (!activeScreensList.has_value())
|
2019-11-23 17:19:26 +01:00
|
|
|
return -4;
|
2020-02-15 17:49:48 +01:00
|
|
|
|
2021-04-18 17:23:21 +02:00
|
|
|
// See ScreenPlayWallpaper m_appArgumentsList constructor how the args get created
|
|
|
|
const QString projectFilePath = argumentList.at(2);
|
|
|
|
const QString appID = argumentList.at(3);
|
|
|
|
const QString volume = argumentList.at(4);
|
|
|
|
const QString fillmode = argumentList.at(5);
|
|
|
|
const QString type = argumentList.at(6);
|
2018-02-22 15:22:10 +01:00
|
|
|
|
2020-02-15 17:49:48 +01:00
|
|
|
bool okParseCheckWallpaperVisible = false;
|
|
|
|
bool checkWallpaperVisible = argumentList.at(7).toInt(&okParseCheckWallpaperVisible);
|
|
|
|
if (!okParseCheckWallpaperVisible) {
|
|
|
|
qFatal("Could not parse checkWallpaperVisible");
|
|
|
|
return -5;
|
|
|
|
}
|
|
|
|
|
2019-03-10 21:20:55 +01:00
|
|
|
#if defined(Q_OS_WIN)
|
2021-04-18 17:23:21 +02:00
|
|
|
WinWindow window(
|
|
|
|
activeScreensList.value(),
|
|
|
|
projectFilePath,
|
|
|
|
appID,
|
|
|
|
volume,
|
|
|
|
fillmode,
|
|
|
|
type,
|
|
|
|
checkWallpaperVisible,
|
|
|
|
debugMode);
|
2021-05-12 17:42:38 +02:00
|
|
|
#elif defined(Q_OS_LINUX)
|
2021-04-18 17:23:21 +02:00
|
|
|
LinuxWindow window(
|
|
|
|
activeScreensList.value(),
|
2021-08-24 18:20:40 +02:00
|
|
|
projectFilePath,
|
2021-04-18 17:23:21 +02:00
|
|
|
appID,
|
|
|
|
volume,
|
2021-08-24 18:20:40 +02:00
|
|
|
fillmode,
|
|
|
|
type,
|
|
|
|
checkWallpaperVisible,
|
|
|
|
debugMode);
|
2021-05-12 17:42:38 +02:00
|
|
|
#elif defined(Q_OS_OSX)
|
2021-04-18 17:23:21 +02:00
|
|
|
MacWindow window(
|
2021-07-25 15:30:37 +02:00
|
|
|
activeScreensList.value(),
|
|
|
|
projectFilePath,
|
|
|
|
appID,
|
|
|
|
volume,
|
|
|
|
fillmode,
|
|
|
|
type,
|
|
|
|
checkWallpaperVisible,
|
|
|
|
debugMode);
|
2019-03-27 18:38:36 +01:00
|
|
|
#endif
|
|
|
|
|
2019-03-10 21:20:55 +01:00
|
|
|
return app.exec();
|
2018-01-31 21:54:25 +01:00
|
|
|
}
|