1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-11-06 19:12:30 +01:00

Merge commit '55b4608f6971baf6d422235ee1571800fb0ff1f9'

This commit is contained in:
Elias Steurer 2021-12-11 18:05:35 +01:00
commit c3da8e1b95
19 changed files with 173 additions and 122 deletions

View File

@ -32,6 +32,7 @@ endif()
set(VCPKG_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../ScreenPlay-vcpkg") set(VCPKG_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../ScreenPlay-vcpkg")
set(VCPKG_INSTALLED_PATH "${VCPKG_PATH}/installed/${VCPKG_ARCH}") set(VCPKG_INSTALLED_PATH "${VCPKG_PATH}/installed/${VCPKG_ARCH}")
find_package(Git REQUIRED) find_package(Git REQUIRED)
if(WIN32) if(WIN32)
set(date_command "CMD") set(date_command "CMD")

View File

@ -152,9 +152,17 @@ Rectangle {
rightMargin: 10 rightMargin: 10
bottom: parent.bottom bottom: parent.bottom
} }
property bool contentActive: ScreenPlay.screenPlayManager.activeWallpaperCounter > 0 property bool contentActive: ScreenPlay.screenPlayManager.activeWallpaperCounter > 0
|| ScreenPlay.screenPlayManager.activeWidgetsCounter > 0 || ScreenPlay.screenPlayManager.activeWidgetsCounter > 0
onContentActiveChanged: {
if(!contentActive){
miMuteAll.isMuted = false
miStopAll.isPlaying = false
}
}
ToolButton { ToolButton {
id: miMuteAll id: miMuteAll
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
@ -162,18 +170,23 @@ Rectangle {
icon.width: root.iconWidth icon.width: root.iconWidth
icon.height: root.iconHeight icon.height: root.iconHeight
enabled: quickActionRow.contentActive enabled: quickActionRow.contentActive
onClicked: isMuted = !isMuted
property bool isMuted: false property bool isMuted: false
onClicked: { onIsMutedChanged: {
if (miMuteAll.isMuted) { if (miMuteAll.isMuted) {
isMuted = false; isMuted = false
miMuteAll.icon.source = "qrc:/assets/icons/icon_volume.svg" miMuteAll.icon.source = "qrc:/assets/icons/icon_volume.svg"
ScreenPlay.screenPlayManager.setAllWallpaperValue("muted", "false"); ScreenPlay.screenPlayManager.setAllWallpaperValue("muted",
"false")
} else { } else {
isMuted = true; isMuted = true
miMuteAll.icon.source = "qrc:/assets/icons/icon_volume_mute.svg" miMuteAll.icon.source = "qrc:/assets/icons/icon_volume_mute.svg"
ScreenPlay.screenPlayManager.setAllWallpaperValue("muted", "true"); ScreenPlay.screenPlayManager.setAllWallpaperValue("muted",
"true")
} }
} }
hoverEnabled: true hoverEnabled: true
ToolTip.text: qsTr("Mute/Unmute all Wallpaper") ToolTip.text: qsTr("Mute/Unmute all Wallpaper")
ToolTip.visible: hovered ToolTip.visible: hovered
@ -187,18 +200,20 @@ Rectangle {
icon.height: root.iconHeight icon.height: root.iconHeight
property bool isPlaying: false property bool isPlaying: false
onIsPlayingChanged:{
onClicked: {
if (miStopAll.isPlaying) { if (miStopAll.isPlaying) {
isPlaying = false; isPlaying = false
miStopAll.icon.source = "qrc:/assets/icons/icon_pause.svg" miStopAll.icon.source = "qrc:/assets/icons/icon_pause.svg"
ScreenPlay.screenPlayManager.setAllWallpaperValue("isPlaying", "true"); ScreenPlay.screenPlayManager.setAllWallpaperValue(
"isPlaying", "true")
} else { } else {
isPlaying = true; isPlaying = true
miStopAll.icon.source = "qrc:/assets/icons/icon_play.svg" miStopAll.icon.source = "qrc:/assets/icons/icon_play.svg"
ScreenPlay.screenPlayManager.setAllWallpaperValue("isPlaying", "false"); ScreenPlay.screenPlayManager.setAllWallpaperValue(
"isPlaying", "false")
} }
} }
onClicked: isPlaying = !isPlaying
hoverEnabled: true hoverEnabled: true
ToolTip.text: qsTr("Pause/Play all Wallpaper") ToolTip.text: qsTr("Pause/Play all Wallpaper")
ToolTip.visible: hovered ToolTip.visible: hovered

View File

@ -41,6 +41,7 @@ void InstalledListModel::init()
QObject::connect(&m_fileSystemWatcher, &QFileSystemWatcher::directoryChanged, this, reloadLambda); QObject::connect(&m_fileSystemWatcher, &QFileSystemWatcher::directoryChanged, this, reloadLambda);
QObject::connect(&m_fileSystemWatcher, &QFileSystemWatcher::fileChanged, this, reloadLambda); QObject::connect(&m_fileSystemWatcher, &QFileSystemWatcher::fileChanged, this, reloadLambda);
loadInstalledContent();
} }
/*! /*!

View File

@ -208,7 +208,13 @@ void ScreenPlayWallpaper::setSDKConnection(std::unique_ptr<SDKConnection> connec
{ {
m_connection = std::move(connection); m_connection = std::move(connection);
qInfo() << "[3/3] SDKConnection (Wallpaper) saved!"; qInfo() << "[3/3] SDKConnection (Wallpaper) saved!";
setIsConnected(true);
QObject::connect(m_connection.get(), &SDKConnection::disconnected, this, [this]() {
setIsConnected(false);
qInfo() << "disconnecetd;";
});
QTimer::singleShot(1000, this, [this]() { QTimer::singleShot(1000, this, [this]() {
if (playbackRate() != 1.0) { if (playbackRate() != 1.0) {
setWallpaperValue("playbackRate", QString::number(playbackRate()), false); setWallpaperValue("playbackRate", QString::number(playbackRate()), false);
@ -239,8 +245,10 @@ void ScreenPlayWallpaper::replace(
const InstalledType::InstalledType type, const InstalledType::InstalledType type,
const bool checkWallpaperVisible) const bool checkWallpaperVisible)
{ {
if (!m_connection) if (!m_connection) {
qWarning() << "Cannot replace for unconnected wallpaper!";
return; return;
}
m_previewImage = previewImage; m_previewImage = previewImage;
m_type = type; m_type = type;

View File

@ -51,6 +51,8 @@ namespace ScreenPlay {
class ScreenPlayWallpaper : public QObject { class ScreenPlayWallpaper : public QObject {
Q_OBJECT Q_OBJECT
Q_PROPERTY(bool isConnected READ isConnected WRITE setIsConnected NOTIFY isConnectedChanged)
Q_PROPERTY(QVector<int> screenNumber READ screenNumber WRITE setScreenNumber NOTIFY screenNumberChanged) Q_PROPERTY(QVector<int> screenNumber READ screenNumber WRITE setScreenNumber NOTIFY screenNumberChanged)
Q_PROPERTY(float volume READ volume WRITE setVolume NOTIFY volumeChanged) Q_PROPERTY(float volume READ volume WRITE setVolume NOTIFY volumeChanged)
@ -108,6 +110,7 @@ public:
bool isLooping() const { return m_isLooping; } bool isLooping() const { return m_isLooping; }
ProjectSettingsListModel* getProjectSettingsListModel() { return &m_projectSettingsListModel; } ProjectSettingsListModel* getProjectSettingsListModel() { return &m_projectSettingsListModel; }
float playbackRate() const { return m_playbackRate; } float playbackRate() const { return m_playbackRate; }
bool isConnected() const { return m_isConnected; }
signals: signals:
void screenNumberChanged(QVector<int> screenNumber); void screenNumberChanged(QVector<int> screenNumber);
@ -126,6 +129,8 @@ signals:
void requestClose(const QString& appID); void requestClose(const QString& appID);
void error(const QString& msg); void error(const QString& msg);
void isConnectedChanged(bool isConnected);
public slots: public slots:
void messageQuit(); void messageQuit();
void processExit(int exitCode, QProcess::ExitStatus exitStatus); void processExit(int exitCode, QProcess::ExitStatus exitStatus);
@ -225,6 +230,14 @@ public slots:
emit playbackRateChanged(m_playbackRate); emit playbackRateChanged(m_playbackRate);
} }
void setIsConnected(bool isConnected)
{
if (m_isConnected == isConnected)
return;
m_isConnected = isConnected;
emit isConnectedChanged(m_isConnected);
}
private: private:
const std::shared_ptr<GlobalVariables> m_globalVariables; const std::shared_ptr<GlobalVariables> m_globalVariables;
std::unique_ptr<SDKConnection> m_connection; std::unique_ptr<SDKConnection> m_connection;
@ -243,5 +256,6 @@ private:
float m_playbackRate { 1.0f }; float m_playbackRate { 1.0f };
QTimer m_pingAliveTimer; QTimer m_pingAliveTimer;
QStringList m_appArgumentsList; QStringList m_appArgumentsList;
bool m_isConnected;
}; };
} }

View File

@ -17,6 +17,8 @@ ScreenPlay::SDKConnection::SDKConnection(QLocalSocket* socket, QObject* parent)
: QObject(parent) : QObject(parent)
{ {
m_socket = socket; m_socket = socket;
connect(m_socket, &QLocalSocket::disconnected, this, &SDKConnection::disconnected);
connect(m_socket, &QLocalSocket::readyRead, this, &SDKConnection::readyRead); connect(m_socket, &QLocalSocket::readyRead, this, &SDKConnection::readyRead);
connect(m_socket, &QLocalSocket::errorOccurred, this, [](QLocalSocket::LocalSocketError socketError) { connect(m_socket, &QLocalSocket::errorOccurred, this, [](QLocalSocket::LocalSocketError socketError) {
qInfo() << "Localsocket error:" << socketError; qInfo() << "Localsocket error:" << socketError;

View File

@ -78,6 +78,7 @@ public:
QString type() const { return m_type; } QString type() const { return m_type; }
signals: signals:
void disconnected();
void requestCloseAt(int at); void requestCloseAt(int at);
void appIDChanged(QString appID); void appIDChanged(QString appID);
void monitorChanged(QVector<int> monitor); void monitorChanged(QVector<int> monitor);

View File

@ -270,7 +270,7 @@ void Wizards::createGifWallpaper(
const QString& file, const QString& file,
const QVector<QString>& tags) const QVector<QString>& tags)
{ {
QtConcurrent::run([=]() { auto con = QtConcurrent::run([=]() {
std::optional<QString> folderName = createTemporaryFolder(); std::optional<QString> folderName = createTemporaryFolder();
if (!folderName.has_value()) { if (!folderName.has_value()) {

View File

@ -49,33 +49,19 @@
#include <QTimer> #include <QTimer>
#include <QtGlobal> #include <QtGlobal>
class ScreenPlaySDK : public QQuickItem { class ScreenPlaySDK : public QObject {
Q_OBJECT Q_OBJECT
Q_DISABLE_COPY(ScreenPlaySDK)
public: public:
ScreenPlaySDK(QQuickItem* parent = nullptr); ScreenPlaySDK(const QString& appID, const QString& type);
ScreenPlaySDK(const QString& appID, const QString& type, QQuickItem* parent = nullptr);
~ScreenPlaySDK(); ~ScreenPlaySDK();
Q_PROPERTY(QString type READ type WRITE setType NOTIFY typeChanged) Q_PROPERTY(QString type READ type WRITE setType NOTIFY typeChanged)
Q_PROPERTY(bool isConnected READ isConnected WRITE setIsConnected NOTIFY isConnectedChanged) Q_PROPERTY(bool isConnected READ isConnected WRITE setIsConnected NOTIFY isConnectedChanged)
Q_PROPERTY(QString appID READ appID WRITE setAppID NOTIFY appIDChanged) Q_PROPERTY(QString appID READ appID WRITE setAppID NOTIFY appIDChanged)
QString type() const QString type() const { return m_type; }
{ bool isConnected() const { return m_isConnected; }
return m_type; QString appID() const { return m_appID; }
}
bool isConnected() const
{
return m_isConnected;
}
QString appID() const
{
return m_appID;
}
public slots: public slots:
void sendMessage(const QJsonObject& obj); void sendMessage(const QJsonObject& obj);
@ -140,7 +126,7 @@ signals:
private: private:
QLocalSocket m_socket; QLocalSocket m_socket;
QString m_type = "undefined"; QString m_type;
bool m_isConnected = false; bool m_isConnected = false;
QString m_appID; QString m_appID;

View File

@ -15,16 +15,8 @@ static ScreenPlaySDK* global_sdkPtr = nullptr;
\brief . \brief .
*/ */
ScreenPlaySDK::ScreenPlaySDK(QQuickItem* parent) ScreenPlaySDK::ScreenPlaySDK(const QString& appID, const QString& type)
: QQuickItem(parent) : QObject(nullptr)
{
}
ScreenPlaySDK::ScreenPlaySDK(
const QString& appID,
const QString& type,
QQuickItem* parent)
: QQuickItem(parent)
, m_type { type } , m_type { type }
, m_appID { appID } , m_appID { appID }
{ {

View File

@ -34,7 +34,10 @@ set(HEADER
add_library(${PROJECT_NAME} SHARED ${SOURCES} ${HEADER}) add_library(${PROJECT_NAME} SHARED ${SOURCES} ${HEADER})
qt_add_qml_module(${PROJECT_NAME} URI ${PROJECT_NAME} VERSION 1.0) qt_add_qml_module(${PROJECT_NAME}
OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin/SysInfo
URI ${PROJECT_NAME}
VERSION 1.0)
target_compile_definitions(${PROJECT_NAME} PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>) target_compile_definitions(${PROJECT_NAME} PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>)

View File

@ -32,8 +32,8 @@ int main(int argc, char* argv[])
// For testing purposes when starting the ScreenPlayWallpaper directly. // 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 window1({ 0 }, "C:/Program Files (x86)/Steam/steamapps/workshop/content/672870/2453869686", "appID=test", "1", "fill", "videoWallpaper", true, true); WinWindow window1({ 0, 1, 2 }, "C:/Program Files (x86)/Steam/steamapps/workshop/content/672870/hordemp4", "appID=test", "1", "fill", "videoWallpaper", true, true);
#elif defined(Q_OS_LINUX) #elif defined(Q_OS_LINUX)
LinuxWindow window({ 0 }, "test", "appID=test", "1", "fill", "videoWallpaper", false, true); LinuxWindow window({ 0 }, "test", "appID=test", "1", "fill", "videoWallpaper", false, true);
#elif defined(Q_OS_OSX) #elif defined(Q_OS_OSX)

View File

@ -6,12 +6,15 @@ Item {
id: root id: root
anchors.fill: parent anchors.fill: parent
property bool loops: Wallpaper.loops property bool loops: Wallpaper.loops
property bool isPlaying: Wallpaper.isPlaying
onIsPlayingChanged: isPlaying ? mediaPlayer.play() : mediaPlayer.pause()
property bool isWindows: Qt.platform.os === "windows" property bool isWindows: Qt.platform.os === "windows"
signal requestFadeIn signal requestFadeIn
MediaPlayer { MediaPlayer {
id: mediaPlayer id: mediaPlayer
source: Wallpaper.projectSourceFileAbsolute source: Wallpaper.projectSourceFileAbsolute
Component.onCompleted: { Component.onCompleted: {
mediaPlayer.play() mediaPlayer.play()

View File

@ -31,13 +31,16 @@ Rectangle {
if (Qt.platform.os === "windows") { if (Qt.platform.os === "windows") {
loader.source = "qrc:/ScreenPlayWallpaper/qml/MultimediaView.qml" loader.source = "qrc:/ScreenPlayWallpaper/qml/MultimediaView.qml"
} }
print(loader.source)
fadeIn() fadeIn()
break break
case InstalledType.HTMLWallpaper: case InstalledType.HTMLWallpaper:
loader.setSource("qrc:/ScreenPlayWallpaper/qml/WebsiteWallpaper.qml", { loader.setSource(
"url": Qt.resolvedUrl( "qrc:/ScreenPlayWallpaper/qml/WebsiteWallpaper.qml", {
Wallpaper.projectSourceFileAbsolute) "url": Qt.resolvedUrl(
}) Wallpaper.projectSourceFileAbsolute)
})
break break
case InstalledType.QMLWallpaper: case InstalledType.QMLWallpaper:
loader.source = Qt.resolvedUrl(Wallpaper.projectSourceFileAbsolute) loader.source = Qt.resolvedUrl(Wallpaper.projectSourceFileAbsolute)
@ -61,49 +64,50 @@ Rectangle {
} }
function fadeIn() { function fadeIn() {
Wallpaper.setVisible(true); Wallpaper.setVisible(true)
if (canFadeByWallpaperFillMode && Wallpaper.canFade) if (canFadeByWallpaperFillMode && Wallpaper.canFade)
imgCover.state = "hideDefaultBackgroundImage"; imgCover.state = "hideDefaultBackgroundImage"
else else
imgCover.opacity = 0; imgCover.opacity = 0
} }
anchors.fill: parent anchors.fill: parent
color: { color: {
if (Qt.platform.os !== "windows") if (Qt.platform.os !== "windows")
return "black"; return "black"
else else
return Wallpaper.windowsDesktopProperties.color; return Wallpaper.windowsDesktopProperties.color
} }
Component.onCompleted: { Component.onCompleted: {
init(); init()
} }
Connections { Connections {
function onQmlExit() { function onQmlExit() {
if (canFadeByWallpaperFillMode && Wallpaper.canFade) if (canFadeByWallpaperFillMode && Wallpaper.canFade)
imgCover.state = "exit"; imgCover.state = "exit"
else else
Wallpaper.terminate(); Wallpaper.terminate()
} }
function onQmlSceneValueReceived(key, value) { function onQmlSceneValueReceived(key, value) {
var obj2 = 'import QtQuick; Item {Component.onCompleted: loader.item.' + key + ' = ' + value + '; }'; var obj2 = 'import QtQuick; Item {Component.onCompleted: loader.item.'
var newObject = Qt.createQmlObject(obj2.toString(), root, "err"); + key + ' = ' + value + '; }'
newObject.destroy(10000); var newObject = Qt.createQmlObject(obj2.toString(), root, "err")
newObject.destroy(10000)
} }
// Replace wallpaper with QML Scene // Replace wallpaper with QML Scene
function onReloadQML(oldType) { function onReloadQML(oldType) {
loader.sourceComponent = undefined; loader.sourceComponent = undefined
loader.source = ""; loader.source = ""
Wallpaper.clearComponentCache(); Wallpaper.clearComponentCache()
loader.source = Qt.resolvedUrl(Wallpaper.projectSourceFileAbsolute); loader.source = Qt.resolvedUrl(Wallpaper.projectSourceFileAbsolute)
} }
// Replace wallpaper with GIF // Replace wallpaper with GIF
function onReloadGIF(oldType) { function onReloadGIF(oldType) {
init(); init()
} }
// This function only gets called here (the same function // This function only gets called here (the same function
@ -113,9 +117,9 @@ Rectangle {
// We need to check if the old type // We need to check if the old type
// was also Video not get called twice // was also Video not get called twice
if (oldType === InstalledType.VideoWallpaper) if (oldType === InstalledType.VideoWallpaper)
return ; return
loader.source = "qrc:/ScreenPlayWallpaper/qml/MultimediaView.qml"; loader.source = "qrc:/ScreenPlayWallpaper/qml/MultimediaView.qml"
} }
target: Wallpaper target: Wallpaper
@ -130,20 +134,19 @@ Rectangle {
//asynchronous: true //asynchronous: true
onStatusChanged: { onStatusChanged: {
if (loader.status === Loader.Error) { if (loader.status === Loader.Error) {
loader.source = ""; loader.source = ""
// Wallpaper.terminate(); // Wallpaper.terminate();
} }
} }
Connections { Connections {
function onRequestFadeIn() { function onRequestFadeIn() {
fadeIn(); fadeIn()
} }
ignoreUnknownSignals: true ignoreUnknownSignals: true
target: loader.item target: loader.item
} }
} }
Image { Image {
@ -154,40 +157,41 @@ Rectangle {
sourceSize.height: Wallpaper.height sourceSize.height: Wallpaper.height
source: { source: {
if (Qt.platform.os === "windows") if (Qt.platform.os === "windows")
return Qt.resolvedUrl("file:///" + Wallpaper.windowsDesktopProperties.wallpaperPath); return Qt.resolvedUrl(
"file:///" + Wallpaper.windowsDesktopProperties.wallpaperPath)
else else
return "" return ""
} }
Component.onCompleted: { Component.onCompleted: {
if (Qt.platform.os !== "windows") { if (Qt.platform.os !== "windows") {
root.canFadeByWallpaperFillMode = false; root.canFadeByWallpaperFillMode = false
return ; return
} }
switch (Wallpaper.windowsDesktopProperties.wallpaperStyle) { switch (Wallpaper.windowsDesktopProperties.wallpaperStyle) {
case 10: case 10:
imgCover.fillMode = Image.PreserveAspectCrop; imgCover.fillMode = Image.PreserveAspectCrop
break; break
case 6: case 6:
imgCover.fillMode = Image.PreserveAspectFit; imgCover.fillMode = Image.PreserveAspectFit
break; break
case 2: case 2:
break; break
case 0: case 0:
if (desktopProperties.isTiled) { if (desktopProperties.isTiled) {
// Tiled // Tiled
imgCover.fillMode = Image.Tile; imgCover.fillMode = Image.Tile
} else { } else {
// Center // Center
imgCover.fillMode = Image.PreserveAspectFit; imgCover.fillMode = Image.PreserveAspectFit
imgCover.anchors.centerIn = parent; imgCover.anchors.centerIn = parent
imgCover.width = sourceSize.width; imgCover.width = sourceSize.width
imgCover.height = sourceSize.height; imgCover.height = sourceSize.height
} }
break; break
case 22: case 22:
root.canFadeByWallpaperFillMode = false; root.canFadeByWallpaperFillMode = false
break; break
} }
} }
@ -206,7 +210,6 @@ Rectangle {
target: imgCover target: imgCover
opacity: 1 opacity: 1
} }
}, },
State { State {
name: "hideDefaultBackgroundImage" name: "hideDefaultBackgroundImage"
@ -215,7 +218,6 @@ Rectangle {
target: imgCover target: imgCover
opacity: 0 opacity: 0
} }
}, },
State { State {
name: "exit" name: "exit"
@ -224,7 +226,6 @@ Rectangle {
target: imgCover target: imgCover
opacity: 1 opacity: 1
} }
} }
] ]
transitions: [ transitions: [
@ -243,9 +244,7 @@ Rectangle {
duration: 600 duration: 600
property: "opacity" property: "opacity"
} }
} }
}, },
Transition { Transition {
from: "hideDefaultBackgroundImage" from: "hideDefaultBackgroundImage"
@ -262,9 +261,7 @@ Rectangle {
ScriptAction { ScriptAction {
script: Wallpaper.terminate() script: Wallpaper.terminate()
} }
} }
} }
] ]
} }
@ -294,7 +291,12 @@ Rectangle {
} }
Text { Text {
text: "projectSourceFileAbsolute " + Wallpaper.projectSourceFileAbsolute text: "getApplicationPath " + Wallpaper.getApplicationPath()
font.pointSize: 14
}
Text {
text: "projectSourceFileAbsolute " + Qt.resolvedUrl(Wallpaper.projectSourceFileAbsolute)
font.pointSize: 14 font.pointSize: 14
} }
@ -331,9 +333,10 @@ Rectangle {
Text { Text {
text: { text: {
if (Qt.platform.os === "windows") if (Qt.platform.os === "windows")
return "imgCover.source " + Qt.resolvedUrl("file:///" + Wallpaper.windowsDesktopProperties.wallpaperPath) return "imgCover.source " + Qt.resolvedUrl(
else "file:///" + Wallpaper.windowsDesktopProperties.wallpaperPath)
return "" else
return ""
} }
font.pointSize: 14 font.pointSize: 14
} }
@ -342,13 +345,10 @@ Rectangle {
text: "imgCover.status " + imgCover.status text: "imgCover.status " + imgCover.status
font.pointSize: 14 font.pointSize: 14
} }
} }
background: Rectangle { background: Rectangle {
opacity: 0.5 opacity: 0.5
} }
} }
} }

