diff --git a/ScreenPlay/CMakeLists.txt b/ScreenPlay/CMakeLists.txt index 8511d3a0..a28222d0 100644 --- a/ScreenPlay/CMakeLists.txt +++ b/ScreenPlay/CMakeLists.txt @@ -11,6 +11,7 @@ include(GenerateCMakeVariableHeader) set(SOURCES # cmake-format: sort + src/applicationengine.cpp src/app.cpp src/create.cpp src/createimportvideo.cpp @@ -31,6 +32,7 @@ set(HEADER # cmake-format: sort inc/public/ScreenPlay/app.h + inc/public/ScreenPlay/applicationengine.h inc/public/ScreenPlay/create.h inc/public/ScreenPlay/createimportstates.h inc/public/ScreenPlay/createimportvideo.h @@ -96,6 +98,7 @@ set(QML qml/Settings/SettingsPage.qml qml/Settings/SettingsView.qml qml/TrayIcon.qml + qml/Base.qml qml/Workshop/WorkshopView.qml) set(TS_FILES @@ -351,6 +354,9 @@ if(WIN32 file(MAKE_DIRECTORY ${FONTS_OUT_DIR}) copy_recursive(${CMAKE_CURRENT_SOURCE_DIR}/assets/fonts ${FONTS_OUT_DIR} "*.ttf") copy_recursive(${CMAKE_CURRENT_SOURCE_DIR}/assets/fonts ${FONTS_OUT_DIR} "*.otf") + set(RESOURCES_DIR "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/assets") + file(MAKE_DIRECTORY ${RESOURCES_DIR}) + endif() if(WIN32) @@ -412,14 +418,14 @@ if(APPLE) add_custom_command( TARGET ${PROJECT_NAME} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/../ThirdParty/ffmpeg/ffmpeg - ${CMAKE_BINARY_DIR}/bin/ScreenPlay.app/Contents/MacOS/) + COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/../ThirdParty/ffmpeg/ffmpeg" + "${CMAKE_BINARY_DIR}/bin/ScreenPlay.app/Contents/MacOS/") add_custom_command( TARGET ${PROJECT_NAME} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/../ThirdParty/ffmpeg/ffprobe - ${CMAKE_BINARY_DIR}/bin/ScreenPlay.app/Contents/MacOS/) + COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/../ThirdParty/ffmpeg/ffprobe" + "${CMAKE_BINARY_DIR}/bin/ScreenPlay.app/Contents/MacOS/") # fonts include(CopyRecursive) @@ -428,12 +434,13 @@ if(APPLE) copy_recursive(${CMAKE_CURRENT_SOURCE_DIR}/assets/fonts ${FONTS_OUT_DIR} "*.ttf") copy_recursive(${CMAKE_CURRENT_SOURCE_DIR}/assets/fonts ${FONTS_OUT_DIR} "*.otf") - # .qm translations - set(QM_OUT_DIR "${RESOURCES_DIR}/translations") - file(MAKE_DIRECTORY ${QM_OUT_DIR}) - set_source_files_properties(${TS_FILES} PROPERTIES OUTPUT_LOCATION ${QM_OUT_DIR}) endif() +# .qm translations +set(QM_OUT_DIR "${RESOURCES_DIR}/translations") +file(MAKE_DIRECTORY ${QM_OUT_DIR}) +set_source_files_properties(${TS_FILES} PROPERTIES OUTPUT_LOCATION ${QM_OUT_DIR}) + # Must be called here, because we need to change the OUTPUT_LOCATION for macos qt_add_lrelease(${PROJECT_NAME} TS_FILES ${TS_FILES}) diff --git a/ScreenPlay/inc/public/ScreenPlay/app.h b/ScreenPlay/inc/public/ScreenPlay/app.h index fe90e73b..6cc56a1c 100644 --- a/ScreenPlay/inc/public/ScreenPlay/app.h +++ b/ScreenPlay/inc/public/ScreenPlay/app.h @@ -1,21 +1,7 @@ // SPDX-License-Identifier: LicenseRef-EliasSteurerTachiom OR AGPL-3.0-only #pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include #include "ScreenPlay/create.h" #include "ScreenPlay/globalvariables.h" @@ -27,6 +13,7 @@ #include "ScreenPlay/settings.h" #include "ScreenPlay/wizards.h" #include "ScreenPlayUtil/util.h" +#include #include @@ -38,25 +25,26 @@ namespace ScreenPlay { class App : public QObject { Q_OBJECT + QML_ELEMENT + QML_SINGLETON - Q_PROPERTY(QQmlApplicationEngine* mainWindowEngine READ mainWindowEngine WRITE setMainWindowEngine NOTIFY mainWindowEngineChanged) - Q_PROPERTY(GlobalVariables* globalVariables READ globalVariables WRITE setGlobalVariables NOTIFY globalVariablesChanged) - Q_PROPERTY(ScreenPlayManager* screenPlayManager READ screenPlayManager WRITE setScreenPlayManager NOTIFY screenPlayManagerChanged) - Q_PROPERTY(Create* create READ create WRITE setCreate NOTIFY createChanged) - Q_PROPERTY(Wizards* wizards READ wizards WRITE setWizards NOTIFY wizardsChanged) - Q_PROPERTY(Util* util READ util WRITE setUtil NOTIFY utilChanged) - Q_PROPERTY(Settings* settings READ settings WRITE setSettings NOTIFY settingsChanged) - - Q_PROPERTY(InstalledListModel* installedListModel READ installedListModel WRITE setInstalledListModel NOTIFY installedListModelChanged) - Q_PROPERTY(InstalledListFilter* installedListFilter READ installedListFilter WRITE setInstalledListFilter NOTIFY installedListFilterChanged) - Q_PROPERTY(MonitorListModel* monitorListModel READ monitorListModel WRITE setMonitorListModel NOTIFY monitorListModelChanged) - Q_PROPERTY(ProfileListModel* profileListModel READ profileListModel WRITE setProfileListModel NOTIFY profileListModelChanged) + Q_PROPERTY(GlobalVariables* globalVariables READ globalVariables WRITE setGlobalVariables NOTIFY globalVariablesChanged FINAL) + Q_PROPERTY(ScreenPlayManager* screenPlayManager READ screenPlayManager WRITE setScreenPlayManager NOTIFY screenPlayManagerChanged FINAL) + Q_PROPERTY(Create* create READ create WRITE setCreate NOTIFY createChanged FINAL) + Q_PROPERTY(Wizards* wizards READ wizards WRITE setWizards NOTIFY wizardsChanged FINAL) + Q_PROPERTY(Util* util READ util WRITE setUtil NOTIFY utilChanged FINAL) + Q_PROPERTY(Settings* settings READ settings WRITE setSettings NOTIFY settingsChanged FINAL) + Q_PROPERTY(InstalledListModel* installedListModel READ installedListModel WRITE setInstalledListModel NOTIFY installedListModelChanged FINAL) + Q_PROPERTY(InstalledListFilter* installedListFilter READ installedListFilter WRITE setInstalledListFilter NOTIFY installedListFilterChanged FINAL) + Q_PROPERTY(MonitorListModel* monitorListModel READ monitorListModel WRITE setMonitorListModel NOTIFY monitorListModelChanged FINAL) + Q_PROPERTY(ProfileListModel* profileListModel READ profileListModel WRITE setProfileListModel NOTIFY profileListModelChanged FINAL) public: - explicit App(); - - void init(); - bool m_isAnotherScreenPlayInstanceRunning { false }; + // QML callable functions + Q_INVOKABLE void init(); + Q_INVOKABLE QString version() const; + Q_INVOKABLE void showDockIcon(const bool show); + Q_INVOKABLE void exit(); GlobalVariables* globalVariables() const { return m_globalVariables.get(); } ScreenPlayManager* screenPlayManager() const { return m_screenPlayManager.get(); } @@ -67,9 +55,11 @@ public: MonitorListModel* monitorListModel() const { return m_monitorListModel.get(); } ProfileListModel* profileListModel() const { return m_profileListModel.get(); } InstalledListFilter* installedListFilter() const { return m_installedListFilter.get(); } - QQmlApplicationEngine* mainWindowEngine() const { return m_mainWindowEngine.get(); } Wizards* wizards() const { return m_wizards.get(); } + QQmlEngine* engine() const; + void setEngine(QQmlEngine* engine); + signals: void globalVariablesChanged(ScreenPlay::GlobalVariables* globalVariables); void screenPlayManagerChanged(ScreenPlay::ScreenPlayManager* screenPlayManager); @@ -80,15 +70,11 @@ signals: void monitorListModelChanged(ScreenPlay::MonitorListModel* monitorListModel); void profileListModelChanged(ScreenPlay::ProfileListModel* profileListModel); void installedListFilterChanged(ScreenPlay::InstalledListFilter* installedListFilter); - void mainWindowEngineChanged(QQmlApplicationEngine* mainWindowEngine); void wizardsChanged(ScreenPlay::Wizards* wizards); + void requestExit(); + void requestRetranslation(); public slots: - QString version() const; - void showDockIcon(const bool show); - void exit(); - QPointF cursorPos() { return QCursor::pos(); } - void setGlobalVariables(GlobalVariables* globalVariables); void setScreenPlayManager(ScreenPlayManager* screenPlayManager); void setCreate(Create* create); @@ -98,20 +84,16 @@ public slots: void setMonitorListModel(MonitorListModel* monitorListModel); void setProfileListModel(ProfileListModel* profileListModel); void setInstalledListFilter(InstalledListFilter* installedListFilter); - void setMainWindowEngine(QQmlApplicationEngine* mainWindowEngine); void setWizards(Wizards* wizards); private: - QNetworkAccessManager m_networkAccessManager; - std::unique_ptr m_mainWindowEngine; - + QQmlEngine* m_engine = nullptr; std::unique_ptr m_create; std::unique_ptr m_wizards; std::unique_ptr m_screenPlayManager; std::unique_ptr m_util; std::shared_ptr m_globalVariables; - std::shared_ptr m_settings; std::shared_ptr m_installedListModel; std::shared_ptr m_monitorListModel; diff --git a/ScreenPlay/inc/public/ScreenPlay/applicationengine.h b/ScreenPlay/inc/public/ScreenPlay/applicationengine.h new file mode 100644 index 00000000..332efe71 --- /dev/null +++ b/ScreenPlay/inc/public/ScreenPlay/applicationengine.h @@ -0,0 +1,18 @@ +#pragma once + +#include +#include +#include +#include +#include + +namespace ScreenPlay { + +class ApplicationEngine : public QQmlApplicationEngine { + Q_OBJECT +public: + explicit ApplicationEngine(QObject* parent = nullptr); + bool isAnotherScreenPlayInstanceRunning(); + void init(); +}; +} diff --git a/ScreenPlay/inc/public/ScreenPlay/globalvariables.h b/ScreenPlay/inc/public/ScreenPlay/globalvariables.h index 9d317aa2..89087934 100644 --- a/ScreenPlay/inc/public/ScreenPlay/globalvariables.h +++ b/ScreenPlay/inc/public/ScreenPlay/globalvariables.h @@ -17,8 +17,9 @@ class GlobalVariables : public QObject { Q_OBJECT QML_ELEMENT QML_UNCREATABLE("") + Q_CLASSINFO("RegisterEnumClassesUnscoped", "false") - Q_PROPERTY(QVersionNumber version READ version CONSTANT) + Q_PROPERTY(Version version READ version WRITE setVersion NOTIFY versionChanged FINAL) Q_PROPERTY(QUrl localStoragePath READ localStoragePath WRITE setLocalStoragePath NOTIFY localStoragePathChanged FINAL) Q_PROPERTY(QUrl localSettingsPath READ localSettingsPath WRITE setLocalSettingsPath NOTIFY localSettingsPathChanged FINAL) Q_PROPERTY(QUrl wallpaperExecutablePath READ wallpaperExecutablePath WRITE setWallpaperExecutablePath NOTIFY wallpaperExecutablePathChanged FINAL) @@ -29,43 +30,24 @@ class GlobalVariables : public QObject { public: explicit GlobalVariables(QObject* parent = nullptr); - /*! - \property GlobalVariables::m_version - \brief Returns the current app version. Not yet used. - */ - QVersionNumber version() const { return m_version; } - /*! - \property GlobalVariables::localStoragePath - \brief Returns the localStoragePath. - */ + enum class Version { + OpenSource, + OpenSourceSteam, + OpenSourcePlus, + OpenSourcePlusSteam + }; + Q_ENUM(Version) + + Version version() const { return m_version; } QUrl localStoragePath() const { return m_localStoragePath; } - /*! - \property GlobalVariables::localSettingsPath - \brief Returns the localSettingsPath. - */ QUrl localSettingsPath() const { return m_localSettingsPath; } - /*! - \property GlobalVariables::wallpaperExecutablePath - \brief Returns the wallpaperExecutablePath. This only differes in development builds. - */ QUrl wallpaperExecutablePath() const { return m_wallpaperExecutablePath; } - /*! - \property GlobalVariables::widgetExecutablePath - \brief Returns the widgetExecutablePath. This only differes in development builds. - */ QUrl widgetExecutablePath() const { return m_widgetExecutablePath; } - /*! - \property GlobalVariables::m_version - \brief Returns the current app version. Not yet used. - */ QUrl godotWallpaperExecutablePath() const { return m_godotWallpaperExecutablePath; } - /*! - \property GlobalVariables::m_version - \brief Returns the current app version. Not yet used. - */ QUrl godotEditorExecutablePath() const { return m_godotEditorExecutablePath; } signals: + void versionChanged(Version version); void localStoragePathChanged(QUrl localStoragePath); void localSettingsPathChanged(QUrl localSettingsPath); void wallpaperExecutablePathChanged(QUrl wallpaperExecutablePath); @@ -74,6 +56,7 @@ signals: void godotEditorExecutablePathChanged(QUrl godotEditorExecutablePath); public slots: + void setVersion(Version version); void setLocalStoragePath(QUrl localStoragePath); void setLocalSettingsPath(QUrl localSettingsPath); void setWallpaperExecutablePath(QUrl wallpaperExecutablePath); @@ -93,8 +76,8 @@ private: QUrl m_localSettingsPath; QUrl m_wallpaperExecutablePath; QUrl m_widgetExecutablePath; - QVersionNumber m_version { 1, 0, 0 }; QUrl m_godotWallpaperExecutablePath; QUrl m_godotEditorExecutablePath; + Version m_version = Version::OpenSource; }; } diff --git a/ScreenPlay/inc/public/ScreenPlay/screenplaymanager.h b/ScreenPlay/inc/public/ScreenPlay/screenplaymanager.h index a16550a9..32a6bf05 100644 --- a/ScreenPlay/inc/public/ScreenPlay/screenplaymanager.h +++ b/ScreenPlay/inc/public/ScreenPlay/screenplaymanager.h @@ -39,7 +39,6 @@ public: int activeWallpaperCounter() const { return m_activeWallpaperCounter; } int activeWidgetsCounter() const { return m_activeWidgetsCounter; } - bool isAnotherScreenPlayInstanceRunning() { return m_isAnotherScreenPlayInstanceRunning; } signals: void activeWallpaperCounterChanged(int activeWallpaperCounter); @@ -77,8 +76,8 @@ public slots: const QJsonObject& properties, const bool saveToProfilesConfigFile); - bool removeAllWallpapers(); - bool removeAllWidgets(); + bool removeAllWallpapers(bool saveToProfile = false); + bool removeAllWidgets(bool saveToProfile = false); bool removeWallpaperAt(const int index); bool requestProjectSettingsAtMonitorIndex(const int index); @@ -159,7 +158,6 @@ private: int m_activeWallpaperCounter { 0 }; int m_activeWidgetsCounter { 0 }; - bool m_isAnotherScreenPlayInstanceRunning = false; QTimer m_saveLimiter; const quint16 m_webSocketPort = 16395; diff --git a/ScreenPlay/main.cpp b/ScreenPlay/main.cpp index 154d26be..b4851838 100644 --- a/ScreenPlay/main.cpp +++ b/ScreenPlay/main.cpp @@ -1,7 +1,7 @@ // SPDX-License-Identifier: LicenseRef-EliasSteurerTachiom OR AGPL-3.0-only #include "ScreenPlay/CMakeVariables.h" -#include "ScreenPlay/app.h" +#include "ScreenPlay/applicationengine.h" #include "ScreenPlayUtil/logginghandler.h" #include "qcorotask.h" #include "qml/qcoroqml.h" @@ -18,6 +18,7 @@ Q_IMPORT_QML_PLUGIN(ScreenPlayWorkshopPlugin) #endif +#include Q_IMPORT_QML_PLUGIN(ScreenPlayAppPlugin) Q_IMPORT_QML_PLUGIN(ScreenPlayUtilPlugin) Q_IMPORT_QML_PLUGIN(PlausiblePlugin) @@ -30,14 +31,14 @@ int main(int argc, char* argv[]) #endif QGuiApplication qtGuiApp(argc, argv); - ScreenPlay::App app; + ScreenPlay::ApplicationEngine appEngine; - if (app.m_isAnotherScreenPlayInstanceRunning) { + if (appEngine.isAnotherScreenPlayInstanceRunning()) { return 0; } auto logging = std::make_unique("ScreenPlay"); - app.init(); + appEngine.init(); const int status = qtGuiApp.exec(); #if defined(Q_OS_WIN) sentry_shutdown(); diff --git a/ScreenPlay/main.qml b/ScreenPlay/main.qml index ec3baedd..50981a2a 100644 --- a/ScreenPlay/main.qml +++ b/ScreenPlay/main.qml @@ -1,57 +1,16 @@ -import QtCore as QCore import QtQml import QtQuick import QtQuick.Window import QtQuick.Controls import QtQuick.Controls.Material -import QtQuick.Layouts -import ScreenPlayApp -import ScreenPlay -import ScreenPlayUtil as Util -import Qt5Compat.GraphicalEffects import Plausible 1.0 -import "qml/Monitors" as Monitors -import "qml/Installed" as Installed -import "qml/Navigation" as Navigation -import "qml/Community" as Community -import "qml" +import ScreenPlayApp 1.0 +import QtCore as QCore ApplicationWindow { id: root - - function setTheme(theme) { - switch (theme) { - case Settings.Theme.System: - root.Material.theme = Material.System; - break; - case Settings.Theme.Dark: - root.Material.theme = Material.Dark; - break; - case Settings.Theme.Light: - root.Material.theme = Material.Light; - break; - } - } - - function switchPage(name) { - if (nav.currentNavigationName === name) { - if (name === "Installed") - App.installedListModel.reset(); - } - if (name === "Installed") { - stackView.replace("qrc:/qml/ScreenPlayApp/qml/Installed/InstalledView.qml", { - "sidebar": sidebar - }); - return; - } - stackView.replace("qrc:/qml/ScreenPlayApp/qml/" + name + "/" + name + "View.qml", { - "modalSource": content - }); - nav.setNavigation(name); - sidebar.state = "inactive"; - } - - color: Material.theme === Material.Dark ? Qt.darker(Material.background) : Material.background + color: Material.theme === Material.Dark ? Qt.darker( + Material.background) : Material.background // Set visible if the -silent parameter was not set (see app.cpp end of constructor). visible: false width: 1400 @@ -59,6 +18,71 @@ ApplicationWindow { title: "ScreenPlay - v" + App.version() minimumHeight: 450 minimumWidth: 1050 + Component.onCompleted: { + // App is now a qml singleton to fix QtC autocompletion. + // This also now means we have to make sure to init it here + // and do _not_ access any other properties before we called init. + App.init() + + setTheme(App.settings.theme) + if (!App.settings.silentStart) { + App.showDockIcon(true) + root.show() + } + baseLoader.setSource("qrc:/qml/ScreenPlayApp/qml/Base.qml") + } + + Connections { + target: App + function onRequestExit(){ + Qt.exit(0) + } + } + + function setTheme(theme) { + switch (theme) { + case Settings.Theme.System: + root.Material.theme = Material.System + break + case Settings.Theme.Dark: + root.Material.theme = Material.Dark + break + case Settings.Theme.Light: + root.Material.theme = Material.Light + break + } + } + + // Partial workaround for + // https://bugreports.qt.io/browse/QTBUG-86047 + Material.accent: Material.color(Material.Orange) + onVisibilityChanged: { + if (root.visibility !== 2) + return + } + + QCore.Settings { + id: settings + } + + onClosing: close => { + close.accepted = false + if (App.screenPlayManager.activeWallpaperCounter === 0 + && App.screenPlayManager.activeWidgetsCounter === 0) { + App.exit() + } + const alwaysMinimize = settings.value("alwaysMinimize", null) + if (alwaysMinimize === null) { + console.error( + "Unable to retreive alwaysMinimize setting") + } + if (alwaysMinimize === "true") { + root.hide() + App.showDockIcon(false) + return + } + exitDialog.open() + } Plausible { id: plausible @@ -68,204 +92,9 @@ ApplicationWindow { enabled: false } - // Partial workaround for - // https://bugreports.qt.io/browse/QTBUG-86047 - Material.accent: Material.color(Material.Orange) - onVisibilityChanged: { - if (root.visibility !== 2) - return; - } - - onClosing: close => { - close.accepted = false; - if (App.screenPlayManager.activeWallpaperCounter === 0 && App.screenPlayManager.activeWidgetsCounter === 0) { - App.exit(); - } - const alwaysMinimize = settings.value("alwaysMinimize", null); - if (alwaysMinimize === null) { - console.error("Unable to retreive alwaysMinimize setting"); - } - if (alwaysMinimize === "true") { - root.hide(); - App.showDockIcon(false); - return; - } - exitDialog.open(); - } - - QCore.Settings { - id: settings - } - - Navigation.ExitPopup { - id: exitDialog - applicationWindow: root - modalSource: content - } - - Component.onCompleted: { - setTheme(App.settings.theme); - stackView.push("qrc:/qml/ScreenPlayApp/qml/Installed/InstalledView.qml", { - "sidebar": sidebar - }); - if (!App.settings.silentStart) { - App.showDockIcon(true); - root.show(); - } - App.installedListModel.reset(); - } - - Item { - id: noneContentItems - Util.SteamNotAvailable { - id: dialogSteam - modalSource: content - } - - Util.MonitorConfiguration { - modalSource: content - } - - Util.CriticalError { - window: root - modalSource: content - } - - Monitors.MonitorsView { - id: monitors - modalSource: content - } - TrayIcon { - window: root - } - } - - Connections { - function onThemeChanged(theme) { - setTheme(theme); - } - - target: App.settings - } - - Connections { - function onRequestNavigation(nav) { - switchPage(nav); - } - - target: App.util - } - - Connections { - function onRequestRaise() { - App.showDockIcon(true); - root.show(); - } - - function onActiveWidgetsCounterChanged() { - plausible.pageView("widget/count/" + App.screenPlayManager.activeWidgetsCounter); - } - - function onActiveWallpaperCounterChanged() { - plausible.pageView("wallpaper/count/" + App.screenPlayManager.activeWallpaperCounter); - } - - target: App.screenPlayManager - } - - Item { - id: content + Loader { + id: baseLoader + asynchronous: true anchors.fill: parent - - StackView { - id: stackView - objectName: "stackView" - property int duration: 300 - - anchors { - top: nav.bottom - right: parent.right - bottom: parent.bottom - left: parent.left - } - - replaceEnter: Transition { - OpacityAnimator { - from: 0 - to: 1 - duration: stackView.duration - easing.type: Easing.InOutQuart - } - - ScaleAnimator { - from: 0.8 - to: 1 - duration: stackView.duration - easing.type: Easing.InOutQuart - } - } - - replaceExit: Transition { - OpacityAnimator { - from: 1 - to: 0 - duration: stackView.duration - easing.type: Easing.InOutQuart - } - - ScaleAnimator { - from: 1 - to: 0.8 - duration: stackView.duration - easing.type: Easing.InOutQuart - } - } - } - - Connections { - function onSetSidebarActive(active) { - if (active) - sidebar.state = "active"; - else - sidebar.state = "inactive"; - } - - function onSetNavigationItem(pos) { - if (pos === 0) - nav.onPageChanged("Create"); - else - nav.onPageChanged("Workshop"); - } - - target: stackView.currentItem - ignoreUnknownSignals: true - } - - Installed.Sidebar { - id: sidebar - objectName: "installedSidebar" - navHeight: nav.height - - anchors { - top: parent.top - right: parent.right - bottom: parent.bottom - } - } - - Navigation.Navigation { - id: nav - modalSource: content - anchors { - top: parent.top - right: parent.right - left: parent.left - } - - onChangePage: function (name) { - monitors.close(); - switchPage(name); - } - } } } diff --git a/ScreenPlay/qml/Base.qml b/ScreenPlay/qml/Base.qml new file mode 100644 index 00000000..5e2de724 --- /dev/null +++ b/ScreenPlay/qml/Base.qml @@ -0,0 +1,202 @@ +import QtQuick +import QtQuick.Controls +import ScreenPlayUtil as Util +import ScreenPlayApp 1.0 + +import "Monitors" as Monitors +import "Installed" as Installed +import "Navigation" as Navigation +import "Community" as Community + +Item { + id: content + anchors.fill: parent + Component.onCompleted: { + stackView.push( + "qrc:/qml/ScreenPlayApp/qml/Installed/InstalledView.qml", { + "sidebar": sidebar + }) + startTimer.start() + } + Timer { + id: startTimer + interval: 10 + onTriggered: App.installedListModel.reset() + } + + + function switchPage(name) { + + if (nav.currentNavigationName === name) { + if (name === "Installed") + App.installedListModel.reset(); + } + if (name === "Installed") { + stackView.replace("qrc:/qml/ScreenPlayApp/qml/Installed/InstalledView.qml", { + "sidebar": sidebar + }); + return; + } + stackView.replace("qrc:/qml/ScreenPlayApp/qml/" + name + "/" + name + "View.qml", { + "modalSource": content + }); + nav.setNavigation(name); + sidebar.state = "inactive"; + } + + Navigation.ExitPopup { + id: exitDialog + applicationWindow: root + modalSource: content + } + + Item { + id: noneContentItems + Util.SteamNotAvailable { + id: dialogSteam + modalSource: content + } + + Util.MonitorConfiguration { + modalSource: content + } + + Util.CriticalError { + window: root + modalSource: content + } + + Monitors.MonitorsView { + id: monitors + modalSource: content + } + TrayIcon { + window: root + } + } + + Connections { + function onThemeChanged(theme) { + setTheme(theme); + } + + target: App.settings + } + + Connections { + function onRequestNavigation(nav) { + switchPage(nav); + } + + target: App.util + } + + Connections { + function onRequestRaise() { + App.showDockIcon(true); + root.show(); + } + + function onActiveWidgetsCounterChanged() { + plausible.pageView("widget/count/" + App.screenPlayManager.activeWidgetsCounter); + } + + function onActiveWallpaperCounterChanged() { + plausible.pageView("wallpaper/count/" + App.screenPlayManager.activeWallpaperCounter); + } + + target: App.screenPlayManager + } + + + StackView { + id: stackView + objectName: "stackView" + property int duration: 300 + + anchors { + top: nav.bottom + right: parent.right + bottom: parent.bottom + left: parent.left + } + + replaceEnter: Transition { + OpacityAnimator { + from: 0 + to: 1 + duration: stackView.duration + easing.type: Easing.InOutQuart + } + + ScaleAnimator { + from: 0.8 + to: 1 + duration: stackView.duration + easing.type: Easing.InOutQuart + } + } + + replaceExit: Transition { + OpacityAnimator { + from: 1 + to: 0 + duration: stackView.duration + easing.type: Easing.InOutQuart + } + + ScaleAnimator { + from: 1 + to: 0.8 + duration: stackView.duration + easing.type: Easing.InOutQuart + } + } + } + + Connections { + function onSetSidebarActive(active) { + if (active) + sidebar.state = "active"; + else + sidebar.state = "inactive"; + } + + function onSetNavigationItem(pos) { + if (pos === 0) + nav.onPageChanged("Create"); + else + nav.onPageChanged("Workshop"); + } + + target: stackView.currentItem + ignoreUnknownSignals: true + } + + Installed.Sidebar { + id: sidebar + objectName: "installedSidebar" + navHeight: nav.height + + anchors { + top: parent.top + right: parent.right + bottom: parent.bottom + } + } + + Navigation.Navigation { + id: nav + modalSource: content + anchors { + top: parent.top + right: parent.right + left: parent.left + } + + onChangePage: function (name) { + monitors.close(); + switchPage(name); + } + } +} diff --git a/ScreenPlay/qml/Community/CommunityNavItem.qml b/ScreenPlay/qml/Community/CommunityNavItem.qml index e0b61d76..ad68474c 100644 --- a/ScreenPlay/qml/Community/CommunityNavItem.qml +++ b/ScreenPlay/qml/Community/CommunityNavItem.qml @@ -2,7 +2,7 @@ import QtQuick import QtQuick.Controls import QtQuick.Controls.Material import ScreenPlayApp -import ScreenPlay + TabButton { id: control diff --git a/ScreenPlay/qml/Community/CommunityView.qml b/ScreenPlay/qml/Community/CommunityView.qml index b921f8ac..8d59dd07 100644 --- a/ScreenPlay/qml/Community/CommunityView.qml +++ b/ScreenPlay/qml/Community/CommunityView.qml @@ -4,7 +4,7 @@ import QtQuick.Controls.Material import Qt5Compat.GraphicalEffects import QtQuick.Layouts import ScreenPlayApp -import ScreenPlay + Item { id: root diff --git a/ScreenPlay/qml/Community/XMLNewsfeed.qml b/ScreenPlay/qml/Community/XMLNewsfeed.qml index f457af7f..ae62b8de 100644 --- a/ScreenPlay/qml/Community/XMLNewsfeed.qml +++ b/ScreenPlay/qml/Community/XMLNewsfeed.qml @@ -5,7 +5,7 @@ import Qt5Compat.GraphicalEffects import QtQuick.Layouts import QtQml.XmlListModel import ScreenPlayApp -import ScreenPlay + Item { id: root diff --git a/ScreenPlay/qml/Create/CreateSidebar.qml b/ScreenPlay/qml/Create/CreateSidebar.qml index d76ecb42..3417ab0a 100644 --- a/ScreenPlay/qml/Create/CreateSidebar.qml +++ b/ScreenPlay/qml/Create/CreateSidebar.qml @@ -5,7 +5,7 @@ import QtQuick.Controls.Material import Qt5Compat.GraphicalEffects import QtQuick.Controls.Material.impl import ScreenPlayApp -import ScreenPlay + import ScreenPlayUtil Rectangle { diff --git a/ScreenPlay/qml/Create/CreateView.qml b/ScreenPlay/qml/Create/CreateView.qml index 409d5037..e8676cbc 100644 --- a/ScreenPlay/qml/Create/CreateView.qml +++ b/ScreenPlay/qml/Create/CreateView.qml @@ -5,7 +5,7 @@ import QtQuick.Controls.Material import Qt5Compat.GraphicalEffects import QtQuick.Controls.Material.impl import ScreenPlayApp -import ScreenPlay + import ScreenPlayUtil Item { diff --git a/ScreenPlay/qml/Create/StartInfo.qml b/ScreenPlay/qml/Create/StartInfo.qml index 7267a17b..17be289b 100644 --- a/ScreenPlay/qml/Create/StartInfo.qml +++ b/ScreenPlay/qml/Create/StartInfo.qml @@ -5,7 +5,7 @@ import QtQuick.Controls.Material import Qt5Compat.GraphicalEffects import QtQuick.Controls.Material.impl import ScreenPlayApp -import ScreenPlay + import ScreenPlayUtil as Util Item { diff --git a/ScreenPlay/qml/Create/StartInfoLinkImage.qml b/ScreenPlay/qml/Create/StartInfoLinkImage.qml index 8b1a0ac7..bf09d4f9 100644 --- a/ScreenPlay/qml/Create/StartInfoLinkImage.qml +++ b/ScreenPlay/qml/Create/StartInfoLinkImage.qml @@ -5,7 +5,7 @@ import QtQuick.Controls.Material import Qt5Compat.GraphicalEffects import QtQuick.Controls.Material.impl import ScreenPlayApp -import ScreenPlay + import ScreenPlayUtil Item { diff --git a/ScreenPlay/qml/Create/Wizard.qml b/ScreenPlay/qml/Create/Wizard.qml index a33d6980..c554f75b 100644 --- a/ScreenPlay/qml/Create/Wizard.qml +++ b/ScreenPlay/qml/Create/Wizard.qml @@ -4,7 +4,7 @@ import QtQuick.Controls import QtQuick.Controls.Material import QtQuick.Layouts import ScreenPlayApp -import ScreenPlay + import ScreenPlayUtil Item { diff --git a/ScreenPlay/qml/Create/Wizards/GifWallpaper.qml b/ScreenPlay/qml/Create/Wizards/GifWallpaper.qml index 41f6b47a..a54f8ca6 100644 --- a/ScreenPlay/qml/Create/Wizards/GifWallpaper.qml +++ b/ScreenPlay/qml/Create/Wizards/GifWallpaper.qml @@ -3,7 +3,7 @@ import QtQuick.Controls.Material import QtQuick.Controls import QtQuick.Layouts import ScreenPlayApp -import ScreenPlay + import ScreenPlayUtil as Util WizardPage { diff --git a/ScreenPlay/qml/Create/Wizards/GodotWallpaper.qml b/ScreenPlay/qml/Create/Wizards/GodotWallpaper.qml index 578b39f2..ba7d2fec 100644 --- a/ScreenPlay/qml/Create/Wizards/GodotWallpaper.qml +++ b/ScreenPlay/qml/Create/Wizards/GodotWallpaper.qml @@ -4,7 +4,7 @@ import QtQuick.Controls import QtQuick.Controls.Material import QtQuick.Layouts import ScreenPlayApp -import ScreenPlay + import ScreenPlayUtil as Util WizardPage { diff --git a/ScreenPlay/qml/Create/Wizards/HTMLWallpaper.qml b/ScreenPlay/qml/Create/Wizards/HTMLWallpaper.qml index f4f93281..1e9da55c 100644 --- a/ScreenPlay/qml/Create/Wizards/HTMLWallpaper.qml +++ b/ScreenPlay/qml/Create/Wizards/HTMLWallpaper.qml @@ -4,7 +4,7 @@ import QtQuick.Controls import QtQuick.Controls.Material import QtQuick.Layouts import ScreenPlayApp -import ScreenPlay + import ScreenPlayUtil as Util WizardPage { diff --git a/ScreenPlay/qml/Create/Wizards/HTMLWidget.qml b/ScreenPlay/qml/Create/Wizards/HTMLWidget.qml index e4c71e75..d7bab5f1 100644 --- a/ScreenPlay/qml/Create/Wizards/HTMLWidget.qml +++ b/ScreenPlay/qml/Create/Wizards/HTMLWidget.qml @@ -3,7 +3,7 @@ import QtQuick.Controls.Material import QtQuick.Controls import QtQuick.Layouts import ScreenPlayApp -import ScreenPlay + import ScreenPlayUtil as Util WizardPage { diff --git a/ScreenPlay/qml/Create/Wizards/ImportVideoAndConvert/CreateWallpaper.qml b/ScreenPlay/qml/Create/Wizards/ImportVideoAndConvert/CreateWallpaper.qml index 52b5e715..6aa0fb14 100644 --- a/ScreenPlay/qml/Create/Wizards/ImportVideoAndConvert/CreateWallpaper.qml +++ b/ScreenPlay/qml/Create/Wizards/ImportVideoAndConvert/CreateWallpaper.qml @@ -4,7 +4,7 @@ import QtQuick.Controls import QtQuick.Controls.Material import QtQuick.Layouts import ScreenPlayApp -import ScreenPlay + Item { id: root diff --git a/ScreenPlay/qml/Create/Wizards/ImportVideoAndConvert/CreateWallpaperFileSelect.qml b/ScreenPlay/qml/Create/Wizards/ImportVideoAndConvert/CreateWallpaperFileSelect.qml index f3bb0164..0db716a9 100644 --- a/ScreenPlay/qml/Create/Wizards/ImportVideoAndConvert/CreateWallpaperFileSelect.qml +++ b/ScreenPlay/qml/Create/Wizards/ImportVideoAndConvert/CreateWallpaperFileSelect.qml @@ -5,7 +5,7 @@ import QtQuick.Controls.Material import QtQuick.Layouts import QtQuick.Dialogs import ScreenPlayApp -import ScreenPlay + import ScreenPlayUtil as Util import "../../" diff --git a/ScreenPlay/qml/Create/Wizards/ImportVideoAndConvert/CreateWallpaperResult.qml b/ScreenPlay/qml/Create/Wizards/ImportVideoAndConvert/CreateWallpaperResult.qml index 3279355c..1a1af185 100644 --- a/ScreenPlay/qml/Create/Wizards/ImportVideoAndConvert/CreateWallpaperResult.qml +++ b/ScreenPlay/qml/Create/Wizards/ImportVideoAndConvert/CreateWallpaperResult.qml @@ -4,7 +4,7 @@ import QtQuick.Controls.Material import QtQuick.Layouts import Qt5Compat.GraphicalEffects import ScreenPlayApp -import ScreenPlay + Item { id: wrapperError diff --git a/ScreenPlay/qml/Create/Wizards/ImportVideoAndConvert/CreateWallpaperSettings.qml b/ScreenPlay/qml/Create/Wizards/ImportVideoAndConvert/CreateWallpaperSettings.qml index 28e75a32..8d4936e3 100644 --- a/ScreenPlay/qml/Create/Wizards/ImportVideoAndConvert/CreateWallpaperSettings.qml +++ b/ScreenPlay/qml/Create/Wizards/ImportVideoAndConvert/CreateWallpaperSettings.qml @@ -5,7 +5,7 @@ import QtQuick.Controls.Material import QtQuick.Layouts import QtQuick.Dialogs import ScreenPlayApp -import ScreenPlay + import ScreenPlayUtil Item { diff --git a/ScreenPlay/qml/Create/Wizards/ImportVideoAndConvert/CreateWallpaperVideoImportConvert.qml b/ScreenPlay/qml/Create/Wizards/ImportVideoAndConvert/CreateWallpaperVideoImportConvert.qml index 7c2cebcd..a9256912 100644 --- a/ScreenPlay/qml/Create/Wizards/ImportVideoAndConvert/CreateWallpaperVideoImportConvert.qml +++ b/ScreenPlay/qml/Create/Wizards/ImportVideoAndConvert/CreateWallpaperVideoImportConvert.qml @@ -4,7 +4,7 @@ import QtQuick.Controls import QtQuick.Controls.Material import QtQuick.Layouts import ScreenPlayApp -import ScreenPlay + import ScreenPlayUtil as Util Item { diff --git a/ScreenPlay/qml/Create/Wizards/QMLWallpaper.qml b/ScreenPlay/qml/Create/Wizards/QMLWallpaper.qml index e7bc9b5c..f8c6242e 100644 --- a/ScreenPlay/qml/Create/Wizards/QMLWallpaper.qml +++ b/ScreenPlay/qml/Create/Wizards/QMLWallpaper.qml @@ -4,7 +4,7 @@ import QtQuick.Controls import QtQuick.Controls.Material import QtQuick.Layouts import ScreenPlayApp -import ScreenPlay + import ScreenPlayUtil as Util WizardPage { diff --git a/ScreenPlay/qml/Create/Wizards/QMLWidget.qml b/ScreenPlay/qml/Create/Wizards/QMLWidget.qml index 52ab0391..67c6be4c 100644 --- a/ScreenPlay/qml/Create/Wizards/QMLWidget.qml +++ b/ScreenPlay/qml/Create/Wizards/QMLWidget.qml @@ -3,7 +3,7 @@ import QtQuick.Controls.Material import QtQuick.Controls import QtQuick.Layouts import ScreenPlayApp -import ScreenPlay + import ScreenPlayUtil as Util WizardPage { diff --git a/ScreenPlay/qml/Create/Wizards/WebsiteWallpaper.qml b/ScreenPlay/qml/Create/Wizards/WebsiteWallpaper.qml index 21329599..828db928 100644 --- a/ScreenPlay/qml/Create/Wizards/WebsiteWallpaper.qml +++ b/ScreenPlay/qml/Create/Wizards/WebsiteWallpaper.qml @@ -4,7 +4,7 @@ import QtQuick.Controls import QtQuick.Controls.Material import QtQuick.Layouts import ScreenPlayApp -import ScreenPlay + import ScreenPlayUtil as Util WizardPage { diff --git a/ScreenPlay/qml/Create/Wizards/WizardPage.qml b/ScreenPlay/qml/Create/Wizards/WizardPage.qml index 8ad8aefd..35b915fc 100644 --- a/ScreenPlay/qml/Create/Wizards/WizardPage.qml +++ b/ScreenPlay/qml/Create/Wizards/WizardPage.qml @@ -5,7 +5,7 @@ import QtQuick.Controls.Material import QtQuick.Layouts import QtQuick.Window import ScreenPlayApp -import ScreenPlay + FocusScope { id: root diff --git a/ScreenPlay/qml/Installed/InstalledNavigation.qml b/ScreenPlay/qml/Installed/InstalledNavigation.qml index 84a22a8e..3cd789bd 100644 --- a/ScreenPlay/qml/Installed/InstalledNavigation.qml +++ b/ScreenPlay/qml/Installed/InstalledNavigation.qml @@ -5,7 +5,7 @@ import QtQuick.Controls.Material import Qt5Compat.GraphicalEffects import QtQuick.Controls.Material.impl import ScreenPlayApp -import ScreenPlay + import ScreenPlayUtil as Util Item { diff --git a/ScreenPlay/qml/Installed/InstalledView.qml b/ScreenPlay/qml/Installed/InstalledView.qml index 5a7f2f9f..0efdcf77 100644 --- a/ScreenPlay/qml/Installed/InstalledView.qml +++ b/ScreenPlay/qml/Installed/InstalledView.qml @@ -7,7 +7,7 @@ import Qt5Compat.GraphicalEffects import QtQuick.Controls.Material.impl import QtCore as QCore import ScreenPlayApp -import ScreenPlay + import ScreenPlayUtil as Util Item { diff --git a/ScreenPlay/qml/Installed/InstalledWelcomeScreen.qml b/ScreenPlay/qml/Installed/InstalledWelcomeScreen.qml index c25ab688..b731ddc4 100644 --- a/ScreenPlay/qml/Installed/InstalledWelcomeScreen.qml +++ b/ScreenPlay/qml/Installed/InstalledWelcomeScreen.qml @@ -2,7 +2,7 @@ import QtQuick import QtQuick.Controls import QtQuick.Controls.Material import ScreenPlayApp -import ScreenPlay + import ScreenPlayUtil Item { diff --git a/ScreenPlay/qml/Installed/ScreenPlayItem.qml b/ScreenPlay/qml/Installed/ScreenPlayItem.qml index 733390b1..03a94e55 100644 --- a/ScreenPlay/qml/Installed/ScreenPlayItem.qml +++ b/ScreenPlay/qml/Installed/ScreenPlayItem.qml @@ -3,7 +3,7 @@ import Qt5Compat.GraphicalEffects import QtQuick.Controls import QtQuick.Controls.Material import ScreenPlayApp -import ScreenPlay + import ScreenPlayUtil as Util Item { diff --git a/ScreenPlay/qml/Installed/Sidebar.qml b/ScreenPlay/qml/Installed/Sidebar.qml index 8c186d4a..97bd3ceb 100644 --- a/ScreenPlay/qml/Installed/Sidebar.qml +++ b/ScreenPlay/qml/Installed/Sidebar.qml @@ -6,7 +6,7 @@ import QtQuick.Dialogs import QtQuick.Controls.Material import QtQuick.Controls.Material.impl import ScreenPlayApp -import ScreenPlay + import ScreenPlayUtil import "../Monitors" diff --git a/ScreenPlay/qml/Monitors/DefaultVideoControls.qml b/ScreenPlay/qml/Monitors/DefaultVideoControls.qml index 091e142c..48ae0f51 100644 --- a/ScreenPlay/qml/Monitors/DefaultVideoControls.qml +++ b/ScreenPlay/qml/Monitors/DefaultVideoControls.qml @@ -4,7 +4,7 @@ import Qt5Compat.GraphicalEffects import QtQuick.Controls.Material import QtQuick.Layouts import ScreenPlayApp -import ScreenPlay + import ScreenPlayUtil as Util ColumnLayout { diff --git a/ScreenPlay/qml/Monitors/MonitorSelection.qml b/ScreenPlay/qml/Monitors/MonitorSelection.qml index 57e382a6..c8e61060 100644 --- a/ScreenPlay/qml/Monitors/MonitorSelection.qml +++ b/ScreenPlay/qml/Monitors/MonitorSelection.qml @@ -3,7 +3,7 @@ import QtQuick.Controls import Qt5Compat.GraphicalEffects import QtQuick.Controls.Material import ScreenPlayApp -import ScreenPlay + Rectangle { id: root diff --git a/ScreenPlay/qml/Monitors/MonitorSelectionItem.qml b/ScreenPlay/qml/Monitors/MonitorSelectionItem.qml index 820699ee..df9b9ab1 100644 --- a/ScreenPlay/qml/Monitors/MonitorSelectionItem.qml +++ b/ScreenPlay/qml/Monitors/MonitorSelectionItem.qml @@ -2,7 +2,7 @@ import QtQuick import Qt5Compat.GraphicalEffects import QtQuick.Controls.Material import ScreenPlayApp -import ScreenPlay + import ScreenPlayUtil Item { diff --git a/ScreenPlay/qml/Monitors/MonitorsProjectSettingItem.qml b/ScreenPlay/qml/Monitors/MonitorsProjectSettingItem.qml index 4953cfdb..7345ff97 100644 --- a/ScreenPlay/qml/Monitors/MonitorsProjectSettingItem.qml +++ b/ScreenPlay/qml/Monitors/MonitorsProjectSettingItem.qml @@ -5,7 +5,7 @@ import QtQuick.Layouts import QtQuick.Dialogs import Qt5Compat.GraphicalEffects import ScreenPlayApp -import ScreenPlay + Item { id: root diff --git a/ScreenPlay/qml/Monitors/MonitorsView.qml b/ScreenPlay/qml/Monitors/MonitorsView.qml index 73460367..7f0e4b72 100644 --- a/ScreenPlay/qml/Monitors/MonitorsView.qml +++ b/ScreenPlay/qml/Monitors/MonitorsView.qml @@ -5,7 +5,7 @@ import QtQuick.Controls.Material import QtQuick.Layouts import QtQuick.Controls.Material.impl import ScreenPlayApp -import ScreenPlay + import ScreenPlayUtil as Util Util.Popup { @@ -142,7 +142,7 @@ Util.Popup { font.family: App.settings.font enabled: App.screenPlayManager.activeWallpaperCounter > 0 onClicked: { - if (!App.screenPlayManager.removeAllWallpapers()) + if (!App.screenPlayManager.removeAllWallpapers(true)) print("Unable to close all wallpaper!"); root.close(); } diff --git a/ScreenPlay/qml/Monitors/SaveNotification.qml b/ScreenPlay/qml/Monitors/SaveNotification.qml index 2b1492d8..91da2410 100644 --- a/ScreenPlay/qml/Monitors/SaveNotification.qml +++ b/ScreenPlay/qml/Monitors/SaveNotification.qml @@ -3,7 +3,7 @@ import QtQuick.Controls import QtQuick.Controls.Material import QtQuick.Controls.Material.impl import ScreenPlayApp -import ScreenPlay + Rectangle { id: root diff --git a/ScreenPlay/qml/Navigation/ExitPopup.qml b/ScreenPlay/qml/Navigation/ExitPopup.qml index 6eaa8b59..62825569 100644 --- a/ScreenPlay/qml/Navigation/ExitPopup.qml +++ b/ScreenPlay/qml/Navigation/ExitPopup.qml @@ -6,7 +6,7 @@ import QtQuick.Controls import QtQuick.Controls.Material import QtQuick.Layouts import ScreenPlayApp -import ScreenPlay + import ScreenPlayUtil as Util import Qt5Compat.GraphicalEffects diff --git a/ScreenPlay/qml/Navigation/Navigation.qml b/ScreenPlay/qml/Navigation/Navigation.qml index 7d80f5f1..ceafd615 100644 --- a/ScreenPlay/qml/Navigation/Navigation.qml +++ b/ScreenPlay/qml/Navigation/Navigation.qml @@ -6,7 +6,7 @@ import QtQuick.Controls.Material import Qt5Compat.GraphicalEffects import QtQuick.Controls.Material.impl import ScreenPlayApp -import ScreenPlay + import ScreenPlayUtil Rectangle { diff --git a/ScreenPlay/qml/Settings/SettingBool.qml b/ScreenPlay/qml/Settings/SettingBool.qml index 0f64af84..b5147ab3 100644 --- a/ScreenPlay/qml/Settings/SettingBool.qml +++ b/ScreenPlay/qml/Settings/SettingBool.qml @@ -3,7 +3,7 @@ import QtQuick.Controls import QtQuick.Layouts import QtQuick.Controls.Material import ScreenPlayApp -import ScreenPlay + Item { id: settingsBool diff --git a/ScreenPlay/qml/Settings/SettingsButton.qml b/ScreenPlay/qml/Settings/SettingsButton.qml index 7a4c0b4a..d27b3831 100644 --- a/ScreenPlay/qml/Settings/SettingsButton.qml +++ b/ScreenPlay/qml/Settings/SettingsButton.qml @@ -3,7 +3,7 @@ import QtQuick.Controls import QtQuick.Layouts import QtQuick.Controls.Material import ScreenPlayApp -import ScreenPlay + Item { id: settingsButton diff --git a/ScreenPlay/qml/Settings/SettingsComboBox.qml b/ScreenPlay/qml/Settings/SettingsComboBox.qml index 04147078..91dcf00e 100644 --- a/ScreenPlay/qml/Settings/SettingsComboBox.qml +++ b/ScreenPlay/qml/Settings/SettingsComboBox.qml @@ -1,7 +1,7 @@ import QtQuick import QtQuick.Controls import QtQuick.Layouts -import ScreenPlay + import ScreenPlayApp Control { diff --git a/ScreenPlay/qml/Settings/SettingsExpander.qml b/ScreenPlay/qml/Settings/SettingsExpander.qml index d9f8dc73..576f3adf 100644 --- a/ScreenPlay/qml/Settings/SettingsExpander.qml +++ b/ScreenPlay/qml/Settings/SettingsExpander.qml @@ -3,7 +3,7 @@ import QtQuick.Controls import QtQuick.Layouts import QtQuick.Controls.Material import ScreenPlayApp -import ScreenPlay + Item { id: root diff --git a/ScreenPlay/qml/Settings/SettingsHeader.qml b/ScreenPlay/qml/Settings/SettingsHeader.qml index 200f1f93..bc01b2d8 100644 --- a/ScreenPlay/qml/Settings/SettingsHeader.qml +++ b/ScreenPlay/qml/Settings/SettingsHeader.qml @@ -2,7 +2,7 @@ import QtQuick import QtQuick.Layouts import Qt5Compat.GraphicalEffects import ScreenPlayApp -import ScreenPlay + Item { id: settingsHeader diff --git a/ScreenPlay/qml/Settings/SettingsView.qml b/ScreenPlay/qml/Settings/SettingsView.qml index 756788a5..bf8423b1 100644 --- a/ScreenPlay/qml/Settings/SettingsView.qml +++ b/ScreenPlay/qml/Settings/SettingsView.qml @@ -6,7 +6,6 @@ import QtQuick.Controls.Material import QtQuick.Layouts import Qt5Compat.GraphicalEffects import ScreenPlayApp -import ScreenPlay import ScreenPlayUtil Item { @@ -200,7 +199,8 @@ Item { } } onActivated: { - App.settings.setLanguage(settingsLanguage.comboBox.currentValue); + let language = settingsLanguage.comboBox.currentValue + App.settings.setLanguage(language); App.settings.retranslateUI(); } } diff --git a/ScreenPlay/qml/TrayIcon.qml b/ScreenPlay/qml/TrayIcon.qml index 43c73e46..40805182 100644 --- a/ScreenPlay/qml/TrayIcon.qml +++ b/ScreenPlay/qml/TrayIcon.qml @@ -2,7 +2,7 @@ import QtQuick import QtQuick.Window import Qt.labs.platform import ScreenPlayApp -import ScreenPlay + SystemTrayIcon { id: root diff --git a/ScreenPlay/qml/Workshop/WorkshopView.qml b/ScreenPlay/qml/Workshop/WorkshopView.qml index 21572861..511c9b00 100644 --- a/ScreenPlay/qml/Workshop/WorkshopView.qml +++ b/ScreenPlay/qml/Workshop/WorkshopView.qml @@ -3,7 +3,7 @@ import QtQuick.Controls import QtQuick.Controls.Material import Qt5Compat.GraphicalEffects import QtQuick.Layouts -import ScreenPlay + import ScreenPlayWorkshop Item { diff --git a/ScreenPlay/src/app.cpp b/ScreenPlay/src/app.cpp index 175b52f3..32625e27 100644 --- a/ScreenPlay/src/app.cpp +++ b/ScreenPlay/src/app.cpp @@ -1,18 +1,24 @@ // SPDX-License-Identifier: LicenseRef-EliasSteurerTachiom OR AGPL-3.0-only #include "ScreenPlay/app.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + #if defined(Q_OS_MACOS) #include "ScreenPlayUtil/macutils.h" #endif -#include "ScreenPlay/CMakeVariables.h" -#include "ScreenPlayUtil/steamenumsgenerated.h" -#include "app.h" -#include -#include -#include -#include - namespace ScreenPlay { /*! @@ -32,25 +38,6 @@ namespace ScreenPlay { \brief The App class contains all members for ScreenPlay. */ -/*! - \brief Constructor creates and holds all classes used by ScreenPlay via unique_ptr or - shared_ptr. -*/ -App::App() - : QObject(nullptr) -{ - - QGuiApplication::setWindowIcon(QIcon(":/qml/ScreenPlayApp/assets/icons/app.ico")); - QGuiApplication::setOrganizationName("ScreenPlay"); - QGuiApplication::setOrganizationDomain("screen-play.app"); - QGuiApplication::setApplicationName("ScreenPlay"); - QGuiApplication::setApplicationVersion(QString(SCREENPLAY_VERSION)); - QGuiApplication::setQuitOnLastWindowClosed(false); - // ScreenPlayManager first to check if another ScreenPlay Instace is running - m_screenPlayManager = std::make_unique(); - m_isAnotherScreenPlayInstanceRunning = m_screenPlayManager->isAnotherScreenPlayInstanceRunning(); -} - /*! \brief Used for initialization after the constructor. The sole purpose is to check if another ScreenPlay instance is running and then quit early. This is also because we cannot @@ -77,6 +64,7 @@ void App::init() using std::make_shared, std::make_unique; + m_screenPlayManager = make_unique(); m_globalVariables = make_shared(); m_monitorListModel = make_shared(); m_util = make_unique(); @@ -84,7 +72,6 @@ void App::init() m_settings = make_shared(m_globalVariables); m_installedListModel = make_shared(m_globalVariables, m_settings); m_installedListFilter = make_shared(m_installedListModel); - m_mainWindowEngine = make_unique(); // Only create anonymousTelemetry if user did not disallow! if (m_settings->anonymousTelemetry()) { @@ -114,7 +101,7 @@ void App::init() // When the installed storage path changed QObject::connect(m_settings.get(), &Settings::resetInstalledListmodel, m_installedListModel.get(), &InstalledListModel::reset); - QObject::connect(m_settings.get(), &Settings::requestRetranslation, m_mainWindowEngine.get(), &QQmlEngine::retranslate); + QObject::connect(m_settings.get(), &Settings::requestRetranslation, this, &App::requestRetranslation); m_settings->setupLanguage(); QObject::connect(m_globalVariables.get(), &GlobalVariables::localStoragePathChanged, this, [this](QUrl localStoragePath) { @@ -122,9 +109,6 @@ void App::init() m_settings->setqSetting("ScreenPlayContentPath", localStoragePath.toString()); }); - // Init after we have the paths from settings - m_installedListModel->init(); - auto* guiAppInst = dynamic_cast(QGuiApplication::instance()); // Set visible if the -silent parameter was not set @@ -133,16 +117,15 @@ void App::init() settings()->setSilentStart(true); } - qmlRegisterSingletonInstance("ScreenPlay", 1, 0, "App", this); - m_mainWindowEngine->addImportPath(guiAppInst->applicationDirPath() + "/qml"); - guiAppInst->addLibraryPath(guiAppInst->applicationDirPath() + "/qml"); - - QQuickStyle::setStyle("Material"); - m_mainWindowEngine->load(QUrl(QStringLiteral("qrc:/qml/ScreenPlayApp/main.qml"))); - // Must be called last to display a error message on startup by the qml engine m_screenPlayManager->init(m_globalVariables, m_monitorListModel, m_settings); - QObject::connect(m_monitorListModel.get(), &MonitorListModel::monitorConfigurationChanged, m_screenPlayManager.get(), &ScreenPlayManager::removeAllWallpapers); + + QObject::connect( + m_monitorListModel.get(), + &MonitorListModel::monitorConfigurationChanged, + m_screenPlayManager.get(), [this]() { + m_screenPlayManager->removeAllWallpapers(true); + }); } QString App::version() const @@ -156,18 +139,13 @@ QString App::version() const */ void App::exit() { - m_screenPlayManager->removeAllWallpapers(); - m_screenPlayManager->removeAllWidgets(); + m_screenPlayManager->removeAllWallpapers(false); + m_screenPlayManager->removeAllWidgets(false); // Must be called inside a separate event loop otherwise we // would kill the qml engine while it is calling this function. // A single shot timer is a handy woraround for this. QTimer::singleShot(0, this, [this]() { - auto* appInst = QGuiApplication::instance(); - // We must ensure that we kill the qml engine first - // before we destory the rest of the app - m_mainWindowEngine->clearSingletons(); - m_mainWindowEngine.reset(); - appInst->quit(); + emit requestExit(); }); } @@ -303,20 +281,6 @@ void App::setInstalledListFilter(InstalledListFilter* installedListFilter) m_installedListFilter.reset(installedListFilter); emit installedListFilterChanged(m_installedListFilter.get()); } -/*! - \property App::mainWindowEngine - \brief . - - . -*/ -void App::setMainWindowEngine(QQmlApplicationEngine* mainWindowEngine) -{ - if (m_mainWindowEngine.get() == mainWindowEngine) - return; - - m_mainWindowEngine.reset(mainWindowEngine); - emit mainWindowEngineChanged(m_mainWindowEngine.get()); -} /*! \property App::wizards \brief . @@ -331,6 +295,24 @@ void App::setWizards(Wizards* wizards) m_wizards.reset(wizards); emit wizardsChanged(m_wizards.get()); } + +QQmlEngine* App::engine() const +{ + return m_engine; +} + +void App::setEngine(QQmlEngine* engine) +{ + m_engine = engine; + if (!m_engine) { + qFatal("QQmlEngine not set"); + } + QObject::connect( + m_settings.get(), + &Settings::requestRetranslation, + m_engine, + &QQmlEngine::retranslate); +} } #include "moc_app.cpp" diff --git a/ScreenPlay/src/applicationengine.cpp b/ScreenPlay/src/applicationengine.cpp new file mode 100644 index 00000000..0ce9a221 --- /dev/null +++ b/ScreenPlay/src/applicationengine.cpp @@ -0,0 +1,59 @@ +#include "ScreenPlay/applicationengine.h" +#include "ScreenPlay/CMakeVariables.h" +#include "ScreenPlay/app.h" +#include "ScreenPlay/applicationengine.h" + +#include +#include + +namespace ScreenPlay { + +ApplicationEngine::ApplicationEngine(QObject* parent) + : QQmlApplicationEngine { parent } +{ + QGuiApplication::setWindowIcon(QIcon(":/qml/ScreenPlayApp/assets/icons/app.ico")); + QGuiApplication::setOrganizationName("ScreenPlay"); + QGuiApplication::setOrganizationDomain("screen-play.app"); + QGuiApplication::setApplicationName("ScreenPlay"); + QGuiApplication::setApplicationVersion(QString(SCREENPLAY_VERSION)); + QGuiApplication::setQuitOnLastWindowClosed(false); +} + +/*! + \brief Checks if another ScreenPlay instance is running by trying to connect to a pipe + with the name ScreenPlay. + If successful we send a raise command and quit via m_isAnotherScreenPlayInstanceRunning = true. +*/ + +bool ScreenPlay::ApplicationEngine::isAnotherScreenPlayInstanceRunning() +{ + QLocalSocket socket; + socket.connectToServer("ScreenPlay", QIODeviceBase::ExistingOnly); + // If we cannot connect to a running ScreenPlay + // pipe we are alone + if (!socket.isOpen()) { + socket.close(); + return false; + } + + qInfo("Another ScreenPlay app is already running!"); + QByteArray msg = "command=requestRaise"; + socket.write(msg); + socket.waitForBytesWritten(500); + socket.close(); + return true; +} + +void ApplicationEngine::init() +{ + auto* guiAppInst = dynamic_cast(QGuiApplication::instance()); + addImportPath(guiAppInst->applicationDirPath() + "/qml"); + guiAppInst->addLibraryPath(guiAppInst->applicationDirPath() + "/qml"); + + QQuickStyle::setStyle("Material"); + load(QUrl(QStringLiteral("qrc:/qml/ScreenPlayApp/main.qml"))); + + App* singleton = singletonInstance("ScreenPlayApp", "App"); + singleton->setEngine(this); +} +} diff --git a/ScreenPlay/src/globalvariables.cpp b/ScreenPlay/src/globalvariables.cpp index 1e48aad2..d1da46b0 100644 --- a/ScreenPlay/src/globalvariables.cpp +++ b/ScreenPlay/src/globalvariables.cpp @@ -13,7 +13,7 @@ namespace ScreenPlay { /*! \brief Constructs the global variabls. */ -ScreenPlay::GlobalVariables::GlobalVariables(QObject* parent) +GlobalVariables::GlobalVariables(QObject* parent) : QObject(parent) { setLocalSettingsPath(QUrl { QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) }); @@ -71,6 +71,13 @@ void GlobalVariables::setGodotEditorExecutablePath(QUrl godotEditorExecutablePat emit godotEditorExecutablePathChanged(m_godotEditorExecutablePath); } +void GlobalVariables::setVersion(Version version) +{ + if (m_version == version) + return; + m_version = version; + emit versionChanged(m_version); +} } #include "moc_globalvariables.cpp" diff --git a/ScreenPlay/src/screenplaymanager.cpp b/ScreenPlay/src/screenplaymanager.cpp index 8a1af2be..6cdccd23 100644 --- a/ScreenPlay/src/screenplaymanager.cpp +++ b/ScreenPlay/src/screenplaymanager.cpp @@ -23,12 +23,6 @@ ScreenPlayManager::ScreenPlayManager( QObject* parent) : QObject { parent } { - - if (checkIsAnotherScreenPlayInstanceRunning()) { - m_isAnotherScreenPlayInstanceRunning = true; - return; - } - m_server = std::make_unique(); QObject::connect(m_server.get(), &QLocalServer::newConnection, this, &ScreenPlayManager::newConnection); @@ -47,29 +41,6 @@ ScreenPlayManager::ScreenPlayManager( }); } -/*! - \brief Checks if another ScreenPlay instance is running by trying to connect to a pipe - with the name ScreenPlay. - If successful we send a raise command and quit via m_isAnotherScreenPlayInstanceRunning = true. -*/ -bool ScreenPlayManager::checkIsAnotherScreenPlayInstanceRunning() -{ - QLocalSocket socket; - socket.connectToServer("ScreenPlay"); - - if (!socket.isOpen()) { - socket.close(); - return false; - } - - qInfo("Another ScreenPlay app is already running!"); - QByteArray msg = "command=requestRaise"; - socket.write(msg); - socket.waitForBytesWritten(500); - socket.close(); - return true; -} - /*! \brief Inits this class instead of init in the constructor. This is because we need to check first if another ScreenPlay instance is running. If it is not the case we call this function. @@ -227,11 +198,11 @@ bool ScreenPlayManager::createWidget( /*! \brief Removes all wallpaper entries in the profiles.json. */ -bool ScreenPlayManager::removeAllWallpapers() +bool ScreenPlayManager::removeAllWallpapers(bool saveToProfile) { if (m_screenPlayWallpapers.empty()) { - qWarning() << "Trying to remove all Wallpapers while m_screenPlayWallpapers is not empty. Count: " << m_screenPlayWallpapers.size(); + qWarning() << "Trying to remove all Wallpapers while m_screenPlayWallpapers is not empty."; return false; } @@ -247,7 +218,8 @@ bool ScreenPlayManager::removeAllWallpapers() } } - emit requestSaveProfiles(); + if (saveToProfile) + emit requestSaveProfiles(); return true; } @@ -255,10 +227,10 @@ bool ScreenPlayManager::removeAllWallpapers() /*! \brief Removes all widgets and resets the activeWidgetCounter to 0. */ -bool ScreenPlayManager::removeAllWidgets() +bool ScreenPlayManager::removeAllWidgets(bool saveToProfile) { if (m_screenPlayWidgets.empty()) { - qWarning() << "Trying to remove all Widgets while m_screenPlayWidgets is empty. Count: " << m_screenPlayWidgets.size(); + qWarning() << "Trying to remove all Widgets while m_screenPlayWidgets is empty."; return false; } @@ -274,7 +246,8 @@ bool ScreenPlayManager::removeAllWidgets() } } - emit requestSaveProfiles(); + if (saveToProfile) + emit requestSaveProfiles(); return true; } @@ -557,9 +530,9 @@ bool ScreenPlayManager::loadProfiles() } std::optional version = util.getVersionNumberFromString(configObj->value("version").toString()); - - if (version && *version != m_globalVariables->version()) { - qWarning() << "Version missmatch fileVersion: " << version->toString() << "m_version: " << m_globalVariables->version().toString(); + QVersionNumber requiredVersion { 1, 0, 0 }; + if (version && *version != requiredVersion) { + qWarning() << "Version missmatch fileVersion: " << version->toString() << "m_version: " << requiredVersion.toString(); return false; } diff --git a/ScreenPlay/src/settings.cpp b/ScreenPlay/src/settings.cpp index 8a1d7d54..921c5924 100644 --- a/ScreenPlay/src/settings.cpp +++ b/ScreenPlay/src/settings.cpp @@ -302,7 +302,7 @@ bool Settings::retranslateUI() QString langCode = fixLanguageCode(QVariant::fromValue(language()).toString()); QFile tsFile; - const QString qmPath = QGuiApplication::applicationDirPath() + "/translations/ScreenPlay_" + langCode + ".qm"; + const QString qmPath = QGuiApplication::applicationDirPath() + "/assets/translations/ScreenPlay_" + langCode + ".qm"; if (tsFile.exists(qmPath)) { if (!m_translator.load(qmPath)) { qWarning() << "Unable to load translation file: " << qmPath; diff --git a/ScreenPlay/tests/tst_main.cpp b/ScreenPlay/tests/tst_main.cpp index 03126b64..826a0e7c 100644 --- a/ScreenPlay/tests/tst_main.cpp +++ b/ScreenPlay/tests/tst_main.cpp @@ -10,14 +10,18 @@ #include #include #include +#include #include +#include #include +#include Q_IMPORT_QML_PLUGIN(ScreenPlayAppPlugin) Q_IMPORT_QML_PLUGIN(ScreenPlayUtilPlugin) #ifdef SCREENPLAY_STEAM Q_IMPORT_QML_PLUGIN(ScreenPlayWorkshopPlugin) #endif + class ScreenPlayTest : public QObject { Q_OBJECT @@ -26,7 +30,7 @@ private slots: { app.init(); - m_window = qobject_cast(app.mainWindowEngine()->rootObjects().first()); + // m_window = qobject_cast(app.mainWindowEngine()->rootObjects().first()); m_window->addImportPath(QGuiApplication::instance()->applicationDirPath() + "/qml"); QVERIFY(m_window); diff --git a/ScreenPlayUtil/qml/Dialog.qml b/ScreenPlayUtil/qml/Dialog.qml index d79d4958..a1260845 100644 --- a/ScreenPlayUtil/qml/Dialog.qml +++ b/ScreenPlayUtil/qml/Dialog.qml @@ -5,7 +5,7 @@ import Qt5Compat.GraphicalEffects import QtQuick.Controls.Material.impl import QtQuick.Controls.Material import ScreenPlayApp -import ScreenPlay + Dialog { id: root diff --git a/ScreenPlayUtil/qml/Dialogs/CriticalError.qml b/ScreenPlayUtil/qml/Dialogs/CriticalError.qml index 0c068f7a..633a8611 100644 --- a/ScreenPlayUtil/qml/Dialogs/CriticalError.qml +++ b/ScreenPlayUtil/qml/Dialogs/CriticalError.qml @@ -5,7 +5,7 @@ import QtQuick.Controls.Material import QtQuick.Window import Qt5Compat.GraphicalEffects import ScreenPlayApp -import ScreenPlay + import ScreenPlayUtil as Util Util.Dialog { diff --git a/ScreenPlayUtil/qml/Dialogs/MonitorConfiguration.qml b/ScreenPlayUtil/qml/Dialogs/MonitorConfiguration.qml index aa763aa9..79937cbb 100644 --- a/ScreenPlayUtil/qml/Dialogs/MonitorConfiguration.qml +++ b/ScreenPlayUtil/qml/Dialogs/MonitorConfiguration.qml @@ -3,7 +3,7 @@ import QtQuick.Controls import QtQuick.Layouts import QtQuick.Controls.Material import ScreenPlayApp -import ScreenPlay + import ScreenPlayUtil as Util Util.Dialog { diff --git a/ScreenPlayUtil/qml/FileSelector.qml b/ScreenPlayUtil/qml/FileSelector.qml index 395a3c0c..3bac07f2 100644 --- a/ScreenPlayUtil/qml/FileSelector.qml +++ b/ScreenPlayUtil/qml/FileSelector.qml @@ -3,7 +3,7 @@ import QtQuick.Controls import QtQuick.Controls.Material import QtQuick.Dialogs import ScreenPlayApp -import ScreenPlay + /*! \qmltype Image Selector diff --git a/ScreenPlayUtil/qml/Headline.qml b/ScreenPlayUtil/qml/Headline.qml index 44965c7d..da6ea437 100644 --- a/ScreenPlayUtil/qml/Headline.qml +++ b/ScreenPlayUtil/qml/Headline.qml @@ -1,7 +1,7 @@ import QtQuick import QtQuick.Controls.Material import ScreenPlayApp -import ScreenPlay + Item { id: root diff --git a/ScreenPlayUtil/qml/HeadlineSection.qml b/ScreenPlayUtil/qml/HeadlineSection.qml index 739956cd..5bf074e0 100644 --- a/ScreenPlayUtil/qml/HeadlineSection.qml +++ b/ScreenPlayUtil/qml/HeadlineSection.qml @@ -1,7 +1,7 @@ import QtQuick import QtQuick.Controls.Material import ScreenPlayApp -import ScreenPlay + Text { text: qsTr("Headline Section") diff --git a/ScreenPlayUtil/qml/ImageSelector.qml b/ScreenPlayUtil/qml/ImageSelector.qml index 7064829e..b896730e 100644 --- a/ScreenPlayUtil/qml/ImageSelector.qml +++ b/ScreenPlayUtil/qml/ImageSelector.qml @@ -3,7 +3,7 @@ import QtQuick.Controls import QtQuick.Controls.Material import QtQuick.Dialogs import ScreenPlayApp -import ScreenPlay + /*! \qmltype Image Selector diff --git a/ScreenPlayUtil/qml/LabelSlider.qml b/ScreenPlayUtil/qml/LabelSlider.qml index 602e3719..0a2bdcdc 100644 --- a/ScreenPlayUtil/qml/LabelSlider.qml +++ b/ScreenPlayUtil/qml/LabelSlider.qml @@ -3,7 +3,7 @@ import QtQuick.Controls.Material 2.0 as QQCM import QtQuick.Layouts import QtQuick.Controls as QQC import ScreenPlayApp -import ScreenPlay + Item { id: root diff --git a/ScreenPlayUtil/qml/LicenseSelector.qml b/ScreenPlayUtil/qml/LicenseSelector.qml index a80e38be..42f53a86 100644 --- a/ScreenPlayUtil/qml/LicenseSelector.qml +++ b/ScreenPlayUtil/qml/LicenseSelector.qml @@ -3,7 +3,7 @@ import QtQuick.Controls import QtQuick.Controls.Material import QtQuick.Layouts import ScreenPlayApp -import ScreenPlay + ColumnLayout { id: root diff --git a/ScreenPlayUtil/qml/Tag.qml b/ScreenPlayUtil/qml/Tag.qml index 3f912c10..c737a4dc 100644 --- a/ScreenPlayUtil/qml/Tag.qml +++ b/ScreenPlayUtil/qml/Tag.qml @@ -2,7 +2,7 @@ import QtQuick import QtQuick.Controls import QtQuick.Controls.Material import ScreenPlayApp -import ScreenPlay + Item { id: tag diff --git a/ScreenPlayUtil/qml/TagSelector.qml b/ScreenPlayUtil/qml/TagSelector.qml index f9c20783..1ce89bd6 100644 --- a/ScreenPlayUtil/qml/TagSelector.qml +++ b/ScreenPlayUtil/qml/TagSelector.qml @@ -3,7 +3,7 @@ import QtQuick.Controls import Qt5Compat.GraphicalEffects import QtQuick.Controls.Material import ScreenPlayApp -import ScreenPlay + Item { id: root diff --git a/ScreenPlayUtil/qml/TextField.qml b/ScreenPlayUtil/qml/TextField.qml index cc43ff35..86b67983 100644 --- a/ScreenPlayUtil/qml/TextField.qml +++ b/ScreenPlayUtil/qml/TextField.qml @@ -4,7 +4,7 @@ import QtQuick.Controls.Material import QtQuick.Controls import QtQuick.Layouts import ScreenPlayApp -import ScreenPlay + ColumnLayout { id: root diff --git a/ScreenPlayUtil/src/logginghandler.cpp b/ScreenPlayUtil/src/logginghandler.cpp index 40fc0fe4..2d3dd60a 100644 --- a/ScreenPlayUtil/src/logginghandler.cpp +++ b/ScreenPlayUtil/src/logginghandler.cpp @@ -254,7 +254,9 @@ void LoggingHandler::writeToConsole(QtMsgType type, const QMessageLogContext& co fmt::styled(now.toStdString(), fmt::emphasis::bold), fmt::styled(typeIndicator.toStdString(), fg(color)), message.toStdString(), - context.file, + // Using context.file (char*) directly results + // in a runtime crash in release + QString::fromUtf8(context.file).toStdString(), line); } } diff --git a/ScreenPlayWorkshop/qml/Forum.qml b/ScreenPlayWorkshop/qml/Forum.qml index 5cbc8e70..2a2e812b 100644 --- a/ScreenPlayWorkshop/qml/Forum.qml +++ b/ScreenPlayWorkshop/qml/Forum.qml @@ -4,7 +4,7 @@ import QtQuick.Controls.Material import QtQuick.Layouts import Qt5Compat.GraphicalEffects import ScreenPlayApp -import ScreenPlay + Item { id: root diff --git a/ScreenPlayWorkshop/qml/PopupOffline.qml b/ScreenPlayWorkshop/qml/PopupOffline.qml index db0eaed7..7844d38a 100644 --- a/ScreenPlayWorkshop/qml/PopupOffline.qml +++ b/ScreenPlayWorkshop/qml/PopupOffline.qml @@ -5,7 +5,7 @@ import QtQuick.Controls.Material import Qt5Compat.GraphicalEffects import ScreenPlayWorkshop import ScreenPlayUtil -import ScreenPlay + import ScreenPlayApp Popup { diff --git a/ScreenPlayWorkshop/qml/Workshop.qml b/ScreenPlayWorkshop/qml/Workshop.qml index 44d6bc5f..99ed515c 100644 --- a/ScreenPlayWorkshop/qml/Workshop.qml +++ b/ScreenPlayWorkshop/qml/Workshop.qml @@ -3,7 +3,7 @@ import QtQuick.Controls import QtQuick.Controls.Material import Qt5Compat.GraphicalEffects import QtQuick.Layouts -import ScreenPlay + Item { id: root