mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-28 22:53: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()
|
||||
break
|
||||
case GamingShell.GamepadManager.ButtonA:
|
||||
if (grid.activeFocus && grid.currentItem) {
|
||||
if (runningGames.activeFocus) {
|
||||
runningGames.activateCurrent()
|
||||
} else if (grid.activeFocus && grid.currentItem) {
|
||||
root.launchGame(grid.currentIndex)
|
||||
}
|
||||
break
|
||||
case GamingShell.GamepadManager.ButtonX:
|
||||
if (runningGames.activeFocus) {
|
||||
runningGames.closeCurrent()
|
||||
}
|
||||
break
|
||||
case GamingShell.GamepadManager.ButtonB:
|
||||
root.dismissRequested()
|
||||
break
|
||||
|
|
@ -388,6 +395,19 @@ Window {
|
|||
highlightMoveDuration: 0
|
||||
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: {
|
||||
if (activeFocus && count > 0 && currentIndex < 0) {
|
||||
currentIndex = 0
|
||||
|
|
@ -567,7 +587,9 @@ Window {
|
|||
|
||||
// Gamepad legend
|
||||
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
|
||||
opacity: 0.5
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,6 +29,19 @@ Item {
|
|||
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.ActivityInfo { id: actInfo }
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue