mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-10 02:20:14 +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 {
|
pluginList.forEach {
|
||||||
if (it.name == plugin.name && it.author == plugin.author) {
|
if (it.name == plugin.name && it.author == plugin.author) {
|
||||||
if (plugin.version > it.version) {
|
if (plugin.version > it.version) {
|
||||||
|
@ -99,15 +99,17 @@ class PluginsCenterView : View() {
|
|||||||
val map = center.fetchPlugin(page++)
|
val map = center.fetchPlugin(page++)
|
||||||
if (map.isEmpty()) return@runBlocking
|
if (map.isEmpty()) return@runBlocking
|
||||||
map.forEach {
|
map.forEach {
|
||||||
ret.add(
|
with(PluginModel(
|
||||||
PluginModel(
|
|
||||||
it.value.name,
|
it.value.name,
|
||||||
it.value.version,
|
it.value.version,
|
||||||
it.value.author,
|
it.value.author,
|
||||||
it.value.description,
|
it.value.description,
|
||||||
it.value
|
it.value
|
||||||
)
|
)) {
|
||||||
)
|
ret.add(this)
|
||||||
|
controller.checkUpdate(this)
|
||||||
|
controller.checkAmbiguous(this)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,15 @@
|
|||||||
package net.mamoe.mirai.console.graphical.view
|
package net.mamoe.mirai.console.graphical.view
|
||||||
|
|
||||||
import com.jfoenix.controls.JFXTreeTableColumn
|
import com.jfoenix.controls.JFXTreeTableColumn
|
||||||
|
import javafx.scene.control.TreeTableCell
|
||||||
import net.mamoe.mirai.console.graphical.controller.MiraiGraphicalUIController
|
import net.mamoe.mirai.console.graphical.controller.MiraiGraphicalUIController
|
||||||
import net.mamoe.mirai.console.graphical.model.PluginModel
|
import net.mamoe.mirai.console.graphical.model.PluginModel
|
||||||
import net.mamoe.mirai.console.graphical.stylesheet.PluginViewStyleSheet
|
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 net.mamoe.mirai.console.graphical.util.jfxTreeTableView
|
||||||
import tornadofx.View
|
import tornadofx.View
|
||||||
import tornadofx.addStylesheet
|
import tornadofx.addStylesheet
|
||||||
|
import tornadofx.visibleWhen
|
||||||
|
|
||||||
class PluginsView : View() {
|
class PluginsView : View() {
|
||||||
|
|
||||||
@ -50,15 +53,25 @@ class PluginsView : View() {
|
|||||||
JFXTreeTableColumn<PluginModel, PluginModel>("操作").apply {
|
JFXTreeTableColumn<PluginModel, PluginModel>("操作").apply {
|
||||||
prefWidthProperty().bind(this@jfxTreeTableView.widthProperty().multiply(0.08))
|
prefWidthProperty().bind(this@jfxTreeTableView.widthProperty().multiply(0.08))
|
||||||
|
|
||||||
// setCellValueFactory { return@setCellValueFactory it.value.valueProperty() }
|
setCellValueFactory { return@setCellValueFactory it.value.valueProperty() }
|
||||||
//
|
|
||||||
// setCellFactory {
|
setCellFactory {
|
||||||
// return@setCellFactory object : TreeTableCell<PluginModel, PluginModel>() {
|
return@setCellFactory object : TreeTableCell<PluginModel, PluginModel>() {
|
||||||
// override fun updateItem(item: PluginModel?, empty: Boolean) {
|
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