Skip to content

Commit

Permalink
settings reset functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
subhra74 committed Apr 19, 2020
1 parent 5681ebd commit fbf5a24
Showing 1 changed file with 17 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@ public SettingsDialog(JFrame window) {
super.setVisible(false);
});

btnReset.addActionListener(e -> {
loadSettings(new Settings());
JOptionPane.showMessageDialog(this, "Settings have been reset,\nplease save and restart the app");
});

bottomBox.add(btnReset);
bottomBox.add(Box.createHorizontalGlue());
bottomBox.add(btnCancel);
Expand Down Expand Up @@ -587,9 +592,20 @@ public boolean showDialog(JFrame window) {
}

public boolean showDialog(JFrame window, SettingsPageName page) {
this.setLocationRelativeTo(window);
Settings settings = App.getGlobalSettings();

this.setLocationRelativeTo(window);
if (page != null) {
navList.setSelectedIndex(page.index);
}

loadSettings(settings);

super.setVisible(true);
return false;
}

private void loadSettings(Settings settings) {
this.chkAudibleBell.setSelected(settings.isTerminalBell());
this.chkPuttyLikeCopyPaste.setSelected(settings.isPuttyLikeCopyPaste());

Expand Down Expand Up @@ -671,15 +687,9 @@ public boolean showDialog(JFrame window, SettingsPageName page) {
this.editorModel.clear();
this.editorModel.addEntries(settings.getEditors());

if (page != null) {
navList.setSelectedIndex(page.index);
}

this.chkUseManualScaling.setSelected(settings.isManualScaling());
this.spScaleValue.setValue(settings.getUiScaling());

super.setVisible(true);
return false;
}

private String[] getTerminalFonts() {
Expand Down

0 comments on commit fbf5a24

Please sign in to comment.