Merge remote-tracking branch 'origin/master'

This commit is contained in:
jiahua.liu 2020-03-28 22:51:59 +08:00
commit 3c35d3826e
9 changed files with 64 additions and 29 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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,18 +47,33 @@ class PrimaryStyleSheet : BaseStyleSheet() {
jfxListView {
// 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
}
}
jfxListCell {
backgroundColor += c(100, 100, 100, 0.4)
backgroundRadius += box(5.px)
textFill = c(fontColor)
fontWeight = FontWeight.BOLD
textFill = c(fontColor)
fontWeight = FontWeight.BOLD
}
}
textField {
}
}
}

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 {