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