From 78caa35f89886c010a45be1b181394a12eda67a7 Mon Sep 17 00:00:00 2001 From: Elias Steurer Date: Thu, 12 Oct 2023 16:01:51 +0200 Subject: [PATCH] Remove old KDE implementation --- .gitlab/ci/base_jobs.yml | 2 +- README.md | 4 +- ScreenPlay/inc/public/ScreenPlay/app.h | 10 -- .../inc/public/ScreenPlay/screenplaymanager.h | 6 - .../public/ScreenPlay/screenplaywallpaper.h | 1 - ScreenPlay/inc/public/ScreenPlay/settings.h | 1 + ScreenPlay/src/app.cpp | 110 ----------------- ScreenPlay/src/screenplaymanager.cpp | 69 +---------- ScreenPlay/src/settings.cpp | 4 +- ScreenPlayWallpaper/CMakeLists.txt | 3 - ScreenPlayWallpaper/kde/ScreenPlay/README.md | 28 ----- .../kde/ScreenPlay/contents/config/main.xml | 15 --- .../contents/ui/WaitingForScreenplay.qml | 72 ----------- .../kde/ScreenPlay/contents/ui/Wallpaper.qml | 86 ------------- .../contents/ui/WallpaperContainer.qml | 41 ------- .../kde/ScreenPlay/contents/ui/config.qml | 28 ----- .../kde/ScreenPlay/contents/ui/index.html | 37 ------ .../kde/ScreenPlay/contents/ui/main.qml | 114 ------------------ .../kde/ScreenPlay/metadata.desktop | 20 --- 19 files changed, 7 insertions(+), 644 deletions(-) delete mode 100644 ScreenPlayWallpaper/kde/ScreenPlay/README.md delete mode 100644 ScreenPlayWallpaper/kde/ScreenPlay/contents/config/main.xml delete mode 100644 ScreenPlayWallpaper/kde/ScreenPlay/contents/ui/WaitingForScreenplay.qml delete mode 100644 ScreenPlayWallpaper/kde/ScreenPlay/contents/ui/Wallpaper.qml delete mode 100644 ScreenPlayWallpaper/kde/ScreenPlay/contents/ui/WallpaperContainer.qml delete mode 100644 ScreenPlayWallpaper/kde/ScreenPlay/contents/ui/config.qml delete mode 100644 ScreenPlayWallpaper/kde/ScreenPlay/contents/ui/index.html delete mode 100644 ScreenPlayWallpaper/kde/ScreenPlay/contents/ui/main.qml delete mode 100644 ScreenPlayWallpaper/kde/ScreenPlay/metadata.desktop diff --git a/.gitlab/ci/base_jobs.yml b/.gitlab/ci/base_jobs.yml index 8b343cc1..86aa846f 100644 --- a/.gitlab/ci/base_jobs.yml +++ b/.gitlab/ci/base_jobs.yml @@ -43,7 +43,7 @@ - cd .. - cd .. image: - name: ubuntu:23.10 + name: ubuntu:22.04 tags: - gitlab-org-docker artifacts: diff --git a/README.md b/README.md index 9a2c14fa..8ef497b8 100644 --- a/README.md +++ b/README.md @@ -74,11 +74,11 @@ Here are some ways you can contribute:
-| Feature | Windows | Linux | MacOS | +| Feature | Windows | Linux X11 and Wayland (layer shell) | MacOS | |------------------------ |--------- |------- |------- | | __ScreenPlay Main App__ | ✔ | ✔ | ✔ | | __Steam Binaries__ | ✔ | ❌ | ✔ | -| __Wallpaper__ | ✔ | ❓ Help Needed for Gnome/KDE/etc! | ✔ | +| __Wallpaper__ | ✔ | ✔ | ✔ | | __Widgets__ | ✔ | ✔ | ✔ | | __Multilanguage (EN,DE,RU,FR,ES,KO,VI,CH_ZN,PT_BR🆕)__ | ✔ | ✔ | ✔ | diff --git a/ScreenPlay/inc/public/ScreenPlay/app.h b/ScreenPlay/inc/public/ScreenPlay/app.h index 8512b7de..81231b38 100644 --- a/ScreenPlay/inc/public/ScreenPlay/app.h +++ b/ScreenPlay/inc/public/ScreenPlay/app.h @@ -101,13 +101,6 @@ public slots: void setMainWindowEngine(QQmlApplicationEngine* mainWindowEngine); void setWizards(Wizards* wizards); -private: - bool setupKDE(); - bool isKDEInstalled(); - void installKDEWallpaper(); - void upgradeKDEWallpaper(); - void restartKDE(); - std::optional isNewestKDEWallpaperInstalled(); private: QNetworkAccessManager m_networkAccessManager; @@ -126,8 +119,5 @@ private: std::shared_ptr m_monitorListModel; std::shared_ptr m_profileListModel; std::shared_ptr m_installedListFilter; - - QString m_kdeWallpaperPath; - QString m_appKdeWallapperPath; }; } diff --git a/ScreenPlay/inc/public/ScreenPlay/screenplaymanager.h b/ScreenPlay/inc/public/ScreenPlay/screenplaymanager.h index ba183f50..00fbc390 100644 --- a/ScreenPlay/inc/public/ScreenPlay/screenplaymanager.h +++ b/ScreenPlay/inc/public/ScreenPlay/screenplaymanager.h @@ -27,7 +27,6 @@ class ScreenPlayManager : public QObject { Q_PROPERTY(int activeWallpaperCounter READ activeWallpaperCounter WRITE setActiveWallpaperCounter NOTIFY activeWallpaperCounterChanged) Q_PROPERTY(int activeWidgetsCounter READ activeWidgetsCounter WRITE setActiveWidgetsCounter NOTIFY activeWidgetsCounterChanged) - Q_PROPERTY(bool isKDEConnected READ isKDEConnected WRITE setIsKDEConnected NOTIFY isKDEConnectedChanged) public: explicit ScreenPlayManager(QObject* parent = nullptr); @@ -41,8 +40,6 @@ public: int activeWidgetsCounter() const { return m_activeWidgetsCounter; } bool isAnotherScreenPlayInstanceRunning() { return m_isAnotherScreenPlayInstanceRunning; } - bool isKDEConnected() const; - void setIsKDEConnected(bool isKDEConnected); signals: void activeWallpaperCounterChanged(int activeWallpaperCounter); @@ -55,8 +52,6 @@ signals: void profilesSaved(); void displayErrorPopup(const QString& msg); - void isKDEConnectedChanged(bool isKDEConnected); - private slots: bool saveProfiles(); @@ -168,7 +163,6 @@ private: QTimer m_saveLimiter; const quint16 m_webSocketPort = 16395; - bool m_isKDEConnected = false; }; } diff --git a/ScreenPlay/inc/public/ScreenPlay/screenplaywallpaper.h b/ScreenPlay/inc/public/ScreenPlay/screenplaywallpaper.h index fdc7c878..65516e0e 100644 --- a/ScreenPlay/inc/public/ScreenPlay/screenplaywallpaper.h +++ b/ScreenPlay/inc/public/ScreenPlay/screenplaywallpaper.h @@ -95,7 +95,6 @@ signals: void volumeChanged(float volume); void isLoopingChanged(bool isLooping); void playbackRateChanged(float playbackRate); - void messageKDECloseWallpaper(); void requestSave(); void requestClose(const QString& appID); diff --git a/ScreenPlay/inc/public/ScreenPlay/settings.h b/ScreenPlay/inc/public/ScreenPlay/settings.h index 85edc6a4..3fc63987 100644 --- a/ScreenPlay/inc/public/ScreenPlay/settings.h +++ b/ScreenPlay/inc/public/ScreenPlay/settings.h @@ -72,6 +72,7 @@ public: Unknown, OSX, Windows, + Wayland, Cinnamon, Enlightenment, Gnome, diff --git a/ScreenPlay/src/app.cpp b/ScreenPlay/src/app.cpp index 47008874..9bfe8e16 100644 --- a/ScreenPlay/src/app.cpp +++ b/ScreenPlay/src/app.cpp @@ -200,10 +200,6 @@ void App::init() m_mainWindowEngine->addImportPath(guiAppInst->applicationDirPath() + "/qml"); guiAppInst->addLibraryPath(guiAppInst->applicationDirPath() + "/qml"); - if (m_settings->desktopEnvironment() == Settings::DesktopEnvironment::KDE) { - setupKDE(); - } - QQuickStyle::setStyle("Material"); m_mainWindowEngine->load(QUrl(QStringLiteral("qrc:/qml/ScreenPlayApp/main.qml"))); @@ -229,112 +225,6 @@ void App::exit() guiAppInst->quit(); } -bool App::isKDEInstalled() -{ - QProcess plasmaShellVersionProcess; - plasmaShellVersionProcess.start("plasmashell", { "--version" }); - plasmaShellVersionProcess.waitForFinished(); - QString versionOut = plasmaShellVersionProcess.readAll(); - if (!versionOut.contains("plasmashell ")) { - qWarning() << "Unable to read plasma shell version. ScreenPlay only works on KDE"; - return false; - } - return true; -} - -void App::installKDEWallpaper() -{ - - qInfo() << "Install ScreenPlay KDE Wallpaper"; - QProcess process; - process.setWorkingDirectory(m_appKdeWallapperPath); - process.start("plasmapkg2", { "--install", "ScreenPlay" }); - process.waitForFinished(); - process.terminate(); -} - -void App::upgradeKDEWallpaper() -{ - - qInfo() << "Upgrade ScreenPlay KDE Wallpaper"; - QProcess process; - process.setWorkingDirectory(m_appKdeWallapperPath); - process.start("plasmapkg2", { "--upgrade", "ScreenPlay" }); - process.waitForFinished(); - process.terminate(); - qInfo() << process.readAllStandardError() << process.readAllStandardOutput(); -} - -void App::restartKDE() -{ - qInfo() << "Restart KDE "; - QProcess process; - process.start("kquitapp5", { "plasmashell" }); - process.waitForFinished(); - process.terminate(); - qInfo() << process.readAllStandardError() << process.readAllStandardOutput(); - process.startDetached("kstart5", { "plasmashell" }); - qInfo() << process.readAllStandardError() << process.readAllStandardOutput(); -} - -std::optional App::isNewestKDEWallpaperInstalled() -{ - - QFileInfo installedWallpaperMetadata(m_kdeWallpaperPath + "/metadata.desktop"); - QSettings installedWallpaperSettings(installedWallpaperMetadata.absoluteFilePath(), QSettings::Format::IniFormat); - installedWallpaperSettings.beginGroup("Desktop Entry"); - const QString installedWallpaperVersion = installedWallpaperSettings.value("Version").toString(); - installedWallpaperSettings.endGroup(); - const QVersionNumber installedVersionNumber = QVersionNumber::fromString(installedWallpaperVersion); - - QFileInfo currentWallpaperMetadata(m_appKdeWallapperPath + "/ScreenPlay/metadata.desktop"); - QSettings currentWallpaperSettings(currentWallpaperMetadata.absoluteFilePath(), QSettings::Format::IniFormat); - currentWallpaperSettings.beginGroup("Desktop Entry"); - const QString currentWallpaperVersion = currentWallpaperSettings.value("Version").toString(); - currentWallpaperSettings.endGroup(); - const QVersionNumber currentVersionNumber = QVersionNumber::fromString(currentWallpaperVersion); - - qInfo() << "installedVersionNumber" << installedVersionNumber << "currentVersionNumber " << currentVersionNumber; - if (installedVersionNumber.isNull() || currentVersionNumber.isNull()) { - qInfo() << "Unable to parse version number from:" << currentWallpaperVersion << installedWallpaperVersion; - qInfo() << "Reinstall ScreenPlay Wallpaper"; - return std::nullopt; - } else { - return { installedVersionNumber >= currentVersionNumber }; - } -} - -/*! - \brief -*/ -bool App::setupKDE() -{ - - m_kdeWallpaperPath = QDir(QDir::homePath() + "/.local/share/plasma/wallpapers/ScreenPlay/").canonicalPath(); - m_appKdeWallapperPath = QGuiApplication::instance()->applicationDirPath() + "/kde"; - - if (!isKDEInstalled()) - return false; - - QFileInfo installedWallpaperMetadata(m_kdeWallpaperPath + "/metadata.desktop"); - if (!installedWallpaperMetadata.exists()) { - installKDEWallpaper(); - restartKDE(); - return true; - } - if (auto isNewer = isNewestKDEWallpaperInstalled()) { - if (!isNewer.value()) { - upgradeKDEWallpaper(); - return true; - } - - qInfo() << "All up to date!" << isNewer.value(); - return true; - } else { - return false; - } -} - void App::showDockIcon(const bool show) { #if defined(Q_OS_OSX) diff --git a/ScreenPlay/src/screenplaymanager.cpp b/ScreenPlay/src/screenplaymanager.cpp index fcba65ba..d267c6b2 100644 --- a/ScreenPlay/src/screenplaymanager.cpp +++ b/ScreenPlay/src/screenplaymanager.cpp @@ -83,28 +83,6 @@ void ScreenPlayManager::init( m_monitorListModel = mlm; m_settings = settings; - if (m_settings->desktopEnvironment() == Settings::DesktopEnvironment::KDE) { - m_websocketServer = std::make_unique(QStringLiteral("ScreenPlayWebSocket"), QWebSocketServer::SslMode::NonSecureMode); - const bool success = m_websocketServer->listen(QHostAddress::Any, m_webSocketPort); - qInfo() << "Open Websocket:" << success << "port:" << m_webSocketPort; - QObject::connect(m_websocketServer.get(), &QWebSocketServer::newConnection, this, [this]() { - qInfo() << "New Websocket Connection"; - auto* socket = m_websocketServer->nextPendingConnection(); - QObject::connect(socket, &QWebSocket::textMessageReceived, this, [this](const QString& message) { - qInfo() << "Message:" << message; - }); - QObject::connect(socket, &QWebSocket::disconnected, this, [this, socket]() { - m_connections.removeOne(socket); - setIsKDEConnected(false); - qInfo() << "Disconnected connection count: " << m_connections.count(); - }); - - m_connections.push_back(socket); - setIsKDEConnected(true); - // socket->flush(); - }); - } - // Reset to default settings if we are unable to load // the existing one if (!loadProfiles()) { @@ -153,22 +131,6 @@ bool ScreenPlayManager::createWallpaper( const QString path = QUrl::fromUserInput(absoluteStoragePath).toLocalFile(); const QString appID = ScreenPlayUtil::generateRandomString(); - if (m_settings->desktopEnvironment() == Settings::DesktopEnvironment::KDE) { - if (m_connections.empty()) - return false; - - QJsonObject msg; - msg.insert("command", "replace"); - msg.insert("absolutePath", path); - msg.insert("type", static_cast(type)); - msg.insert("fillMode", static_cast(fillMode)); - msg.insert("volume", volume); - msg.insert("file", file); - - m_connections.first()->sendTextMessage(QJsonDocument(msg).toJson()); - m_connections.first()->flush(); - } - // Only support remove wallpaper that spans over 1 monitor if (monitorIndex.length() == 1) { int i = 0; @@ -207,11 +169,7 @@ bool ScreenPlayManager::createWallpaper( QObject::connect(wallpaper.get(), &ScreenPlayWallpaper::requestSave, this, &ScreenPlayManager::requestSaveProfiles); QObject::connect(wallpaper.get(), &ScreenPlayWallpaper::requestClose, this, &ScreenPlayManager::removeWallpaper); QObject::connect(wallpaper.get(), &ScreenPlayWallpaper::error, this, &ScreenPlayManager::displayErrorPopup); - if (m_settings->desktopEnvironment() != Settings::DesktopEnvironment::KDE) { - if (!wallpaper->start()) { - return false; - } - } + m_screenPlayWallpapers.append(wallpaper); m_monitorListModel->setWallpaperMonitor(wallpaper, monitorIndex); increaseActiveWallpaperCounter(); @@ -286,15 +244,6 @@ bool ScreenPlayManager::removeAllWallpapers() return false; } } - if (m_settings->desktopEnvironment() == Settings::DesktopEnvironment::KDE) { - for (auto& connection : m_connections) { - QJsonObject obj; - obj.insert("command", "quit"); - connection->sendTextMessage(QJsonDocument(obj).toJson(QJsonDocument::Compact)); - connection->flush(); - connection->close(); - } - } emit requestSaveProfiles(); @@ -486,9 +435,6 @@ bool ScreenPlayManager::removeWallpaper(const QString& appID) return false; } - if (m_settings->desktopEnvironment() == Settings::DesktopEnvironment::Windows || m_settings->desktopEnvironment() == Settings::DesktopEnvironment::OSX) - wallpaper->messageKDECloseWallpaper(); - qInfo() << "Remove wallpaper " << wallpaper->file() << "at monitor " << wallpaper->screenNumber(); // The MonitorListModel contains a shared_ptr of this object that needs to be removed @@ -723,19 +669,6 @@ bool ScreenPlayManager::loadProfiles() return true; } -bool ScreenPlayManager::isKDEConnected() const -{ - return m_isKDEConnected; -} - -void ScreenPlayManager::setIsKDEConnected(bool isKDEConnected) -{ - if (m_isKDEConnected == isKDEConnected) - return; - m_isKDEConnected = isKDEConnected; - emit isKDEConnectedChanged(isKDEConnected); -} - } #include "moc_screenplaymanager.cpp" diff --git a/ScreenPlay/src/settings.cpp b/ScreenPlay/src/settings.cpp index c28bad0f..d577bdce 100644 --- a/ScreenPlay/src/settings.cpp +++ b/ScreenPlay/src/settings.cpp @@ -59,8 +59,8 @@ Settings::Settings(const std::shared_ptr& globalVariables, setDesktopEnvironment(DesktopEnvironment::OSX); #endif #ifdef Q_OS_LINUX - // We only support KDE for now - setDesktopEnvironment(DesktopEnvironment::KDE); + // We only support Wayland wl_roots for now + setDesktopEnvironment(DesktopEnvironment::Wayland); #endif qRegisterMetaType("Settings::Language"); diff --git a/ScreenPlayWallpaper/CMakeLists.txt b/ScreenPlayWallpaper/CMakeLists.txt index 620afbae..30f08dea 100644 --- a/ScreenPlayWallpaper/CMakeLists.txt +++ b/ScreenPlayWallpaper/CMakeLists.txt @@ -92,9 +92,6 @@ if(UNIX AND NOT APPLE) target_link_libraries( ${PROJECT_NAME} PRIVATE LayerShellQtInterface) - - include(CopyRecursive) - copy_recursive(${CMAKE_CURRENT_SOURCE_DIR}/kde/ScreenPlay ${CMAKE_BINARY_DIR}/bin/kde/ScreenPlay "*") endif() if(APPLE) diff --git a/ScreenPlayWallpaper/kde/ScreenPlay/README.md b/ScreenPlayWallpaper/kde/ScreenPlay/README.md deleted file mode 100644 index c62e5229..00000000 --- a/ScreenPlayWallpaper/kde/ScreenPlay/README.md +++ /dev/null @@ -1,28 +0,0 @@ -# ScreenPlay Wallpaper for KDE Plasma Desktop - -One has to install it via the command below. Simply putting it into: -* ~/.local/share/plasma/wallpapers/ -Will not work because KDE uses the kpluginindex.json (that is actually a bz2 file. Do not ask why...) to load all available wallpaper. - -#### Installation -``` -sudo apt install qml-module-qt-websockets qtwebengine5-* - -plasmapkg2 --install ScreenPlay -``` - -#### Application structure -Because Wallpaper and Widgets are already a different application we can extend the logic for KDE. For this we create a local websocket instance to communicate with our main ScreenPlay app. - -### Development -1. Make changes -1. `plasmapkg2 --upgrade ScreenPlay` -1. Open Desktop Settings - - Select Wallpaper type Image -1. Close Desktop Settings Window -1. Open Desktop Settings - - Select Wallpaper type ScreenPlay - -``` -plasmapkg2 --upgrade ScreenPlay ; kquitapp5 plasmashell; kstart5 plasmashell -``` \ No newline at end of file diff --git a/ScreenPlayWallpaper/kde/ScreenPlay/contents/config/main.xml b/ScreenPlayWallpaper/kde/ScreenPlay/contents/config/main.xml deleted file mode 100644 index 500f9e69..00000000 --- a/ScreenPlayWallpaper/kde/ScreenPlay/contents/config/main.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - 0 - - - - diff --git a/ScreenPlayWallpaper/kde/ScreenPlay/contents/ui/WaitingForScreenplay.qml b/ScreenPlayWallpaper/kde/ScreenPlay/contents/ui/WaitingForScreenplay.qml deleted file mode 100644 index e4662751..00000000 --- a/ScreenPlayWallpaper/kde/ScreenPlay/contents/ui/WaitingForScreenplay.qml +++ /dev/null @@ -1,72 +0,0 @@ -import QtQuick 2.15 - -Rectangle { - anchors.fill: parent - color: "black" - - Rectangle { - id: toBeCreated - anchors.fill: parent - color: "black" - opacity: 0 - - Text { - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - wrapMode: Text.WordWrap - anchors.centerIn: parent - text: qsTr("Please start ScreenPlay before launching the wallpaper") - color: "White" - font.pixelSize: 50 - } - - OpacityAnimator on opacity { - id: createAnimation - from: 0 - to: 1 - duration: 1000 - onRunningChanged: { - if (!running) { - toBeDeleted.opacity = 1; - toBeCreated.opacity = 0; - destroyAnimation.start(); - } - } - } - Component.onCompleted: { - createAnimation.start(); - } - } - - Rectangle { - id: toBeDeleted - opacity: 0 - anchors.fill: parent - color: "black" - - Text { - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - wrapMode: Text.WordWrap - anchors.centerIn: parent - text: qsTr("Please start ScreenPlay before launching the wallpaper") - color: "White" - font.pixelSize: 50 - } - - OpacityAnimator on opacity { - id: destroyAnimation - from: 1 - to: 0 - duration: 1000 - running: false - onRunningChanged: { - if (!running) { - toBeDeleted.opacity = 0; - toBeCreated.opacity = 0; - createAnimation.start(); - } - } - } - } -} diff --git a/ScreenPlayWallpaper/kde/ScreenPlay/contents/ui/Wallpaper.qml b/ScreenPlayWallpaper/kde/ScreenPlay/contents/ui/Wallpaper.qml deleted file mode 100644 index 45d2ed96..00000000 --- a/ScreenPlayWallpaper/kde/ScreenPlay/contents/ui/Wallpaper.qml +++ /dev/null @@ -1,86 +0,0 @@ -import QtQuick 2.0 -import QtQuick.Controls 2.12 -import QtWebSockets 1.1 -import QtWebEngine 1.8 -import QtMultimedia 5.12 -import Qt.labs.settings 1.1 - -Rectangle { - id: root - color: "black" - anchors.fill: parent - - property string fullContentPath - property real volume: 1 - property string fillMode: "Cover" - property string type - property string projectSourceFileAbsolute - property bool loops: true - - function stop() { - player1.stop(); - player2.stop(); - videoOutput1.visible = false; - videoOutput2.visible = false; - root.enabled = false; - } - - function play() { - root.enabled = true; - videoOutput2.visible = false; - videoOutput1.visible = true; - - //if(wallpaper.configuration.DualPlayback){ - player2.source = root.projectSourceFileAbsolute; - player2.play(); - player2.pause(); - //} - player1.play(); - } - - MediaPlayer { - id: player1 - volume: root.volume - source: root.projectSourceFileAbsolute - onStopped: { - if (!root.enabled) - return; - videoOutput1.visible = false; - videoOutput2.visible = true; - if (player2.source !== root.projectSourceFileAbsolute) { - player2.source = root.projectSourceFileAbsolute; - } - player1.play(); - player1.pause(); - player2.play(); - } - } - - MediaPlayer { - id: player2 - volume: root.volume - onStopped: { - if (!root.enabled) - return; - videoOutput2.visible = false; - videoOutput1.visible = true; - player2.play(); - player2.pause(); - player1.play(); - } - } - - VideoOutput { - id: videoOutput1 - fillMode: VideoOutput.PreserveAspectCrop - anchors.fill: parent - source: player1 - } - - VideoOutput { - id: videoOutput2 - fillMode: VideoOutput.PreserveAspectCrop - anchors.fill: parent - source: player2 - } -} diff --git a/ScreenPlayWallpaper/kde/ScreenPlay/contents/ui/WallpaperContainer.qml b/ScreenPlayWallpaper/kde/ScreenPlay/contents/ui/WallpaperContainer.qml deleted file mode 100644 index e5781a43..00000000 --- a/ScreenPlayWallpaper/kde/ScreenPlay/contents/ui/WallpaperContainer.qml +++ /dev/null @@ -1,41 +0,0 @@ -import QtQuick 2.0 -import QtQuick.Controls 2.12 -import QtWebSockets 1.1 -import QtWebEngine 1.8 -import QtMultimedia 5.12 - -Rectangle { - id: container - anchors.fill: parent - - Loader { - id: wp - anchors.fill: parent - source: "Wallpaper.qml" - property bool connected: false - - Timer { - id: connectTimer - interval: 1000 - running: true - repeat: true - onTriggered: { - if (!wp.connected) { - console.log("not connected"); - wp.source = ""; - wp.source = "Wallpaper.qml"; - } else { - console.log("connected"); - screensaver.visible = false; - connectTimer.stop(); - } - } - } - } - - Loader { - id: screensaver - anchors.fill: parent - source: "WaitingForScreenplay.qml" - } -} diff --git a/ScreenPlayWallpaper/kde/ScreenPlay/contents/ui/config.qml b/ScreenPlayWallpaper/kde/ScreenPlay/contents/ui/config.qml deleted file mode 100644 index 80c2c221..00000000 --- a/ScreenPlayWallpaper/kde/ScreenPlay/contents/ui/config.qml +++ /dev/null @@ -1,28 +0,0 @@ -import QtQuick 2.11 -import QtQuick.Controls 2.4 as QQC -import QtQuick.Window 2.0 -import QtGraphicalEffects 1.0 -import org.kde.plasma.core 2.0 as PlasmaCore -import org.kde.plasma.wallpapers.image 2.0 as Wallpaper -import org.kde.kcm 1.1 as KCM -import org.kde.kirigami 2.4 as Kirigami -import org.kde.newstuff 1.1 as NewStuff - -Column { - id: root - - property alias cfg_MonitorIndex: monitorIndex.text - - anchors.fill: parent - spacing: units.largeSpacing - - Row { - anchors.horizontalCenter: parent.horizontalCenter - spacing: units.largeSpacing - - QQC.TextField { - id: monitorIndex - text: "0" - } - } -} diff --git a/ScreenPlayWallpaper/kde/ScreenPlay/contents/ui/index.html b/ScreenPlayWallpaper/kde/ScreenPlay/contents/ui/index.html deleted file mode 100644 index 717a664d..00000000 --- a/ScreenPlayWallpaper/kde/ScreenPlay/contents/ui/index.html +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - diff --git a/ScreenPlayWallpaper/kde/ScreenPlay/contents/ui/main.qml b/ScreenPlayWallpaper/kde/ScreenPlay/contents/ui/main.qml deleted file mode 100644 index cc9b7d3b..00000000 --- a/ScreenPlayWallpaper/kde/ScreenPlay/contents/ui/main.qml +++ /dev/null @@ -1,114 +0,0 @@ -import QtQuick 2.0 -import QtQuick.Controls 2.12 -import QtWebSockets 1.1 -import QtWebEngine 1.8 -import QtMultimedia 5.12 -import Qt.labs.settings 1.1 -import org.kde.plasma.core 2.0 as PlasmaCore - -Rectangle { - id: root - color: "orange" - property bool connected: false - - Settings { - id: settings - } - - Component.onCompleted: { - wallpaper.projectSourceFileAbsolute = settings.value("SP_projectSourceFileAbsolute", "NULL"); - // if(root.projectSourceFileAbsolute === "NULL") - // return - wallpaper.type = settings.value("SP_type"); - wallpaper.fillMode = settings.value("SP_fillMode"); - //wallpaper.volume = settings.value("SP_volume") - wallpaper.play(); - } - - Wallpaper { - id: wallpaper - anchors.fill: parent - - // visible: root.connected - onFullContentPathChanged: settings.setValue("SP_fullContentPath", fullContentPath) - onVolumeChanged: settings.setValue("SP_volume", volume) - onFillModeChanged: settings.setValue("SP_fillMode", fillMode) - onTypeChanged: settings.setValue("SP_type", type) - onProjectSourceFileAbsoluteChanged: settings.setValue("SP_projectSourceFileAbsolute", projectSourceFileAbsolute) - onLoopsChanged: settings.setValue("SP_loops", loops) - } - - Timer { - id: reconnectTimer - interval: 1000 - running: true - repeat: true - onTriggered: { - if (socket.status === WebSocket.Open) - return; - socket.active = false; - socket.active = true; - reconnectTimer.retryCounter += 1; - } - property int retryCounter: 0 - } - - WebSocket { - id: socket - url: "ws://127.0.0.1:16395" - onStatusChanged: { - if (socket.status === WebSocket.Open) - socket.sendTextMessage("Hello World from QML wallpaper"); - } - - onTextMessageReceived: message => { - var obj = JSON.parse(message); - root.connected = true; - txtCommand.text = obj.command; - if (obj.command === "replace") { - socket.sendTextMessage("replace"); - wallpaper.type = obj.type; - wallpaper.fillMode = obj.fillMode; - wallpaper.volume = obj.volume; - wallpaper.projectSourceFileAbsolute = "file://" + obj.absolutePath + "/" + obj.file; - print("got: " + root.projectSourceFileAbsolute); - wallpaper.play(); - return; - } - if (obj.command === "quit") { - wallpaper.stop(); - } - } - } - // WaitingForScreenplay { - // anchors.fill: parent - // visible: !root.connected - // } - Column { - anchors { - horizontalCenter: parent.horizontalCenter - bottom: parent.bottom - margins: 60 - } - Text { - id: txtCommand - color: "white" - } - Text { - color: "white" - text: "wallpaper.type: " + wallpaper.type - } - Text { - color: "white" - text: "projectSourceFileAbsolute " + wallpaper.projectSourceFileAbsolute - } - Text { - color: "white" - text: "reconnectTimer.retryCounter : " + reconnectTimer.retryCounter - } - Text { - color: "white" - text: "MonitorIndex: " + wallpaper.configuration.MonitorIndex - } - } -} diff --git a/ScreenPlayWallpaper/kde/ScreenPlay/metadata.desktop b/ScreenPlayWallpaper/kde/ScreenPlay/metadata.desktop deleted file mode 100644 index 1d642b0e..00000000 --- a/ScreenPlayWallpaper/kde/ScreenPlay/metadata.desktop +++ /dev/null @@ -1,20 +0,0 @@ -[Desktop Entry] -Encoding=UTF-8 -Name=ScreenPlay -Keywords=ScreenPlay -Icon=preferences-desktop-wallpaper -Version=0.15.0-RC5 - -Type=Service - -X-KDE-ServiceTypes=Plasma/Wallpaper -X-KDE-ParentApp= -X-KDE-PluginInfo-Name=ScreenPlay -X-KDE-PluginInfo-EnabledByDefault=true -X-KDE-PluginInfo-Version=3 -X-KDE-PluginInfo-Website=https://gitlab.com/kelteseth/screenplay - -X-Plasma-MainScript=ui/main.qml - -MimeType=image/gif;image/png;image/svg+xml;image/svg+xml-compressed;video/x-mng; -X-Plasma-DropMimeTypes=image/gif,image/png,image/svg+xml,image/svg+xml-compressed,video/x-mng