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:
commit
c3da8e1b95
@ -32,6 +32,7 @@ endif()
|
||||
set(VCPKG_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../ScreenPlay-vcpkg")
|
||||
set(VCPKG_INSTALLED_PATH "${VCPKG_PATH}/installed/${VCPKG_ARCH}")
|
||||
|
||||
|
||||
find_package(Git REQUIRED)
|
||||
if(WIN32)
|
||||
set(date_command "CMD")
|
||||
|
@ -152,9 +152,17 @@ Rectangle {
|
||||
rightMargin: 10
|
||||
bottom: parent.bottom
|
||||
}
|
||||
|
||||
property bool contentActive: ScreenPlay.screenPlayManager.activeWallpaperCounter > 0
|
||||
|| ScreenPlay.screenPlayManager.activeWidgetsCounter > 0
|
||||
|
||||
onContentActiveChanged: {
|
||||
if(!contentActive){
|
||||
miMuteAll.isMuted = false
|
||||
miStopAll.isPlaying = false
|
||||
}
|
||||
}
|
||||
|
||||
ToolButton {
|
||||
id: miMuteAll
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
@ -162,18 +170,23 @@ Rectangle {
|
||||
icon.width: root.iconWidth
|
||||
icon.height: root.iconHeight
|
||||
enabled: quickActionRow.contentActive
|
||||
|
||||
onClicked: isMuted = !isMuted
|
||||
property bool isMuted: false
|
||||
onClicked: {
|
||||
onIsMutedChanged: {
|
||||
if (miMuteAll.isMuted) {
|
||||
isMuted = false;
|
||||
isMuted = false
|
||||
miMuteAll.icon.source = "qrc:/assets/icons/icon_volume.svg"
|
||||
ScreenPlay.screenPlayManager.setAllWallpaperValue("muted", "false");
|
||||
ScreenPlay.screenPlayManager.setAllWallpaperValue("muted",
|
||||
"false")
|
||||
} else {
|
||||
isMuted = true;
|
||||
isMuted = true
|
||||
miMuteAll.icon.source = "qrc:/assets/icons/icon_volume_mute.svg"
|
||||
ScreenPlay.screenPlayManager.setAllWallpaperValue("muted", "true");
|
||||
ScreenPlay.screenPlayManager.setAllWallpaperValue("muted",
|
||||
"true")
|
||||
}
|
||||
}
|
||||
|
||||
hoverEnabled: true
|
||||
ToolTip.text: qsTr("Mute/Unmute all Wallpaper")
|
||||
ToolTip.visible: hovered
|
||||
@ -187,18 +200,20 @@ Rectangle {
|
||||
icon.height: root.iconHeight
|
||||
|
||||
property bool isPlaying: false
|
||||
|
||||
onClicked: {
|
||||
onIsPlayingChanged:{
|
||||
if (miStopAll.isPlaying) {
|
||||
isPlaying = false;
|
||||
isPlaying = false
|
||||
miStopAll.icon.source = "qrc:/assets/icons/icon_pause.svg"
|
||||
ScreenPlay.screenPlayManager.setAllWallpaperValue("isPlaying", "true");
|
||||
ScreenPlay.screenPlayManager.setAllWallpaperValue(
|
||||
"isPlaying", "true")
|
||||
} else {
|
||||
isPlaying = true;
|
||||
isPlaying = true
|
||||
miStopAll.icon.source = "qrc:/assets/icons/icon_play.svg"
|
||||
ScreenPlay.screenPlayManager.setAllWallpaperValue("isPlaying", "false");
|
||||
ScreenPlay.screenPlayManager.setAllWallpaperValue(
|
||||
"isPlaying", "false")
|
||||
}
|
||||
}
|
||||
onClicked: isPlaying = !isPlaying
|
||||
hoverEnabled: true
|
||||
ToolTip.text: qsTr("Pause/Play all Wallpaper")
|
||||
ToolTip.visible: hovered
|
||||
|
@ -41,6 +41,7 @@ void InstalledListModel::init()
|
||||
|
||||
QObject::connect(&m_fileSystemWatcher, &QFileSystemWatcher::directoryChanged, this, reloadLambda);
|
||||
QObject::connect(&m_fileSystemWatcher, &QFileSystemWatcher::fileChanged, this, reloadLambda);
|
||||
loadInstalledContent();
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -208,7 +208,13 @@ void ScreenPlayWallpaper::setSDKConnection(std::unique_ptr<SDKConnection> connec
|
||||
{
|
||||
m_connection = std::move(connection);
|
||||
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]() {
|
||||
if (playbackRate() != 1.0) {
|
||||
setWallpaperValue("playbackRate", QString::number(playbackRate()), false);
|
||||
@ -239,8 +245,10 @@ void ScreenPlayWallpaper::replace(
|
||||
const InstalledType::InstalledType type,
|
||||
const bool checkWallpaperVisible)
|
||||
{
|
||||
if (!m_connection)
|
||||
if (!m_connection) {
|
||||
qWarning() << "Cannot replace for unconnected wallpaper!";
|
||||
return;
|
||||
}
|
||||
|
||||
m_previewImage = previewImage;
|
||||
m_type = type;
|
||||
|
@ -51,6 +51,8 @@ namespace ScreenPlay {
|
||||
class ScreenPlayWallpaper : public QObject {
|
||||
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(float volume READ volume WRITE setVolume NOTIFY volumeChanged)
|
||||
@ -108,6 +110,7 @@ public:
|
||||
bool isLooping() const { return m_isLooping; }
|
||||
ProjectSettingsListModel* getProjectSettingsListModel() { return &m_projectSettingsListModel; }
|
||||
float playbackRate() const { return m_playbackRate; }
|
||||
bool isConnected() const { return m_isConnected; }
|
||||
|
||||
signals:
|
||||
void screenNumberChanged(QVector<int> screenNumber);
|
||||
@ -126,6 +129,8 @@ signals:
|
||||
void requestClose(const QString& appID);
|
||||
void error(const QString& msg);
|
||||
|
||||
void isConnectedChanged(bool isConnected);
|
||||
|
||||
public slots:
|
||||
void messageQuit();
|
||||
void processExit(int exitCode, QProcess::ExitStatus exitStatus);
|
||||
@ -225,6 +230,14 @@ public slots:
|
||||
emit playbackRateChanged(m_playbackRate);
|
||||
}
|
||||
|
||||
void setIsConnected(bool isConnected)
|
||||
{
|
||||
if (m_isConnected == isConnected)
|
||||
return;
|
||||
m_isConnected = isConnected;
|
||||
emit isConnectedChanged(m_isConnected);
|
||||
}
|
||||
|
||||
private:
|
||||
const std::shared_ptr<GlobalVariables> m_globalVariables;
|
||||
std::unique_ptr<SDKConnection> m_connection;
|
||||
@ -243,5 +256,6 @@ private:
|
||||
float m_playbackRate { 1.0f };
|
||||
QTimer m_pingAliveTimer;
|
||||
QStringList m_appArgumentsList;
|
||||
bool m_isConnected;
|
||||
};
|
||||
}
|
||||
|
@ -17,6 +17,8 @@ ScreenPlay::SDKConnection::SDKConnection(QLocalSocket* socket, QObject* parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
m_socket = socket;
|
||||
|
||||
connect(m_socket, &QLocalSocket::disconnected, this, &SDKConnection::disconnected);
|
||||
connect(m_socket, &QLocalSocket::readyRead, this, &SDKConnection::readyRead);
|
||||
connect(m_socket, &QLocalSocket::errorOccurred, this, [](QLocalSocket::LocalSocketError socketError) {
|
||||
qInfo() << "Localsocket error:" << socketError;
|
||||
|
@ -78,6 +78,7 @@ public:
|
||||
QString type() const { return m_type; }
|
||||
|
||||
signals:
|
||||
void disconnected();
|
||||
void requestCloseAt(int at);
|
||||
void appIDChanged(QString appID);
|
||||
void monitorChanged(QVector<int> monitor);
|
||||
|
@ -270,7 +270,7 @@ void Wizards::createGifWallpaper(
|
||||
const QString& file,
|
||||
const QVector<QString>& tags)
|
||||
{
|
||||
QtConcurrent::run([=]() {
|
||||
auto con = QtConcurrent::run([=]() {
|
||||
std::optional<QString> folderName = createTemporaryFolder();
|
||||
|
||||
if (!folderName.has_value()) {
|
||||
|
@ -49,33 +49,19 @@
|
||||
#include <QTimer>
|
||||
#include <QtGlobal>
|
||||
|
||||
class ScreenPlaySDK : public QQuickItem {
|
||||
class ScreenPlaySDK : public QObject {
|
||||
Q_OBJECT
|
||||
Q_DISABLE_COPY(ScreenPlaySDK)
|
||||
|
||||
public:
|
||||
ScreenPlaySDK(QQuickItem* parent = nullptr);
|
||||
ScreenPlaySDK(const QString& appID, const QString& type, QQuickItem* parent = nullptr);
|
||||
ScreenPlaySDK(const QString& appID, const QString& type);
|
||||
~ScreenPlaySDK();
|
||||
|
||||
Q_PROPERTY(QString type READ type WRITE setType NOTIFY typeChanged)
|
||||
Q_PROPERTY(bool isConnected READ isConnected WRITE setIsConnected NOTIFY isConnectedChanged)
|
||||
Q_PROPERTY(QString appID READ appID WRITE setAppID NOTIFY appIDChanged)
|
||||
|
||||
QString type() const
|
||||
{
|
||||
return m_type;
|
||||
}
|
||||
|
||||
bool isConnected() const
|
||||
{
|
||||
return m_isConnected;
|
||||
}
|
||||
|
||||
QString appID() const
|
||||
{
|
||||
return m_appID;
|
||||
}
|
||||
QString type() const { return m_type; }
|
||||
bool isConnected() const { return m_isConnected; }
|
||||
QString appID() const { return m_appID; }
|
||||
|
||||
public slots:
|
||||
void sendMessage(const QJsonObject& obj);
|
||||
@ -140,7 +126,7 @@ signals:
|
||||
private:
|
||||
QLocalSocket m_socket;
|
||||
|
||||
QString m_type = "undefined";
|
||||
QString m_type;
|
||||
bool m_isConnected = false;
|
||||
|
||||
QString m_appID;
|
||||
|
@ -15,16 +15,8 @@ static ScreenPlaySDK* global_sdkPtr = nullptr;
|
||||
\brief .
|
||||
*/
|
||||
|
||||
ScreenPlaySDK::ScreenPlaySDK(QQuickItem* parent)
|
||||
: QQuickItem(parent)
|
||||
{
|
||||
}
|
||||
|
||||
ScreenPlaySDK::ScreenPlaySDK(
|
||||
const QString& appID,
|
||||
const QString& type,
|
||||
QQuickItem* parent)
|
||||
: QQuickItem(parent)
|
||||
ScreenPlaySDK::ScreenPlaySDK(const QString& appID, const QString& type)
|
||||
: QObject(nullptr)
|
||||
, m_type { type }
|
||||
, m_appID { appID }
|
||||
{
|
||||
|
@ -34,7 +34,10 @@ set(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>)
|
||||
|
||||
|
@ -32,8 +32,8 @@ int main(int argc, char* argv[])
|
||||
// For testing purposes when starting the ScreenPlayWallpaper directly.
|
||||
if (argumentList.length() == 1) {
|
||||
#if defined(Q_OS_WIN)
|
||||
//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 }, "test", "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)
|
||||
LinuxWindow window({ 0 }, "test", "appID=test", "1", "fill", "videoWallpaper", false, true);
|
||||
#elif defined(Q_OS_OSX)
|
||||
|
@ -6,12 +6,15 @@ Item {
|
||||
id: root
|
||||
anchors.fill: parent
|
||||
property bool loops: Wallpaper.loops
|
||||
property bool isPlaying: Wallpaper.isPlaying
|
||||
onIsPlayingChanged: isPlaying ? mediaPlayer.play() : mediaPlayer.pause()
|
||||
property bool isWindows: Qt.platform.os === "windows"
|
||||
signal requestFadeIn
|
||||
|
||||
MediaPlayer {
|
||||
id: mediaPlayer
|
||||
|
||||
|
||||
source: Wallpaper.projectSourceFileAbsolute
|
||||
Component.onCompleted: {
|
||||
mediaPlayer.play()
|
||||
|
@ -31,13 +31,16 @@ Rectangle {
|
||||
if (Qt.platform.os === "windows") {
|
||||
loader.source = "qrc:/ScreenPlayWallpaper/qml/MultimediaView.qml"
|
||||
}
|
||||
|
||||
print(loader.source)
|
||||
fadeIn()
|
||||
break
|
||||
case InstalledType.HTMLWallpaper:
|
||||
loader.setSource("qrc:/ScreenPlayWallpaper/qml/WebsiteWallpaper.qml", {
|
||||
"url": Qt.resolvedUrl(
|
||||
Wallpaper.projectSourceFileAbsolute)
|
||||
})
|
||||
loader.setSource(
|
||||
"qrc:/ScreenPlayWallpaper/qml/WebsiteWallpaper.qml", {
|
||||
"url": Qt.resolvedUrl(
|
||||
Wallpaper.projectSourceFileAbsolute)
|
||||
})
|
||||
break
|
||||
case InstalledType.QMLWallpaper:
|
||||
loader.source = Qt.resolvedUrl(Wallpaper.projectSourceFileAbsolute)
|
||||
@ -61,49 +64,50 @@ Rectangle {
|
||||
}
|
||||
|
||||
function fadeIn() {
|
||||
Wallpaper.setVisible(true);
|
||||
Wallpaper.setVisible(true)
|
||||
if (canFadeByWallpaperFillMode && Wallpaper.canFade)
|
||||
imgCover.state = "hideDefaultBackgroundImage";
|
||||
imgCover.state = "hideDefaultBackgroundImage"
|
||||
else
|
||||
imgCover.opacity = 0;
|
||||
imgCover.opacity = 0
|
||||
}
|
||||
|
||||
anchors.fill: parent
|
||||
color: {
|
||||
if (Qt.platform.os !== "windows")
|
||||
return "black";
|
||||
return "black"
|
||||
else
|
||||
return Wallpaper.windowsDesktopProperties.color;
|
||||
return Wallpaper.windowsDesktopProperties.color
|
||||
}
|
||||
Component.onCompleted: {
|
||||
init();
|
||||
init()
|
||||
}
|
||||
|
||||
Connections {
|
||||
function onQmlExit() {
|
||||
if (canFadeByWallpaperFillMode && Wallpaper.canFade)
|
||||
imgCover.state = "exit";
|
||||
imgCover.state = "exit"
|
||||
else
|
||||
Wallpaper.terminate();
|
||||
Wallpaper.terminate()
|
||||
}
|
||||
|
||||
function onQmlSceneValueReceived(key, value) {
|
||||
var obj2 = 'import QtQuick; Item {Component.onCompleted: loader.item.' + key + ' = ' + value + '; }';
|
||||
var newObject = Qt.createQmlObject(obj2.toString(), root, "err");
|
||||
newObject.destroy(10000);
|
||||
var obj2 = 'import QtQuick; Item {Component.onCompleted: loader.item.'
|
||||
+ key + ' = ' + value + '; }'
|
||||
var newObject = Qt.createQmlObject(obj2.toString(), root, "err")
|
||||
newObject.destroy(10000)
|
||||
}
|
||||
|
||||
// Replace wallpaper with QML Scene
|
||||
function onReloadQML(oldType) {
|
||||
loader.sourceComponent = undefined;
|
||||
loader.source = "";
|
||||
Wallpaper.clearComponentCache();
|
||||
loader.source = Qt.resolvedUrl(Wallpaper.projectSourceFileAbsolute);
|
||||
loader.sourceComponent = undefined
|
||||
loader.source = ""
|
||||
Wallpaper.clearComponentCache()
|
||||
loader.source = Qt.resolvedUrl(Wallpaper.projectSourceFileAbsolute)
|
||||
}
|
||||
|
||||
// Replace wallpaper with GIF
|
||||
function onReloadGIF(oldType) {
|
||||
init();
|
||||
init()
|
||||
}
|
||||
|
||||
// This function only gets called here (the same function
|
||||
@ -113,9 +117,9 @@ Rectangle {
|
||||
// We need to check if the old type
|
||||
// was also Video not get called twice
|
||||
if (oldType === InstalledType.VideoWallpaper)
|
||||
return ;
|
||||
return
|
||||
|
||||
loader.source = "qrc:/ScreenPlayWallpaper/qml/MultimediaView.qml";
|
||||
loader.source = "qrc:/ScreenPlayWallpaper/qml/MultimediaView.qml"
|
||||
}
|
||||
|
||||
target: Wallpaper
|
||||
@ -130,20 +134,19 @@ Rectangle {
|
||||
//asynchronous: true
|
||||
onStatusChanged: {
|
||||
if (loader.status === Loader.Error) {
|
||||
loader.source = "";
|
||||
// Wallpaper.terminate();
|
||||
loader.source = ""
|
||||
// Wallpaper.terminate();
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
function onRequestFadeIn() {
|
||||
fadeIn();
|
||||
fadeIn()
|
||||
}
|
||||
|
||||
ignoreUnknownSignals: true
|
||||
target: loader.item
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Image {
|
||||
@ -154,40 +157,41 @@ Rectangle {
|
||||
sourceSize.height: Wallpaper.height
|
||||
source: {
|
||||
if (Qt.platform.os === "windows")
|
||||
return Qt.resolvedUrl("file:///" + Wallpaper.windowsDesktopProperties.wallpaperPath);
|
||||
return Qt.resolvedUrl(
|
||||
"file:///" + Wallpaper.windowsDesktopProperties.wallpaperPath)
|
||||
else
|
||||
return ""
|
||||
}
|
||||
|
||||
|
||||
Component.onCompleted: {
|
||||
if (Qt.platform.os !== "windows") {
|
||||
root.canFadeByWallpaperFillMode = false;
|
||||
return ;
|
||||
root.canFadeByWallpaperFillMode = false
|
||||
return
|
||||
}
|
||||
switch (Wallpaper.windowsDesktopProperties.wallpaperStyle) {
|
||||
case 10:
|
||||
imgCover.fillMode = Image.PreserveAspectCrop;
|
||||
break;
|
||||
imgCover.fillMode = Image.PreserveAspectCrop
|
||||
break
|
||||
case 6:
|
||||
imgCover.fillMode = Image.PreserveAspectFit;
|
||||
break;
|
||||
imgCover.fillMode = Image.PreserveAspectFit
|
||||
break
|
||||
case 2:
|
||||
break;
|
||||
break
|
||||
case 0:
|
||||
if (desktopProperties.isTiled) {
|
||||
// Tiled
|
||||
imgCover.fillMode = Image.Tile;
|
||||
imgCover.fillMode = Image.Tile
|
||||
} else {
|
||||
// Center
|
||||
imgCover.fillMode = Image.PreserveAspectFit;
|
||||
imgCover.anchors.centerIn = parent;
|
||||
imgCover.width = sourceSize.width;
|
||||
imgCover.height = sourceSize.height;
|
||||
imgCover.fillMode = Image.PreserveAspectFit
|
||||
imgCover.anchors.centerIn = parent
|
||||
imgCover.width = sourceSize.width
|
||||
imgCover.height = sourceSize.height
|
||||
}
|
||||
break;
|
||||
break
|
||||
case 22:
|
||||
root.canFadeByWallpaperFillMode = false;
|
||||
break;
|
||||
root.canFadeByWallpaperFillMode = false
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
@ -206,7 +210,6 @@ Rectangle {
|
||||
target: imgCover
|
||||
opacity: 1
|
||||
}
|
||||
|
||||
},
|
||||
State {
|
||||
name: "hideDefaultBackgroundImage"
|
||||
@ -215,7 +218,6 @@ Rectangle {
|
||||
target: imgCover
|
||||
opacity: 0
|
||||
}
|
||||
|
||||
},
|
||||
State {
|
||||
name: "exit"
|
||||
@ -224,7 +226,6 @@ Rectangle {
|
||||
target: imgCover
|
||||
opacity: 1
|
||||
}
|
||||
|
||||
}
|
||||
]
|
||||
transitions: [
|
||||
@ -243,9 +244,7 @@ Rectangle {
|
||||
duration: 600
|
||||
property: "opacity"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
Transition {
|
||||
from: "hideDefaultBackgroundImage"
|
||||
@ -262,9 +261,7 @@ Rectangle {
|
||||
ScriptAction {
|
||||
script: Wallpaper.terminate()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -294,7 +291,12 @@ Rectangle {
|
||||
}
|
||||
|
||||
Text {
|
||||
text: "projectSourceFileAbsolute " + Wallpaper.projectSourceFileAbsolute
|
||||
text: "getApplicationPath " + Wallpaper.getApplicationPath()
|
||||
font.pointSize: 14
|
||||
}
|
||||
|
||||
Text {
|
||||
text: "projectSourceFileAbsolute " + Qt.resolvedUrl(Wallpaper.projectSourceFileAbsolute)
|
||||
font.pointSize: 14
|
||||
}
|
||||
|
||||
@ -331,9 +333,10 @@ Rectangle {
|
||||
Text {
|
||||
text: {
|
||||
if (Qt.platform.os === "windows")
|
||||
return "imgCover.source " + Qt.resolvedUrl("file:///" + Wallpaper.windowsDesktopProperties.wallpaperPath)
|
||||
else
|
||||
return ""
|
||||
return "imgCover.source " + Qt.resolvedUrl(
|
||||
"file:///" + Wallpaper.windowsDesktopProperties.wallpaperPath)
|
||||
else
|
||||
return ""
|
||||
}
|
||||
font.pointSize: 14
|
||||
}
|
||||
@ -342,13 +345,10 @@ Rectangle {
|
||||
text: "imgCover.status " + imgCover.status
|
||||
font.pointSize: 14
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
background: Rectangle {
|
||||
opacity: 0.5
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -85,7 +85,13 @@ BaseWindow::BaseWindow(
|
||||
if (auto typeOpt = ScreenPlayUtil::getInstalledTypeFromString(project.value("type").toString())) {
|
||||
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!");
|
||||
const QString filename = project.value("file").toString();
|
||||
if (filename.endsWith(".mp4")) {
|
||||
@ -93,14 +99,6 @@ BaseWindow::BaseWindow(
|
||||
} else if (filename.endsWith(".webm")) {
|
||||
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 {
|
||||
|
@ -285,20 +285,43 @@ void WinWindow::setupWallpaperForOneScreen(int activeScreen)
|
||||
*/
|
||||
void WinWindow::setupWallpaperForAllScreens()
|
||||
{
|
||||
ScreenPlayUtil::WinMonitorStats monitors;
|
||||
QRect rect;
|
||||
for (int i = 0; i < QApplication::screens().count(); i++) {
|
||||
QScreen* screenTmp = QApplication::screens().at(i);
|
||||
rect.setWidth(rect.width() + screenTmp->geometry().width());
|
||||
rect.setHeight(rect.height() + screenTmp->geometry().height());
|
||||
for (int i = 0; i < monitors.iMonitors.size(); i++) {
|
||||
const int width = std::abs(monitors.rcMonitors[i].right - monitors.rcMonitors[i].left);
|
||||
const int height = std::abs(monitors.rcMonitors[i].top - monitors.rcMonitors[i].bottom);
|
||||
qInfo() << width << height;
|
||||
rect.setWidth(rect.width() + width);
|
||||
rect.setHeight(rect.height() + height);
|
||||
}
|
||||
m_window.setHeight(rect.height());
|
||||
m_window.setWidth(rect.width());
|
||||
if (!SetWindowPos(m_windowHandle, HWND_TOPMOST, 0, 0, rect.width(), rect.height(), SWP_NOSIZE | SWP_NOMOVE)) {
|
||||
int offsetX = 0;
|
||||
int offsetY = 0;
|
||||
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: ");
|
||||
}
|
||||
if (SetParent(m_windowHandle, m_windowHandleWorker) == nullptr) {
|
||||
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();
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -55,8 +55,7 @@ qt_add_qml_module(
|
||||
OUTPUT_DIRECTORY ${WORKSHOP_PLUGIN_DIR}
|
||||
URI "Workshop"
|
||||
SOURCES ${SOURCES} ${HEADER}
|
||||
VERSION
|
||||
1.0)
|
||||
VERSION 1.0)
|
||||
|
||||
if(APPLE)
|
||||
if(${SCREENPLAY_STEAM})
|
||||
|
@ -88,8 +88,10 @@ void InstalledListModel::append(const QJsonObject& obj, const QString& folderNam
|
||||
|
||||
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);
|
||||
|
||||
for (const auto& item : list) {
|
||||
@ -117,6 +119,7 @@ void InstalledListModel::loadInstalledContent()
|
||||
|
||||
emit installedLoadingFinished();
|
||||
});
|
||||
m_loadContentFutureWatcher.setFuture(m_loadContentFuture);
|
||||
}
|
||||
|
||||
QVariantMap InstalledListModel::get(QString folderId)
|
||||
|
@ -89,6 +89,8 @@ signals:
|
||||
private:
|
||||
QVector<ScreenPlay::ProjectFile> m_screenPlayFiles;
|
||||
QUrl m_absoluteStoragePath;
|
||||
QFuture<void> m_loadContentFuture;
|
||||
QFutureWatcher<void> m_loadContentFutureWatcher;
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user