mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-26 08:00:11 +08:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
5a1bbfa07c
@ -17,6 +17,8 @@ import net.mamoe.mirai.network.WrongPasswordException
|
|||||||
import net.mamoe.mirai.utils.LoginSolver
|
import net.mamoe.mirai.utils.LoginSolver
|
||||||
import net.mamoe.mirai.utils.SimpleLogger.LogPriority
|
import net.mamoe.mirai.utils.SimpleLogger.LogPriority
|
||||||
import tornadofx.*
|
import tornadofx.*
|
||||||
|
import java.text.SimpleDateFormat
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
class MiraiGraphicalUIController : Controller(), MiraiConsoleUI {
|
class MiraiGraphicalUIController : Controller(), MiraiConsoleUI {
|
||||||
|
|
||||||
@ -31,6 +33,10 @@ class MiraiGraphicalUIController : Controller(), MiraiConsoleUI {
|
|||||||
|
|
||||||
val consoleInfo = ConsoleInfo()
|
val consoleInfo = ConsoleInfo()
|
||||||
|
|
||||||
|
val sdf by lazy {
|
||||||
|
SimpleDateFormat("HH:mm:ss")
|
||||||
|
}
|
||||||
|
|
||||||
fun login(qq: String, psd: String) {
|
fun login(qq: String, psd: String) {
|
||||||
CommandManager.runCommand(ConsoleCommandSender, "/login $qq $psd")
|
CommandManager.runCommand(ConsoleCommandSender, "/login $qq $psd")
|
||||||
}
|
}
|
||||||
@ -43,22 +49,17 @@ class MiraiGraphicalUIController : Controller(), MiraiConsoleUI {
|
|||||||
|
|
||||||
// 修改interface之后用来暂时占位
|
// 修改interface之后用来暂时占位
|
||||||
override fun pushLog(priority: LogPriority, identityStr: String, identity: Long, message: String) {
|
override fun pushLog(priority: LogPriority, identityStr: String, identity: Long, message: String) {
|
||||||
fun ObservableList<*>.trim() {
|
|
||||||
if (size > settingModel.item.maxLongNum) {
|
|
||||||
this.removeAt(0)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Platform.runLater {
|
Platform.runLater {
|
||||||
when (identity) {
|
|
||||||
0L -> mainLog.apply {
|
val time = sdf.format(Date())
|
||||||
add("$identityStr $message")
|
|
||||||
trim()
|
if (identity == 0L) {
|
||||||
}
|
mainLog
|
||||||
else -> cache[identity]?.logHistory?.apply {
|
} else {
|
||||||
add("$identityStr $message")
|
cache[identity]?.logHistory
|
||||||
trim()
|
}?.apply {
|
||||||
}
|
add("[$time] $identityStr $message")
|
||||||
|
trim()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -89,7 +90,9 @@ class MiraiGraphicalUIController : Controller(), MiraiConsoleUI {
|
|||||||
Platform.runLater {
|
Platform.runLater {
|
||||||
ret = InputDialog(hint).open()
|
ret = InputDialog(hint).open()
|
||||||
}
|
}
|
||||||
while (ret == null) { delay(1000) }
|
while (ret == null) {
|
||||||
|
delay(1000)
|
||||||
|
}
|
||||||
return ret!!
|
return ret!!
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,6 +105,15 @@ class MiraiGraphicalUIController : Controller(), MiraiConsoleUI {
|
|||||||
private fun getPluginsFromConsole(): ObservableList<PluginModel> =
|
private fun getPluginsFromConsole(): ObservableList<PluginModel> =
|
||||||
PluginManager.getAllPluginDescriptions().map(::PluginModel).toObservable()
|
PluginManager.getAllPluginDescriptions().map(::PluginModel).toObservable()
|
||||||
|
|
||||||
|
|
||||||
|
private fun ObservableList<*>.trim() {
|
||||||
|
println(size)
|
||||||
|
println(settingModel.item.maxLongNum)
|
||||||
|
while (size > settingModel.item.maxLongNum) {
|
||||||
|
this.removeAt(0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class GraphicalLoginSolver : LoginSolver() {
|
class GraphicalLoginSolver : LoginSolver() {
|
||||||
|
Loading…
Reference in New Issue
Block a user