mirror of https://github.com/stella-emu/stella.git
refactored launcher dialog to use only one pointer for other dialogs
This commit is contained in:
parent
29685703d4
commit
b225a684bf
|
@ -298,11 +298,6 @@ LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent,
|
||||||
// Create (empty) context menu for ROM list options
|
// Create (empty) context menu for ROM list options
|
||||||
myMenu = make_unique<ContextMenu>(this, _font, EmptyVarList);
|
myMenu = make_unique<ContextMenu>(this, _font, EmptyVarList);
|
||||||
|
|
||||||
// Create global props dialog, which is used to temporarily override
|
|
||||||
// ROM properties
|
|
||||||
myGlobalProps = make_unique<GlobalPropsDialog>(this,
|
|
||||||
myUseMinimalUI ? _font : osystem.frameBuffer().font());
|
|
||||||
|
|
||||||
// since we cannot know how many files there are, use are really high value here
|
// since we cannot know how many files there are, use are really high value here
|
||||||
myList->progress().setRange(0, 50000, 5);
|
myList->progress().setRange(0, 50000, 5);
|
||||||
myList->progress().setMessage(" Filtering files" + ELLIPSIS + " ");
|
myList->progress().setMessage(" Filtering files" + ELLIPSIS + " ");
|
||||||
|
@ -616,7 +611,7 @@ void LauncherDialog::handleContextMenu()
|
||||||
const string& cmd = myMenu->getSelectedTag().toString();
|
const string& cmd = myMenu->getSelectedTag().toString();
|
||||||
|
|
||||||
if(cmd == "override")
|
if(cmd == "override")
|
||||||
myGlobalProps->open();
|
openGlobalProps();
|
||||||
else if(cmd == "reload")
|
else if(cmd == "reload")
|
||||||
reload();
|
reload();
|
||||||
else if(cmd == "highscores")
|
else if(cmd == "highscores")
|
||||||
|
@ -641,7 +636,7 @@ void LauncherDialog::handleKeyDown(StellaKey key, StellaMod mod, bool repeated)
|
||||||
switch(key)
|
switch(key)
|
||||||
{
|
{
|
||||||
case KBDK_P:
|
case KBDK_P:
|
||||||
myGlobalProps->open();
|
openGlobalProps();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KBDK_H:
|
case KBDK_H:
|
||||||
|
@ -664,7 +659,7 @@ void LauncherDialog::handleKeyDown(StellaKey key, StellaMod mod, bool repeated)
|
||||||
{
|
{
|
||||||
case KBDK_F8: // front ("Skill P2")
|
case KBDK_F8: // front ("Skill P2")
|
||||||
if (!currentNode().isDirectory() && Bankswitch::isValidRomName(currentNode()))
|
if (!currentNode().isDirectory() && Bankswitch::isValidRomName(currentNode()))
|
||||||
myGlobalProps->open();
|
openGlobalProps();
|
||||||
break;
|
break;
|
||||||
case KBDK_F4: // back ("COLOR", "B/W")
|
case KBDK_F4: // back ("COLOR", "B/W")
|
||||||
openSettings();
|
openSettings();
|
||||||
|
@ -705,7 +700,7 @@ void LauncherDialog::handleJoyUp(int stick, int button)
|
||||||
|
|
||||||
if (button == 1 && (e == Event::UIOK || e == Event::NoType) &&
|
if (button == 1 && (e == Event::UIOK || e == Event::NoType) &&
|
||||||
!currentNode().isDirectory() && Bankswitch::isValidRomName(currentNode()))
|
!currentNode().isDirectory() && Bankswitch::isValidRomName(currentNode()))
|
||||||
myGlobalProps->open();
|
openGlobalProps();
|
||||||
if (button == 3 && (e == Event::Event::UITabPrev || e == Event::NoType))
|
if (button == 3 && (e == Event::Event::UITabPrev || e == Event::NoType))
|
||||||
openSettings();
|
openSettings();
|
||||||
else if (!myEventHandled)
|
else if (!myEventHandled)
|
||||||
|
@ -802,7 +797,7 @@ void LauncherDialog::handleCommand(CommandSender* sender, int cmd,
|
||||||
|
|
||||||
case ListWidget::kLongButtonPressCmd:
|
case ListWidget::kLongButtonPressCmd:
|
||||||
if (!currentNode().isDirectory() && Bankswitch::isValidRomName(currentNode()))
|
if (!currentNode().isDirectory() && Bankswitch::isValidRomName(currentNode()))
|
||||||
myGlobalProps->open();
|
openGlobalProps();
|
||||||
myEventHandled = true;
|
myEventHandled = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -878,6 +873,17 @@ void LauncherDialog::setDefaultDir()
|
||||||
instance().settings().setValue("romdir", myList->currentDir().getShortPath());
|
instance().settings().setValue("romdir", myList->currentDir().getShortPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
void LauncherDialog::openGlobalProps()
|
||||||
|
{
|
||||||
|
// Create global props dialog, which is used to temporarily override
|
||||||
|
// ROM properties
|
||||||
|
myDialog = make_unique<GlobalPropsDialog>(this, myUseMinimalUI
|
||||||
|
? _font
|
||||||
|
: instance().frameBuffer().font());
|
||||||
|
myDialog->open();
|
||||||
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void LauncherDialog::openSettings()
|
void LauncherDialog::openSettings()
|
||||||
{
|
{
|
||||||
|
@ -885,37 +891,26 @@ void LauncherDialog::openSettings()
|
||||||
|
|
||||||
// Create an options dialog, similar to the in-game one
|
// Create an options dialog, similar to the in-game one
|
||||||
if (instance().settings().getBool("basic_settings"))
|
if (instance().settings().getBool("basic_settings"))
|
||||||
{
|
myDialog = make_unique<StellaSettingsDialog>(instance(), parent(),
|
||||||
if (myStellaSettingsDialog == nullptr)
|
_w, _h, Menu::AppMode::launcher);
|
||||||
myStellaSettingsDialog = make_unique<StellaSettingsDialog>(instance(), parent(),
|
|
||||||
_w, _h, Menu::AppMode::launcher);
|
|
||||||
myStellaSettingsDialog->open();
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
myDialog = make_unique<OptionsDialog>(instance(), parent(), this, _w, _h,
|
||||||
if (myOptionsDialog == nullptr)
|
Menu::AppMode::launcher);
|
||||||
myOptionsDialog = make_unique<OptionsDialog>(instance(), parent(), this, _w, _h,
|
myDialog->open();
|
||||||
Menu::AppMode::launcher);
|
|
||||||
myOptionsDialog->open();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void LauncherDialog::openHighScores()
|
void LauncherDialog::openHighScores()
|
||||||
{
|
{
|
||||||
// Create an options dialog, similar to the in-game one
|
// Create an high scores dialog, similar to the in-game one
|
||||||
if(myHighScoresDialog == nullptr)
|
myDialog = make_unique<HighScoresDialog>(instance(), parent(), _w, _h,
|
||||||
myHighScoresDialog = make_unique<HighScoresDialog>(instance(), parent(), _w, _h,
|
Menu::AppMode::launcher);
|
||||||
Menu::AppMode::launcher);
|
myDialog->open();
|
||||||
|
|
||||||
myHighScoresDialog->open();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void LauncherDialog::openWhatsNew()
|
void LauncherDialog::openWhatsNew()
|
||||||
{
|
{
|
||||||
if(myWhatsNewDialog == nullptr)
|
myDialog = make_unique<WhatsNewDialog>(instance(), parent(), _w, _h);
|
||||||
myWhatsNewDialog = make_unique<WhatsNewDialog>(instance(), parent(), _w, _h);
|
myDialog->open();
|
||||||
myWhatsNewDialog->open();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,11 +22,6 @@ class ButtonWidget;
|
||||||
class CommandSender;
|
class CommandSender;
|
||||||
class ContextMenu;
|
class ContextMenu;
|
||||||
class DialogContainer;
|
class DialogContainer;
|
||||||
class OptionsDialog;
|
|
||||||
class HighScoresDialog;
|
|
||||||
class GlobalPropsDialog;
|
|
||||||
class StellaSettingsDialog;
|
|
||||||
class WhatsNewDialog;
|
|
||||||
class OSystem;
|
class OSystem;
|
||||||
class Properties;
|
class Properties;
|
||||||
class EditTextWidget;
|
class EditTextWidget;
|
||||||
|
@ -157,17 +152,14 @@ class LauncherDialog : public Dialog
|
||||||
void handleContextMenu();
|
void handleContextMenu();
|
||||||
void showOnlyROMs(bool state);
|
void showOnlyROMs(bool state);
|
||||||
void setDefaultDir();
|
void setDefaultDir();
|
||||||
|
void openGlobalProps();
|
||||||
void openSettings();
|
void openSettings();
|
||||||
void openHighScores();
|
void openHighScores();
|
||||||
void openWhatsNew();
|
void openWhatsNew();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
unique_ptr<OptionsDialog> myOptionsDialog;
|
unique_ptr<Dialog> myDialog;
|
||||||
unique_ptr<HighScoresDialog> myHighScoresDialog;
|
|
||||||
unique_ptr<StellaSettingsDialog> myStellaSettingsDialog;
|
|
||||||
unique_ptr<ContextMenu> myMenu;
|
unique_ptr<ContextMenu> myMenu;
|
||||||
unique_ptr<GlobalPropsDialog> myGlobalProps;
|
|
||||||
unique_ptr<WhatsNewDialog> myWhatsNewDialog;
|
|
||||||
|
|
||||||
// automatically sized font for ROM info viewer
|
// automatically sized font for ROM info viewer
|
||||||
unique_ptr<GUI::Font> myROMInfoFont;
|
unique_ptr<GUI::Font> myROMInfoFont;
|
||||||
|
|
Loading…
Reference in New Issue