mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-22 22:36:00 +00:00
fix(ui): enable launches like play and say why they are disabled
This commit is contained in:
1 parent
c6332f88db
commit
18985c581c
2 files changed
+19
-5
No files matched your search
@@ -223,7 +223,8 @@ private fun Content(
|
|||||||
if (e.installed) {
|
if (e.installed) {
|
||||||
Rise(3) {
|
Rise(3) {
|
||||||
Actions {
|
Actions {
|
||||||
PrimaryButton("Open ${e.name}", enabled = s.ready && !s.busy, main = true) { a.onEmulator(e) }
|
PrimaryButton("Open ${e.name}", enabled = !s.busy, main = true) { a.onEmulator(e) }
|
||||||
|
BusyChip(s)
|
||||||
SecondaryButton("ROMs folder", onClick = a.onRoms)
|
SecondaryButton("ROMs folder", onClick = a.onRoms)
|
||||||
if (pkg != null) SecondaryButton(
|
if (pkg != null) SecondaryButton(
|
||||||
if (pkg.kind == "appimage") "Remove" else "Forget",
|
if (pkg.kind == "appimage") "Remove" else "Forget",
|
||||||
@@ -296,8 +297,8 @@ private fun Content(
|
|||||||
Spacer(Modifier.height(14.dp))
|
Spacer(Modifier.height(14.dp))
|
||||||
Actions {
|
Actions {
|
||||||
Image(painterResource(e.iconRes), null, modifier = Modifier.size(40.dp))
|
Image(painterResource(e.iconRes), null, modifier = Modifier.size(40.dp))
|
||||||
PrimaryButton("Launch in ${e.name}", enabled = s.ready && !s.busy, main = true) { a.onRom(g) }
|
PrimaryButton("Launch in ${e.name}", enabled = !s.busy, main = true) { a.onRom(g) }
|
||||||
ActionChip(g.hostPath.extension.uppercase().ifEmpty { "folder" }, ok = false)
|
if (s.busy) BusyChip(s) else ActionChip(g.hostPath.extension.uppercase().ifEmpty { "folder" }, ok = false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (g.art != null && !narrow) Poster(g.art, g.name, Modifier.width(detailPosterWidth))
|
if (g.art != null && !narrow) Poster(g.art, g.name, Modifier.width(detailPosterWidth))
|
||||||
@@ -331,6 +332,7 @@ private fun DesktopCard(s: FrontEndState, a: FrontEndActions) {
|
|||||||
// Enabled without a runtime or the desktop: the session's loading screen installs them first.
|
// Enabled without a runtime or the desktop: the session's loading screen installs them first.
|
||||||
PrimaryButton(if (s.desktopInstalled) "Open desktop" else "Install & open desktop", enabled = !s.busy, main = true, onClick = a.onDesktop)
|
PrimaryButton(if (s.desktopInstalled) "Open desktop" else "Install & open desktop", enabled = !s.busy, main = true, onClick = a.onDesktop)
|
||||||
Cog(onClick = a.onDesktopSettings)
|
Cog(onClick = a.onDesktopSettings)
|
||||||
|
BusyChip(s)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Column(
|
Column(
|
||||||
|
|||||||
@@ -71,7 +71,10 @@ internal fun GamesPage(s: FrontEndState, a: FrontEndActions, selected: String, o
|
|||||||
Row(verticalAlignment = Alignment.Bottom) {
|
Row(verticalAlignment = Alignment.Bottom) {
|
||||||
GameHero(current, Modifier.weight(1f).heightIn(min = if (narrow) 190.dp else 250.dp)) {
|
GameHero(current, Modifier.weight(1f).heightIn(min = if (narrow) 190.dp else 250.dp)) {
|
||||||
GameHeroCopy(current, if (narrow) 28.sp else 38.sp)
|
GameHeroCopy(current, if (narrow) 28.sp else 38.sp)
|
||||||
PrimaryButton("Launch", enabled = s.ready && !s.busy, main = true, icon = Icons.Filled.PlayArrow) { a.onSteamGame(current) }
|
Actions {
|
||||||
|
PrimaryButton("Launch", enabled = !s.busy, main = true, icon = Icons.Filled.PlayArrow) { a.onSteamGame(current) }
|
||||||
|
BusyChip(s)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!narrow) Poster(current.art, current.name, Modifier.width(168.dp))
|
if (!narrow) Poster(current.art, current.name, Modifier.width(168.dp))
|
||||||
}
|
}
|
||||||
@@ -92,7 +95,10 @@ internal fun GamesPage(s: FrontEndState, a: FrontEndActions, selected: String, o
|
|||||||
) {
|
) {
|
||||||
GameHero(current, Modifier.fillMaxWidth().heightIn(min = if (narrow) 170.dp else 200.dp)) {
|
GameHero(current, Modifier.fillMaxWidth().heightIn(min = if (narrow) 170.dp else 200.dp)) {
|
||||||
GameHeroCopy(current, if (narrow) 24.sp else 32.sp)
|
GameHeroCopy(current, if (narrow) 24.sp else 32.sp)
|
||||||
PrimaryButton("Launch", enabled = s.ready && !s.busy, main = true, icon = Icons.Filled.PlayArrow) { a.onSteamGame(current) }
|
Actions {
|
||||||
|
PrimaryButton("Launch", enabled = !s.busy, main = true, icon = Icons.Filled.PlayArrow) { a.onSteamGame(current) }
|
||||||
|
BusyChip(s)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
SectionTitle("Launch settings", null)
|
SectionTitle("Launch settings", null)
|
||||||
LaunchSettings(s, a, host)
|
LaunchSettings(s, a, host)
|
||||||
@@ -183,6 +189,12 @@ internal fun PageHeader(title: String, trailing: @Composable RowScope.() -> Unit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Why a launch button is greyed out: the runtime is being worked on. Nothing when it is not. */
|
||||||
|
@Composable
|
||||||
|
internal fun BusyChip(s: FrontEndState) {
|
||||||
|
if (s.busy) ActionChip(if (s.percent >= 0) "Runtime busy · ${s.percent}%" else "Runtime busy", ok = false)
|
||||||
|
}
|
||||||
|
|
||||||
/** Whether Steam can start, said where Play is rather than only in Setup. */
|
/** Whether Steam can start, said where Play is rather than only in Setup. */
|
||||||
@Composable
|
@Composable
|
||||||
internal fun RuntimeChip(s: FrontEndState) = when {
|
internal fun RuntimeChip(s: FrontEndState) = when {
|
||||||
|
|||||||
Reference in new issue
Block a user