mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-09-16 07:16:27 -04:00
Profile page title changed to display name
This commit is contained in:
parent
a72d27a431
commit
17d1af181d
@ -487,6 +487,7 @@ public final class Decorator extends StackPane implements TaskExecutorDialogWiza
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setContent(Node content, AnimationProducer animation) {
|
private void setContent(Node content, AnimationProducer animation) {
|
||||||
|
isWizardPageNow = false;
|
||||||
animationHandler.setContent(content, animation);
|
animationHandler.setContent(content, animation);
|
||||||
|
|
||||||
if (content instanceof Region) {
|
if (content instanceof Region) {
|
||||||
@ -510,6 +511,7 @@ public final class Decorator extends StackPane implements TaskExecutorDialogWiza
|
|||||||
|
|
||||||
private String category;
|
private String category;
|
||||||
private Node nowPage;
|
private Node nowPage;
|
||||||
|
private boolean isWizardPageNow;
|
||||||
|
|
||||||
public Node getNowPage() {
|
public Node getNowPage() {
|
||||||
return nowPage;
|
return nowPage;
|
||||||
@ -573,6 +575,7 @@ public final class Decorator extends StackPane implements TaskExecutorDialogWiza
|
|||||||
contentPlaceHolder.getStyleClass().removeAll("gray-background", "white-background");
|
contentPlaceHolder.getStyleClass().removeAll("gray-background", "white-background");
|
||||||
contentPlaceHolder.getStyleClass().add("white-background");
|
contentPlaceHolder.getStyleClass().add("white-background");
|
||||||
setContent(page, nav.getAnimation().getAnimationProducer());
|
setContent(page, nav.getAnimation().getAnimationProducer());
|
||||||
|
isWizardPageNow = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
@ -588,7 +591,7 @@ public final class Decorator extends StackPane implements TaskExecutorDialogWiza
|
|||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private void onBack() {
|
private void onBack() {
|
||||||
if (wizardController.canPrev())
|
if (isWizardPageNow && wizardController.canPrev())
|
||||||
wizardController.onPrev(true);
|
wizardController.onPrev(true);
|
||||||
else
|
else
|
||||||
onCloseNav();
|
onCloseNav();
|
||||||
|
@ -51,15 +51,16 @@ public final class ProfilePage extends StackPane implements DecoratorPage {
|
|||||||
*/
|
*/
|
||||||
public ProfilePage(Profile profile) {
|
public ProfilePage(Profile profile) {
|
||||||
this.profile = profile;
|
this.profile = profile;
|
||||||
|
String profileDisplayName = Optional.ofNullable(profile).map(Profiles::getProfileDisplayName).orElse("");
|
||||||
|
|
||||||
title = new SimpleStringProperty(this, "title",
|
title = new SimpleStringProperty(this, "title",
|
||||||
profile == null ? Main.i18n("profile.new") : Main.i18n("profile") + " - " + profile.getName());
|
profile == null ? Main.i18n("profile.new") : Main.i18n("profile") + " - " + profileDisplayName);
|
||||||
location = new SimpleStringProperty(this, "location",
|
location = new SimpleStringProperty(this, "location",
|
||||||
Optional.ofNullable(profile).map(Profile::getGameDir).map(File::getAbsolutePath).orElse(""));
|
Optional.ofNullable(profile).map(Profile::getGameDir).map(File::getAbsolutePath).orElse(""));
|
||||||
|
|
||||||
FXUtils.loadFXML(this, "/assets/fxml/profile.fxml");
|
FXUtils.loadFXML(this, "/assets/fxml/profile.fxml");
|
||||||
|
|
||||||
txtProfileName.setText(Optional.ofNullable(profile).map(Profiles::getProfileDisplayName).orElse(""));
|
txtProfileName.setText(profileDisplayName);
|
||||||
FXUtils.onChangeAndOperate(txtProfileName.textProperty(), it -> {
|
FXUtils.onChangeAndOperate(txtProfileName.textProperty(), it -> {
|
||||||
btnSave.setDisable(!txtProfileName.validate() || StringUtils.isBlank(getLocation()));
|
btnSave.setDisable(!txtProfileName.validate() || StringUtils.isBlank(getLocation()));
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user