1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-09-15 06:52:34 +02:00

Cleanup comments and OS specific defines

This commit is contained in:
Elias Steurer 2021-05-12 17:42:38 +02:00
parent dd5f7248c6
commit 36c6f627cf
2 changed files with 20 additions and 26 deletions

View File

@ -9,13 +9,9 @@
#if defined(Q_OS_WIN) #if defined(Q_OS_WIN)
#include "src/winwindow.h" #include "src/winwindow.h"
#endif #elif defined(Q_OS_LINUX)
#if defined(Q_OS_LINUX)
#include "src/linuxwindow.h" #include "src/linuxwindow.h"
#endif #elif defined(Q_OS_OSX)
#if defined(Q_OS_OSX)
#include "src/macwindow.h" #include "src/macwindow.h"
#endif #endif
@ -31,21 +27,17 @@ int main(int argc, char* argv[])
// If we start with only one argument (app path) // If we start with only one argument (app path)
// It means we want to test a single wallpaper // It means we want to test a single wallpaper
QStringList argumentList = app.arguments(); const QStringList argumentList = app.arguments();
// For testing purposes when starting the ScreenPlayWallpaper directly.
if (argumentList.length() == 1) { if (argumentList.length() == 1) {
#if defined(Q_OS_WIN) #if defined(Q_OS_WIN)
WinWindow window1({ 0 }, "test", "appID=test", "1", "fill", "videoWallpaper", true, true); WinWindow window1({ 0 }, "test", "appID=test", "1", "fill", "videoWallpaper", true, true);
//WinWindow window2({ 1 }, "test", "appID=xyz", "1", "fill", true, true); #elif defined(Q_OS_LINUX)
//WinWindow window3({ 2 }, "test", "appID=123", "1", "fill", true,true);
#endif
#if defined(Q_OS_LINUX)
LinuxWindow window({ 0 }, "/home/graphicscore/Desktop/wallpapers/MechaGirl", "appid", "1", "fill", false); LinuxWindow window({ 0 }, "/home/graphicscore/Desktop/wallpapers/MechaGirl", "appid", "1", "fill", false);
#endif #elif defined(Q_OS_OSX)
#if defined(Q_OS_OSX)
MacWindow window({ 0 }, "test", "appid", "1", "fill"); MacWindow window({ 0 }, "test", "appid", "1", "fill");
#endif #endif
return app.exec(); return app.exec();
} }
@ -85,9 +77,7 @@ int main(int argc, char* argv[])
type, type,
checkWallpaperVisible, checkWallpaperVisible,
debugMode); debugMode);
#endif #elif defined(Q_OS_LINUX)
#if defined(Q_OS_LINUX)
LinuxWindow window( LinuxWindow window(
activeScreensList.value(), activeScreensList.value(),
projectPath, projectPath,
@ -95,11 +85,7 @@ int main(int argc, char* argv[])
fillmode, fillmode,
volume, volume,
checkWallpaperVisible); checkWallpaperVisible);
QObject::connect(&sdk, &ScreenPlaySDK::sdkDisconnected, &window, &LinuxWindow::destroyThis); #elif defined(Q_OS_OSX)
QObject::connect(&sdk, &ScreenPlaySDK::incommingMessage, &window, &LinuxWindow::messageReceived);
#endif
#if defined(Q_OS_OSX)
MacWindow window( MacWindow window(
activeScreensList.value(), activeScreensList.value(),
projectPath, projectPath,
@ -107,8 +93,6 @@ int main(int argc, char* argv[])
fillmode, fillmode,
volume, volume,
checkWallpaperVisible); checkWallpaperVisible);
QObject::connect(&sdk, &ScreenPlaySDK::sdkDisconnected, &window, &MacWindow::destroyThis);
QObject::connect(&sdk, &ScreenPlaySDK::incommingMessage, &window, &MacWindow::messageReceived);
#endif #endif
return app.exec(); return app.exec();

View File

@ -85,6 +85,9 @@ BaseWindow::BaseWindow(
setupLiveReloading(); setupLiveReloading();
} }
/*!
\brief messageReceived.
*/
void BaseWindow::messageReceived(QString key, QString value) void BaseWindow::messageReceived(QString key, QString value)
{ {
if (key == "volume") { if (key == "volume") {
@ -145,6 +148,9 @@ void BaseWindow::messageReceived(QString key, QString value)
emit qmlSceneValueReceived(key, value); emit qmlSceneValueReceived(key, value);
} }
/*!
\brief replaceWallpaper.
*/
void BaseWindow::replaceWallpaper( void BaseWindow::replaceWallpaper(
const QString absolutePath, const QString absolutePath,
const QString file, const QString file,
@ -178,8 +184,9 @@ void BaseWindow::replaceWallpaper(
emit reloadGIF(oldType); emit reloadGIF(oldType);
} }
// Used for loading shader /*!
// Loading shader relative to the qml file will be available in Qt 6 \brief Used for loading shader. Loading shader relative to the qml file will be available in Qt 6
*/
QString BaseWindow::loadFromFile(const QString& filename) QString BaseWindow::loadFromFile(const QString& filename)
{ {
QFile file(basePath() + "/" + filename); QFile file(basePath() + "/" + filename);
@ -201,6 +208,9 @@ QString BaseWindow::getApplicationPath()
return QApplication::applicationDirPath(); return QApplication::applicationDirPath();
} }
/*!
\brief This public slot is for QML usage.
*/
void BaseWindow::setupLiveReloading() void BaseWindow::setupLiveReloading()
{ {
auto reloadQMLLambda = [this]() { emit reloadQML(type()); }; auto reloadQMLLambda = [this]() { emit reloadQML(type()); };