diff --git a/CHANGELOG.md b/CHANGELOG.md index 82c4d1e..f44f337 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,11 @@ ### Removed ### Fixed +- Fix edit dialog for base instance + - Disable name field + - Fix title showing `` +- Translate edit dialog +- Fix checkbox area not toggling properly ### Security @@ -87,4 +92,4 @@ - Add proper `CHANGELOG.md` ### Fixed -- Fix installer not including Rust binaries \ No newline at end of file +- Fix installer not including Rust binaries diff --git a/build.gradle.kts b/build.gradle.kts index 709af9f..49a05af 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -14,7 +14,7 @@ plugins { } group = "dev.nycode" -version = "0.5.0" +version = "0.5.1" repositories { google() diff --git a/src/main/kotlin/localization/Strings.kt b/src/main/kotlin/localization/Strings.kt index 6094b71..50cbac9 100644 --- a/src/main/kotlin/localization/Strings.kt +++ b/src/main/kotlin/localization/Strings.kt @@ -82,5 +82,8 @@ data class Strings( val waitingForChanges: String, val iAmDone: String, val mergingSteamManifest: (name: String) -> String, - val reLinkingInstances: String + val reLinkingInstances: String, + val save: String, + val editInstanceTitle: (name: String) -> String, + val editBaseInstance: String ) diff --git a/src/main/kotlin/localization/StringsDe.kt b/src/main/kotlin/localization/StringsDe.kt index e893de9..6f94aa9 100644 --- a/src/main/kotlin/localization/StringsDe.kt +++ b/src/main/kotlin/localization/StringsDe.kt @@ -100,5 +100,8 @@ val StringsDe = Strings( mergingSteamManifest = { name -> "Steam Manifest von $name wird neu-zusammengefasst" }, preparingReSynchronisation = "Neu-Synchronisation wird vorbereitet", reLinkingInstances = "Instanzen werden neu gelinkt", - waitingForChanges = "Es wird auf Ă„nderungen gewartet" + waitingForChanges = "Es wird auf Ă„nderungen gewartet", + save = "Speichern", + editInstanceTitle = { name -> "Instanz $name bearbeiten" }, + editBaseInstance = "Basis-Instanz bearbeiten" ) diff --git a/src/main/kotlin/localization/StringsEn.kt b/src/main/kotlin/localization/StringsEn.kt index 69b0633..fb365f7 100644 --- a/src/main/kotlin/localization/StringsEn.kt +++ b/src/main/kotlin/localization/StringsEn.kt @@ -99,5 +99,8 @@ val StringsEn = Strings( mergingSteamManifest = { name -> "Merging Steam manifest of $name" }, preparingReSynchronisation = "Preparing re-synchronisation", reLinkingInstances = "Relinking instances", - waitingForChanges = "Waiting for changes" + waitingForChanges = "Waiting for changes", + save = "Save", + editInstanceTitle = { name -> "Edit instance $name" }, + editBaseInstance = "Edit base-instance" ) diff --git a/src/main/kotlin/ui/instance/context/modification/InstanceCreationDialog.kt b/src/main/kotlin/ui/instance/context/modification/InstanceCreationDialog.kt index 03659a2..31df82f 100644 --- a/src/main/kotlin/ui/instance/context/modification/InstanceCreationDialog.kt +++ b/src/main/kotlin/ui/instance/context/modification/InstanceCreationDialog.kt @@ -26,10 +26,11 @@ fun InstanceCreationDialog( strings.createInstance, strings.createANewInstance, mainInstance, - false, - { isValid() }, - { Text(strings.createInstance) }, - onCloseRequest, - createInstance + disableFolderInput = false, + disableNameInput = false, + isValid = { isValid() }, + saveButtonLabel = { Text(strings.createInstance) }, + onCloseRequest = onCloseRequest, + onUpdate = createInstance ) } diff --git a/src/main/kotlin/ui/instance/context/modification/InstanceEditDialog.kt b/src/main/kotlin/ui/instance/context/modification/InstanceEditDialog.kt index 7d1ef6e..520854d 100644 --- a/src/main/kotlin/ui/instance/context/modification/InstanceEditDialog.kt +++ b/src/main/kotlin/ui/instance/context/modification/InstanceEditDialog.kt @@ -2,6 +2,7 @@ package dev.nycode.omsilauncher.ui.instance.context.modification import androidx.compose.material.Text import androidx.compose.runtime.Composable +import cafe.adriel.lyricist.LocalStrings import dev.nycode.omsilauncher.instance.Instance @Composable @@ -10,14 +11,21 @@ fun InstanceEditDialog( onCloseRequest: () -> Unit, saveInstance: (InstanceModificationState) -> Unit, ) { + val strings = LocalStrings.current + val title = if (instance.isBaseInstance) { + strings.editBaseInstance + } else { + strings.editInstanceTitle(instance.name) + } InstanceDialog( - "Instanz ${instance.name} bearbeiten", - "Instanz ${instance.name} bearbeiten", + title, + title, instance, true, + instance.isBaseInstance, onCloseRequest = onCloseRequest, saveButtonLabel = { - Text("Speichern") + Text(strings.save) }, onUpdate = saveInstance ) diff --git a/src/main/kotlin/ui/instance/context/modification/InstanceModificationDialog.kt b/src/main/kotlin/ui/instance/context/modification/InstanceModificationDialog.kt index d466cd9..ce8eb9a 100644 --- a/src/main/kotlin/ui/instance/context/modification/InstanceModificationDialog.kt +++ b/src/main/kotlin/ui/instance/context/modification/InstanceModificationDialog.kt @@ -46,6 +46,7 @@ fun InstanceDialog( formTitle: String, parentInstance: Instance, disableFolderInput: Boolean = false, + disableNameInput: Boolean = false, isValid: InstanceModificationState.() -> Boolean = { true }, saveButtonLabel: @Composable () -> Unit, onCloseRequest: () -> Unit, @@ -59,7 +60,7 @@ fun InstanceDialog( state = dialogState ) { Box(modifier = Modifier.padding(16.dp).fillMaxSize()) { - InstanceForm(formTitle, instanceModificationState, disableFolderInput) + InstanceForm(formTitle, instanceModificationState, disableFolderInput, disableNameInput) Button({ onCloseRequest() onUpdate(instanceModificationState) @@ -74,7 +75,8 @@ fun InstanceDialog( private fun InstanceForm( title: String, instanceModificationState: InstanceModificationState, - disableFolderInput: Boolean = false + disableFolderInput: Boolean = false, + disableNameInput: Boolean = false ) = with(instanceModificationState) { val strings = LocalStrings.current Column(modifier = Modifier.fillMaxWidth()) { @@ -108,7 +110,8 @@ private fun InstanceForm( label = { Text(strings.instanceName) }, - singleLine = true + singleLine = true, + enabled = !disableNameInput ) } Spacer(modifier = Modifier.height(8.dp)) @@ -204,7 +207,7 @@ private fun CheckboxRow( value: Boolean, onValueChange: (Boolean) -> Unit, ) { - val pressIndicator = Modifier.pointerInput(Unit) { + val pressIndicator = Modifier.pointerInput(value) { detectTapGestures(onPress = { onValueChange(!value) })