mirror of
https://gitlab.com/kelteseth/ScreenPlay.git
synced 2024-09-03 09:09:48 +02:00
Add working pause visual part of the video with settings
This commit is contained in:
parent
4ebd0af183
commit
9f06f75f66
@ -95,7 +95,7 @@ App::App()
|
||||
}
|
||||
|
||||
m_create = make_unique<Create>(m_globalVariables);
|
||||
m_screenPlayManager = make_unique<ScreenPlayManager>(m_globalVariables, m_monitorListModel, m_sdkConnector, m_telemetry);
|
||||
m_screenPlayManager = make_unique<ScreenPlayManager>(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
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
@ -19,12 +19,14 @@ ScreenPlayManager::ScreenPlayManager(
|
||||
const shared_ptr<MonitorListModel>& mlm,
|
||||
const shared_ptr<SDKConnector>& sdkc,
|
||||
const shared_ptr<GAnalytics>& telemetry,
|
||||
const shared_ptr<Settings>& 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<ScreenPlayWallpaper> wallpaper;
|
||||
|
||||
if (type == "videoWallpaper") {
|
||||
wallpaper = make_shared<ScreenPlayWallpaper>(
|
||||
monitorIndex,
|
||||
m_globalVariables,
|
||||
Util::generateRandomString(),
|
||||
path,
|
||||
previewImage,
|
||||
volume,
|
||||
fillMode,
|
||||
type);
|
||||
|
||||
settings.insert("monitors", monitors);
|
||||
settings.insert("type", type);
|
||||
settings.insert("volume", static_cast<double>(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<ScreenPlayWallpaper>(
|
||||
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<ScreenPlayWallpaper>(
|
||||
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<double>(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<float>(wallpaperObj.value("volume").toDouble(-1.0));
|
||||
|
||||
if (volume == -1.0F)
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "screenplaywallpaper.h"
|
||||
#include "screenplaywidget.h"
|
||||
#include "sdkconnector.h"
|
||||
#include "settings.h"
|
||||
#include "util.h"
|
||||
|
||||
#include <memory>
|
||||
@ -42,6 +43,7 @@ public:
|
||||
const shared_ptr<MonitorListModel>& mlm,
|
||||
const shared_ptr<SDKConnector>& sdkc,
|
||||
const shared_ptr<GAnalytics>& telemetry,
|
||||
const shared_ptr<Settings>& settings,
|
||||
QObject* parent = nullptr);
|
||||
|
||||
int activeWallpaperCounter() const
|
||||
@ -136,6 +138,7 @@ private:
|
||||
const shared_ptr<MonitorListModel>& m_monitorListModel;
|
||||
const shared_ptr<SDKConnector>& m_sdkconnector;
|
||||
const shared_ptr<GAnalytics>& m_telemetry;
|
||||
const shared_ptr<Settings>& m_settings;
|
||||
|
||||
QVector<shared_ptr<ScreenPlayWallpaper>> m_screenPlayWallpapers;
|
||||
QVector<shared_ptr<ScreenPlayWidget>> m_screenPlayWidgets;
|
||||
|
@ -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<ProjectSettingsListModel>(absolutePath + "/project.json") }
|
||||
@ -57,62 +57,8 @@ ScreenPlayWallpaper::ScreenPlayWallpaper(
|
||||
QString { "appID=" + m_appID },
|
||||
QString::number(static_cast<double>(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<int>& screenNumber,
|
||||
const shared_ptr<GlobalVariables>& globalVariables,
|
||||
const QString& appID,
|
||||
const QString& absolutePath,
|
||||
const QString& previewImage,
|
||||
const QString& type,
|
||||
const QJsonObject& profileJsonObject,
|
||||
QObject* parent)
|
||||
: QObject(parent)
|
||||
, m_projectSettingsListModel { make_shared<ProjectSettingsListModel>(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<int, QProcess::ExitStatus>::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<double>(1)),
|
||||
"fill",
|
||||
type
|
||||
type,
|
||||
QString::number(checkWallpaperVisible)
|
||||
};
|
||||
|
||||
qDebug() << "Creating ScreenPlayWallpaper " << proArgs;
|
||||
|
@ -28,8 +28,7 @@ class ScreenPlayWallpaper : public QObject {
|
||||
Q_PROPERTY(QJsonObject profileJsonObject READ profileJsonObject WRITE setProfileJsonObject NOTIFY profileJsonObjectChanged)
|
||||
|
||||
public:
|
||||
explicit ScreenPlayWallpaper(
|
||||
const QVector<int>& screenNumber,
|
||||
explicit ScreenPlayWallpaper(const QVector<int>& screenNumber,
|
||||
const shared_ptr<GlobalVariables>& 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(
|
||||
|
@ -147,13 +147,13 @@ Settings::Settings(const shared_ptr<GlobalVariables>& 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>& 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();
|
||||
|
@ -25,13 +25,12 @@
|
||||
#include <QtConcurrent/QtConcurrent>
|
||||
#include <QtGlobal>
|
||||
|
||||
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
|
||||
#include "globalvariables.h"
|
||||
#include "util.h"
|
||||
#include "nlohmann/json.hpp"
|
||||
#include "util.h"
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#include <qt_windows.h>
|
||||
@ -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<GlobalVariables>& 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;
|
||||
};
|
||||
}
|
||||
|
@ -121,6 +121,12 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
onVisualsPausedChanged:{
|
||||
if(window.checkWallpaperVisible){
|
||||
webView.visible = visualsPaused
|
||||
}
|
||||
}
|
||||
|
||||
onIsPlayingChanged: {
|
||||
if (webView.loadProgress === 100) {
|
||||
if (isPlaying) {
|
||||
|
@ -1,9 +1,9 @@
|
||||
#include <QApplication>
|
||||
#include <QObject>
|
||||
#include <QStringList>
|
||||
#include <QVector>
|
||||
#include <QtGlobal>
|
||||
#include <QtWebEngine>
|
||||
#include <QVector>
|
||||
|
||||
#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<int>{ 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
|
||||
|
@ -5,9 +5,10 @@ BaseWindow::BaseWindow(QObject* parent)
|
||||
{
|
||||
}
|
||||
|
||||
BaseWindow::BaseWindow(QString projectFilePath, QVector<int> activeScreensList)
|
||||
BaseWindow::BaseWindow(QString projectFilePath, const QVector<int> activeScreensList, const bool checkWallpaperVisible)
|
||||
: QObject(nullptr)
|
||||
, m_activeScreensList(activeScreensList)
|
||||
, m_checkWallpaperVisible(checkWallpaperVisible)
|
||||
{
|
||||
QApplication::instance()->installEventFilter(this);
|
||||
qRegisterMetaType<BaseWindow::WallpaperType>();
|
||||
|
@ -16,7 +16,7 @@ class BaseWindow : public QObject {
|
||||
|
||||
public:
|
||||
BaseWindow(QObject* parent = nullptr);
|
||||
BaseWindow(QString projectFilePath, QVector<int> activeScreensList);
|
||||
BaseWindow(QString projectFilePath, const QVector<int> 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<int> 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 };
|
||||
|
@ -62,11 +62,12 @@ LRESULT __stdcall MouseHookCallback(int nCode, WPARAM wParam, LPARAM lParam)
|
||||
|
||||
WinWindow::WinWindow(
|
||||
const QVector<int>& 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<HWND>(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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,9 +9,8 @@
|
||||
#include <QScreen>
|
||||
#include <QSettings>
|
||||
#include <QString>
|
||||
#include <QVector>
|
||||
#include <QApplication>
|
||||
#include <QTimer>
|
||||
#include <QVector>
|
||||
#include <memory>
|
||||
|
||||
#include <qt_windows.h>
|
||||
@ -22,9 +21,8 @@
|
||||
class WinWindow : public BaseWindow {
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
public:
|
||||
explicit WinWindow(const QVector<int>& activeScreensList, QString projectPath, QString id, QString volume, const QString fillmode);
|
||||
explicit WinWindow(const QVector<int>& activeScreensList, const QString projectPath, const QString id, const QString volume, const QString fillmode, const bool checkWallpaperVisible);
|
||||
|
||||
public slots:
|
||||
void setVisible(bool show) override;
|
||||
|
Loading…
Reference in New Issue
Block a user