graphic setting view

This commit is contained in:
ryoii 2020-02-21 21:20:58 +08:00
parent eda936c2bf
commit e5546d9283
3 changed files with 33 additions and 7 deletions

View File

@ -23,8 +23,13 @@ class MiraiGraphicalUIController : Controller(), MiraiConsoleUI {
private val loginSolver = GraphicalLoginSolver()
private val cache = mutableMapOf<Long, BotModel>()
val mainLog = observableListOf<String>()
val botList = observableListOf<BotModel>()
val pluginList: ObservableList<PluginModel> by lazy(::getPluginsFromConsole)
val consoleConfig : Map<String, Any> by lazy(::getConfigFromConsole)
val consoleInfo = ConsoleInfo()
suspend fun login(qq: String, psd: String) {
@ -78,6 +83,8 @@ class MiraiGraphicalUIController : Controller(), MiraiConsoleUI {
// TODO
return observableListOf<PluginModel>()
}
private fun getConfigFromConsole() = MiraiConsole.MiraiProperties.config.asMap()
}
class GraphicalLoginSolver : LoginSolver() {

View File

@ -69,15 +69,11 @@ class PrimaryView : View() {
center = jfxTabPane {
tab("Login") {
this += find<LoginView>().root
}
tab("Login").content = find<LoginView>().root
tab("Plugins") {
this += find<PluginsView>().root
}
tab("Plugins").content = find<PluginsView>().root
tab("Settings")
tab("Settings").content = find<SettingsView>().root
logTab("Main", controller.mainLog)
}

View File

@ -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<MiraiGraphicalUIController>()
override val root = form {
controller.consoleConfig.forEach {
fieldset {
field(it.key) {
jfxTextfield(it.value.toString()) { isEditable = false }
}
}
}
}
}