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

116 lines
3.3 KiB
C++
Raw Normal View History

#include <QApplication>
#include <QObject>
#include <QStringList>
#include <QVector>
#include <QtGlobal>
#include <QtWebEngine>
#include "ScreenPlayUtil/util.h"
#if defined(Q_OS_WIN)
#include "src/winwindow.h"
#endif
2019-04-01 13:42:35 +02:00
#if defined(Q_OS_LINUX)
#include "src/linuxwindow.h"
#endif
#if defined(Q_OS_OSX)
2019-04-04 17:20:13 +02:00
#include "src/macwindow.h"
#endif
2018-02-18 16:46:47 +01:00
int main(int argc, char* argv[])
{
2021-03-28 18:07:49 +02:00
//QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
2018-12-01 18:01:17 +01:00
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
QStringList argumentList = app.arguments();
if (argumentList.length() == 1) {
#if defined(Q_OS_WIN)
WinWindow window1({ 0 }, "test", "appID=test", "1", "fill", "videoWallpaper", true, true);
//WinWindow window2({ 1 }, "test", "appID=xyz", "1", "fill", true, true);
//WinWindow window3({ 2 }, "test", "appID=123", "1", "fill", true,true);
#endif
2019-04-01 13:42:35 +02:00
#if defined(Q_OS_LINUX)
2020-03-27 16:18:15 +01:00
LinuxWindow window({ 0 }, "/home/graphicscore/Desktop/wallpapers/MechaGirl", "appid", "1", "fill", false);
2019-04-01 13:42:35 +02:00
#endif
2019-04-04 17:20:13 +02:00
#if defined(Q_OS_OSX)
2020-01-30 16:32:24 +01:00
MacWindow window({ 0 }, "test", "appid", "1", "fill");
2019-04-04 17:20:13 +02:00
#endif
2019-04-01 13:42:35 +02:00
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);
#endif
2018-09-06 13:57:36 +02:00
2019-04-01 13:42:35 +02:00
#if defined(Q_OS_LINUX)
LinuxWindow window(
activeScreensList.value(),
projectPath,
appID,
fillmode,
volume,
checkWallpaperVisible);
2019-04-01 13:42:35 +02:00
QObject::connect(&sdk, &ScreenPlaySDK::sdkDisconnected, &window, &LinuxWindow::destroyThis);
QObject::connect(&sdk, &ScreenPlaySDK::incommingMessage, &window, &LinuxWindow::messageReceived);
#endif
#if defined(Q_OS_OSX)
MacWindow window(
activeScreensList.value(),
projectPath,
appID,
fillmode,
volume,
checkWallpaperVisible);
QObject::connect(&sdk, &ScreenPlaySDK::sdkDisconnected, &window, &MacWindow::destroyThis);
QObject::connect(&sdk, &ScreenPlaySDK::incommingMessage, &window, &MacWindow::messageReceived);
#endif
return app.exec();
}