View File

@ -85,7 +85,13 @@ BaseWindow::BaseWindow(
if (auto typeOpt = ScreenPlayUtil::getInstalledTypeFromString(project.value("type").toString())) { if (auto typeOpt = ScreenPlayUtil::getInstalledTypeFromString(project.value("type").toString())) {
setType(typeOpt.value()); setType(typeOpt.value());
if (!project.contains("videoCodec")) { if (this->type() == ScreenPlay::InstalledType::InstalledType::VideoWallpaper) {
if (auto videoCodecOpt = ScreenPlayUtil::getVideoCodecFromString(project.value("videoCodec").toString())) {
setVideoCodec(videoCodecOpt.value());
} else {
qCritical() << "Cannot parse Wallpaper video codec from value" << project.value("type");
}
} else if (!project.contains("videoCodec") && this->type() == ScreenPlay::InstalledType::InstalledType::VideoWallpaper) {
qWarning("No videoCodec was specified inside the json object!"); qWarning("No videoCodec was specified inside the json object!");
const QString filename = project.value("file").toString(); const QString filename = project.value("file").toString();
if (filename.endsWith(".mp4")) { if (filename.endsWith(".mp4")) {
@ -93,14 +99,6 @@ BaseWindow::BaseWindow(
} else if (filename.endsWith(".webm")) { } else if (filename.endsWith(".webm")) {
setVideoCodec(ScreenPlay::VideoCodec::VideoCodec::VP8); setVideoCodec(ScreenPlay::VideoCodec::VideoCodec::VP8);
} }
} else {
if (this->type() == ScreenPlay::InstalledType::InstalledType::VideoWallpaper) {
if (auto videoCodecOpt = ScreenPlayUtil::getVideoCodecFromString(project.value("videoCodec").toString())) {
setVideoCodec(videoCodecOpt.value());
} else {
qCritical() << "Cannot parse Wallpaper video codec from value" << project.value("type");
}
}
} }
} else { } else {

View File

@ -285,20 +285,43 @@ void WinWindow::setupWallpaperForOneScreen(int activeScreen)
*/ */
void WinWindow::setupWallpaperForAllScreens() void WinWindow::setupWallpaperForAllScreens()
{ {
ScreenPlayUtil::WinMonitorStats monitors;
QRect rect; QRect rect;
for (int i = 0; i < QApplication::screens().count(); i++) { for (int i = 0; i < monitors.iMonitors.size(); i++) {
QScreen* screenTmp = QApplication::screens().at(i); const int width = std::abs(monitors.rcMonitors[i].right - monitors.rcMonitors[i].left);
rect.setWidth(rect.width() + screenTmp->geometry().width()); const int height = std::abs(monitors.rcMonitors[i].top - monitors.rcMonitors[i].bottom);
rect.setHeight(rect.height() + screenTmp->geometry().height()); qInfo() << width << height;
rect.setWidth(rect.width() + width);
rect.setHeight(rect.height() + height);
} }
m_window.setHeight(rect.height()); int offsetX = 0;
m_window.setWidth(rect.width()); int offsetY = 0;
if (!SetWindowPos(m_windowHandle, HWND_TOPMOST, 0, 0, rect.width(), rect.height(), SWP_NOSIZE | SWP_NOMOVE)) { for (int i = 0; i < monitors.iMonitors.size(); i++) {
const int x = monitors.rcMonitors[i].left;
const int y = monitors.rcMonitors[i].top;
qInfo() << x << y;
if (x < offsetX) {
offsetX = x;
}
if (y < offsetY) {
offsetY += y;
}
}
if (!SetWindowPos(m_windowHandle, nullptr, offsetX, offsetY, rect.width(), rect.height(), SWP_NOSIZE | SWP_NOMOVE)) {
qFatal("Could not set window pos: ");
}
if (!SetWindowPos(m_windowHandle, nullptr, offsetX, offsetY, rect.width(), rect.height(), SWP_NOSIZE | SWP_NOMOVE)) {
qFatal("Could not set window pos: "); qFatal("Could not set window pos: ");
} }
if (SetParent(m_windowHandle, m_windowHandleWorker) == nullptr) { if (SetParent(m_windowHandle, m_windowHandleWorker) == nullptr) {
qFatal("Could not attach to parent window"); qFatal("Could not attach to parent window");
} }
qInfo() << rect.width() << rect.height() << offsetX << offsetY;
m_window.setHeight(rect.height());
m_window.setWidth(rect.width());
m_window.setY(offsetY);
m_window.setX(offsetX+1920);
qInfo() << m_window.geometry();
} }
/*! /*!

View File

@ -55,8 +55,7 @@ qt_add_qml_module(
OUTPUT_DIRECTORY ${WORKSHOP_PLUGIN_DIR} OUTPUT_DIRECTORY ${WORKSHOP_PLUGIN_DIR}
URI "Workshop" URI "Workshop"
SOURCES ${SOURCES} ${HEADER} SOURCES ${SOURCES} ${HEADER}
VERSION VERSION 1.0)
1.0)
if(APPLE) if(APPLE)
if(${SCREENPLAY_STEAM}) if(${SCREENPLAY_STEAM})

View File

@ -88,8 +88,10 @@ void InstalledListModel::append(const QJsonObject& obj, const QString& folderNam
void InstalledListModel::loadInstalledContent() void InstalledListModel::loadInstalledContent()
{ {
if(m_loadContentFutureWatcher.isRunning())
return;
QtConcurrent::run([this]() { m_loadContentFuture = QtConcurrent::run([this]() {
QFileInfoList list = QDir(m_absoluteStoragePath.toLocalFile()).entryInfoList(QDir::NoDotAndDotDot | QDir::AllDirs); QFileInfoList list = QDir(m_absoluteStoragePath.toLocalFile()).entryInfoList(QDir::NoDotAndDotDot | QDir::AllDirs);
for (const auto& item : list) { for (const auto& item : list) {
@ -117,6 +119,7 @@ void InstalledListModel::loadInstalledContent()
emit installedLoadingFinished(); emit installedLoadingFinished();
}); });
m_loadContentFutureWatcher.setFuture(m_loadContentFuture);
} }
QVariantMap InstalledListModel::get(QString folderId) QVariantMap InstalledListModel::get(QString folderId)

View File

@ -89,6 +89,8 @@ signals:
private: private:
QVector<ScreenPlay::ProjectFile> m_screenPlayFiles; QVector<ScreenPlay::ProjectFile> m_screenPlayFiles;
QUrl m_absoluteStoragePath; QUrl m_absoluteStoragePath;
QFuture<void> m_loadContentFuture;
QFutureWatcher<void> m_loadContentFutureWatcher;
}; };
} }