From 52fb670d55f60e88d29b0e222907511937a24d8a Mon Sep 17 00:00:00 2001 From: Elias Steurer Date: Thu, 14 May 2020 16:45:50 +0200 Subject: [PATCH] Change widget and wallpaper types to use enums Apparently this is the only way for qml to work * https://www.kdab.com/new-qt-5-8-meta-object-support-namespaces/ moc needs full enum namespace info see QTBUG-58454 void createWallpaper( const ScreenPlay::Enums::WallpaperType type, const ScreenPlay::Enums::FillMode fillMode, const QString& absoluteStoragePath, const QString& previewImage, QVector monitorIndex, const float volume, const bool saveToProfilesConfigFile); --- ScreenPlay/CMakeLists.txt | 2 +- ScreenPlay/app.cpp | 16 +++-- ScreenPlay/main.qml | 17 +++-- ScreenPlay/qml/Community/XMLNewsfeed.qml | 66 ++++--------------- ScreenPlay/qml/Create/CreateContentButton.qml | 2 +- .../CreateEmptyWidget/CreateEmptyWidget.qml | 2 +- ScreenPlay/qml/Installed/Sidebar.qml | 43 +++++++----- .../qml/Monitors/DefaultVideoControls.qml | 14 ++-- .../Monitors/MonitorsProjectSettingItem.qml | 2 +- ScreenPlay/qml/Settings/Settings.qml | 14 ++-- ScreenPlay/src/globalvariables.h | 48 ++++++++------ ScreenPlay/src/screenplaymanager.cpp | 16 ++--- ScreenPlay/src/screenplaymanager.h | 9 +-- ScreenPlay/src/screenplaywallpaper.cpp | 4 +- ScreenPlay/src/screenplaywallpaper.h | 16 ++--- ScreenPlay/src/screenplaywidget.cpp | 2 +- ScreenPlay/src/screenplaywidget.h | 12 ++-- ScreenPlay/src/settings.cpp | 4 +- ScreenPlay/src/settings.h | 17 +++-- 19 files changed, 144 insertions(+), 162 deletions(-) diff --git a/ScreenPlay/CMakeLists.txt b/ScreenPlay/CMakeLists.txt index cba3e713..2719199c 100644 --- a/ScreenPlay/CMakeLists.txt +++ b/ScreenPlay/CMakeLists.txt @@ -60,7 +60,7 @@ set(headers app.h set(resources Resources.qrc) -add_executable(ScreenPlay ${src} ${headers} ${resources}) +add_executable(${PROJECT_NAME} ${src} ${headers} ${resources}) target_compile_definitions(${PROJECT_NAME} PRIVATE "GIT_VERSION=${GIT_VERSION}") diff --git a/ScreenPlay/app.cpp b/ScreenPlay/app.cpp index b590503c..c90df31d 100644 --- a/ScreenPlay/app.cpp +++ b/ScreenPlay/app.cpp @@ -86,12 +86,18 @@ App::App() qRegisterMetaType(); qRegisterMetaType(); qRegisterMetaType(); - qRegisterMetaType(); - qRegisterMetaType(); - qRegisterMetaType(); - qmlRegisterUncreatableType("ScreenPlay.GlobalVariables", 1, 0, "GlobalVariables", "Error only for enums"); - + qRegisterMetaType(); + qRegisterMetaType(); + qRegisterMetaType(); + // Registers the enums from globalvariables. + // Apparently this is the only way for qml to work + // https://www.kdab.com/new-qt-5-8-meta-object-support-namespaces/ + qmlRegisterUncreatableMetaObject(ScreenPlay::Enums::staticMetaObject, + "ScreenPlayEnums", + 1, 0, + "ScreenPlayEnums", + "Error: only enums"); qmlRegisterAnonymousType("ScreenPlay", 1); qmlRegisterAnonymousType("ScreenPlay", 1); diff --git a/ScreenPlay/main.qml b/ScreenPlay/main.qml index 1252baee..22166d43 100644 --- a/ScreenPlay/main.qml +++ b/ScreenPlay/main.qml @@ -15,18 +15,18 @@ import "qml/Common" import "qml/Installed" import "qml/Navigation" import "qml/Workshop" +import "qml/Community" ApplicationWindow { id: window color: { - if(Material.theme === Material.Dark){ + if (Material.theme === Material.Dark) { return Qt.darker(Material.background) } else { - return Material.background + return Material.background } } - // Set visible if the -silent parameter was not set (see app.cpp end of constructor). visible: false width: 1400 @@ -34,18 +34,17 @@ ApplicationWindow { title: "ScreenPlay Alpha - V0.10.1" minimumHeight: 450 minimumWidth: 1050 - onVisibilityChanged: { - if(window.visibility === 2){ + onVisibilityChanged: { + if (window.visibility === 2) { switchPage("Installed") } } - - Material.accent: { + Material.accent: { return Material.color(Material.Orange) } - function setTheme(theme){ + function setTheme(theme) { switch (theme) { case Settings.System: window.Material.theme = Material.System @@ -112,7 +111,6 @@ ApplicationWindow { anchors.fill: parent } - Connections { target: ScreenPlay.util function onRequestNavigation(nav) { @@ -331,4 +329,5 @@ ApplicationWindow { anchors.fill: pageLoader z: 98 } + } diff --git a/ScreenPlay/qml/Community/XMLNewsfeed.qml b/ScreenPlay/qml/Community/XMLNewsfeed.qml index 31674a22..a1422549 100644 --- a/ScreenPlay/qml/Community/XMLNewsfeed.qml +++ b/ScreenPlay/qml/Community/XMLNewsfeed.qml @@ -3,7 +3,8 @@ import QtQuick.Controls 2.3 import QtQuick.Controls.Material 2.2 import QtGraphicalEffects 1.0 import QtQuick.Layouts 1.3 -import QtQuick.XmlListModel 2.0 +import QtQuick.XmlListModel 2.15 +import ScreenPlay 1.0 GridView { id: changelogFlickableWrapper @@ -12,40 +13,32 @@ GridView { flickDeceleration: 5000 cellHeight: 205 cellWidth: 360 + clip: true model: feedModel + onCountChanged: print("count ",count) - Timer { - interval: 200 - running: true - repeat: false - onTriggered: { - feedModel.source = "https://screen-play.app/index.php?option=com_content&view=category&layout=blog&id=10&format=feed&type=rss" - } - } XmlListModel { id: feedModel - - query: "/rss/channel/item" + namespaceDeclarations: "declare default element namespace 'http://www.w3.org/2005/Atom';" + onProgressChanged: print("progress ",progress) + source: "https://gitlab.com/kelteseth/ScreenPlay/-/tags?&format=atom" + query: "/entry" XmlRole { name: "title" query: "title/string()" } XmlRole { - name: "backgroundImage" - query: "description/string()" + name: "content" + query: "content/string()" } XmlRole { name: "link" query: "link/string()" } XmlRole { - name: "pubDate" - query: "pubDate/string()" - } - XmlRole { - name: "category" - query: "category/string()" + name: "updated" + query: "updated/string()" } } @@ -98,35 +91,6 @@ GridView { anchors.margins: 5 radius: 4 - Image { - fillMode: Image.PreserveAspectCrop - anchors.fill: parent - source: { - var a = backgroundImage - var r = new RegExp(/]+src="([^">]+)"/) - var url = r.exec(a) - return url[1].toString() - } - } - - LinearGradient { - visible: true - opacity: .5 - anchors.fill: parent - start: Qt.point(0, parent.height) - end: Qt.point(0, parent.height - 150) - gradient: Gradient { - GradientStop { - position: 0.0 - color: "#BB000000" - } - GradientStop { - position: 1.0 - color: "#00000000" - } - } - } - Text { id: txtTitle text: title @@ -137,7 +101,7 @@ GridView { left: parent.left margins: 20 } - color: "white" + color: "#333333" font.family: ScreenPlay.settings.font font.weight: Font.Normal font.pointSize: 18 @@ -145,9 +109,7 @@ GridView { } Text { id: txtPubDate - text: { - return pubDate.replace("+0000", "") - } + text: updated anchors { right: parent.right rightMargin: 20 diff --git a/ScreenPlay/qml/Create/CreateContentButton.qml b/ScreenPlay/qml/Create/CreateContentButton.qml index b4a82d71..f36bc4b1 100644 --- a/ScreenPlay/qml/Create/CreateContentButton.qml +++ b/ScreenPlay/qml/Create/CreateContentButton.qml @@ -76,7 +76,7 @@ Item { font.family: ScreenPlay.settings.font opacity: buttonActive ? 1 : .25 font.pointSize: 14 - color: Material.theme === Material.Light ? Qt.lighter(Material.foreground) : Qt.darker(Material.foreground) + color: Material.foreground wrapMode: Text.WrapAnywhere maximumLineCount: 1 diff --git a/ScreenPlay/qml/Create/Wizards/CreateEmptyWidget/CreateEmptyWidget.qml b/ScreenPlay/qml/Create/Wizards/CreateEmptyWidget/CreateEmptyWidget.qml index 43cfd026..4e8abcb2 100644 --- a/ScreenPlay/qml/Create/Wizards/CreateEmptyWidget/CreateEmptyWidget.qml +++ b/ScreenPlay/qml/Create/Wizards/CreateEmptyWidget/CreateEmptyWidget.qml @@ -4,7 +4,7 @@ import QtQuick.Controls 2.14 import QtQuick.Layouts 1.14 import QtQuick.Dialogs 1.2 import ScreenPlay 1.0 -import ScreenPlay.Settings 1.0 + import "../../../Common" diff --git a/ScreenPlay/qml/Installed/Sidebar.qml b/ScreenPlay/qml/Installed/Sidebar.qml index d4c11f77..46e1dc2a 100644 --- a/ScreenPlay/qml/Installed/Sidebar.qml +++ b/ScreenPlay/qml/Installed/Sidebar.qml @@ -6,8 +6,7 @@ import QtQuick.Layouts 1.12 import QtQuick.Controls.Material 2.12 import ScreenPlay 1.0 -import ScreenPlay.GlobalVariables 1.0 -import ScreenPlay.Settings 1.0 +import ScreenPlayEnums 1.0 import "../Monitors" import "../Common" as SP @@ -20,13 +19,13 @@ Item { property real navHeight property string type - property var typeEnum: GlobalVariables.QMLWallpaper + property var typeEnum: ScreenPlayEnums.QMLWallpaper property string activeScreen function isWallpaper() { - if (typeEnum === GlobalVariables.VideoWallpaper - || typeEnum === GlobalVariables.HTMLWallpaper - || typeEnum === GlobalVariables.QMLWallpaper) { + if (typeEnum === ScreenPlayEnums.VideoWallpaper + || typeEnum === ScreenPlayEnums.HTMLWallpaper + || typeEnum === ScreenPlayEnums.QMLWallpaper) { return true } else { return false @@ -35,8 +34,8 @@ Item { function isWidget() { - if (typeEnum === GlobalVariables.HTMLWidget - || typeEnum === GlobalVariables.QMLWidget) { + if (typeEnum === ScreenPlayEnums.HTMLWidget + || typeEnum === ScreenPlayEnums.QMLWidget) { return true } else { return false @@ -69,27 +68,27 @@ Item { switch (type) { case "videoWallpaper": - root.typeEnum = GlobalVariables.VideoWallpaper + root.typeEnum = ScreenPlayEnums.VideoWallpaper state = "videoWallpaper" return case "htmlWallpaper": state = "activeScene" - root.typeEnum = GlobalVariables.HTMLWallpaper + root.typeEnum = ScreenPlayEnums.HTMLWallpaper return case "qmlWallpaper": state = "activeScene" - root.typeEnum = GlobalVariables.QMLWallpaper + root.typeEnum = ScreenPlayEnums.QMLWallpaper return case "godotWallpaper": state = "activeScene" return case "qmlWidget": state = "activeWidget" - root.typeEnum = GlobalVariables.QMLWidget + root.typeEnum = ScreenPlayEnums.QMLWidget return case "htmlWidget": state = "activeWidget" - root.typeEnum = GlobalVariables.HTMLWidget + root.typeEnum = ScreenPlayEnums.HTMLWidget return case "standaloneWidget": state = "activeWidget" @@ -324,19 +323,19 @@ Item { model: [{ - "value": GlobalVariables.Stretch, + "value": ScreenPlayEnums.Stretch, "text": qsTr("Stretch") }, { - "value": GlobalVariables.Fill, + "value": ScreenPlayEnums.Fill, "text": qsTr("Fill") }, { - "value": GlobalVariables.Contain, + "value": ScreenPlayEnums.Contain, "text": qsTr("Contain") }, { - "value": GlobalVariables.Cover, + "value": ScreenPlayEnums.Cover, "text": qsTr("Cover") }, { - "value": GlobalVariables.Scale_Down, + "value": ScreenPlayEnums.Scale_Down, "text": qsTr("Scale-Down") }] } @@ -380,6 +379,14 @@ Item { if (activeMonitors.length === 0) return + print(root.typeEnum, + cbVideoFillMode.currentValue, + ScreenPlay.globalVariables.localStoragePath + "/" + activeScreen, + ScreenPlay.installedListModel.get( activeScreen).screenPreview, + activeMonitors, + (Math.round( sliderVolume.value * 100) / 100), + true) + ScreenPlay.screenPlayManager.createWallpaper( root.typeEnum, cbVideoFillMode.currentValue, diff --git a/ScreenPlay/qml/Monitors/DefaultVideoControls.qml b/ScreenPlay/qml/Monitors/DefaultVideoControls.qml index c896b4cb..082b81f9 100644 --- a/ScreenPlay/qml/Monitors/DefaultVideoControls.qml +++ b/ScreenPlay/qml/Monitors/DefaultVideoControls.qml @@ -5,8 +5,8 @@ import QtQuick.Controls.Material 2.2 import QtQuick.Layouts 1.3 import ScreenPlay 1.0 -import ScreenPlay.Settings 1.0 -import ScreenPlay.GlobalVariables 1.0 +import ScreenPlayEnums 1.0 + import "../Common/" as SP @@ -86,19 +86,19 @@ ColumnLayout { model: [{ - "value": Settings.Stretch, + "value": ScreenPlayEnums.Stretch, "text": qsTr("Stretch") }, { - "value": Settings.Fill, + "value": ScreenPlayEnums.Fill, "text": qsTr("Fill") }, { - "value": Settings.Contain, + "value": ScreenPlayEnums.Contain, "text": qsTr("Contain") }, { - "value": Settings.Cover, + "value": ScreenPlayEnums.Cover, "text": qsTr("Cover") }, { - "value": Settings.Scale_Down, + "value": ScreenPlayEnums.Scale_Down, "text": qsTr("Scale-Down") }] } diff --git a/ScreenPlay/qml/Monitors/MonitorsProjectSettingItem.qml b/ScreenPlay/qml/Monitors/MonitorsProjectSettingItem.qml index 632f3bed..37f5d713 100644 --- a/ScreenPlay/qml/Monitors/MonitorsProjectSettingItem.qml +++ b/ScreenPlay/qml/Monitors/MonitorsProjectSettingItem.qml @@ -5,7 +5,7 @@ import QtQuick.Dialogs 1.2 import QtQuick.Controls.Material 2.2 import QtQuick.Layouts 1.3 -import ScreenPlay.Settings 1.0 + import ScreenPlay 1.0 Rectangle { diff --git a/ScreenPlay/qml/Settings/Settings.qml b/ScreenPlay/qml/Settings/Settings.qml index 6d9e60a9..8363c39e 100644 --- a/ScreenPlay/qml/Settings/Settings.qml +++ b/ScreenPlay/qml/Settings/Settings.qml @@ -7,8 +7,8 @@ import QtGraphicalEffects 1.0 import Qt.labs.platform 1.0 import ScreenPlay 1.0 -import ScreenPlay.Settings 1.0 -import ScreenPlay.GlobalVariables 1.0 +import ScreenPlayEnums 1.0 + import "../Common" @@ -322,19 +322,19 @@ Item { cbVideoFillMode.comboBox.currentValue) model: [{ - "value": GlobalVariables.Stretch, + "value": ScreenPlayEnums.Stretch, "text": qsTr("Stretch") }, { - "value": GlobalVariables.Fill, + "value": ScreenPlayEnums.Fill, "text": qsTr("Fill") }, { - "value": GlobalVariables.Contain, + "value": ScreenPlayEnums.Contain, "text": qsTr("Contain") }, { - "value": GlobalVariables.Cover, + "value": ScreenPlayEnums.Cover, "text": qsTr("Cover") }, { - "value": GlobalVariables.Scale_Down, + "value": ScreenPlayEnums.Scale_Down, "text": qsTr("Scale-Down") }] } diff --git a/ScreenPlay/src/globalvariables.h b/ScreenPlay/src/globalvariables.h index 371167f8..975588af 100644 --- a/ScreenPlay/src/globalvariables.h +++ b/ScreenPlay/src/globalvariables.h @@ -16,6 +16,34 @@ namespace ScreenPlay { */ +namespace Enums { + Q_NAMESPACE + + enum class FillMode { + Stretch, + Fill, + Contain, + Cover, + Scale_Down + }; + Q_ENUM_NS(FillMode) + + + enum class WallpaperType { + VideoWallpaper, + QMLWallpaper, + HTMLWallpaper + }; + Q_ENUM_NS(WallpaperType) + + enum class WidgetType { + QMLWidget, + HTMLWidget + }; + Q_ENUM_NS(WidgetType) + +} + class GlobalVariables : public QObject { Q_OBJECT @@ -28,28 +56,8 @@ class GlobalVariables : public QObject { public: explicit GlobalVariables(QObject* parent = nullptr); - enum class FillMode { - Stretch, - Fill, - Contain, - Cover, - Scale_Down - }; - Q_ENUM(FillMode) - enum class WallpaperType { - VideoWallpaper, - QMLWallpaper, - HTMLWallpaper - }; - Q_ENUM(WallpaperType) - - enum class WidgetType { - QMLWidget, - HTMLWidget - }; - Q_ENUM(WidgetType) /*! \property GlobalVariables::localStoragePath diff --git a/ScreenPlay/src/screenplaymanager.cpp b/ScreenPlay/src/screenplaymanager.cpp index e47c60e2..87ef38fc 100644 --- a/ScreenPlay/src/screenplaymanager.cpp +++ b/ScreenPlay/src/screenplaymanager.cpp @@ -38,12 +38,12 @@ ScreenPlayManager::ScreenPlayManager( if we call the method when using via the settings on startup to skip a unnecessary save. */ void ScreenPlayManager::createWallpaper( - const GlobalVariables::WallpaperType type, + const Enums::WallpaperType type, + const Enums::FillMode fillMode, const QString& absoluteStoragePath, const QString& previewImage, QVector monitorIndex, const float volume, - const GlobalVariables::FillMode fillMode, const bool saveToProfilesConfigFile) { if (m_telemetry) { @@ -88,13 +88,13 @@ void ScreenPlayManager::createWallpaper( // Do not save on app start if (saveToProfilesConfigFile) { - if (type == GlobalVariables::WallpaperType::VideoWallpaper) { + if (type == Enums::WallpaperType::VideoWallpaper) { QJsonObject settings = wallpaper->getActiveSettingsJson(); saveWallpaperProfile("default", settings); return; } - if (type == GlobalVariables::WallpaperType::QMLWallpaper) { + if (type == Enums::WallpaperType::QMLWallpaper) { QJsonObject settings; settings.insert("monitors", monitors); settings.insert("type", QVariant::fromValue(type).toString()); @@ -114,7 +114,7 @@ void ScreenPlayManager::createWallpaper( \brief Creates a ScreenPlayWidget object via a \a absoluteStoragePath and a \a preview image (relative path). */ void ScreenPlayManager::createWidget( - const GlobalVariables::WidgetType type, + const Enums::WidgetType type, const QUrl& absoluteStoragePath, const QString& previewImage) { @@ -362,10 +362,10 @@ void ScreenPlayManager::loadWallpaperProfiles() QString previewImage = wallpaperObj.value("previewImage").toString(); QString file = wallpaperObj.value("file").toString(); QString typeString = wallpaperObj.value("type").toString(); - auto type = QStringToEnum(typeString, GlobalVariables::WallpaperType::VideoWallpaper); - auto fillMode = QStringToEnum(fillModeString, GlobalVariables::FillMode::Cover); + auto type = QStringToEnum(typeString, Enums::WallpaperType::VideoWallpaper); + auto fillMode = QStringToEnum(fillModeString, Enums::FillMode::Cover); - createWallpaper(type, absolutePath, previewImage, monitors, volume, fillMode, false); + createWallpaper(type, fillMode, absolutePath, previewImage, monitors, volume, false); monitors.clear(); } } diff --git a/ScreenPlay/src/screenplaymanager.h b/ScreenPlay/src/screenplaymanager.h index 60ab7729..b446fb28 100644 --- a/ScreenPlay/src/screenplaymanager.h +++ b/ScreenPlay/src/screenplaymanager.h @@ -56,17 +56,18 @@ signals: void activeWidgetsCounterChanged(int activeWidgetsCounter); public slots: + // moc needs full enum namespace info see QTBUG-58454 void createWallpaper( - const GlobalVariables::WallpaperType type, + const ScreenPlay::Enums::WallpaperType type, + const ScreenPlay::Enums::FillMode fillMode, const QString& absoluteStoragePath, const QString& previewImage, QVector monitorIndex, const float volume, - const GlobalVariables::FillMode fillMode, - const bool saveToProfilesConfigFile = true); + const bool saveToProfilesConfigFile); void createWidget( - const GlobalVariables::WidgetType type, + const ScreenPlay::Enums::WidgetType type, const QUrl& absoluteStoragePath, const QString& previewImage); diff --git a/ScreenPlay/src/screenplaywallpaper.cpp b/ScreenPlay/src/screenplaywallpaper.cpp index a68e8c6d..ba29f924 100644 --- a/ScreenPlay/src/screenplaywallpaper.cpp +++ b/ScreenPlay/src/screenplaywallpaper.cpp @@ -19,8 +19,8 @@ ScreenPlayWallpaper::ScreenPlayWallpaper(const QVector& screenNumber, const QString& absolutePath, const QString& previewImage, const float volume, - const GlobalVariables::FillMode fillMode, - const GlobalVariables::WallpaperType type, + const Enums::FillMode fillMode, + const Enums::WallpaperType type, const bool checkWallpaperVisible, QObject* parent) : QObject(parent) diff --git a/ScreenPlay/src/screenplaywallpaper.h b/ScreenPlay/src/screenplaywallpaper.h index ae9e6697..60246936 100644 --- a/ScreenPlay/src/screenplaywallpaper.h +++ b/ScreenPlay/src/screenplaywallpaper.h @@ -25,7 +25,7 @@ class ScreenPlayWallpaper : public QObject { Q_PROPERTY(QString absolutePath READ absolutePath WRITE setAbsolutePath NOTIFY absolutePathChanged) Q_PROPERTY(QString previewImage READ previewImage WRITE setPreviewImage NOTIFY previewImageChanged) Q_PROPERTY(QString appID READ appID WRITE setAppID NOTIFY appIDChanged) - Q_PROPERTY(GlobalVariables::WallpaperType type READ type WRITE setType NOTIFY typeChanged) + Q_PROPERTY(Enums::WallpaperType type READ type WRITE setType NOTIFY typeChanged) public: explicit ScreenPlayWallpaper(const QVector& screenNumber, @@ -34,8 +34,8 @@ public: const QString& absolutePath, const QString& previewImage, const float volume, - const GlobalVariables::FillMode fillMode, - const GlobalVariables::WallpaperType type, + const Enums::FillMode fillMode, + const Enums::WallpaperType type, const bool checkWallpaperVisible, QObject* parent = nullptr); @@ -45,7 +45,7 @@ public: const QString& appID, const QString& absolutePath, const QString& previewImage, - const GlobalVariables::WallpaperType type, + const Enums::WallpaperType type, const QJsonObject& profileJsonObject, QObject* parent = nullptr); @@ -71,7 +71,7 @@ public: return m_appID; } - GlobalVariables::WallpaperType type() const + Enums::WallpaperType type() const { return m_type; } @@ -105,7 +105,7 @@ signals: void screenNumberChanged(QVector screenNumber); void previewImageChanged(QString previewImage); void appIDChanged(QString appID); - void typeChanged(GlobalVariables::WallpaperType type); + void typeChanged(Enums::WallpaperType type); void fileChanged(QString file); void fillModeChanged(QString fillMode); void absolutePathChanged(QString absolutePath); @@ -144,7 +144,7 @@ public slots: emit appIDChanged(m_appID); } - void setType(GlobalVariables::WallpaperType type) + void setType(Enums::WallpaperType type) { if (m_type == type) return; @@ -210,7 +210,7 @@ private: QVector m_screenNumber; QString m_previewImage; - GlobalVariables::WallpaperType m_type; + Enums::WallpaperType m_type; QString m_appID; QString m_file; QString m_fillMode; diff --git a/ScreenPlay/src/screenplaywidget.cpp b/ScreenPlay/src/screenplaywidget.cpp index 42867fba..0fd75222 100644 --- a/ScreenPlay/src/screenplaywidget.cpp +++ b/ScreenPlay/src/screenplaywidget.cpp @@ -18,7 +18,7 @@ ScreenPlayWidget::ScreenPlayWidget(const QString& appID, const QString& projectPath, const QString& previewImage, const QString& fullPath, - const GlobalVariables::WidgetType type) + const Enums::WidgetType type) : QObject { nullptr } , m_globalVariables { globalVariables } , m_projectPath { projectPath } diff --git a/ScreenPlay/src/screenplaywidget.h b/ScreenPlay/src/screenplaywidget.h index a811136b..2f5742e7 100644 --- a/ScreenPlay/src/screenplaywidget.h +++ b/ScreenPlay/src/screenplaywidget.h @@ -19,7 +19,7 @@ class ScreenPlayWidget : public QObject { Q_PROPERTY(QString previewImage READ previewImage WRITE setPreviewImage NOTIFY previewImageChanged) Q_PROPERTY(QPoint position READ position WRITE setPosition NOTIFY positionChanged) Q_PROPERTY(QString appID READ appID WRITE setAppID NOTIFY appIDChanged) - Q_PROPERTY(GlobalVariables::WidgetType type READ type WRITE setType NOTIFY typeChanged) + Q_PROPERTY(Enums::WidgetType type READ type WRITE setType NOTIFY typeChanged) public: explicit ScreenPlayWidget( @@ -28,7 +28,7 @@ public: const QString& projectPath, const QString& previewImage, const QString& fullPath, - const GlobalVariables::WidgetType type); + const Enums::WidgetType type); ~ScreenPlayWidget() { } @@ -52,7 +52,7 @@ public: return m_appID; } - GlobalVariables::WidgetType type() const + Enums::WidgetType type() const { return m_type; } @@ -94,7 +94,7 @@ public slots: emit appIDChanged(m_appID); } - void setType(GlobalVariables::WidgetType type) + void setType(Enums::WidgetType type) { if (m_type == type) return; @@ -108,7 +108,7 @@ signals: void previewImageChanged(QString previewImage); void positionChanged(QPoint position); void appIDChanged(QString appID); - void typeChanged(GlobalVariables::WidgetType type); + void typeChanged(Enums::WidgetType type); private: QProcess m_process; @@ -118,6 +118,6 @@ private: QString m_previewImage; QString m_appID; QPoint m_position; - GlobalVariables::WidgetType m_type; + Enums::WidgetType m_type; }; } diff --git a/ScreenPlay/src/settings.cpp b/ScreenPlay/src/settings.cpp index 4e27c0a5..b763141b 100644 --- a/ScreenPlay/src/settings.cpp +++ b/ScreenPlay/src/settings.cpp @@ -64,9 +64,9 @@ Settings::Settings(const std::shared_ptr& globalVariables, setHighPriorityStart(m_qSettings.value("ScreenPlayExecutable", false).toBool()); if (m_qSettings.contains("VideoFillMode")) { auto value = m_qSettings.value("VideoFillMode").toString(); - setVideoFillMode(QStringToEnum(value, GlobalVariables::FillMode::Cover)); + setVideoFillMode(QStringToEnum(value, Enums::FillMode::Cover)); } else { - setVideoFillMode(GlobalVariables::FillMode::Cover); + setVideoFillMode(Enums::FillMode::Cover); } if (m_qSettings.contains("Theme")) { diff --git a/ScreenPlay/src/settings.h b/ScreenPlay/src/settings.h index cdd56c96..3af3dde4 100644 --- a/ScreenPlay/src/settings.h +++ b/ScreenPlay/src/settings.h @@ -1,10 +1,10 @@ #pragma once +#include #include #include #include #include -#include #include #include #include @@ -49,7 +49,7 @@ class Settings : public QObject { Q_PROPERTY(bool checkWallpaperVisible READ checkWallpaperVisible WRITE setCheckWallpaperVisible NOTIFY checkWallpaperVisibleChanged) Q_PROPERTY(bool offlineMode READ offlineMode WRITE setOfflineMode NOTIFY offlineModeChanged) - Q_PROPERTY(GlobalVariables::FillMode videoFillMode READ videoFillMode WRITE setVideoFillMode NOTIFY videoFillModeChanged) + Q_PROPERTY(ScreenPlay::Enums::FillMode videoFillMode READ videoFillMode WRITE setVideoFillMode NOTIFY videoFillModeChanged) Q_PROPERTY(Language language READ language WRITE setLanguage NOTIFY languageChanged) Q_PROPERTY(Theme theme READ theme WRITE setTheme NOTIFY themeChanged) @@ -125,7 +125,7 @@ public: return m_checkWallpaperVisible; } - GlobalVariables::FillMode videoFillMode() const + ScreenPlay::Enums::FillMode videoFillMode() const { return m_videoFillMode; } @@ -162,7 +162,7 @@ signals: void silentStartChanged(bool silentStart); void anonymousTelemetryChanged(bool anonymousTelemetry); void checkWallpaperVisibleChanged(bool checkWallpaperVisible); - void videoFillModeChanged(GlobalVariables::FillMode videoFillMode); + void videoFillModeChanged(ScreenPlay::Enums::FillMode videoFillMode); void languageChanged(Language language); void fontChanged(QString font); @@ -191,7 +191,6 @@ public slots: settings.sync(); } else { settings.remove("ScreenPlay"); - } #endif @@ -282,7 +281,7 @@ public slots: emit checkWallpaperVisibleChanged(m_checkWallpaperVisible); } - void setVideoFillMode(GlobalVariables::FillMode videoFillMode) + void setVideoFillMode(ScreenPlay::Enums::FillMode videoFillMode) { if (m_videoFillMode == videoFillMode) return; @@ -318,7 +317,7 @@ public slots: if (m_theme == theme) return; - setqSetting("Theme", QVariant::fromValue(theme).toString()); + setqSetting("Theme", QVariant::fromValue(theme).toString()); m_theme = theme; emit themeChanged(m_theme); @@ -342,9 +341,9 @@ private: QString m_gitBuildHash; QString m_decoder; - FillMode m_videoFillMode { FillMode::Cover }; + ScreenPlay::Enums::FillMode m_videoFillMode { ScreenPlay::Enums::FillMode::Cover }; Language m_language { Language::En }; Theme m_theme { Theme::System }; - QString m_font {"Roboto"}; + QString m_font { "Roboto" }; }; }