From 83bb652132430318834aa099b4716c859f334233 Mon Sep 17 00:00:00 2001 From: Elias Steurer Date: Thu, 2 Feb 2023 15:25:26 +0100 Subject: [PATCH] Add tasks.json and format all files --- .vscode/tasks.json | 95 ++++++- ScreenPlay/CMakeLists.txt | 2 +- ScreenPlay/main.cpp | 2 +- ScreenPlay/main.qml | 245 ++++++++--------- ScreenPlay/qml/Community/Community.qml | 17 +- ScreenPlay/qml/Community/CommunityNavItem.qml | 4 - ScreenPlay/qml/Community/XMLNewsfeed.qml | 16 +- ScreenPlay/qml/Create/Create.qml | 9 - ScreenPlay/qml/Create/CreateSidebar.qml | 18 +- ScreenPlay/qml/Create/StartInfo.qml | 7 +- ScreenPlay/qml/Create/StartInfoLinkImage.qml | 11 +- ScreenPlay/qml/Create/Wizard.qml | 19 +- .../qml/Create/Wizards/GifWallpaper.qml | 8 +- .../qml/Create/Wizards/HTMLWallpaper.qml | 4 - ScreenPlay/qml/Create/Wizards/HTMLWidget.qml | 7 - .../ImportVideoAndConvert/CreateWallpaper.qml | 15 +- .../CreateWallpaperInit.qml | 12 +- .../CreateWallpaperResult.qml | 9 - .../CreateWallpaperVideoImportConvert.qml | 108 ++++---- .../Create/Wizards/ImportWebm/ImportWebm.qml | 10 +- .../Wizards/ImportWebm/ImportWebmConvert.qml | 19 +- .../Wizards/ImportWebm/ImportWebmInit.qml | 25 -- .../Create/Wizards/Importh264/Importh264.qml | 10 +- .../Wizards/Importh264/Importh264Convert.qml | 19 +- .../Wizards/Importh264/Importh264Init.qml | 24 +- .../qml/Create/Wizards/QMLWallpaper.qml | 4 - ScreenPlay/qml/Create/Wizards/QMLWidget.qml | 7 - .../qml/Create/Wizards/WebsiteWallpaper.qml | 3 - ScreenPlay/qml/Create/Wizards/WizardPage.qml | 16 +- .../Create/WizardsFiles/QMLWallpaperMain.qml | 1 - .../qml/Create/WizardsFiles/QMLWidgetMain.qml | 2 +- ScreenPlay/qml/Installed/Installed.qml | 152 +++++------ .../qml/Installed/InstalledNavigation.qml | 48 ++-- .../qml/Installed/InstalledWelcomeScreen.qml | 17 +- ScreenPlay/qml/Installed/ScreenPlayItem.qml | 35 ++- .../qml/Installed/ScreenPlayItemImage.qml | 6 - ScreenPlay/qml/Installed/Sidebar.qml | 116 +++----- .../qml/Monitors/DefaultVideoControls.qml | 38 ++- ScreenPlay/qml/Monitors/MonitorSelection.qml | 96 ++++--- .../qml/Monitors/MonitorSelectionItem.qml | 16 +- ScreenPlay/qml/Monitors/Monitors.qml | 58 ++-- .../Monitors/MonitorsProjectSettingItem.qml | 19 +- ScreenPlay/qml/Monitors/SaveNotification.qml | 3 - ScreenPlay/qml/Navigation/ExitPopup.qml | 21 +- ScreenPlay/qml/Navigation/Navigation.qml | 96 ++++--- ScreenPlay/qml/Settings/SettingBool.qml | 18 +- ScreenPlay/qml/Settings/Settings.qml | 98 ++++--- ScreenPlay/qml/Settings/SettingsButton.qml | 6 +- ScreenPlay/qml/Settings/SettingsComboBox.qml | 4 - ScreenPlay/qml/Settings/SettingsExpander.qml | 6 - ScreenPlay/qml/Settings/SettingsHeader.qml | 8 - .../Settings/SettingsHorizontalSeperator.qml | 2 - ScreenPlay/qml/Workshop/Workshop.qml | 9 +- ScreenPlay/src/app.cpp | 146 +++++----- ScreenPlayShader/src/ShadertoyShader.qml | 1 - ScreenPlayShader/src/TestMain.qml | 7 +- ScreenPlaySysInfo/qml/TestMain.qml | 16 +- ScreenPlayUtil/CMakeLists.txt | 10 +- ScreenPlayUtil/qml/Background.qml | 5 - ScreenPlayUtil/qml/CloseIcon.qml | 2 - ScreenPlayUtil/qml/ColorImage.qml | 2 - ScreenPlayUtil/qml/ColorPicker.qml | 57 +--- ScreenPlayUtil/qml/Dialogs/CriticalError.qml | 9 +- .../qml/Dialogs/MonitorConfiguration.qml | 2 +- ScreenPlayUtil/qml/FileSelector.qml | 10 +- ScreenPlayUtil/qml/Grow.qml | 3 - ScreenPlayUtil/qml/GrowIconLink.qml | 2 - ScreenPlayUtil/qml/Headline.qml | 2 - ScreenPlayUtil/qml/ImageSelector.qml | 11 - ScreenPlayUtil/qml/LicenseSelector.qml | 4 - ScreenPlayUtil/qml/RippleEffect.qml | 15 +- ScreenPlayUtil/qml/Search.qml | 3 - ScreenPlayUtil/qml/Shake.qml | 3 - ScreenPlayUtil/qml/Tag.qml | 3 - ScreenPlayUtil/qml/TagSelector.qml | 37 ++- ScreenPlayUtil/qml/TextField.qml | 15 +- ScreenPlayUtil/qml/TrayIcon.qml | 42 ++- ScreenPlayUtil/src/projectfile.cpp | 2 +- .../contents/ui/WaitingForScreenplay.qml | 56 ++-- .../kde/ScreenPlay/contents/ui/Wallpaper.qml | 68 +++-- .../contents/ui/WallpaperContainer.qml | 33 ++- .../kde/ScreenPlay/contents/ui/config.qml | 5 - .../kde/ScreenPlay/contents/ui/main.qml | 103 ++++---- ScreenPlayWallpaper/qml/MultimediaView.qml | 40 ++- ScreenPlayWallpaper/qml/MultimediaWebView.qml | 92 +++---- ScreenPlayWallpaper/qml/Test.qml | 35 ++- ScreenPlayWallpaper/qml/Wallpaper.qml | 250 ++++++++---------- ScreenPlayWallpaper/qml/WebsiteWallpaper.qml | 4 +- ScreenPlayWeather/qml/TestMain.qml | 78 +++--- ScreenPlayWidget/qml/Test.qml | 4 +- ScreenPlayWidget/qml/Widget.qml | 52 ++-- ScreenPlayWorkshop/qml/Background.qml | 18 +- ScreenPlayWorkshop/qml/Forum.qml | 4 +- ScreenPlayWorkshop/qml/Navigation.qml | 9 +- ScreenPlayWorkshop/qml/PopupOffline.qml | 7 +- ScreenPlayWorkshop/qml/ScreenPlayItem.qml | 16 -- .../qml/ScreenPlayItemImage.qml | 3 - ScreenPlayWorkshop/qml/Sidebar.qml | 82 +++--- ScreenPlayWorkshop/qml/SteamProfile.qml | 18 +- ScreenPlayWorkshop/qml/SteamWorkshop.qml | 17 +- .../qml/SteamWorkshopStartPage.qml | 197 ++++++-------- ScreenPlayWorkshop/qml/TestMain.qml | 22 +- ScreenPlayWorkshop/qml/Workshop.qml | 9 +- ScreenPlayWorkshop/qml/WorkshopItem.qml | 19 -- .../upload/PopupSteamWorkshopAgreement.qml | 4 - .../qml/upload/UploadProject.qml | 22 +- .../qml/upload/UploadProjectBigItem.qml | 11 - .../qml/upload/UploadProjectItem.qml | 16 +- 108 files changed, 1383 insertions(+), 1940 deletions(-) diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 23afb2ed..95f55792 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -12,6 +12,99 @@ "group": "build", "problemMatcher": [], "detail": "CMake template build task" - } + }, + { + "type": "process", + "label": "Format Cpp files", + "command": "python", + "group": { + "kind": "build", + "isDefault": true + }, + "options": { + "cwd": "${workspaceFolder}/Tools" + }, + "args": [ + "clang_format.py" + ] + }, + { + "type": "process", + "label": "Format CMake files", + "command": "python", + "group": { + "kind": "build", + "isDefault": true + }, + "options": { + "cwd": "${workspaceFolder}/Tools" + }, + "args": [ + "cmake_format.py" + ] + }, + { + "type": "process", + "label": "Format Qml files", + "command": "python", + "group": { + "kind": "build", + "isDefault": true + }, + "options": { + "cwd": "${workspaceFolder}/Tools" + }, + "args": [ + "qml_format.py" + ] + }, + { + "type": "process", + "label": "Run setup.py", + "command": "python", + "group": { + "kind": "build", + "isDefault": true + }, + "options": { + "cwd": "${workspaceFolder}/Tools" + }, + "args": [ + "setup.py" + ] + }, + { + "type": "process", + "label": "Export ScreenPlay release, with deploy and steam enabled", + "command": "python", + "group": { + "kind": "build", + "isDefault": true + }, + "options": { + "cwd": "${workspaceFolder}/Tools" + }, + "args": [ + "build.py", + "-type=release", + "-deploy_version", + "-steam" + ] + }, + { + "type": "process", + "label": "Update Qt *.ts translations", + "command": "python", + "group": { + "kind": "build", + "isDefault": true + }, + "options": { + "cwd": "${workspaceFolder}/Tools" + }, + "args": [ + "update_translations.py" + ] + } ] } \ No newline at end of file diff --git a/ScreenPlay/CMakeLists.txt b/ScreenPlay/CMakeLists.txt index 0ec85f19..2fe5969e 100644 --- a/ScreenPlay/CMakeLists.txt +++ b/ScreenPlay/CMakeLists.txt @@ -219,7 +219,6 @@ set(RESOURCES assets/startinfo/vscode.png assets/wizards/example_html.png assets/wizards/example_qml.png - assets/wizards/QmlProject.qmlproject assets/wizards/License_All_Rights_Reserved_1.0.txt assets/wizards/License_Apache_2.0.txt assets/wizards/License_CC0_1.0.txt @@ -227,6 +226,7 @@ set(RESOURCES assets/wizards/License_CC_Attribution-ShareAlike_4.0.txt assets/wizards/License_CC_Attribution_4.0.txt assets/wizards/License_GPL_3.0.txt + assets/wizards/QmlProject.qmlproject assets/WorkshopPreview.html legal/DataProtection.txt legal/gpl-3.0.txt diff --git a/ScreenPlay/main.cpp b/ScreenPlay/main.cpp index 29472edd..bb3daaa0 100644 --- a/ScreenPlay/main.cpp +++ b/ScreenPlay/main.cpp @@ -1,9 +1,9 @@ // SPDX-License-Identifier: LicenseRef-EliasSteurerTachiom OR AGPL-3.0-only #include "ScreenPlay/app.h" -#include #include #include +#include #include #if defined(Q_OS_WIN) diff --git a/ScreenPlay/main.qml b/ScreenPlay/main.qml index cabd6268..141dd9c3 100644 --- a/ScreenPlay/main.qml +++ b/ScreenPlay/main.qml @@ -20,40 +20,35 @@ ApplicationWindow { function setTheme(theme) { switch (theme) { case Settings.System: - root.Material.theme = Material.System - break + root.Material.theme = Material.System; + break; case Settings.Dark: - root.Material.theme = Material.Dark - break + root.Material.theme = Material.Dark; + break; case Settings.Light: - root.Material.theme = Material.Light - break + root.Material.theme = Material.Light; + break; } } function switchPage(name) { if (nav.currentNavigationName === name) { if (name === "Installed") - App.installedListModel.reset() + App.installedListModel.reset(); } - if (name === "Installed") { - stackView.replace( - "qrc:/qml/ScreenPlayApp/qml/Installed/Installed.qml", { - "sidebar": sidebar - }) - return + stackView.replace("qrc:/qml/ScreenPlayApp/qml/Installed/Installed.qml", { + "sidebar": sidebar + }); + return; } - stackView.replace( - "qrc:/qml/ScreenPlayApp/qml/" + name + "/" + name + ".qml", - { - "modalSource": content - }) - sidebar.state = "inactive" + stackView.replace("qrc:/qml/ScreenPlayApp/qml/" + name + "/" + name + ".qml", { + "modalSource": content + }); + 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 @@ -67,28 +62,23 @@ ApplicationWindow { Material.accent: Material.color(Material.Orange) onVisibilityChanged: { if (root.visibility === 2) - App.installedListModel.reset() + App.installedListModel.reset(); } - onClosing: (close) => { - close.accepted = false - - if (App.screenPlayManager.activeWallpaperCounter === 0 - && App.screenPlayManager.activeWidgetsCounter === 0) { - Qt.quit() + onClosing: close => { + close.accepted = false; + if (App.screenPlayManager.activeWallpaperCounter === 0 && App.screenPlayManager.activeWidgetsCounter === 0) { + Qt.quit(); } - - const alwaysMinimize = settings.value("alwaysMinimize", null) - if(alwaysMinimize === null){ - console.error("Unable to retreive alwaysMinimize setting") + 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 + if (alwaysMinimize === "true") { + root.hide(); + App.showDockIcon(false); + return; } - - exitDialog.open() + exitDialog.open(); } Labs.Settings { @@ -102,13 +92,13 @@ ApplicationWindow { } Component.onCompleted: { - setTheme(App.settings.theme) + setTheme(App.settings.theme); stackView.push("qrc:/qml/ScreenPlayApp/qml/Installed/Installed.qml", { - "sidebar": sidebar - }) - if (!App.settings.silentStart){ - App.showDockIcon(true) - root.show() + "sidebar": sidebar + }); + if (!App.settings.silentStart) { + App.showDockIcon(true); + root.show(); } } @@ -139,7 +129,7 @@ ApplicationWindow { Connections { function onThemeChanged(theme) { - setTheme(theme) + setTheme(theme); } target: App.settings @@ -147,7 +137,7 @@ ApplicationWindow { Connections { function onRequestNavigation(nav) { - switchPage(nav) + switchPage(nav); } target: App.util @@ -155,8 +145,8 @@ ApplicationWindow { Connections { function onRequestRaise() { - App.showDockIcon(true) - root.show() + App.showDockIcon(true); + root.show(); } target: App.screenPlayManager @@ -164,98 +154,97 @@ ApplicationWindow { Item { id: content - anchors.fill:parent + anchors.fill: parent + StackView { + id: stackView + objectName: "stackView" + property int duration: 300 - 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 + anchors { + top: nav.bottom + right: parent.right + bottom: parent.bottom + left: parent.left } - ScaleAnimator { - from: 0.8 - to: 1 - duration: stackView.duration - easing.type: Easing.InOutQuart + 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 + } } } - replaceExit: Transition { - OpacityAnimator { - from: 1 - to: 0 - duration: stackView.duration - easing.type: Easing.InOutQuart + Connections { + function onSetSidebarActive(active) { + if (active) + sidebar.state = "active"; + else + sidebar.state = "inactive"; } - ScaleAnimator { - from: 1 - to: 0.8 - duration: stackView.duration - easing.type: Easing.InOutQuart + 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 } } - } - Connections { - function onSetSidebarActive(active) { - if (active) - sidebar.state = "active" - else - sidebar.state = "inactive" - } + Navigation.Navigation { + id: nav + modalSource: content + anchors { + top: parent.top + right: parent.right + left: parent.left + } - 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) + onChangePage: function (name) { + monitors.close(); + switchPage(name); + } } } } -} diff --git a/ScreenPlay/qml/Community/Community.qml b/ScreenPlay/qml/Community/Community.qml index 9b6d67c5..08db5845 100644 --- a/ScreenPlay/qml/Community/Community.qml +++ b/ScreenPlay/qml/Community/Community.qml @@ -42,7 +42,6 @@ Item { Layout.fillWidth: true } - Button { text: qsTr("News") onClicked: Qt.openUrlExternally("https://screen-play.app/blog/") @@ -54,8 +53,7 @@ Item { Button { text: qsTr("Wiki") - onClicked: Qt.openUrlExternally( - "https://kelteseth.gitlab.io/ScreenPlayDocs/") + onClicked: Qt.openUrlExternally("https://kelteseth.gitlab.io/ScreenPlayDocs/") icon.source: "qrc:/qml/ScreenPlayApp/assets/icons/icon_help_center.svg" icon.width: 14 icon.height: 14 @@ -64,8 +62,7 @@ Item { Button { text: qsTr("Forum") - onClicked: Qt.openUrlExternally( - "https://forum.screen-play.app/") + onClicked: Qt.openUrlExternally("https://forum.screen-play.app/") icon.source: "qrc:/qml/ScreenPlayApp/assets/icons/icon_forum.svg" icon.width: 14 icon.height: 14 @@ -74,8 +71,7 @@ Item { Button { text: qsTr("Reddit") - onClicked: Qt.openUrlExternally( - "https://www.reddit.com/r/ScreenPlayApp/") + onClicked: Qt.openUrlExternally("https://www.reddit.com/r/ScreenPlayApp/") icon.source: "qrc:/qml/ScreenPlayApp/assets/icons/brand_reddit.svg" icon.width: 14 icon.height: 14 @@ -84,8 +80,7 @@ Item { Button { text: qsTr("Issue Tracker") - onClicked: Qt.openUrlExternally( - "https://gitlab.com/kelteseth/ScreenPlay/-/issues") + onClicked: Qt.openUrlExternally("https://gitlab.com/kelteseth/ScreenPlay/-/issues") icon.source: "qrc:/qml/ScreenPlayApp/assets/icons/icon_report_problem.svg" icon.width: 14 icon.height: 14 @@ -94,8 +89,7 @@ Item { Button { text: qsTr("Contribute") - onClicked: Qt.openUrlExternally( - "https://gitlab.com/kelteseth/ScreenPlay#general-contributing") + onClicked: Qt.openUrlExternally("https://gitlab.com/kelteseth/ScreenPlay#general-contributing") icon.source: "qrc:/qml/ScreenPlayApp/assets/icons/icon_supervisor_account.svg" icon.width: 14 icon.height: 14 @@ -115,7 +109,6 @@ Item { Layout.fillHeight: true Layout.fillWidth: true } - } } diff --git a/ScreenPlay/qml/Community/CommunityNavItem.qml b/ScreenPlay/qml/Community/CommunityNavItem.qml index 6c63c31c..e0b61d76 100644 --- a/ScreenPlay/qml/Community/CommunityNavItem.qml +++ b/ScreenPlay/qml/Community/CommunityNavItem.qml @@ -27,7 +27,6 @@ TabButton { right: txt.left verticalCenter: txt.verticalCenter } - } Text { @@ -63,12 +62,9 @@ TabButton { topMargin: 15 right: parent.right } - } - } background: Item { } - } diff --git a/ScreenPlay/qml/Community/XMLNewsfeed.qml b/ScreenPlay/qml/Community/XMLNewsfeed.qml index c5fc8acf..f7cf7a08 100644 --- a/ScreenPlay/qml/Community/XMLNewsfeed.qml +++ b/ScreenPlay/qml/Community/XMLNewsfeed.qml @@ -58,7 +58,6 @@ Item { name: "description" elementName: "description" } - } header: Item { @@ -82,9 +81,7 @@ Item { topMargin: 30 horizontalCenter: parent.horizontalCenter } - } - } delegate: Item { @@ -108,13 +105,11 @@ Item { source: image opacity: status === Image.Ready ? 1 : 0 - Behavior on opacity { + Behavior on opacity { PropertyAnimation { duration: 250 } - } - } LinearGradient { @@ -132,9 +127,7 @@ Item { position: 0 color: "transparent" } - } - } Text { @@ -153,7 +146,6 @@ Item { left: parent.left margins: 20 } - } Text { @@ -173,7 +165,6 @@ Item { left: parent.left leftMargin: 20 } - } MouseArea { @@ -184,7 +175,6 @@ Item { onEntered: delegate.state = "hover" onExited: delegate.state = "" } - } transitions: [ @@ -198,7 +188,6 @@ Item { from: 1 to: 1.05 } - }, Transition { from: "hover" @@ -210,7 +199,6 @@ Item { from: 1.05 to: 1 } - } ] } @@ -219,7 +207,5 @@ Item { snapMode: ScrollBar.SnapOnRelease policy: ScrollBar.AlwaysOn } - } - } diff --git a/ScreenPlay/qml/Create/Create.qml b/ScreenPlay/qml/Create/Create.qml index 327477d0..f9c9c296 100644 --- a/ScreenPlay/qml/Create/Create.qml +++ b/ScreenPlay/qml/Create/Create.qml @@ -29,7 +29,6 @@ Item { left: parent.left bottom: parent.bottom } - } Item { @@ -80,7 +79,6 @@ Item { duration: 400 easing.type: Easing.InOutQuart } - } pushExit: Transition { @@ -99,15 +97,12 @@ Item { duration: 400 easing.type: Easing.InOutQuart } - } - } layer.effect: ElevationEffect { elevation: 6 } - } states: [ @@ -119,7 +114,6 @@ Item { anchors.topMargin: wizardContentWrapper.anchors.margins opacity: 1 } - } ] transitions: [ @@ -141,11 +135,8 @@ Item { wizardContentWrapper.anchors.left = sidebar.right; } } - } - } ] } - } diff --git a/ScreenPlay/qml/Create/CreateSidebar.qml b/ScreenPlay/qml/Create/CreateSidebar.qml index 86a9a10b..bf1ef42b 100644 --- a/ScreenPlay/qml/Create/CreateSidebar.qml +++ b/ScreenPlay/qml/Create/CreateSidebar.qml @@ -37,15 +37,15 @@ Rectangle { id: loaderConnections function onWizardStarted() { - root.expanded = false + root.expanded = false; } function onWizardExited() { - root.expanded = true - stackView.clear(StackView.PushTransition) - stackView.push("qrc:/qml/ScreenPlayApp/qml/Create/StartInfo.qml") - listView.currentIndex = 0 - App.util.setNavigationActive(true) + root.expanded = true; + stackView.clear(StackView.PushTransition); + stackView.push("qrc:/qml/ScreenPlayApp/qml/Create/StartInfo.qml"); + listView.currentIndex = 0; + App.util.setNavigationActive(true); } ignoreUnknownSignals: true @@ -152,9 +152,9 @@ Rectangle { highlighted: ListView.isCurrentItem text: headline onClicked: { - listView.currentIndex = index - const item = stackView.push(source) - loaderConnections.target = item + listView.currentIndex = index; + const item = stackView.push(source); + loaderConnections.target = item; } } } diff --git a/ScreenPlay/qml/Create/StartInfo.qml b/ScreenPlay/qml/Create/StartInfo.qml index 3b89dec0..9de354cf 100644 --- a/ScreenPlay/qml/Create/StartInfo.qml +++ b/ScreenPlay/qml/Create/StartInfo.qml @@ -1,6 +1,6 @@ import QtQuick import QtQuick.Controls -import QtQuick.Layouts +import QtQuick.Layouts import QtQuick.Controls.Material import Qt5Compat.GraphicalEffects import QtQuick.Controls.Material.impl @@ -23,7 +23,6 @@ Item { left: parent.left margins: 20 } - } Text { @@ -40,7 +39,6 @@ Item { left: parent.left margins: 20 } - } GridView { @@ -217,7 +215,6 @@ Item { description: "" category: "Resources" } - } delegate: StartInfoLinkImage { @@ -231,7 +228,5 @@ Item { width: gridView.cellWidth height: gridView.cellHeight } - } - } diff --git a/ScreenPlay/qml/Create/StartInfoLinkImage.qml b/ScreenPlay/qml/Create/StartInfoLinkImage.qml index b08735f0..25f1cc23 100644 --- a/ScreenPlay/qml/Create/StartInfoLinkImage.qml +++ b/ScreenPlay/qml/Create/StartInfoLinkImage.qml @@ -1,6 +1,6 @@ import QtQuick import QtQuick.Controls -import QtQuick.Layouts +import QtQuick.Layouts import QtQuick.Controls.Material import Qt5Compat.GraphicalEffects import QtQuick.Controls.Material.impl @@ -48,9 +48,7 @@ Item { position: 1 color: "#00000000" } - } - } Text { @@ -67,7 +65,6 @@ Item { margins: 15 bottomMargin: 5 } - } Text { @@ -84,7 +81,6 @@ Item { bottom: parent.bottom margins: 15 } - } Rectangle { @@ -108,9 +104,7 @@ Item { fill: parent margins: 5 } - } - } MouseArea { @@ -125,7 +119,6 @@ Item { layer.effect: ElevationEffect { elevation: 4 } - } transitions: [ @@ -139,7 +132,6 @@ Item { from: 1 to: 1.05 } - }, Transition { from: "hover" @@ -151,7 +143,6 @@ Item { from: 1.05 to: 1 } - } ] } diff --git a/ScreenPlay/qml/Create/Wizard.qml b/ScreenPlay/qml/Create/Wizard.qml index 2ce59846..a9c47189 100644 --- a/ScreenPlay/qml/Create/Wizard.qml +++ b/ScreenPlay/qml/Create/Wizard.qml @@ -6,7 +6,7 @@ import QtQuick.Layouts import ScreenPlayApp import ScreenPlay import ScreenPlay.Create -import ScreenPlayUtil +import ScreenPlayUtil Item { id: root @@ -42,7 +42,6 @@ Item { right: wrapper.right topMargin: 3 } - } Rectangle { @@ -53,7 +52,6 @@ Item { radius: 4 width: { // Add small margin left and right - if (parent.width < 1200) return parent.width - 20; else @@ -86,9 +84,7 @@ Item { App.util.setNavigation("Create"); } } - } - } states: [ @@ -105,7 +101,6 @@ Item { target: effect opacity: 0 } - }, State { name: "in" @@ -125,7 +120,6 @@ Item { target: effect opacity: 0.4 } - }, State { name: "error" @@ -146,7 +140,6 @@ Item { opacity: 1 z: 1 } - }, State { name: "success" @@ -167,7 +160,6 @@ Item { opacity: 0 z: 0 } - } ] transitions: [ @@ -206,13 +198,9 @@ Item { property: "opacity" easing.type: Easing.OutQuart } - } - } - } - }, Transition { from: "in" @@ -244,11 +232,8 @@ Item { property: "opacity" easing.type: Easing.OutQuart } - } - } - }, Transition { from: "in" @@ -265,9 +250,7 @@ Item { PauseAnimation { duration: 50 } - } - } ] } diff --git a/ScreenPlay/qml/Create/Wizards/GifWallpaper.qml b/ScreenPlay/qml/Create/Wizards/GifWallpaper.qml index 11c7b63b..fa5cd72d 100644 --- a/ScreenPlay/qml/Create/Wizards/GifWallpaper.qml +++ b/ScreenPlay/qml/Create/Wizards/GifWallpaper.qml @@ -84,7 +84,7 @@ WizardPage { horizontalAlignment: Text.AlignHCenter wrapMode: Text.WrapAtWordBoundaryOrAnywhere width: parent.width - anchors{ + anchors { fill: parent margins: 40 } @@ -97,7 +97,6 @@ WizardPage { fillMode: Image.PreserveAspectCrop source: root.file } - } Item { @@ -113,7 +112,6 @@ WizardPage { fileDialog.nameFilters: ["Gif (*.gif)"] onFileChanged: root.file = file } - } ColumnLayout { @@ -162,11 +160,7 @@ WizardPage { Layout.fillHeight: true Layout.fillWidth: true } - } - } - } - } diff --git a/ScreenPlay/qml/Create/Wizards/HTMLWallpaper.qml b/ScreenPlay/qml/Create/Wizards/HTMLWallpaper.qml index 4d784202..3788ff89 100644 --- a/ScreenPlay/qml/Create/Wizards/HTMLWallpaper.qml +++ b/ScreenPlay/qml/Create/Wizards/HTMLWallpaper.qml @@ -53,7 +53,6 @@ WizardPage { Layout.fillWidth: true placeholderText: qsTr("Created By") } - } Util.TextField { @@ -83,7 +82,6 @@ WizardPage { Layout.fillWidth: true } - } Item { @@ -99,7 +97,5 @@ WizardPage { Layout.fillWidth: true } - } - } diff --git a/ScreenPlay/qml/Create/Wizards/HTMLWidget.qml b/ScreenPlay/qml/Create/Wizards/HTMLWidget.qml index e3231f30..f6532d71 100644 --- a/ScreenPlay/qml/Create/Wizards/HTMLWidget.qml +++ b/ScreenPlay/qml/Create/Wizards/HTMLWidget.qml @@ -2,7 +2,6 @@ import QtQuick import QtQuick.Controls.Material import QtQuick.Controls import QtQuick.Layouts - import ScreenPlayApp import ScreenPlay import ScreenPlayUtil as Util @@ -52,7 +51,6 @@ WizardPage { anchors.fill: parent fillMode: Image.PreserveAspectCrop } - } Util.ImageSelector { @@ -60,7 +58,6 @@ WizardPage { Layout.fillWidth: true } - } ColumnLayout { @@ -104,11 +101,7 @@ WizardPage { Layout.fillWidth: true } - } - } - } - } diff --git a/ScreenPlay/qml/Create/Wizards/ImportVideoAndConvert/CreateWallpaper.qml b/ScreenPlay/qml/Create/Wizards/ImportVideoAndConvert/CreateWallpaper.qml index 7be3f322..391176c2 100644 --- a/ScreenPlay/qml/Create/Wizards/ImportVideoAndConvert/CreateWallpaper.qml +++ b/ScreenPlay/qml/Create/Wizards/ImportVideoAndConvert/CreateWallpaper.qml @@ -23,15 +23,15 @@ Item { CreateWallpaperInit { onNext: function (filePath, codec) { - startConvert(filePath, codec) + startConvert(filePath, codec); } function startConvert(filePath, codec) { - root.wizardStarted() - swipeView.currentIndex = 1 - createWallpaperVideoImportConvert.codec = codec - createWallpaperVideoImportConvert.filePath = filePath - App.create.createWallpaperStart(filePath, codec, quality) + root.wizardStarted(); + swipeView.currentIndex = 1; + createWallpaperVideoImportConvert.codec = codec; + createWallpaperVideoImportConvert.filePath = filePath; + App.create.createWallpaperStart(filePath, codec, quality); } } @@ -41,6 +41,7 @@ Item { onAbort: root.wizardExited() } - CreateWallpaperResult {} + CreateWallpaperResult { + } } } diff --git a/ScreenPlay/qml/Create/Wizards/ImportVideoAndConvert/CreateWallpaperInit.qml b/ScreenPlay/qml/Create/Wizards/ImportVideoAndConvert/CreateWallpaperInit.qml index c7ac8606..57cfe5cf 100644 --- a/ScreenPlay/qml/Create/Wizards/ImportVideoAndConvert/CreateWallpaperInit.qml +++ b/ScreenPlay/qml/Create/Wizards/ImportVideoAndConvert/CreateWallpaperInit.qml @@ -8,6 +8,7 @@ import ScreenPlayApp import ScreenPlay import ScreenPlay.Create import ScreenPlayUtil as Util + Item { id: root objectName: "createWallpaperInit" @@ -62,7 +63,6 @@ Item { // text: "AV1 (NVidia 3000, AMD 6000 or newer). ULTRA SLOW ENCODING!" // value: Create.AV1 // } - id: comboBoxCodec Layout.preferredWidth: 400 @@ -84,11 +84,8 @@ Item { value: Create.VP8 } // Import works but the QWebEngine cannot display AV1 :( - } - } - } Util.Slider { @@ -104,9 +101,7 @@ Item { to: 0 stepSize: 1 } - } - } Button { @@ -124,7 +119,6 @@ Item { bottom: parent.bottom margins: 20 } - } Button { @@ -141,7 +135,7 @@ Item { nameFilters: ["Video files (*.mp4 *.mpg *.mp2 *.mpeg *.ogv *.avi *.wmv *.m4v *.3gp *.flv)"] onAccepted: { - root.next(fileDialogImportVideo.currentFile , model.get(comboBoxCodec.currentIndex).value); + root.next(fileDialogImportVideo.currentFile, model.get(comboBoxCodec.currentIndex).value); } } @@ -150,7 +144,5 @@ Item { bottom: parent.bottom margins: 20 } - } - } diff --git a/ScreenPlay/qml/Create/Wizards/ImportVideoAndConvert/CreateWallpaperResult.qml b/ScreenPlay/qml/Create/Wizards/ImportVideoAndConvert/CreateWallpaperResult.qml index 7a3b08c1..3dff9f52 100644 --- a/ScreenPlay/qml/Create/Wizards/ImportVideoAndConvert/CreateWallpaperResult.qml +++ b/ScreenPlay/qml/Create/Wizards/ImportVideoAndConvert/CreateWallpaperResult.qml @@ -2,7 +2,6 @@ import QtQuick import QtQuick.Controls import QtQuick.Controls.Material import QtQuick.Layouts - import Qt5Compat.GraphicalEffects import ScreenPlayApp import ScreenPlay @@ -28,7 +27,6 @@ Item { topMargin: 30 horizontalCenter: parent.horizontalCenter } - } Rectangle { @@ -66,7 +64,6 @@ Item { left: parent.left margins: 20 } - } MouseArea { @@ -80,9 +77,7 @@ Item { snapMode: ScrollBar.SnapOnRelease policy: ScrollBar.AlwaysOn } - } - } Menu { @@ -94,7 +89,6 @@ Item { App.util.copyToClipboard(txtFFMPEGDebug.text); } } - } Button { @@ -114,7 +108,6 @@ Item { bottom: parent.bottom margins: 10 } - } states: [ @@ -125,7 +118,6 @@ Item { target: txtFFMPEGDebug text: "Error!" } - }, State { name: "success" @@ -134,7 +126,6 @@ Item { target: txtFFMPEGDebug text: "Success!" } - } ] } diff --git a/ScreenPlay/qml/Create/Wizards/ImportVideoAndConvert/CreateWallpaperVideoImportConvert.qml b/ScreenPlay/qml/Create/Wizards/ImportVideoAndConvert/CreateWallpaperVideoImportConvert.qml index ef8a95a1..d4cc8e97 100644 --- a/ScreenPlay/qml/Create/Wizards/ImportVideoAndConvert/CreateWallpaperVideoImportConvert.qml +++ b/ScreenPlay/qml/Create/Wizards/ImportVideoAndConvert/CreateWallpaperVideoImportConvert.qml @@ -21,84 +21,81 @@ Item { signal save function cleanup() { - App.create.cancel() + App.create.cancel(); } function basename(str) { - let filenameWithExtentions = (str.slice(str.lastIndexOf("/") + 1)) - let filename = filenameWithExtentions.split('.').slice(0, -1).join('.') - return filename + let filenameWithExtentions = (str.slice(str.lastIndexOf("/") + 1)); + let filename = filenameWithExtentions.split('.').slice(0, -1).join('.'); + return filename; } function checkCanSave() { if (canSave && conversionFinishedSuccessful) - btnSave.enabled = true + btnSave.enabled = true; else - btnSave.enabled = false + btnSave.enabled = false; } onCanSaveChanged: root.checkCanSave() onFilePathChanged: { - textFieldName.text = basename(filePath) + textFieldName.text = basename(filePath); } Connections { function onCreateWallpaperStateChanged(state) { switch (state) { case ImportVideoState.ConvertingPreviewImage: - txtConvert.text = qsTr("Generating preview image...") - break + txtConvert.text = qsTr("Generating preview image..."); + break; case ImportVideoState.ConvertingPreviewThumbnailImage: - txtConvert.text = qsTr("Generating preview thumbnail image...") - break + txtConvert.text = qsTr("Generating preview thumbnail image..."); + break; case ImportVideoState.ConvertingPreviewImageFinished: - imgPreview.source = "file:///" + App.create.workingDir + "/preview.jpg" - imgPreview.visible = true - break + imgPreview.source = "file:///" + App.create.workingDir + "/preview.jpg"; + imgPreview.visible = true; + break; case ImportVideoState.ConvertingPreviewVideo: - txtConvert.text = qsTr("Generating 5 second preview video...") - break + txtConvert.text = qsTr("Generating 5 second preview video..."); + break; case ImportVideoState.ConvertingPreviewGif: - txtConvert.text = qsTr("Generating preview gif...") - break + txtConvert.text = qsTr("Generating preview gif..."); + break; case ImportVideoState.ConvertingPreviewGifFinished: - gifPreview.source = "file:///" + App.create.workingDir + "/preview.gif" - imgPreview.visible = false - gifPreview.visible = true - gifPreview.playing = true - break + gifPreview.source = "file:///" + App.create.workingDir + "/preview.gif"; + imgPreview.visible = false; + gifPreview.visible = true; + gifPreview.playing = true; + break; case ImportVideoState.ConvertingAudio: - txtConvert.text = qsTr("Converting Audio...") - break + txtConvert.text = qsTr("Converting Audio..."); + break; case ImportVideoState.ConvertingVideo: - txtConvert.text = qsTr( - "Converting Video... This can take some time!") - break + txtConvert.text = qsTr("Converting Video... This can take some time!"); + break; case ImportVideoState.ConvertingVideoError: - txtConvert.text = qsTr("Converting Video ERROR!") - break + txtConvert.text = qsTr("Converting Video ERROR!"); + break; case ImportVideoState.AnalyseVideoError: - txtConvert.text = qsTr("Analyse Video ERROR!") - break + txtConvert.text = qsTr("Analyse Video ERROR!"); + break; case ImportVideoState.Finished: - txtConvert.text = "" - conversionFinishedSuccessful = true - busyIndicator.running = false + txtConvert.text = ""; + conversionFinishedSuccessful = true; + busyIndicator.running = false; btnExit.enabled = false; - root.checkCanSave() - break + root.checkCanSave(); + break; } } function onProgressChanged(progress) { - var percentage = Math.floor(progress * 100) + var percentage = Math.floor(progress * 100); if (percentage > 100 || progress > 0.95) - percentage = 100 - + percentage = 100; if (percentage === NaN) - print(progress, percentage) - - txtConvertNumber.text = percentage + "%" + print(progress, percentage); + txtConvertNumber.text = percentage + "%"; } target: App.create @@ -278,9 +275,9 @@ Item { Layout.fillWidth: true onTextChanged: { if (textFieldName.text.length >= 3) - canSave = true + canSave = true; else - canSave = false + canSave = false; } } @@ -330,8 +327,8 @@ Item { highlighted: true font.family: App.settings.font onClicked: { - root.abort() - App.create.cancel() + root.abort(); + App.create.cancel(); } } @@ -345,14 +342,9 @@ Item { font.family: App.settings.font onClicked: { if (conversionFinishedSuccessful) { - btnSave.enabled = false - App.create.saveWallpaper( - textFieldName.text, - textFieldDescription.text, root.filePath, - previewSelector.imageSource, - textFieldYoutubeURL.text, codec, - textFieldTags.getTags()) - savePopup.open() + btnSave.enabled = false; + App.create.saveWallpaper(textFieldName.text, textFieldDescription.text, root.filePath, previewSelector.imageSource, textFieldYoutubeURL.text, codec, textFieldTags.getTags()); + savePopup.open(); } } } @@ -388,9 +380,9 @@ Item { interval: 1000 + Math.random() * 1000 onTriggered: { - savePopup.close() - App.util.setNavigationActive(true) - App.util.setNavigation("Installed") + savePopup.close(); + App.util.setNavigationActive(true); + App.util.setNavigation("Installed"); } } } diff --git a/ScreenPlay/qml/Create/Wizards/ImportWebm/ImportWebm.qml b/ScreenPlay/qml/Create/Wizards/ImportWebm/ImportWebm.qml index 5623d34d..71215f30 100644 --- a/ScreenPlay/qml/Create/Wizards/ImportWebm/ImportWebm.qml +++ b/ScreenPlay/qml/Create/Wizards/ImportWebm/ImportWebm.qml @@ -23,11 +23,11 @@ Item { ImportWebmInit { onNext: function (filePath) { - root.wizardStarted() - swipeView.currentIndex = 1 - createWallpaperVideoImportConvert.filePath = filePath - App.util.setNavigationActive(false) - App.create.createWallpaperStart(filePath) + root.wizardStarted(); + swipeView.currentIndex = 1; + createWallpaperVideoImportConvert.filePath = filePath; + App.util.setNavigationActive(false); + App.create.createWallpaperStart(filePath); } } diff --git a/ScreenPlay/qml/Create/Wizards/ImportWebm/ImportWebmConvert.qml b/ScreenPlay/qml/Create/Wizards/ImportWebm/ImportWebmConvert.qml index 80cbbbca..9a29f17c 100644 --- a/ScreenPlay/qml/Create/Wizards/ImportWebm/ImportWebmConvert.qml +++ b/ScreenPlay/qml/Create/Wizards/ImportWebm/ImportWebmConvert.qml @@ -16,8 +16,8 @@ Item { property bool canSave: false property string filePath - signal exit() - signal save() + signal exit + signal save function basename(str) { let filenameWithExtentions = (str.slice(str.lastIndexOf("/") + 1)); @@ -91,10 +91,8 @@ Item { var percentage = Math.floor(progress * 100); if (percentage > 100 || progress > 0.95) percentage = 100; - if (percentage === NaN) print(progress, percentage); - txtConvertNumber.text = percentage + "%"; } @@ -112,7 +110,6 @@ Item { margins: 40 bottomMargin: 0 } - } Item { @@ -182,9 +179,7 @@ Item { position: 1 color: "#00000000" } - } - } BusyIndicator { @@ -206,7 +201,6 @@ Item { bottom: parent.bottom bottomMargin: 40 } - } Text { @@ -222,9 +216,7 @@ Item { bottom: parent.bottom bottomMargin: 20 } - } - } Util.ImageSelector { @@ -238,9 +230,7 @@ Item { left: parent.left bottom: parent.bottom } - } - } Item { @@ -306,7 +296,6 @@ Item { width: parent.width Layout.fillWidth: true } - } Row { @@ -352,9 +341,7 @@ Item { } } } - } - } Popup { @@ -391,7 +378,5 @@ Item { root.exit(); } } - } - } diff --git a/ScreenPlay/qml/Create/Wizards/ImportWebm/ImportWebmInit.qml b/ScreenPlay/qml/Create/Wizards/ImportWebm/ImportWebmInit.qml index d8480103..f77c22ad 100644 --- a/ScreenPlay/qml/Create/Wizards/ImportWebm/ImportWebmInit.qml +++ b/ScreenPlay/qml/Create/Wizards/ImportWebm/ImportWebmInit.qml @@ -107,32 +107,10 @@ Item { fill: parent margins: 40 } - } - } - } - - Item { - Layout.fillHeight: true - Layout.preferredWidth: wrapper.width * 0.33 - - StartInfoLinkImage { - text: "Handbreak" - image: "qrc:/qml/ScreenPlayApp/assets/startinfo/handbreak.png" - link: "https://handbrake.fr/" - description: "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Cum sociis natoque penatibus et magnis dis parturient montes," - category: "Tools" - width: 300 - height: parent.height - anchors.centerIn: parent - } - - } - } - } Button { @@ -153,7 +131,6 @@ Item { left: parent.left margins: 20 } - } Button { @@ -178,7 +155,5 @@ Item { bottom: parent.bottom margins: 20 } - } - } diff --git a/ScreenPlay/qml/Create/Wizards/Importh264/Importh264.qml b/ScreenPlay/qml/Create/Wizards/Importh264/Importh264.qml index f509c6ec..6a00209e 100644 --- a/ScreenPlay/qml/Create/Wizards/Importh264/Importh264.qml +++ b/ScreenPlay/qml/Create/Wizards/Importh264/Importh264.qml @@ -23,11 +23,11 @@ Item { Importh264Init { onNext: function (filePath) { - root.wizardStarted() - swipeView.currentIndex = 1 - createWallpaperVideoImportConvert.filePath = filePath - App.util.setNavigationActive(false) - App.create.importH264(filePath) + root.wizardStarted(); + swipeView.currentIndex = 1; + createWallpaperVideoImportConvert.filePath = filePath; + App.util.setNavigationActive(false); + App.create.importH264(filePath); } } diff --git a/ScreenPlay/qml/Create/Wizards/Importh264/Importh264Convert.qml b/ScreenPlay/qml/Create/Wizards/Importh264/Importh264Convert.qml index 64e37a72..b60b7934 100644 --- a/ScreenPlay/qml/Create/Wizards/Importh264/Importh264Convert.qml +++ b/ScreenPlay/qml/Create/Wizards/Importh264/Importh264Convert.qml @@ -16,8 +16,8 @@ Item { property bool canSave: false property string filePath - signal exit() - signal save() + signal exit + signal save function basename(str) { let filenameWithExtentions = (str.slice(str.lastIndexOf("/") + 1)); @@ -91,10 +91,8 @@ Item { var percentage = Math.floor(progress * 100); if (percentage > 100 || progress > 0.95) percentage = 100; - if (percentage === NaN) print(progress, percentage); - txtConvertNumber.text = percentage + "%"; } @@ -112,7 +110,6 @@ Item { margins: 40 bottomMargin: 0 } - } Item { @@ -182,9 +179,7 @@ Item { position: 1 color: "#00000000" } - } - } BusyIndicator { @@ -206,7 +201,6 @@ Item { bottom: parent.bottom bottomMargin: 40 } - } Text { @@ -222,9 +216,7 @@ Item { bottom: parent.bottom bottomMargin: 20 } - } - } Util.ImageSelector { @@ -238,9 +230,7 @@ Item { left: parent.left bottom: parent.bottom } - } - } Item { @@ -306,7 +296,6 @@ Item { width: parent.width Layout.fillWidth: true } - } Row { @@ -352,9 +341,7 @@ Item { } } } - } - } Popup { @@ -391,7 +378,5 @@ Item { root.exit(); } } - } - } diff --git a/ScreenPlay/qml/Create/Wizards/Importh264/Importh264Init.qml b/ScreenPlay/qml/Create/Wizards/Importh264/Importh264Init.qml index 0c0e5dc4..81fe7d55 100644 --- a/ScreenPlay/qml/Create/Wizards/Importh264/Importh264Init.qml +++ b/ScreenPlay/qml/Create/Wizards/Importh264/Importh264Init.qml @@ -60,22 +60,19 @@ Item { Layout.fillHeight: true Layout.fillWidth: true onExited: { - bg.color = Qt.darker(Material.backgroundColor) + bg.color = Qt.darker(Material.backgroundColor); } onEntered: { - bg.color = Qt.darker(Qt.darker( - Material.backgroundColor)) - drag.accept(Qt.LinkAction) + bg.color = Qt.darker(Qt.darker(Material.backgroundColor)); + drag.accept(Qt.LinkAction); } onDropped: { - let file = App.util.toLocal(drop.urls[0]) - bg.color = Qt.darker(Qt.darker( - Material.backgroundColor)) + let file = App.util.toLocal(drop.urls[0]); + bg.color = Qt.darker(Qt.darker(Material.backgroundColor)); if (file.endsWith(".mp4")) - root.next(drop.urls[0]) + root.next(drop.urls[0]); else - txtFile.text = qsTr( - "Invalid file type. Must be valid h264 (*.mp4)!") + txtFile.text = qsTr("Invalid file type. Must be valid h264 (*.mp4)!"); } Rectangle { @@ -127,8 +124,7 @@ Item { icon.width: 16 icon.height: 16 font.family: App.settings.font - onClicked: Qt.openUrlExternally( - "https://kelteseth.gitlab.io/ScreenPlayDocs/wallpaper/wallpaper/#performance") + onClicked: Qt.openUrlExternally("https://kelteseth.gitlab.io/ScreenPlayDocs/wallpaper/wallpaper/#performance") anchors { bottom: parent.bottom @@ -142,7 +138,7 @@ Item { highlighted: true font.family: App.settings.font onClicked: { - fileDialogImportVideo.open() + fileDialogImportVideo.open(); } FileDialog { @@ -150,7 +146,7 @@ Item { nameFilters: ["Video files (*.mp4)"] onAccepted: { - root.next(fileDialogImportVideo.currentFile) + root.next(fileDialogImportVideo.currentFile); } } diff --git a/ScreenPlay/qml/Create/Wizards/QMLWallpaper.qml b/ScreenPlay/qml/Create/Wizards/QMLWallpaper.qml index f85acf5e..afea832c 100644 --- a/ScreenPlay/qml/Create/Wizards/QMLWallpaper.qml +++ b/ScreenPlay/qml/Create/Wizards/QMLWallpaper.qml @@ -53,7 +53,6 @@ WizardPage { Layout.fillWidth: true placeholderText: qsTr("Created By") } - } Util.TextField { @@ -83,7 +82,6 @@ WizardPage { Layout.fillWidth: true } - } Item { @@ -99,7 +97,5 @@ WizardPage { Layout.fillWidth: true } - } - } diff --git a/ScreenPlay/qml/Create/Wizards/QMLWidget.qml b/ScreenPlay/qml/Create/Wizards/QMLWidget.qml index d428382d..43edcd52 100644 --- a/ScreenPlay/qml/Create/Wizards/QMLWidget.qml +++ b/ScreenPlay/qml/Create/Wizards/QMLWidget.qml @@ -2,7 +2,6 @@ import QtQuick import QtQuick.Controls.Material import QtQuick.Controls import QtQuick.Layouts - import ScreenPlayApp import ScreenPlay import ScreenPlayUtil as Util @@ -52,7 +51,6 @@ WizardPage { anchors.fill: parent fillMode: Image.PreserveAspectCrop } - } Util.ImageSelector { @@ -60,7 +58,6 @@ WizardPage { Layout.fillWidth: true } - } ColumnLayout { @@ -104,11 +101,7 @@ WizardPage { Layout.fillWidth: true } - } - } - } - } diff --git a/ScreenPlay/qml/Create/Wizards/WebsiteWallpaper.qml b/ScreenPlay/qml/Create/Wizards/WebsiteWallpaper.qml index fec21e46..605920aa 100644 --- a/ScreenPlay/qml/Create/Wizards/WebsiteWallpaper.qml +++ b/ScreenPlay/qml/Create/Wizards/WebsiteWallpaper.qml @@ -54,7 +54,6 @@ WizardPage { Layout.fillWidth: true placeholderText: qsTr("Created By") } - } Util.TextField { @@ -99,7 +98,5 @@ WizardPage { Layout.fillWidth: true } - } - } diff --git a/ScreenPlay/qml/Create/Wizards/WizardPage.qml b/ScreenPlay/qml/Create/Wizards/WizardPage.qml index 9a997168..1530c900 100644 --- a/ScreenPlay/qml/Create/Wizards/WizardPage.qml +++ b/ScreenPlay/qml/Create/Wizards/WizardPage.qml @@ -15,11 +15,11 @@ FocusScope { property alias savePopup: savePopup property bool ready: false - signal wizardStarted() - signal wizardExited() - signal saveClicked() - signal saveFinished() - signal cancelClicked() + signal wizardStarted + signal wizardExited + signal saveClicked + signal saveFinished + signal cancelClicked ScrollView { contentWidth: width @@ -45,9 +45,7 @@ FocusScope { top: parent.top horizontalCenter: parent.horizontalCenter } - } - } RowLayout { @@ -80,7 +78,6 @@ FocusScope { savePopup.open(); } } - } Popup { @@ -108,7 +105,6 @@ FocusScope { bottom: parent.bottom bottomMargin: 30 } - } Timer { @@ -120,7 +116,5 @@ FocusScope { root.wizardExited(); } } - } - } diff --git a/ScreenPlay/qml/Create/WizardsFiles/QMLWallpaperMain.qml b/ScreenPlay/qml/Create/WizardsFiles/QMLWallpaperMain.qml index b52940ae..e9d57480 100644 --- a/ScreenPlay/qml/Create/WizardsFiles/QMLWallpaperMain.qml +++ b/ScreenPlay/qml/Create/WizardsFiles/QMLWallpaperMain.qml @@ -10,7 +10,6 @@ Rectangle { implicitWidth: 1366 implicitHeight: 768 - Text { id: name text: qsTr("My ScreenPlay Wallpaper 🚀") diff --git a/ScreenPlay/qml/Create/WizardsFiles/QMLWidgetMain.qml b/ScreenPlay/qml/Create/WizardsFiles/QMLWidgetMain.qml index 1c7c35a9..d754a804 100644 --- a/ScreenPlay/qml/Create/WizardsFiles/QMLWidgetMain.qml +++ b/ScreenPlay/qml/Create/WizardsFiles/QMLWidgetMain.qml @@ -7,7 +7,7 @@ Item { Rectangle { id: background - anchors.fill:parent + anchors.fill: parent opacity: 0.9 color: "#333333" } diff --git a/ScreenPlay/qml/Installed/Installed.qml b/ScreenPlay/qml/Installed/Installed.qml index 6aa332ef..35e689bf 100644 --- a/ScreenPlay/qml/Installed/Installed.qml +++ b/ScreenPlay/qml/Installed/Installed.qml @@ -25,24 +25,24 @@ Item { function checkIsContentInstalled() { if (App.installedListModel.count === 0) { - loaderHelp.active = true - gridView.footerItem.isVisible = true - gridView.visible = false - navWrapper.visible = false + loaderHelp.active = true; + gridView.footerItem.isVisible = true; + gridView.visible = false; + navWrapper.visible = false; } else { - loaderHelp.active = false - gridView.footerItem.isVisible = false - refresh = false - gridView.contentY = -82 - gridView.visible = true - navWrapper.visible = true + loaderHelp.active = false; + gridView.footerItem.isVisible = false; + refresh = false; + gridView.contentY = -82; + gridView.visible = true; + navWrapper.visible = true; } } Component.onCompleted: { - navWrapper.state = "in" - App.installedListFilter.sortBySearchType(SearchType.All) - checkIsContentInstalled() + navWrapper.state = "in"; + App.installedListFilter.sortBySearchType(SearchType.All); + checkIsContentInstalled(); } Action { @@ -52,12 +52,12 @@ Item { Connections { function onInstalledLoadingFinished() { - checkIsContentInstalled() + checkIsContentInstalled(); } function onCountChanged(count) { if (count === 0) - checkIsContentInstalled() + checkIsContentInstalled(); } target: App.installedListModel @@ -72,7 +72,7 @@ Item { Connections { function onSortChanged() { - gridView.positionViewAtBeginning() + gridView.positionViewAtBeginning(); } target: App.installedListFilter @@ -129,12 +129,12 @@ Item { } onContentYChanged: { if (contentY <= -180) - gridView.headerItem.isVisible = true + gridView.headerItem.isVisible = true; else - gridView.headerItem.isVisible = false + gridView.headerItem.isVisible = false; //Pull to refresh if (contentY <= -180 && !refresh && !isDragging) - App.installedListModel.reset() + App.installedListModel.reset(); } anchors { @@ -151,11 +151,11 @@ Item { opacity: 0 onIsVisibleChanged: { if (isVisible) { - txtHeader.color = Material.accent - txtHeader.text = qsTr("Refreshing!") + txtHeader.color = Material.accent; + txtHeader.text = qsTr("Refreshing!"); } else { - txtHeader.color = "gray" - txtHeader.text = qsTr("Pull to refresh!") + txtHeader.color = "gray"; + txtHeader.text = qsTr("Pull to refresh!"); } } @@ -163,7 +163,7 @@ Item { interval: 150 running: true onTriggered: { - animFadeIn.start() + animFadeIn.start(); } } @@ -177,7 +177,7 @@ Item { font.pointSize: 18 } - PropertyAnimation on opacity { + PropertyAnimation on opacity { id: animFadeIn from: 0 @@ -207,11 +207,11 @@ Item { interval: 400 running: true onTriggered: { - animFadeInTxtFooter.start() + animFadeInTxtFooter.start(); } } - PropertyAnimation on opacity { + PropertyAnimation on opacity { id: animFadeInTxtFooter from: 0 @@ -236,16 +236,15 @@ Item { isScrolling: gridView.isScrolling onOpenContextMenu: function (position) { // Set the menu to the current item informations - contextMenu.publishedFileID = delegate.publishedFileID - contextMenu.absoluteStoragePath = delegate.absoluteStoragePath - contextMenu.fileName = delegate.customTitle - const pos = delegate.mapToItem(root, position.x, position.y) + contextMenu.publishedFileID = delegate.publishedFileID; + contextMenu.absoluteStoragePath = delegate.absoluteStoragePath; + contextMenu.fileName = delegate.customTitle; + const pos = delegate.mapToItem(root, position.x, position.y); // Disable duplicate opening. The can happen if we // call popup when we are in the closing animtion. if (contextMenu.visible || contextMenu.opened) - return - - contextMenu.popup(pos.x, pos.y) + return; + contextMenu.popup(pos.x, pos.y); } } @@ -267,7 +266,7 @@ Item { objectName: "openFolder" icon.source: "qrc:/qml/ScreenPlayApp/assets/icons/icon_folder_open.svg" onClicked: { - App.util.openFolderInExplorer(contextMenu.absoluteStoragePath) + App.util.openFolderInExplorer(contextMenu.absoluteStoragePath); } } @@ -276,13 +275,10 @@ Item { objectName: enabled ? "removeItem" : "removeWorkshopItem" icon.source: "qrc:/qml/ScreenPlayApp/assets/icons/icon_import_export_.svg" onClicked: { - exportFileDialog.absoluteStoragePath = contextMenu.absoluteStoragePath - let urlFileName = Labs.StandardPaths.writableLocation( - Labs.StandardPaths.DesktopLocation) + "/" - + contextMenu.fileName + ".screenplay" - - exportFileDialog.currentFile = urlFileName - exportFileDialog.open() + exportFileDialog.absoluteStoragePath = contextMenu.absoluteStoragePath; + let urlFileName = Labs.StandardPaths.writableLocation(Labs.StandardPaths.DesktopLocation) + "/" + contextMenu.fileName + ".screenplay"; + exportFileDialog.currentFile = urlFileName; + exportFileDialog.open(); } } @@ -290,21 +286,18 @@ Item { text: enabled ? qsTr("Remove Item") : qsTr("Remove via Workshop") objectName: enabled ? "removeItem" : "removeWorkshopItem" icon.source: "qrc:/qml/ScreenPlayApp/assets/icons/icon_delete.svg" - enabled: contextMenu.publishedFileID === 0 - || !App.settings.steamVersion + enabled: contextMenu.publishedFileID === 0 || !App.settings.steamVersion onClicked: { - deleteDialog.open() + deleteDialog.open(); } } MenuItem { text: qsTr("Open Workshop Page") - enabled: contextMenu.publishedFileID !== 0 - && App.settings.steamVersion + enabled: contextMenu.publishedFileID !== 0 && App.settings.steamVersion icon.source: "qrc:/qml/ScreenPlayApp/assets/icons/icon_steam.svg" onClicked: { - Qt.openUrlExternally( - "steam://url/CommunityFilePage/" + contextMenu.publishedFileID) + Qt.openUrlExternally("steam://url/CommunityFilePage/" + contextMenu.publishedFileID); } } } @@ -317,9 +310,8 @@ Item { modalSource: root.modalSource anchors.centerIn: Overlay.overlay onAccepted: { - root.sidebar.clear() - App.installedListModel.deinstallItemAt( - contextMenu.absoluteStoragePath) + root.sidebar.clear(); + App.installedListModel.deinstallItemAt(contextMenu.absoluteStoragePath); } } @@ -328,7 +320,7 @@ Item { fileMode: FileDialog.SaveFile property string absoluteStoragePath onAccepted: { - exportFileProgressDialog.open() + exportFileProgressDialog.open(); } } @@ -341,9 +333,7 @@ Item { modalSource: root.modalSource closePolicy: Popup.NoAutoClose onOpened: { - const success = App.util.exportProject( - exportFileDialog.absoluteStoragePath, - exportFileDialog.currentFile) + const success = App.util.exportProject(exportFileDialog.absoluteStoragePath, exportFileDialog.currentFile); } onClosed: exportProgressBar.value = 0 ColumnLayout { @@ -368,10 +358,10 @@ Item { id: exportConnections target: App.util function onCompressionProgressChanged(file, proc, total, br, bt) { - exportProgressBar.value = (br * 100 / bt) + exportProgressBar.value = (br * 100 / bt); } function onCompressionFinished() { - exportFileProgressDialog.close() + exportFileProgressDialog.close(); } } } @@ -391,31 +381,28 @@ Item { anchors.fill: parent property string filePath onEntered: function (drag) { - dropPopup.open() + dropPopup.open(); } onDropped: function (drop) { - dropPopup.close() - dropArea.enabled = false - + dropPopup.close(); + dropArea.enabled = false; if (drop.urls.length > 1) { - importProjectErrorDialog.title = qsTr( - "We only support adding one item at once.") - importProjectErrorDialog.open() - return + importProjectErrorDialog.title = qsTr("We only support adding one item at once."); + importProjectErrorDialog.open(); + return; } - var file = "" // Convert url to string - file = "" + drop.urls[0] + var file = ""; // Convert url to string + file = "" + drop.urls[0]; if (!file.endsWith('.screenplay')) { - importProjectErrorDialog.title = qsTr( - "File type not supported. We only support '.screenplay' files.") - importProjectErrorDialog.open() - return + importProjectErrorDialog.title = qsTr("File type not supported. We only support '.screenplay' files."); + importProjectErrorDialog.open(); + return; } - importDialog.open() - dropArea.filePath = file + importDialog.open(); + dropArea.filePath = file; } onExited: { - dropPopup.close() + dropPopup.close(); } Util.Dialog { @@ -436,10 +423,9 @@ Item { closePolicy: Popup.NoAutoClose onClosed: importProgressBar.value = 0 onOpened: { - const success = App.util.importProject(dropArea.filePath, - App.globalVariables.localStoragePath) - print("finished", success) - dropArea.filePath = "" + const success = App.util.importProject(dropArea.filePath, App.globalVariables.localStoragePath); + print("finished", success); + dropArea.filePath = ""; } ColumnLayout { width: parent.width @@ -461,10 +447,10 @@ Item { id: importConnections target: App.util function onExtractionProgressChanged(file, proc, total, br, bt) { - importProgressBar.value = (br * 100 / bt) + importProgressBar.value = (br * 100 / bt); } function onExtractionFinished() { - importDialog.close() + importDialog.close(); } } } @@ -480,8 +466,8 @@ Item { modal: true onOpened: fileDropAnimation.state = "fileDrop" onClosed: { - fileDropAnimation.state = "" - dropArea.enabled = true + fileDropAnimation.state = ""; + dropArea.enabled = true; } Util.FileDropAnimation { diff --git a/ScreenPlay/qml/Installed/InstalledNavigation.qml b/ScreenPlay/qml/Installed/InstalledNavigation.qml index 0ca5191a..29658e84 100644 --- a/ScreenPlay/qml/Installed/InstalledNavigation.qml +++ b/ScreenPlay/qml/Installed/InstalledNavigation.qml @@ -33,7 +33,8 @@ Item { } } - Util.MouseHoverBlocker {} + Util.MouseHoverBlocker { + } Item { height: nav.height @@ -47,7 +48,8 @@ Item { TabBar { height: parent.height - background: Item {} + background: Item { + } anchors { top: parent.top topMargin: 5 @@ -56,21 +58,12 @@ Item { bottom: parent.bottom } - component CustomTabButton: TabButton { - icon.height: 16 - icon.width: 16 - height: parent.height - width: implicitWidth - background: Item {} - font.capitalization: Font.MixedCase - } - CustomTabButton { text: qsTr("All") icon.source: "qrc:/qml/ScreenPlayApp/assets/icons/icon_installed.svg" onClicked: { - setSidebarActive(false) - App.installedListFilter.sortBySearchType(SearchType.All) + setSidebarActive(false); + App.installedListFilter.sortBySearchType(SearchType.All); } } @@ -78,8 +71,8 @@ Item { text: qsTr("Scenes") icon.source: "qrc:/qml/ScreenPlayApp/assets/icons/icon_code.svg" onClicked: { - setSidebarActive(false) - App.installedListFilter.sortBySearchType(SearchType.Scene) + setSidebarActive(false); + App.installedListFilter.sortBySearchType(SearchType.Scene); } } @@ -87,9 +80,8 @@ Item { text: qsTr("Videos") icon.source: "qrc:/qml/ScreenPlayApp/assets/icons/icon_movie.svg" onClicked: { - setSidebarActive(false) - App.installedListFilter.sortBySearchType( - SearchType.Wallpaper) + setSidebarActive(false); + App.installedListFilter.sortBySearchType(SearchType.Wallpaper); } } @@ -97,8 +89,8 @@ Item { text: qsTr("Widgets") icon.source: "qrc:/qml/ScreenPlayApp/assets/icons/icon_widgets.svg" onClicked: { - setSidebarActive(false) - App.installedListFilter.sortBySearchType(SearchType.Widget) + setSidebarActive(false); + App.installedListFilter.sortBySearchType(SearchType.Widget); } } } @@ -127,10 +119,8 @@ Item { ToolTip.visible: hovered ToolTip.text: (btnSortOrder.sortOrder === Qt.AscendingOrder) ? "Install Date Ascending" : "Install Date Descending" onClicked: { - btnSortOrder.sortOrder - = (btnSortOrder.sortOrder - === Qt.DescendingOrder) ? Qt.AscendingOrder : Qt.DescendingOrder - App.installedListFilter.setSortOrder(btnSortOrder.sortOrder) + btnSortOrder.sortOrder = (btnSortOrder.sortOrder === Qt.DescendingOrder) ? Qt.AscendingOrder : Qt.DescendingOrder; + App.installedListFilter.setSortOrder(btnSortOrder.sortOrder); } anchors { @@ -142,6 +132,16 @@ Item { } } + component CustomTabButton: TabButton { + icon.height: 16 + icon.width: 16 + height: parent.height + width: implicitWidth + background: Item { + } + font.capitalization: Font.MixedCase + } + states: [ State { name: "out" diff --git a/ScreenPlay/qml/Installed/InstalledWelcomeScreen.qml b/ScreenPlay/qml/Installed/InstalledWelcomeScreen.qml index c361622e..c25ab688 100644 --- a/ScreenPlay/qml/Installed/InstalledWelcomeScreen.qml +++ b/ScreenPlay/qml/Installed/InstalledWelcomeScreen.qml @@ -70,8 +70,7 @@ Item { id: txtHeadline y: 80 - text: App.settings.steamVersion ? qsTr("Get free Widgets and Wallpaper via the Steam Workshop") : qsTr( - "Get content via our forum") + text: App.settings.steamVersion ? qsTr("Get free Widgets and Wallpaper via the Steam Workshop") : qsTr("Get content via our forum") font.family: App.settings.font font.capitalization: Font.Capitalize wrapMode: Text.WordWrap @@ -106,9 +105,9 @@ Item { text: { if (App.settings.steamVersion) { - return qsTr("Browse the Steam Workshop") + return qsTr("Browse the Steam Workshop"); } else { - return qsTr("Open the ScreenPlay forum") + return qsTr("Open the ScreenPlay forum"); } } Material.background: Material.color(Material.Orange) @@ -118,18 +117,18 @@ Item { height: implicitHeight + 10 icon.source: { if (App.settings.steamVersion) { - return "qrc:/qml/ScreenPlayApp/assets/icons/icon_steam.svg" + return "qrc:/qml/ScreenPlayApp/assets/icons/icon_steam.svg"; } else { - return "qrc:/qml/ScreenPlayApp/assets/icons/icon_community.svg" + return "qrc:/qml/ScreenPlayApp/assets/icons/icon_community.svg"; } } icon.width: 18 icon.height: 18 onClicked: { if (App.settings.steamVersion) { - App.util.setNavigation("Workshop") + App.util.setNavigation("Workshop"); } else { - Qt.openUrlExternally("https://forum.screen-play.app/") + Qt.openUrlExternally("https://forum.screen-play.app/"); } } @@ -312,7 +311,7 @@ Item { ScriptAction { script: { - animShake.start(2000, 1000, -1) + animShake.start(2000, 1000, -1); } } } diff --git a/ScreenPlay/qml/Installed/ScreenPlayItem.qml b/ScreenPlay/qml/Installed/ScreenPlayItem.qml index 8b9410a8..f2e04297 100644 --- a/ScreenPlay/qml/Installed/ScreenPlayItem.qml +++ b/ScreenPlay/qml/Installed/ScreenPlayItem.qml @@ -25,16 +25,16 @@ Item { height: 180 onTypeChanged: { if (JSUtil.isWidget(type)) { - icnType.source = "qrc:/qml/ScreenPlayApp/assets/icons/icon_widgets.svg" - return + icnType.source = "qrc:/qml/ScreenPlayApp/assets/icons/icon_widgets.svg"; + return; } if (JSUtil.isScene(type)) { - icnType.source = "qrc:/qml/ScreenPlayApp/assets/icons/icon_code.svg" - return + icnType.source = "qrc:/qml/ScreenPlayApp/assets/icons/icon_code.svg"; + return; } if (JSUtil.isVideo(type)) { - icnType.source = "qrc:/qml/ScreenPlayApp/assets/icons/icon_movie.svg" - return + icnType.source = "qrc:/qml/ScreenPlayApp/assets/icons/icon_movie.svg"; + return; } } @@ -42,11 +42,10 @@ Item { running: true onTriggered: showAnim.start() interval: { - var itemIndexMax = itemIndex + var itemIndexMax = itemIndex; if (itemIndex > 30) - itemIndexMax = 3 - - 5 * itemIndexMax * Math.random() + itemIndexMax = 3; + 5 * itemIndexMax * Math.random(); } } @@ -215,20 +214,20 @@ Item { cursorShape: Qt.PointingHandCursor acceptedButtons: Qt.LeftButton | Qt.RightButton onEntered: { - root.state = "hover" - screenPlayItemImage.state = "hover" - screenPlayItemImage.enter() + root.state = "hover"; + screenPlayItemImage.state = "hover"; + screenPlayItemImage.enter(); } onExited: { - root.state = "" - screenPlayItemImage.state = "loaded" - screenPlayItemImage.exit() + root.state = ""; + screenPlayItemImage.state = "loaded"; + screenPlayItemImage.exit(); } onClicked: function (mouse) { if (mouse.button === Qt.LeftButton) - App.util.setSidebarItem(root.screenId, root.type) + App.util.setSidebarItem(root.screenId, root.type); else if (mouse.button === Qt.RightButton) - root.openContextMenu(Qt.point(mouseX, mouseY)) + root.openContextMenu(Qt.point(mouseX, mouseY)); } } } diff --git a/ScreenPlay/qml/Installed/ScreenPlayItemImage.qml b/ScreenPlay/qml/Installed/ScreenPlayItemImage.qml index 7e1c4d4d..a60eedc7 100644 --- a/ScreenPlay/qml/Installed/ScreenPlayItemImage.qml +++ b/ScreenPlay/qml/Installed/ScreenPlayItemImage.qml @@ -11,7 +11,6 @@ Item { function enter() { if (root.sourceImageGIF != "") loader_imgGIFPreview.sourceComponent = component_imgGIFPreview; - } function exit() { @@ -33,7 +32,6 @@ Item { source: { if (root.sourceImage === "") return "qrc:/qml/ScreenPlayApp/assets/images/missingPreview.png"; - return root.screenPreview === "" ? "qrc:/qml/ScreenPlayApp/assets/images/missingPreview.png" : Qt.resolvedUrl(absoluteStoragePath + "/" + root.sourceImage); } onStatusChanged: { @@ -57,7 +55,6 @@ Item { source: root.sourceImageGIF === "" ? "qrc:/qml/ScreenPlayApp/assets/images/missingPreview.png" : Qt.resolvedUrl(absoluteStoragePath + "/" + root.sourceImageGIF) fillMode: Image.PreserveAspectCrop } - } Loader { @@ -79,7 +76,6 @@ Item { to: 1 easing.type: Easing.OutQuart } - }, Transition { from: "hover" @@ -92,7 +88,6 @@ Item { to: 0 easing.type: Easing.OutQuart } - }, Transition { from: "loaded" @@ -106,7 +101,6 @@ Item { to: 1 easing.type: Easing.OutQuart } - } ] } diff --git a/ScreenPlay/qml/Installed/Sidebar.qml b/ScreenPlay/qml/Installed/Sidebar.qml index e0f1519c..f88d8322 100644 --- a/ScreenPlay/qml/Installed/Sidebar.qml +++ b/ScreenPlay/qml/Installed/Sidebar.qml @@ -20,83 +20,70 @@ Item { function indexOfValue(model, value) { for (var i = 0; i < model.length; i++) { - let ourValue = model[i].value + let ourValue = model[i].value; if (value === ourValue) - return i + return i; } - return -1 + return -1; } // This is used for removing wallpaper. We need to clear // the preview image/gif so we can release the file for deletion. function clear() { - imagePreview.source = "" - animatedImagePreview.source = "" - txtHeadline.text = "" - root.state = "inactive" + imagePreview.source = ""; + animatedImagePreview.source = ""; + txtHeadline.text = ""; + root.state = "inactive"; } width: 400 state: "inactive" property bool hasPreviewGif: false onContentFolderNameChanged: { - txtHeadline.text = App.installedListModel.get( - root.contentFolderName).m_title - - const previewGiFilePath = Qt.resolvedUrl( - App.globalVariables.localStoragePath + "/" - + root.contentFolderName + "/" + App.installedListModel.get( - root.contentFolderName).m_previewGIF) - - const previewImageFilePath = Qt.resolvedUrl( - App.globalVariables.localStoragePath + "/" - + root.contentFolderName + "/" + App.installedListModel.get( - root.contentFolderName).m_preview) - - root.hasPreviewGif = App.util.fileExists(previewGiFilePath) - + txtHeadline.text = App.installedListModel.get(root.contentFolderName).m_title; + const previewGiFilePath = Qt.resolvedUrl(App.globalVariables.localStoragePath + "/" + root.contentFolderName + "/" + App.installedListModel.get(root.contentFolderName).m_previewGIF); + const previewImageFilePath = Qt.resolvedUrl(App.globalVariables.localStoragePath + "/" + root.contentFolderName + "/" + App.installedListModel.get(root.contentFolderName).m_preview); + root.hasPreviewGif = App.util.fileExists(previewGiFilePath); if (hasPreviewGif) { - animatedImagePreview.source = previewGiFilePath - animatedImagePreview.playing = true + animatedImagePreview.source = previewGiFilePath; + animatedImagePreview.playing = true; } else { - imagePreview.source = previewImageFilePath + imagePreview.source = previewImageFilePath; } - - if (JSUtil.isWidget(root.type) - || (monitorSelection.activeMonitors.length > 0)) { - btnSetWallpaper.enabled = true - return + if (JSUtil.isWidget(root.type) || (monitorSelection.activeMonitors.length > 0)) { + btnSetWallpaper.enabled = true; + return; } - btnSetWallpaper.enabled = false + btnSetWallpaper.enabled = false; } Connections { function onSetSidebarItem(folderName, type) { // Toggle sidebar if clicked on the same content twice - if (root.contentFolderName === folderName - && root.state !== "inactive") { - root.state = "inactive" - return + if (root.contentFolderName === folderName && root.state !== "inactive") { + root.state = "inactive"; + return; } - root.contentFolderName = folderName - root.type = type + root.contentFolderName = folderName; + root.type = type; if (JSUtil.isWallpaper(root.type)) { if (type === InstalledType.VideoWallpaper) - root.state = "activeWallpaper" + root.state = "activeWallpaper"; else - root.state = "activeScene" - btnSetWallpaper.text = qsTr("Set Wallpaper") + root.state = "activeScene"; + btnSetWallpaper.text = qsTr("Set Wallpaper"); } else { - root.state = "activeWidget" - btnSetWallpaper.text = qsTr("Set Widget") + root.state = "activeWidget"; + btnSetWallpaper.text = qsTr("Set Widget"); } } target: App.util } - Util.MouseHoverBlocker {} + Util.MouseHoverBlocker { + } Rectangle { anchors.fill: parent @@ -350,9 +337,7 @@ Item { "text": qsTr("Scale-Down") }] Component.onCompleted: { - cbVideoFillMode.currentIndex = root.indexOfValue( - cbVideoFillMode.model, - App.settings.videoFillMode) + cbVideoFillMode.currentIndex = root.indexOfValue(cbVideoFillMode.model, App.settings.videoFillMode); } } } @@ -361,47 +346,32 @@ Item { Button { id: btnSetWallpaper objectName: "btnSetWallpaper" - enabled: JSUtil.isWidget( - root.type) ? true : monitorSelection.isSelected + enabled: JSUtil.isWidget(root.type) ? true : monitorSelection.isSelected Material.background: Material.accent Material.foreground: "white" icon.source: "qrc:/qml/ScreenPlayApp/assets/icons/icon_plus.svg" icon.color: "white" font.pointSize: 12 onClicked: { - const absoluteStoragePath = App.globalVariables.localStoragePath - + "/" + root.contentFolderName - const previewImage = App.installedListModel.get( - root.contentFolderName).m_preview + const absoluteStoragePath = App.globalVariables.localStoragePath + "/" + root.contentFolderName; + const previewImage = App.installedListModel.get(root.contentFolderName).m_preview; if (JSUtil.isWallpaper(root.type)) { - let activeMonitors = monitorSelection.getActiveMonitors( - ) + let activeMonitors = monitorSelection.getActiveMonitors(); // TODO Alert user to choose a monitor if (activeMonitors.length === 0) - return + return; // We only have sliderVolume if it is a VideoWallpaper - let volume = 0 + let volume = 0; if (type === InstalledType.VideoWallpaper) - volume = Math.round( - sliderVolume.slider.value * 100) / 100 - - const screenFile = App.installedListModel.get( - root.contentFolderName).m_file - let success = App.screenPlayManager.createWallpaper( - root.type, cbVideoFillMode.currentValue, - absoluteStoragePath, previewImage, screenFile, - activeMonitors, volume, 1, {}, true) + volume = Math.round(sliderVolume.slider.value * 100) / 100; + const screenFile = App.installedListModel.get(root.contentFolderName).m_file; + let success = App.screenPlayManager.createWallpaper(root.type, cbVideoFillMode.currentValue, absoluteStoragePath, previewImage, screenFile, activeMonitors, volume, 1, {}, true); } if (JSUtil.isWidget(root.type)) - App.screenPlayManager.createWidget(type, - Qt.point(0, 0), - absoluteStoragePath, - previewImage, {}, - true) - - root.state = "inactive" - monitorSelection.reset() + App.screenPlayManager.createWidget(type, Qt.point(0, 0), absoluteStoragePath, previewImage, {}, true); + root.state = "inactive"; + monitorSelection.reset(); } anchors { diff --git a/ScreenPlay/qml/Monitors/DefaultVideoControls.qml b/ScreenPlay/qml/Monitors/DefaultVideoControls.qml index 7f926494..e1f51bfb 100644 --- a/ScreenPlay/qml/Monitors/DefaultVideoControls.qml +++ b/ScreenPlay/qml/Monitors/DefaultVideoControls.qml @@ -19,7 +19,6 @@ ColumnLayout { let ourValue = model[i].value; if (value === ourValue) return i; - } return -1; } @@ -44,7 +43,6 @@ ColumnLayout { } } - Util.Slider { id: slCurrentVideoTime @@ -83,23 +81,23 @@ ColumnLayout { valueRole: "value" currentIndex: root.indexOfValue(settingsComboBox.model, App.settings.videoFillMode) model: [{ - "value": FillMode.Stretch, - "text": qsTr("Stretch") - }, { - "value": FillMode.Fill, - "text": qsTr("Fill") - }, { - "value": FillMode.Contain, - "text": qsTr("Contain") - }, { - "value": FillMode.Cover, - "text": qsTr("Cover") - }, { - "value": FillMode.Scale_Down, - "text": qsTr("Scale_Down") - }] + "value": FillMode.Stretch, + "text": qsTr("Stretch") + }, { + "value": FillMode.Fill, + "text": qsTr("Fill") + }, { + "value": FillMode.Contain, + "text": qsTr("Contain") + }, { + "value": FillMode.Cover, + "text": qsTr("Cover") + }, { + "value": FillMode.Scale_Down, + "text": qsTr("Scale_Down") + }] onActivated: { - App.screenPlayManager.setWallpaperFillModeAtMonitorIndex(activeMonitorIndex,settingsComboBox.currentValue); + App.screenPlayManager.setWallpaperFillModeAtMonitorIndex(activeMonitorIndex, settingsComboBox.currentValue); } } @@ -107,7 +105,6 @@ ColumnLayout { Layout.fillHeight: true Layout.fillWidth: true } - } states: [ @@ -119,7 +116,6 @@ ColumnLayout { opacity: 1 anchors.topMargin: 20 } - }, State { name: "hidden" @@ -129,7 +125,6 @@ ColumnLayout { opacity: 0 anchors.topMargin: -50 } - } ] transitions: [ @@ -144,7 +139,6 @@ ColumnLayout { easing.type: Easing.InOutQuart properties: "anchors.topMargin, opacity" } - } ] } diff --git a/ScreenPlay/qml/Monitors/MonitorSelection.qml b/ScreenPlay/qml/Monitors/MonitorSelection.qml index 153c29f8..2dd0b1ac 100644 --- a/ScreenPlay/qml/Monitors/MonitorSelection.qml +++ b/ScreenPlay/qml/Monitors/MonitorSelection.qml @@ -20,9 +20,8 @@ Rectangle { property alias radius: root.radius Component.onCompleted: { - resize() - selectOnly(0) - + resize(); + selectOnly(0); } signal requestProjectSettings(var index, var installedType, var appID) @@ -30,87 +29,84 @@ Rectangle { function selectOnly(index) { for (var i = 0; i < rp.count; i++) { if (i === index) { - rp.itemAt(i).isSelected = true - continue + rp.itemAt(i).isSelected = true; + continue; } - rp.itemAt(i).isSelected = false + rp.itemAt(i).isSelected = false; } - getActiveMonitors() + getActiveMonitors(); } function reset() { for (var i = 0; i < rp.count; i++) { - rp.itemAt(i).isSelected = false + rp.itemAt(i).isSelected = false; } - rp.itemAt(0).isSelected = true - getActiveMonitors() + rp.itemAt(0).isSelected = true; + getActiveMonitors(); } function getActiveMonitors() { - root.activeMonitors = [] + root.activeMonitors = []; for (var i = 0; i < rp.count; i++) { if (rp.itemAt(i).isSelected) - root.activeMonitors.push(rp.itemAt(i).index) + root.activeMonitors.push(rp.itemAt(i).index); } // Must be called manually. When QML properties are getting altered in js the // property binding breaks - root.activeMonitorsChanged() - root.isSelected = root.activeMonitors.length > 0 - return root.activeMonitors + root.activeMonitorsChanged(); + root.isSelected = root.activeMonitors.length > 0; + return root.activeMonitors; } function selectMonitorAt(index) { if (!multipleMonitorsSelectable) - selectOnly(index) + selectOnly(index); else - rp.itemAt(index).isSelected = !rp.itemAt(index).isSelected - getActiveMonitors() + rp.itemAt(index).isSelected = !rp.itemAt(index).isSelected; + getActiveMonitors(); if (rp.itemAt(index).hasContent) - root.requestProjectSettings(index, rp.itemAt(index).installedType, - rp.itemAt(index).appID) + root.requestProjectSettings(index, rp.itemAt(index).installedType, rp.itemAt(index).appID); } function resize() { - var absoluteDesktopSize = App.monitorListModel.absoluteDesktopSize() - var isWidthGreaterThanHeight = false - var windowsDelta = 0 + var absoluteDesktopSize = App.monitorListModel.absoluteDesktopSize(); + var isWidthGreaterThanHeight = false; + var windowsDelta = 0; if (absoluteDesktopSize.width < absoluteDesktopSize.height) { - windowsDelta = absoluteDesktopSize.width / absoluteDesktopSize.height - isWidthGreaterThanHeight = false + windowsDelta = absoluteDesktopSize.width / absoluteDesktopSize.height; + isWidthGreaterThanHeight = false; } else { - windowsDelta = absoluteDesktopSize.height / absoluteDesktopSize.width - isWidthGreaterThanHeight = true + windowsDelta = absoluteDesktopSize.height / absoluteDesktopSize.width; + isWidthGreaterThanHeight = true; } if (rp.count === 1) - availableWidth = availableWidth * 0.66 - - var dynamicHeight = availableWidth * windowsDelta - var dynamicWidth = availableHeight * windowsDelta + availableWidth = availableWidth * 0.66; + var dynamicHeight = availableWidth * windowsDelta; + var dynamicWidth = availableHeight * windowsDelta; // Delta (height/width) - var monitorHeightRationDelta = 0 - var monitorWidthRationDelta = 0 + var monitorHeightRationDelta = 0; + var monitorWidthRationDelta = 0; if (isWidthGreaterThanHeight) { - monitorHeightRationDelta = dynamicHeight / absoluteDesktopSize.height - monitorWidthRationDelta = availableWidth / absoluteDesktopSize.width + monitorHeightRationDelta = dynamicHeight / absoluteDesktopSize.height; + monitorWidthRationDelta = availableWidth / absoluteDesktopSize.width; } else { - monitorHeightRationDelta = availableHeight / absoluteDesktopSize.height - monitorWidthRationDelta = dynamicWidth / absoluteDesktopSize.width + monitorHeightRationDelta = availableHeight / absoluteDesktopSize.height; + monitorWidthRationDelta = dynamicWidth / absoluteDesktopSize.width; } for (var i = 0; i < rp.count; i++) { - rp.itemAt(i).index = i - rp.itemAt(i).height = rp.itemAt(i).height * monitorHeightRationDelta - rp.itemAt(i).width = rp.itemAt(i).width * monitorWidthRationDelta - rp.itemAt(i).x = rp.itemAt(i).x * monitorWidthRationDelta - rp.itemAt(i).y = rp.itemAt(i).y * monitorHeightRationDelta - rp.contentWidth += rp.itemAt(i).width - rp.contentHeight += rp.itemAt(i).height + rp.itemAt(i).index = i; + rp.itemAt(i).height = rp.itemAt(i).height * monitorHeightRationDelta; + rp.itemAt(i).width = rp.itemAt(i).width * monitorWidthRationDelta; + rp.itemAt(i).x = rp.itemAt(i).x * monitorWidthRationDelta; + rp.itemAt(i).y = rp.itemAt(i).y * monitorHeightRationDelta; + rp.contentWidth += rp.itemAt(i).width; + rp.contentHeight += rp.itemAt(i).height; } - rp.contentWidth += 200 - rp.contentHeight += 200 + rp.contentWidth += 200; + rp.contentHeight += 200; } - color: Material.theme === Material.Light ? Material.background : Qt.darker( - Material.background) + color: Material.theme === Material.Light ? Material.background : Qt.darker(Material.background) height: availableHeight width: parent.width clip: true @@ -118,7 +114,7 @@ Rectangle { Connections { function onMonitorReloadCompleted() { - resize() + resize(); } target: App.monitorListModel @@ -150,7 +146,7 @@ Rectangle { installedType: m_installedType monitorWithoutContentSelectable: root.monitorWithoutContentSelectable onMonitorSelected: function (index) { - root.selectMonitorAt(index) + root.selectMonitorAt(index); } } } diff --git a/ScreenPlay/qml/Monitors/MonitorSelectionItem.qml b/ScreenPlay/qml/Monitors/MonitorSelectionItem.qml index 9bf77733..99a6f9cf 100644 --- a/ScreenPlay/qml/Monitors/MonitorSelectionItem.qml +++ b/ScreenPlay/qml/Monitors/MonitorSelectionItem.qml @@ -10,10 +10,10 @@ Item { property rect geometry onGeometryChanged: { - root.width = geometry.width - root.height = geometry.height - root.x = geometry.x - root.y = geometry.y + root.width = geometry.width; + root.height = geometry.height; + root.x = geometry.x; + root.y = geometry.y; } property string previewImage @@ -51,7 +51,6 @@ Item { top: wrapper.bottom topMargin: 5 } - } Rectangle { @@ -83,14 +82,12 @@ Item { onClicked: { if (monitorWithoutContentSelectable) { monitorSelected(index); - return + return; } if (root.hasContent && !root.monitorWithoutContentSelectable) monitorSelected(index); - } } - } states: [ @@ -101,7 +98,6 @@ Item { target: wrapper border.color: "#373737" } - }, State { name: "selected" @@ -110,7 +106,6 @@ Item { target: wrapper border.color: "#F28E0D" } - } ] transitions: [ @@ -125,7 +120,6 @@ Item { easing.type: Easing.InOutQuart property: "border.color" } - } ] } diff --git a/ScreenPlay/qml/Monitors/Monitors.qml b/ScreenPlay/qml/Monitors/Monitors.qml index d6061fd0..50596121 100644 --- a/ScreenPlay/qml/Monitors/Monitors.qml +++ b/ScreenPlay/qml/Monitors/Monitors.qml @@ -18,12 +18,12 @@ Util.Popup { width: 1000 height: 500 onOpened: { - monitorSelection.selectMonitorAt(0) + monitorSelection.selectMonitorAt(0); } Connections { function onRequestToggleWallpaperConfiguration() { - root.open() + root.open(); } target: App.util @@ -81,21 +81,18 @@ Util.Popup { availableHeight: 150 onRequestProjectSettings: function (index, installedType, appID) { if (installedType === InstalledType.VideoWallpaper) { - videoControlWrapper.state = "visible" - customPropertiesGridView.visible = false - const wallpaper = App.screenPlayManager.getWallpaperByAppID( - appID) - videoControlWrapper.wallpaper = wallpaper + videoControlWrapper.state = "visible"; + customPropertiesGridView.visible = false; + const wallpaper = App.screenPlayManager.getWallpaperByAppID(appID); + videoControlWrapper.wallpaper = wallpaper; } else { - videoControlWrapper.state = "hidden" - customPropertiesGridView.visible = true - if (!App.screenPlayManager.requestProjectSettingsAtMonitorIndex( - index)) { - console.warn("Unable to get requested settings from index: ", - index) + videoControlWrapper.state = "hidden"; + customPropertiesGridView.visible = true; + if (!App.screenPlayManager.requestProjectSettingsAtMonitorIndex(index)) { + console.warn("Unable to get requested settings from index: ", index); } } - activeMonitorIndex = index + activeMonitorIndex = index; } anchors { @@ -107,7 +104,7 @@ Util.Popup { Connections { function onProjectSettingsListModelResult(listModel) { - customPropertiesGridView.projectSettingsListmodelRef = listModel + customPropertiesGridView.projectSettingsListmodelRef = listModel; } target: App.screenPlayManager @@ -130,39 +127,32 @@ Util.Popup { highlighted: true text: qsTr("Remove selected") font.family: App.settings.font - enabled: monitorSelection.activeMonitors.length == 1 - && App.screenPlayManager.activeWallpaperCounter > 0 + enabled: monitorSelection.activeMonitors.length == 1 && App.screenPlayManager.activeWallpaperCounter > 0 onClicked: { - if (!App.screenPlayManager.removeWallpaperAt( - monitorSelection.activeMonitors[0])) - print("Unable to close singel wallpaper") + if (!App.screenPlayManager.removeWallpaperAt(monitorSelection.activeMonitors[0])) + print("Unable to close singel wallpaper"); } } Button { id: btnRemoveAllWallpape - text: qsTr("Remove all ") - + App.screenPlayManager.activeWallpaperCounter + " " + qsTr( - "Wallpapers") + text: qsTr("Remove all ") + App.screenPlayManager.activeWallpaperCounter + " " + qsTr("Wallpapers") Material.background: Material.accent highlighted: true font.family: App.settings.font enabled: App.screenPlayManager.activeWallpaperCounter > 0 onClicked: { if (!App.screenPlayManager.removeAllWallpapers()) - print("Unable to close all wallpaper!") - - root.close() + print("Unable to close all wallpaper!"); + root.close(); } } Button { id: btnRemoveAllWidgets - text: qsTr("Remove all ") - + App.screenPlayManager.activeWidgetsCounter + " " + qsTr( - "Widgets") + text: qsTr("Remove all ") + App.screenPlayManager.activeWidgetsCounter + " " + qsTr("Widgets") Material.background: Material.accent Material.foreground: Material.primaryTextColor highlighted: true @@ -170,17 +160,15 @@ Util.Popup { enabled: App.screenPlayManager.activeWidgetsCounter > 0 onClicked: { if (!App.screenPlayManager.removeAllWidgets()) - print("Unable to close all widgets!") - - root.close() + print("Unable to close all widgets!"); + root.close(); } } } } Rectangle { - color: Material.theme === Material.Light ? Material.background : Qt.darker( - Material.background) + color: Material.theme === Material.Light ? Material.background : Qt.darker(Material.background) radius: 3 clip: true @@ -262,7 +250,7 @@ Util.Popup { Connections { function onProfilesSaved() { if (root.opened) - saveNotification.open() + saveNotification.open(); } target: App.screenPlayManager diff --git a/ScreenPlay/qml/Monitors/MonitorsProjectSettingItem.qml b/ScreenPlay/qml/Monitors/MonitorsProjectSettingItem.qml index 12462f6f..88f7f406 100644 --- a/ScreenPlay/qml/Monitors/MonitorsProjectSettingItem.qml +++ b/ScreenPlay/qml/Monitors/MonitorsProjectSettingItem.qml @@ -35,7 +35,6 @@ Item { left: parent.left leftMargin: root.isHeadline ? 0 : 25 } - } Item { @@ -43,8 +42,7 @@ Item { visible: !root.isHeadline Component.onCompleted: { if (root.isHeadline) - return ; - + return; switch (root.value["type"]) { case "slider": loader.sourceComponent = compSlider; @@ -64,7 +62,6 @@ Item { } if (root.value["text"]) txtDescription.text = root.value["text"]; - } anchors { @@ -86,7 +83,6 @@ Item { target: loader.item } - } Component { @@ -119,11 +115,8 @@ Item { right: parent.right verticalCenter: parent.verticalCenter } - } - } - } Component { @@ -148,7 +141,6 @@ Item { right: parent.right verticalCenter: parent.verticalCenter } - } Rectangle { @@ -166,7 +158,6 @@ Item { rightMargin: 20 verticalCenter: parent.verticalCenter } - } ColorDialog { @@ -184,9 +175,7 @@ Item { App.screenPlayManager.setWallpaperValueAtMonitorIndex(selectedMonitor, name, tmpColor); } } - } - } Component { @@ -233,7 +222,6 @@ Item { left: parent.left leftMargin: 20 } - } Text { @@ -247,13 +235,8 @@ Item { right: parent.right verticalCenter: parent.verticalCenter } - } - } - } - } - } diff --git a/ScreenPlay/qml/Monitors/SaveNotification.qml b/ScreenPlay/qml/Monitors/SaveNotification.qml index 5a54ef71..2b1492d8 100644 --- a/ScreenPlay/qml/Monitors/SaveNotification.qml +++ b/ScreenPlay/qml/Monitors/SaveNotification.qml @@ -51,7 +51,6 @@ Rectangle { bottom: parent.bottom bottomMargin: 5 } - } layer.effect: ElevationEffect { @@ -70,7 +69,6 @@ Rectangle { duration: 250 easing.type: Easing.InOutQuart } - } ] states: [ @@ -82,7 +80,6 @@ Rectangle { anchors.bottomMargin: 10 opacity: 1 } - } ] } diff --git a/ScreenPlay/qml/Navigation/ExitPopup.qml b/ScreenPlay/qml/Navigation/ExitPopup.qml index 4e5b9312..3a2ebd3e 100644 --- a/ScreenPlay/qml/Navigation/ExitPopup.qml +++ b/ScreenPlay/qml/Navigation/ExitPopup.qml @@ -9,7 +9,6 @@ import ScreenPlay import ScreenPlayUtil as Util import Qt5Compat.GraphicalEffects - /*! \qmltype exitDialog \brief exitDialog @@ -46,10 +45,10 @@ Util.Popup { Text { text: { if (Qt.platform.os === "windows") { - return qsTr("You can quit ScreenPlay via the bottom right Tray-Icon.") + return qsTr("You can quit ScreenPlay via the bottom right Tray-Icon."); } if (Qt.platform.os === "osx") { - return qsTr("You can quit ScreenPlay via the top right Tray-Icon.") + return qsTr("You can quit ScreenPlay via the top right Tray-Icon."); } } @@ -75,20 +74,20 @@ Util.Popup { Button { text: qsTr("Minimize ScreenPlay") onClicked: { - applicationWindow.hide() - App.showDockIcon(false) - root.close() + applicationWindow.hide(); + App.showDockIcon(false); + root.close(); } } Button { highlighted: true text: qsTr("Always minimize ScreenPlay") onClicked: { - settings.setValue("alwaysMinimize", true) - settings.sync() - App.showDockIcon(false) - applicationWindow.hide() - root.close() + settings.setValue("alwaysMinimize", true); + settings.sync(); + App.showDockIcon(false); + applicationWindow.hide(); + root.close(); } } } diff --git a/ScreenPlay/qml/Navigation/Navigation.qml b/ScreenPlay/qml/Navigation/Navigation.qml index fec57139..16b5c639 100644 --- a/ScreenPlay/qml/Navigation/Navigation.qml +++ b/ScreenPlay/qml/Navigation/Navigation.qml @@ -22,31 +22,30 @@ Rectangle { signal changePage(string name) function setActive(active) { - navActive = active + navActive = active; if (active) - root.state = "enabled" + root.state = "enabled"; else - root.state = "disabled" + root.state = "disabled"; } function setNavigation(name) { - var i = 0 + var i = 0; for (; i < navArray.length; i++) { if (navArray[i].name === name) { - navArray[i].state = "active" - root.currentNavigationName = name + navArray[i].state = "active"; + root.currentNavigationName = name; } else { - navArray[i].state = "inactive" + navArray[i].state = "inactive"; } } } function onPageChanged(name) { if (!navActive) - return - - root.changePage(name) - setNavigation(name) + return; + root.changePage(name); + setNavigation(name); } implicitWidth: 1366 @@ -60,11 +59,11 @@ Rectangle { Connections { function onRequestNavigationActive(isActive) { - setActive(isActive) + setActive(isActive); } function onRequestNavigation(nav) { - onPageChanged(nav) + onPageChanged(nav); } target: App.util @@ -83,16 +82,6 @@ Rectangle { spacing: 0 - component CustomTabButton: TabButton { - icon.height: 16 - icon.width: 16 - font.pointSize: 12 - height: parent.height - width: implicitWidth - background: Item {} - font.capitalization: Font.MixedCase - } - CustomTabButton { id: navCreate icon.height: 22 @@ -100,7 +89,7 @@ Rectangle { text: qsTr("Create") icon.source: "qrc:/qml/ScreenPlayApp/assets/icons/icon_plus.svg" onClicked: { - root.onPageChanged("Create") + root.onPageChanged("Create"); } objectName: "createTab" } @@ -111,7 +100,7 @@ Rectangle { text: qsTr("Workshop") icon.source: "qrc:/qml/ScreenPlayApp/assets/icons/icon_steam.svg" onClicked: { - root.onPageChanged("Workshop") + root.onPageChanged("Workshop"); } objectName: "workshopTab" } @@ -121,7 +110,7 @@ Rectangle { text: qsTr("Installed") + " " + App.installedListModel.count icon.source: "qrc:/qml/ScreenPlayApp/assets/icons/icon_installed.svg" onClicked: { - root.onPageChanged("Installed") + root.onPageChanged("Installed"); } objectName: "installedTab" } @@ -131,7 +120,7 @@ Rectangle { text: qsTr("Community") icon.source: "qrc:/qml/ScreenPlayApp/assets/icons/icon_community.svg" onClicked: { - root.onPageChanged("Community") + root.onPageChanged("Community"); } objectName: "communityTab" } @@ -141,20 +130,30 @@ Rectangle { text: qsTr("Settings") icon.source: "qrc:/qml/ScreenPlayApp/assets/icons/icon_settings.svg" onClicked: { - root.onPageChanged("Settings") + root.onPageChanged("Settings"); } objectName: "settingsTab" } } + component CustomTabButton: TabButton { + icon.height: 16 + icon.width: 16 + font.pointSize: 12 + height: parent.height + width: implicitWidth + background: Item { + } + font.capitalization: Font.MixedCase + } + Rectangle { id: quickActionRowBackground anchors.centerIn: quickActionRow width: quickActionRow.width + 5 height: quickActionRow.height - 16 color: Material.theme === Material.Light ? Material.background : "#242424" - border.color: Material.theme === Material.Light ? Material.iconDisabledColor : Qt.darker( - Material.background) + border.color: Material.theme === Material.Light ? Material.iconDisabledColor : Qt.darker(Material.background) border.width: 1 radius: 3 } @@ -170,8 +169,7 @@ Rectangle { ToolButton { icon.source: "qrc:/qml/ScreenPlayApp/assets/icons/font-awsome/patreon-brands.svg" text: qsTr("Support me on Patreon!") - onClicked: Qt.openUrlExternally( - "https://www.patreon.com/ScreenPlayApp") + onClicked: Qt.openUrlExternally("https://www.patreon.com/ScreenPlayApp") } } @@ -184,13 +182,12 @@ Rectangle { bottom: parent.bottom } - property bool contentActive: App.screenPlayManager.activeWallpaperCounter > 0 - || App.screenPlayManager.activeWidgetsCounter > 0 + property bool contentActive: App.screenPlayManager.activeWallpaperCounter > 0 || App.screenPlayManager.activeWidgetsCounter > 0 onContentActiveChanged: { if (!contentActive) { - miMuteAll.soundEnabled = true - miStopAll.isPlaying = true + miMuteAll.soundEnabled = true; + miStopAll.isPlaying = true; } } @@ -206,12 +203,11 @@ Rectangle { property bool soundEnabled: true onSoundEnabledChanged: { if (miMuteAll.soundEnabled) { - miMuteAll.icon.source = "qrc:/qml/ScreenPlayApp/assets/icons/icon_volume.svg" - App.screenPlayManager.setAllWallpaperValue("muted", "false") + miMuteAll.icon.source = "qrc:/qml/ScreenPlayApp/assets/icons/icon_volume.svg"; + App.screenPlayManager.setAllWallpaperValue("muted", "false"); } else { - miMuteAll.icon.source - = "qrc:/qml/ScreenPlayApp/assets/icons/icon_volume_mute.svg" - App.screenPlayManager.setAllWallpaperValue("muted", "true") + miMuteAll.icon.source = "qrc:/qml/ScreenPlayApp/assets/icons/icon_volume_mute.svg"; + App.screenPlayManager.setAllWallpaperValue("muted", "true"); } } @@ -230,13 +226,11 @@ Rectangle { property bool isPlaying: true onIsPlayingChanged: { if (miStopAll.isPlaying) { - miStopAll.icon.source = "qrc:/qml/ScreenPlayApp/assets/icons/icon_pause.svg" - App.screenPlayManager.setAllWallpaperValue("isPlaying", - "true") + miStopAll.icon.source = "qrc:/qml/ScreenPlayApp/assets/icons/icon_pause.svg"; + App.screenPlayManager.setAllWallpaperValue("isPlaying", "true"); } else { - miStopAll.icon.source = "qrc:/qml/ScreenPlayApp/assets/icons/icon_play.svg" - App.screenPlayManager.setAllWallpaperValue("isPlaying", - "false") + miStopAll.icon.source = "qrc:/qml/ScreenPlayApp/assets/icons/icon_play.svg"; + App.screenPlayManager.setAllWallpaperValue("isPlaying", "false"); } } hoverEnabled: true @@ -252,10 +246,10 @@ Rectangle { icon.width: root.iconWidth icon.height: root.iconHeight onClicked: { - App.screenPlayManager.removeAllWallpapers() - App.screenPlayManager.removeAllWidgets() - miStopAll.isPlaying = true - miMuteAll.soundEnabled = true + App.screenPlayManager.removeAllWallpapers(); + App.screenPlayManager.removeAllWidgets(); + miStopAll.isPlaying = true; + miMuteAll.soundEnabled = true; } hoverEnabled: true diff --git a/ScreenPlay/qml/Settings/SettingBool.qml b/ScreenPlay/qml/Settings/SettingBool.qml index 14430d29..d2915787 100644 --- a/ScreenPlay/qml/Settings/SettingBool.qml +++ b/ScreenPlay/qml/Settings/SettingBool.qml @@ -19,11 +19,11 @@ Item { width: parent.width onAvailableChanged: { if (!available) { - settingsBool.opacity = 0.5 - radioButton.enabled = false + settingsBool.opacity = 0.5; + radioButton.enabled = false; } else { - settingsButton.opacity = 1 - radioButton.enabled = true + settingsButton.opacity = 1; + radioButton.enabled = true; } } @@ -55,12 +55,10 @@ Item { wrapMode: Text.WordWrap linkColor: Material.color(Material.Orange) onLinkActivated: function (link) { - Qt.openUrlExternally(link) + Qt.openUrlExternally(link); } - color: Material.theme === Material.Light ? Qt.lighter( - Material.foreground) : Qt.darker( - Material.foreground) + color: Material.theme === Material.Light ? Qt.lighter(Material.foreground) : Qt.darker(Material.foreground) font.family: App.settings.font verticalAlignment: Text.AlignVCenter horizontalAlignment: Text.AlignLeft @@ -82,9 +80,9 @@ Item { checked: settingsBool.isChecked onCheckedChanged: { if (radioButton.checkState === Qt.Checked) - checkboxChanged(true) + checkboxChanged(true); else - checkboxChanged(false) + checkboxChanged(false); } anchors { diff --git a/ScreenPlay/qml/Settings/Settings.qml b/ScreenPlay/qml/Settings/Settings.qml index 1dfd225b..a7f90730 100644 --- a/ScreenPlay/qml/Settings/Settings.qml +++ b/ScreenPlay/qml/Settings/Settings.qml @@ -17,11 +17,11 @@ Item { function indexOfValue(model, value) { for (var i = 0; i < model.length; i++) { - let ourValue = model[i].value + let ourValue = model[i].value; if (value === ourValue) - return i + return i; } - return -1 + return -1; } Flickable { @@ -69,11 +69,12 @@ Item { description: qsTr("ScreenPlay will start with Windows and will setup your Desktop every time for you.") isChecked: App.settings.autostart onCheckboxChanged: function (checked) { - App.settings.setAutostart(checked) + App.settings.setAutostart(checked); } } - SettingsHorizontalSeperator {} + SettingsHorizontalSeperator { + } SettingBool { headline: qsTr("High priority Autostart") @@ -81,11 +82,12 @@ Item { description: qsTr("This options grants ScreenPlay a higher autostart priority than other apps.") isChecked: App.settings.highPriorityStart onCheckboxChanged: { - App.settings.setHighPriorityStart(checked) + App.settings.setHighPriorityStart(checked); } } - SettingsHorizontalSeperator {} + SettingsHorizontalSeperator { + } SettingBool { height: 70 @@ -93,33 +95,33 @@ Item { description: qsTr("Help us make ScreenPlay faster and more stable. All collected data is purely anonymous and only used for development purposes! We use sentry.io to collect and analyze this data. A big thanks to them for providing us with free premium support for open source projects!") isChecked: App.settings.anonymousTelemetry onCheckboxChanged: function (checked) { - App.settings.setAnonymousTelemetry(checked) + App.settings.setAnonymousTelemetry(checked); } } - SettingsHorizontalSeperator {} + SettingsHorizontalSeperator { + } SettingsButton { headline: qsTr("Set save location") buttonText: qsTr("Set location") description: { // Remove file:/// so the used does not get confused - let path = App.globalVariables.localStoragePath + "" + let path = App.globalVariables.localStoragePath + ""; if (path.length === 0) - return qsTr("Your storage path is empty!") + return qsTr("Your storage path is empty!"); else - return path.replace('file:///', '') + return path.replace('file:///', ''); } onButtonPressed: { - folderDialogSaveLocation.open() + folderDialogSaveLocation.open(); } FolderDialog { id: folderDialogSaveLocation folder: App.globalVariables.localStoragePath onAccepted: { - App.settings.setLocalStoragePath( - folderDialogSaveLocation.currentFolder) + App.settings.setLocalStoragePath(folderDialogSaveLocation.currentFolder); } } } @@ -142,7 +144,8 @@ Item { } } - SettingsHorizontalSeperator {} + SettingsHorizontalSeperator { + } SettingsComboBox { id: settingsLanguage @@ -150,9 +153,7 @@ Item { headline: qsTr("Language") description: qsTr("Set the ScreenPlay UI Language") Component.onCompleted: { - settingsLanguage.comboBox.currentIndex = root.indexOfValue( - settingsLanguage.comboBox.model, - App.settings.language) + settingsLanguage.comboBox.currentIndex = root.indexOfValue(settingsLanguage.comboBox.model, App.settings.language); } comboBox { @@ -197,14 +198,14 @@ Item { "text": "Dutch" }] onActivated: { - App.settings.setLanguage( - settingsLanguage.comboBox.currentValue) - App.settings.retranslateUI() + App.settings.setLanguage(settingsLanguage.comboBox.currentValue); + App.settings.retranslateUI(); } } } - SettingsHorizontalSeperator {} + SettingsHorizontalSeperator { + } SettingsComboBox { id: settingsTheme @@ -212,9 +213,7 @@ Item { headline: qsTr("Theme") description: qsTr("Switch dark/light theme") Component.onCompleted: { - settingsTheme.comboBox.currentIndex = root.indexOfValue( - settingsTheme.comboBox.model, - App.settings.theme) + settingsTheme.comboBox.currentIndex = root.indexOfValue(settingsTheme.comboBox.model, App.settings.theme); } comboBox { @@ -229,8 +228,7 @@ Item { "text": qsTr("Light") }] onActivated: { - App.settings.setTheme( - settingsTheme.comboBox.currentValue) + App.settings.setTheme(settingsTheme.comboBox.currentValue); } } } @@ -256,11 +254,12 @@ Item { description: qsTr("We disable the video rendering (not the audio!) for the best performance. If you have problem you can disable this behaviour here. Wallpaper restart required!") isChecked: App.settings.checkWallpaperVisible onCheckboxChanged: function (checked) { - App.settings.setCheckWallpaperVisible(checked) + App.settings.setCheckWallpaperVisible(checked); } } - SettingsHorizontalSeperator {} + SettingsHorizontalSeperator { + } SettingsComboBox { id: cbVideoFillMode @@ -268,14 +267,11 @@ Item { headline: qsTr("Default Fill Mode") description: qsTr("Set this property to define how the video is scaled to fit the target area.") Component.onCompleted: { - cbVideoFillMode.comboBox.currentIndex = root.indexOfValue( - cbVideoFillMode.comboBox.model, - App.settings.videoFillMode) + cbVideoFillMode.comboBox.currentIndex = root.indexOfValue(cbVideoFillMode.comboBox.model, App.settings.videoFillMode); } comboBox { - onActivated: App.settings.setVideoFillMode( - cbVideoFillMode.comboBox.currentValue) + onActivated: App.settings.setVideoFillMode(cbVideoFillMode.comboBox.currentValue) model: [{ "value": FillMode.Stretch, "text": qsTr("Stretch") @@ -319,8 +315,7 @@ Item { Item { width: parent.width - height: txtHeadline.paintedHeight + txtDescriptionAbout.paintedHeight - + wrapperLinks.childrenRect.height + 80 + height: txtHeadline.paintedHeight + txtDescriptionAbout.paintedHeight + wrapperLinks.childrenRect.height + 80 Text { id: txtHeadline @@ -443,26 +438,27 @@ Item { } } - SettingsHorizontalSeperator {} + SettingsHorizontalSeperator { + } SettingsButton { icon.source: "qrc:/qml/ScreenPlayApp/assets/icons/icon_launch.svg" headline: qsTr("Version") description: App.settings.buildInfos buttonText: qsTr("Open Changelog") - onButtonPressed: Qt.openUrlExternally( - "https://gitlab.com/kelteseth/ScreenPlay/-/releases") + onButtonPressed: Qt.openUrlExternally("https://gitlab.com/kelteseth/ScreenPlay/-/releases") } - SettingsHorizontalSeperator {} + SettingsHorizontalSeperator { + } SettingsButton { headline: qsTr("Third Party Software") description: qsTr("ScreenPlay would not be possible without the work of others. A big thank you to: ") buttonText: qsTr("Licenses") onButtonPressed: { - App.util.requestAllLicenses() - expanderCopyright.toggle() + App.util.requestAllLicenses(); + expanderCopyright.toggle(); } } @@ -471,21 +467,22 @@ Item { Connections { function onAllLicenseLoaded(licensesText) { - expanderCopyright.text = licensesText + expanderCopyright.text = licensesText; } target: App.util } } - SettingsHorizontalSeperator {} + SettingsHorizontalSeperator { + } SettingsButton { headline: qsTr("Logs") description: qsTr("If your ScreenPlay missbehaves this is a good way to look for answers. This shows all logs and warning during runtime.") buttonText: qsTr("Show Logs") onButtonPressed: { - expanderDebug.toggle() + expanderDebug.toggle(); } } @@ -495,15 +492,16 @@ Item { text: App.util.debugMessages } - SettingsHorizontalSeperator {} + SettingsHorizontalSeperator { + } SettingsButton { headline: qsTr("Data Protection") description: qsTr("We use you data very carefully to improve ScreenPlay. We do not sell or share this (anonymous) information with others!") buttonText: qsTr("Privacy") onButtonPressed: { - App.util.requestDataProtection() - expanderDataProtection.toggle() + App.util.requestDataProtection(); + expanderDataProtection.toggle(); } } @@ -512,7 +510,7 @@ Item { Connections { function onAllDataProtectionLoaded(dataProtectionText) { - expanderDataProtection.text = dataProtectionText + expanderDataProtection.text = dataProtectionText; } target: App.util diff --git a/ScreenPlay/qml/Settings/SettingsButton.qml b/ScreenPlay/qml/Settings/SettingsButton.qml index d1918ca8..7a4c0b4a 100644 --- a/ScreenPlay/qml/Settings/SettingsButton.qml +++ b/ScreenPlay/qml/Settings/SettingsButton.qml @@ -16,7 +16,7 @@ Item { property bool enabled: true property bool available: true - signal buttonPressed() + signal buttonPressed height: txtHeadline.paintedHeight + txtDescription.paintedHeight + 20 width: parent.width @@ -46,7 +46,6 @@ Item { left: parent.left leftMargin: 20 } - } Text { @@ -68,7 +67,6 @@ Item { right: btnSettings.left rightMargin: 20 } - } Button { @@ -87,7 +85,5 @@ Item { rightMargin: 20 verticalCenter: parent.verticalCenter } - } - } diff --git a/ScreenPlay/qml/Settings/SettingsComboBox.qml b/ScreenPlay/qml/Settings/SettingsComboBox.qml index cc7a77d9..e25fea12 100644 --- a/ScreenPlay/qml/Settings/SettingsComboBox.qml +++ b/ScreenPlay/qml/Settings/SettingsComboBox.qml @@ -32,7 +32,6 @@ Control { left: parent.left leftMargin: 20 } - } Text { @@ -54,7 +53,6 @@ Control { right: comboBox.left rightMargin: 20 } - } ComboBox { @@ -70,7 +68,5 @@ Control { rightMargin: 20 verticalCenter: parent.verticalCenter } - } - } diff --git a/ScreenPlay/qml/Settings/SettingsExpander.qml b/ScreenPlay/qml/Settings/SettingsExpander.qml index e93520b3..d9f8dc73 100644 --- a/ScreenPlay/qml/Settings/SettingsExpander.qml +++ b/ScreenPlay/qml/Settings/SettingsExpander.qml @@ -41,7 +41,6 @@ Item { left: parent.left margins: 20 } - } MouseArea { @@ -55,7 +54,6 @@ Item { snapMode: ScrollBar.SnapOnRelease policy: ScrollBar.AlwaysOn } - } Menu { @@ -67,7 +65,6 @@ Item { App.util.copyToClipboard(txtExpander.text); } } - } states: [ @@ -78,7 +75,6 @@ Item { target: root height: 500 } - }, State { name: "off" @@ -87,7 +83,6 @@ Item { target: root height: 0 } - } ] transitions: [ @@ -101,7 +96,6 @@ Item { property: "height" duration: 250 } - } ] } diff --git a/ScreenPlay/qml/Settings/SettingsHeader.qml b/ScreenPlay/qml/Settings/SettingsHeader.qml index 08ac458c..200f1f93 100644 --- a/ScreenPlay/qml/Settings/SettingsHeader.qml +++ b/ScreenPlay/qml/Settings/SettingsHeader.qml @@ -28,7 +28,6 @@ Item { right: parent.right left: parent.left } - } Rectangle { @@ -63,7 +62,6 @@ Item { left: parent.left leftMargin: 0 } - } ColorOverlay { @@ -89,11 +87,8 @@ Item { left: parent.left leftMargin: 30 } - } - } - } states: [ @@ -111,7 +106,6 @@ Item { anchors.topMargin: 10 opacity: 0 } - }, State { name: "in" @@ -127,7 +121,6 @@ Item { anchors.topMargin: 2 opacity: 1 } - } ] transitions: [ @@ -142,7 +135,6 @@ Item { duration: 400 easing.type: Easing.InOutQuart } - } ] } diff --git a/ScreenPlay/qml/Settings/SettingsHorizontalSeperator.qml b/ScreenPlay/qml/Settings/SettingsHorizontalSeperator.qml index 27fff741..e1dd8f8e 100644 --- a/ScreenPlay/qml/Settings/SettingsHorizontalSeperator.qml +++ b/ScreenPlay/qml/Settings/SettingsHorizontalSeperator.qml @@ -23,7 +23,5 @@ Item { leftMargin: customMargin verticalCenter: parent.verticalCenter } - } - } diff --git a/ScreenPlay/qml/Workshop/Workshop.qml b/ScreenPlay/qml/Workshop/Workshop.qml index 69ef2668..7edb1cc5 100644 --- a/ScreenPlay/qml/Workshop/Workshop.qml +++ b/ScreenPlay/qml/Workshop/Workshop.qml @@ -14,12 +14,11 @@ Item { Component.onCompleted: { if (App.settings.steamVersion) { - workshopLoader.setSource( - "qrc:/qml/ScreenPlayWorkshop/qml/SteamWorkshop.qml", { - "modalSource": modalSource - }) + workshopLoader.setSource("qrc:/qml/ScreenPlayWorkshop/qml/SteamWorkshop.qml", { + "modalSource": modalSource + }); } else { - workshopLoader.setSource("qrc:/qml/ScreenPlayWorkshop/qml/Forum.qml") + workshopLoader.setSource("qrc:/qml/ScreenPlayWorkshop/qml/Forum.qml"); } } diff --git a/ScreenPlay/src/app.cpp b/ScreenPlay/src/app.cpp index b9dbc260..e847a99d 100644 --- a/ScreenPlay/src/app.cpp +++ b/ScreenPlay/src/app.cpp @@ -5,19 +5,19 @@ #include "ScreenPlayUtil/macutils.h" #endif +#include "app.h" #include "steam/steam_qt_enums_generated.h" #include #include #include -#include "app.h" namespace ScreenPlay { -/*! +/*! \module ScreenPlay \title ScreenPlay - + \brief Module for ScreenPlay. */ /*! @@ -367,138 +367,138 @@ void App::setGlobalVariables(GlobalVariables* globalVariables) \property App::screenPlayManager \brief Sets the screen play manager. */ - void App::setScreenPlayManager(ScreenPlayManager* screenPlayManager) - { - if (m_screenPlayManager.get() == screenPlayManager) - return; +void App::setScreenPlayManager(ScreenPlayManager* screenPlayManager) +{ + if (m_screenPlayManager.get() == screenPlayManager) + return; - m_screenPlayManager.reset(screenPlayManager); - emit screenPlayManagerChanged(m_screenPlayManager.get()); - } + m_screenPlayManager.reset(screenPlayManager); + emit screenPlayManagerChanged(m_screenPlayManager.get()); +} /*! \property App::create \brief . . */ - void App::setCreate(Create* create) - { - if (m_create.get() == create) - return; +void App::setCreate(Create* create) +{ + if (m_create.get() == create) + return; - m_create.reset(create); - emit createChanged(m_create.get()); - } + m_create.reset(create); + emit createChanged(m_create.get()); +} /*! \property App::util \brief . . */ - void App::setUtil(Util* util) - { - if (m_util.get() == util) - return; +void App::setUtil(Util* util) +{ + if (m_util.get() == util) + return; - m_util.reset(util); - emit utilChanged(m_util.get()); - } + m_util.reset(util); + emit utilChanged(m_util.get()); +} /*! \property App::settings \brief . . */ - void App::setSettings(Settings* settings) - { - if (m_settings.get() == settings) - return; +void App::setSettings(Settings* settings) +{ + if (m_settings.get() == settings) + return; - m_settings.reset(settings); - emit settingsChanged(m_settings.get()); - } + m_settings.reset(settings); + emit settingsChanged(m_settings.get()); +} /*! \property App::installedListModel \brief . . */ - void App::setInstalledListModel(InstalledListModel* installedListModel) - { - if (m_installedListModel.get() == installedListModel) - return; +void App::setInstalledListModel(InstalledListModel* installedListModel) +{ + if (m_installedListModel.get() == installedListModel) + return; - m_installedListModel.reset(installedListModel); - emit installedListModelChanged(m_installedListModel.get()); - } + m_installedListModel.reset(installedListModel); + emit installedListModelChanged(m_installedListModel.get()); +} /*! \property App::monitorListModel \brief . . */ - void App::setMonitorListModel(MonitorListModel* monitorListModel) - { - if (m_monitorListModel.get() == monitorListModel) - return; +void App::setMonitorListModel(MonitorListModel* monitorListModel) +{ + if (m_monitorListModel.get() == monitorListModel) + return; - m_monitorListModel.reset(monitorListModel); - emit monitorListModelChanged(m_monitorListModel.get()); - } + m_monitorListModel.reset(monitorListModel); + emit monitorListModelChanged(m_monitorListModel.get()); +} /*! \property App::profileListModel \brief . . */ - void App::setProfileListModel(ProfileListModel* profileListModel) - { - if (m_profileListModel.get() == profileListModel) - return; +void App::setProfileListModel(ProfileListModel* profileListModel) +{ + if (m_profileListModel.get() == profileListModel) + return; - m_profileListModel.reset(profileListModel); - emit profileListModelChanged(m_profileListModel.get()); - } + m_profileListModel.reset(profileListModel); + emit profileListModelChanged(m_profileListModel.get()); +} /*! \property App::installedListFilter \brief . . */ - void App::setInstalledListFilter(InstalledListFilter* installedListFilter) - { - if (m_installedListFilter.get() == installedListFilter) - return; +void App::setInstalledListFilter(InstalledListFilter* installedListFilter) +{ + if (m_installedListFilter.get() == installedListFilter) + return; - m_installedListFilter.reset(installedListFilter); - emit installedListFilterChanged(m_installedListFilter.get()); - } + m_installedListFilter.reset(installedListFilter); + emit installedListFilterChanged(m_installedListFilter.get()); +} /*! \property App::mainWindowEngine \brief . . */ - void App::setMainWindowEngine(QQmlApplicationEngine* mainWindowEngine) - { - if (m_mainWindowEngine.get() == mainWindowEngine) - return; +void App::setMainWindowEngine(QQmlApplicationEngine* mainWindowEngine) +{ + if (m_mainWindowEngine.get() == mainWindowEngine) + return; - m_mainWindowEngine.reset(mainWindowEngine); - emit mainWindowEngineChanged(m_mainWindowEngine.get()); - } + m_mainWindowEngine.reset(mainWindowEngine); + emit mainWindowEngineChanged(m_mainWindowEngine.get()); +} /*! \property App::wizards \brief . . */ - void App::setWizards(Wizards* wizards) - { - if (m_wizards.get() == wizards) - return; +void App::setWizards(Wizards* wizards) +{ + if (m_wizards.get() == wizards) + return; - m_wizards.reset(wizards); - emit wizardsChanged(m_wizards.get()); - } + m_wizards.reset(wizards); + emit wizardsChanged(m_wizards.get()); +} } diff --git a/ScreenPlayShader/src/ShadertoyShader.qml b/ScreenPlayShader/src/ShadertoyShader.qml index 2f53c6a1..6c394cb0 100644 --- a/ScreenPlayShader/src/ShadertoyShader.qml +++ b/ScreenPlayShader/src/ShadertoyShader.qml @@ -152,5 +152,4 @@ qt_TexCoord0 = qt_MultiTexCoord0; root.iDate.w = currentDate.getSeconds(); } } - } diff --git a/ScreenPlayShader/src/TestMain.qml b/ScreenPlayShader/src/TestMain.qml index ce9eeadd..7e1f1e4b 100644 --- a/ScreenPlayShader/src/TestMain.qml +++ b/ScreenPlayShader/src/TestMain.qml @@ -22,8 +22,7 @@ Window { property real frequency: 2 property real time: 0 property real framerate: 60 - property real updateInterval: Math.round( - (1000 / framerate) * 10) / 10 + property real updateInterval: Math.round((1000 / framerate) * 10) / 10 Timer { interval: updateInterval @@ -32,9 +31,9 @@ Window { repeat: true onTriggered: { if (parent.time > 600) { - parent.time = 0 + parent.time = 0; } - parent.time += 1 + parent.time += 1; } } diff --git a/ScreenPlaySysInfo/qml/TestMain.qml b/ScreenPlaySysInfo/qml/TestMain.qml index 436557d4..d7cccd17 100644 --- a/ScreenPlaySysInfo/qml/TestMain.qml +++ b/ScreenPlaySysInfo/qml/TestMain.qml @@ -25,11 +25,11 @@ Window { } function stringListToString(list) { - let out = "" + let out = ""; for (var i = 0; i < list.length; i++) { - out += "\n" + list[i] + out += "\n" + list[i]; } - return out + return out; } Rectangle { @@ -45,14 +45,13 @@ Window { } RowLayout { - id:wrapper + id: wrapper spacing: 40 anchors.centerIn: parent ColumnLayout { id: wrapperLeft Layout.preferredWidth: 500 - ColumnLayout { spacing: 10 Item { @@ -67,8 +66,7 @@ Window { } } Text { - text: root.stringListToString( - ipAddress.privateIpV4AddressList) + text: root.stringListToString(ipAddress.privateIpV4AddressList) color: root.accentColor font { pointSize: 16 @@ -76,8 +74,7 @@ Window { } } Text { - text: root.stringListToString( - ipAddress.privateIpV6AddressList) + text: root.stringListToString(ipAddress.privateIpV6AddressList) color: root.accentColor font { pointSize: 16 @@ -236,7 +233,6 @@ Window { horizontalAlignment: Text.AlignHCenter } - ListView { id: storageListView Layout.fillWidth: true diff --git a/ScreenPlayUtil/CMakeLists.txt b/ScreenPlayUtil/CMakeLists.txt index 9e6a6620..5352e8a1 100644 --- a/ScreenPlayUtil/CMakeLists.txt +++ b/ScreenPlayUtil/CMakeLists.txt @@ -40,15 +40,19 @@ set(QML qml/TextField.qml qml/TrayIcon.qml) -set(SOURCES # cmake-format: sort - inc/public/ScreenPlayUtil/httpfileserver.cpp src/contenttypes.cpp src/util.cpp src/projectfile.cpp) +set(SOURCES + # cmake-format: sort + inc/public/ScreenPlayUtil/httpfileserver.cpp + src/contenttypes.cpp + src/projectfile.cpp + src/util.cpp) set(HEADER # cmake-format: sort - inc/public/ScreenPlayUtil/exitcodes.h inc/public/ScreenPlayUtil/AutoPropertyHelpers.h inc/public/ScreenPlayUtil/ConstRefPropertyHelpers.h inc/public/ScreenPlayUtil/contenttypes.h + inc/public/ScreenPlayUtil/exitcodes.h inc/public/ScreenPlayUtil/HelpersCommon.h inc/public/ScreenPlayUtil/httpfileserver.h inc/public/ScreenPlayUtil/ListPropertyHelper.h diff --git a/ScreenPlayUtil/qml/Background.qml b/ScreenPlayUtil/qml/Background.qml index bf1da6e3..6896e2b6 100644 --- a/ScreenPlayUtil/qml/Background.qml +++ b/ScreenPlayUtil/qml/Background.qml @@ -35,7 +35,6 @@ Rectangle { target: bgWorkshop opacity: 0 } - }, State { name: "create" @@ -49,7 +48,6 @@ Rectangle { target: bgWorkshop opacity: 0 } - }, State { name: "community" @@ -63,7 +61,6 @@ Rectangle { target: bgWorkshop opacity: 0 } - }, State { name: "workshop" @@ -77,7 +74,6 @@ Rectangle { target: bgWorkshop opacity: 1 } - } ] transitions: [ @@ -91,7 +87,6 @@ Rectangle { duration: 400 easing.type: Easing.InOutQuart } - } ] } diff --git a/ScreenPlayUtil/qml/CloseIcon.qml b/ScreenPlayUtil/qml/CloseIcon.qml index 129908ef..5e347069 100644 --- a/ScreenPlayUtil/qml/CloseIcon.qml +++ b/ScreenPlayUtil/qml/CloseIcon.qml @@ -64,7 +64,6 @@ MouseArea { target: iconColorOverlay color: Material.color(Material.Orange) } - } ] transitions: [ @@ -78,7 +77,6 @@ MouseArea { duration: 200 easing.type: Easing.InOutQuad } - } ] } diff --git a/ScreenPlayUtil/qml/ColorImage.qml b/ScreenPlayUtil/qml/ColorImage.qml index 127f43f3..ea818ed3 100644 --- a/ScreenPlayUtil/qml/ColorImage.qml +++ b/ScreenPlayUtil/qml/ColorImage.qml @@ -2,7 +2,6 @@ import QtQuick import QtQuick.Controls.Material import Qt5Compat.GraphicalEffects - /*! \qmltype ColorImage \inqmlmodule Common @@ -14,7 +13,6 @@ import Qt5Compat.GraphicalEffects Image { id: root - /*! \qmlproperty color ColorImage::color diff --git a/ScreenPlayUtil/qml/ColorPicker.qml b/ScreenPlayUtil/qml/ColorPicker.qml index 912aa256..bc8a0024 100644 --- a/ScreenPlayUtil/qml/ColorPicker.qml +++ b/ScreenPlayUtil/qml/ColorPicker.qml @@ -23,7 +23,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - import QtQuick import QtQuick.Layouts import QtQuick.Controls @@ -65,9 +64,9 @@ Pane { function hexToRgb(hex) { // Expand shorthand form (e.g. "03F") to full form (e.g. "0033FF") var shorthandRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i; - hex = hex.replace(shorthandRegex, function(m, r, g, b) { - return r + r + g + g + b + b; - }); + hex = hex.replace(shorthandRegex, function (m, r, g, b) { + return r + r + g + g + b + b; + }); var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); return result ? { "r": parseInt(result[1], 16), @@ -188,9 +187,7 @@ Pane { position: 1 color: hueColor } - } - } Rectangle { @@ -211,9 +208,7 @@ Pane { position: 0 color: "#00000000" } - } - } Rectangle { @@ -234,7 +229,6 @@ Pane { radius: width / 2 color: "transparent" } - } MouseArea { @@ -250,7 +244,6 @@ Pane { onPositionChanged: handleMouse(mouse) onPressed: handleMouse(mouse) } - } Rectangle { @@ -272,7 +265,6 @@ Pane { PathSvg { path: "M0,0 L30,0" } - } ShapePath { @@ -283,9 +275,7 @@ Pane { PathSvg { path: "M0,-5 L30,-5 L30,4 L0,4z" } - } - } MouseArea { @@ -329,11 +319,8 @@ Pane { position: 0 color: "#FF0000" } - } - } - } ColumnLayout { @@ -356,7 +343,6 @@ Pane { onValueChanged: { if (!updatingControls) setCurrentColor(); - } } @@ -375,7 +361,6 @@ Pane { onValueChanged: { if (!updatingControls) setCurrentColor(); - } } @@ -394,14 +379,12 @@ Pane { onValueChanged: { if (!updatingControls) setCurrentColor(); - } } Item { Layout.fillHeight: true } - } Rectangle { @@ -436,22 +419,16 @@ Pane { var compColor = Qt.rgba(1, 1, 1, 1); if (color.hsvValue > 0.5) compColor = Qt.rgba(0, 0, 0, 1); - border.color = compColor; } onExited: { border.width = 0; } } - } - } - } - } - } Canvas { @@ -480,7 +457,6 @@ Pane { PathSvg { path: "M0,0 L30,0" } - } ShapePath { @@ -491,9 +467,7 @@ Pane { PathSvg { path: "M0,-5 L30,-5 L30,4 L0,4z" } - } - } MouseArea { @@ -513,11 +487,8 @@ Pane { position: 1 color: "#00000000" } - } - } - } ColumnLayout { @@ -555,11 +526,8 @@ Pane { Layout.fillHeight: true color: currentColor } - } - } - } ColumnLayout { @@ -580,7 +548,6 @@ Pane { leftPadding: optRgb.indicator.width + optRgb.spacing verticalAlignment: Text.AlignVCenter } - } RadioButton { @@ -600,9 +567,7 @@ Pane { leftPadding: optHsv.indicator.width + optHsv.spacing verticalAlignment: Text.AlignVCenter } - } - } Item { @@ -623,7 +588,6 @@ Pane { Layout.fillWidth: true color: BppMetrics.textColor } - } RowLayout { @@ -640,7 +604,6 @@ Pane { Layout.fillWidth: true color: BppMetrics.textColor } - } RowLayout { @@ -657,7 +620,6 @@ Pane { Layout.fillWidth: true color: BppMetrics.textColor } - } RowLayout { @@ -674,7 +636,6 @@ Pane { Layout.fillWidth: true color: BppMetrics.textColor } - } RowLayout { @@ -691,7 +652,6 @@ Pane { Layout.fillWidth: true color: BppMetrics.textColor } - } RowLayout { @@ -708,7 +668,6 @@ Pane { Layout.fillWidth: true color: BppMetrics.textColor } - } Item { @@ -729,7 +688,6 @@ Pane { Layout.fillWidth: true color: BppMetrics.textColor } - } RowLayout { @@ -751,23 +709,16 @@ Pane { color: BppMetrics.textColor onTextChanged: { if (!hexColor.focus) - return ; - + return; if (!updatingControls && acceptableInput) { //console.log('updating', rgbColor.r, currentColor.r * 255, rgbColor.g, currentColor.g * 255, rgbColor.b, currentColor.b * 255) - var rgbColor = hexToRgb(text); if (rgbColor && rgbColor.r !== Math.floor(currentColor.r * 255) && rgbColor.g !== Math.floor(currentColor.g * 255) && rgbColor.b !== Math.floor(currentColor.b * 255)) initColorRGB(rgbColor.r, rgbColor.g, rgbColor.b, currentColor.a * 255); - } } } - } - } - } - } diff --git a/ScreenPlayUtil/qml/Dialogs/CriticalError.qml b/ScreenPlayUtil/qml/Dialogs/CriticalError.qml index d7d3c372..71680f9e 100644 --- a/ScreenPlayUtil/qml/Dialogs/CriticalError.qml +++ b/ScreenPlayUtil/qml/Dialogs/CriticalError.qml @@ -15,15 +15,14 @@ Util.Dialog { property string message standardButtons: Dialog.Ok | Dialog.Help onHelpRequested: { - Qt.openUrlExternally( - "https://forum.screen-play.app/category/7/troubleshooting") + Qt.openUrlExternally("https://forum.screen-play.app/category/7/troubleshooting"); } Connections { function onDisplayErrorPopup(msg) { - root.message = msg - root.window.show() - root.open() + root.message = msg; + root.window.show(); + root.open(); } target: App.screenPlayManager diff --git a/ScreenPlayUtil/qml/Dialogs/MonitorConfiguration.qml b/ScreenPlayUtil/qml/Dialogs/MonitorConfiguration.qml index 75492485..aa763aa9 100644 --- a/ScreenPlayUtil/qml/Dialogs/MonitorConfiguration.qml +++ b/ScreenPlayUtil/qml/Dialogs/MonitorConfiguration.qml @@ -14,7 +14,7 @@ Util.Dialog { Connections { function onMonitorConfigurationChanged() { - root.open() + root.open(); } target: App.monitorListModel diff --git a/ScreenPlayUtil/qml/FileSelector.qml b/ScreenPlayUtil/qml/FileSelector.qml index c24c43b0..395a3c0c 100644 --- a/ScreenPlayUtil/qml/FileSelector.qml +++ b/ScreenPlayUtil/qml/FileSelector.qml @@ -73,7 +73,6 @@ Item { bottom: parent.bottom margins: 10 } - } Text { @@ -94,7 +93,6 @@ Item { bottom: parent.bottom margins: 10 } - } Button { @@ -114,7 +112,6 @@ Item { bottom: parent.bottom margins: 5 } - } Button { @@ -133,7 +130,6 @@ Item { bottom: parent.bottom margins: 5 } - } FileDialog { @@ -141,11 +137,10 @@ Item { title: qsTr("Please choose a file") onAccepted: { - root.file = fileDialog.currentFile ; + root.file = fileDialog.currentFile; txtName.text = fileDialog.currentFile.toString(); } } - } states: [ @@ -162,7 +157,6 @@ Item { target: txtPlaceholder opacity: 0 } - }, State { name: "nothingSelected" @@ -172,7 +166,6 @@ Item { opacity: 0 anchors.topMargin: -40 } - } ] transitions: [ @@ -194,7 +187,6 @@ Item { duration: 300 easing.type: Easing.OutQuart } - } ] } diff --git a/ScreenPlayUtil/qml/Grow.qml b/ScreenPlayUtil/qml/Grow.qml index 5413947e..41bf3778 100644 --- a/ScreenPlayUtil/qml/Grow.qml +++ b/ScreenPlayUtil/qml/Grow.qml @@ -43,13 +43,10 @@ Scale { to: 1 duration: 300 } - } PauseAnimation { duration: root.loopOffset } - } - } diff --git a/ScreenPlayUtil/qml/GrowIconLink.qml b/ScreenPlayUtil/qml/GrowIconLink.qml index ffd91b4c..bcd701ca 100644 --- a/ScreenPlayUtil/qml/GrowIconLink.qml +++ b/ScreenPlayUtil/qml/GrowIconLink.qml @@ -51,7 +51,6 @@ Rectangle { height: 34 sourceSize: Qt.size(34, 34) } - } ] transitions: [ @@ -66,7 +65,6 @@ Rectangle { duration: 200 easing.type: Easing.InOutQuart } - } ] } diff --git a/ScreenPlayUtil/qml/Headline.qml b/ScreenPlayUtil/qml/Headline.qml index 411540c0..44965c7d 100644 --- a/ScreenPlayUtil/qml/Headline.qml +++ b/ScreenPlayUtil/qml/Headline.qml @@ -29,7 +29,5 @@ Item { left: parent.left bottom: parent.bottom } - } - } diff --git a/ScreenPlayUtil/qml/ImageSelector.qml b/ScreenPlayUtil/qml/ImageSelector.qml index ee09a857..2d4671b3 100644 --- a/ScreenPlayUtil/qml/ImageSelector.qml +++ b/ScreenPlayUtil/qml/ImageSelector.qml @@ -83,10 +83,8 @@ Item { onClicked: { if (imageSource !== "") popup.open(); - } } - } Popup { @@ -107,7 +105,6 @@ Item { cursorShape: Qt.PointingHandCursor onClicked: popup.close() } - } Text { @@ -130,7 +127,6 @@ Item { bottom: parent.bottom margins: 10 } - } Text { @@ -151,7 +147,6 @@ Item { bottom: parent.bottom margins: 10 } - } Button { @@ -168,7 +163,6 @@ Item { bottom: parent.bottom margins: 5 } - } Button { @@ -187,7 +181,6 @@ Item { bottom: parent.bottom margins: 5 } - } FileDialog { @@ -200,7 +193,6 @@ Item { txtName.text = fileDialog.fileUrl.toString().replace(/^.*[\\\/]/, ''); } } - } states: [ @@ -217,7 +209,6 @@ Item { target: txtPlaceholder opacity: 0 } - }, State { name: "nothingSelected" @@ -227,7 +218,6 @@ Item { opacity: 0 anchors.topMargin: -40 } - } ] transitions: [ @@ -249,7 +239,6 @@ Item { duration: 300 easing.type: Easing.OutQuart } - } ] } diff --git a/ScreenPlayUtil/qml/LicenseSelector.qml b/ScreenPlayUtil/qml/LicenseSelector.qml index fd7f6092..a80e38be 100644 --- a/ScreenPlayUtil/qml/LicenseSelector.qml +++ b/ScreenPlayUtil/qml/LicenseSelector.qml @@ -79,9 +79,7 @@ ColumnLayout { description: qsTr("You do not share any rights and nobody is allowed to use or remix it (Not recommended). Can also used to credit work others.") licenseFile: "License_All_Rights_Reserved_1.0.txt" } - } - } ToolButton { @@ -101,7 +99,5 @@ ColumnLayout { text: licenseModel.get(cb.currentIndex).description } - } - } diff --git a/ScreenPlayUtil/qml/RippleEffect.qml b/ScreenPlayUtil/qml/RippleEffect.qml index aca3ac2c..46fb7f31 100644 --- a/ScreenPlayUtil/qml/RippleEffect.qml +++ b/ScreenPlayUtil/qml/RippleEffect.qml @@ -3,7 +3,6 @@ * https://github.com/rschiang/material * (THE BSD 2-CLAUSE LICENSE) */ - import QtQuick import Qt5Compat.GraphicalEffects import QtQuick.Controls.Material @@ -18,10 +17,10 @@ Item { function trigger() { var wave = ripple.createObject(container, { - "startX": root.width * 0.5, - "startY": root.height * 0.5, - "maxRadius": furthestDistance(root.width * 0.5, root.height * 0.5) - }); + "startX": root.width * 0.5, + "startY": root.height * 0.5, + "maxRadius": furthestDistance(root.width * 0.5, root.height * 0.5) + }); } function distance(x1, y1, x2, y2) { @@ -68,7 +67,6 @@ Item { function fadeIfApplicable() { if (!fadeAnimation.running) fadeAnimation.start(); - } radius: 0 @@ -82,7 +80,6 @@ Item { growAnimation.start(); if (!fadeAnimation.running) fadeAnimation.start(); - } NumberAnimation { @@ -110,11 +107,7 @@ Item { ScriptAction { script: ink.destroy() } - } - } - } - } diff --git a/ScreenPlayUtil/qml/Search.qml b/ScreenPlayUtil/qml/Search.qml index ecff541d..31b85f9f 100644 --- a/ScreenPlayUtil/qml/Search.qml +++ b/ScreenPlayUtil/qml/Search.qml @@ -23,7 +23,6 @@ Item { right: parent.right verticalCenter: parent.verticalCenter } - } TextField { @@ -46,7 +45,5 @@ Item { top: parent.top topMargin: 10 } - } - } diff --git a/ScreenPlayUtil/qml/Shake.qml b/ScreenPlayUtil/qml/Shake.qml index bc1ba60b..bc0d526e 100644 --- a/ScreenPlayUtil/qml/Shake.qml +++ b/ScreenPlayUtil/qml/Shake.qml @@ -75,13 +75,10 @@ Translate { to: 0 duration: 50 } - } PauseAnimation { duration: root.loopOffset } - } - } diff --git a/ScreenPlayUtil/qml/Tag.qml b/ScreenPlayUtil/qml/Tag.qml index bf46f995..3f912c10 100644 --- a/ScreenPlayUtil/qml/Tag.qml +++ b/ScreenPlayUtil/qml/Tag.qml @@ -51,7 +51,6 @@ Item { font.pointSize: 14 font.family: App.settings.font } - } MouseArea { @@ -76,7 +75,6 @@ Item { anchors.fill: parent source: "qrc:/qml/ScreenPlayApp/assets/icons/icon_close.svg" } - } states: [ @@ -93,7 +91,6 @@ Item { opacity: 1 enabled: true } - } ] } diff --git a/ScreenPlayUtil/qml/TagSelector.qml b/ScreenPlayUtil/qml/TagSelector.qml index 3980739c..f9c20783 100644 --- a/ScreenPlayUtil/qml/TagSelector.qml +++ b/ScreenPlayUtil/qml/TagSelector.qml @@ -9,29 +9,28 @@ Item { id: root function getTags() { - var array = [] + var array = []; for (var i = 0; i < listModel.count; i++) { - array.push(listModel.get(i)._name) + array.push(listModel.get(i)._name); } - return array + return array; } height: 70 implicitWidth: 200 onStateChanged: { if (root.state === "add") { - btnAdd.text = qsTr("Save") - textField.focus = true + btnAdd.text = qsTr("Save"); + textField.focus = true; } else { - btnAdd.text = qsTr("Add tag") + btnAdd.text = qsTr("Add tag"); } } Rectangle { id: rectangle - color: Material.theme === Material.Light ? Material.background : Qt.darker( - Material.background) + color: Material.theme === Material.Light ? Material.background : Qt.darker(Material.background) radius: 3 clip: true @@ -61,7 +60,7 @@ Item { Connections { function onRemoveThis() { - listModel.remove(itemIndex) + listModel.remove(itemIndex); } target: delegate @@ -83,9 +82,7 @@ Item { radius: 3 height: parent.height - 20 width: 200 - color: Material.theme - === Material.Light ? Qt.lighter( - Material.background) : Material.background + color: Material.theme === Material.Light ? Qt.lighter(Material.background) : Material.background anchors { top: parent.top @@ -113,7 +110,7 @@ Item { color: Material.primaryTextColor onTextChanged: { if (textField.length >= 10) - textField.text = textField.text + textField.text = textField.text; } anchors { @@ -135,8 +132,8 @@ Item { highlighted: true font.family: App.settings.font onClicked: { - root.state = "" - textField.clear() + root.state = ""; + textField.clear(); } anchors { @@ -157,12 +154,12 @@ Item { onClicked: { if (root.state === "add") { listModel.append({ - "_name": textField.text - }) - textField.clear() - root.state = "" + "_name": textField.text + }); + textField.clear(); + root.state = ""; } else { - root.state = "add" + root.state = "add"; } } diff --git a/ScreenPlayUtil/qml/TextField.qml b/ScreenPlayUtil/qml/TextField.qml index e95a2bb4..086d8b9b 100644 --- a/ScreenPlayUtil/qml/TextField.qml +++ b/ScreenPlayUtil/qml/TextField.qml @@ -15,7 +15,7 @@ Item { property alias text: textField.text property alias placeholderText: txtPlaceholder.text - signal editingFinished() + signal editingFinished height: 55 width: 150 @@ -27,8 +27,7 @@ Item { } onEditingFinished: { if (!root.required) - return ; - + return; } Text { @@ -47,7 +46,6 @@ Item { left: parent.left leftMargin: 10 } - } Timer { @@ -63,7 +61,6 @@ Item { function resetState() { if (textField.text.length === 0) root.state = ""; - textField.focus = false; } @@ -80,7 +77,6 @@ Item { resetState(); if (textField.text.length > 0) root.state = "containsTextEditingFinished"; - } onPressed: { root.state = "containsText"; @@ -91,7 +87,6 @@ Item { right: parent.right bottom: parent.bottom } - } Text { @@ -106,7 +101,6 @@ Item { top: textField.bottom right: textField.right } - } states: [ @@ -120,7 +114,6 @@ Item { anchors.topMargin: 15 anchors.leftMargin: 10 } - }, State { name: "containsText" @@ -133,7 +126,6 @@ Item { anchors.topMargin: 0 anchors.leftMargin: 0 } - }, State { name: "containsTextEditingFinished" @@ -146,7 +138,6 @@ Item { anchors.topMargin: 0 anchors.leftMargin: 0 } - } ] transitions: [ @@ -161,7 +152,6 @@ Item { easing.type: Easing.InOutQuart properties: "font.pointSize,anchors.topMargin,anchors.leftMargin,opacity,color" } - }, Transition { from: "containsText" @@ -174,7 +164,6 @@ Item { easing.type: Easing.OutSine properties: "color,opacity" } - } ] } diff --git a/ScreenPlayUtil/qml/TrayIcon.qml b/ScreenPlayUtil/qml/TrayIcon.qml index 17f693a7..6e946522 100644 --- a/ScreenPlayUtil/qml/TrayIcon.qml +++ b/ScreenPlayUtil/qml/TrayIcon.qml @@ -14,16 +14,16 @@ SystemTrayIcon { onActivated: function (reason) { switch (reason) { case SystemTrayIcon.Unknown: - break + break; case SystemTrayIcon.Context: - break + break; case SystemTrayIcon.DoubleClick: - window.show() - break + window.show(); + break; case SystemTrayIcon.Trigger: - break + break; case SystemTrayIcon.MiddleClick: - break + break; } } @@ -32,7 +32,7 @@ SystemTrayIcon { text: qsTr("Open ScreenPlay") onTriggered: { App.showDockIcon(true); - window.show() + window.show(); } } @@ -44,15 +44,13 @@ SystemTrayIcon { text: qsTr("Mute all") onTriggered: { if (miMuteAll.isMuted) { - isMuted = false - miMuteAll.text = qsTr("Mute all") - App.screenPlayManager.setAllWallpaperValue("muted", - "true") + isMuted = false; + miMuteAll.text = qsTr("Mute all"); + App.screenPlayManager.setAllWallpaperValue("muted", "true"); } else { - isMuted = true - miMuteAll.text = qsTr("Unmute all") - App.screenPlayManager.setAllWallpaperValue("muted", - "false") + isMuted = true; + miMuteAll.text = qsTr("Unmute all"); + App.screenPlayManager.setAllWallpaperValue("muted", "false"); } } } @@ -65,15 +63,13 @@ SystemTrayIcon { text: qsTr("Pause all") onTriggered: { if (miStopAll.isPlaying) { - isPlaying = false - miStopAll.text = qsTr("Pause all") - App.screenPlayManager.setAllWallpaperValue( - "isPlaying", "true") + isPlaying = false; + miStopAll.text = qsTr("Pause all"); + App.screenPlayManager.setAllWallpaperValue("isPlaying", "true"); } else { - isPlaying = true - miStopAll.text = qsTr("Play all") - App.screenPlayManager.setAllWallpaperValue( - "isPlaying", "false") + isPlaying = true; + miStopAll.text = qsTr("Play all"); + App.screenPlayManager.setAllWallpaperValue("isPlaying", "false"); } } } diff --git a/ScreenPlayUtil/src/projectfile.cpp b/ScreenPlayUtil/src/projectfile.cpp index f66b76b4..c3121da6 100644 --- a/ScreenPlayUtil/src/projectfile.cpp +++ b/ScreenPlayUtil/src/projectfile.cpp @@ -87,7 +87,7 @@ bool ProjectFile::init() if (obj.contains("codec")) { if (auto videoCodecOpt = ScreenPlayUtil::getVideoCodecFromString(obj.value("codec").toString())) { videoCodec = videoCodecOpt.value(); - } else{ + } else { qWarning("Invalid videoCodec was specified inside the json object!"); } } else if (type == ScreenPlay::InstalledType::InstalledType::VideoWallpaper) { diff --git a/ScreenPlayWallpaper/kde/ScreenPlay/contents/ui/WaitingForScreenplay.qml b/ScreenPlayWallpaper/kde/ScreenPlay/contents/ui/WaitingForScreenplay.qml index deda4063..e4662751 100644 --- a/ScreenPlayWallpaper/kde/ScreenPlay/contents/ui/WaitingForScreenplay.qml +++ b/ScreenPlayWallpaper/kde/ScreenPlay/contents/ui/WaitingForScreenplay.qml @@ -20,27 +20,27 @@ Rectangle { font.pixelSize: 50 } - OpacityAnimator on opacity{ - id: createAnimation - from: 0; - to: 1; - duration: 1000 - onRunningChanged: { - if(!running){ - toBeDeleted.opacity = 1 - toBeCreated.opacity = 0 - destroyAnimation.start() - } - } + OpacityAnimator on opacity { + id: createAnimation + from: 0 + to: 1 + duration: 1000 + onRunningChanged: { + if (!running) { + toBeDeleted.opacity = 1; + toBeCreated.opacity = 0; + destroyAnimation.start(); + } + } } Component.onCompleted: { - createAnimation.start() + createAnimation.start(); } } Rectangle { - opacity: 0 id: toBeDeleted + opacity: 0 anchors.fill: parent color: "black" @@ -54,21 +54,19 @@ Rectangle { font.pixelSize: 50 } - OpacityAnimator on opacity{ - id: destroyAnimation - from: 1; - to: 0; - duration: 1000 - running: false - onRunningChanged: { - if(!running){ - toBeDeleted.opacity = 0 - toBeCreated.opacity = 0 - createAnimation.start() - } - } + OpacityAnimator on opacity { + id: destroyAnimation + from: 1 + to: 0 + duration: 1000 + running: false + onRunningChanged: { + if (!running) { + toBeDeleted.opacity = 0; + toBeCreated.opacity = 0; + createAnimation.start(); + } + } } } } - - diff --git a/ScreenPlayWallpaper/kde/ScreenPlay/contents/ui/Wallpaper.qml b/ScreenPlayWallpaper/kde/ScreenPlay/contents/ui/Wallpaper.qml index 15d0d782..45d2ed96 100644 --- a/ScreenPlayWallpaper/kde/ScreenPlay/contents/ui/Wallpaper.qml +++ b/ScreenPlayWallpaper/kde/ScreenPlay/contents/ui/Wallpaper.qml @@ -5,7 +5,6 @@ import QtWebEngine 1.8 import QtMultimedia 5.12 import Qt.labs.settings 1.1 - Rectangle { id: root color: "black" @@ -18,25 +17,25 @@ Rectangle { property string projectSourceFileAbsolute property bool loops: true - function stop(){ - player1.stop() - player2.stop() - videoOutput1.visible = false - videoOutput2.visible = false - root.enabled = false + function stop() { + player1.stop(); + player2.stop(); + videoOutput1.visible = false; + videoOutput2.visible = false; + root.enabled = false; } - function play(){ - root.enabled = true - videoOutput2.visible = false - videoOutput1.visible = true + function play() { + root.enabled = true; + videoOutput2.visible = false; + videoOutput1.visible = true; //if(wallpaper.configuration.DualPlayback){ - player2.source = root.projectSourceFileAbsolute - player2.play() - player2.pause() + player2.source = root.projectSourceFileAbsolute; + player2.play(); + player2.pause(); //} - player1.play() + player1.play(); } MediaPlayer { @@ -44,17 +43,16 @@ Rectangle { volume: root.volume source: root.projectSourceFileAbsolute onStopped: { - if(!root.enabled) - return - - videoOutput1.visible = false - videoOutput2.visible = true - if(player2.source !== root.projectSourceFileAbsolute){ - player2.source = root.projectSourceFileAbsolute - } - player1.play() - player1.pause() - player2.play() + if (!root.enabled) + return; + videoOutput1.visible = false; + videoOutput2.visible = true; + if (player2.source !== root.projectSourceFileAbsolute) { + player2.source = root.projectSourceFileAbsolute; + } + player1.play(); + player1.pause(); + player2.play(); } } @@ -62,17 +60,16 @@ Rectangle { id: player2 volume: root.volume onStopped: { - if(!root.enabled) - return - videoOutput2.visible = false - videoOutput1.visible = true - player2.play() - player2.pause() - player1.play() + if (!root.enabled) + return; + videoOutput2.visible = false; + videoOutput1.visible = true; + player2.play(); + player2.pause(); + player1.play(); } } - VideoOutput { id: videoOutput1 fillMode: VideoOutput.PreserveAspectCrop @@ -86,7 +83,4 @@ Rectangle { anchors.fill: parent source: player2 } - - - } diff --git a/ScreenPlayWallpaper/kde/ScreenPlay/contents/ui/WallpaperContainer.qml b/ScreenPlayWallpaper/kde/ScreenPlay/contents/ui/WallpaperContainer.qml index d7998261..e5781a43 100644 --- a/ScreenPlayWallpaper/kde/ScreenPlay/contents/ui/WallpaperContainer.qml +++ b/ScreenPlayWallpaper/kde/ScreenPlay/contents/ui/WallpaperContainer.qml @@ -4,7 +4,6 @@ import QtWebSockets 1.1 import QtWebEngine 1.8 import QtMultimedia 5.12 - Rectangle { id: container anchors.fill: parent @@ -16,27 +15,27 @@ Rectangle { property bool connected: false Timer { - id: connectTimer - interval: 1000 - running: true - repeat: true - onTriggered: { - if(!wp.connected){ - console.log("not connected") - wp.source = "" - wp.source = "Wallpaper.qml" - } else { - console.log("connected") - screensaver.visible = false - connectTimer.stop() - } - } + id: connectTimer + interval: 1000 + running: true + repeat: true + onTriggered: { + if (!wp.connected) { + console.log("not connected"); + wp.source = ""; + wp.source = "Wallpaper.qml"; + } else { + console.log("connected"); + screensaver.visible = false; + connectTimer.stop(); + } + } } } Loader { - anchors.fill: parent id: screensaver + anchors.fill: parent source: "WaitingForScreenplay.qml" } } diff --git a/ScreenPlayWallpaper/kde/ScreenPlay/contents/ui/config.qml b/ScreenPlayWallpaper/kde/ScreenPlay/contents/ui/config.qml index 48cfdf16..80c2c221 100644 --- a/ScreenPlayWallpaper/kde/ScreenPlay/contents/ui/config.qml +++ b/ScreenPlayWallpaper/kde/ScreenPlay/contents/ui/config.qml @@ -8,13 +8,11 @@ import org.kde.kcm 1.1 as KCM import org.kde.kirigami 2.4 as Kirigami import org.kde.newstuff 1.1 as NewStuff - Column { id: root property alias cfg_MonitorIndex: monitorIndex.text - anchors.fill: parent spacing: units.largeSpacing @@ -26,8 +24,5 @@ Column { id: monitorIndex text: "0" } - - } - } diff --git a/ScreenPlayWallpaper/kde/ScreenPlay/contents/ui/main.qml b/ScreenPlayWallpaper/kde/ScreenPlay/contents/ui/main.qml index 4f6aa157..cc9b7d3b 100644 --- a/ScreenPlayWallpaper/kde/ScreenPlay/contents/ui/main.qml +++ b/ScreenPlayWallpaper/kde/ScreenPlay/contents/ui/main.qml @@ -4,55 +4,51 @@ import QtWebSockets 1.1 import QtWebEngine 1.8 import QtMultimedia 5.12 import Qt.labs.settings 1.1 - import org.kde.plasma.core 2.0 as PlasmaCore Rectangle { - id:root - color:"orange" + id: root + color: "orange" property bool connected: false Settings { - id:settings + id: settings } Component.onCompleted: { - wallpaper.projectSourceFileAbsolute = settings.value("SP_projectSourceFileAbsolute","NULL") -// if(root.projectSourceFileAbsolute === "NULL") -// return - - wallpaper.type = settings.value("SP_type") - wallpaper.fillMode = settings.value("SP_fillMode") + wallpaper.projectSourceFileAbsolute = settings.value("SP_projectSourceFileAbsolute", "NULL"); + // if(root.projectSourceFileAbsolute === "NULL") + // return + wallpaper.type = settings.value("SP_type"); + wallpaper.fillMode = settings.value("SP_fillMode"); //wallpaper.volume = settings.value("SP_volume") - wallpaper.play() + wallpaper.play(); } - Wallpaper { - id:wallpaper + id: wallpaper anchors.fill: parent - // visible: root.connected - - onFullContentPathChanged: settings.setValue("SP_fullContentPath",fullContentPath) - onVolumeChanged: settings.setValue("SP_volume",volume) - onFillModeChanged: settings.setValue("SP_fillMode",fillMode) - onTypeChanged: settings.setValue("SP_type",type) - onProjectSourceFileAbsoluteChanged: settings.setValue("SP_projectSourceFileAbsolute",projectSourceFileAbsolute) - onLoopsChanged: settings.setValue("SP_loops",loops) + // visible: root.connected + onFullContentPathChanged: settings.setValue("SP_fullContentPath", fullContentPath) + onVolumeChanged: settings.setValue("SP_volume", volume) + onFillModeChanged: settings.setValue("SP_fillMode", fillMode) + onTypeChanged: settings.setValue("SP_type", type) + onProjectSourceFileAbsoluteChanged: settings.setValue("SP_projectSourceFileAbsolute", projectSourceFileAbsolute) + onLoopsChanged: settings.setValue("SP_loops", loops) } Timer { - id:reconnectTimer + id: reconnectTimer interval: 1000 running: true repeat: true onTriggered: { if (socket.status === WebSocket.Open) - return - socket.active = false - socket.active = true - reconnectTimer.retryCounter += 1 + return; + socket.active = false; + socket.active = true; + reconnectTimer.retryCounter += 1; } property int retryCounter: 0 } @@ -61,35 +57,33 @@ Rectangle { id: socket url: "ws://127.0.0.1:16395" onStatusChanged: { - if (socket.status === WebSocket.Open) - socket.sendTextMessage("Hello World from QML wallpaper") + if (socket.status === WebSocket.Open) + socket.sendTextMessage("Hello World from QML wallpaper"); } - onTextMessageReceived: (message)=> { - - var obj = JSON.parse(message) - root.connected = true - txtCommand.text = obj.command - + onTextMessageReceived: message => { + var obj = JSON.parse(message); + root.connected = true; + txtCommand.text = obj.command; if (obj.command === "replace") { - socket.sendTextMessage("replace") - wallpaper.type = obj.type - wallpaper.fillMode = obj.fillMode - wallpaper.volume = obj.volume - wallpaper.projectSourceFileAbsolute = "file://" + obj.absolutePath + "/" + obj.file - print("got: " + root.projectSourceFileAbsolute) - wallpaper.play() + socket.sendTextMessage("replace"); + wallpaper.type = obj.type; + wallpaper.fillMode = obj.fillMode; + wallpaper.volume = obj.volume; + wallpaper.projectSourceFileAbsolute = "file://" + obj.absolutePath + "/" + obj.file; + print("got: " + root.projectSourceFileAbsolute); + wallpaper.play(); return; - } - if(obj.command === "quit"){ - wallpaper.stop() - } + } + if (obj.command === "quit") { + wallpaper.stop(); + } } } -// WaitingForScreenplay { -// anchors.fill: parent -// visible: !root.connected -// } + // WaitingForScreenplay { + // anchors.fill: parent + // visible: !root.connected + // } Column { anchors { horizontalCenter: parent.horizontalCenter @@ -97,7 +91,7 @@ Rectangle { margins: 60 } Text { - id:txtCommand + id: txtCommand color: "white" } Text { @@ -106,20 +100,15 @@ Rectangle { } Text { color: "white" - text: "projectSourceFileAbsolute " + wallpaper.projectSourceFileAbsolute + text: "projectSourceFileAbsolute " + wallpaper.projectSourceFileAbsolute } Text { color: "white" - text:"reconnectTimer.retryCounter : "+ reconnectTimer.retryCounter + text: "reconnectTimer.retryCounter : " + reconnectTimer.retryCounter } Text { color: "white" text: "MonitorIndex: " + wallpaper.configuration.MonitorIndex } - } - - - } - diff --git a/ScreenPlayWallpaper/qml/MultimediaView.qml b/ScreenPlayWallpaper/qml/MultimediaView.qml index a957d158..5cdfd3e3 100644 --- a/ScreenPlayWallpaper/qml/MultimediaView.qml +++ b/ScreenPlayWallpaper/qml/MultimediaView.qml @@ -10,15 +10,14 @@ Item { property string fillMode: Wallpaper.fillMode onFillModeChanged: { // Convert Web based video modes to the limited Qt fillModes - if (fillMode === "cover" || fillMode === "stretch" - || fillMode === "contain") { - return vo.fillMode = VideoOutput.Stretch + if (fillMode === "cover" || fillMode === "stretch" || fillMode === "contain") { + return vo.fillMode = VideoOutput.Stretch; } if (fillMode === "fill") { - return vo.fillMode = VideoOutput.PreserveAspectFit + return vo.fillMode = VideoOutput.PreserveAspectFit; } if (fillMode === "scale_down") { - return vo.fillMode = VideoOutput.PreserveAspectCrop + return vo.fillMode = VideoOutput.PreserveAspectCrop; } } @@ -29,18 +28,18 @@ Item { property string source: Wallpaper.projectSourceFileAbsolute onSourceChanged: { // Qt 6.3 workaround - mediaPlayer.stop() - mediaPlayer.source = Qt.resolvedUrl(root.source) - mediaPlayer.play() + mediaPlayer.stop(); + mediaPlayer.source = Qt.resolvedUrl(root.source); + mediaPlayer.play(); } MediaPlayer { id: mediaPlayer - onPlaybackStateChanged:{ - if( mediaPlayer.playbackState == MediaPlayer.PlayingState){ - root.ready = true - } - } + onPlaybackStateChanged: { + if (mediaPlayer.playbackState == MediaPlayer.PlayingState) { + root.ready = true; + } + } loops: root.loops ? MediaPlayer.Infinite : 1 videoOutput: vo audioOutput: ao @@ -59,21 +58,20 @@ Item { Connections { function onFillModeChanged(fillMode) { if (fillMode === "stretch") { - vo.fillMode = VideoOutput.Stretch - return + vo.fillMode = VideoOutput.Stretch; + return; } if (fillMode === "fill") { - vo.fillMode = VideoOutput.PreserveAspectFit - return + vo.fillMode = VideoOutput.PreserveAspectFit; + return; } - if (fillMode === "contain" || fillMode === "cover" - || fillMode === "scale-down") { - vo.fillMode = VideoOutput.PreserveAspectCrop + if (fillMode === "contain" || fillMode === "cover" || fillMode === "scale-down") { + vo.fillMode = VideoOutput.PreserveAspectCrop; } } function onCurrentTimeChanged(currentTime) { - mediaPlayer.position = currentTime * mediaPlayer.duration + mediaPlayer.position = currentTime * mediaPlayer.duration; } target: Wallpaper diff --git a/ScreenPlayWallpaper/qml/MultimediaWebView.qml b/ScreenPlayWallpaper/qml/MultimediaWebView.qml index fb1e9b23..c76d067b 100644 --- a/ScreenPlayWallpaper/qml/MultimediaWebView.qml +++ b/ScreenPlayWallpaper/qml/MultimediaWebView.qml @@ -3,7 +3,6 @@ import QtWebEngine import ScreenPlay.Enums.InstalledType import ScreenPlayWallpaper - /*! * The native macOS multimedia stack does not support VP8/VP9. For this we must use the WebEngine. */ @@ -15,44 +14,42 @@ Item { function getSetVideoCommand() { // TODO 30: // Currently wont work. Commit anyways til QtCreator and Qt work with js template literals - var src = "" - src += "var videoPlayer = document.getElementById('videoPlayer');" - src += "var videoSource = document.getElementById('videoSource');" - src += "videoSource.src = '" + Wallpaper.projectSourceFileAbsolute + "';" - src += "videoPlayer.load();" - src += "videoPlayer.volume = " + Wallpaper.volume + ";" - src += "videoPlayer.setAttribute('style', 'object-fit :" + Wallpaper.fillMode + ";');" - src += "videoPlayer.play();" - print(src) - return src + var src = ""; + src += "var videoPlayer = document.getElementById('videoPlayer');"; + src += "var videoSource = document.getElementById('videoSource');"; + src += "videoSource.src = '" + Wallpaper.projectSourceFileAbsolute + "';"; + src += "videoPlayer.load();"; + src += "videoPlayer.volume = " + Wallpaper.volume + ";"; + src += "videoPlayer.setAttribute('style', 'object-fit :" + Wallpaper.fillMode + ";');"; + src += "videoPlayer.play();"; + print(src); + return src; } Component.onCompleted: { - WebEngine.settings.localContentCanAccessFileUrls = true - WebEngine.settings.localContentCanAccessRemoteUrls = true - WebEngine.settings.allowRunningInsecureContent = true - WebEngine.settings.accelerated2dCanvasEnabled = true - WebEngine.settings.javascriptCanOpenWindows = false - WebEngine.settings.showScrollBars = false - WebEngine.settings.playbackRequiresUserGesture = false - WebEngine.settings.focusOnNavigationEnabled = true + WebEngine.settings.localContentCanAccessFileUrls = true; + WebEngine.settings.localContentCanAccessRemoteUrls = true; + WebEngine.settings.allowRunningInsecureContent = true; + WebEngine.settings.accelerated2dCanvasEnabled = true; + WebEngine.settings.javascriptCanOpenWindows = false; + WebEngine.settings.showScrollBars = false; + WebEngine.settings.playbackRequiresUserGesture = false; + WebEngine.settings.focusOnNavigationEnabled = true; } WebEngineView { id: webView anchors.fill: parent - url: Qt.resolvedUrl("file://" + Wallpaper.getApplicationPath( - ) + "/index.html") + url: Qt.resolvedUrl("file://" + Wallpaper.getApplicationPath() + "/index.html") onJavaScriptConsoleMessage: function (lineNumber, message) { - print(lineNumber, message) + print(lineNumber, message); } onLoadProgressChanged: { if (loadProgress === 100) { - webView.runJavaScript(root.getSetVideoCommand(), - function (result) { - requestFadeIn() - }) + webView.runJavaScript(root.getSetVideoCommand(), function (result) { + requestFadeIn(); + }); } } } @@ -75,79 +72,68 @@ Item { interval: 300 onTriggered: { - webView.visible = !Wallpaper.visualsPaused - txtVisualsPaused.visible = Wallpaper.visualsPaused + webView.visible = !Wallpaper.visualsPaused; + txtVisualsPaused.visible = Wallpaper.visualsPaused; } } Connections { function onReloadVideo(oldType) { - webView.runJavaScript(root.getSetVideoCommand()) + webView.runJavaScript(root.getSetVideoCommand()); } function onQmlExit() { - webView.runJavaScript( - "var videoPlayer = document.getElementById('videoPlayer'); videoPlayer.volume = 0;") + webView.runJavaScript("var videoPlayer = document.getElementById('videoPlayer'); videoPlayer.volume = 0;"); } function onMutedChanged(muted) { if (muted) - webView.runJavaScript( - "var videoPlayer = document.getElementById('videoPlayer'); videoPlayer.volume = 0;") + webView.runJavaScript("var videoPlayer = document.getElementById('videoPlayer'); videoPlayer.volume = 0;"); else - webView.runJavaScript( - "var videoPlayer = document.getElementById('videoPlayer'); videoPlayer.volume = " + Wallpaper.volume + ";") + webView.runJavaScript("var videoPlayer = document.getElementById('videoPlayer'); videoPlayer.volume = " + Wallpaper.volume + ";"); } function onFillModeChanged(fillMode) { if (webView.loadProgress === 100) - webView.runJavaScript( - "var videoPlayer = document.getElementById('videoPlayer'); videoPlayer.setAttribute('style', 'object-fit :" + fillMode + ";');") + webView.runJavaScript("var videoPlayer = document.getElementById('videoPlayer'); videoPlayer.setAttribute('style', 'object-fit :" + fillMode + ";');"); } function onLoopsChanged(loops) { if (webView.loadProgress === 100) - webView.runJavaScript( - "var videoPlayer = document.getElementById('videoPlayer'); videoPlayer.loop = " + loops + ";") + webView.runJavaScript("var videoPlayer = document.getElementById('videoPlayer'); videoPlayer.loop = " + loops + ";"); } function onVolumeChanged(volume) { if (webView.loadProgress === 100) - webView.runJavaScript( - "var videoPlayer = document.getElementById('videoPlayer'); videoPlayer.volume = " + volume + ";") + webView.runJavaScript("var videoPlayer = document.getElementById('videoPlayer'); videoPlayer.volume = " + volume + ";"); } function onCurrentTimeChanged(currentTime) { if (webView.loadProgress === 100) - webView.runJavaScript( - "var videoPlayer = document.getElementById('videoPlayer'); videoPlayer.currentTime = " - + currentTime + " * videoPlayer.duration;") + webView.runJavaScript("var videoPlayer = document.getElementById('videoPlayer'); videoPlayer.currentTime = " + currentTime + " * videoPlayer.duration;"); } function onPlaybackRateChanged(playbackRate) { if (webView.loadProgress === 100) - webView.runJavaScript( - "var videoPlayer = document.getElementById('videoPlayer'); videoPlayer.playbackRate = " + playbackRate + ";") + webView.runJavaScript("var videoPlayer = document.getElementById('videoPlayer'); videoPlayer.playbackRate = " + playbackRate + ";"); } function onVisualsPausedChanged(visualsPaused) { if (visualsPaused) { // Wait until Wallpaper animation is finsihed - timerCover.restart() + timerCover.restart(); } else { - webView.visible = true - txtVisualsPaused.visible = false + webView.visible = true; + txtVisualsPaused.visible = false; } } function onIsPlayingChanged(isPlaying) { if (webView.loadProgress === 100) { if (isPlaying) - webView.runJavaScript( - "var videoPlayer = document.getElementById('videoPlayer'); videoPlayer.play();") + webView.runJavaScript("var videoPlayer = document.getElementById('videoPlayer'); videoPlayer.play();"); else - webView.runJavaScript( - "var videoPlayer = document.getElementById('videoPlayer'); videoPlayer.pause();") + webView.runJavaScript("var videoPlayer = document.getElementById('videoPlayer'); videoPlayer.pause();"); } } diff --git a/ScreenPlayWallpaper/qml/Test.qml b/ScreenPlayWallpaper/qml/Test.qml index 85264b3d..97f4c78f 100644 --- a/ScreenPlayWallpaper/qml/Test.qml +++ b/ScreenPlayWallpaper/qml/Test.qml @@ -33,10 +33,10 @@ Rectangle { id: ma function setPosition() { - attractor.pointX = mouseX - 25 - attractor.pointY = mouseY - 25 - mouseDot.x = mouseX - mouseDot.center - mouseDot.y = mouseY - mouseDot.center + attractor.pointX = mouseX - 25; + attractor.pointY = mouseY - 25; + mouseDot.x = mouseX - mouseDot.center; + mouseDot.y = mouseY - mouseDot.center; } anchors.fill: parent @@ -44,14 +44,13 @@ Rectangle { propagateComposedEvents: true hoverEnabled: true Component.onCompleted: { - attractor.pointX = parent.width * 0.5 - attractor.pointY = parent.height * 0.5 + attractor.pointX = parent.width * 0.5; + attractor.pointY = parent.height * 0.5; } onPositionChanged: { - setPosition() + setPosition(); } onClicked: { - } } @@ -179,10 +178,10 @@ Rectangle { highlighted: true text: qsTr("Click me! - 1") onClicked: { - focus = false - focus = true - print("Button Clicked!") - txtButtonConter.counter = txtButtonConter.counter - 1 + focus = false; + focus = true; + print("Button Clicked!"); + txtButtonConter.counter = txtButtonConter.counter - 1; } } @@ -190,10 +189,10 @@ Rectangle { highlighted: true text: qsTr("Exit Wallpaper") onClicked: { - focus = false - focus = true - print("Exit Wallpaper") - Wallpaper.terminate() + focus = false; + focus = true; + print("Exit Wallpaper"); + Wallpaper.terminate(); } } @@ -202,8 +201,8 @@ Rectangle { focusPolicy: Qt.ClickFocus text: qsTr("Click me! +1") onClicked: { - print("Button Clicked!") - txtButtonConter.counter = txtButtonConter.counter + 1 + print("Button Clicked!"); + txtButtonConter.counter = txtButtonConter.counter + 1; } } } diff --git a/ScreenPlayWallpaper/qml/Wallpaper.qml b/ScreenPlayWallpaper/qml/Wallpaper.qml index d822ae73..039077a0 100644 --- a/ScreenPlayWallpaper/qml/Wallpaper.qml +++ b/ScreenPlayWallpaper/qml/Wallpaper.qml @@ -11,175 +11,159 @@ Rectangle { property bool canFadeByWallpaperFillMode: true function init() { - fadeInImageSetup() + fadeInImageSetup(); switch (Wallpaper.type) { case InstalledType.VideoWallpaper: if (Wallpaper.videoCodec === VideoCodec.Unknown) { - Wallpaper.terminate() + Wallpaper.terminate(); } // macOS only supports h264 via the native Qt MM if (Qt.platform.os === "osx") { - if ((Wallpaper.videoCodec === VideoCodec.VP8 - || Wallpaper.videoCodec === VideoCodec.VP9)) { - loader.source = "qrc:/qml/ScreenPlayWallpaper/qml/MultimediaWebView.qml" + if ((Wallpaper.videoCodec === VideoCodec.VP8 || Wallpaper.videoCodec === VideoCodec.VP9)) { + loader.source = "qrc:/qml/ScreenPlayWallpaper/qml/MultimediaWebView.qml"; } else { - loader.source = "qrc:/qml/ScreenPlayWallpaper/qml/MultimediaView.qml" + loader.source = "qrc:/qml/ScreenPlayWallpaper/qml/MultimediaView.qml"; } } - if (Qt.platform.os === "windows") { - loader.source = "qrc:/qml/ScreenPlayWallpaper/qml/MultimediaView.qml" + loader.source = "qrc:/qml/ScreenPlayWallpaper/qml/MultimediaView.qml"; } - - break + break; case InstalledType.HTMLWallpaper: - loader.setSource( - "qrc:/qml/ScreenPlayWallpaper/qml/WebsiteWallpaper.qml", - { - "url": Qt.resolvedUrl( - Wallpaper.projectSourceFileAbsolute) - }) - break + loader.setSource("qrc:/qml/ScreenPlayWallpaper/qml/WebsiteWallpaper.qml", { + "url": Qt.resolvedUrl(Wallpaper.projectSourceFileAbsolute) + }); + break; case InstalledType.QMLWallpaper: - loader.source = Qt.resolvedUrl(Wallpaper.projectSourceFileAbsolute) - break + loader.source = Qt.resolvedUrl(Wallpaper.projectSourceFileAbsolute); + break; case InstalledType.WebsiteWallpaper: - loader.setSource( - "qrc:/qml/ScreenPlayWallpaper/qml/WebsiteWallpaper.qml", - { - "url": Wallpaper.projectSourceFileAbsolute - }) - break + loader.setSource("qrc:/qml/ScreenPlayWallpaper/qml/WebsiteWallpaper.qml", { + "url": Wallpaper.projectSourceFileAbsolute + }); + break; case InstalledType.GifWallpaper: - loader.setSource( - "qrc:/qml/ScreenPlayWallpaper/qml/GifWallpaper.qml", { - "source": Qt.resolvedUrl( - Wallpaper.projectSourceFileAbsolute) - }) - break + loader.setSource("qrc:/qml/ScreenPlayWallpaper/qml/GifWallpaper.qml", { + "source": Qt.resolvedUrl(Wallpaper.projectSourceFileAbsolute) + }); + break; } } - function fadeInImageSetup(){ - if (Qt.platform.os !== "windows") { - root.canFadeByWallpaperFillMode = false - return - } - - imgCover.source = Qt.resolvedUrl("file:///" + Wallpaper.windowsDesktopProperties.wallpaperPath) - - switch (Wallpaper.windowsDesktopProperties.wallpaperStyle) { - case 10: - imgCover.fillMode = Image.PreserveAspectCrop - // We only support fade in for one screen - if (Wallpaper.activeScreensList.length !== 1) - return - if (Wallpaper.width === 0) - return - - if (Wallpaper.width > Wallpaper.windowsDesktopProperties.defaultWallpaperSize.width) - return - - // Windows does some weird top margin if the Wallpaper - // is bigger than the monitor. So instead of centering - // it vertically it moves the wallpaper down by 1/3 of - // the remaining height. - // 1. Scale down the wallpaper based on the height. - // The default Windows 11 wallpaper C:\Windows\Web\Wallpaper\Windows\img19.jpg - // has a resoltion of 3841x2400 scaled down to 3440x2150,3 with a given monitor - // resolution of 3440x1440 resulting in a 2150,3 - 1440 = 710,3 - // 710,3 / (1/3) = 236,767 - const monitorWidth = Wallpaper.width - const monitorHeight = Wallpaper.height - const windowsWallpaperWidth = Wallpaper.windowsDesktopProperties.defaultWallpaperSize.width - const windowsWallpapeHeight = Wallpaper.windowsDesktopProperties.defaultWallpaperSize.height - - // 1. Get scale factor: - // -> 3440 / 3840 = 0.8956 - const scaleFactor = monitorWidth / windowsWallpaperWidth - // 2. Scale down the default Windows wallpaper height (width stays the same for correct aspect ratio): - // -> 2400 * 0.8956 = 2149.4 - const scaledDownDefaultWallpaperHeight = windowsWallpapeHeight * scaleFactor - // 3. Calc offste - // -> 2150,3 - 1440 = 710,3 - const offset = scaledDownDefaultWallpaperHeight - monitorHeight - // 4. Calc the one third offset (topMargin) - // -> 710,3 * (1/3) = 236,767 - const topMargin = Math.floor(offset * 0.3333333) - imgCover.anchors.topMargin = -topMargin - - break - case 6: - imgCover.fillMode = Image.PreserveAspectFit - break - case 2: - break - case 0: - if (desktopProperties.isTiled) { - // Tiled - imgCover.fillMode = Image.Tile - } else { - // Center - imgCover.fillMode = Image.PreserveAspectFit - imgCover.anchors.centerIn = parent - imgCover.width = sourceSize.width - imgCover.height = sourceSize.height - } - break - case 22: - root.canFadeByWallpaperFillMode = false - break + function fadeInImageSetup() { + if (Qt.platform.os !== "windows") { + root.canFadeByWallpaperFillMode = false; + return; + } + imgCover.source = Qt.resolvedUrl("file:///" + Wallpaper.windowsDesktopProperties.wallpaperPath); + switch (Wallpaper.windowsDesktopProperties.wallpaperStyle) { + case 10: + imgCover.fillMode = Image.PreserveAspectCrop; + // We only support fade in for one screen + if (Wallpaper.activeScreensList.length !== 1) + return; + if (Wallpaper.width === 0) + return; + if (Wallpaper.width > Wallpaper.windowsDesktopProperties.defaultWallpaperSize.width) + return; + + // Windows does some weird top margin if the Wallpaper + // is bigger than the monitor. So instead of centering + // it vertically it moves the wallpaper down by 1/3 of + // the remaining height. + // 1. Scale down the wallpaper based on the height. + // The default Windows 11 wallpaper C:\Windows\Web\Wallpaper\Windows\img19.jpg + // has a resoltion of 3841x2400 scaled down to 3440x2150,3 with a given monitor + // resolution of 3440x1440 resulting in a 2150,3 - 1440 = 710,3 + // 710,3 / (1/3) = 236,767 + const monitorWidth = Wallpaper.width; + const monitorHeight = Wallpaper.height; + const windowsWallpaperWidth = Wallpaper.windowsDesktopProperties.defaultWallpaperSize.width; + const windowsWallpapeHeight = Wallpaper.windowsDesktopProperties.defaultWallpaperSize.height; + + // 1. Get scale factor: + // -> 3440 / 3840 = 0.8956 + const scaleFactor = monitorWidth / windowsWallpaperWidth; + // 2. Scale down the default Windows wallpaper height (width stays the same for correct aspect ratio): + // -> 2400 * 0.8956 = 2149.4 + const scaledDownDefaultWallpaperHeight = windowsWallpapeHeight * scaleFactor; + // 3. Calc offste + // -> 2150,3 - 1440 = 710,3 + const offset = scaledDownDefaultWallpaperHeight - monitorHeight; + // 4. Calc the one third offset (topMargin) + // -> 710,3 * (1/3) = 236,767 + const topMargin = Math.floor(offset * 0.3333333); + imgCover.anchors.topMargin = -topMargin; + break; + case 6: + imgCover.fillMode = Image.PreserveAspectFit; + break; + case 2: + break; + case 0: + if (desktopProperties.isTiled) { + // Tiled + imgCover.fillMode = Image.Tile; + } else { + // Center + imgCover.fillMode = Image.PreserveAspectFit; + imgCover.anchors.centerIn = parent; + imgCover.width = sourceSize.width; + imgCover.height = sourceSize.height; } + break; + case 22: + root.canFadeByWallpaperFillMode = false; + break; + } } function fadeIn() { - Wallpaper.setVisible(true) - + Wallpaper.setVisible(true); if (canFadeByWallpaperFillMode && Wallpaper.canFade) - imgCover.state = "hideDefaultBackgroundImage" + imgCover.state = "hideDefaultBackgroundImage"; else - imgCover.opacity = 0 + imgCover.opacity = 0; } anchors.fill: parent color: { if (Qt.platform.os !== "windows") - return "black" + return "black"; else - return Wallpaper.windowsDesktopProperties.color + return Wallpaper.windowsDesktopProperties.color; } - + Component.onCompleted: { - init() + init(); } Connections { function onQmlExit() { if (canFadeByWallpaperFillMode && Wallpaper.canFade) - imgCover.state = "exit" + imgCover.state = "exit"; else - Wallpaper.terminate() + Wallpaper.terminate(); } function onQmlSceneValueReceived(key, value) { - var obj2 = 'import QtQuick; Item {Component.onCompleted: loader.item.' - + key + ' = ' + value + '; }' - var newObject = Qt.createQmlObject(obj2.toString(), root, "err") - newObject.destroy(10000) + var obj2 = 'import QtQuick; Item {Component.onCompleted: loader.item.' + key + ' = ' + value + '; }'; + var newObject = Qt.createQmlObject(obj2.toString(), root, "err"); + newObject.destroy(10000); } // Replace wallpaper with QML Scene function onReloadQML(oldType) { - loader.sourceComponent = undefined - loader.source = "" - Wallpaper.clearComponentCache() - loader.source = Qt.resolvedUrl(Wallpaper.projectSourceFileAbsolute) + loader.sourceComponent = undefined; + loader.source = ""; + Wallpaper.clearComponentCache(); + loader.source = Qt.resolvedUrl(Wallpaper.projectSourceFileAbsolute); } // Replace wallpaper with GIF function onReloadGIF(oldType) { - init() + init(); } // This function only gets called here (the same function @@ -189,15 +173,13 @@ Rectangle { // We need to check if the old type // was also Video not get called twice if (oldType === InstalledType.VideoWallpaper) - return - - loader.source = "qrc:/qml/ScreenPlayWallpaper/qml/MultimediaView.qml" + return; + loader.source = "qrc:/qml/ScreenPlayWallpaper/qml/MultimediaView.qml"; } target: Wallpaper } - Loader { id: loader anchors.fill: parent @@ -205,17 +187,15 @@ Rectangle { // an item. QApplication::quit(); waits for the destruction forever. //asynchronous: true onStatusChanged: { - if (loader.status === Loader.Ready ) { - if(loader.item.ready) - root.fadeIn() + if (loader.status === Loader.Ready) { + if (loader.item.ready) + root.fadeIn(); } if (loader.status === Loader.Error) { - loader.source = "" - imgCover.state = "exit" + loader.source = ""; + imgCover.state = "exit"; } } - - } Image { @@ -223,7 +203,7 @@ Rectangle { state: "showDefaultBackgroundImage" sourceSize.width: Wallpaper.width sourceSize.height: Wallpaper.height - + anchors { top: parent.top left: parent.left @@ -324,8 +304,7 @@ Rectangle { } Text { - text: "projectSourceFileAbsolute " + Qt.resolvedUrl( - Wallpaper.projectSourceFileAbsolute) + text: "projectSourceFileAbsolute " + Qt.resolvedUrl(Wallpaper.projectSourceFileAbsolute) font.pointSize: 14 } @@ -362,10 +341,9 @@ Rectangle { Text { text: { if (Qt.platform.os === "windows") - return "imgCover.source " + Qt.resolvedUrl( - "file:///" + Wallpaper.windowsDesktopProperties.wallpaperPath) + return "imgCover.source " + Qt.resolvedUrl("file:///" + Wallpaper.windowsDesktopProperties.wallpaperPath); else - return "" + return ""; } font.pointSize: 14 } diff --git a/ScreenPlayWallpaper/qml/WebsiteWallpaper.qml b/ScreenPlayWallpaper/qml/WebsiteWallpaper.qml index a9aee1cd..d5bd76f4 100644 --- a/ScreenPlayWallpaper/qml/WebsiteWallpaper.qml +++ b/ScreenPlayWallpaper/qml/WebsiteWallpaper.qml @@ -7,7 +7,7 @@ Item { property string url - signal requestFadeIn() + signal requestFadeIn Component.onCompleted: { WebEngine.settings.localContentCanAccessFileUrls = true; @@ -29,8 +29,6 @@ Item { onLoadProgressChanged: { if ((loadProgress === 100)) root.requestFadeIn(); - } } - } diff --git a/ScreenPlayWeather/qml/TestMain.qml b/ScreenPlayWeather/qml/TestMain.qml index d9d7a204..8e9c87aa 100644 --- a/ScreenPlayWeather/qml/TestMain.qml +++ b/ScreenPlayWeather/qml/TestMain.qml @@ -17,55 +17,56 @@ Window { id: weather city: "Friedrichshafen" onReady: { - rp.model = weather.days + rp.model = weather.days; // Qt bug https://bugreports.qt.io/browse/QTBUG-105137 - test() + test(); } } - function test() {} + function test() { + } function mapWeatherCode(code) { - const weather_time = "" // or "-day", "-night" - const weather_prefix = "wi" + weather_time + "-" + const weather_time = ""; // or "-day", "-night" + const weather_prefix = "wi" + weather_time + "-"; // https://open-meteo.com/en/docs // WMO Weather interpretation codes (WW) // to https://erikflowers.github.io/weather-icons/ switch (code) { case 0: - return weather_prefix + "day-sunny" + return weather_prefix + "day-sunny"; case 1: case 2: case 3: - return weather_prefix + "cloud" + return weather_prefix + "cloud"; case 45: case 48: - return weather_prefix + "day-sunny" + return weather_prefix + "day-sunny"; case 51: case 53: case 55: - return weather_prefix + "rain-mix" + return weather_prefix + "rain-mix"; case 61: case 63: case 65: - return weather_prefix + "rain-mix" + return weather_prefix + "rain-mix"; case 71: case 73: case 75: - return weather_prefix + "snow" + return weather_prefix + "snow"; case 77: - return weather_prefix + "snow" + return weather_prefix + "snow"; case 80: case 81: case 82: - return weather_prefix + "snow" + return weather_prefix + "snow"; case 85: case 86: - return weather_prefix + "snow" + return weather_prefix + "snow"; case 95: - return weather_prefix + "thunderstorm" + return weather_prefix + "thunderstorm"; case 96: case 99: - return weather_prefix + "storm-showers" + return weather_prefix + "storm-showers"; } } Rectangle { @@ -100,28 +101,7 @@ Window { Text { Layout.alignment: Qt.AlignCenter horizontalAlignment: Text.AlignHCenter - text: "longtitude: " + weather.longtitude + " - latitude: " - + weather.latitude + " - elevation: " + weather.elevation - + "m - population: " + weather.population - } - - component TextItem: Column { - property alias value: value.text - property alias text: description.text - Layout.preferredWidth: 120 - Text { - id: value - width: 120 - font.pointSize: 16 - horizontalAlignment: Text.AlignHCenter - color: Material.primaryTextColor - } - Text { - id: description - horizontalAlignment: Text.AlignHCenter - color: Material.secondaryTextColor - width: 120 - } + text: "longtitude: " + weather.longtitude + " - latitude: " + weather.latitude + " - elevation: " + weather.elevation + "m - population: " + weather.population } RowLayout { @@ -159,8 +139,7 @@ Window { } Layout.alignment: Qt.AlignCenter horizontalAlignment: Image.AlignHCenter - source: "qrc:/qml/ScreenPlayWeather/assets/icons/" + root.mapWeatherCode( - weatherCode) + ".svg" + source: "qrc:/qml/ScreenPlayWeather/assets/icons/" + root.mapWeatherCode(weatherCode) + ".svg" } TextItem { text: "Weather Code" @@ -188,4 +167,23 @@ Window { } } } + + component TextItem: Column { + property alias value: value.text + property alias text: description.text + Layout.preferredWidth: 120 + Text { + id: value + width: 120 + font.pointSize: 16 + horizontalAlignment: Text.AlignHCenter + color: Material.primaryTextColor + } + Text { + id: description + horizontalAlignment: Text.AlignHCenter + color: Material.secondaryTextColor + width: 120 + } + } } diff --git a/ScreenPlayWidget/qml/Test.qml b/ScreenPlayWidget/qml/Test.qml index 9e9a16b8..8e384e6a 100644 --- a/ScreenPlayWidget/qml/Test.qml +++ b/ScreenPlayWidget/qml/Test.qml @@ -2,11 +2,10 @@ import QtQuick import ScreenPlayWidget Rectangle { - implicitWidth: 500 + implicitWidth: 500 implicitHeight: 300 color: "#80000000" - Text { id: name @@ -18,5 +17,4 @@ Rectangle { anchors.margins: 10 color: "white" } - } diff --git a/ScreenPlayWidget/qml/Widget.qml b/ScreenPlayWidget/qml/Widget.qml index be487cec..f65c972d 100644 --- a/ScreenPlayWidget/qml/Widget.qml +++ b/ScreenPlayWidget/qml/Widget.qml @@ -18,24 +18,23 @@ Item { target: Widget function onQmlExit() { if (Qt.platform.os === "windows") - Widget.setWindowBlur(0) - loader.source = "" - animFadeOut.start() + Widget.setWindowBlur(0); + loader.source = ""; + animFadeOut.start(); } function onQmlSceneValueReceived(key, value) { - var obj2 = 'import QtQuick; Item {Component.onCompleted: loader.item.' - + key + ' = ' + value + '; }' - var newObject = Qt.createQmlObject(obj2.toString(), root, "err") - newObject.destroy(10000) + var obj2 = 'import QtQuick; Item {Component.onCompleted: loader.item.' + key + ' = ' + value + '; }'; + var newObject = Qt.createQmlObject(obj2.toString(), root, "err"); + newObject.destroy(10000); } // Replace wallpaper with QML Scene function onReloadQML(oldType) { - loader.sourceComponent = undefined - loader.source = "" - Widget.clearComponentCache() - loader.source = Qt.resolvedUrl(Widget.projectSourceFileAbsolute) + loader.sourceComponent = undefined; + loader.source = ""; + Widget.clearComponentCache(); + loader.source = Qt.resolvedUrl(Widget.projectSourceFileAbsolute); } } @@ -65,11 +64,11 @@ Item { Component.onCompleted: { switch (Widget.type) { case InstalledType.QMLWidget: - loader.source = Qt.resolvedUrl(Widget.projectSourceFileAbsolute) - break + loader.source = Qt.resolvedUrl(Widget.projectSourceFileAbsolute); + break; case InstalledType.HTMLWidget: - loader.sourceComponent = webViewComponent - break + loader.sourceComponent = webViewComponent; + break; } } onStatusChanged: { @@ -77,10 +76,10 @@ Item { // Resize to loaded widget size // Note: We must use implicit* here to not // break the set values. - root.width = loader.item.implicitWidth - root.height = loader.item.implicitHeight - Widget.show() - root.state = "in" + root.width = loader.item.implicitWidth; + root.height = loader.item.implicitHeight; + Widget.show(); + root.state = "in"; } } } @@ -95,7 +94,7 @@ Item { anchors.fill: parent onJavaScriptConsoleMessage: print(lineNumber, message) Component.onCompleted: { - webView.url = Qt.resolvedUrl(Widget.sourcePath) + webView.url = Qt.resolvedUrl(Widget.sourcePath); } } } @@ -110,20 +109,19 @@ Item { onEntered: imgClose.state = "areaHover" onExited: { if (mouseAreaClose.containsMouse) - return - imgClose.state = "" + return; + imgClose.state = ""; } onPressed: function (mouse) { clickPos = { "x": mouse.x, "y": mouse.y - } + }; } onPositionChanged: { if (mouseArea.pressed) - Widget.setPos(Widget.cursorPos().x - clickPos.x, - Widget.cursorPos().y - clickPos.y) + Widget.setPos(Widget.cursorPos().x - clickPos.x, Widget.cursorPos().y - clickPos.y); } } @@ -137,8 +135,8 @@ Item { onExited: imgClose.state = "" onClicked: { if (Qt.platform.os === "windows") - Widget.setWindowBlur(0) - animFadeOut.start() + Widget.setWindowBlur(0); + animFadeOut.start(); } anchors { diff --git a/ScreenPlayWorkshop/qml/Background.qml b/ScreenPlayWorkshop/qml/Background.qml index ff1ed693..fa30a38f 100644 --- a/ScreenPlayWorkshop/qml/Background.qml +++ b/ScreenPlayWorkshop/qml/Background.qml @@ -7,30 +7,30 @@ Rectangle { property string backgroundImage: "" property int imageOffsetTop: 0 property int stackViewDepth: 0 - onStackViewDepthChanged: { + onStackViewDepthChanged: { if (stackViewDepth > 1) { - root.state = "backgroundBlur" - return true + root.state = "backgroundBlur"; + return true; } - root.state = "backgroundImage" - return false + root.state = "backgroundImage"; + return false; } color: "#161C1D" onImageOffsetTopChanged: { if ((imageOffsetTop * -1) >= 200) { - root.state = "backgroundColor" + root.state = "backgroundColor"; } else { if (root.state !== "backgroundImage") - root.state = "backgroundImage" + root.state = "backgroundImage"; } } onBackgroundImageChanged: { if (backgroundImage === "") - root.state = "" + root.state = ""; else - root.state = "backgroundImage" + root.state = "backgroundImage"; } Image { diff --git a/ScreenPlayWorkshop/qml/Forum.qml b/ScreenPlayWorkshop/qml/Forum.qml index 5dcba368..5cbc8e70 100644 --- a/ScreenPlayWorkshop/qml/Forum.qml +++ b/ScreenPlayWorkshop/qml/Forum.qml @@ -6,7 +6,6 @@ import Qt5Compat.GraphicalEffects import ScreenPlayApp import ScreenPlay - Item { id: root @@ -23,7 +22,7 @@ Item { } RowLayout { - anchors{ + anchors { fill: parent rightMargin: 20 leftMargin: 20 @@ -49,5 +48,4 @@ Item { } } } - } diff --git a/ScreenPlayWorkshop/qml/Navigation.qml b/ScreenPlayWorkshop/qml/Navigation.qml index b3c1bac9..9e961243 100644 --- a/ScreenPlayWorkshop/qml/Navigation.qml +++ b/ScreenPlayWorkshop/qml/Navigation.qml @@ -35,8 +35,7 @@ Rectangle { verticalAlignment: Qt.AlignVCenter wrapMode: Text.WrapAtWordBoundaryOrAnywhere text: { - return steam.steamAccount.username + qsTr( - " Subscribed items: ") + steam.steamAccount.amountSubscribedItems + return steam.steamAccount.username + qsTr(" Subscribed items: ") + steam.steamAccount.amountSubscribedItems; } anchors { @@ -55,7 +54,7 @@ Rectangle { width: 30 height: 30 Component.onCompleted: { - steam.steamAccount.loadAvatar() + steam.steamAccount.loadAvatar(); } anchors { @@ -66,8 +65,8 @@ Rectangle { Connections { function onAvatarChanged(_avatar) { - avatar.setImage(_avatar) - avatarPlaceholder.opacity = 0 + avatar.setImage(_avatar); + avatarPlaceholder.opacity = 0; } target: steam.steamAccount diff --git a/ScreenPlayWorkshop/qml/PopupOffline.qml b/ScreenPlayWorkshop/qml/PopupOffline.qml index 4a52963e..37dffd11 100644 --- a/ScreenPlayWorkshop/qml/PopupOffline.qml +++ b/ScreenPlayWorkshop/qml/PopupOffline.qml @@ -54,8 +54,7 @@ Popup { horizontalAlignment: Text.AlignHCenter Layout.alignment: Qt.AlignHCenter color: Material.secondaryTextColor - text: qsTr("Steam Error Restart: %1\nSteam Error API Init: %2").arg( - steam.steamErrorRestart).arg(root.steam.steamErrorAPIInit) + text: qsTr("Steam Error Restart: %1\nSteam Error API Init: %2").arg(steam.steamErrorRestart).arg(root.steam.steamErrorAPIInit) } Button { @@ -63,8 +62,8 @@ Popup { text: qsTr("Back") Layout.alignment: Qt.AlignHCenter onClicked: { - root.close() - App.util.setNavigation("Installed") + root.close(); + App.util.setNavigation("Installed"); } } Item { diff --git a/ScreenPlayWorkshop/qml/ScreenPlayItem.qml b/ScreenPlayWorkshop/qml/ScreenPlayItem.qml index dcf0f666..9b05eeb6 100644 --- a/ScreenPlayWorkshop/qml/ScreenPlayItem.qml +++ b/ScreenPlayWorkshop/qml/ScreenPlayItem.qml @@ -43,7 +43,6 @@ Item { y: 0 z: 0 } - }, Translate { id: tr @@ -105,7 +104,6 @@ Item { easing.type: Easing.OutQuint properties: "xScale,yScale" } - } RectangularGlow { @@ -124,7 +122,6 @@ Item { top: parent.top topMargin: 3 } - } Item { @@ -170,7 +167,6 @@ Item { left: parent.left margins: 10 } - } Rectangle { @@ -183,9 +179,7 @@ Item { left: parent.left bottom: parent.bottom } - } - } OpacityMask { @@ -201,21 +195,17 @@ Item { onEntered: { if (!hasMenuOpen) screenPlayItem.state = "hover"; - } onExited: { if (!hasMenuOpen) screenPlayItem.state = "visible"; - } onClicked: { checkBox.toggle(); if (mouse.button === Qt.LeftButton) itemClicked(screenId, type, checkBox.checkState === Qt.Checked); - } } - } CheckBox { @@ -233,9 +223,7 @@ Item { right: parent.right margins: 10 } - } - } states: [ @@ -252,7 +240,6 @@ Item { target: effect opacity: 0 } - }, State { name: "visible" @@ -278,7 +265,6 @@ Item { target: icnType opacity: 0 } - }, State { name: "selected" @@ -293,7 +279,6 @@ Item { target: icnType opacity: 0.5 } - } ] transitions: [ @@ -311,7 +296,6 @@ Item { property: "opacity" duration: 80 } - } ] } diff --git a/ScreenPlayWorkshop/qml/ScreenPlayItemImage.qml b/ScreenPlayWorkshop/qml/ScreenPlayItemImage.qml index 7bd3b67b..de92c99d 100644 --- a/ScreenPlayWorkshop/qml/ScreenPlayItemImage.qml +++ b/ScreenPlayWorkshop/qml/ScreenPlayItemImage.qml @@ -34,7 +34,6 @@ Item { target: image opacity: 0 } - }, State { name: "loaded" @@ -43,7 +42,6 @@ Item { target: image opacity: 1 } - } ] transitions: [ @@ -57,7 +55,6 @@ Item { duration: 300 easing.type: Easing.InOutQuad } - } ] } diff --git a/ScreenPlayWorkshop/qml/Sidebar.qml b/ScreenPlayWorkshop/qml/Sidebar.qml index 9ee13594..447d3009 100644 --- a/ScreenPlayWorkshop/qml/Sidebar.qml +++ b/ScreenPlayWorkshop/qml/Sidebar.qml @@ -22,22 +22,21 @@ Drawer { function setWorkshopItem(publishedFileID, imgUrl, videoPreview, subscriptionCount) { if (root.publishedFileID === publishedFileID) { if (!root.visible) - root.open() + root.open(); else - root.close() - return + root.close(); + return; } - root.publishedFileID = publishedFileID - root.imgUrl = imgUrl - root.subscriptionCount = subscriptionCount - root.videoPreview = videoPreview - root.subscribed = false - txtVotesUp.highlighted = false - txtVotesDown.highlighted = false + root.publishedFileID = publishedFileID; + root.imgUrl = imgUrl; + root.subscriptionCount = subscriptionCount; + root.videoPreview = videoPreview; + root.subscribed = false; + txtVotesUp.highlighted = false; + txtVotesDown.highlighted = false; if (!root.visible) - root.open() - - steamWorkshop.requestWorkshopItemDetails(publishedFileID) + root.open(); + steamWorkshop.requestWorkshopItemDetails(publishedFileID); } edge: Qt.RightEdge @@ -49,31 +48,30 @@ Drawer { Connections { function onRequestItemDetailReturned(title, tags, steamIDOwner, description, votesUp, votesDown, url, fileSize, publishedFileId) { - tagListModel.clear() + tagListModel.clear(); // Even if the tags array is empty it still contains // one empty string, resulting in an empty button if (tags.length > 1) { for (var i in tags) { tagListModel.append({ - "name": tags[i] - }) + "name": tags[i] + }); } - rpTagList.model = tagListModel + rpTagList.model = tagListModel; } else { - rpTagList.model = null + rpTagList.model = null; } - txtTitle.text = title - const size = Math.floor((1000 * ((fileSize / 1024) / 1000)) / 1000) - txtFileSize.text = qsTr("Size: ") + size + " MB" - pbVotes.to = votesDown + votesUp - pbVotes.value = votesUp - txtVotesDown.text = votesDown - txtVotesUp.text = votesUp + txtTitle.text = title; + const size = Math.floor((1000 * ((fileSize / 1024) / 1000)) / 1000); + txtFileSize.text = qsTr("Size: ") + size + " MB"; + pbVotes.to = votesDown + votesUp; + pbVotes.value = votesUp; + txtVotesDown.text = votesDown; + txtVotesUp.text = votesUp; if (description === "") - description = qsTr("No description...") - - txtDescription.text = description - pbVotes.hoverText = votesUp + " / " + votesDown + description = qsTr("No description..."); + txtDescription.text = description; + pbVotes.hoverText = votesUp + " / " + votesDown; } target: steamWorkshop @@ -187,9 +185,9 @@ Drawer { ToolTip.visible: hovered ToolTip.text: qsTr("Click here if you like the content") onClicked: { - steamWorkshop.vote(root.publishedFileID, true) - txtVotesUp.highlighted = true - txtVotesDown.highlighted = false + steamWorkshop.vote(root.publishedFileID, true); + txtVotesUp.highlighted = true; + txtVotesDown.highlighted = false; } } @@ -201,9 +199,9 @@ Drawer { ToolTip.visible: hovered ToolTip.text: qsTr("Click here if you do not like the content") onClicked: { - steamWorkshop.vote(root.publishedFileID, false) - txtVotesUp.highlighted = false - txtVotesDown.highlighted = true + steamWorkshop.vote(root.publishedFileID, false); + txtVotesUp.highlighted = false; + txtVotesDown.highlighted = true; } } } @@ -230,8 +228,7 @@ Drawer { ScrollBar.horizontal: ScrollBar { height: 5 } - contentWidth: rpTagList.childrenRect.width + rowTagList.width - + (rpTagList.count * rowTagList.spacing) + contentWidth: rpTagList.childrenRect.width + rowTagList.width + (rpTagList.count * rowTagList.spacing) contentHeight: 40 Row { @@ -259,7 +256,6 @@ Drawer { } } - RowLayout { Layout.fillWidth: true spacing: 20 @@ -331,8 +327,7 @@ Drawer { icon.source: "qrc:/qml/ScreenPlayWorkshop/assets/icons/icon_open_in_new.svg" height: 25 text: qsTr("Open In Steam") - onClicked: Qt.openUrlExternally( - "steam://url/CommunityFilePage/" + root.publishedFileID) + onClicked: Qt.openUrlExternally("steam://url/CommunityFilePage/" + root.publishedFileID) } Button { @@ -343,15 +338,14 @@ Drawer { icon.source: "qrc:/qml/ScreenPlayWorkshop/assets/icons/icon_download.svg" text: root.subscribed ? qsTr("Subscribed!") : qsTr("Subscribe") onClicked: { - root.subscribed = true - root.steamWorkshop.subscribeItem(root.publishedFileID) + root.subscribed = true; + root.steamWorkshop.subscribeItem(root.publishedFileID); } } } background: Rectangle { - color: Material.theme === Material.Light ? "white" : Qt.darker( - Material.background) + color: Material.theme === Material.Light ? "white" : Qt.darker(Material.background) opacity: 0.95 } diff --git a/ScreenPlayWorkshop/qml/SteamProfile.qml b/ScreenPlayWorkshop/qml/SteamProfile.qml index 36da8f75..b3124897 100644 --- a/ScreenPlayWorkshop/qml/SteamProfile.qml +++ b/ScreenPlayWorkshop/qml/SteamProfile.qml @@ -45,13 +45,13 @@ Item { width: 70 height: 70 Component.onCompleted: { - root.steamWorkshop.steamAccount.loadAvatar() + root.steamWorkshop.steamAccount.loadAvatar(); } Connections { function onAvatarChanged(_avatar) { - avatar.setImage(_avatar) - avatarPlaceholder.opacity = 0 + avatar.setImage(_avatar); + avatarPlaceholder.opacity = 0; } target: root.steamWorkshop.steamAccount @@ -133,8 +133,7 @@ Item { text: qsTr("Back") enabled: root.steamWorkshop.workshopProfileListModel.currentPage > 1 onClicked: { - root.steamWorkshop.workshopProfileListModel.setCurrentPage( - root.steamWorkshop.workshopProfileListModel.currentPage - 1) + root.steamWorkshop.workshopProfileListModel.setCurrentPage(root.steamWorkshop.workshopProfileListModel.currentPage - 1); } } @@ -142,8 +141,7 @@ Item { id: txtPage Layout.alignment: Qt.AlignVCenter - text: root.steamWorkshop.workshopProfileListModel.currentPage - + "/" + root.steamWorkshop.workshopProfileListModel.pages + text: root.steamWorkshop.workshopProfileListModel.currentPage + "/" + root.steamWorkshop.workshopProfileListModel.pages color: Material.primaryTextColor } @@ -152,11 +150,9 @@ Item { Layout.alignment: Qt.AlignVCenter text: qsTr("Forward") - enabled: root.steamWorkshop.workshopProfileListModel.currentPage - <= root.steamWorkshop.workshopProfileListModel.pages - 1 + enabled: root.steamWorkshop.workshopProfileListModel.currentPage <= root.steamWorkshop.workshopProfileListModel.pages - 1 onClicked: { - root.steamWorkshop.workshopProfileListModel.setCurrentPage( - root.steamWorkshop.workshopProfileListModel.currentPage + 1) + root.steamWorkshop.workshopProfileListModel.setCurrentPage(root.steamWorkshop.workshopProfileListModel.currentPage + 1); } } diff --git a/ScreenPlayWorkshop/qml/SteamWorkshop.qml b/ScreenPlayWorkshop/qml/SteamWorkshop.qml index 92316ea9..ae1bf12e 100644 --- a/ScreenPlayWorkshop/qml/SteamWorkshop.qml +++ b/ScreenPlayWorkshop/qml/SteamWorkshop.qml @@ -17,26 +17,23 @@ Item { Component.onCompleted: { if (screenPlayWorkshop.init()) { stackView.push("qrc:/qml/ScreenPlayWorkshop/qml/SteamWorkshopStartPage.qml", { - "stackView": stackView, - "screenPlayWorkshop": screenPlayWorkshop, - "steamWorkshop": screenPlayWorkshop.steamWorkshop, - "background": background, - // "modalSource": root.modalSource - }) + "stackView": stackView, + "screenPlayWorkshop": screenPlayWorkshop, + "steamWorkshop": screenPlayWorkshop.steamWorkshop, + "background": background + }); } else { - popupOffline.open() + popupOffline.open(); } } } - Background { id: background anchors.fill: parent stackViewDepth: stackView.depth } - PopupOffline { id: popupOffline workshop: screenPlayWorkshop @@ -52,7 +49,7 @@ Item { target: stackView.currentItem ignoreUnknownSignals: true function onRequestBack() { - stackView.pop() + stackView.pop(); } } diff --git a/ScreenPlayWorkshop/qml/SteamWorkshopStartPage.qml b/ScreenPlayWorkshop/qml/SteamWorkshopStartPage.qml index 9e0567eb..e530ab31 100644 --- a/ScreenPlayWorkshop/qml/SteamWorkshopStartPage.qml +++ b/ScreenPlayWorkshop/qml/SteamWorkshopStartPage.qml @@ -16,13 +16,13 @@ Item { property Background background Component.onCompleted: { - root.state = "searching" - root.steamWorkshop.searchWorkshopByText("") + root.state = "searching"; + root.steamWorkshop.searchWorkshopByText(""); } onVisibleChanged: { if (!visible) - sidebar.close() + sidebar.close(); } MouseArea { @@ -40,16 +40,14 @@ Item { id: searchConnection target: root.steamWorkshop function onWorkshopBannerCompleted() { - bannerTxt.text = root.steamWorkshop.workshopListModel.getBannerText( - ) - background.backgroundImage = root.steamWorkshop.workshopListModel.getBannerUrl() - banner.bannerPublishedFileID = root.steamWorkshop.workshopListModel.getBannerID() - bannerTxtUnderline.numberSubscriber - = root.steamWorkshop.workshopListModel.getBannerAmountSubscriber() + bannerTxt.text = root.steamWorkshop.workshopListModel.getBannerText(); + background.backgroundImage = root.steamWorkshop.workshopListModel.getBannerUrl(); + banner.bannerPublishedFileID = root.steamWorkshop.workshopListModel.getBannerID(); + bannerTxtUnderline.numberSubscriber = root.steamWorkshop.workshopListModel.getBannerAmountSubscriber(); } function onWorkshopSearchCompleted(itemCount) { - root.state = "" + root.state = ""; } } @@ -59,7 +57,7 @@ Item { Connections { function onUserNeedsToAcceptWorkshopLegalAgreement() { - popupSteamWorkshopAgreement.open() + popupSteamWorkshopAgreement.open(); } target: root.steamWorkshop.uploadListModel @@ -76,9 +74,9 @@ Item { onContentYChanged: { // Calculate parallax scrolling if (contentY >= 0) - background.imageOffsetTop = (contentY * -0.4) + background.imageOffsetTop = (contentY * -0.4); else - background.imageOffsetTop = 0 + background.imageOffsetTop = 0; } Item { @@ -129,30 +127,6 @@ Item { spacing: 10 - component HeaderLabel: Label { - id: textObj - color: "white" - wrapMode: Text.WrapAnywhere - clip: true - - width: Math.min(100, textWidth) - readonly property alias textWidth: textMetrics.boundingRect.width - - TextMetrics { - id: textMetrics - font: textObj.font - text: textObj.text - elide: textObj.elide - } - - background: Rectangle { - opacity: .9 - color: Material.theme - === Material.Light ? Material.background : "#242424" - } - padding: 10 - } - HeaderLabel { id: bannerTxtUnderline property int numberSubscriber: 0 @@ -161,7 +135,6 @@ Item { } HeaderLabel { - id: bannerTxt font.pointSize: 42 } @@ -175,10 +148,8 @@ Item { highlighted: true icon.source: "qrc:/qml/ScreenPlayWorkshop/assets/icons/icon_download.svg" onClicked: { - text = qsTr("Downloading...") - root.steamWorkshop.subscribeItem( - root.steamWorkshop.workshopListModel.getBannerID( - )) + text = qsTr("Downloading..."); + root.steamWorkshop.subscribeItem(root.steamWorkshop.workshopListModel.getBannerID()); } } @@ -191,16 +162,11 @@ Item { //icon.source: "qrc:/qml/ScreenPlayWorkshop/assets/icons/icon_info.svg" visible: false onClicked: { - sidebar.setWorkshopItem( - publishedFileID, imgUrl, - additionalPreviewUrl, - subscriptionCount) + sidebar.setWorkshopItem(publishedFileID, imgUrl, additionalPreviewUrl, subscriptionCount); } } ToolButton { - onClicked: Qt.openUrlExternally( - "steam://url/CommunityFilePage/" - + banner.bannerPublishedFileID) + onClicked: Qt.openUrlExternally("steam://url/CommunityFilePage/" + banner.bannerPublishedFileID) icon.source: "qrc:/qml/ScreenPlayWorkshop/assets/icons/icon_open_in_new.svg" } } @@ -247,7 +213,7 @@ Item { width: 70 height: 70 Component.onCompleted: { - steamWorkshop.steamAccount.loadAvatar() + steamWorkshop.steamAccount.loadAvatar(); } anchors { @@ -257,8 +223,8 @@ Item { Connections { function onAvatarChanged(_avatar) { - avatar.setImage(_avatar) - avatarPlaceholder.opacity = 0 + avatar.setImage(_avatar); + avatarPlaceholder.opacity = 0; } target: steamWorkshop.steamAccount @@ -283,12 +249,10 @@ Item { text: qsTr("Profile") icon.source: "qrc:/qml/ScreenPlayWorkshop/assets/icons/icon_account_circle.svg" onClicked: { - stackView.push( - "qrc:/qml/ScreenPlayWorkshop/qml/SteamProfile.qml", - { - "screenPlayWorkshop": root.screenPlayWorkshop, - "steamWorkshop": root.steamWorkshop - }) + stackView.push("qrc:/qml/ScreenPlayWorkshop/qml/SteamProfile.qml", { + "screenPlayWorkshop": root.screenPlayWorkshop, + "steamWorkshop": root.steamWorkshop + }); } } @@ -304,12 +268,10 @@ Item { text: qsTr("Upload") icon.source: "qrc:/qml/ScreenPlayWorkshop/assets/icons/icon_file_upload.svg" onClicked: { - stackView.push( - "qrc:/qml/ScreenPlayWorkshop/qml/upload/UploadProject.qml", - { - "screenPlayWorkshop": root.screenPlayWorkshop, - "steamWorkshop": root.steamWorkshop - }) + stackView.push("qrc:/qml/ScreenPlayWorkshop/qml/upload/UploadProject.qml", { + "screenPlayWorkshop": root.screenPlayWorkshop, + "steamWorkshop": root.steamWorkshop + }); } } @@ -328,9 +290,8 @@ Item { ToolButton { icon.source: "qrc:/qml/ScreenPlayWorkshop/assets/icons/icon_search.svg" onClicked: { - root.state = "searching" - root.steamWorkshop.searchWorkshopByText( - tiSearch.text) + root.state = "searching"; + root.steamWorkshop.searchWorkshopByText(tiSearch.text); } icon.width: 20 icon.height: 20 @@ -349,22 +310,17 @@ Item { // WORKAROUND: // onEditingFinished causes internal qml layout crash in Qt 6.4 Keys.onReturnPressed: event => { - event.accepted = true - if (root.state === "searching") { - print("SEARCHING") - return - } - - root.state = "searching" - print("EDITING FINISHED", - root.state) - if (tiSearch.text === "") - return root.steamWorkshop.searchWorkshop( - SteamEnums.K_EUGCQuery_RankedByTrend) - - root.steamWorkshop.searchWorkshopByText( - tiSearch.text) - } + event.accepted = true; + if (root.state === "searching") { + print("SEARCHING"); + return; + } + root.state = "searching"; + print("EDITING FINISHED", root.state); + if (tiSearch.text === "") + return root.steamWorkshop.searchWorkshop(SteamEnums.K_EUGCQuery_RankedByTrend); + root.steamWorkshop.searchWorkshopByText(tiSearch.text); + } leftInset: -20 leftPadding: 20 @@ -379,10 +335,9 @@ Item { ToolButton { icon.source: "qrc:/qml/ScreenPlayWorkshop/assets/icons/icon_close.svg" onClicked: { - root.state = "searching" - tiSearch.text = "" - root.steamWorkshop.searchWorkshop( - SteamEnums.K_EUGCQuery_RankedByTrend) + root.state = "searching"; + tiSearch.text = ""; + root.steamWorkshop.searchWorkshop(SteamEnums.K_EUGCQuery_RankedByTrend); } enabled: tiSearch.text !== "" icon.width: 20 @@ -414,8 +369,7 @@ Item { Button { text: qsTr("Open Workshop in Steam") font.capitalization: Font.Capitalize - onClicked: Qt.openUrlExternally( - "steam://url/SteamWorkshopPage/672870") + onClicked: Qt.openUrlExternally("steam://url/SteamWorkshopPage/672870") icon.source: "qrc:/qml/ScreenPlayWorkshop/assets/icons/icon_steam.svg" icon.width: 18 icon.height: 18 @@ -464,9 +418,8 @@ Item { "text": qsTr("Total Unique Subscriptions") }] onActivated: { - root.state = "searching" - root.steamWorkshop.searchWorkshop( - cbQuerySort.currentValue) + root.state = "searching"; + root.steamWorkshop.searchWorkshop(cbQuerySort.currentValue); } anchors { @@ -487,10 +440,7 @@ Item { itemIndex: index steamWorkshop: root.steamWorkshop onClicked: { - sidebar.setWorkshopItem(m_publishedFileID, - m_workshopPreview, - additionalPreviewUrl, - subscriptionCount) + sidebar.setWorkshopItem(m_publishedFileID, m_workshopPreview, additionalPreviewUrl, subscriptionCount); } } @@ -516,11 +466,9 @@ Item { text: qsTr("Back") enabled: root.steamWorkshop.workshopListModel.currentPage > 1 onClicked: { - root.state = "searching" - root.steamWorkshop.workshopListModel.setCurrentPage( - root.steamWorkshop.workshopListModel.currentPage - 1) - root.steamWorkshop.searchWorkshop( - SteamEnums.K_EUGCQuery_RankedByTrend) + root.state = "searching"; + root.steamWorkshop.workshopListModel.setCurrentPage(root.steamWorkshop.workshopListModel.currentPage - 1); + root.steamWorkshop.searchWorkshop(SteamEnums.K_EUGCQuery_RankedByTrend); } } @@ -528,8 +476,7 @@ Item { id: txtPage Layout.alignment: Qt.AlignVCenter - text: root.steamWorkshop.workshopListModel.currentPage + "/" - + root.steamWorkshop.workshopListModel.pages + text: root.steamWorkshop.workshopListModel.currentPage + "/" + root.steamWorkshop.workshopListModel.pages color: Material.primaryTextColor } @@ -538,14 +485,11 @@ Item { Layout.alignment: Qt.AlignVCenter text: qsTr("Forward") - enabled: root.steamWorkshop.workshopListModel.currentPage - <= root.steamWorkshop.workshopListModel.pages - 1 + enabled: root.steamWorkshop.workshopListModel.currentPage <= root.steamWorkshop.workshopListModel.pages - 1 onClicked: { - root.state = "searching" - root.steamWorkshop.workshopListModel.setCurrentPage( - root.steamWorkshop.workshopListModel.currentPage + 1) - root.steamWorkshop.searchWorkshop( - SteamEnums.K_EUGCQuery_RankedByTrend) + root.state = "searching"; + root.steamWorkshop.workshopListModel.setCurrentPage(root.steamWorkshop.workshopListModel.currentPage + 1); + root.steamWorkshop.searchWorkshop(SteamEnums.K_EUGCQuery_RankedByTrend); } } @@ -555,7 +499,7 @@ Item { } } - Behavior on contentHeight { + Behavior on contentHeight { PropertyAnimation { duration: 400 property: "contentHeight" @@ -568,16 +512,39 @@ Item { } } + component HeaderLabel: Label { + id: textObj + color: "white" + wrapMode: Text.WrapAnywhere + clip: true + + width: Math.min(100, textWidth) + readonly property alias textWidth: textMetrics.boundingRect.width + + TextMetrics { + id: textMetrics + font: textObj.font + text: textObj.text + elide: textObj.elide + } + + background: Rectangle { + opacity: .9 + color: Material.theme === Material.Light ? Material.background : "#242424" + } + padding: 10 + } + Sidebar { id: sidebar topMargin: 60 steamWorkshop: root.steamWorkshop onTagClicked: tag => { - gridView.headerItem.searchField.text = tag - root.steamWorkshop.searchWorkshopByText(tag) - sidebar.close() - } + gridView.headerItem.searchField.text = tag; + root.steamWorkshop.searchWorkshopByText(tag); + sidebar.close(); + } } states: [ diff --git a/ScreenPlayWorkshop/qml/TestMain.qml b/ScreenPlayWorkshop/qml/TestMain.qml index c5566375..d91939b2 100644 --- a/ScreenPlayWorkshop/qml/TestMain.qml +++ b/ScreenPlayWorkshop/qml/TestMain.qml @@ -11,24 +11,22 @@ Window { visible: true title: qsTr("ScreenPlayWorkshop") Component.onCompleted: { - root.Material.theme = Material.Dark + root.Material.theme = Material.Dark; } ScreenPlayWorkshop { id: screenPlayWorkshop Component.onCompleted: { if (screenPlayWorkshop.init()) { - print("init") - stackView.push( - "qrc:/qml/ScreenPlayWorkshop/qml/SteamWorkshopStartPage.qml", - { - "stackView": stackView, - "screenPlayWorkshop": screenPlayWorkshop, - "steamWorkshop": screenPlayWorkshop.steamWorkshop, - "background": background - }) + print("init"); + stackView.push("qrc:/qml/ScreenPlayWorkshop/qml/SteamWorkshopStartPage.qml", { + "stackView": stackView, + "screenPlayWorkshop": screenPlayWorkshop, + "steamWorkshop": screenPlayWorkshop.steamWorkshop, + "background": background + }); } else { - popupOffline.open() + popupOffline.open(); } } } @@ -91,9 +89,9 @@ Window { } } Rectangle { + id: nav height: 60 color: Material.background - id: nav anchors { right: parent.right left: parent.left diff --git a/ScreenPlayWorkshop/qml/Workshop.qml b/ScreenPlayWorkshop/qml/Workshop.qml index 535bf932..d590c414 100644 --- a/ScreenPlayWorkshop/qml/Workshop.qml +++ b/ScreenPlayWorkshop/qml/Workshop.qml @@ -13,12 +13,11 @@ Item { Component.onCompleted: { if (App.settings.steamVersion) { - workshopLoader.setSource( - "qrc:/qml/ScreenPlayApp/qml/Workshop/SteamWorkshop.qml", { - "modalSource": modalSource - }) + workshopLoader.setSource("qrc:/qml/ScreenPlayApp/qml/Workshop/SteamWorkshop.qml", { + "modalSource": modalSource + }); } else { - workshopLoader.setSource("qrc:/qml/ScreenPlayApp/qml/Workshop/Forum.qml") + workshopLoader.setSource("qrc:/qml/ScreenPlayApp/qml/Workshop/Forum.qml"); } } diff --git a/ScreenPlayWorkshop/qml/WorkshopItem.qml b/ScreenPlayWorkshop/qml/WorkshopItem.qml index c3baf104..8b2f1338 100644 --- a/ScreenPlayWorkshop/qml/WorkshopItem.qml +++ b/ScreenPlayWorkshop/qml/WorkshopItem.qml @@ -33,7 +33,6 @@ Item { y: 0 z: 0 } - }, Translate { id: tr @@ -62,7 +61,6 @@ Item { top: parent.top topMargin: 3 } - } Timer { @@ -114,7 +112,6 @@ Item { easing.type: Easing.OutQuint properties: "xScale,yScale" } - } Item { @@ -177,9 +174,7 @@ Item { position: 1 color: "#00000000" } - } - } Text { @@ -202,7 +197,6 @@ Item { leftMargin: 20 bottomMargin: -50 } - } Item { @@ -224,9 +218,7 @@ Item { sourceSize: Qt.size(parent.width, parent.height) fillMode: Image.PreserveAspectFit } - } - } OpacityMask { @@ -264,9 +256,7 @@ Item { top: parent.top right: parent.right } - } - } FastBlur { @@ -306,11 +296,8 @@ Item { left: parent.left leftMargin: 20 } - } - } - } states: [ @@ -337,7 +324,6 @@ Item { target: effBlur radius: 0 } - }, State { name: "downloading" @@ -367,7 +353,6 @@ Item { opacity: 1 anchors.topMargin: 0 } - }, State { name: "installed" @@ -397,7 +382,6 @@ Item { target: txtDownloading text: qsTr("Download complete!") } - } ] transitions: [ @@ -423,7 +407,6 @@ Item { duration: 100 properties: "opacity" } - }, Transition { from: "*" @@ -454,9 +437,7 @@ Item { duration: 200 properties: "opacity, anchors.topMargin" } - } - } ] } diff --git a/ScreenPlayWorkshop/qml/upload/PopupSteamWorkshopAgreement.qml b/ScreenPlayWorkshop/qml/upload/PopupSteamWorkshopAgreement.qml index a49ba648..0186a220 100644 --- a/ScreenPlayWorkshop/qml/upload/PopupSteamWorkshopAgreement.qml +++ b/ScreenPlayWorkshop/qml/upload/PopupSteamWorkshopAgreement.qml @@ -13,7 +13,6 @@ Popup { closePolicy: Popup.NoAutoClose anchors.centerIn: Overlay.overlay - ColumnLayout { anchors { fill: parent @@ -59,13 +58,10 @@ Popup { root.close(); } } - } - } background: Rectangle { color: Material.theme === Material.Light ? "white" : Material.background } - } diff --git a/ScreenPlayWorkshop/qml/upload/UploadProject.qml b/ScreenPlayWorkshop/qml/upload/UploadProject.qml index 42632cc7..97f37d72 100644 --- a/ScreenPlayWorkshop/qml/upload/UploadProject.qml +++ b/ScreenPlayWorkshop/qml/upload/UploadProject.qml @@ -90,11 +90,11 @@ Item { 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; } } @@ -109,7 +109,7 @@ Item { text: qsTr("Abort") onClicked: { - root.requestBack() + root.requestBack(); } anchors { @@ -126,14 +126,13 @@ Item { 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 - root.steamWorkshop.bulkUploadToWorkshop(uploadListArray) + view.currentIndex = 1; + root.steamWorkshop.bulkUploadToWorkshop(uploadListArray); } anchors { @@ -185,7 +184,7 @@ Item { highlighted: true enabled: false onClicked: { - root.requestBack() + root.requestBack(); } anchors { @@ -196,7 +195,7 @@ Item { Connections { function onUploadCompleted() { - btnFinish.enabled = true + btnFinish.enabled = true; } target: root.steamWorkshop.uploadListModel @@ -204,5 +203,4 @@ Item { } } } - } diff --git a/ScreenPlayWorkshop/qml/upload/UploadProjectBigItem.qml b/ScreenPlayWorkshop/qml/upload/UploadProjectBigItem.qml index 90d4cbd0..b4f05749 100644 --- a/ScreenPlayWorkshop/qml/upload/UploadProjectBigItem.qml +++ b/ScreenPlayWorkshop/qml/upload/UploadProjectBigItem.qml @@ -44,7 +44,6 @@ Item { layer.effect: ElevationEffect { elevation: 6 } - } Item { @@ -71,7 +70,6 @@ Item { left: parent.left bottom: parent.bottom } - } Image { @@ -86,7 +84,6 @@ Item { left: parent.left margins: 10 } - } ColumnLayout { @@ -111,7 +108,6 @@ Item { text: qsTr("Type: ") + m_type color: Material.foreground } - } Button { @@ -123,7 +119,6 @@ Item { bottom: parent.bottom margins: 20 } - } Text { @@ -135,7 +130,6 @@ Item { font.pointSize: 18 opacity: 0 } - } CheckBox { @@ -154,9 +148,7 @@ Item { right: parent.right margins: 10 } - } - } states: [ @@ -173,7 +165,6 @@ Item { target: icnType opacity: 0.5 } - }, State { name: "invalid" @@ -187,7 +178,6 @@ Item { target: txtInvalidError opacity: 1 } - } ] transitions: [ @@ -200,7 +190,6 @@ Item { target: txtInvalidError duration: 250 } - } ] } diff --git a/ScreenPlayWorkshop/qml/upload/UploadProjectItem.qml b/ScreenPlayWorkshop/qml/upload/UploadProjectItem.qml index f3a79fe2..29d66446 100644 --- a/ScreenPlayWorkshop/qml/upload/UploadProjectItem.qml +++ b/ScreenPlayWorkshop/qml/upload/UploadProjectItem.qml @@ -8,7 +8,6 @@ import ScreenPlayWorkshop import WorkshopEnums Page { - id: root property string previewImagePath @@ -27,10 +26,10 @@ Page { switch (steamStatus) { case SteamEnums.K_EResultNone: root.contentItem.state = "uploadComplete"; - return ; + return; case SteamEnums.K_EResultOK: root.contentItem.state = "uploadComplete"; - return ; + return; case SteamEnums.K_EResultFail: errorText = qsTr("Fail"); break; @@ -387,7 +386,6 @@ Page { layer.effect: ElevationEffect { elevation: 6 } - } contentItem: Item { @@ -429,11 +427,8 @@ Page { position: 1 color: "#00000000" } - } - } - } ColumnLayout { @@ -498,9 +493,7 @@ Page { value: root.progress to: 100 } - } - } states: [ @@ -509,7 +502,6 @@ Page { PropertyChanges { } - }, State { name: "uploadComplete" @@ -533,7 +525,6 @@ Page { target: gradientStop1 color: Material.color(Material.LightGreen) } - }, State { name: "error" @@ -552,7 +543,6 @@ Page { target: gradientStop1 color: Material.color(Material.DeepOrange) } - } ] transitions: [ @@ -564,9 +554,7 @@ Page { targets: [gradient, gradientStop0, gradientStop1] duration: 500 } - } ] } - }