Commit 0abb51c8 authored by Skylot's avatar Skylot

fix(gui): on settings reset run upgrade method

parent 557667b1
...@@ -47,7 +47,10 @@ public class JadxSettings extends JadxCLIArgs { ...@@ -47,7 +47,10 @@ public class JadxSettings extends JadxCLIArgs {
private Map<String, WindowLocation> windowPos = new HashMap<>(); private Map<String, WindowLocation> windowPos = new HashMap<>();
public JadxSettings() { public static JadxSettings makeDefault() {
JadxSettings jadxSettings = new JadxSettings();
jadxSettings.fixOnLoad();
return jadxSettings;
} }
public void sync() { public void sync() {
......
...@@ -46,10 +46,13 @@ public class JadxSettingsAdapter { ...@@ -46,10 +46,13 @@ public class JadxSettingsAdapter {
JadxSettings settings = fromString(jsonSettings); JadxSettings settings = fromString(jsonSettings);
if (settings == null) { if (settings == null) {
LOG.debug("Created new settings."); LOG.debug("Created new settings.");
settings = new JadxSettings(); settings = JadxSettings.makeDefault();
} } else {
settings.fixOnLoad(); settings.fixOnLoad();
}
if (LOG.isDebugEnabled()) {
LOG.debug("Loaded settings: {}", makeString(settings)); LOG.debug("Loaded settings: {}", makeString(settings));
}
return settings; return settings;
} catch (Exception e) { } catch (Exception e) {
LOG.error("Error load settings", e); LOG.error("Error load settings", e);
......
...@@ -12,8 +12,8 @@ import org.slf4j.Logger; ...@@ -12,8 +12,8 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import say.swing.JFontChooser; import say.swing.JFontChooser;
import jadx.gui.ui.codearea.EditorTheme;
import jadx.gui.ui.MainWindow; import jadx.gui.ui.MainWindow;
import jadx.gui.ui.codearea.EditorTheme;
import jadx.gui.utils.LangLocale; import jadx.gui.utils.LangLocale;
import jadx.gui.utils.NLS; import jadx.gui.utils.NLS;
...@@ -94,7 +94,7 @@ public class JadxSettingsWindow extends JDialog { ...@@ -94,7 +94,7 @@ public class JadxSettingsWindow extends JDialog {
NLS.str("preferences.reset_title"), NLS.str("preferences.reset_title"),
JOptionPane.YES_NO_OPTION); JOptionPane.YES_NO_OPTION);
if (res == JOptionPane.YES_OPTION) { if (res == JOptionPane.YES_OPTION) {
String defaults = JadxSettingsAdapter.makeString(new JadxSettings()); String defaults = JadxSettingsAdapter.makeString(JadxSettings.makeDefault());
JadxSettingsAdapter.fill(settings, defaults); JadxSettingsAdapter.fill(settings, defaults);
getContentPane().removeAll(); getContentPane().removeAll();
initUI(); initUI();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment