Skip to content

Commit

Permalink
Merge pull request #28 from RBertoCases/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
RBertoCases authored May 16, 2022
2 parents 36fb3ca + e23cde4 commit 6f655bc
Show file tree
Hide file tree
Showing 5 changed files with 123 additions and 37 deletions.
23 changes: 22 additions & 1 deletion layer_grid/SoftwareScreen.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 3 additions & 8 deletions layer_help/ControllerHelp.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 {
Expand Down
7 changes: 7 additions & 0 deletions layer_settings/SettingsScreen.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}


}

Expand Down
80 changes: 80 additions & 0 deletions resources/Music.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
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();
}
}
}
}
39 changes: 11 additions & 28 deletions theme.qml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import "layer_grid"
import "layer_settings"
import "layer_help"
import "Lists"
import "resources" as Resources

FocusScope
{
Expand All @@ -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"
}
}

Expand All @@ -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
Expand All @@ -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() }

Expand Down Expand Up @@ -83,6 +87,7 @@ FocusScope
function showHomeScreen()
{
homeScreen.focus = true;
currentCollection = -1
homeSfx.play()
}

Expand Down Expand Up @@ -253,7 +258,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()
}
Expand All @@ -272,35 +277,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
Expand Down Expand Up @@ -371,7 +354,7 @@ FocusScope
bottom: parent.bottom;
}
showBack: !homeScreen.focus
showCollControls: !settingsScreen.focus
showCollControls: softwareScreen.focus
}

}
Expand Down

0 comments on commit 6f655bc

Please sign in to comment.