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