mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-26 08:00:11 +08:00
Graphical log identity
This commit is contained in:
parent
86cf95f0fb
commit
c804f7f1bc
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user