Skip to content
This repository has been archived by the owner on Jul 21, 2023. It is now read-only.

Commit

Permalink
Fix edit dialog for base instance (#43)
Browse files Browse the repository at this point in the history
* Fix edit dialog for base instance
- Translate edit dialog

* Fix checkbox area not toggling properly

* Bump version
  • Loading branch information
DRSchlaubi authored May 30, 2022
1 parent 1015e45 commit 29d6309
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 17 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
### Removed

### Fixed
- Fix edit dialog for base instance
- Disable name field
- Fix title showing `<base instance>`
- Translate edit dialog
- Fix checkbox area not toggling properly

### Security

Expand Down Expand Up @@ -87,4 +92,4 @@
- Add proper `CHANGELOG.md`

### Fixed
- Fix installer not including Rust binaries
- Fix installer not including Rust binaries
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ plugins {
}

group = "dev.nycode"
version = "0.5.0"
version = "0.5.1"

repositories {
google()
Expand Down
5 changes: 4 additions & 1 deletion src/main/kotlin/localization/Strings.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
5 changes: 4 additions & 1 deletion src/main/kotlin/localization/StringsDe.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
5 changes: 4 additions & 1 deletion src/main/kotlin/localization/StringsEn.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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)
Expand All @@ -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()) {
Expand Down Expand Up @@ -108,7 +110,8 @@ private fun InstanceForm(
label = {
Text(strings.instanceName)
},
singleLine = true
singleLine = true,
enabled = !disableNameInput
)
}
Spacer(modifier = Modifier.height(8.dp))
Expand Down Expand Up @@ -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)
})
Expand Down

0 comments on commit 29d6309

Please sign in to comment.