Browse Source

Merge remote-tracking branch 'origin/master'

jiahua.liu 6 years ago
parent
commit
3c35d3826e

+ 1 - 2
mirai-console-graphical/src/main/kotlin/net/mamoe/mirai/console/graphical/MiraiGraphical.kt

@@ -11,11 +11,10 @@ package net.mamoe.mirai.console.graphical
 
 import net.mamoe.mirai.console.MiraiConsole
 import net.mamoe.mirai.console.graphical.controller.MiraiGraphicalUIController
-import net.mamoe.mirai.console.graphical.styleSheet.PrimaryStyleSheet
+import net.mamoe.mirai.console.graphical.stylesheet.PrimaryStyleSheet
 import net.mamoe.mirai.console.graphical.view.Decorator
 import tornadofx.App
 import tornadofx.find
-import tornadofx.launch
 
 //object MiraiGraphicalLoader {
 //    @JvmStatic

+ 1 - 1
mirai-console-graphical/src/main/kotlin/net/mamoe/mirai/console/graphical/styleSheet/BaseStyleSheet.kt → mirai-console-graphical/src/main/kotlin/net/mamoe/mirai/console/graphical/stylesheet/BaseStyleSheet.kt

@@ -1,4 +1,4 @@
-package net.mamoe.mirai.console.graphical.styleSheet
+package net.mamoe.mirai.console.graphical.stylesheet
 
 import javafx.scene.layout.BackgroundRepeat
 import javafx.scene.paint.Color

+ 1 - 1
mirai-console-graphical/src/main/kotlin/net/mamoe/mirai/console/graphical/styleSheet/LoginViewStyleSheet.kt → mirai-console-graphical/src/main/kotlin/net/mamoe/mirai/console/graphical/stylesheet/LoginViewStyleSheet.kt

@@ -1,4 +1,4 @@
-package net.mamoe.mirai.console.graphical.styleSheet
+package net.mamoe.mirai.console.graphical.stylesheet
 
 import javafx.scene.Cursor
 import javafx.scene.effect.BlurType

+ 1 - 1
mirai-console-graphical/src/main/kotlin/net/mamoe/mirai/console/graphical/styleSheet/PluginViewStyleSheet.kt → mirai-console-graphical/src/main/kotlin/net/mamoe/mirai/console/graphical/stylesheet/PluginViewStyleSheet.kt

@@ -1,4 +1,4 @@
-package net.mamoe.mirai.console.graphical.styleSheet
+package net.mamoe.mirai.console.graphical.stylesheet
 
 import javafx.geometry.Pos
 import javafx.scene.paint.Color

+ 22 - 6
mirai-console-graphical/src/main/kotlin/net/mamoe/mirai/console/graphical/styleSheet/PrimaryStyleSheet.kt → mirai-console-graphical/src/main/kotlin/net/mamoe/mirai/console/graphical/stylesheet/PrimaryStyleSheet.kt

@@ -1,6 +1,7 @@
-package net.mamoe.mirai.console.graphical.styleSheet
+package net.mamoe.mirai.console.graphical.stylesheet
 
 import javafx.scene.Cursor
+import javafx.scene.paint.Color
 import javafx.scene.text.FontWeight
 import tornadofx.*
 
@@ -46,17 +47,32 @@ class PrimaryStyleSheet : BaseStyleSheet() {
 
                 jfxListView {
 
-                    jfxListCell {
-                        backgroundColor += c(100, 100, 100, 0.4)
-                        backgroundRadius += box(5.px)
+                    // placeholder
+                    vBox {
+                        spacing = 15.px
 
+                        label {
                             textFill = c(fontColor)
                             fontWeight = FontWeight.BOLD
+                        }
 
+                        button {
+                            textFill = c(fontColor)
+                            fontWeight = FontWeight.BOLD
+                            backgroundColor += c(secondaryColor, 0.8)
+                            padding = box(2.px, 10.px)
+                            cursor = Cursor.HAND
+                        }
                     }
-                }
 
-                textField {
+                    jfxListCell {
+                        backgroundColor += c(100, 100, 100, 0.4)
+                        backgroundRadius += box(5.px)
+
+                        textFill = c(fontColor)
+                        fontWeight = FontWeight.BOLD
+
+                    }
                 }
             }
         }

+ 1 - 1
mirai-console-graphical/src/main/kotlin/net/mamoe/mirai/console/graphical/util/JFoenixAdaptor.kt

