mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 18:58:00 +00:00
update prefs
This commit is contained in:
@@ -35,7 +35,7 @@ import javax.swing.SwingConstants;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.UIManager;
|
||||
|
||||
import forge.localinstance.properties.ForgePreferences;
|
||||
import forge.gui.GuiBase;
|
||||
import forge.localinstance.properties.ForgePreferences.FPref;
|
||||
import forge.localinstance.skin.FSkinProp;
|
||||
import forge.toolbox.FProgressBar;
|
||||
@@ -78,8 +78,7 @@ public class SplashFrame extends JFrame {
|
||||
*/
|
||||
public SplashFrame() {
|
||||
super();
|
||||
final ForgePreferences prefs = new ForgePreferences();
|
||||
FSkin.loadLight(prefs.getPref(FPref.UI_SKIN), true);
|
||||
FSkin.loadLight(GuiBase.getForgePrefs().getPref(FPref.UI_SKIN), true);
|
||||
|
||||
try {
|
||||
SwingUtilities.invokeAndWait(new Runnable() {
|
||||
|
||||
@@ -105,7 +105,6 @@ public class Forge implements ApplicationListener {
|
||||
public static boolean isTabletDevice = false;
|
||||
public static String locale = "en-US";
|
||||
public Assets assets;
|
||||
private ForgePreferences forgePreferences;
|
||||
public static boolean hdbuttons = false;
|
||||
public static boolean hdstart = false;
|
||||
public static boolean isPortraitMode = false;
|
||||
@@ -148,9 +147,7 @@ public class Forge implements ApplicationListener {
|
||||
}
|
||||
|
||||
private ForgePreferences getForgePreferences() {
|
||||
if (forgePreferences == null)
|
||||
forgePreferences = new ForgePreferences();
|
||||
return forgePreferences;
|
||||
return GuiBase.getForgePrefs();
|
||||
}
|
||||
public static Localizer getLocalizer() {
|
||||
if (localizer == null)
|
||||
|
||||
@@ -16,7 +16,6 @@ import forge.localinstance.properties.ForgeConstants;
|
||||
import forge.localinstance.properties.ForgePreferences;
|
||||
import forge.localinstance.properties.ForgePreferences.FPref;
|
||||
import forge.localinstance.skin.FSkinProp;
|
||||
import forge.model.FModel;
|
||||
import forge.screens.LoadingOverlay;
|
||||
import forge.screens.SplashScreen;
|
||||
import forge.screens.TransitionScreen;
|
||||
@@ -43,11 +42,10 @@ public class FSkin {
|
||||
}
|
||||
|
||||
public static void changeSkin(final String skinName) {
|
||||
final ForgePreferences prefs = FModel.getPreferences();
|
||||
if (skinName.equals(prefs.getPref(FPref.UI_SKIN))) { return; }
|
||||
if (skinName.equals(GuiBase.getForgePrefs().getPref(FPref.UI_SKIN))) { return; }
|
||||
|
||||
//save skin preference
|
||||
saveSkinName(prefs, skinName);
|
||||
saveSkinName(GuiBase.getForgePrefs(), skinName);
|
||||
|
||||
Forge.setTransitionScreen(new TransitionScreen(() -> FThreads.invokeInBackgroundThread(() -> FThreads.invokeInEdtLater(() -> {
|
||||
final LoadingOverlay loader = new LoadingOverlay(Forge.getLocalizer().getMessageorUseDefault("lblRestartInFewSeconds", "Forge will restart after a few seconds..."), true);
|
||||
@@ -102,7 +100,7 @@ public class FSkin {
|
||||
FSkinFont.deleteCachedFiles();
|
||||
//use default skin if valid
|
||||
preferredDir = def;
|
||||
saveSkinName(FModel.getPreferences(), "Default");
|
||||
saveSkinName(GuiBase.getForgePrefs(), "Default");
|
||||
} else {
|
||||
useFallbackDir();
|
||||
}
|
||||
|
||||
@@ -14,9 +14,15 @@ public class GuiBase {
|
||||
private static int androidAPI = 0;
|
||||
private static int deviceRAM = 0;
|
||||
private static boolean usingAppDirectory = false;
|
||||
private static ForgePreferences forgePrefs;
|
||||
|
||||
public static IGuiBase getInterface() { return guiInterface; }
|
||||
public static void setInterface(IGuiBase i0) { guiInterface = i0; }
|
||||
public static ForgePreferences getForgePrefs() {
|
||||
if (forgePrefs == null)
|
||||
forgePrefs = new ForgePreferences();
|
||||
return forgePrefs;
|
||||
}
|
||||
|
||||
public static void setIsAndroid(boolean value) { isAndroidport = value; }
|
||||
public static boolean isAndroid() { return isAndroidport; }
|
||||
|
||||
@@ -123,7 +123,7 @@ public final class FModel {
|
||||
// Instantiate preferences: quest and regular
|
||||
// Preferences are initialized first so that the splash screen can be translated.
|
||||
try {
|
||||
preferences = new ForgePreferences();
|
||||
preferences = GuiBase.getForgePrefs();
|
||||
if (adjustPrefs != null) {
|
||||
adjustPrefs.apply(preferences);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user