diff --git a/platform-independent/java/gui/src/main/java/com/lyndir/masterpassword/gui/util/Res.java b/platform-independent/java/gui/src/main/java/com/lyndir/masterpassword/gui/util/Res.java index 2f9e7671..f75a519b 100644 --- a/platform-independent/java/gui/src/main/java/com/lyndir/masterpassword/gui/util/Res.java +++ b/platform-independent/java/gui/src/main/java/com/lyndir/masterpassword/gui/util/Res.java @@ -165,6 +165,10 @@ public abstract class Res { return icon( "media/icon_key.png" ); } + public Icon prefs() { + return icon( "media/prefs.png" ); + } + public Icon avatar(final int index) { return icon( strf( "media/avatar-%d.png", index % avatars() ) ); } diff --git a/platform-independent/java/gui/src/main/java/com/lyndir/masterpassword/gui/view/UserContentPanel.java b/platform-independent/java/gui/src/main/java/com/lyndir/masterpassword/gui/view/UserContentPanel.java index 21714b15..25bb3b2b 100644 --- a/platform-independent/java/gui/src/main/java/com/lyndir/masterpassword/gui/view/UserContentPanel.java +++ b/platform-independent/java/gui/src/main/java/com/lyndir/masterpassword/gui/view/UserContentPanel.java @@ -55,6 +55,8 @@ public class UserContentPanel extends JPanel implements MasterPassword.Listener, "Import a user from a backup file into Master Password." ); private final JButton helpButton = Components.button( Res.icons().help(), event -> showHelp(), "Show information on how to use Master Password." ); + private final JButton prefsButton = Components.button( Res.icons().prefs(), event -> showAppPreferences(), + "Show application preferences." ); private final JPanel userToolbar = Components.panel( BoxLayout.PAGE_AXIS ); private final JPanel siteToolbar = Components.panel( BoxLayout.PAGE_AXIS ); @@ -248,6 +250,17 @@ public class UserContentPanel extends JPanel implements MasterPassword.Listener, "About Master Password", JOptionPane.INFORMATION_MESSAGE ); } + private void showAppPreferences() { + Component checkForUpdates = Components.checkBox("Check For Updates", MPGuiConfig.get().checkForUpdates(), MPGuiConfig.get()::setCheckForUpdates); + + Component stayResident = Components.checkBox(strf("Stay Resident (reactivate with %s+%s)", + InputEvent.getModifiersExText(MPGuiConstants.ui_hotkey.getModifiers()), + KeyEvent.getKeyText(MPGuiConstants.ui_hotkey.getKeyCode())), + MPGuiConfig.get().stayResident(), MPGuiConfig.get()::setStayResident); + + Components.showDialog(this, "Application Preferences", new JOptionPane(Components.panel(BoxLayout.PAGE_AXIS, checkForUpdates, stayResident))); + } + private enum ContentMode { NO_USER, AUTHENTICATE, @@ -274,6 +287,9 @@ public class UserContentPanel extends JPanel implements MasterPassword.Listener, userToolbar.add( Box.createGlue() ); userToolbar.add( helpButton ); + siteToolbar.add(Box.createGlue()); + siteToolbar.add(prefsButton); + add( Box.createGlue() ); add( Components.heading( "Select a user to proceed." ) ); add( Box.createGlue() ); @@ -312,6 +328,9 @@ public class UserContentPanel extends JPanel implements MasterPassword.Listener, userToolbar.add( Box.createGlue() ); userToolbar.add( helpButton ); + siteToolbar.add(Box.createGlue()); + siteToolbar.add(prefsButton); + add( Components.heading( user.getFullName(), SwingConstants.CENTER ) ); add( Components.strut() ); @@ -512,6 +531,8 @@ public class UserContentPanel extends JPanel implements MasterPassword.Listener, siteToolbar.add( editButton ); siteToolbar.add( keyButton ); siteToolbar.add( deleteButton ); + siteToolbar.add(Box.createGlue()); + siteToolbar.add(prefsButton); settingsButton.setEnabled( false ); questionsButton.setEnabled( false ); editButton.setEnabled( false ); @@ -586,16 +607,6 @@ public class UserContentPanel extends JPanel implements MasterPassword.Listener, components.add( Components.checkBox( "Hide Passwords", user.getPreferences().isHidePasswords(), user.getPreferences()::setHidePasswords ) ); - components.add( new JSeparator() ); - - components.add( Components.checkBox( "Check For Updates", - MPGuiConfig.get().checkForUpdates(), MPGuiConfig.get()::setCheckForUpdates ) ); - - components.add( Components.checkBox( strf( "Stay Resident (reactivate with %s+%s)", - InputEvent.getModifiersExText( MPGuiConstants.ui_hotkey.getModifiers() ), - KeyEvent.getKeyText( MPGuiConstants.ui_hotkey.getKeyCode() ) ), - MPGuiConfig.get().stayResident(), MPGuiConfig.get()::setStayResident ) ); - Components.showDialog( this, user.getFullName(), new JOptionPane( Components.panel( BoxLayout.PAGE_AXIS, components.build().toArray( new Component[0] ) ) ) ); } diff --git a/platform-independent/java/gui/src/main/resources/media/prefs.png b/platform-independent/java/gui/src/main/resources/media/prefs.png new file mode 100644 index 00000000..9717aea7 Binary files /dev/null and b/platform-independent/java/gui/src/main/resources/media/prefs.png differ diff --git a/platform-independent/java/gui/src/main/resources/media/prefs@2x.png b/platform-independent/java/gui/src/main/resources/media/prefs@2x.png new file mode 100644 index 00000000..8855bc33 Binary files /dev/null and b/platform-independent/java/gui/src/main/resources/media/prefs@2x.png differ