fix: add menu item to reload all gamelist views (shift+F5)

This commit is contained in:
lantzelot-swe 2022-10-24 20:22:26 +02:00
parent 9a58494d2f
commit c5c426a34f
1 changed files with 23 additions and 3 deletions

View File

@ -85,6 +85,7 @@ public class MenuManager
private JMenuItem exportFLItem;
private JMenuItem exportSavedStatesItem;
private JMenuItem refreshItem;
private JMenuItem refreshAllItem;
private JMenuItem toggleFavorite1Item;
private JMenuItem toggleFavorite2Item;
@ -199,6 +200,7 @@ public class MenuManager
fileMenu.add(exportMenu);
fileMenu.addSeparator();
fileMenu.add(getRefreshItem());
fileMenu.add(getRefreshAllItem());
fileMenu.addSeparator();
fileMenu.add(getPreferencesMenuItem());
fileMenu.addSeparator();
@ -481,6 +483,16 @@ public class MenuManager
return refreshItem;
}
private JMenuItem getRefreshAllItem()
{
refreshAllItem = new JMenuItem("Reload all gamelist views");
KeyStroke keyStrokeToReloadGameViews = KeyStroke.getKeyStroke(KeyEvent.VK_F5, InputEvent.SHIFT_DOWN_MASK);
refreshAllItem.setAccelerator(keyStrokeToReloadGameViews);
refreshAllItem.setMnemonic('g');
refreshAllItem.addActionListener(e -> reloadAll());
return refreshAllItem;
}
private JMenuItem getExitItem()
{
exitItem = new JMenuItem("Exit");
@ -776,7 +788,8 @@ public class MenuManager
editViewTagItem.addActionListener(e -> {
if (!mainWindow.getMainPanel().isNoGameSelected())
{
String initialValue = mainWindow.getMainPanel().isSingleGameSelected() ? uiModel.getInfoModel().getViewTag() : "";
String initialValue =
mainWindow.getMainPanel().isSingleGameSelected() ? uiModel.getInfoModel().getViewTag() : "";
String message = mainWindow.getMainPanel().isSingleGameSelected()
? "Enter the view tag to set for " + uiModel.getInfoModel().getTitle()
: "Enter the view tag to set for the selected games";
@ -1201,6 +1214,13 @@ public class MenuManager
this.mainWindow.reloadCurrentGameView();
}
private void reloadAll()
{
//Refresh game views
uiModel.reloadGameViews();
this.mainWindow.refreshMenuAndUI();
}
private void backupDb()
{
BackupProgressDialog dialog = new BackupProgressDialog(this.mainWindow);