mirror of https://github.com/stella-emu/stella.git
remove new default path button
replace with an UI option, which lets "romdir" automatically follow the launcher path
This commit is contained in:
parent
0753972d47
commit
d81f106a50
|
@ -125,6 +125,7 @@ Settings::Settings()
|
|||
|
||||
// ROM browser options
|
||||
setPermanent("exitlauncher", "false");
|
||||
setPermanent("followlauncher", "false");
|
||||
setPermanent("launcherres", Common::Size(900, 600));
|
||||
setPermanent("launcherfont", "medium");
|
||||
setPermanent("launcherroms", "true");
|
||||
|
@ -500,6 +501,7 @@ void Settings::usage() const
|
|||
<< " -launcherroms <1|0> Show only ROMs in the launcher (vs. all files)\n"
|
||||
<< " -romviewer <float> Show ROM info viewer at given zoom level in ROM\n"
|
||||
<< " launcher (use 0 for off)\n"
|
||||
<< " -followlauncher <0|1> Default ROM path follows launcher navigation\n"
|
||||
<< " -lastrom <name> Last played ROM, automatically selected in\n"
|
||||
<< " launcher\n"
|
||||
<< " -romloadcount <number> Number of ROM to load next from multicard\n"
|
||||
|
|
|
@ -66,7 +66,7 @@ LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent,
|
|||
const int fontWidth = font.getMaxCharWidth(),
|
||||
fontHeight = font.getFontHeight(),
|
||||
lineHeight = font.getLineHeight(),
|
||||
bwidth = (_w - 2 * HBORDER - BUTTON_GAP * (5 - 1)),
|
||||
bwidth = (_w - 2 * HBORDER - BUTTON_GAP * (4 - 1)),
|
||||
bheight = myUseMinimalUI ? lineHeight - 4 : lineHeight + 4,
|
||||
LBL_GAP = fontWidth;
|
||||
int xpos = 0, ypos = 0, lwidth = 0, lwidth2 = 0;
|
||||
|
@ -176,50 +176,41 @@ LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent,
|
|||
// Add four buttons at the bottom
|
||||
xpos = HBORDER; ypos += myDir->getHeight() + 8;
|
||||
#ifndef BSPF_MACOS
|
||||
myStartButton = new ButtonWidget(this, font, xpos, ypos, (bwidth + 0) / 5, bheight,
|
||||
myStartButton = new ButtonWidget(this, font, xpos, ypos, (bwidth + 0) / 4, bheight,
|
||||
"Select", kLoadROMCmd);
|
||||
wid.push_back(myStartButton);
|
||||
|
||||
xpos += (bwidth + 0) / 5 + BUTTON_GAP;
|
||||
myPrevDirButton = new ButtonWidget(this, font, xpos, ypos, (bwidth + 1) / 5, bheight,
|
||||
xpos += (bwidth + 0) / 4 + BUTTON_GAP;
|
||||
myPrevDirButton = new ButtonWidget(this, font, xpos, ypos, (bwidth + 1) / 4, bheight,
|
||||
"Go Up", kPrevDirCmd);
|
||||
wid.push_back(myPrevDirButton);
|
||||
|
||||
xpos += (bwidth + 1) / 5 + BUTTON_GAP;
|
||||
mySetDefaultDirButton = new ButtonWidget(this, font, xpos, ypos, (bwidth + 2) / 5, bheight,
|
||||
"Set Path", kDefaultDirCmd);
|
||||
wid.push_back(mySetDefaultDirButton);
|
||||
|
||||
xpos += (bwidth + 2) / 5 + BUTTON_GAP;
|
||||
myOptionsButton = new ButtonWidget(this, font, xpos, ypos, (bwidth + 3) / 5, bheight,
|
||||
xpos += (bwidth + 1) / 4 + BUTTON_GAP;
|
||||
myOptionsButton = new ButtonWidget(this, font, xpos, ypos, (bwidth + 3) / 4, bheight,
|
||||
"Options" + ELLIPSIS, kOptionsCmd);
|
||||
wid.push_back(myOptionsButton);
|
||||
|
||||
xpos += (bwidth + 3) / 5 + BUTTON_GAP;
|
||||
myQuitButton = new ButtonWidget(this, font, xpos, ypos, (bwidth + 4) / 5, bheight,
|
||||
xpos += (bwidth + 2) / 4 + BUTTON_GAP;
|
||||
myQuitButton = new ButtonWidget(this, font, xpos, ypos, (bwidth + 4) / 4, bheight,
|
||||
"Quit", kQuitCmd);
|
||||
wid.push_back(myQuitButton);
|
||||
#else
|
||||
myQuitButton = new ButtonWidget(this, font, xpos, ypos, (bwidth + 0) / 5, bheight,
|
||||
myQuitButton = new ButtonWidget(this, font, xpos, ypos, (bwidth + 0) / 4, bheight,
|
||||
"Quit", kQuitCmd);
|
||||
wid.push_back(myQuitButton);
|
||||
|
||||
xpos += (bwidth + 0) / 5 + BUTTON_GAP;
|
||||
myOptionsButton = new ButtonWidget(this, font, xpos, ypos, (bwidth + 1) / 5, bheight,
|
||||
xpos += (bwidth + 0) / 4 + BUTTON_GAP;
|
||||
myOptionsButton = new ButtonWidget(this, font, xpos, ypos, (bwidth + 1) / 4, bheight,
|
||||
"Options" + ELLIPSIS, kOptionsCmd);
|
||||
wid.push_back(myOptionsButton);
|
||||
|
||||
xpos += (bwidth + 1) / 5 + BUTTON_GAP;
|
||||
mySetDefaultDirButton = new ButtonWidget(this, font, xpos, ypos, (bwidth + 2) / 5, bheight,
|
||||
"Set Path", kDefaultDirCmd);
|
||||
|
||||
xpos += (bwidth + 2) / 5 + BUTTON_GAP;
|
||||
myPrevDirButton = new ButtonWidget(this, font, xpos, ypos, (bwidth + 3) / 5, bheight,
|
||||
xpos += (bwidth + 1) / 4 + BUTTON_GAP;
|
||||
myPrevDirButton = new ButtonWidget(this, font, xpos, ypos, (bwidth + 2) / 4, bheight,
|
||||
"Go Up", kPrevDirCmd);
|
||||
wid.push_back(myPrevDirButton);
|
||||
|
||||
xpos += (bwidth + 3) / 5 + BUTTON_GAP;
|
||||
myStartButton = new ButtonWidget(this, font, xpos, ypos, (bwidth + 4) / 5, bheight,
|
||||
xpos += (bwidth + 2) / 4 + BUTTON_GAP;
|
||||
myStartButton = new ButtonWidget(this, font, xpos, ypos, (bwidth + 3) / 4, bheight,
|
||||
"Select", kLoadROMCmd);
|
||||
wid.push_back(myStartButton);
|
||||
#endif
|
||||
|
@ -317,6 +308,13 @@ void LauncherDialog::loadConfig()
|
|||
myList->clearFlags(Widget::FLAG_WANTS_RAWDATA); // always reset this
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void LauncherDialog::saveConfig()
|
||||
{
|
||||
if(instance().settings().getBool("followlauncher"))
|
||||
instance().settings().setValue("romdir", myList->currentDir().getShortPath());
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void LauncherDialog::updateUI()
|
||||
{
|
||||
|
@ -586,6 +584,7 @@ void LauncherDialog::handleCommand(CommandSender* sender, int cmd,
|
|||
|
||||
case kLoadROMCmd:
|
||||
case FileListWidget::ItemActivated:
|
||||
saveConfig();
|
||||
loadRom();
|
||||
break;
|
||||
|
||||
|
@ -597,10 +596,6 @@ void LauncherDialog::handleCommand(CommandSender* sender, int cmd,
|
|||
myList->selectParent();
|
||||
break;
|
||||
|
||||
case kDefaultDirCmd:
|
||||
setDefaultDir();
|
||||
break;
|
||||
|
||||
case FileListWidget::ItemChanged:
|
||||
updateUI();
|
||||
break;
|
||||
|
@ -617,6 +612,7 @@ void LauncherDialog::handleCommand(CommandSender* sender, int cmd,
|
|||
break;
|
||||
|
||||
case kQuitCmd:
|
||||
saveConfig();
|
||||
close();
|
||||
instance().eventHandler().quit();
|
||||
break;
|
||||
|
|
|
@ -107,6 +107,7 @@ class LauncherDialog : public Dialog
|
|||
Event::Type getJoyAxisEvent(int stick, JoyAxis axis, JoyDir adir, int button) override;
|
||||
|
||||
void loadConfig() override;
|
||||
void saveConfig() override;
|
||||
void updateUI();
|
||||
void applyFiltering();
|
||||
|
||||
|
@ -132,7 +133,6 @@ class LauncherDialog : public Dialog
|
|||
|
||||
ButtonWidget* myStartButton{nullptr};
|
||||
ButtonWidget* myPrevDirButton{nullptr};
|
||||
ButtonWidget* mySetDefaultDirButton{nullptr};
|
||||
ButtonWidget* myOptionsButton{nullptr};
|
||||
ButtonWidget* myQuitButton{nullptr};
|
||||
|
||||
|
@ -155,7 +155,6 @@ class LauncherDialog : public Dialog
|
|||
enum {
|
||||
kAllfilesCmd = 'lalf', // show all files (or ROMs only)
|
||||
kPrevDirCmd = 'PRVD',
|
||||
kDefaultDirCmd = 'DEFD',
|
||||
kOptionsCmd = 'OPTI',
|
||||
kQuitCmd = 'QUIT'
|
||||
};
|
||||
|
|
|
@ -189,8 +189,14 @@ UIDialog::UIDialog(OSystem& osystem, DialogContainer& parent,
|
|||
myRomPath = new EditTextWidget(myTab, font, xpos, ypos + 1,
|
||||
_w - xpos - HBORDER - 2, lineHeight, "");
|
||||
wid.push_back(myRomPath);
|
||||
|
||||
xpos = _w - HBORDER - font.getStringWidth("Follow Launcher path") - 24;
|
||||
ypos += lineHeight + V_GAP * 2;
|
||||
myFollowLauncherWidget = new CheckboxWidget(myTab, font, xpos, ypos, "Follow Launcher path");
|
||||
wid.push_back(myFollowLauncherWidget);
|
||||
|
||||
xpos = HBORDER;
|
||||
ypos += lineHeight + V_GAP * 4;
|
||||
ypos += V_GAP * 2;
|
||||
|
||||
// Launcher width and height
|
||||
myLauncherWidthSlider = new SliderWidget(myTab, font, xpos, ypos, "Launcher width ",
|
||||
|
@ -309,6 +315,9 @@ void UIDialog::loadConfig()
|
|||
myLauncherWidthSlider->setValue(w);
|
||||
myLauncherHeightSlider->setValue(h);
|
||||
|
||||
// Follow Launcher path
|
||||
myFollowLauncherWidget->setState(settings.getBool("followlauncher"));
|
||||
|
||||
// Launcher font
|
||||
const string& font = settings.getString("launcherfont");
|
||||
myLauncherFontPopup->setSelected(font, "medium");
|
||||
|
@ -379,6 +388,9 @@ void UIDialog::saveConfig()
|
|||
// ROM path
|
||||
settings.setValue("romdir", myRomPath->getText());
|
||||
|
||||
// Follow Launcher path
|
||||
settings.setValue("followlauncher", myFollowLauncherWidget->getState());
|
||||
|
||||
// Launcher size
|
||||
settings.setValue("launcherres",
|
||||
Common::Size(myLauncherWidthSlider->getValue(),
|
||||
|
|
|
@ -54,6 +54,7 @@ class UIDialog : public Dialog, public CommandSender
|
|||
|
||||
// Launcher options
|
||||
EditTextWidget* myRomPath{nullptr};
|
||||
CheckboxWidget* myFollowLauncherWidget{nullptr};
|
||||
SliderWidget* myLauncherWidthSlider{nullptr};
|
||||
SliderWidget* myLauncherHeightSlider{nullptr};
|
||||
PopUpWidget* myLauncherFontPopup{nullptr};
|
||||
|
|
Loading…
Reference in New Issue