mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-29 15:03:09 +00:00
Add empty state, gamepad task controls, and X: Close
Show a PlaceholderMessage in the grid when no games are found, with context-aware text for empty library vs no search results. Map gamepad A to activate and X to close in RunningGamesView. Update the legend bar to show X: Close when running tasks are visible.
This commit is contained in:
parent
daa8fc7d8a
commit
4a9a5b2a97
2 changed files with 37 additions and 2 deletions
|
|
@ -100,10 +100,17 @@ Window {
|
||||||
if (grid.activeFocus) grid.moveCurrentIndexRight()
|
if (grid.activeFocus) grid.moveCurrentIndexRight()
|
||||||
break
|
break
|
||||||
case GamingShell.GamepadManager.ButtonA:
|
case GamingShell.GamepadManager.ButtonA:
|
||||||
if (grid.activeFocus && grid.currentItem) {
|
if (runningGames.activeFocus) {
|
||||||
|
runningGames.activateCurrent()
|
||||||
|
} else if (grid.activeFocus && grid.currentItem) {
|
||||||
root.launchGame(grid.currentIndex)
|
root.launchGame(grid.currentIndex)
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
|
case GamingShell.GamepadManager.ButtonX:
|
||||||
|
if (runningGames.activeFocus) {
|
||||||
|
runningGames.closeCurrent()
|
||||||
|
}
|
||||||
|
break
|
||||||
case GamingShell.GamepadManager.ButtonB:
|
case GamingShell.GamepadManager.ButtonB:
|
||||||
root.dismissRequested()
|
root.dismissRequested()
|
||||||
break
|
break
|
||||||
|
|
@ -388,6 +395,19 @@ Window {
|
||||||
highlightMoveDuration: 0
|
highlightMoveDuration: 0
|
||||||
highlight: null
|
highlight: null
|
||||||
|
|
||||||
|
Kirigami.PlaceholderMessage {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
width: parent.width - Kirigami.Units.gridUnit * 4
|
||||||
|
visible: grid.count === 0 && !GamingShell.GameLauncherProvider.loading
|
||||||
|
icon.name: "games-none"
|
||||||
|
text: searchField.text.length > 0
|
||||||
|
? i18n("No games match your search")
|
||||||
|
: i18n("No games found")
|
||||||
|
explanation: searchField.text.length > 0
|
||||||
|
? ""
|
||||||
|
: i18n("Install games or check that they have the Game category in their .desktop file")
|
||||||
|
}
|
||||||
|
|
||||||
onActiveFocusChanged: {
|
onActiveFocusChanged: {
|
||||||
if (activeFocus && count > 0 && currentIndex < 0) {
|
if (activeFocus && count > 0 && currentIndex < 0) {
|
||||||
currentIndex = 0
|
currentIndex = 0
|
||||||
|
|
@ -567,7 +587,9 @@ Window {
|
||||||
|
|
||||||
// Gamepad legend
|
// Gamepad legend
|
||||||
PC3.Label {
|
PC3.Label {
|
||||||
text: i18n("A: Select B: Back Y: Exit LB/RB: Filter ☰: Search")
|
text: runningGames.hasTasks
|
||||||
|
? i18n("A: Select X: Close B: Back Y: Exit LB/RB: Filter ☰: Search")
|
||||||
|
: i18n("A: Select B: Back Y: Exit LB/RB: Filter ☰: Search")
|
||||||
font.pointSize: Kirigami.Theme.defaultFont.pointSize * 0.75
|
font.pointSize: Kirigami.Theme.defaultFont.pointSize * 0.75
|
||||||
opacity: 0.5
|
opacity: 0.5
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,19 @@ Item {
|
||||||
taskList.forceActiveFocus()
|
taskList.forceActiveFocus()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function activateCurrent() {
|
||||||
|
if (taskList.currentItem) {
|
||||||
|
taskList.currentItem.activate()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function closeCurrent() {
|
||||||
|
if (taskList.currentItem) {
|
||||||
|
var idx = taskList.currentIndex
|
||||||
|
tasks.requestClose(tasks.makeModelIndex(idx))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
TaskManager.VirtualDesktopInfo { id: vdInfo }
|
TaskManager.VirtualDesktopInfo { id: vdInfo }
|
||||||
TaskManager.ActivityInfo { id: actInfo }
|
TaskManager.ActivityInfo { id: actInfo }
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue