enhanced launcher context menu with direct Game properties dialog link

This commit is contained in:
Thomas Jentzsch 2022-02-16 21:54:20 +01:00
parent 5b5eccf28f
commit e537eaffd5
3 changed files with 68 additions and 39 deletions

View File

@ -2290,6 +2290,11 @@
<td>Control + F</td> <td>Control + F</td>
<td>Control + F</td> <td>Control + F</td>
</tr> </tr>
<tr>
<td>Open Game properties dialog</td>
<td>Control + G</td>
<td>Control + G</td>
</tr>
<tr> <tr>
<td>Open Power-On options dialog</td> <td>Open Power-On options dialog</td>
<td>Control + P</td> <td>Control + P</td>
@ -4317,18 +4322,22 @@
<p><ul> <p><ul>
<li> <li>
<p><b>Remove from recently played/most popular</b> (or 'Control + X'): <p><b>Remove from recently played/most popular</b> (or 'Control + X'):
This option removes the selected ROM from the current folder.</p> Removes the selected ROM from the current virtual folder.</p>
</li> </li>
<li> <li>
<p><b>Add to/remove from favorites</b> (or 'Control + F'): This option <p><b>Add to/remove from favorites</b> (or 'Control + F'): Toggles the
toggles the favorite state of the selected ROM or directory.</p> favorite state of the selected ROM or directory.</p>
</li>
<li>
<p><b>Game properties</b> (or 'Control + G'): Opens the
<b><a href="#Properties">Game properties</a></b> dialog.</p>
</li> </li>
<li><p><b><a name="PowerOn">Power-on options</a></b> (or 'Control + P'): <li><p><b><a name="PowerOn">Power-on options</a></b> (or 'Control + P'):
Selecting this option shows a dialog whereby Opens a dialog whereby ROM properties can be temporarily overridden, and
ROM properties can be temporarily overridden, and joystick/console buttons can be joystick/console buttons can be temporarily held down. Selecting options
temporarily held down. Selecting options from this dialog will cause all ROMs launched from this dialog will cause all ROMs launched after that to use those
after that to use those properties you specify. Clicking <b>Defaults</b> will disable properties you specify. Clicking <b>Defaults</b> will disable its
its functionality, and use ROM properties as defined by the ROM itself. The dialog is as functionality, and use ROM properties as defined by the ROM itself. The dialog is as
follows (see <b>Advanced Configuration - <a href="#Properties">Game Properties</a></b> follows (see <b>Advanced Configuration - <a href="#Properties">Game Properties</a></b>
for more information concerning ROM properties):</p> for more information concerning ROM properties):</p>
<table border="5" cellpadding="2" frame="box" rules="none"> <table border="5" cellpadding="2" frame="box" rules="none">
@ -4354,9 +4363,9 @@
</table> </table>
</li> </li>
<li> <li>
<p><b>High scores</b> (or 'Control + H'): This option displays the <a href="#HighScores"> <p><b>High scores</b> (or 'Control + H'): Opens the
High Scores</a> dialog for the selected ROM. Only available if high score <b><a href="#HighScores"></b>High Scores</a> dialog for the selected ROM.
properties have been setup for the ROM.</p> Only available if high score properties have been setup for the ROM.</p>
</li> </li>
<li> <li>
<p><b>Enable/disable file extensions</b> (or 'Control + E'): Toggles the <p><b>Enable/disable file extensions</b> (or 'Control + E'): Toggles the
@ -4375,8 +4384,8 @@
of ROMs in current directory only or all subdirectories too.</p> of ROMs in current directory only or all subdirectories too.</p>
</li> </li>
<li> <li>
<p><b>Reload listing</b> (or 'Control + R'): Selecting this performs a <p><b>Reload listing</b> (or 'Control + R'): Performs a reload of the
reload of the current listing. </p> current file listing. </p>
</li> </li>
</ul></p> </ul></p>
</blockquote></br> </blockquote></br>

View File

@ -28,6 +28,7 @@
#include "FSNode.hxx" #include "FSNode.hxx"
#include "MD5.hxx" #include "MD5.hxx"
#include "OptionsDialog.hxx" #include "OptionsDialog.hxx"
#include "GameInfoDialog.hxx"
#include "HighScoresDialog.hxx" #include "HighScoresDialog.hxx"
#include "HighScoresManager.hxx" #include "HighScoresManager.hxx"
#include "GlobalPropsDialog.hxx" #include "GlobalPropsDialog.hxx"
@ -245,7 +246,6 @@ void LauncherDialog::addPathWidgets(int& ypos)
buttonWidth, buttonHeight, reloadIcon, kReloadCmd); buttonWidth, buttonHeight, reloadIcon, kReloadCmd);
myReloadButton->setToolTip("Reload listing"); myReloadButton->setToolTip("Reload listing");
wid.push_back(myReloadButton); wid.push_back(myReloadButton);
ypos = myNavigationBar->getBottom() + Dialog::vGap();
} }
else else
{ {
@ -256,10 +256,10 @@ void LauncherDialog::addPathWidgets(int& ypos)
lwFound, fontHeight, "", TextAlign::Right); lwFound, fontHeight, "", TextAlign::Right);
EditTextWidget* e = new EditTextWidget(this, _font, myNavigationBar->getRight() - 1, ypos, EditTextWidget* e = new EditTextWidget(this, _font, myNavigationBar->getRight() - 1, ypos,
lwFound + LBL_GAP + 1, lineHeight, ""); lwFound + LBL_GAP + 1, buttonHeight - 2, "");
e->setEditable(false, true); e->setEditable(false, true);
ypos = myNavigationBar->getBottom();
} }
ypos = myNavigationBar->getBottom() + Dialog::vGap();
addToFocusList(wid); addToFocusList(wid);
} }
@ -739,6 +739,8 @@ void LauncherDialog::handleContextMenu()
removeAllPopular(); removeAllPopular();
else if(cmd == "removerecent") else if(cmd == "removerecent")
removeAllRecent(); removeAllRecent();
else if(cmd == "properties")
openGameProperties();
else if(cmd == "override") else if(cmd == "override")
openGlobalProps(); openGlobalProps();
else if(cmd == "extensions") else if(cmd == "extensions")
@ -807,6 +809,10 @@ void LauncherDialog::handleKeyDown(StellaKey key, StellaMod mod, bool repeated)
myList->toggleUserFavorite(); myList->toggleUserFavorite();
break; break;
case KBDK_G:
openGameProperties();
break;
case KBDK_H: case KBDK_H:
if(instance().highScores().enabled()) if(instance().highScores().enabled())
openHighScores(); openHighScores();
@ -1137,6 +1143,7 @@ void LauncherDialog::openContextMenu(int x, int y)
} }
if(!currentNode().isDirectory() && Bankswitch::isValidRomName(currentNode())) if(!currentNode().isDirectory() && Bankswitch::isValidRomName(currentNode()))
{ {
items.push_back(ContextItem("Game properties" + ELLIPSIS, "Ctrl+G", "properties"));
items.push_back(ContextItem("Power-on options" + ELLIPSIS, "Ctrl+P", "override")); items.push_back(ContextItem("Power-on options" + ELLIPSIS, "Ctrl+P", "override"));
if(instance().highScores().enabled()) if(instance().highScores().enabled())
items.push_back(ContextItem("High scores" + ELLIPSIS, "Ctrl+H", "highscores")); items.push_back(ContextItem("High scores" + ELLIPSIS, "Ctrl+H", "highscores"));
@ -1212,6 +1219,18 @@ void LauncherDialog::openSettings()
myDialog->open(); myDialog->open();
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void LauncherDialog::openGameProperties()
{
if(!currentNode().isDirectory() && Bankswitch::isValidRomName(currentNode()))
{
// Create game properties dialog
myDialog = make_unique<GameInfoDialog>(instance(), parent(),
myUseMinimalUI ? _font : instance().frameBuffer().font(), this, _w, _h);
myDialog->open();
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void LauncherDialog::openGlobalProps() void LauncherDialog::openGlobalProps()
{ {

View File

@ -168,6 +168,7 @@ class LauncherDialog : public Dialog, CommandSender
void loadRom(); void loadRom();
void loadRomInfo(); void loadRomInfo();
void openSettings(); void openSettings();
void openGameProperties();
void openContextMenu(int x = -1, int y = -1); void openContextMenu(int x = -1, int y = -1);
void openGlobalProps(); void openGlobalProps();
void openHighScores(); void openHighScores();