From 0c837d81cb5263a7798cdecaeb277b6024e8de9b Mon Sep 17 00:00:00 2001 From: Elias Steurer Date: Thu, 27 Jan 2022 16:59:08 +0100 Subject: [PATCH] Fix linux ui loading This was because of buggy require property and missing Q_IMPORT_QML_PLUGIN --- ScreenPlay/CMakeLists.txt | 6 +++-- ScreenPlay/app.cpp | 4 ++-- ScreenPlay/main.cpp | 1 + ScreenPlay/main.qml | 15 ++++++++----- ScreenPlay/qml/Community/Community.qml | 2 +- ScreenPlay/qml/Create/Create.qml | 4 ++-- ScreenPlay/qml/Create/Sidebar.qml | 22 +++++++++---------- ScreenPlay/qml/Installed/Installed.qml | 8 +++---- ScreenPlay/qml/Settings/Settings.qml | 2 +- ScreenPlay/qml/Workshop/SteamWorkshop.qml | 2 +- .../qml/Workshop/SteamWorkshopStartPage.qml | 4 ++-- ScreenPlay/qml/Workshop/Workshop.qml | 6 ++--- ScreenPlay/qml/Workshop/WorkshopInstalled.qml | 2 +- ScreenPlayWallpaper/src/basewindow.cpp | 2 +- 14 files changed, 44 insertions(+), 36 deletions(-) diff --git a/ScreenPlay/CMakeLists.txt b/ScreenPlay/CMakeLists.txt index 54ad6565..cc6ecf27 100644 --- a/ScreenPlay/CMakeLists.txt +++ b/ScreenPlay/CMakeLists.txt @@ -196,6 +196,7 @@ target_link_libraries( Qt6::Core Qt6::WebSockets Qt6::Svg + ScreenPlayQmlplugin SteamSDKQtEnums) if(${TESTS_ENABLED}) @@ -224,10 +225,11 @@ qt_add_lrelease( target_compile_definitions(${PROJECT_NAME} PRIVATE $<$,$>:QT_QML_DEBUG>) +qt_add_library(ScreenPlayQml STATIC) qt_add_qml_module( - ${PROJECT_NAME} + ScreenPlayQml URI - ${PROJECT_NAME} + ScreenPlayQml VERSION 1.0 QML_FILES diff --git a/ScreenPlay/app.cpp b/ScreenPlay/app.cpp index cfe79715..a2290fd7 100644 --- a/ScreenPlay/app.cpp +++ b/ScreenPlay/app.cpp @@ -62,7 +62,7 @@ App::App() QGuiApplication::setOrganizationName("ScreenPlay"); QGuiApplication::setOrganizationDomain("screen-play.app"); QGuiApplication::setApplicationName("ScreenPlay"); - QGuiApplication::setApplicationVersion("0.15.0"); + QGuiApplication::setApplicationVersion(QVersionNumber(0, 15, 0).toString()); QGuiApplication::setQuitOnLastWindowClosed(false); QFontDatabase::addApplicationFont(":/assets/fonts/LibreBaskerville-Italic.ttf"); @@ -216,7 +216,7 @@ void App::init() setupKDE(); } - m_mainWindowEngine->load(QUrl(QStringLiteral("qrc:/ScreenPlay/main.qml"))); + m_mainWindowEngine->load(QUrl(QStringLiteral("qrc:/ScreenPlayQml/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); diff --git a/ScreenPlay/main.cpp b/ScreenPlay/main.cpp index b37aa693..87a02635 100644 --- a/ScreenPlay/main.cpp +++ b/ScreenPlay/main.cpp @@ -36,6 +36,7 @@ #include #include #include +Q_IMPORT_QML_PLUGIN(ScreenPlayQmlPlugin) #include #define DOCTEST_CONFIG_IMPLEMENT diff --git a/ScreenPlay/main.qml b/ScreenPlay/main.qml index 2178b9ca..01a8f52e 100644 --- a/ScreenPlay/main.qml +++ b/ScreenPlay/main.qml @@ -38,12 +38,12 @@ ApplicationWindow { } if (name === "Installed") { - stackView.replace("qrc:/ScreenPlay/qml/Installed/Installed.qml", { + stackView.replace("qrc:/ScreenPlayQml/qml/Installed/Installed.qml", { "sidebar": sidebar }) return } - stackView.replace("qrc:/ScreenPlay/qml/" + name + "/" + name + ".qml", { + stackView.replace("qrc:/ScreenPlayQml/qml/" + name + "/" + name + ".qml", { "modalSource": content }) sidebar.state = "inactive" @@ -58,7 +58,7 @@ ApplicationWindow { title: "ScreenPlay Alpha - " + ScreenPlay.version() minimumHeight: 450 minimumWidth: 1050 - flags: Qt.FramelessWindowHint | Qt.Window + property bool enableCustomWindowNavigation: Qt.platform.os === "windows" || Qt.platform.os === "osx" // Partial workaround for // https://bugreports.qt.io/browse/QTBUG-86047 @@ -74,8 +74,11 @@ ApplicationWindow { } } Component.onCompleted: { + if(root.enableCustomWindowNavigation){ + root.flags = Qt.FramelessWindowHint | Qt.Window + } setTheme(ScreenPlay.settings.theme) - stackView.push("qrc:/ScreenPlay/qml/Installed/Installed.qml", { + stackView.push("qrc:/ScreenPlayQml/qml/Installed/Installed.qml", { "sidebar": sidebar }) if (!ScreenPlay.settings.silentStart) @@ -112,6 +115,8 @@ ApplicationWindow { anchors.margins: 1 Navigation.WindowNavigation { id: windowNav + enabled: root.enableCustomWindowNavigation + visible: enabled z:5 modalSource: content width: parent.width @@ -121,7 +126,7 @@ ApplicationWindow { Item { id: content anchors { - top: windowNav.bottom + top: root.enableCustomWindowNavigation ? windowNav.bottom : parent.top right: parent.right bottom: parent.bottom left: parent.left diff --git a/ScreenPlay/qml/Community/Community.qml b/ScreenPlay/qml/Community/Community.qml index 31b05c20..2e566b3d 100644 --- a/ScreenPlay/qml/Community/Community.qml +++ b/ScreenPlay/qml/Community/Community.qml @@ -8,7 +8,7 @@ import ScreenPlay 1.0 Item { id: root - required property Item modalSource + property Item modalSource XMLNewsfeed { anchors { diff --git a/ScreenPlay/qml/Create/Create.qml b/ScreenPlay/qml/Create/Create.qml index 05d93059..f4b61d2d 100644 --- a/ScreenPlay/qml/Create/Create.qml +++ b/ScreenPlay/qml/Create/Create.qml @@ -12,11 +12,11 @@ import ScreenPlay.QMLUtilities 1.0 Item { id: root - required property Item modalSource + property Item modalSource Component.onCompleted: { wizardContentWrapper.state = "in"; - stackView.push("qrc:/ScreenPlay/qml/Create/StartInfo.qml"); + stackView.push("qrc:/ScreenPlayQml/qml/Create/StartInfo.qml"); } Sidebar { diff --git a/ScreenPlay/qml/Create/Sidebar.qml b/ScreenPlay/qml/Create/Sidebar.qml index 95802ab3..2900fe71 100644 --- a/ScreenPlay/qml/Create/Sidebar.qml +++ b/ScreenPlay/qml/Create/Sidebar.qml @@ -43,7 +43,7 @@ Rectangle { function onWizardExited() { root.expanded = true stackView.clear(StackView.PushTransition) - stackView.push("qrc:/ScreenPlay/qml/Create/StartInfo.qml") + stackView.push("qrc:/ScreenPlayQml/qml/Create/StartInfo.qml") listView.currentIndex = 0 ScreenPlay.util.setNavigationActive(true) } @@ -54,70 +54,70 @@ Rectangle { model: ListModel { ListElement { headline: qsTr("Tools Overview") - source: "qrc:/ScreenPlay/qml/Create/StartInfo.qml" + source: "qrc:/ScreenPlayQml/qml/Create/StartInfo.qml" category: "Home" objectName: "" } ListElement { headline: qsTr("Video Import h264 (.mp4)") - source: "qrc:/ScreenPlay/qml/Create/Wizards/Importh264/Importh264.qml" + source: "qrc:/ScreenPlayQml/qml/Create/Wizards/Importh264/Importh264.qml" category: "Video Wallpaper" objectName: "" } ListElement { headline: qsTr("Video Import VP8 & VP9 (.webm)") - source: "qrc:/ScreenPlay/qml/Create/Wizards/ImportWebm/ImportWebm.qml" + source: "qrc:/ScreenPlayQml/qml/Create/Wizards/ImportWebm/ImportWebm.qml" category: "Video Wallpaper" objectName: "" } ListElement { headline: qsTr("Video import (all types)") - source: "qrc:/ScreenPlay/qml/Create/Wizards/ImportVideoAndConvert/CreateWallpaper.qml" + source: "qrc:/ScreenPlayQml/qml/Create/Wizards/ImportVideoAndConvert/CreateWallpaper.qml" category: "Video Wallpaper" objectName: "videoImportConvert" } ListElement { headline: qsTr("GIF Wallpaper") - source: "qrc:/ScreenPlay/qml/Create/Wizards/GifWallpaper.qml" + source: "qrc:/ScreenPlayQml/qml/Create/Wizards/GifWallpaper.qml" category: "Video Wallpaper" objectName: "" } ListElement { headline: qsTr("QML Wallpaper") - source: "qrc:/ScreenPlay/qml/Create/Wizards/QMLWallpaper.qml" + source: "qrc:/ScreenPlayQml/qml/Create/Wizards/QMLWallpaper.qml" category: "Code Wallpaper" objectName: "" } ListElement { headline: qsTr("HTML5 Wallpaper") - source: "qrc:/ScreenPlay/qml/Create/Wizards/HTMLWallpaper.qml" + source: "qrc:/ScreenPlayQml/qml/Create/Wizards/HTMLWallpaper.qml" category: "Code Wallpaper" objectName: "" } ListElement { headline: qsTr("Website Wallpaper") - source: "qrc:/ScreenPlay/qml/Create/Wizards/WebsiteWallpaper.qml" + source: "qrc:/ScreenPlayQml/qml/Create/Wizards/WebsiteWallpaper.qml" category: "Code Wallpaper" objectName: "" } ListElement { headline: qsTr("QML Widget") - source: "qrc:/ScreenPlay/qml/Create/Wizards/QMLWidget.qml" + source: "qrc:/ScreenPlayQml/qml/Create/Wizards/QMLWidget.qml" category: "Code Widgets" objectName: "" } ListElement { headline: qsTr("HTML Widget") - source: "qrc:/ScreenPlay/qml/Create/Wizards/HTMLWidget.qml" + source: "qrc:/ScreenPlayQml/qml/Create/Wizards/HTMLWidget.qml" category: "Code Widgets" objectName: "" } diff --git a/ScreenPlay/qml/Installed/Installed.qml b/ScreenPlay/qml/Installed/Installed.qml index 4e2798a2..91e29e9c 100644 --- a/ScreenPlay/qml/Installed/Installed.qml +++ b/ScreenPlay/qml/Installed/Installed.qml @@ -14,7 +14,7 @@ Item { property bool refresh: false property bool enabled: true - required property Sidebar sidebar + property Sidebar sidebar signal setNavigationItem(var pos) signal setSidebarActive(var active) @@ -73,7 +73,7 @@ Item { active: false z: 99 anchors.fill: parent - source: "qrc:/ScreenPlay/qml/Installed/InstalledWelcomeScreen.qml" + source: "qrc:/ScreenPlayQml/qml/Installed/InstalledWelcomeScreen.qml" } Connections { @@ -89,7 +89,7 @@ Item { objectName: "gridView" property bool isDragging: false - property bool isScrolling: gridView.verticalVelocity != 0 + property bool isScrolling: gridView.verticalVelocity !== 0 boundsBehavior: Flickable.DragOverBounds maximumFlickVelocity: 5000 @@ -297,7 +297,7 @@ Item { } } - Common.Dialog { + Dialog { id: deleteDialog title: qsTr("Are you sure you want to delete this item?") standardButtons: Dialog.Ok | Dialog.Cancel diff --git a/ScreenPlay/qml/Settings/Settings.qml b/ScreenPlay/qml/Settings/Settings.qml index 17dcfafe..f84201e0 100644 --- a/ScreenPlay/qml/Settings/Settings.qml +++ b/ScreenPlay/qml/Settings/Settings.qml @@ -12,7 +12,7 @@ import "../Common" Item { id: root - required property Item modalSource + property Item modalSource function indexOfValue(model, value) { for (var i = 0; i < model.length; i++) { diff --git a/ScreenPlay/qml/Workshop/SteamWorkshop.qml b/ScreenPlay/qml/Workshop/SteamWorkshop.qml index d3ddb8a3..c8126888 100644 --- a/ScreenPlay/qml/Workshop/SteamWorkshop.qml +++ b/ScreenPlay/qml/Workshop/SteamWorkshop.qml @@ -17,7 +17,7 @@ Item { id: screenPlayWorkshop Component.onCompleted: { if (screenPlayWorkshop.init()) { - stackView.push("qrc:/ScreenPlay/qml/Workshop/SteamWorkshopStartPage.qml", { + stackView.push("qrc:/ScreenPlayQml/qml/Workshop/SteamWorkshopStartPage.qml", { "stackView": stackView, "screenPlayWorkshop": screenPlayWorkshop, "steamWorkshop": screenPlayWorkshop.steamWorkshop, diff --git a/ScreenPlay/qml/Workshop/SteamWorkshopStartPage.qml b/ScreenPlay/qml/Workshop/SteamWorkshopStartPage.qml index 546735f5..ba2a06be 100644 --- a/ScreenPlay/qml/Workshop/SteamWorkshopStartPage.qml +++ b/ScreenPlay/qml/Workshop/SteamWorkshopStartPage.qml @@ -276,7 +276,7 @@ Item { text: qsTr("Profile") onClicked: { stackView.push( - "qrc:/ScreenPlay/qml/Workshop/SteamProfile.qml", { + "qrc:/ScreenPlayQml/qml/Workshop/SteamProfile.qml", { "screenPlayWorkshop": root.screenPlayWorkshop, "steamWorkshop": root.steamWorkshop }) @@ -295,7 +295,7 @@ Item { text: qsTr("Upload") onClicked: { stackView.push( - "qrc:/ScreenPlay/qml/Workshop/upload/UploadProject.qml", { + "qrc:/ScreenPlayQml/qml/Workshop/upload/UploadProject.qml", { "screenPlayWorkshop": root.screenPlayWorkshop, "steamWorkshop": root.steamWorkshop }) diff --git a/ScreenPlay/qml/Workshop/Workshop.qml b/ScreenPlay/qml/Workshop/Workshop.qml index 3512dd63..5fb94c84 100644 --- a/ScreenPlay/qml/Workshop/Workshop.qml +++ b/ScreenPlay/qml/Workshop/Workshop.qml @@ -9,16 +9,16 @@ import ScreenPlay Item { id: root - required property Item modalSource + property Item modalSource Component.onCompleted: { if (ScreenPlay.settings.steamVersion) { workshopLoader.setSource( - "qrc:/ScreenPlay/qml/Workshop/SteamWorkshop.qml", { + "qrc:/ScreenPlayQml/qml/Workshop/SteamWorkshop.qml", { "modalSource": modalSource }) } else { - workshopLoader.setSource("qrc:/ScreenPlay/qml/Workshop/Forum.qml") + workshopLoader.setSource("qrc:/ScreenPlayQml/qml/Workshop/Forum.qml") } } diff --git a/ScreenPlay/qml/Workshop/WorkshopInstalled.qml b/ScreenPlay/qml/Workshop/WorkshopInstalled.qml index dc644c69..b45f11be 100644 --- a/ScreenPlay/qml/Workshop/WorkshopInstalled.qml +++ b/ScreenPlay/qml/Workshop/WorkshopInstalled.qml @@ -35,7 +35,7 @@ Item { active: false z: 99 anchors.fill: parent - source: "qrc:/ScreenPlay/qml/Installed/InstalledUserHelper.qml" + source: "qrc:/ScreenPlayQml/qml/Installed/InstalledUserHelper.qml" } transitions: [ diff --git a/ScreenPlayWallpaper/src/basewindow.cpp b/ScreenPlayWallpaper/src/basewindow.cpp index 396e782a..28f1f644 100644 --- a/ScreenPlayWallpaper/src/basewindow.cpp +++ b/ScreenPlayWallpaper/src/basewindow.cpp @@ -60,7 +60,7 @@ BaseWindow::BaseWindow( if (projectFilePath == "test") { setType(ScreenPlay::InstalledType::InstalledType::QMLWallpaper); - setProjectSourceFileAbsolute({ "qrc:/ScreenPlayWallpaper/qml/Test.qml" }); + setProjectSourceFileAbsolute({ "qrc:/ScreenPlayQmlWallpaper/qml/Test.qml" }); setupLiveReloading(); return; }