From b0eac04ff90b1183b2107d6ea810744517e43d5c Mon Sep 17 00:00:00 2001 From: Elias Steurer Date: Fri, 21 May 2021 12:54:41 +0200 Subject: [PATCH 1/3] Remove old files entries --- CMakeLists.txt | 1 - ScreenPlay/CMakeLists.txt | 3 --- 2 files changed, 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 45219ad5..e9ead731 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,7 +35,6 @@ else() endif() set(VCPKG_INSTALLED_PATH "${VCPKG_PATH}/installed/${VCPKG_ARCH}") -set(QT_TELEMTRY_INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/Common/qt-google-analytics/) find_package(Git REQUIRED) if(WIN32) diff --git a/ScreenPlay/CMakeLists.txt b/ScreenPlay/CMakeLists.txt index 851079c0..af377ef7 100644 --- a/ScreenPlay/CMakeLists.txt +++ b/ScreenPlay/CMakeLists.txt @@ -115,9 +115,6 @@ target_link_libraries( if(WIN32) target_link_libraries(${PROJECT_NAME} PRIVATE sentry::sentry) endif() - -target_include_directories(${PROJECT_NAME} PRIVATE ${QT_TELEMTRY_INCLUDE}) - file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/bin/assets/fonts) configure_file(assets/fonts/NotoSansCJKkr-Regular.otf ${CMAKE_BINARY_DIR}/bin/assets/fonts COPYONLY) From 8c344b7c3dcb437f408782a185914e29c41653f8 Mon Sep 17 00:00:00 2001 From: Elias Steurer Date: Sun, 23 May 2021 17:23:59 +0200 Subject: [PATCH 2/3] Remove explicit workshop loading This does not really make sense because it (und)loaded the plugin twice and cause crashes on macos. The new version now lets the QML engine handle the lifetime. --- .gitlab-ci.yml | 4 +- ScreenPlay/Resources.qrc | 1 + ScreenPlay/app.cpp | 47 +---- ScreenPlay/app.h | 3 +- .../assets/icons/steam_default_avatar.png | Bin 0 -> 19559 bytes ScreenPlay/main.qml | 15 -- ScreenPlay/qml/Workshop/Background.qml | 2 +- ScreenPlay/qml/Workshop/Navigation.qml | 27 +-- ScreenPlay/qml/Workshop/PopupOffline.qml | 2 +- ScreenPlay/qml/Workshop/Sidebar.qml | 2 +- ScreenPlay/qml/Workshop/Workshop.qml | 195 +++++++++--------- ScreenPlay/qml/Workshop/WorkshopInstalled.qml | 2 +- ScreenPlay/qml/Workshop/WorkshopItem.qml | 2 +- .../upload/PopupSteamWorkshopAgreement.qml | 2 +- .../qml/Workshop/upload/UploadProject.qml | 51 ++--- .../qml/Workshop/upload/UploadProjectItem.qml | 1 - 16 files changed, 136 insertions(+), 220 deletions(-) create mode 100644 ScreenPlay/assets/icons/steam_default_avatar.png diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 913e0714..d9c499cc 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -13,8 +13,8 @@ check: script: - cd Tools - pip install cmakelang - - python format-cmake.py - - python format-cpp.py + - python format_cmake.py + - python format_cpp.py build:windows_debug: stage: build diff --git a/ScreenPlay/Resources.qrc b/ScreenPlay/Resources.qrc index fb87c206..7e0f5a9b 100644 --- a/ScreenPlay/Resources.qrc +++ b/ScreenPlay/Resources.qrc @@ -138,5 +138,6 @@ assets/icons/icon_sort-up-solid.svg assets/icons/icon_sort-down-solid.svg assets/icons/brand_reddit.svg + assets/icons/steam_default_avatar.png diff --git a/ScreenPlay/app.cpp b/ScreenPlay/app.cpp index 782cdb1a..e4d09969 100644 --- a/ScreenPlay/app.cpp +++ b/ScreenPlay/app.cpp @@ -58,7 +58,7 @@ App::App() QGuiApplication::setOrganizationName("ScreenPlay"); QGuiApplication::setOrganizationDomain("https://screen-play.app"); QGuiApplication::setApplicationName("ScreenPlay"); - QGuiApplication::setApplicationVersion("0.13.2"); + QGuiApplication::setApplicationVersion("0.13.3"); QGuiApplication::setQuitOnLastWindowClosed(false); QFontDatabase::addApplicationFont(":/assets/fonts/LibreBaskerville-Italic.ttf"); @@ -216,49 +216,4 @@ void App::exit() QApplication::instance()->quit(); } -/*! - \brief Loads the Steam plugin when needed. This enables to start ScreenPlay - via OS autostart without waiting for Steam first. -*/ -bool App::loadSteamPlugin() -{ - -#ifdef Q_OS_MACOS -#ifdef QT_NO_DEBUG - const QString fileSuffix = ".dylib"; -#else - const QString fileSuffix = "d.dylib"; -#endif -#endif - -#ifdef Q_OS_WIN -#ifdef QT_NO_DEBUG - const QString fileSuffix = ".dll"; -#else - const QString fileSuffix = "d.dll"; -#endif -#endif - -#ifdef Q_OS_LINUX - const QString fileSuffix = ".so"; -#endif - - m_workshopPlugin.setFileName(QApplication::applicationDirPath() + "/ScreenPlayWorkshop" + fileSuffix); - - if (!m_workshopPlugin.load()) { - qWarning() << "Steam plugin not provided!" << QApplication::applicationDirPath() + "/ScreenPlayWorkshop" + fileSuffix; - qWarning() << m_workshopPlugin.fileName() << " - With error: " << m_workshopPlugin.errorString(); - return false; - } - - const ScreenPlayWorkshopPlugin* workshopPlugin = reinterpret_cast(m_workshopPlugin.instance()); - Q_UNUSED(workshopPlugin) - settings()->setSteamVersion(true); - return true; -} - -bool App::unloadSteamPlugin() -{ - return m_workshopPlugin.unload(); -} } diff --git a/ScreenPlay/app.h b/ScreenPlay/app.h index c5ae44a7..2bccbdd8 100644 --- a/ScreenPlay/app.h +++ b/ScreenPlay/app.h @@ -36,6 +36,7 @@ #include #include +#include #include #include #include @@ -119,8 +120,6 @@ signals: public slots: QString version() const; void exit(); - bool loadSteamPlugin(); - bool unloadSteamPlugin(); void setGlobalVariables(GlobalVariables* globalVariables) { diff --git a/ScreenPlay/assets/icons/steam_default_avatar.png b/ScreenPlay/assets/icons/steam_default_avatar.png new file mode 100644 index 0000000000000000000000000000000000000000..8c45c9c175b932e218cea6c576559cc196192a59 GIT binary patch literal 19559 zcmeI4c{r3^{QvJ(`;siF$d-^Xi>(=hGWLDV)?&$&VwH;?z*;~0Km3+`EL!7bZH9!u$quD7*kUx3YFsN zL~$3Jz_ z8@M%@lHbHs!OR}7D{rP4z@Digyy?y9+Q&7$eR6vPStZ;7ZsvTvsON(C8erBRjovL* z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Q4RQcFh%lS>_!cPBh&H> zNOSVdusD1;Z{bcrY)x%#$e6ZB+;wXU3yb~xB~in#%T9pf8tlkRAP`Q>jPVIw(3NoO zx-Z&_=B|svlSr4*KIVh@Z}lo2+}+*Jo3dBBC@Cu_Fn9N;OY=t-6c*|$Z3~_#FFo`z zf^RpK-No5C_WeP4+I(;)IA6L^8@0uv>l2{$%A&y&JK~{-{rjG5^20TysLV`{SZhRI zu69KFeYyAa`haoDr%#_idiqF6@Pr9?(LV05Udt>rG_>)uI&|b7cU_Om%iC!W9@y1Z zjE|4!lbZB>o{Pqvx@(v7#n|ZWxHkraId!W1aV$pa)VMbqm763L;n70F7!^H!qpa-Ul=PP1n681_;8fuin(liV zd*g=W>G`!=(xg1!KYNu=iW#)Kk~#;Wmw#_M*bVt)qVjoAPRz=^GdnK<9^AGdhbX z;9|=z6!BcEP{nKP$@qDQ#wN+BdKoTZG;HF4Ac}XiXOD>l&&0w%QfW@<3mIKkn+L&U zVcDQATAT04Lg>)@)Ol~!&akpSJdT<;)B`h zy@q+i@{aRuuc>%Bdx-1hweQMbd;z9^l+kqs=$&E*0(^N2vB}n2%m1%IPs>;{SHmIb Fe*iZz*j4}l literal 0 HcmV?d00001 diff --git a/ScreenPlay/main.qml b/ScreenPlay/main.qml index d6597b38..e47ac1ca 100644 --- a/ScreenPlay/main.qml +++ b/ScreenPlay/main.qml @@ -32,27 +32,12 @@ ApplicationWindow { } function switchPage(name) { - const unloadSteamPlugin = nav.currentNavigationName === "Workshop"; if (nav.currentNavigationName === name) { if (name === "Installed") ScreenPlay.installedListModel.reset(); - return ; - } - if (name === "Workshop") { - if (!ScreenPlay.settings.steamVersion) { - const steamAvialable = ScreenPlay.loadSteamPlugin(); - if (!steamAvialable) { - dialogSteam.open(); - switchPage("Installed"); - return ; - } - } } stackView.replace("qrc:/qml/" + name + "/" + name + ".qml"); - if (unloadSteamPlugin) - ScreenPlay.unloadSteamPlugin(); - sidebar.state = "inactive"; } diff --git a/ScreenPlay/qml/Workshop/Background.qml b/ScreenPlay/qml/Workshop/Background.qml index 12beaafb..6c23240c 100644 --- a/ScreenPlay/qml/Workshop/Background.qml +++ b/ScreenPlay/qml/Workshop/Background.qml @@ -1,6 +1,6 @@ import QtQuick 2.13 import QtGraphicalEffects 1.0 -import ScreenPlay.Workshop 1.0 +import Workshop 1.0 Rectangle { id: root diff --git a/ScreenPlay/qml/Workshop/Navigation.qml b/ScreenPlay/qml/Workshop/Navigation.qml index e1925bda..ac19f25e 100644 --- a/ScreenPlay/qml/Workshop/Navigation.qml +++ b/ScreenPlay/qml/Workshop/Navigation.qml @@ -3,16 +3,15 @@ import QtQuick.Controls 2.13 import QtQuick.Controls.Material 2.13 import QtGraphicalEffects 1.0 import QtQuick.Controls.Material.impl 2.12 -import ScreenPlay.Workshop 1.0 -import SteamQMLImageProvider 1.0 +import Workshop 1.0 import ScreenPlay 1.0 Rectangle { id: root - property SteamWorkshop steamWorkshop + property SteamWorkshop steam - signal uploadPressed() + signal uploadPressed implicitWidth: 800 height: 50 @@ -39,7 +38,8 @@ Rectangle { verticalAlignment: Qt.AlignVCenter wrapMode: Text.WrapAtWordBoundaryOrAnywhere text: { - return steamWorkshop.steamAccount.username + qsTr(" Subscribed items: ") + steamWorkshop.steamAccount.amountSubscribedItems; + return steam.steamAccount.username + qsTr( + " Subscribed items: ") + steam.steamAccount.amountSubscribedItems } anchors { @@ -50,7 +50,6 @@ Rectangle { right: btnUplaod.left rightMargin: 10 } - } SteamImage { @@ -59,7 +58,7 @@ Rectangle { width: 30 height: 30 Component.onCompleted: { - steamWorkshop.steamAccount.loadAvatar(); + steam.steamAccount.loadAvatar() } anchors { @@ -70,12 +69,18 @@ Rectangle { Connections { function onAvatarChanged(_avatar) { - avatar.setImage(_avatar); + avatar.setImage(_avatar) + avatarPlaceholder.opacity = 0 } - target: steamWorkshop.steamAccount + target: steam.steamAccount } + } + Image { + id: avatarPlaceholder + anchors.fill: avatar + source: "qrc:/assets/icons/steam_default_avatar.png" } Button { @@ -93,9 +98,7 @@ Rectangle { right: parent.right rightMargin: 10 } - } - } states: [ @@ -106,7 +109,6 @@ Rectangle { target: bg radius: 3 } - }, State { name: "scrolling" @@ -115,7 +117,6 @@ Rectangle { target: bg radius: 0 } - } ] } diff --git a/ScreenPlay/qml/Workshop/PopupOffline.qml b/ScreenPlay/qml/Workshop/PopupOffline.qml index 899c73fe..f6c0167c 100644 --- a/ScreenPlay/qml/Workshop/PopupOffline.qml +++ b/ScreenPlay/qml/Workshop/PopupOffline.qml @@ -2,7 +2,7 @@ import QtQuick 2.0 import QtQuick.Controls 2.13 import QtQuick.Controls.Material 2.13 import QtGraphicalEffects 1.0 -import ScreenPlay.Workshop 1.0 +import Workshop 1.0 import ScreenPlay 1.0 Popup { diff --git a/ScreenPlay/qml/Workshop/Sidebar.qml b/ScreenPlay/qml/Workshop/Sidebar.qml index 596990e6..e970dba4 100644 --- a/ScreenPlay/qml/Workshop/Sidebar.qml +++ b/ScreenPlay/qml/Workshop/Sidebar.qml @@ -4,7 +4,7 @@ import QtQuick.Controls 2.3 import QtQuick.Layouts 1.11 import QtWebEngine 1.8 import QtQuick.Controls.Material 2.2 -import ScreenPlay.Workshop 1.0 +import Workshop 1.0 import ScreenPlay 1.0 Drawer { diff --git a/ScreenPlay/qml/Workshop/Workshop.qml b/ScreenPlay/qml/Workshop/Workshop.qml index 2ad6c0c8..9d22d842 100644 --- a/ScreenPlay/qml/Workshop/Workshop.qml +++ b/ScreenPlay/qml/Workshop/Workshop.qml @@ -3,8 +3,7 @@ import QtQuick.Controls 2.13 import QtQuick.Controls.Material 2.13 import QtGraphicalEffects 1.0 import QtQuick.Layouts 1.12 -import ScreenPlay.Workshop 1.0 -import ScreenPlay.Workshop.SteamEnums 1.0 +import Workshop 1.0 import ScreenPlay 1.0 import "upload/" import "../Common" as Common @@ -12,19 +11,21 @@ import "../Common" as Common Item { id: root - property alias steamWorkshop: screenPlayWorkshop.steamWorkshop + ScreenPlayWorkshop { + id: workshop + property alias steam: workshop.steamWorkshop + } - state: "base" onVisibleChanged: { if (!visible) - sidebar.close(); - + sidebar.close() } Component.onCompleted: { - if (steamWorkshop.online) - steamWorkshop.searchWorkshop(SteamEnums.K_EUGCQuery_RankedByTrend); + if (workshop.steam.online) + workshop.steam.searchWorkshop( + SteamEnums.K_EUGCQuery_RankedByTrend) else - popupOffline.open(); + popupOffline.open() } MouseArea { @@ -37,19 +38,16 @@ Item { preventStealing: true } - ScreenPlayWorkshop { - id: screenPlayWorkshop - } - Connections { function onWorkshopSearched() { - bannerTxt.text = steamWorkshop.workshopListModel.getBannerText(); - background.backgroundImage = steamWorkshop.workshopListModel.getBannerUrl(); - banner.bannerPublishedFileID = steamWorkshop.workshopListModel.getBannerID(); - bannerTxtUnderline.numberSubscriber = steamWorkshop.workshopListModel.getBannerAmountSubscriber(); + bannerTxt.text = workshop.steam.workshopListModel.getBannerText() + background.backgroundImage = workshop.steam.workshopListModel.getBannerUrl() + banner.bannerPublishedFileID = workshop.steam.workshopListModel.getBannerID() + bannerTxtUnderline.numberSubscriber + = workshop.steam.workshopListModel.getBannerAmountSubscriber() } - target: steamWorkshop + target: workshop.steam } Background { @@ -65,8 +63,7 @@ Item { UploadProject { id: popupUploadProject - steamWorkshop: steamWorkshop - workshop: screenPlayWorkshop + screenPlayWorkshop: workshop } PopupSteamWorkshopAgreement { @@ -75,16 +72,16 @@ Item { Connections { function onUserNeedsToAcceptWorkshopLegalAgreement() { - popupSteamWorkshopAgreement.open(); + popupSteamWorkshopAgreement.open() } - target: steamWorkshop.uploadListModel + target: workshop.steam.uploadListModel } Navigation { id: nav - steamWorkshop: steamWorkshop + steam: workshop.steam z: 3 onUploadPressed: popupUploadProject.open() @@ -93,7 +90,6 @@ Item { right: parent.right left: parent.left } - } Flickable { @@ -105,13 +101,9 @@ Item { onContentYChanged: { // Calculate parallax scrolling if (contentY >= 0) - background.imageOffsetTop = (contentY * -0.4); + background.imageOffsetTop = (contentY * -0.4) else - background.imageOffsetTop = 0; - if (contentY >= (header.height)) - root.state = "scrolling"; - else - root.state = "base"; + background.imageOffsetTop = 0 } Item { @@ -150,7 +142,6 @@ Item { left: parent.left bottom: parent.bottom } - } ColumnLayout { @@ -194,8 +185,10 @@ Item { Material.foreground: "white" icon.source: "qrc:/assets/icons/icon_download.svg" onClicked: { - text = qsTr("Downloading..."); - steamWorkshop.subscribeItem(steamWorkshop.workshopListModel.getBannerID()); + text = qsTr("Downloading...") + workshop.steam.subscribeItem( + workshop.steam.workshopListModel.getBannerID( + )) } } @@ -206,14 +199,18 @@ Item { icon.source: "qrc:/assets/icons/icon_info.svg" visible: false onClicked: { - sidebar.setWorkshopItem(publishedFileID, imgUrl, additionalPreviewUrl, subscriptionCount); + sidebar.setWorkshopItem(publishedFileID, + imgUrl, + additionalPreviewUrl, + subscriptionCount) } } - } MouseArea { - onClicked: Qt.openUrlExternally("steam://url/CommunityFilePage/" + banner.bannerPublishedFileID) + onClicked: Qt.openUrlExternally( + "steam://url/CommunityFilePage/" + + banner.bannerPublishedFileID) height: 30 width: bannerTxtOpenInSteam.paintedWidth cursorShape: Qt.PointingHandCursor @@ -229,13 +226,9 @@ Item { font.family: ScreenPlay.settings.font font.weight: Font.Thin } - } - } - } - } GridView { @@ -247,7 +240,7 @@ Item { cellHeight: 190 height: contentHeight interactive: false - model: steamWorkshop.workshopListModel + model: workshop.steam.workshopListModel boundsBehavior: Flickable.StopAtBounds anchors { @@ -285,9 +278,6 @@ Item { TextField { id: tiSearch - - leftPadding: 25 - selectByMouse: true placeholderText: qsTr("Search for Wallpaper and Widgets...") onTextChanged: timerSearch.restart() @@ -303,9 +293,9 @@ Item { id: timerSearch interval: 500 - onTriggered: steamWorkshop.searchWorkshopByText(tiSearch.text) + onTriggered: workshop.steam.searchWorkshopByText( + tiSearch.text) } - } Image { @@ -320,7 +310,6 @@ Item { bottom: parent.bottom bottomMargin: 22 } - } ToolButton { @@ -335,9 +324,7 @@ Item { bottom: parent.bottom bottomMargin: 10 } - } - } RowLayout { @@ -360,7 +347,8 @@ Item { text: qsTr("Open Workshop in Steam") font.capitalization: Font.Capitalize font.family: ScreenPlay.settings.font - onClicked: Qt.openUrlExternally("steam://url/SteamWorkshopPage/672870") + onClicked: Qt.openUrlExternally( + "steam://url/SteamWorkshopPage/672870") icon.source: "qrc:/assets/icons/icon_steam.svg" icon.width: 18 icon.height: 18 @@ -371,13 +359,13 @@ Item { text: qsTr("Open GameHub in Steam") font.capitalization: Font.Capitalize font.family: ScreenPlay.settings.font - onClicked: Qt.openUrlExternally("steam://url/GameHub/672870") + onClicked: Qt.openUrlExternally( + "steam://url/GameHub/672870") icon.source: "qrc:/assets/icons/icon_steam.svg" icon.width: 18 icon.height: 18 height: cbQuerySort.height } - } ComboBox { @@ -391,38 +379,39 @@ Item { Layout.preferredHeight: searchWrapper.height font.family: ScreenPlay.settings.font model: [{ - "value": SteamEnums.k_EUGCQuery_RankedByVote, - "text": qsTr("Ranked By Vote") - }, { - "value": SteamEnums.K_EUGCQuery_RankedByPublicationDate, - "text": qsTr("Publication Date") - }, { - "value": SteamEnums.K_EUGCQuery_RankedByTrend, - "text": qsTr("Ranked By Trend") - }, { - "value": SteamEnums.K_EUGCQuery_FavoritedByFriendsRankedByPublicationDate, - "text": qsTr("Favorited By Friends") - }, { - "value": SteamEnums.K_EUGCQuery_CreatedByFriendsRankedByPublicationDate, - "text": qsTr("Created By Friends") - }, { - "value": SteamEnums.K_EUGCQuery_CreatedByFollowedUsersRankedByPublicationDate, - "text": qsTr("Created By Followed Users") - }, { - "value": SteamEnums.K_EUGCQuery_NotYetRated, - "text": qsTr("Not Yet Rated") - }, { - "value": SteamEnums.K_EUGCQuery_RankedByTotalVotesAsc, - "text": qsTr("Total VotesAsc") - }, { - "value": SteamEnums.K_EUGCQuery_RankedByVotesUp, - "text": qsTr("Votes Up") - }, { - "value": SteamEnums.K_EUGCQuery_RankedByTotalUniqueSubscriptions, - "text": qsTr("Total Unique Subscriptions") - }] + "value": SteamEnums.k_EUGCQuery_RankedByVote, + "text": qsTr("Ranked By Vote") + }, { + "value": SteamEnums.K_EUGCQuery_RankedByPublicationDate, + "text": qsTr("Publication Date") + }, { + "value": SteamEnums.K_EUGCQuery_RankedByTrend, + "text": qsTr("Ranked By Trend") + }, { + "value": SteamEnums.K_EUGCQuery_FavoritedByFriendsRankedByPublicationDate, + "text": qsTr("Favorited By Friends") + }, { + "value": SteamEnums.K_EUGCQuery_CreatedByFriendsRankedByPublicationDate, + "text": qsTr("Created By Friends") + }, { + "value": SteamEnums.K_EUGCQuery_CreatedByFollowedUsersRankedByPublicationDate, + "text": qsTr("Created By Followed Users") + }, { + "value": SteamEnums.K_EUGCQuery_NotYetRated, + "text": qsTr("Not Yet Rated") + }, { + "value": SteamEnums.K_EUGCQuery_RankedByTotalVotesAsc, + "text": qsTr("Total VotesAsc") + }, { + "value": SteamEnums.K_EUGCQuery_RankedByVotesUp, + "text": qsTr("Votes Up") + }, { + "value": SteamEnums.K_EUGCQuery_RankedByTotalUniqueSubscriptions, + "text": qsTr("Total Unique Subscriptions") + }] onActivated: { - steamWorkshop.searchWorkshop(cbQuerySort.currentValue); + workshop.steam.searchWorkshop( + cbQuerySort.currentValue) } anchors { @@ -430,11 +419,8 @@ Item { right: parent.right rightMargin: 10 } - } - } - } delegate: WorkshopItem { @@ -444,9 +430,11 @@ Item { additionalPreviewUrl: m_additionalPreviewUrl subscriptionCount: m_subscriptionCount itemIndex: index - steamWorkshop: root.steamWorkshop + steamWorkshop: workshop.steamWorkshop onClicked: { - sidebar.setWorkshopItem(publishedFileID, imgUrl, additionalPreviewUrl, subscriptionCount); + sidebar.setWorkshopItem(publishedFileID, imgUrl, + additionalPreviewUrl, + subscriptionCount) } } @@ -470,10 +458,12 @@ Item { Layout.alignment: Qt.AlignVCenter text: qsTr("Back") - enabled: steamWorkshop.workshopListModel.currentPage > 1 + enabled: workshop.steam.workshopListModel.currentPage > 1 onClicked: { - steamWorkshop.workshopListModel.setCurrentPage(steamWorkshop.workshopListModel.currentPage - 1); - steamWorkshop.searchWorkshop(SteamEnums.K_EUGCQuery_RankedByTrend); + workshop.steam.workshopListModel.setCurrentPage( + workshop.steam.workshopListModel.currentPage - 1) + workshop.steam.searchWorkshop( + SteamEnums.K_EUGCQuery_RankedByTrend) } } @@ -481,7 +471,8 @@ Item { id: txtPage Layout.alignment: Qt.AlignVCenter - text: steamWorkshop.workshopListModel.currentPage + "/" + steamWorkshop.workshopListModel.pages + text: workshop.steam.workshopListModel.currentPage + + "/" + workshop.steam.workshopListModel.pages font.family: ScreenPlay.settings.font color: Material.primaryTextColor } @@ -491,19 +482,20 @@ Item { Layout.alignment: Qt.AlignVCenter text: qsTr("Forward") - enabled: steamWorkshop.workshopListModel.currentPage <= steamWorkshop.workshopListModel.pages - 1 + enabled: workshop.steam.workshopListModel.currentPage + <= workshop.steam.workshopListModel.pages - 1 onClicked: { - steamWorkshop.workshopListModel.setCurrentPage(steamWorkshop.workshopListModel.currentPage + 1); - steamWorkshop.searchWorkshop(SteamEnums.K_EUGCQuery_RankedByTrend); + workshop.steam.workshopListModel.setCurrentPage( + workshop.steam.workshopListModel.currentPage + 1) + workshop.steam.searchWorkshop( + SteamEnums.K_EUGCQuery_RankedByTrend) } } Item { Layout.fillWidth: true } - } - } Behavior on contentHeight { @@ -512,24 +504,21 @@ Item { property: "contentHeight" easing.type: Easing.InOutQuart } - } ScrollBar.vertical: ScrollBar { snapMode: ScrollBar.SnapOnRelease } - } Sidebar { id: sidebar topMargin: 60 - steamWorkshop: root.steamWorkshop + steamWorkshop: workshop.steamWorkshop onTagClicked: { - gridView.headerItem.searchField.text = tag; - sidebar.close(); + gridView.headerItem.searchField.text = tag + sidebar.close() } } - } diff --git a/ScreenPlay/qml/Workshop/WorkshopInstalled.qml b/ScreenPlay/qml/Workshop/WorkshopInstalled.qml index 0354a435..a77318a1 100644 --- a/ScreenPlay/qml/Workshop/WorkshopInstalled.qml +++ b/ScreenPlay/qml/Workshop/WorkshopInstalled.qml @@ -2,7 +2,7 @@ import QtQuick 2.12 import QtQuick.Controls 2.3 import QtQuick.Controls.Styles 1.4 import QtGraphicalEffects 1.0 -import ScreenPlay.Workshop 1.0 as SP +import Workshop 1.0 as SP Item { id: pageInstalled diff --git a/ScreenPlay/qml/Workshop/WorkshopItem.qml b/ScreenPlay/qml/Workshop/WorkshopItem.qml index 183ec942..2aa85e82 100644 --- a/ScreenPlay/qml/Workshop/WorkshopItem.qml +++ b/ScreenPlay/qml/Workshop/WorkshopItem.qml @@ -2,7 +2,7 @@ import QtQuick 2.12 import QtGraphicalEffects 1.0 import QtQuick.Controls 2.3 import QtQuick.Controls.Material 2.2 -import ScreenPlay.Workshop 1.0 +import Workshop 1.0 import ScreenPlay 1.0 Item { diff --git a/ScreenPlay/qml/Workshop/upload/PopupSteamWorkshopAgreement.qml b/ScreenPlay/qml/Workshop/upload/PopupSteamWorkshopAgreement.qml index 6759d1ab..e48eb754 100644 --- a/ScreenPlay/qml/Workshop/upload/PopupSteamWorkshopAgreement.qml +++ b/ScreenPlay/qml/Workshop/upload/PopupSteamWorkshopAgreement.qml @@ -2,7 +2,7 @@ import QtQuick 2.12 import QtQuick.Controls 2.12 import QtQuick.Controls.Material 2.12 import QtQuick.Layouts 1.12 -import ScreenPlay.Workshop 1.0 as SP +import Workshop 1.0 as SP import ScreenPlay 1.0 import "../../Common" diff --git a/ScreenPlay/qml/Workshop/upload/UploadProject.qml b/ScreenPlay/qml/Workshop/upload/UploadProject.qml index 2593c64c..888caabd 100644 --- a/ScreenPlay/qml/Workshop/upload/UploadProject.qml +++ b/ScreenPlay/qml/Workshop/upload/UploadProject.qml @@ -2,14 +2,14 @@ import QtQuick 2.12 import QtQuick.Controls 2.12 import QtQuick.Controls.Material 2.12 import QtQuick.Layouts 1.12 -import ScreenPlay.Workshop 1.0 +import Workshop 1.0 import ScreenPlay 1.0 Popup { id: root - property SteamWorkshop steamWorkshop - property ScreenPlayWorkshop workshop + property ScreenPlayWorkshop screenPlayWorkshop + property SteamWorkshop steam: screenPlayWorkshop.steamWorkshop width: 1200 height: 700 @@ -28,7 +28,7 @@ Popup { Connections { function onRequestClosePopup() { - root.close(); + root.close() } target: uploadLoader.item @@ -40,7 +40,7 @@ Popup { Item { id: wrapper - signal requestClosePopup() + signal requestClosePopup Item { id: headerWrapper @@ -67,9 +67,7 @@ Popup { top: parent.top horizontalCenter: parent.horizontalCenter } - } - } SwipeView { @@ -99,7 +97,7 @@ Popup { cellWidth: parent.width cellHeight: 250 clip: true - model: workshop.installedListModel + model: screenPlayWorkshop.installedListModel anchors { top: parent.top @@ -124,11 +122,11 @@ Popup { onItemClicked: { for (let childItem in gridView.contentItem.children) { if (gridView.contentItem.children[childItem].isSelected) { - btnUploadProjects.enabled = true; - return ; + btnUploadProjects.enabled = true + return } } - btnUploadProjects.enabled = false; + btnUploadProjects.enabled = false } } @@ -136,7 +134,6 @@ Popup { snapMode: ScrollBar.SnapOnRelease policy: ScrollBar.AlwaysOn } - } Button { @@ -144,7 +141,7 @@ Popup { text: qsTr("Abort") onClicked: { - wrapper.requestClosePopup(); + wrapper.requestClosePopup() } anchors { @@ -152,7 +149,6 @@ Popup { bottom: parent.bottom margins: 10 } - } Button { @@ -162,14 +158,14 @@ Popup { highlighted: true enabled: false onClicked: { - var uploadListArray = []; + var uploadListArray = [] for (let childItem in gridView.contentItem.children) { if (gridView.contentItem.children[childItem].isSelected) - uploadListArray.push(gridView.contentItem.children[childItem].absoluteStoragePath); - + uploadListArray.push( + gridView.contentItem.children[childItem].absoluteStoragePath) } - view.currentIndex = 1; - steamWorkshop.bulkUploadToWorkshop(uploadListArray); + view.currentIndex = 1 + steam.bulkUploadToWorkshop(uploadListArray) } anchors { @@ -177,9 +173,7 @@ Popup { bottom: parent.bottom margins: 10 } - } - } Item { @@ -193,7 +187,7 @@ Popup { flickDeceleration: 5000 cacheBuffer: 1000 clip: true - model: steamWorkshop.uploadListModel + model: steam.uploadListModel width: parent.width - 50 spacing: 25 @@ -214,7 +208,6 @@ Popup { ScrollBar.vertical: ScrollBar { snapMode: ScrollBar.SnapOnRelease } - } Button { @@ -224,7 +217,7 @@ Popup { highlighted: true enabled: false onClicked: { - root.close(); + root.close() } anchors { @@ -235,16 +228,13 @@ Popup { Connections { function onUploadCompleted() { - btnFinish.enabled = true; + btnFinish.enabled = true } - target: steamWorkshop.uploadListModel + target: steam.uploadListModel } - } - } - } PageIndicator { @@ -255,13 +245,10 @@ Popup { anchors.bottom: view.bottom anchors.horizontalCenter: parent.horizontalCenter } - } - } background: Rectangle { color: Material.theme === Material.Light ? "white" : Material.background } - } diff --git a/ScreenPlay/qml/Workshop/upload/UploadProjectItem.qml b/ScreenPlay/qml/Workshop/upload/UploadProjectItem.qml index cdfb53f3..cf92aa55 100644 --- a/ScreenPlay/qml/Workshop/upload/UploadProjectItem.qml +++ b/ScreenPlay/qml/Workshop/upload/UploadProjectItem.qml @@ -2,7 +2,6 @@ import QtQuick 2.13 import QtQuick.Controls 2.13 import QtGraphicalEffects 1.0 import QtQuick.Controls.Material 2.12 -import ScreenPlay.Workshop.SteamEnums 1.0 import QtQuick.Layouts 1.12 import QtQuick.Controls.Material.impl 2.12 From 2596c9700b2514caa4967ac96397180efc5c5c5e Mon Sep 17 00:00:00 2001 From: Elias Steurer Date: Sun, 23 May 2021 17:24:52 +0200 Subject: [PATCH 3/3] Remove explicit wigdet count workaround We now list to the pipe connection to make this behavior implicit. --- ScreenPlay/src/screenplaywidget.cpp | 1 - ScreenPlay/src/sdkconnection.h | 1 - 2 files changed, 2 deletions(-) diff --git a/ScreenPlay/src/screenplaywidget.cpp b/ScreenPlay/src/screenplaywidget.cpp index 8bfae4b2..1af492a9 100644 --- a/ScreenPlay/src/screenplaywidget.cpp +++ b/ScreenPlay/src/screenplaywidget.cpp @@ -83,7 +83,6 @@ void ScreenPlayWidget::setSDKConnection(std::unique_ptr connectio { m_connection = std::move(connection); qInfo() << "[3/3] SDKConnected (Widged) saved!"; - QObject::connect(m_connection.get(), &SDKConnection::requestDecreaseWidgetCount, this, [this]() { emit requestClose(appID()); }); QObject::connect(m_connection.get(), &SDKConnection::jsonMessageReceived, this, [this](const QJsonObject obj) { if (obj.value("messageType") == "positionUpdate") { setPosition({ obj.value("positionX").toInt(0), obj.value("positionY").toInt(0) }); diff --git a/ScreenPlay/src/sdkconnection.h b/ScreenPlay/src/sdkconnection.h index 3f4817da..74fbb572 100644 --- a/ScreenPlay/src/sdkconnection.h +++ b/ScreenPlay/src/sdkconnection.h @@ -82,7 +82,6 @@ signals: void appIDChanged(QString appID); void monitorChanged(QVector monitor); void typeChanged(QString type); - void requestDecreaseWidgetCount(); void requestRaise(); void appConnected(const ScreenPlay::SDKConnection* connection); void jsonMessageReceived(const QJsonObject obj);