Fix disable options button always changing to No optional mods...

This commit is contained in:
comp500 2021-02-16 16:26:23 +00:00
parent 6c6a0100fd
commit 03b0f1b09b
4 changed files with 8 additions and 7 deletions

View File

@ -367,7 +367,8 @@ class UpdateManager internal constructor(private val opts: Options, val ui: IUse
handleCancellation() handleCancellation()
} }
} }
ui.disableOptionsButton() // TODO: keep this enabled? then apply changes after download process?
ui.disableOptionsButton(optionTasks.isNotEmpty())
// TODO: different thread pool type? // TODO: different thread pool type?
val threadPool = Executors.newFixedThreadPool(10) val threadPool = Executors.newFixedThreadPool(10)

View File

@ -19,7 +19,7 @@ interface IUserInterface {
fun showOptions(options: List<IOptionDetails>): Boolean fun showOptions(options: List<IOptionDetails>): Boolean
fun showExceptions(exceptions: List<ExceptionDetails>, numTotal: Int, allowsIgnore: Boolean): ExceptionListResult fun showExceptions(exceptions: List<ExceptionDetails>, numTotal: Int, allowsIgnore: Boolean): ExceptionListResult
fun disableOptionsButton() {} fun disableOptionsButton(hasOptions: Boolean) {}
fun showCancellationDialog(): CancellationResult = CancellationResult.QUIT fun showCancellationDialog(): CancellationResult = CancellationResult.QUIT

View File

@ -131,8 +131,8 @@ class GUIHandler : IUserInterface {
return future.get() return future.get()
} }
override fun disableOptionsButton() = EventQueue.invokeLater { override fun disableOptionsButton(hasOptions: Boolean) = EventQueue.invokeLater {
frmPackwizlauncher.disableOptionsButton() frmPackwizlauncher.disableOptionsButton(hasOptions)
} }
override fun showCancellationDialog(): IUserInterface.CancellationResult { override fun showCancellationDialog(): IUserInterface.CancellationResult {

View File

@ -77,9 +77,9 @@ class InstallWindow(private val handler: GUIHandler) : JFrame() {
lblProgresslabel.text = progress.message lblProgresslabel.text = progress.message
} }
fun disableOptionsButton() { fun disableOptionsButton(hasOptions: Boolean) {
btnOptions.apply { btnOptions.apply {
text = "No optional mods" text = if (hasOptions) { "Optional mods..." } else { "No optional mods" }
isEnabled = false isEnabled = false
} }
} }