core: option for control escaping of unicode characters (#103)
This commit is contained in:
@@ -30,7 +30,7 @@ public class JadxGUI {
|
||||
}
|
||||
});
|
||||
} catch (Throwable e) {
|
||||
LOG.error("Error: {}", e.getMessage());
|
||||
LOG.error("Error: {}", e.getMessage(), e);
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -165,6 +165,10 @@ public class JadxSettings extends JadxCLIArgs {
|
||||
this.deobfuscationUseSourceNameAsAlias = useSourceNameAsAlias;
|
||||
}
|
||||
|
||||
public void setEscapeUnicode(boolean escapeUnicode) {
|
||||
this.escapeUnicode = escapeUnicode;
|
||||
}
|
||||
|
||||
public boolean isUseFastSearch() {
|
||||
return false;
|
||||
// return useFastSearch;
|
||||
|
||||
@@ -67,6 +67,8 @@ public class JadxSettingsWindow extends JDialog {
|
||||
panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS));
|
||||
panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
|
||||
panel.add(makeDeobfuscationGroup());
|
||||
panel.add(makeDecompilationGroup());
|
||||
panel.add(makeEditorGroup());
|
||||
panel.add(makeOtherGroup());
|
||||
|
||||
JButton saveBtn = new JButton(NLS.str("preferences.save"));
|
||||
@@ -179,15 +181,29 @@ public class JadxSettingsWindow extends JDialog {
|
||||
return deobfGroup;
|
||||
}
|
||||
|
||||
private SettingsGroup makeOtherGroup() {
|
||||
JCheckBox update = new JCheckBox();
|
||||
update.setSelected(settings.isCheckForUpdates());
|
||||
update.addItemListener(new ItemListener() {
|
||||
public void itemStateChanged(ItemEvent e) {
|
||||
settings.setCheckForUpdates(e.getStateChange() == ItemEvent.SELECTED);
|
||||
private SettingsGroup makeEditorGroup() {
|
||||
JButton fontBtn = new JButton(NLS.str("preferences.select_font"));
|
||||
fontBtn.addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
JFontChooser fontChooser = new JFontChooser();
|
||||
fontChooser.setSelectedFont(settings.getFont());
|
||||
int result = fontChooser.showDialog(JadxSettingsWindow.this);
|
||||
if (result == JFontChooser.OK_OPTION) {
|
||||
Font font = fontChooser.getSelectedFont();
|
||||
LOG.info("Selected Font : {}", font);
|
||||
settings.setFont(font);
|
||||
mainWindow.updateFont(font);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
SettingsGroup other = new SettingsGroup(NLS.str("preferences.editor"));
|
||||
other.addRow(NLS.str("preferences.font"), fontBtn);
|
||||
return other;
|
||||
}
|
||||
|
||||
private SettingsGroup makeDecompilationGroup() {
|
||||
JCheckBox fallback = new JCheckBox();
|
||||
fallback.setSelected(settings.isFallbackMode());
|
||||
fallback.addItemListener(new ItemListener() {
|
||||
@@ -224,6 +240,42 @@ public class JadxSettingsWindow extends JDialog {
|
||||
}
|
||||
});
|
||||
|
||||
JCheckBox autoStartJobs = new JCheckBox();
|
||||
autoStartJobs.setSelected(settings.isAutoStartJobs());
|
||||
autoStartJobs.addItemListener(new ItemListener() {
|
||||
public void itemStateChanged(ItemEvent e) {
|
||||
settings.setAutoStartJobs(e.getStateChange() == ItemEvent.SELECTED);
|
||||
}
|
||||
});
|
||||
|
||||
JCheckBox escapeUnicode = new JCheckBox();
|
||||
escapeUnicode.setSelected(settings.escapeUnicode());
|
||||
escapeUnicode.addItemListener(new ItemListener() {
|
||||
public void itemStateChanged(ItemEvent e) {
|
||||
settings.setEscapeUnicode(e.getStateChange() == ItemEvent.SELECTED);
|
||||
needReload();
|
||||
}
|
||||
});
|
||||
|
||||
SettingsGroup other = new SettingsGroup(NLS.str("preferences.decompile"));
|
||||
other.addRow(NLS.str("preferences.threads"), threadsCount);
|
||||
other.addRow(NLS.str("preferences.start_jobs"), autoStartJobs);
|
||||
other.addRow(NLS.str("preferences.showInconsistentCode"), showInconsistentCode);
|
||||
other.addRow(NLS.str("preferences.escapeUnicode"), escapeUnicode);
|
||||
other.addRow(NLS.str("preferences.fallback"), fallback);
|
||||
other.addRow(NLS.str("preferences.skipResourcesDecode"), resourceDecode);
|
||||
return other;
|
||||
}
|
||||
|
||||
private SettingsGroup makeOtherGroup() {
|
||||
JCheckBox update = new JCheckBox();
|
||||
update.setSelected(settings.isCheckForUpdates());
|
||||
update.addItemListener(new ItemListener() {
|
||||
public void itemStateChanged(ItemEvent e) {
|
||||
settings.setCheckForUpdates(e.getStateChange() == ItemEvent.SELECTED);
|
||||
}
|
||||
});
|
||||
|
||||
JCheckBox cfg = new JCheckBox();
|
||||
cfg.setSelected(settings.isCFGOutput());
|
||||
cfg.addItemListener(new ItemListener() {
|
||||
@@ -242,30 +294,6 @@ public class JadxSettingsWindow extends JDialog {
|
||||
}
|
||||
});
|
||||
|
||||
JButton fontBtn = new JButton(NLS.str("preferences.select_font"));
|
||||
fontBtn.addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
JFontChooser fontChooser = new JFontChooser();
|
||||
fontChooser.setSelectedFont(settings.getFont());
|
||||
int result = fontChooser.showDialog(JadxSettingsWindow.this);
|
||||
if (result == JFontChooser.OK_OPTION) {
|
||||
Font font = fontChooser.getSelectedFont();
|
||||
LOG.info("Selected Font : {}", font);
|
||||
settings.setFont(font);
|
||||
mainWindow.updateFont(font);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
JCheckBox autoStartJobs = new JCheckBox();
|
||||
autoStartJobs.setSelected(settings.isAutoStartJobs());
|
||||
autoStartJobs.addItemListener(new ItemListener() {
|
||||
public void itemStateChanged(ItemEvent e) {
|
||||
settings.setAutoStartJobs(e.getStateChange() == ItemEvent.SELECTED);
|
||||
}
|
||||
});
|
||||
|
||||
JCheckBox fastSearch = new JCheckBox();
|
||||
fastSearch.setEnabled(false);
|
||||
fastSearch.setSelected(settings.isUseFastSearch());
|
||||
@@ -277,15 +305,9 @@ public class JadxSettingsWindow extends JDialog {
|
||||
|
||||
SettingsGroup other = new SettingsGroup(NLS.str("preferences.other"));
|
||||
other.addRow(NLS.str("preferences.check_for_updates"), update);
|
||||
other.addRow(NLS.str("preferences.threads"), threadsCount);
|
||||
other.addRow(NLS.str("preferences.fallback"), fallback);
|
||||
other.addRow(NLS.str("preferences.showInconsistentCode"), showInconsistentCode);
|
||||
other.addRow(NLS.str("preferences.skipResourcesDecode"), resourceDecode);
|
||||
other.addRow(NLS.str("preferences.cfg"), cfg);
|
||||
other.addRow(NLS.str("preferences.raw_cfg"), rawCfg);
|
||||
other.addRow(NLS.str("preferences.font"), fontBtn);
|
||||
other.addRow(NLS.str("preferences.fast_search"), fastSearch);
|
||||
other.addRow(NLS.str("preferences.start_jobs"), autoStartJobs);
|
||||
return other;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user