fix: 切换语言时theme重复bind导致报错的问题
Some checks failed
Auto Alpha Tag / auto-tag (x64, x64) (push) Has been cancelled
Release / meta (push) Has been cancelled
Release / windows (x64, x64) (push) Has been cancelled
Release / release (push) Has been cancelled

This commit is contained in:
octopus_yan 2024-09-19 12:34:52 +08:00
parent be7e17665f
commit 1b3a4f5569
2 changed files with 0 additions and 7 deletions

View File

@ -1,6 +1,5 @@
package cn.octopusyan.alistgui.config; package cn.octopusyan.alistgui.config;
import atlantafx.base.theme.Theme;
import cn.octopusyan.alistgui.Application; import cn.octopusyan.alistgui.Application;
import cn.octopusyan.alistgui.base.BaseController; import cn.octopusyan.alistgui.base.BaseController;
import cn.octopusyan.alistgui.controller.AboutController; import cn.octopusyan.alistgui.controller.AboutController;
@ -41,7 +40,6 @@ public class Context {
private static final Logger log = LoggerFactory.getLogger(Context.class); private static final Logger log = LoggerFactory.getLogger(Context.class);
private static Scene scene; private static Scene scene;
private static final IntegerProperty currentViewIndex = new SimpleIntegerProperty(0); private static final IntegerProperty currentViewIndex = new SimpleIntegerProperty(0);
private static final ObjectProperty<Theme> theme = new SimpleObjectProperty<>(ConfigManager.theme());
/** /**
* 控制器集合 * 控制器集合
@ -92,10 +90,6 @@ public class Context {
Context.application = application; Context.application = application;
} }
public static ObjectProperty<Theme> themeProperty() {
return theme;
}
// 获取当前所选时区属性 // 获取当前所选时区属性
public static ObjectProperty<Locale> currentLocaleProperty() { public static ObjectProperty<Locale> currentLocaleProperty() {
return currentLocale; return currentLocale;

View File

@ -36,7 +36,6 @@ public class SetupViewModel extends BaseViewModel {
public SetupViewModel() { public SetupViewModel() {
theme.bindBidirectional(Context.themeProperty());
theme.addListener((_, _, newValue) -> ConfigManager.theme(newValue)); theme.addListener((_, _, newValue) -> ConfigManager.theme(newValue));
silentStartup.addListener((_, _, newValue) -> ConfigManager.silentStartup(newValue)); silentStartup.addListener((_, _, newValue) -> ConfigManager.silentStartup(newValue));
autoStart.addListener((_, _, newValue) -> { autoStart.addListener((_, _, newValue) -> {