From 10dacd0ba693b3627c178e86ee5d5dc8c5867e6b Mon Sep 17 00:00:00 2001 From: Elias Steurer Date: Wed, 6 Jan 2021 17:35:08 +0100 Subject: [PATCH] Disable monitor selection when using KDE Fix missing enum register Fix hardcoded colors --- ScreenPlay/app.cpp | 6 +++--- ScreenPlay/qml/Installed/Sidebar.qml | 7 +++++-- ScreenPlay/qml/Monitors/MonitorSelection.qml | 15 +++++++++++++++ ScreenPlay/qml/Monitors/MonitorSelectionItem.qml | 5 ++++- ScreenPlay/src/screenplaymanager.cpp | 3 ++- ScreenPlay/src/settings.h | 1 + .../kde/ScreenPlay/contents/ui/main.qml | 9 +++++---- ScreenPlayWallpaper/kde/ScreenPlay/update.sh | 4 ++++ 8 files changed, 39 insertions(+), 11 deletions(-) create mode 100755 ScreenPlayWallpaper/kde/ScreenPlay/update.sh diff --git a/ScreenPlay/app.cpp b/ScreenPlay/app.cpp index 33c1e786..5cecaef9 100644 --- a/ScreenPlay/app.cpp +++ b/ScreenPlay/app.cpp @@ -123,7 +123,7 @@ App::App() qmlRegisterAnonymousType("ScreenPlay", 1); qmlRegisterAnonymousType("ScreenPlay", 1); qmlRegisterAnonymousType("ScreenPlay", 1); - qmlRegisterAnonymousType("ScreenPlay", 1); + qmlRegisterAnonymousType("Settings", 1); // ScreenPlayManager first to check if another ScreenPlay Instace is running m_screenPlayManager = std::make_unique(); @@ -195,7 +195,7 @@ void App::init() // Set visible if the -silent parameter was not set if (QApplication::instance()->arguments().contains("-silent")) { qInfo() << "Starting in silent mode."; - settings()->setSilentStart(true); + m_settings->setSilentStart(true); } qmlRegisterSingletonInstance("ScreenPlay", 1, 0, "ScreenPlay", this); @@ -257,7 +257,7 @@ bool App::loadSteamPlugin() const ScreenPlayWorkshopPlugin* workshopPlugin = reinterpret_cast(m_workshopPlugin.instance()); Q_UNUSED(workshopPlugin) - settings()->setSteamVersion(true); + m_settings->setSteamVersion(true); return true; } } diff --git a/ScreenPlay/qml/Installed/Sidebar.qml b/ScreenPlay/qml/Installed/Sidebar.qml index 4bd6e54f..10fbe691 100644 --- a/ScreenPlay/qml/Installed/Sidebar.qml +++ b/ScreenPlay/qml/Installed/Sidebar.qml @@ -7,6 +7,8 @@ import QtQuick.Controls.Material 2.12 import QtQuick.Controls.Material.impl 2.12 import ScreenPlay 1.0 +import Settings 1.0 + import ScreenPlay.Enums.FillMode 1.0 import ScreenPlay.Enums.InstalledType 1.0 @@ -243,6 +245,7 @@ Item { ColumnLayout { Layout.fillWidth: true + Text { id: txtHeadlineMonitor height: 20 @@ -250,7 +253,7 @@ Item { font.family: ScreenPlay.settings.font verticalAlignment: Text.AlignVCenter font.pointSize: 10 - color: "#626262" + color: Material.primaryTextColor } MonitorSelection { @@ -296,7 +299,7 @@ Item { font.family: ScreenPlay.settings.font verticalAlignment: Text.AlignVCenter font.pointSize: 10 - color: "#626262" + color: Material.primaryTextColor wrapMode: Text.WrapAnywhere Layout.fillWidth: true } diff --git a/ScreenPlay/qml/Monitors/MonitorSelection.qml b/ScreenPlay/qml/Monitors/MonitorSelection.qml index 58908f18..a24188ed 100644 --- a/ScreenPlay/qml/Monitors/MonitorSelection.qml +++ b/ScreenPlay/qml/Monitors/MonitorSelection.qml @@ -3,13 +3,16 @@ import QtQuick.Controls 2.14 import QtGraphicalEffects 1.0 import QtQuick.Controls 2.12 import QtQuick.Controls.Material 2.12 + import ScreenPlay 1.0 +import Settings 1.0 Rectangle { id: root color: Material.theme === Material.Light ? Material.background : Qt.darker( Material.background) + enabled: ScreenPlay.settings.desktopEnvironment === Settings.Windows height: availableHeight width: parent.width clip: true @@ -146,6 +149,7 @@ Rectangle { Flickable { id: flickable anchors.fill: parent + opacity: root.enabled ? 1 : .2 contentWidth: rp.contentWidth contentHeight: rp.contentHeight @@ -167,6 +171,7 @@ Rectangle { property int contentHeight delegate: MonitorSelectionItem { id: delegate + enabled: root.enabled monitorID: m_monitorID monitorName: m_name appID: m_appID @@ -186,4 +191,14 @@ Rectangle { } } } + + Text { + id: name + text: qsTr("KDE only supports one Wallpaper") + font.family: ScreenPlay.settings.font + font.capitalization: Font.Capitalize + color: Material.primaryTextColor + anchors.centerIn: parent + opacity: !root.enabled ? 1 : 0 + } } diff --git a/ScreenPlay/qml/Monitors/MonitorSelectionItem.qml b/ScreenPlay/qml/Monitors/MonitorSelectionItem.qml index fde261cb..58fcf126 100644 --- a/ScreenPlay/qml/Monitors/MonitorSelectionItem.qml +++ b/ScreenPlay/qml/Monitors/MonitorSelectionItem.qml @@ -53,7 +53,7 @@ Item { Rectangle { id: wrapper - color: "#828282" + color: root.enabled ? "#828282" : Qt.lighter("#828282") anchors.fill: parent anchors.margins: 10 border.color: "#1e1e1e" @@ -83,6 +83,9 @@ Item { hoverEnabled: true cursorShape: Qt.PointingHandCursor onClicked: { + if(!root.enabled) + return + if (monitorWithoutContentSelectable) { monitorSelected(index) return diff --git a/ScreenPlay/src/screenplaymanager.cpp b/ScreenPlay/src/screenplaymanager.cpp index 6c81e80c..75ad7a4d 100644 --- a/ScreenPlay/src/screenplaymanager.cpp +++ b/ScreenPlay/src/screenplaymanager.cpp @@ -85,7 +85,8 @@ void ScreenPlayManager::init( if (m_settings->desktopEnvironment() == Settings::DesktopEnvironment::KDE) { m_websocketServer = std::make_unique(QStringLiteral("ScreenPlayWebSocket"), QWebSocketServer::SslMode::NonSecureMode); - m_websocketServer->listen(QHostAddress::Any, m_webSocketPort); + const bool websocket_server = m_websocketServer->listen(QHostAddress::Any, m_webSocketPort); + qInfo() << "Starting kde websocket server : " << websocket_server; QObject::connect(m_websocketServer.get(), &QWebSocketServer::newConnection, this, [this]() { qInfo() << "New Websocket Connection"; auto* socket = m_websocketServer->nextPendingConnection(); diff --git a/ScreenPlay/src/settings.h b/ScreenPlay/src/settings.h index f66a2fda..f68d43e6 100644 --- a/ScreenPlay/src/settings.h +++ b/ScreenPlay/src/settings.h @@ -112,6 +112,7 @@ public: Unity, XFCE, }; + Q_ENUM(DesktopEnvironment) enum class Language { En, diff --git a/ScreenPlayWallpaper/kde/ScreenPlay/contents/ui/main.qml b/ScreenPlayWallpaper/kde/ScreenPlay/contents/ui/main.qml index d9ebd91f..29ab3663 100644 --- a/ScreenPlayWallpaper/kde/ScreenPlay/contents/ui/main.qml +++ b/ScreenPlayWallpaper/kde/ScreenPlay/contents/ui/main.qml @@ -1,12 +1,12 @@ -import QtQuick 2.11 +import QtQuick 2.12 import QtGraphicalEffects 1.0 import QtQuick.Window 2.0 -import Qt.WebSockets 1.15 -import QtWebEngine 1.8 +import Qt.WebSockets 1.0 +import QtWebEngine 1.6 Rectangle { id: root - color: "#333333" + color: "green" property string fullContentPath property real volume: 1.0 property string fillMode: "Cover" @@ -64,6 +64,7 @@ Rectangle { WebEngineView { id: webView anchors.fill: parent + anchors.margins:20 opacity: loadProgress === 100 ? 1 : 0 onLoadProgressChanged: { if (loadProgress === 100) diff --git a/ScreenPlayWallpaper/kde/ScreenPlay/update.sh b/ScreenPlayWallpaper/kde/ScreenPlay/update.sh new file mode 100755 index 00000000..d2c4eded --- /dev/null +++ b/ScreenPlayWallpaper/kde/ScreenPlay/update.sh @@ -0,0 +1,4 @@ +cd .. +plasmapkg2 --upgrade ScreenPlay +kquitapp5 plasmashell +kstart5 plasmashell