1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-09-03 09:09:48 +02:00
ScreenPlay/ScreenPlayWallpaper/main.cpp

108 lines
3.1 KiB
C++
Raw Normal View History

#include <QApplication>
#include <QObject>
#include <QStringList>
#include <QVector>
#include <QtGlobal>
2021-07-15 12:07:39 +02:00
#include <QtWebEngineQuick>
#include "ScreenPlayUtil/util.h"
#if defined(Q_OS_WIN)
#include "src/winwindow.h"
#elif defined(Q_OS_LINUX)
2019-04-01 13:42:35 +02:00
#include "src/linuxwindow.h"
#elif defined(Q_OS_OSX)
2019-04-04 17:20:13 +02:00
#include "src/macwindow.h"
#endif
Q_IMPORT_QML_PLUGIN(ScreenPlayWeatherPlugin)
Q_IMPORT_QML_PLUGIN(ScreenPlaySysInfoPlugin)
2018-02-18 16:46:47 +01:00
int main(int argc, char* argv[])
{
QApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
2021-07-15 12:07:39 +02:00
QtWebEngineQuick::initialize();
QApplication app(argc, argv);
// This gives us nice clickable output in QtCreator
qSetMessagePattern("%{if-category}%{category}: %{endif}%{message}\n Loc: [%{file}:%{line}]");
// If we start with only one argument (app path)
// It means we want to test a single wallpaper
const QStringList argumentList = app.arguments();
// For testing purposes when starting the ScreenPlayWallpaper directly.
if (argumentList.length() == 1) {
#if defined(Q_OS_WIN)
// WinWindow window1({ 0 }, "test", "appID=test", "1", "fill", "videoWallpaper", true, true);
WinWindow window1({ 1 }, "C:/Program Files (x86)/Steam/steamapps/workshop/content/672870/26092021185017", "appID=test", "1", "fill", "videoWallpaper", true, true);
#elif defined(Q_OS_LINUX)
2021-08-24 18:20:40 +02:00
LinuxWindow window({ 0 }, "test", "appID=test", "1", "fill", "videoWallpaper", false, true);
#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();
}
// 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;
}
const bool debugMode = false;
2018-02-14 10:21:15 +01:00
const auto activeScreensList = ScreenPlayUtil::parseStringToIntegerList(argumentList.at(1));
if (!activeScreensList.has_value())
return -4;
// 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);
bool okParseCheckWallpaperVisible = false;
bool checkWallpaperVisible = argumentList.at(7).toInt(&okParseCheckWallpaperVisible);
if (!okParseCheckWallpaperVisible) {
qFatal("Could not parse checkWallpaperVisible");
return -5;
}
#if defined(Q_OS_WIN)
WinWindow window(
activeScreensList.value(),
projectFilePath,
appID,
volume,
fillmode,
type,
checkWallpaperVisible,
debugMode);
#elif defined(Q_OS_LINUX)
LinuxWindow window(
activeScreensList.value(),
2021-08-24 18:20:40 +02:00
projectFilePath,
appID,
volume,
2021-08-24 18:20:40 +02:00
fillmode,
type,
checkWallpaperVisible,
debugMode);
#elif defined(Q_OS_OSX)
MacWindow window(
2021-07-25 15:30:37 +02:00
activeScreensList.value(),
projectFilePath,
appID,
volume,
fillmode,
type,
checkWallpaperVisible,
debugMode);
#endif
return app.exec();
}