mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-09 18:00:33 +08:00
graphic setting view
This commit is contained in:
parent
eda936c2bf
commit
e5546d9283
@ -23,8 +23,13 @@ class MiraiGraphicalUIController : Controller(), MiraiConsoleUI {
|
|||||||
private val loginSolver = GraphicalLoginSolver()
|
private val loginSolver = GraphicalLoginSolver()
|
||||||
private val cache = mutableMapOf<Long, BotModel>()
|
private val cache = mutableMapOf<Long, BotModel>()
|
||||||
val mainLog = observableListOf<String>()
|
val mainLog = observableListOf<String>()
|
||||||
|
|
||||||
|
|
||||||
val botList = observableListOf<BotModel>()
|
val botList = observableListOf<BotModel>()
|
||||||
val pluginList: ObservableList<PluginModel> by lazy(::getPluginsFromConsole)
|
val pluginList: ObservableList<PluginModel> by lazy(::getPluginsFromConsole)
|
||||||
|
|
||||||
|
val consoleConfig : Map<String, Any> by lazy(::getConfigFromConsole)
|
||||||
|
|
||||||
val consoleInfo = ConsoleInfo()
|
val consoleInfo = ConsoleInfo()
|
||||||
|
|
||||||
suspend fun login(qq: String, psd: String) {
|
suspend fun login(qq: String, psd: String) {
|
||||||
@ -78,6 +83,8 @@ class MiraiGraphicalUIController : Controller(), MiraiConsoleUI {
|
|||||||
// TODO
|
// TODO
|
||||||
return observableListOf<PluginModel>()
|
return observableListOf<PluginModel>()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun getConfigFromConsole() = MiraiConsole.MiraiProperties.config.asMap()
|
||||||
}
|
}
|
||||||
|
|
||||||
class GraphicalLoginSolver : LoginSolver() {
|
class GraphicalLoginSolver : LoginSolver() {
|
||||||
|
@ -69,15 +69,11 @@ class PrimaryView : View() {
|
|||||||
|
|
||||||
center = jfxTabPane {
|
center = jfxTabPane {
|
||||||
|
|
||||||
tab("Login") {
|
tab("Login").content = find<LoginView>().root
|
||||||
this += find<LoginView>().root
|
|
||||||
}
|
|
||||||
|
|
||||||
tab("Plugins") {
|
tab("Plugins").content = find<PluginsView>().root
|
||||||
this += find<PluginsView>().root
|
|
||||||
}
|
|
||||||
|
|
||||||
tab("Settings")
|
tab("Settings").content = find<SettingsView>().root
|
||||||
|
|
||||||
logTab("Main", controller.mainLog)
|
logTab("Main", controller.mainLog)
|
||||||
}
|
}
|
||||||
|
@ -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 }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user