Graphical log identity

This commit is contained in:
ryoii 2020-03-28 23:12:07 +08:00
parent 86cf95f0fb
commit c804f7f1bc

View File

@ -38,6 +38,11 @@ class MiraiGraphicalUIController : Controller(), MiraiConsoleUI {
fun sendCommand(command: String) = CommandManager.runCommand(ConsoleCommandSender, command) fun sendCommand(command: String) = CommandManager.runCommand(ConsoleCommandSender, command)
override fun pushLog(identity: Long, message: String) = Platform.runLater { override fun pushLog(identity: Long, message: String) = Platform.runLater {
this.pushLog(LogPriority.INFO, "", identity, message)
}
// 修改interface之后用来暂时占位
override fun pushLog(priority: LogPriority, identityStr: String, identity: Long, message: String) {
fun ObservableList<*>.trim() { fun ObservableList<*>.trim() {
if (size > settingModel.item.maxLongNum) { if (size > settingModel.item.maxLongNum) {
this.removeAt(0) this.removeAt(0)
@ -46,21 +51,16 @@ class MiraiGraphicalUIController : Controller(), MiraiConsoleUI {
when (identity) { when (identity) {
0L -> mainLog.apply { 0L -> mainLog.apply {
add(message) add("$identityStr $message")
mainLog.trim() mainLog.trim()
} }
else -> cache[identity]?.logHistory?.apply { else -> cache[identity]?.logHistory?.apply {
add(message) add("$identityStr $message")
trim() trim()
} }
} }
} }
// 修改interface之后用来暂时占位
override fun pushLog(priority: LogPriority, identityStr: String, identity: Long, message: String) {
this.pushLog(identity, message)
}
override fun prePushBot(identity: Long) = Platform.runLater { override fun prePushBot(identity: Long) = Platform.runLater {
BotModel(identity).also { BotModel(identity).also {
cache[identity] = it cache[identity] = it