diff --git a/mirai-console-graphical/src/main/kotlin/net/mamoe/mirai/console/graphical/controller/MiraiGraphicalUIController.kt b/mirai-console-graphical/src/main/kotlin/net/mamoe/mirai/console/graphical/controller/MiraiGraphicalUIController.kt index d70c5dd5f..a9b031a88 100644 --- a/mirai-console-graphical/src/main/kotlin/net/mamoe/mirai/console/graphical/controller/MiraiGraphicalUIController.kt +++ b/mirai-console-graphical/src/main/kotlin/net/mamoe/mirai/console/graphical/controller/MiraiGraphicalUIController.kt @@ -23,8 +23,13 @@ class MiraiGraphicalUIController : Controller(), MiraiConsoleUI { private val loginSolver = GraphicalLoginSolver() private val cache = mutableMapOf() val mainLog = observableListOf() + + val botList = observableListOf() val pluginList: ObservableList by lazy(::getPluginsFromConsole) + + val consoleConfig : Map by lazy(::getConfigFromConsole) + val consoleInfo = ConsoleInfo() suspend fun login(qq: String, psd: String) { @@ -78,6 +83,8 @@ class MiraiGraphicalUIController : Controller(), MiraiConsoleUI { // TODO return observableListOf() } + + private fun getConfigFromConsole() = MiraiConsole.MiraiProperties.config.asMap() } class GraphicalLoginSolver : LoginSolver() { diff --git a/mirai-console-graphical/src/main/kotlin/net/mamoe/mirai/console/graphical/view/PrimaryView.kt b/mirai-console-graphical/src/main/kotlin/net/mamoe/mirai/console/graphical/view/PrimaryView.kt index 56fa4b67a..a0760cd6b 100644 --- a/mirai-console-graphical/src/main/kotlin/net/mamoe/mirai/console/graphical/view/PrimaryView.kt +++ b/mirai-console-graphical/src/main/kotlin/net/mamoe/mirai/console/graphical/view/PrimaryView.kt @@ -69,15 +69,11 @@ class PrimaryView : View() { center = jfxTabPane { - tab("Login") { - this += find().root - } + tab("Login").content = find().root - tab("Plugins") { - this += find().root - } + tab("Plugins").content = find().root - tab("Settings") + tab("Settings").content = find().root logTab("Main", controller.mainLog) } diff --git a/mirai-console-graphical/src/main/kotlin/net/mamoe/mirai/console/graphical/view/SettingsView.kt b/mirai-console-graphical/src/main/kotlin/net/mamoe/mirai/console/graphical/view/SettingsView.kt new file mode 100644 index 000000000..1c0b2968c --- /dev/null +++ b/mirai-console-graphical/src/main/kotlin/net/mamoe/mirai/console/graphical/view/SettingsView.kt @@ -0,0 +1,23 @@ +package net.mamoe.mirai.console.graphical.view + +import net.mamoe.mirai.console.graphical.controller.MiraiGraphicalUIController +import net.mamoe.mirai.console.graphical.util.jfxTextfield +import tornadofx.View +import tornadofx.field +import tornadofx.fieldset +import tornadofx.form + +class SettingsView : View() { + + private val controller = find() + + override val root = form { + controller.consoleConfig.forEach { + fieldset { + field(it.key) { + jfxTextfield(it.value.toString()) { isEditable = false } + } + } + } + } +} \ No newline at end of file