Upgrade message
This commit is contained in:
@@ -64,7 +64,7 @@ public class AccountPage extends StackPane implements DecoratorPage {
|
|||||||
FXUtils.loadFXML(this, "/assets/fxml/account.fxml");
|
FXUtils.loadFXML(this, "/assets/fxml/account.fxml");
|
||||||
|
|
||||||
if (account instanceof AuthlibInjectorAccount) {
|
if (account instanceof AuthlibInjectorAccount) {
|
||||||
Task.ofResult("serverName", () -> Accounts.getAuthlibInjectorServerName(((AuthlibInjectorAccount) account).getServerBaseURL()))
|
Accounts.getAuthlibInjectorServerNameAsync((AuthlibInjectorAccount) account)
|
||||||
.subscribe(Schedulers.javafx(), variables -> lblServer.setText(variables.get("serverName")));
|
.subscribe(Schedulers.javafx(), variables -> lblServer.setText(variables.get("serverName")));
|
||||||
} else {
|
} else {
|
||||||
componentList.removeChildren(paneServer);
|
componentList.removeChildren(paneServer);
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ public final class Controllers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void showUpdate() {
|
public static void showUpdate() {
|
||||||
getDecorator().showUpdate();
|
getLeftPaneController().showUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void shutdown() {
|
public static void shutdown() {
|
||||||
|
|||||||
@@ -127,8 +127,6 @@ public final class Decorator extends StackPane implements TaskExecutorDialogWiza
|
|||||||
@FXML
|
@FXML
|
||||||
private JFXButton btnClose;
|
private JFXButton btnClose;
|
||||||
@FXML
|
@FXML
|
||||||
private HBox updatePane;
|
|
||||||
@FXML
|
|
||||||
private HBox navLeft;
|
private HBox navLeft;
|
||||||
|
|
||||||
public Decorator(Stage primaryStage, Node mainPage, String title) {
|
public Decorator(Stage primaryStage, Node mainPage, String title) {
|
||||||
@@ -143,9 +141,6 @@ public final class Decorator extends StackPane implements TaskExecutorDialogWiza
|
|||||||
|
|
||||||
FXUtils.loadFXML(this, "/assets/fxml/decorator.fxml");
|
FXUtils.loadFXML(this, "/assets/fxml/decorator.fxml");
|
||||||
|
|
||||||
updatePane.setCursor(Cursor.HAND);
|
|
||||||
updatePane.setOnMouseClicked(event -> Launcher.UPDATE_CHECKER.checkOutdate());
|
|
||||||
|
|
||||||
primaryStage.initStyle(StageStyle.UNDECORATED);
|
primaryStage.initStyle(StageStyle.UNDECORATED);
|
||||||
btnClose.setGraphic(close);
|
btnClose.setGraphic(close);
|
||||||
btnMin.setGraphic(minus);
|
btnMin.setGraphic(minus);
|
||||||
@@ -474,10 +469,6 @@ public final class Decorator extends StackPane implements TaskExecutorDialogWiza
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showUpdate() {
|
|
||||||
updatePane.setVisible(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void showCloseNavButton() {
|
private void showCloseNavButton() {
|
||||||
navLeft.getChildren().add(closeNavButton);
|
navLeft.getChildren().add(closeNavButton);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import javafx.scene.control.Tooltip;
|
|||||||
import javafx.scene.image.Image;
|
import javafx.scene.image.Image;
|
||||||
import javafx.scene.input.MouseButton;
|
import javafx.scene.input.MouseButton;
|
||||||
import javafx.scene.layout.VBox;
|
import javafx.scene.layout.VBox;
|
||||||
|
import javafx.scene.paint.Color;
|
||||||
import org.jackhuang.hmcl.Launcher;
|
import org.jackhuang.hmcl.Launcher;
|
||||||
import org.jackhuang.hmcl.auth.Account;
|
import org.jackhuang.hmcl.auth.Account;
|
||||||
import org.jackhuang.hmcl.auth.authlibinjector.AuthlibInjectorAccount;
|
import org.jackhuang.hmcl.auth.authlibinjector.AuthlibInjectorAccount;
|
||||||
@@ -55,11 +56,17 @@ public final class LeftPaneController {
|
|||||||
private final AdvancedListBox leftPane;
|
private final AdvancedListBox leftPane;
|
||||||
private final VBox profilePane = new VBox();
|
private final VBox profilePane = new VBox();
|
||||||
private final VBox accountPane = new VBox();
|
private final VBox accountPane = new VBox();
|
||||||
|
private final IconedItem launcherSettingsItem;
|
||||||
private final VersionListItem missingAccountItem = new VersionListItem(Launcher.i18n("account.missing"), Launcher.i18n("message.unknown"));
|
private final VersionListItem missingAccountItem = new VersionListItem(Launcher.i18n("account.missing"), Launcher.i18n("message.unknown"));
|
||||||
|
|
||||||
public LeftPaneController(AdvancedListBox leftPane) {
|
public LeftPaneController(AdvancedListBox leftPane) {
|
||||||
this.leftPane = leftPane;
|
this.leftPane = leftPane;
|
||||||
|
|
||||||
|
this.launcherSettingsItem = Lang.apply(new IconedItem(SVG.gear(Theme.blackFillBinding(), 20, 20), Launcher.i18n("settings.launcher")), iconedItem -> {
|
||||||
|
iconedItem.prefWidthProperty().bind(leftPane.widthProperty());
|
||||||
|
iconedItem.setOnMouseClicked(e -> Controllers.navigate(Controllers.getSettingsPage()));
|
||||||
|
});
|
||||||
|
|
||||||
leftPane
|
leftPane
|
||||||
.add(new ClassTitle(Launcher.i18n("account").toUpperCase(), Lang.apply(new JFXButton(), button -> {
|
.add(new ClassTitle(Launcher.i18n("account").toUpperCase(), Lang.apply(new JFXButton(), button -> {
|
||||||
button.setGraphic(SVG.plus(Theme.blackFillBinding(), 10, 10));
|
button.setGraphic(SVG.plus(Theme.blackFillBinding(), 10, 10));
|
||||||
@@ -68,10 +75,7 @@ public final class LeftPaneController {
|
|||||||
})))
|
})))
|
||||||
.add(accountPane)
|
.add(accountPane)
|
||||||
.startCategory(Launcher.i18n("launcher").toUpperCase())
|
.startCategory(Launcher.i18n("launcher").toUpperCase())
|
||||||
.add(Lang.apply(new IconedItem(SVG.gear(Theme.blackFillBinding(), 20, 20), Launcher.i18n("settings.launcher")), iconedItem -> {
|
.add(launcherSettingsItem)
|
||||||
iconedItem.prefWidthProperty().bind(leftPane.widthProperty());
|
|
||||||
iconedItem.setOnMouseClicked(e -> Controllers.navigate(Controllers.getSettingsPage()));
|
|
||||||
}))
|
|
||||||
.add(new ClassTitle(Launcher.i18n("profile.title").toUpperCase(), Lang.apply(new JFXButton(), button -> {
|
.add(new ClassTitle(Launcher.i18n("profile.title").toUpperCase(), Lang.apply(new JFXButton(), button -> {
|
||||||
button.setGraphic(SVG.plus(Theme.blackFillBinding(), 10, 10));
|
button.setGraphic(SVG.plus(Theme.blackFillBinding(), 10, 10));
|
||||||
button.getStyleClass().add("toggle-icon-tiny");
|
button.getStyleClass().add("toggle-icon-tiny");
|
||||||
@@ -199,6 +203,11 @@ public final class LeftPaneController {
|
|||||||
Platform.runLater(() -> accountPane.getChildren().setAll(list));
|
Platform.runLater(() -> accountPane.getChildren().setAll(list));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void showUpdate() {
|
||||||
|
launcherSettingsItem.setText(Launcher.i18n("update.found"));
|
||||||
|
launcherSettingsItem.setTextFill(Color.RED);
|
||||||
|
}
|
||||||
|
|
||||||
private boolean checkedModpack = false;
|
private boolean checkedModpack = false;
|
||||||
|
|
||||||
private void onRefreshedVersions(RefreshedVersionsEvent event) {
|
private void onRefreshedVersions(RefreshedVersionsEvent event) {
|
||||||
|
|||||||
@@ -21,21 +21,19 @@ import javafx.geometry.Pos;
|
|||||||
import javafx.scene.Node;
|
import javafx.scene.Node;
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
import javafx.scene.layout.HBox;
|
import javafx.scene.layout.HBox;
|
||||||
|
import javafx.scene.paint.Paint;
|
||||||
|
|
||||||
public class IconedItem extends RipplerContainer {
|
public class IconedItem extends RipplerContainer {
|
||||||
private final Node icon;
|
|
||||||
private final String text;
|
|
||||||
|
|
||||||
public IconedItem(Node icon, String text) {
|
public IconedItem(Node icon, String text) {
|
||||||
super(createHBox(icon, text));
|
super(createHBox(icon, text));
|
||||||
this.icon = icon;
|
|
||||||
this.text = text;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static HBox createHBox(Node icon, String text) {
|
private static HBox createHBox(Node icon, String text) {
|
||||||
HBox hBox = new HBox();
|
HBox hBox = new HBox();
|
||||||
icon.setMouseTransparent(true);
|
icon.setMouseTransparent(true);
|
||||||
Label textLabel = new Label(text);
|
Label textLabel = new Label(text);
|
||||||
|
textLabel.setId("label");
|
||||||
textLabel.setAlignment(Pos.CENTER);
|
textLabel.setAlignment(Pos.CENTER);
|
||||||
textLabel.setMouseTransparent(true);
|
textLabel.setMouseTransparent(true);
|
||||||
hBox.getChildren().addAll(icon, textLabel);
|
hBox.getChildren().addAll(icon, textLabel);
|
||||||
@@ -43,4 +41,12 @@ public class IconedItem extends RipplerContainer {
|
|||||||
hBox.setAlignment(Pos.CENTER_LEFT);
|
hBox.setAlignment(Pos.CENTER_LEFT);
|
||||||
return hBox;
|
return hBox;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setText(String text) {
|
||||||
|
((Label) lookup("#label")).setText(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTextFill(Paint paint) {
|
||||||
|
((Label) lookup("#label")).setTextFill(paint);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,20 +26,9 @@
|
|||||||
<StackPane minWidth="200" maxWidth="200" styleClass="jfx-decorator-content-container">
|
<StackPane minWidth="200" maxWidth="200" styleClass="jfx-decorator-content-container">
|
||||||
<BorderPane fx:id="leftRootPane">
|
<BorderPane fx:id="leftRootPane">
|
||||||
<center>
|
<center>
|
||||||
<BorderPane styleClass="gray-background">
|
<StackPane styleClass="gray-background">
|
||||||
<center>
|
|
||||||
<AdvancedListBox fx:id="leftPane"/>
|
<AdvancedListBox fx:id="leftPane"/>
|
||||||
</center>
|
</StackPane>
|
||||||
<bottom>
|
|
||||||
<BorderPane fx:id="menuBottomBar">
|
|
||||||
<left>
|
|
||||||
<HBox fx:id="updatePane" visible="false" style="-fx-background-color: red;" alignment="CENTER_LEFT">
|
|
||||||
<Label text="%update.found" style="-fx-text-fill: white; -fx-font-size: 16px;" />
|
|
||||||
</HBox>
|
|
||||||
</left>
|
|
||||||
</BorderPane>
|
|
||||||
</bottom>
|
|
||||||
</BorderPane>
|
|
||||||
</center>
|
</center>
|
||||||
<right>
|
<right>
|
||||||
<Rectangle height="${leftRootPane.height}" width="1" fill="gray"/>
|
<Rectangle height="${leftRootPane.height}" width="1" fill="gray"/>
|
||||||
|
|||||||
Reference in New Issue
Block a user