mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-09-17 07:47:57 -04:00
Turn properties in SettingsPage from local variables into fields
This commit is contained in:
parent
357fef8672
commit
088af981df
@ -101,7 +101,10 @@ public final class SettingsPage extends StackPane implements DecoratorPage {
|
|||||||
@FXML
|
@FXML
|
||||||
private Pane proxyPane;
|
private Pane proxyPane;
|
||||||
|
|
||||||
{
|
private ObjectProperty<Proxy.Type> selectedProxyType;
|
||||||
|
private ObjectProperty<EnumBackgroundImage> backgroundType;
|
||||||
|
|
||||||
|
public SettingsPage() {
|
||||||
FXUtils.loadFXML(this, "/assets/fxml/setting.fxml");
|
FXUtils.loadFXML(this, "/assets/fxml/setting.fxml");
|
||||||
|
|
||||||
FXUtils.smoothScrolling(scroll);
|
FXUtils.smoothScrolling(scroll);
|
||||||
@ -148,7 +151,7 @@ public final class SettingsPage extends StackPane implements DecoratorPage {
|
|||||||
chkEnableProxy.selectedProperty().bindBidirectional(CONFIG.hasProxyProperty());
|
chkEnableProxy.selectedProperty().bindBidirectional(CONFIG.hasProxyProperty());
|
||||||
chkProxyAuthentication.selectedProperty().bindBidirectional(CONFIG.hasProxyAuthProperty());
|
chkProxyAuthentication.selectedProperty().bindBidirectional(CONFIG.hasProxyAuthProperty());
|
||||||
|
|
||||||
ObjectProperty<Proxy.Type> selectedProxyType = new SimpleObjectProperty<Proxy.Type>(Proxy.Type.HTTP) {
|
selectedProxyType = new SimpleObjectProperty<Proxy.Type>(Proxy.Type.HTTP) {
|
||||||
{
|
{
|
||||||
invalidated();
|
invalidated();
|
||||||
}
|
}
|
||||||
@ -184,14 +187,14 @@ public final class SettingsPage extends StackPane implements DecoratorPage {
|
|||||||
FXUtils.installTooltip(btnUpdate, i18n("update.tooltip"));
|
FXUtils.installTooltip(btnUpdate, i18n("update.tooltip"));
|
||||||
checkUpdate();
|
checkUpdate();
|
||||||
|
|
||||||
// background
|
// ==== Background ====
|
||||||
backgroundItem.loadChildren(Collections.singletonList(
|
backgroundItem.loadChildren(Collections.singletonList(
|
||||||
backgroundItem.createChildren(i18n("launcher.background.default"), EnumBackgroundImage.DEFAULT)
|
backgroundItem.createChildren(i18n("launcher.background.default"), EnumBackgroundImage.DEFAULT)
|
||||||
));
|
));
|
||||||
backgroundItem.setCustomUserData(EnumBackgroundImage.CUSTOM);
|
backgroundItem.setCustomUserData(EnumBackgroundImage.CUSTOM);
|
||||||
backgroundItem.getTxtCustom().textProperty().bindBidirectional(CONFIG.backgroundImageProperty());
|
backgroundItem.getTxtCustom().textProperty().bindBidirectional(CONFIG.backgroundImageProperty());
|
||||||
|
|
||||||
ObjectProperty<EnumBackgroundImage> backgroundType = new SimpleObjectProperty<EnumBackgroundImage>(EnumBackgroundImage.DEFAULT) {
|
backgroundType = new SimpleObjectProperty<EnumBackgroundImage>(EnumBackgroundImage.DEFAULT) {
|
||||||
{
|
{
|
||||||
invalidated();
|
invalidated();
|
||||||
}
|
}
|
||||||
@ -211,8 +214,9 @@ public final class SettingsPage extends StackPane implements DecoratorPage {
|
|||||||
new When(backgroundType.isEqualTo(EnumBackgroundImage.DEFAULT))
|
new When(backgroundType.isEqualTo(EnumBackgroundImage.DEFAULT))
|
||||||
.then(i18n("launcher.background.default"))
|
.then(i18n("launcher.background.default"))
|
||||||
.otherwise(CONFIG.backgroundImageProperty()));
|
.otherwise(CONFIG.backgroundImageProperty()));
|
||||||
|
// ====
|
||||||
|
|
||||||
// theme
|
// ==== Theme ====
|
||||||
JFXColorPicker picker = new JFXColorPicker(Color.web(CONFIG.getTheme().getColor()), null);
|
JFXColorPicker picker = new JFXColorPicker(Color.web(CONFIG.getTheme().getColor()), null);
|
||||||
picker.setCustomColorText(i18n("color.custom"));
|
picker.setCustomColorText(i18n("color.custom"));
|
||||||
picker.setRecentColorsText(i18n("color.recent"));
|
picker.setRecentColorsText(i18n("color.recent"));
|
||||||
@ -224,6 +228,7 @@ public final class SettingsPage extends StackPane implements DecoratorPage {
|
|||||||
});
|
});
|
||||||
themeColorPickerContainer.getChildren().setAll(picker);
|
themeColorPickerContainer.getChildren().setAll(picker);
|
||||||
Platform.runLater(() -> JFXDepthManager.setDepth(picker, 0));
|
Platform.runLater(() -> JFXDepthManager.setDepth(picker, 0));
|
||||||
|
// ====
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTitle() {
|
public String getTitle() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user