From 96d28dad014c992e65a908d7f8386480779abe19 Mon Sep 17 00:00:00 2001 From: Elias Steurer Date: Sat, 16 May 2020 22:59:54 +0200 Subject: [PATCH] Cleanup --- ScreenPlay/src/screenplaymanager.cpp | 5 ++--- ScreenPlay/src/screenplaymanager.h | 2 +- ScreenPlay/src/sdkconnector.cpp | 29 +++++----------------------- ScreenPlay/src/sdkconnector.h | 2 -- 4 files changed, 8 insertions(+), 30 deletions(-) diff --git a/ScreenPlay/src/screenplaymanager.cpp b/ScreenPlay/src/screenplaymanager.cpp index 0d6bb968..3ab6fff6 100644 --- a/ScreenPlay/src/screenplaymanager.cpp +++ b/ScreenPlay/src/screenplaymanager.cpp @@ -51,13 +51,12 @@ void ScreenPlayManager::createWallpaper( m_telemetry->sendEvent("wallpaper", "start"); } - QString path = QUrl::fromUserInput(absoluteStoragePath).toLocalFile(); - QJsonArray monitors; for (const int index : monitorIndex) { monitors.append(index); } + QString path = QUrl::fromUserInput(absoluteStoragePath).toLocalFile(); QString appID = Util::generateRandomString(); std::shared_ptr wallpaper; @@ -277,7 +276,7 @@ bool ScreenPlayManager::removeWallpaperByAppID(const QString& appID) qInfo() << "Remove wallpaper " << wallpaper->file() << "at monitor " << wallpaper->screenNumber(); decreaseActiveWallpaperCounter(); m_screenPlayWallpapers.removeOne(wallpaper); - if(activeWallpaperCounter() != m_screenPlayWallpapers.length()){ + if (activeWallpaperCounter() != m_screenPlayWallpapers.length()) { qWarning() << "activeWallpaperCounter value: " << activeWallpaperCounter() << "does not match m_screenPlayWallpapers length:" << m_screenPlayWallpapers.length(); return false; diff --git a/ScreenPlay/src/screenplaymanager.h b/ScreenPlay/src/screenplaymanager.h index a68a0013..da98fefb 100644 --- a/ScreenPlay/src/screenplaymanager.h +++ b/ScreenPlay/src/screenplaymanager.h @@ -74,7 +74,7 @@ public slots: void removeAllWallpapers(); void removeAllWidgets(); - bool removeWallpaperAt(const int index = 0); + bool removeWallpaperAt(const int index); void requestProjectSettingsListModelAt(const int index); void setWallpaperValue(const int index, const QString& key, const QString& value); diff --git a/ScreenPlay/src/sdkconnector.cpp b/ScreenPlay/src/sdkconnector.cpp index 91217c89..7b29f73b 100644 --- a/ScreenPlay/src/sdkconnector.cpp +++ b/ScreenPlay/src/sdkconnector.cpp @@ -76,6 +76,7 @@ void SDKConnector::closeAllConnections() client->close(); } m_clients.clear(); + m_clients.squeeze(); } /*! @@ -131,36 +132,16 @@ void SDKConnector::closeConntectionByType(const QStringList& list) } } -/*! - \brief Closes a wallpaper at the given \a index. The native monitor index is used here. - On Windows the monitor 0 is the main display. -*/ -void SDKConnector::closeWallpapersAt(int at) -{ - for (const std::shared_ptr& refSDKConnection : qAsConst(m_clients)) { - refSDKConnection->close(); - if (!refSDKConnection->monitor().empty()) { - if (refSDKConnection->monitor().at(0) == at) { - refSDKConnection->close(); - qDebug() << "Wall Closed...!"; - } else { - qDebug() << "COULD NOT CLOSE!"; - } - } else { - qDebug() << "no wp window "; - } - } -} /*! \brief Closes a wallpaper by the given \a appID. */ void SDKConnector::closeWallpaper(const QString& appID) { - for (auto& item : m_clients) { - if (item->appID() == appID) { - item->close(); - m_clients.removeOne(item); + for (auto& client : m_clients) { + if (client->appID() == appID) { + client->close(); + m_clients.removeOne(client); return; } } diff --git a/ScreenPlay/src/sdkconnector.h b/ScreenPlay/src/sdkconnector.h index 0793d60f..e88ea7fd 100644 --- a/ScreenPlay/src/sdkconnector.h +++ b/ScreenPlay/src/sdkconnector.h @@ -40,8 +40,6 @@ public slots: void closeAllConnections(); void closeAllWallpapers(); void closeAllWidgets(); - - void closeWallpapersAt(int at); void closeWallpaper(const QString& appID); void setWallpaperValue(QString appID, QString key, QString value);