|
|
@@ -5,18 +5,21 @@ import com.jfoenix.controls.JFXListCell
|
|
|
import javafx.collections.ObservableList
|
|
|
import javafx.geometry.Insets
|
|
|
import javafx.geometry.Pos
|
|
|
+import javafx.scene.control.Alert
|
|
|
+import javafx.scene.control.ButtonType
|
|
|
import javafx.scene.control.Tab
|
|
|
import javafx.scene.control.TabPane
|
|
|
import javafx.scene.image.Image
|
|
|
import javafx.scene.input.KeyCode
|
|
|
+import javafx.scene.layout.Priority
|
|
|
import javafx.stage.FileChooser
|
|
|
import kotlinx.coroutines.runBlocking
|
|
|
import net.mamoe.mirai.console.graphical.controller.MiraiGraphicalUIController
|
|
|
import net.mamoe.mirai.console.graphical.model.BotModel
|
|
|
+import net.mamoe.mirai.console.graphical.util.*
|
|
|
import net.mamoe.mirai.console.graphical.util.jfxButton
|
|
|
import net.mamoe.mirai.console.graphical.util.jfxListView
|
|
|
import net.mamoe.mirai.console.graphical.util.jfxTabPane
|
|
|
-import net.mamoe.mirai.console.graphical.util.myButtonBar
|
|
|
import tornadofx.*
|
|
|
|
|
|
class PrimaryView : View() {
|
|
|
@@ -72,8 +75,27 @@ class PrimaryView : View() {
|
|
|
override fun updateItem(item: BotModel?, empty: Boolean) {
|
|
|
super.updateItem(item, empty)
|
|
|
if (item != null && !empty) {
|
|
|
- graphic = null
|
|
|
- text = item.uin.toString()
|
|
|
+ graphic = hbox {
|
|
|
+
|
|
|
+ alignment = Pos.CENTER_LEFT
|
|
|
+
|
|
|
+ label(item.uin.toString())
|
|
|
+ pane {
|
|
|
+ hgrow = Priority.ALWAYS
|
|
|
+ }
|
|
|
+ jfxButton(graphic = SVG.close) {
|
|
|
+ buttonType = JFXButton.ButtonType.FLAT
|
|
|
+ tooltip("退出登录")
|
|
|
+ }.action {
|
|
|
+ alert(Alert.AlertType.CONFIRMATION, "${item.uin}将会退出登录,是否确认") {
|
|
|
+ if (it == ButtonType.OK) {
|
|
|
+ tab?.close()
|
|
|
+ controller.logout(item.uin)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ text = ""
|
|
|
} else {
|
|
|
graphic = null
|
|
|
text = ""
|