mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-08 17:20:11 +08:00
Check plugins update
This commit is contained in:
parent
234db0a65a
commit
c9b1dac567
@ -125,7 +125,7 @@ class MiraiGraphicalUIController : Controller(), MiraiConsoleUI {
|
||||
}
|
||||
}
|
||||
|
||||
fun checkLatest(plugin: PluginModel) {
|
||||
fun checkUpdate(plugin: PluginModel) {
|
||||
pluginList.forEach {
|
||||
if (it.name == plugin.name && it.author == plugin.author) {
|
||||
if (plugin.version > it.version) {
|
||||
|
@ -99,15 +99,17 @@ class PluginsCenterView : View() {
|
||||
val map = center.fetchPlugin(page++)
|
||||
if (map.isEmpty()) return@runBlocking
|
||||
map.forEach {
|
||||
ret.add(
|
||||
PluginModel(
|
||||
it.value.name,
|
||||
it.value.version,
|
||||
it.value.author,
|
||||
it.value.description,
|
||||
it.value
|
||||
)
|
||||
)
|
||||
with(PluginModel(
|
||||
it.value.name,
|
||||
it.value.version,
|
||||
it.value.author,
|
||||
it.value.description,
|
||||
it.value
|
||||
)) {
|
||||
ret.add(this)
|
||||
controller.checkUpdate(this)
|
||||
controller.checkAmbiguous(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,15 @@
|
||||
package net.mamoe.mirai.console.graphical.view
|
||||
|
||||
import com.jfoenix.controls.JFXTreeTableColumn
|
||||
import javafx.scene.control.TreeTableCell
|
||||
import net.mamoe.mirai.console.graphical.controller.MiraiGraphicalUIController
|
||||
import net.mamoe.mirai.console.graphical.model.PluginModel
|
||||
import net.mamoe.mirai.console.graphical.stylesheet.PluginViewStyleSheet
|
||||
import net.mamoe.mirai.console.graphical.util.jfxButton
|
||||
import net.mamoe.mirai.console.graphical.util.jfxTreeTableView
|
||||
import tornadofx.View
|
||||
import tornadofx.addStylesheet
|
||||
import tornadofx.visibleWhen
|
||||
|
||||
class PluginsView : View() {
|
||||
|
||||
@ -50,15 +53,25 @@ class PluginsView : View() {
|
||||
JFXTreeTableColumn<PluginModel, PluginModel>("操作").apply {
|
||||
prefWidthProperty().bind(this@jfxTreeTableView.widthProperty().multiply(0.08))
|
||||
|
||||
// setCellValueFactory { return@setCellValueFactory it.value.valueProperty() }
|
||||
//
|
||||
// setCellFactory {
|
||||
// return@setCellFactory object : TreeTableCell<PluginModel, PluginModel>() {
|
||||
// override fun updateItem(item: PluginModel?, empty: Boolean) {
|
||||
//
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
setCellValueFactory { return@setCellValueFactory it.value.valueProperty() }
|
||||
|
||||
setCellFactory {
|
||||
return@setCellFactory object : TreeTableCell<PluginModel, PluginModel>() {
|
||||
override fun updateItem(item: PluginModel?, empty: Boolean) {
|
||||
if (item != null && !empty) {
|
||||
graphic = jfxButton("更新") {
|
||||
visibleWhen(item.expiredProperty)
|
||||
|
||||
// to do update
|
||||
}
|
||||
text = ""
|
||||
} else {
|
||||
graphic = null
|
||||
text = ""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user