diff --git a/mirai-console-graphical/src/main/kotlin/net/mamoe/mirai/console/graphical/controller/MiraiGraphicalUIController.kt b/mirai-console-graphical/src/main/kotlin/net/mamoe/mirai/console/graphical/controller/MiraiGraphicalUIController.kt index dba5bc9e7..80c8f0dfd 100644 --- a/mirai-console-graphical/src/main/kotlin/net/mamoe/mirai/console/graphical/controller/MiraiGraphicalUIController.kt +++ b/mirai-console-graphical/src/main/kotlin/net/mamoe/mirai/console/graphical/controller/MiraiGraphicalUIController.kt @@ -27,7 +27,7 @@ class MiraiGraphicalUIController : Controller(), MiraiConsoleUI { private val settingModel = find() private val loginSolver = GraphicalLoginSolver() private val cache = mutableMapOf() - val mainLog = observableListOf() + val mainLog = observableListOf>() val botList = observableListOf() @@ -69,7 +69,7 @@ class MiraiGraphicalUIController : Controller(), MiraiConsoleUI { } else { cache[identity]?.logHistory }?.apply { - add("[$time] $identityStr $message") + add("[$time] $identityStr $message" to priority.name) trim() } } diff --git a/mirai-console-graphical/src/main/kotlin/net/mamoe/mirai/console/graphical/model/BotModel.kt b/mirai-console-graphical/src/main/kotlin/net/mamoe/mirai/console/graphical/model/BotModel.kt index 54de54c76..660948f35 100644 --- a/mirai-console-graphical/src/main/kotlin/net/mamoe/mirai/console/graphical/model/BotModel.kt +++ b/mirai-console-graphical/src/main/kotlin/net/mamoe/mirai/console/graphical/model/BotModel.kt @@ -11,7 +11,7 @@ class BotModel(val uin: Long) { val botProperty = SimpleObjectProperty(null) var bot: Bot by botProperty - val logHistory = observableListOf() + val logHistory = observableListOf>() val admins = observableListOf() } diff --git a/mirai-console-graphical/src/main/kotlin/net/mamoe/mirai/console/graphical/stylesheet/PrimaryStyleSheet.kt b/mirai-console-graphical/src/main/kotlin/net/mamoe/mirai/console/graphical/stylesheet/PrimaryStyleSheet.kt index adbec3b80..9bb6628e5 100644 --- a/mirai-console-graphical/src/main/kotlin/net/mamoe/mirai/console/graphical/stylesheet/PrimaryStyleSheet.kt +++ b/mirai-console-graphical/src/main/kotlin/net/mamoe/mirai/console/graphical/stylesheet/PrimaryStyleSheet.kt @@ -124,6 +124,15 @@ class PrimaryStyleSheet : BaseStyleSheet() { } listCell { + + and(":WARNING") { + backgroundColor += c("FFFF00", 0.3) // Yellow + } + + and(":ERROR") { + backgroundColor += c("FF0000", 0.3) // Red + } + and(":selected") { backgroundColor += c(stressColor, 1.0) } diff --git a/mirai-console-graphical/src/main/kotlin/net/mamoe/mirai/console/graphical/view/PrimaryView.kt b/mirai-console-graphical/src/main/kotlin/net/mamoe/mirai/console/graphical/view/PrimaryView.kt index 8399373c5..a871a17b3 100644 --- a/mirai-console-graphical/src/main/kotlin/net/mamoe/mirai/console/graphical/view/PrimaryView.kt +++ b/mirai-console-graphical/src/main/kotlin/net/mamoe/mirai/console/graphical/view/PrimaryView.kt @@ -151,7 +151,7 @@ private fun TabPane.fixedTab(title: String) = tab(title) { isClosable = false } private fun TabPane.logTab( text: String? = null, - logs: ObservableList, + logs: ObservableList>, closeable: Boolean = true, op: Tab.() -> Unit = {} ) = tab(text) { @@ -174,7 +174,7 @@ private fun TabPane.logTab( path.firstOrNull()?.run { if (!exists()) createNewFile() writer().use { - logs.forEach { log -> it.appendln(log) } + logs.forEach { log -> it.appendln(log.first) } } true } ?: false @@ -188,7 +188,10 @@ private fun TabPane.logTab( fitToParentSize() cellFormat { - graphic = label(it) { + + addPseudoClass(it.second) + + graphic = label(it.first) { maxWidthProperty().bind(this@listview.widthProperty()) isWrapText = true }