mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-23 14:20:24 +08:00
Graphic refactor plugin list
This commit is contained in:
parent
ca0e50a367
commit
f41b831580
@ -13,10 +13,7 @@ import net.mamoe.mirai.console.graphical.model.VerificationCodeModel
|
|||||||
import net.mamoe.mirai.console.graphical.view.VerificationCodeFragment
|
import net.mamoe.mirai.console.graphical.view.VerificationCodeFragment
|
||||||
import net.mamoe.mirai.console.utils.MiraiConsoleUI
|
import net.mamoe.mirai.console.utils.MiraiConsoleUI
|
||||||
import net.mamoe.mirai.utils.LoginSolver
|
import net.mamoe.mirai.utils.LoginSolver
|
||||||
import tornadofx.Controller
|
import tornadofx.*
|
||||||
import tornadofx.Scope
|
|
||||||
import tornadofx.find
|
|
||||||
import tornadofx.observableListOf
|
|
||||||
|
|
||||||
class MiraiGraphicalUIController : Controller(), MiraiConsoleUI {
|
class MiraiGraphicalUIController : Controller(), MiraiConsoleUI {
|
||||||
|
|
||||||
@ -79,10 +76,9 @@ class MiraiGraphicalUIController : Controller(), MiraiConsoleUI {
|
|||||||
|
|
||||||
override fun createLoginSolver(): LoginSolver = loginSolver
|
override fun createLoginSolver(): LoginSolver = loginSolver
|
||||||
|
|
||||||
private fun getPluginsFromConsole(): ObservableList<PluginModel> {
|
private fun getPluginsFromConsole(): ObservableList<PluginModel> =
|
||||||
// TODO
|
MiraiConsole.pluginManager.getAllPluginDescriptions().map(::PluginModel).toObservable()
|
||||||
return observableListOf<PluginModel>()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class GraphicalLoginSolver : LoginSolver() {
|
class GraphicalLoginSolver : LoginSolver() {
|
||||||
|
@ -3,16 +3,17 @@ package net.mamoe.mirai.console.graphical.model
|
|||||||
import com.jfoenix.controls.datamodels.treetable.RecursiveTreeObject
|
import com.jfoenix.controls.datamodels.treetable.RecursiveTreeObject
|
||||||
import javafx.beans.property.SimpleBooleanProperty
|
import javafx.beans.property.SimpleBooleanProperty
|
||||||
import javafx.beans.property.SimpleStringProperty
|
import javafx.beans.property.SimpleStringProperty
|
||||||
|
import net.mamoe.mirai.console.plugins.PluginDescription
|
||||||
import tornadofx.getValue
|
import tornadofx.getValue
|
||||||
import tornadofx.setValue
|
import tornadofx.setValue
|
||||||
|
|
||||||
class PluginModel : RecursiveTreeObject<PluginModel>() {
|
class PluginModel(
|
||||||
|
val name: String,
|
||||||
val nameProperty = SimpleStringProperty(this, "nameProperty")
|
val version: String,
|
||||||
val name by nameProperty
|
val author: String,
|
||||||
|
val description: String
|
||||||
val descriptionProperty = SimpleStringProperty(this, "descriptionProperty")
|
) : RecursiveTreeObject<PluginModel>() {
|
||||||
val description by descriptionProperty
|
constructor(plugin: PluginDescription):this(plugin.name, plugin.version, plugin.author, plugin.info)
|
||||||
|
|
||||||
val enabledProperty = SimpleBooleanProperty(this, "enabledProperty")
|
val enabledProperty = SimpleBooleanProperty(this, "enabledProperty")
|
||||||
var enabled by enabledProperty
|
var enabled by enabledProperty
|
||||||
|
@ -13,10 +13,21 @@ class PluginsView : View() {
|
|||||||
|
|
||||||
override val root = jfxTreeTableView(plugins) {
|
override val root = jfxTreeTableView(plugins) {
|
||||||
columns.addAll(
|
columns.addAll(
|
||||||
JFXTreeTableColumn<PluginModel, String>("插件名").apply { },
|
JFXTreeTableColumn<PluginModel, String>("插件名").apply {
|
||||||
JFXTreeTableColumn<PluginModel, String>("版本").apply { },
|
prefWidthProperty().bind(this@jfxTreeTableView.widthProperty().multiply(0.1))
|
||||||
JFXTreeTableColumn<PluginModel, String>("作者").apply { },
|
},
|
||||||
JFXTreeTableColumn<PluginModel, String>("介绍").apply { }
|
JFXTreeTableColumn<PluginModel, String>("版本").apply {
|
||||||
|
prefWidthProperty().bind(this@jfxTreeTableView.widthProperty().multiply(0.1))
|
||||||
|
},
|
||||||
|
JFXTreeTableColumn<PluginModel, String>("作者").apply {
|
||||||
|
prefWidthProperty().bind(this@jfxTreeTableView.widthProperty().multiply(0.1))
|
||||||
|
},
|
||||||
|
JFXTreeTableColumn<PluginModel, String>("介绍").apply {
|
||||||
|
prefWidthProperty().bind(this@jfxTreeTableView.widthProperty().multiply(0.6))
|
||||||
|
},
|
||||||
|
JFXTreeTableColumn<PluginModel, String>("操作").apply {
|
||||||
|
prefWidthProperty().bind(this@jfxTreeTableView.widthProperty().multiply(0.08))
|
||||||
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user