@@ -14,7 +14,7 @@ import tornadofx.bind
 
 internal fun EventTarget.jfxTabPane(op: JFXTabPane.() -> Unit = {}) = JFXTabPane().attachTo(this, op)
 
-internal fun EventTarget.jfxButton(text: String = "", graphic: Node? = null, op: Button.() -> Unit = {}) =
+internal fun EventTarget.jfxButton(text: String = "", graphic: Node? = null, op: JFXButton.() -> Unit = {}) =
     JFXButton(text).attachTo(this, op) {
         if (graphic != null) it.graphic = graphic
         it.buttonType = JFXButton.ButtonType.RAISED

+ 1 - 1
mirai-console-graphical/src/main/kotlin/net/mamoe/mirai/console/graphical/view/LoginView.kt

@@ -5,7 +5,7 @@ import javafx.geometry.Pos
 import javafx.scene.image.Image
 import kotlinx.coroutines.runBlocking
 import net.mamoe.mirai.console.graphical.controller.MiraiGraphicalUIController
-import net.mamoe.mirai.console.graphical.styleSheet.LoginViewStyleSheet
+import net.mamoe.mirai.console.graphical.stylesheet.LoginViewStyleSheet
 import net.mamoe.mirai.console.graphical.util.jfxButton
 import net.mamoe.mirai.console.graphical.util.jfxPasswordfield
 import net.mamoe.mirai.console.graphical.util.jfxTextfield

+ 1 - 1
mirai-console-graphical/src/main/kotlin/net/mamoe/mirai/console/graphical/view/PluginsView.kt

@@ -3,7 +3,7 @@ package net.mamoe.mirai.console.graphical.view
 import com.jfoenix.controls.JFXTreeTableColumn
 import net.mamoe.mirai.console.graphical.controller.MiraiGraphicalUIController
 import net.mamoe.mirai.console.graphical.model.PluginModel
-import net.mamoe.mirai.console.graphical.styleSheet.PluginViewStyleSheet
+import net.mamoe.mirai.console.graphical.stylesheet.PluginViewStyleSheet
 import net.mamoe.mirai.console.graphical.util.jfxTreeTableView
 import tornadofx.View
 import tornadofx.addStylesheet

+ 35 - 15
mirai-console-graphical/src/main/kotlin/net/mamoe/mirai/console/graphical/view/PrimaryView.kt

@@ -1,5 +1,6 @@
 package net.mamoe.mirai.console.graphical.view
 
+import com.jfoenix.controls.JFXButton
 import com.jfoenix.controls.JFXListCell
 import javafx.collections.ObservableList
 import javafx.geometry.Insets
@@ -39,6 +40,20 @@ class PrimaryView : View() {
             jfxListView(controller.botList) {
                 fitToParentHeight()
 
+                placeholder = vbox {
+
+                    alignment = Pos.CENTER
+
+                    label("Bot列表为空,请登录一个Bot")
+
+                    jfxButton("登录") {
+                        buttonType = JFXButton.ButtonType.FLAT
+                    }.action {
+                        // select login pane
+                        mainTabPane.selectionModel.select(3)
+                    }
+                }
+
                 setCellFactory {
                     object : JFXListCell<BotModel>() {
                         var tab: Tab? = null
@@ -65,6 +80,26 @@ class PrimaryView : View() {
                     }
                 }
             }
+        }
+
+        center = vbox {
+
+            jfxTabPane {
+
+                fitToParentHeight()
+
+                tabClosingPolicy = TabPane.TabClosingPolicy.ALL_TABS
+
+                logTab("Main", controller.mainLog, closeable = false)
+
+                fixedTab("Plugins").content = find<PluginsView>().root
+
+                fixedTab("Settings").content = find<SettingsView>().root
+
+                fixedTab("Login").content = find<LoginView>().root
+
+                mainTabPane = this
+            }
 
             // command input
             textfield {
@@ -80,21 +115,6 @@ class PrimaryView : View() {
                 }
             }
         }
-
-        center = jfxTabPane {
-
-            tabClosingPolicy = TabPane.TabClosingPolicy.ALL_TABS
-
-            logTab("Main", controller.mainLog, closeable = false)
-
-            fixedTab("Plugins").content = find<PluginsView>().root
-
-            fixedTab("Settings").content = find<SettingsView>().root
-
-            fixedTab("Login").content = find<LoginView>().root
-
-            mainTabPane = this
-        }
     }
 
     fun Tab.select() = apply {