fix: instance creation + dialog
This commit is contained in:
parent
8f46e4887f
commit
7cefa88dcb
|
@ -2,6 +2,7 @@ package io.gitlab.jfronny.inceptum.gtk
|
||||||
|
|
||||||
import io.gitlab.jfronny.commons.StringFormatter
|
import io.gitlab.jfronny.commons.StringFormatter
|
||||||
import io.gitlab.jfronny.inceptum.common.Utils
|
import io.gitlab.jfronny.inceptum.common.Utils
|
||||||
|
import io.gitlab.jfronny.inceptum.gtk.util.I18n
|
||||||
import io.gitlab.jfronny.inceptum.gtk.window.dialog.MicrosoftLoginDialog
|
import io.gitlab.jfronny.inceptum.gtk.window.dialog.MicrosoftLoginDialog
|
||||||
import io.gitlab.jfronny.inceptum.gtk.window.dialog.StringInputDialog
|
import io.gitlab.jfronny.inceptum.gtk.window.dialog.StringInputDialog
|
||||||
import io.gitlab.jfronny.inceptum.launcher.LauncherEnv.EnvBackend
|
import io.gitlab.jfronny.inceptum.launcher.LauncherEnv.EnvBackend
|
||||||
|
@ -78,6 +79,23 @@ object GtkEnvBackend : EnvBackend {
|
||||||
dialog.message = title
|
dialog.message = title
|
||||||
dialog.detail = markup
|
dialog.detail = markup
|
||||||
dialog.modal = true
|
dialog.modal = true
|
||||||
|
when {
|
||||||
|
cancel == null -> {
|
||||||
|
dialog.setButtons(arrayOf(I18n["ok"]))
|
||||||
|
dialog.defaultButton = 0
|
||||||
|
dialog.cancelButton = -1
|
||||||
|
}
|
||||||
|
ok == null -> {
|
||||||
|
dialog.setButtons(arrayOf("Cancel"))
|
||||||
|
dialog.defaultButton = -1
|
||||||
|
dialog.cancelButton = 0
|
||||||
|
}
|
||||||
|
else -> {
|
||||||
|
dialog.setButtons(arrayOf("OK", "Cancel"))
|
||||||
|
dialog.defaultButton = 0
|
||||||
|
dialog.cancelButton = 1
|
||||||
|
}
|
||||||
|
}
|
||||||
dialog.choose(parent, Cancellable()) { _, res, _ ->
|
dialog.choose(parent, Cancellable()) { _, res, _ ->
|
||||||
val result = dialog.chooseFinish(res)
|
val result = dialog.chooseFinish(res)
|
||||||
val cancelIdx = dialog.cancelButton
|
val cancelIdx = dialog.cancelButton
|
||||||
|
|
|
@ -37,7 +37,7 @@ object GtkMain {
|
||||||
AccountManager.loadAccounts()
|
AccountManager.loadAccounts()
|
||||||
GtkMenubar.create(this)
|
GtkMenubar.create(this)
|
||||||
val window = MainWindow(this)
|
val window = MainWindow(this)
|
||||||
window.show()
|
window.visible = true
|
||||||
GtkEnvBackend.dialogParent = window
|
GtkEnvBackend.dialogParent = window
|
||||||
window.onCloseRequest {
|
window.onCloseRequest {
|
||||||
GtkEnvBackend.dialogParent = null
|
GtkEnvBackend.dialogParent = null
|
||||||
|
|
|
@ -62,8 +62,8 @@ class NewInstanceWindow(app: Application) : KAssistant(app) {
|
||||||
|
|
||||||
val none = CheckButton.newWithLabel("None")
|
val none = CheckButton.newWithLabel("None")
|
||||||
val fabric = CheckButton.newWithLabel("Fabric")
|
val fabric = CheckButton.newWithLabel("Fabric")
|
||||||
none.onActivate { useFabric = false }
|
none.onToggled { useFabric = false }
|
||||||
none.onActivate { useFabric = true }
|
none.onToggled { useFabric = true }
|
||||||
fabric.setGroup(none)
|
fabric.setGroup(none)
|
||||||
append(none)
|
append(none)
|
||||||
val fabricVersionDropdown = KDropDown(versions, { it.loader.version }, def)
|
val fabricVersionDropdown = KDropDown(versions, { it.loader.version }, def)
|
||||||
|
@ -175,6 +175,8 @@ class NewInstanceWindow(app: Application) : KAssistant(app) {
|
||||||
status.setMarkup("The instance was successfully created. You can now launch it using the main menu")
|
status.setMarkup("The instance was successfully created. You can now launch it using the main menu")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setComplete(true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue