diff --git a/ScreenPlay/app.cpp b/ScreenPlay/app.cpp index 4b5d8438..791cb5d0 100644 --- a/ScreenPlay/app.cpp +++ b/ScreenPlay/app.cpp @@ -95,7 +95,7 @@ App::App() } m_create = make_unique(m_globalVariables); - m_screenPlayManager = make_unique(m_globalVariables, m_monitorListModel, m_sdkConnector, m_telemetry); + m_screenPlayManager = make_unique(m_globalVariables, m_monitorListModel, m_sdkConnector, m_telemetry, m_settings); QObject::connect(m_sdkConnector.get(), &SDKConnector::requestDecreaseWidgetCount, m_screenPlayManager.get(), &ScreenPlayManager::decreaseActiveWidgetsCounter); // When the installed storage path changed diff --git a/ScreenPlay/qml/Settings/Settings.qml b/ScreenPlay/qml/Settings/Settings.qml index af90f701..e830c02b 100644 --- a/ScreenPlay/qml/Settings/Settings.qml +++ b/ScreenPlay/qml/Settings/Settings.qml @@ -267,15 +267,14 @@ Item { spacing: 10 SettingBool { - headline: qsTr("Pause wallpaper while ingame") - available: false - description: qsTr("To maximise your framerates ingame, you can enable this setting to pause all active wallpapers!") - isChecked: ScreenPlay.settings.pauseWallpaperWhenIngame + headline: qsTr("Pause wallpaper while another app is in the foreground") + description: qsTr("We disable the video rendering (not the audio!) for the best performance. If you have problem you can disable this behaviour here. Wallpaper restart required!") + isChecked: ScreenPlay.settings.checkWallpaperVisible onCheckboxChanged: { - ScreenPlay.settings.setPauseWallpaperWhenIngame( + ScreenPlay.settings.setCheckWallpaperVisible( checked) ScreenPlay.settings.writeSingleSettingConfig( - "setPauseWallpaperWhenIngame", + "checkWallpaperVisible", checked) } } diff --git a/ScreenPlay/src/screenplaymanager.cpp b/ScreenPlay/src/screenplaymanager.cpp index 80d228a7..d9ba9c4b 100644 --- a/ScreenPlay/src/screenplaymanager.cpp +++ b/ScreenPlay/src/screenplaymanager.cpp @@ -19,12 +19,14 @@ ScreenPlayManager::ScreenPlayManager( const shared_ptr& mlm, const shared_ptr& sdkc, const shared_ptr& telemetry, + const shared_ptr& settings, QObject* parent) : QObject { parent } , m_globalVariables { globalVariables } , m_monitorListModel { mlm } , m_sdkconnector { sdkc } , m_telemetry { telemetry } + , m_settings { settings } { loadWallpaperProfiles(); } @@ -59,44 +61,17 @@ void ScreenPlayManager::createWallpaper( monitors.append(index); } - QJsonObject settings; - std::shared_ptr wallpaper; - - if (type == "videoWallpaper") { - wallpaper = make_shared( - monitorIndex, - m_globalVariables, - Util::generateRandomString(), - path, - previewImage, - volume, - fillMode, - type); - - settings.insert("monitors", monitors); - settings.insert("type", type); - settings.insert("volume", static_cast(volume)); - settings.insert("isLooping", true); - settings.insert("fillMode", fillMode); - settings.insert("previewImage", previewImage); - settings.insert("absolutePath", path); - - } else if (type == "qmlWallpaper" || type == "htmlWallpaper") { - wallpaper = make_shared( - monitorIndex, - m_globalVariables, - Util::generateRandomString(), - path, - previewImage, - type, - settings); - - settings.insert("monitors", monitors); - settings.insert("type", type); - settings.insert("previewImage", previewImage); - settings.insert("absolutePath", path); - } + wallpaper = make_shared( + monitorIndex, + m_globalVariables, + Util::generateRandomString(), + path, + previewImage, + volume, + fillMode, + type, + m_settings->checkWallpaperVisible()); // Only support remove wallpaper that spans over 1 monitor if (monitorIndex.length() == 1) { @@ -113,11 +88,20 @@ void ScreenPlayManager::createWallpaper( m_screenPlayWallpapers.append(wallpaper); m_monitorListModel->setWallpaperActiveMonitor(wallpaper, monitorIndex); + increaseActiveWallpaperCounter(); + + if (saveToProfilesConfigFile && type == "videoWallpaper") { + QJsonObject settings; + settings.insert("monitors", monitors); + settings.insert("type", type); + settings.insert("volume", static_cast(volume)); + settings.insert("isLooping", true); + settings.insert("fillMode", fillMode); + settings.insert("previewImage", previewImage); + settings.insert("absolutePath", path); - if (saveToProfilesConfigFile) { saveWallpaperProfile("default", settings); } - increaseActiveWallpaperCounter(); } /*! @@ -379,12 +363,6 @@ void ScreenPlayManager::loadWallpaperProfiles() monitors.append(value); } - bool parsing = true; - bool isLooping = wallpaperObj.value("isLooping").toBool(parsing); - - if (!parsing) - continue; - float volume = static_cast(wallpaperObj.value("volume").toDouble(-1.0)); if (volume == -1.0F) diff --git a/ScreenPlay/src/screenplaymanager.h b/ScreenPlay/src/screenplaymanager.h index 89b30949..dd117a91 100644 --- a/ScreenPlay/src/screenplaymanager.h +++ b/ScreenPlay/src/screenplaymanager.h @@ -15,6 +15,7 @@ #include "screenplaywallpaper.h" #include "screenplaywidget.h" #include "sdkconnector.h" +#include "settings.h" #include "util.h" #include @@ -42,6 +43,7 @@ public: const shared_ptr& mlm, const shared_ptr& sdkc, const shared_ptr& telemetry, + const shared_ptr& settings, QObject* parent = nullptr); int activeWallpaperCounter() const @@ -136,6 +138,7 @@ private: const shared_ptr& m_monitorListModel; const shared_ptr& m_sdkconnector; const shared_ptr& m_telemetry; + const shared_ptr& m_settings; QVector> m_screenPlayWallpapers; QVector> m_screenPlayWidgets; diff --git a/ScreenPlay/src/screenplaywallpaper.cpp b/ScreenPlay/src/screenplaywallpaper.cpp index 150c46d9..0116a2bb 100644 --- a/ScreenPlay/src/screenplaywallpaper.cpp +++ b/ScreenPlay/src/screenplaywallpaper.cpp @@ -1,6 +1,5 @@ #include "screenplaywallpaper.h" - namespace ScreenPlay { /*! @@ -23,6 +22,7 @@ ScreenPlayWallpaper::ScreenPlayWallpaper( const float volume, const QString& fillMode, const QString& type, + const bool checkWallpaperVisible, QObject* parent) : QObject(parent) , m_projectSettingsListModel { make_shared(absolutePath + "/project.json") } @@ -57,62 +57,8 @@ ScreenPlayWallpaper::ScreenPlayWallpaper( QString { "appID=" + m_appID }, QString::number(static_cast(volume)), fillMode, - type - }; - - qDebug() << "Creating ScreenPlayWallpaper " << proArgs; - - m_process.setArguments(proArgs); - m_process.setProgram(m_globalVariables->wallpaperExecutablePath().toString()); - m_process.startDetached(); -} - -/*! - Constructor for scene Wallpaper with multile json settings. -*/ -ScreenPlayWallpaper::ScreenPlayWallpaper( - const QVector& screenNumber, - const shared_ptr& globalVariables, - const QString& appID, - const QString& absolutePath, - const QString& previewImage, - const QString& type, - const QJsonObject& profileJsonObject, - QObject* parent) - : QObject(parent) - , m_projectSettingsListModel { make_shared(absolutePath + "/project.json") } - , m_globalVariables { globalVariables } - , m_screenNumber { screenNumber } - , m_previewImage { QString { absolutePath + "/" + previewImage } } - , m_type { type } - , m_appID { appID } - , m_absolutePath { absolutePath } - , m_profileJsonObject { profileJsonObject } -{ - QObject::connect(&m_process, QOverload::of(&QProcess::finished), this, &ScreenPlayWallpaper::processExit); - QObject::connect(&m_process, &QProcess::errorOccurred, this, &ScreenPlayWallpaper::processError); - - QString tmpScreenNumber; - if (m_screenNumber.length() > 1) { - for (const int number : m_screenNumber) { - // IMPORTANT: NO TRAILING COMMA! - if (number == m_screenNumber.back()) { - tmpScreenNumber += QString::number(number); - } else { - tmpScreenNumber += QString::number(number) + ","; - } - } - } else { - tmpScreenNumber = QString::number(m_screenNumber.first()); - } - - const QStringList proArgs { - tmpScreenNumber, - m_absolutePath, - QString { "appID=" + m_appID }, - QString::number(static_cast(1)), - "fill", - type + type, + QString::number(checkWallpaperVisible) }; qDebug() << "Creating ScreenPlayWallpaper " << proArgs; diff --git a/ScreenPlay/src/screenplaywallpaper.h b/ScreenPlay/src/screenplaywallpaper.h index fe3edc05..748aade2 100644 --- a/ScreenPlay/src/screenplaywallpaper.h +++ b/ScreenPlay/src/screenplaywallpaper.h @@ -28,8 +28,7 @@ class ScreenPlayWallpaper : public QObject { Q_PROPERTY(QJsonObject profileJsonObject READ profileJsonObject WRITE setProfileJsonObject NOTIFY profileJsonObjectChanged) public: - explicit ScreenPlayWallpaper( - const QVector& screenNumber, + explicit ScreenPlayWallpaper(const QVector& screenNumber, const shared_ptr& globalVariables, const QString& appID, const QString& absolutePath, @@ -37,6 +36,7 @@ public: const float volume, const QString& fillMode, const QString& type, + const bool checkWallpaperVisible, QObject* parent = nullptr); explicit ScreenPlayWallpaper( diff --git a/ScreenPlay/src/settings.cpp b/ScreenPlay/src/settings.cpp index 35638e85..bec7049f 100644 --- a/ScreenPlay/src/settings.cpp +++ b/ScreenPlay/src/settings.cpp @@ -147,13 +147,13 @@ Settings::Settings(const shared_ptr& globalVariables, } } else { - if(!steamWorkshopContentPath.cd("workshop")){ + if (!steamWorkshopContentPath.cd("workshop")) { qDebug() << "Error! No workshop folder found in path: " << steamWorkshopContentPath.absolutePath(); } - if(!steamWorkshopContentPath.cd("content")){ + if (!steamWorkshopContentPath.cd("content")) { qDebug() << "Error! No content folder found in path: " << steamWorkshopContentPath.absolutePath(); } - if(!steamWorkshopContentPath.cd("672870")){ + if (!steamWorkshopContentPath.cd("672870")) { qDebug() << "Error! No 672870 folder found in path: " << steamWorkshopContentPath.absolutePath(); } qDebug() << "Setup installed content path at" << steamWorkshopContentPath.absolutePath(); @@ -177,6 +177,7 @@ Settings::Settings(const shared_ptr& globalVariables, m_qSettings.sync(); } + m_checkWallpaperVisible = configObj.value().value("checkWallpaperVisible").toBool(); m_autostart = configObj.value().value("autostart").toBool(); m_highPriorityStart = configObj.value().value("highPriorityStart").toBool(); m_anonymousTelemetry = configObj.value().value("anonymousTelemetry").toBool(); diff --git a/ScreenPlay/src/settings.h b/ScreenPlay/src/settings.h index 3854aae5..e53c4d3c 100644 --- a/ScreenPlay/src/settings.h +++ b/ScreenPlay/src/settings.h @@ -25,13 +25,12 @@ #include #include - #include #include #include "globalvariables.h" -#include "util.h" #include "nlohmann/json.hpp" +#include "util.h" #ifdef Q_OS_WIN #include @@ -47,13 +46,14 @@ class Settings : public QObject { Q_OBJECT Q_PROPERTY(QVersionNumber version READ version) + Q_PROPERTY(bool anonymousTelemetry READ anonymousTelemetry WRITE setAnonymousTelemetry NOTIFY anonymousTelemetryChanged) Q_PROPERTY(bool silentStart READ silentStart WRITE setSilentStart NOTIFY silentStartChanged) Q_PROPERTY(bool autostart READ autostart WRITE setAutostart NOTIFY autostartChanged) Q_PROPERTY(bool highPriorityStart READ highPriorityStart WRITE setHighPriorityStart NOTIFY highPriorityStartChanged) - - Q_PROPERTY(bool pauseWallpaperWhenIngame READ pauseWallpaperWhenIngame WRITE setPauseWallpaperWhenIngame NOTIFY pauseWallpaperWhenIngameChanged) + Q_PROPERTY(bool checkWallpaperVisible READ checkWallpaperVisible WRITE setCheckWallpaperVisible NOTIFY checkWallpaperVisibleChanged) Q_PROPERTY(bool offlineMode READ offlineMode WRITE setOfflineMode NOTIFY offlineModeChanged) + Q_PROPERTY(QString decoder READ decoder WRITE setDecoder NOTIFY decoderChanged) Q_PROPERTY(QString gitBuildHash READ gitBuildHash WRITE setGitBuildHash NOTIFY gitBuildHashChanged) Q_PROPERTY(QString language READ language WRITE setLanguage NOTIFY languageChanged) @@ -68,11 +68,6 @@ public: return m_version; } - bool pauseWallpaperWhenIngame() const - { - return m_pauseWallpaperWhenIngame; - } - bool offlineMode() const { return m_offlineMode; @@ -118,21 +113,24 @@ public: return m_language; } + bool checkWallpaperVisible() const + { + return m_checkWallpaperVisible; + } + signals: void autostartChanged(bool autostart); void highPriorityStartChanged(bool highPriorityStart); void hasWorkshopBannerSeenChanged(bool hasWorkshopBannerSeen); void decoderChanged(QString decoder); void setMainWindowVisible(bool visible); - void pauseWallpaperWhenIngameChanged(bool pauseWallpaperWhenIngame); void offlineModeChanged(bool offlineMode); void gitBuildHashChanged(QString gitBuildHash); void resetInstalledListmodel(); void silentStartChanged(bool silentStart); - void anonymousTelemetryChanged(bool anonymousTelemetry); - void languageChanged(QString language); + void checkWallpaperVisibleChanged(bool checkWallpaperVisible); public slots: bool writeSingleSettingConfig(QString name, QVariant value); @@ -200,15 +198,6 @@ public slots: emit decoderChanged(m_decoder); } - void setPauseWallpaperWhenIngame(bool pauseWallpaperWhenIngame) - { - if (m_pauseWallpaperWhenIngame == pauseWallpaperWhenIngame) - return; - - m_pauseWallpaperWhenIngame = pauseWallpaperWhenIngame; - emit pauseWallpaperWhenIngameChanged(m_pauseWallpaperWhenIngame); - } - void setOfflineMode(bool offlineMode) { if (m_offlineMode == offlineMode) @@ -254,6 +243,16 @@ public slots: emit languageChanged(m_language); } + void setCheckWallpaperVisible(bool checkWallpaperVisible) + { + if (m_checkWallpaperVisible == checkWallpaperVisible) + return; + + writeSingleSettingConfig("checkWallpaperVisible", checkWallpaperVisible); + m_checkWallpaperVisible = checkWallpaperVisible; + emit checkWallpaperVisibleChanged(m_checkWallpaperVisible); + } + private: void restoreDefault(const QString& appConfigLocation, const QString& settingsFileType); @@ -264,15 +263,15 @@ private: const shared_ptr& m_globalVariables; - bool m_pauseWallpaperWhenIngame { false }; bool m_autostart { true }; bool m_highPriorityStart { true }; bool m_offlineMode { true }; - - QString m_decoder { "" }; - QString m_gitBuildHash; + bool m_checkWallpaperVisible { true }; bool m_silentStart { false }; bool m_anonymousTelemetry { true }; + + QString m_gitBuildHash; + QString m_decoder { "" }; QString m_language; }; } diff --git a/ScreenPlayWallpaper/WebView.qml b/ScreenPlayWallpaper/WebView.qml index d488a65e..b6110e0e 100644 --- a/ScreenPlayWallpaper/WebView.qml +++ b/ScreenPlayWallpaper/WebView.qml @@ -121,6 +121,12 @@ Item { } } + onVisualsPausedChanged:{ + if(window.checkWallpaperVisible){ + webView.visible = visualsPaused + } + } + onIsPlayingChanged: { if (webView.loadProgress === 100) { if (isPlaying) { diff --git a/ScreenPlayWallpaper/main.cpp b/ScreenPlayWallpaper/main.cpp index a6443435..aa7ac031 100644 --- a/ScreenPlayWallpaper/main.cpp +++ b/ScreenPlayWallpaper/main.cpp @@ -1,9 +1,9 @@ #include #include #include +#include #include #include -#include #if defined(Q_OS_WIN) #include "src/winwindow.h" @@ -42,7 +42,7 @@ int main(int argc, char* argv[]) WinWindow window2({ 1 }, "test", "appid", "1", "fill"); WinWindow window3({ 2 }, "test", "appid", "1", "fill"); - //WinWindow window(list, "D:/672870/827874818", "appid", "1", "fill"); + WinWindow window({ 0 }, "C:/Program Files (x86)/Steam/steamapps/workshop/content/672870/1954178242", "appid", "1", "fill", true); #endif #if defined(Q_OS_LINUX) LinuxWindow window(QVector{ 0 }, "test", "appid", "1", "fill"); @@ -55,12 +55,12 @@ int main(int argc, char* argv[]) } // 6 parameter + 1 OS working directory default paramter - if (argumentList.length() != 7) { + if (argumentList.length() != 8) { return -3; } // AppID, Type - ScreenPlaySDK sdk(argumentList.at(3),argumentList.at(6)); + ScreenPlaySDK sdk(argumentList.at(3), argumentList.at(6)); QString monitorNumbers = argumentList.at(1); QStringList activeScreensList = monitorNumbers.split(","); @@ -90,15 +90,23 @@ int main(int argc, char* argv[]) } } - if(list.empty()){ + if (list.empty()) { return -4; } - // Args: which monitor, (2) path to project, (3)wallpaper secret to identify the connected socket, (4) volume, (5) fillmode, (6) type + + // Args: which monitor, (2) path to project, (3)wallpaper secret to identify the connected socket, (4) volume, (5) fillmode, (6) type, (7) // See screenplay.h @ScreenPlayWallpaper constructor how the args get created qDebug() << argumentList; + 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(list, argumentList.at(2), argumentList.at(3), argumentList.at(4), argumentList.at(5)); + WinWindow window(list, argumentList.at(2), argumentList.at(3), argumentList.at(4), argumentList.at(5), checkWallpaperVisible); QObject::connect(&sdk, &ScreenPlaySDK::sdkDisconnected, &window, &WinWindow::destroyThis); QObject::connect(&sdk, &ScreenPlaySDK::incommingMessage, &window, &WinWindow::messageReceived); #endif diff --git a/ScreenPlayWallpaper/src/basewindow.cpp b/ScreenPlayWallpaper/src/basewindow.cpp index 3f6ee6f1..c20b7609 100644 --- a/ScreenPlayWallpaper/src/basewindow.cpp +++ b/ScreenPlayWallpaper/src/basewindow.cpp @@ -5,9 +5,10 @@ BaseWindow::BaseWindow(QObject* parent) { } -BaseWindow::BaseWindow(QString projectFilePath, QVector activeScreensList) +BaseWindow::BaseWindow(QString projectFilePath, const QVector activeScreensList, const bool checkWallpaperVisible) : QObject(nullptr) , m_activeScreensList(activeScreensList) + , m_checkWallpaperVisible(checkWallpaperVisible) { QApplication::instance()->installEventFilter(this); qRegisterMetaType(); diff --git a/ScreenPlayWallpaper/src/basewindow.h b/ScreenPlayWallpaper/src/basewindow.h index c0824ba5..d4bbd7ba 100644 --- a/ScreenPlayWallpaper/src/basewindow.h +++ b/ScreenPlayWallpaper/src/basewindow.h @@ -16,7 +16,7 @@ class BaseWindow : public QObject { public: BaseWindow(QObject* parent = nullptr); - BaseWindow(QString projectFilePath, QVector activeScreensList); + BaseWindow(QString projectFilePath, const QVector activeScreensList, const bool checkWallpaperVisible); Q_PROPERTY(int width READ width WRITE setWidth NOTIFY widthChanged) Q_PROPERTY(int height READ height WRITE setHeight NOTIFY heightChanged) @@ -24,12 +24,16 @@ public: Q_PROPERTY(QString appID READ appID WRITE setAppID NOTIFY appIDChanged) Q_PROPERTY(QString fullContentPath READ fullContentPath WRITE setFullContentPath NOTIFY fullContentPathChanged) + Q_PROPERTY(QString fillMode READ fillMode WRITE setFillMode NOTIFY fillModeChanged) Q_PROPERTY(bool loops READ loops WRITE setLoops NOTIFY loopsChanged) Q_PROPERTY(bool isPlaying READ isPlaying WRITE setIsPlaying NOTIFY isPlayingChanged) Q_PROPERTY(bool muted READ muted WRITE setMuted NOTIFY mutedChanged) Q_PROPERTY(bool canFade READ canFade WRITE setCanFade NOTIFY canFadeChanged) - Q_PROPERTY(QString fillMode READ fillMode WRITE setFillMode NOTIFY fillModeChanged) + + // Save performance by checking if the wallpaper is visible (video wallpaper only for now) + Q_PROPERTY(bool checkWallpaperVisible READ checkWallpaperVisible WRITE setCheckWallpaperVisible NOTIFY checkWallpaperVisibleChanged) + Q_PROPERTY(bool visualsPaused READ visualsPaused WRITE setVisualsPaused NOTIFY visualsPausedChanged) Q_PROPERTY(float volume READ volume WRITE setVolume NOTIFY volumeChanged) Q_PROPERTY(float playbackRate READ playbackRate WRITE setPlaybackRate NOTIFY playbackRateChanged) @@ -123,6 +127,16 @@ public: return m_activeScreensList; } + bool checkWallpaperVisible() const + { + return m_checkWallpaperVisible; + } + + bool visualsPaused() const + { + return m_visualsPaused; + } + signals: void qmlExit(); @@ -143,8 +157,12 @@ signals: void heightChanged(int height); void activeScreensListChanged(QVector activeScreensList); + void checkWallpaperVisibleChanged(bool checkWallpaperVisible); + + void visualsPausedChanged(bool visualsPaused); + public slots: - virtual void destroyThis() {} + virtual void destroyThis() { } virtual void setVisible(bool show) { Q_UNUSED(show) } virtual void messageReceived(QString key, QString value) final; @@ -307,7 +325,30 @@ public slots: emit activeScreensListChanged(m_activeScreensList); } + void setCheckWallpaperVisible(bool checkWallpaperVisible) + { + if (m_checkWallpaperVisible == checkWallpaperVisible) + return; + + m_checkWallpaperVisible = checkWallpaperVisible; + emit checkWallpaperVisibleChanged(m_checkWallpaperVisible); + } + + void setVisualsPaused(bool visualsPaused) + { + if (m_visualsPaused == visualsPaused) + return; + + qDebug() << "visualsPaused: " << visualsPaused; + + m_visualsPaused = visualsPaused; + emit visualsPausedChanged(m_visualsPaused); + } + private: + bool m_checkWallpaperVisible { false }; + bool m_visualsPaused { false }; + bool m_loops { true }; bool m_isPlaying { true }; bool m_muted { false }; diff --git a/ScreenPlayWallpaper/src/winwindow.cpp b/ScreenPlayWallpaper/src/winwindow.cpp index b9abd5d2..8c5743e8 100644 --- a/ScreenPlayWallpaper/src/winwindow.cpp +++ b/ScreenPlayWallpaper/src/winwindow.cpp @@ -62,11 +62,12 @@ LRESULT __stdcall MouseHookCallback(int nCode, WPARAM wParam, LPARAM lParam) WinWindow::WinWindow( const QVector& activeScreensList, - QString projectPath, - QString id, - QString volume, - const QString fillmode) - : BaseWindow(projectPath, activeScreensList) + const QString projectPath, + const QString id, + const QString volume, + const QString fillmode, + const bool checkWallpaperVisible) + : BaseWindow(projectPath, activeScreensList, checkWallpaperVisible) { m_window.hide(); m_windowHandle = reinterpret_cast(m_window.winId()); @@ -123,7 +124,10 @@ WinWindow::WinWindow( m_window.hide(); QObject::connect(&m_checkForFullScreenWindowTimer, &QTimer::timeout, this, &WinWindow::checkForFullScreenWindow); - m_checkForFullScreenWindowTimer.start(30); + + if (checkWallpaperVisible) { + m_checkForFullScreenWindowTimer.start(10); + } } void WinWindow::setVisible(bool show) @@ -292,10 +296,10 @@ void WinWindow::checkForFullScreenWindow() if ((dwStyle & WS_MAXIMIZE) != 0) { // do stuff - setIsPlaying(false); + setVisualsPaused(false); qDebug() << "WS_MAXIMIZE: " << printWindowNameByhWnd(hWnd); } else { - setIsPlaying(true); + setVisualsPaused(true); } return; } @@ -316,16 +320,16 @@ void WinWindow::checkForFullScreenWindow() if (activeScreensList().length() == 1) { // If the window that has WS_MAXIMIZE is at the same monitor as this wallpaper if (monitorIndex == activeScreensList().at(0)) { - qDebug() << "monitorIndex" << monitorIndex; - setIsPlaying(false); + // qDebug() << "monitorIndex" << monitorIndex; + setVisualsPaused(false); } else { - setIsPlaying(true); + setVisualsPaused(true); } } } else { // qDebug() << "No window found, playing!"; - setIsPlaying(true); + setVisualsPaused(true); } } } diff --git a/ScreenPlayWallpaper/src/winwindow.h b/ScreenPlayWallpaper/src/winwindow.h index 1f799ad3..884fb7ba 100644 --- a/ScreenPlayWallpaper/src/winwindow.h +++ b/ScreenPlayWallpaper/src/winwindow.h @@ -9,9 +9,8 @@ #include #include #include -#include -#include #include +#include #include #include @@ -22,9 +21,8 @@ class WinWindow : public BaseWindow { Q_OBJECT - public: - explicit WinWindow(const QVector& activeScreensList, QString projectPath, QString id, QString volume, const QString fillmode); + explicit WinWindow(const QVector& activeScreensList, const QString projectPath, const QString id, const QString volume, const QString fillmode, const bool checkWallpaperVisible); public slots: void setVisible(bool show) override;