From 25ba50fbc8446b602ddfab1edf7869a0e964ae5d Mon Sep 17 00:00:00 2001 From: rbertocases Date: Sun, 10 Apr 2022 16:38:36 -0700 Subject: [PATCH 1/5] fixed spacing of control buttons for 4x3 screens --- layer_help/ControllerHelp.qml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/layer_help/ControllerHelp.qml b/layer_help/ControllerHelp.qml index 6e1dfe9..fd46faf 100644 --- a/layer_help/ControllerHelp.qml +++ b/layer_help/ControllerHelp.qml @@ -61,9 +61,8 @@ FocusScope { anchors { verticalCenter: parent.verticalCenter right: parent.right - rightMargin: vpx(25) } - spacing: vpx(15) + spacing: vpx(25) layoutDirection: Qt.RightToLeft ControllerHelpButton { @@ -71,7 +70,8 @@ FocusScope { button: processButtonArt(api.keys.accept) label: 'OK' Layout.fillWidth: true - Layout.minimumWidth: vpx(65) + Layout.minimumWidth: vpx(50) + Layout.preferredWidth: vpx(60) //onClicked: {console.log("OK Clicked!")} @@ -82,7 +82,8 @@ FocusScope { button: processButtonArt(api.keys.cancel) label: 'Back' Layout.fillWidth: true - Layout.minimumWidth: vpx(75) + Layout.minimumWidth: vpx(50) + Layout.preferredWidth: vpx(75) onClicked: { showHomeScreen(); } @@ -94,7 +95,8 @@ FocusScope { button: processButtonArt(api.keys.nextPage) label: 'Next Collection' Layout.fillWidth: true - Layout.minimumWidth: vpx(185) + Layout.minimumWidth: vpx(175) + Layout.preferredWidth: widescreen ? vpx(175) : vpx(212) onClicked: { turnOnSfx.play(); @@ -114,7 +116,8 @@ FocusScope { button: processButtonArt(api.keys.prevPage) label: 'Prev Collection' Layout.fillWidth: true - Layout.minimumWidth: vpx(170) + Layout.minimumWidth: vpx(130) + Layout.preferredWidth: vpx(175) onClicked: { turnOffSfx.play(); From 2fac66a74785114edfffec81ca9f8d17d00481a8 Mon Sep 17 00:00:00 2001 From: rbertocases Date: Sun, 10 Apr 2022 16:41:42 -0700 Subject: [PATCH 2/5] changed non-wide column number from 3 to 5 --- layer_grid/SoftwareScreen.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layer_grid/SoftwareScreen.qml b/layer_grid/SoftwareScreen.qml index ee3926b..5278504 100644 --- a/layer_grid/SoftwareScreen.qml +++ b/layer_grid/SoftwareScreen.qml @@ -9,7 +9,7 @@ import "qrc:/qmlutils" as PegasusUtils FocusScope { - property int numcolumns: widescreen ? 6 : 3 + property int numcolumns: widescreen ? 6 : 5 property int idx: 0 // "By Time Last Played" "By Title" "By Total Play Time" property var sortTitle: { From 3d0d623f0d422fe0b827e294dfeef21ce3469e8c Mon Sep 17 00:00:00 2001 From: rbertocases Date: Sat, 30 Apr 2022 22:08:55 -0700 Subject: [PATCH 3/5] removed collection controls from homescreen --- layer_grid/SoftwareScreen.qml | 23 ++++++++++++++++++++++- layer_help/ControllerHelp.qml | 11 +++-------- theme.qml | 31 +++++-------------------------- 3 files changed, 30 insertions(+), 35 deletions(-) diff --git a/layer_grid/SoftwareScreen.qml b/layer_grid/SoftwareScreen.qml index 5278504..7ba0bd8 100644 --- a/layer_grid/SoftwareScreen.qml +++ b/layer_grid/SoftwareScreen.qml @@ -65,7 +65,28 @@ FocusScope cycleSort(); return; } - } + // Cycle collection forward + if (api.keys.isNextPage(event) && !event.isAutoRepeat) { + event.accepted = true; + turnOnSfx.play(); + if (currentCollection < api.collections.count-1) { + nextCollection++; + } else { + nextCollection = -1; + } + } + + // Cycle collection back + if (api.keys.isPrevPage(event) && !event.isAutoRepeat) { + event.accepted = true; + turnOffSfx.play(); + if (currentCollection == -1) { + nextCollection = api.collections.count-1; + } else{ + nextCollection--; + } + } + } SequentialAnimation { id: na diff --git a/layer_help/ControllerHelp.qml b/layer_help/ControllerHelp.qml index fd46faf..1fe18aa 100644 --- a/layer_help/ControllerHelp.qml +++ b/layer_help/ControllerHelp.qml @@ -6,14 +6,9 @@ import "../utils.js" as Utils FocusScope { id: root property bool showBack: true - property bool showCollControls: true + property bool showCollControls: false property var gameData: softwareList[sortByIndex].currentGame(currentScreenID) - property string collectionShortName: { - if (currentCollection == -1) - Utils.processPlatformName(currentGame.collections.get(0).shortName) - else - Utils.processPlatformName(api.collections.get(currentCollection).shortName) - } + property string collectionShortName: Utils.processPlatformName(currentGame.collections.get(0).shortName) function processButtonArt(buttonModel) { var i; @@ -39,7 +34,7 @@ FocusScope { height: vpx(70) horizontalAlignment: Image.AlignLeft fillMode: Image.PreserveAspectFit - source: "../assets/images/controllers/" + collectionShortName + ".svg" + source: collectionShortName ? "../assets/images/controllers/" + collectionShortName + ".svg" : "../assets/images/controllers/switch.svg" visible: false anchors { diff --git a/theme.qml b/theme.qml index 03f7e7a..98b0bba 100644 --- a/theme.qml +++ b/theme.qml @@ -83,6 +83,7 @@ FocusScope function showHomeScreen() { homeScreen.focus = true; + currentCollection = -1 homeSfx.play() } @@ -253,7 +254,7 @@ FocusScope //starting collection is set here Component.onCompleted: { state: "homescreen" - currentCollection = api.memory.has('Last Collection') ? api.memory.get('Last Collection') : -1 + currentCollection = -1 api.memory.unset('Last Collection'); homeSfx.play() } @@ -272,35 +273,13 @@ FocusScope } // List specific input - Keys.onPressed: { + /*Keys.onPressed: { // disabled /*if (api.keys.isFilters(event) && !event.isAutoRepeat) { event.accepted = true; toggleDarkMode(); - }*/ - - // Cycle collection forward - if (api.keys.isNextPage(event) && !event.isAutoRepeat) { - event.accepted = true; - turnOnSfx.play(); - if (currentCollection < api.collections.count-1) { - nextCollection++; - } else { - nextCollection = -1; - } } - - // Cycle collection back - if (api.keys.isPrevPage(event) && !event.isAutoRepeat) { - event.accepted = true; - turnOffSfx.play(); - if (currentCollection == -1) { - nextCollection = api.collections.count-1; - } else{ - nextCollection--; - } - } - } + }*/ SettingsScreen { id: settingsScreen @@ -371,7 +350,7 @@ FocusScope bottom: parent.bottom; } showBack: !homeScreen.focus - showCollControls: !settingsScreen.focus + showCollControls: softwareScreen.focus } } From c6d5948c52956c9fc25ca037d784b8186809e90c Mon Sep 17 00:00:00 2001 From: rbertocases Date: Sun, 15 May 2022 20:02:41 -0700 Subject: [PATCH 4/5] Added ability to play background music --- layer_settings/SettingsScreen.qml | 7 +++ resources/Music.qml | 81 +++++++++++++++++++++++++++++++ theme.qml | 8 ++- 3 files changed, 94 insertions(+), 2 deletions(-) create mode 100644 resources/Music.qml diff --git a/layer_settings/SettingsScreen.qml b/layer_settings/SettingsScreen.qml index c76e9dc..981b620 100644 --- a/layer_settings/SettingsScreen.qml +++ b/layer_settings/SettingsScreen.qml @@ -14,11 +14,18 @@ id: root setting: "Screenshot,Fanart" } + ListElement { + settingName: "Background Music" + settingSubtitle: "(Requires Reload)" + setting: "No,Yes" + } + ListElement { settingName: "Word Wrap on Titles" settingSubtitle: "(Requires Reload)" setting: "Yes,No" } + } diff --git a/resources/Music.qml b/resources/Music.qml new file mode 100644 index 0000000..d96b346 --- /dev/null +++ b/resources/Music.qml @@ -0,0 +1,81 @@ +import QtQuick 2.15 +import QtMultimedia 5.9 + + +Item { + Playlist { + id: bgPlaylist; + + playbackMode: Playlist.Loop; + + // add music files into assets/audio/music + // uncomment PlaylistItem below and repeat for each music file + PlaylistItem { source: '../assets/audio/music/whatever.mp3'; } + } + + function loud() { + bgMusic.volume = 0.3; + } + + function quiet() { + bgMusic.volume = 0.05; + } + + property bool isPlaying: { + return bgMusic.playbackState === Audio.PlayingState; + } + + Component.onCompleted: { + bgMusicTimer.start(); + + if (playBGM) { + bgPlaylist.shuffle(); + bgMusic.play(); + } else { + bgMusic.stop(); + } + } + + Connections { + target: Qt.application; + function onStateChanged() { + if (playBGM === false) { + console.log('playBGM was false') + return; + } + if (Qt.application.state === Qt.ApplicationActive) { + if (!isPlaying) bgMusic.play(); + } else { + if (isPlaying) bgMusic.pause(); + } + } + } + + Audio { + id: bgMusic; + + volume: 0.3; + playlist: bgPlaylist; + + Behavior on volume { + NumberAnimation { + duration: 250; + easing.type: Easing.InOutQuad; + } + } + } + + Timer { + id: bgMusicTimer; + + interval: 300; + repeat: false; + onTriggered: { + if (bgPlaylist.itemCount > 0 && playBGM) { + console.log('triggered') + bgPlaylist.shuffle(); + bgMusic.play(); + } + } + } +} diff --git a/theme.qml b/theme.qml index 98b0bba..02853c1 100644 --- a/theme.qml +++ b/theme.qml @@ -12,6 +12,7 @@ import "layer_grid" import "layer_settings" import "layer_help" import "Lists" +import "resources" as Resources FocusScope { @@ -24,7 +25,8 @@ FocusScope timeFormat: api.memory.has("Time Format") ? api.memory.get("Time Format") : "12hr", wordWrap: api.memory.has("Word Wrap on Titles") ? api.memory.get("Word Wrap on Titles") : "Yes", batteryPercentSetting: api.memory.has("Display Battery Percentage") ? api.memory.get("Display Battery Percentage") : "No", - enableDropShadows: api.memory.has("Enable DropShadows") ? api.memory.get("Enable DropShadows") : "Yes" + enableDropShadows: api.memory.has("Enable DropShadows") ? api.memory.get("Enable DropShadows") : "Yes", + playBGM: api.memory.has("Background Music") ? api.memory.get("Background Music"): "No" } } @@ -36,6 +38,7 @@ FocusScope ListMostPlayed { id: listByMostPlayed} ListPublisher { id: listByPublisher} ListAllGames { id: listByTitle} + Resources.Music { id: music} property int currentCollection: api.memory.has('Last Collection') ? api.memory.get('Last Collection') : -1 property int nextCollection: api.memory.has('Last Collection') ? api.memory.get('Last Collection') : -1 @@ -45,7 +48,8 @@ FocusScope property string searchtext property bool wordWrap: (settings.wordWrap === "Yes") ? true : false; property bool showPercent: (settings.batteryPercentSetting === "Yes") ? true : false; - property bool enableDropShadows: (settings.enableDropShadows === "Yes") ? true: false; + property bool enableDropShadows: (settings.enableDropShadows === "Yes") ? true: false; + property bool playBGM: (settings.playBGM === "Yes") ? true : false; onNextCollectionChanged: { changeCollection() } From e23cde4d31c800853fa6e15441b4e484e485c8b7 Mon Sep 17 00:00:00 2001 From: rbertocases Date: Sun, 15 May 2022 20:52:50 -0700 Subject: [PATCH 5/5] Commented out PlaylistItem --- resources/Music.qml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/resources/Music.qml b/resources/Music.qml index d96b346..9ac8bff 100644 --- a/resources/Music.qml +++ b/resources/Music.qml @@ -1,7 +1,6 @@ import QtQuick 2.15 import QtMultimedia 5.9 - Item { Playlist { id: bgPlaylist; @@ -10,7 +9,7 @@ Item { // add music files into assets/audio/music // uncomment PlaylistItem below and repeat for each music file - PlaylistItem { source: '../assets/audio/music/whatever.mp3'; } + //PlaylistItem { source: '../assets/audio/music/whatever.mp3'; } } function loud() {