Mods page refined
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
package org.jackhuang.hmcl.ui
|
||||
|
||||
import com.jfoenix.effects.JFXDepthManager
|
||||
import javafx.fxml.FXML
|
||||
import javafx.scene.Node
|
||||
import javafx.scene.control.ScrollPane
|
||||
@@ -46,6 +47,19 @@ class ModController {
|
||||
for (modInfo in modManager.getMods(versionId)) {
|
||||
rootPane.children += ModItem(modInfo) {
|
||||
modManager.removeMods(versionId, modInfo)
|
||||
}.apply {
|
||||
JFXDepthManager.setDepth(this, 1)
|
||||
style += "-fx-background-radius: 2; -fx-background-color: white; -fx-padding: 8;"
|
||||
|
||||
modInfo.activeProperty.addListener { _, _, newValue ->
|
||||
if (newValue)
|
||||
styleClass -= "disabled"
|
||||
else
|
||||
styleClass += "disabled"
|
||||
}
|
||||
|
||||
if (!modInfo.isActive)
|
||||
styleClass += "disabled"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ import javafx.scene.control.Label
|
||||
import javafx.scene.layout.BorderPane
|
||||
import org.jackhuang.hmcl.mod.ModInfo
|
||||
|
||||
class ModItem(info: ModInfo, private val deleteCallback: () -> Unit) : BorderPane() {
|
||||
class ModItem(info: ModInfo, private val deleteCallback: (ModItem) -> Unit) : BorderPane() {
|
||||
@FXML lateinit var lblModFileName: Label
|
||||
@FXML lateinit var lblModAuthor: Label
|
||||
@FXML lateinit var chkEnabled: JFXCheckBox
|
||||
@@ -40,6 +40,6 @@ class ModItem(info: ModInfo, private val deleteCallback: () -> Unit) : BorderPan
|
||||
}
|
||||
|
||||
fun onDelete() {
|
||||
deleteCallback()
|
||||
deleteCallback(this)
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,10 @@
|
||||
-fx-font-family: "Roboto";
|
||||
}
|
||||
|
||||
.disabled Label {
|
||||
-fx-text-fill: gray;
|
||||
}
|
||||
|
||||
.side-menu {
|
||||
-fx-padding: 20.0, 10.0;
|
||||
-fx-font-size: 15.0;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
<right>
|
||||
<JFXButton onMouseClicked="#onDelete" styleClass="toggle-icon4" BorderPane.alignment="CENTER">
|
||||
<graphic>
|
||||
<fx:include source="/assets/svg/delete-black.fxml"/>
|
||||
<fx:include source="/assets/svg/close-black.fxml"/>
|
||||
</graphic>
|
||||
</JFXButton>
|
||||
</right>
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import java.lang.*?>
|
||||
<?import java.util.*?>
|
||||
<?import javafx.scene.*?>
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
|
||||
@@ -10,7 +7,7 @@
|
||||
xmlns:fx="http://javafx.com/fxml"
|
||||
fx:controller="org.jackhuang.hmcl.ui.ModController">
|
||||
<ScrollPane fx:id="scrollPane" fitToWidth="true" fitToHeight="true">
|
||||
<VBox fx:id="rootPane" spacing="10" style="-fx-padding: 10 0 40 0;">
|
||||
<VBox fx:id="rootPane" spacing="10" style="-fx-padding: 20;">
|
||||
|
||||
</VBox>
|
||||
</ScrollPane>
|
||||
|
||||
2
HMCL/src/main/resources/assets/svg/close-black.fxml
Normal file
2
HMCL/src/main/resources/assets/svg/close-black.fxml
Normal file
@@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<javafx.scene.shape.SVGPath fill="black" content="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z" />
|
||||
2
HMCL/src/main/resources/assets/svg/pencil.fxml
Normal file
2
HMCL/src/main/resources/assets/svg/pencil.fxml
Normal file
@@ -0,0 +1,2 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<javafx.scene.shape.SVGPath content="M20.71,4.04C21.1,3.65 21.1,3 20.71,2.63L18.37,0.29C18,-0.1 17.35,-0.1 16.96,0.29L15,2.25L18.75,6M17.75,7L14,3.25L4,13.25V17H7.75L17.75,7Z" />
|
||||
Reference in New Issue
Block a user