diff --git a/Changes.txt b/Changes.txt index 18cf0a2dd..82fb3b6db 100644 --- a/Changes.txt +++ b/Changes.txt @@ -16,7 +16,9 @@ * Added option to toggle autofire mode. - * Added icons to file lists (TODO: doc) + * Added icons to file lists. + + * Added option to show/hide file extensions. -Have fun! diff --git a/docs/graphics/launcher.png b/docs/graphics/launcher.png index 1e0ee42b3..3781dc09e 100644 Binary files a/docs/graphics/launcher.png and b/docs/graphics/launcher.png differ diff --git a/docs/graphics/options_ui.png b/docs/graphics/options_ui.png index 2b3f37d9c..812793713 100644 Binary files a/docs/graphics/options_ui.png and b/docs/graphics/options_ui.png differ diff --git a/docs/graphics/rominfo_1x_large.png b/docs/graphics/rominfo_1x_large.png index 5a0133404..decbbfbd1 100644 Binary files a/docs/graphics/rominfo_1x_large.png and b/docs/graphics/rominfo_1x_large.png differ diff --git a/docs/graphics/rominfo_1x_small.png b/docs/graphics/rominfo_1x_small.png index 99d23e135..ae2780acc 100644 Binary files a/docs/graphics/rominfo_1x_small.png and b/docs/graphics/rominfo_1x_small.png differ diff --git a/docs/graphics/rominfo_2x_small.png b/docs/graphics/rominfo_2x_small.png index 7c53384b2..82e11ec54 100644 Binary files a/docs/graphics/rominfo_2x_small.png and b/docs/graphics/rominfo_2x_small.png differ diff --git a/docs/index.html b/docs/index.html index 6f4b08c7b..387746583 100644 --- a/docs/index.html +++ b/docs/index.html @@ -2278,6 +2278,11 @@ Control + R Control + R + + Toggle file extensions display + Control + X + Control + X +

UI Keys in Text Editing areas (cannot be remapped)

@@ -3229,6 +3234,17 @@ files in the ROM launcher. + +
-launcherextensions <1|0>
+ Display file extensions in the ROM launcher. + + + +
-launchersubdirs <1|0>
+ Specifies whether the ROM launcher lists files from current + directory only or all subdirectories too. + +
-romviewer <float>
Hide ROM Info Viewer in ROM launcher mode (0) or use the @@ -4157,7 +4173,7 @@

ROM Info Viewer width at 40%, UI sized 800x480, small launcher font:

-

ROM Info Viewer width at 32%, UI sized 1000x720, medium launcher font:

+

ROM Info Viewer width at 32%, UI sized 900x720, medium launcher font:

ROM Info Viewer width at 50% , UI sized 1280x900, large launcher font:

diff --git a/src/emucore/Settings.cxx b/src/emucore/Settings.cxx index f740b4b51..dca0364fc 100644 --- a/src/emucore/Settings.cxx +++ b/src/emucore/Settings.cxx @@ -154,6 +154,7 @@ Settings::Settings() setPermanent("launcherfont", "medium"); setPermanent("launcherroms", "true"); setPermanent("launchersubdirs", "false"); + setPermanent("launcherextensions", "false"); setPermanent("romviewer", "1"); setPermanent("lastrom", ""); @@ -579,7 +580,8 @@ void Settings::usage() const << " entry\n" << endl << " -exitlauncher <0|1> On exiting a ROM, go back to the ROM launcher\n" - << " -launcherpos Sets the window position in windowed EOM launcher mode\n" + << " -launcherpos Sets the window position in windowed launcher\n" + << " mode\n" << " -launcherdisplay Sets the display for the ROM launcher\n" << " -launcherres The resolution to use in ROM launcher mode\n" << " -launcherfont \n" << " -romviewer Show ROM info viewer at given zoom level in ROM\n" << " launcher (use 0 for off)\n" - << " -launcherroms <1|0> Show only ROMs in the launcher (vs. all files)\n" - << " -launchersubdirs <0|1> Show files from subdirectories too\n" - << " -romdir Set the path where the ROM launcher will start\n" - << " -followlauncher <0|1> Default ROM path follows launcher navigation\n" - << " -userdir Set the path to save user files to\n" - << " -saveuserdir <0|1> Update user path when navigating in browser\n" - << " -lastrom Last played ROM, automatically selected in\n" + << " -launcherroms <1|0> Show only ROMs in the launcher (vs. all files)\n" + << " -launchersubdirs <0|1> Show files from subdirectories too\n" + << " -launcherextensions <0|1> Display file extensions in launcher\n" + << " -romdir Set the path where the ROM launcher will start\n" + << " -followlauncher <0|1> Default ROM path follows launcher navigation\n" + << " -userdir Set the path to save user files to\n" + << " -saveuserdir <0|1> Update user path when navigating in browser\n" + << " -lastrom Last played ROM, automatically selected in\n" << " launcher\n" << " -romloadcount Number of ROM to load next from multicard\n" << " -uipalette = orgLen) _dirList.push_back(path.substr(orgLen)); @@ -116,14 +116,24 @@ void FileListWidget::setLocation(const FilesystemNode& node, if(file.isDirectory()) { if(BSPF::endsWithIgnoreCase(name, ".zip")) + { + l.push_back(displayName); _iconList.push_back(IconType::zip); + } else + { + l.push_back(name); _iconList.push_back(IconType::directory); + } } - else if(file.isFile() && Bankswitch::isValidRomName(name)) - _iconList.push_back(IconType::rom); else - _iconList.push_back(IconType::unknown); + { + l.push_back(displayName); + if(file.isFile() && Bankswitch::isValidRomName(name)) + _iconList.push_back(IconType::rom); + else + _iconList.push_back(IconType::unknown); + } } setList(l); @@ -152,7 +162,10 @@ void FileListWidget::reload() { if(_node.exists()) { - _selectedFile = selected().getName(); + if(_showFileExtensions || selected().isDirectory()) + _selectedFile = selected().getName(); + else + _selectedFile = selected().getNameWithExt(EmptyString); setLocation(_node, _selectedFile); } } diff --git a/src/gui/FileListWidget.hxx b/src/gui/FileListWidget.hxx index 857263ea3..42c6cc6fb 100644 --- a/src/gui/FileListWidget.hxx +++ b/src/gui/FileListWidget.hxx @@ -65,6 +65,9 @@ class FileListWidget : public StringListWidget // When enabled, all subdirectories will be searched too. void setIncludeSubDirs(bool enable) { _includeSubDirs = enable; } + // When enabled, file extensions will be displayed too. + void setShowFileExtensions(bool enable) { _showFileExtensions = enable; } + /** Set initial directory, and optionally select the given item. @@ -121,6 +124,7 @@ class FileListWidget : public StringListWidget FilesystemNode _node; FSList _fileList; bool _includeSubDirs{false}; + bool _showFileExtensions{true}; StringList _dirList; IconTypeList _iconList; diff --git a/src/gui/LauncherDialog.cxx b/src/gui/LauncherDialog.cxx index 422788597..102aefcf7 100644 --- a/src/gui/LauncherDialog.cxx +++ b/src/gui/LauncherDialog.cxx @@ -348,7 +348,12 @@ const FilesystemNode& LauncherDialog::currentDir() const // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void LauncherDialog::reload() { + bool subDirs = instance().settings().getBool("launchersubdirs"); + bool extensions = instance().settings().getBool("launcherextensions"); + myMD5List.clear(); + myList->setIncludeSubDirs(subDirs); + myList->setShowFileExtensions(extensions); myList->reload(); myPendingReload = false; } @@ -380,8 +385,11 @@ void LauncherDialog::loadConfig() } bool subDirs = instance().settings().getBool("launchersubdirs"); + bool extensions = instance().settings().getBool("launcherextensions"); + if (mySubDirs) mySubDirs->setState(subDirs); myList->setIncludeSubDirs(subDirs); + myList->setShowFileExtensions(extensions); // Assume that if the list is empty, this is the first time that loadConfig() // has been called (and we should reload the list) @@ -663,6 +671,16 @@ void LauncherDialog::handleKeyDown(StellaKey key, StellaMod mod, bool repeated) reload(); break; + case KBDK_X: + { + bool extensions = !instance().settings().getBool("launcherextensions"); + + instance().settings().setValue("launcherextensions", extensions); + myList->setShowFileExtensions(extensions); + reload(); + break; + } + default: handled = false; break; @@ -867,6 +885,10 @@ void LauncherDialog::handleCommand(CommandSender* sender, int cmd, break; } + case kExtChangedCmd: + reload(); + break; + case ContextMenu::kItemSelectedCmd: handleContextMenu(); break; diff --git a/src/gui/LauncherDialog.hxx b/src/gui/LauncherDialog.hxx index 21a9a3121..55a439731 100644 --- a/src/gui/LauncherDialog.hxx +++ b/src/gui/LauncherDialog.hxx @@ -47,7 +47,8 @@ class LauncherDialog : public Dialog // These must be accessible from dialogs created by this class enum { kLoadROMCmd = 'STRT', // load currently selected ROM - kRomDirChosenCmd = 'romc' // rom dir chosen + kRomDirChosenCmd = 'romc', // ROM dir chosen + kExtChangedCmd = 'extc' // File extension display changed }; public: diff --git a/src/gui/UIDialog.cxx b/src/gui/UIDialog.cxx index f45187f1a..62ac637a0 100644 --- a/src/gui/UIDialog.cxx +++ b/src/gui/UIDialog.cxx @@ -254,6 +254,13 @@ UIDialog::UIDialog(OSystem& osystem, DialogContainer& parent, new PopUpWidget(myTab, font, xpos, ypos + 1, pwidth, lineHeight, items, "Launcher font ", lwidth); wid.push_back(myLauncherFontPopup); + + // Display launcher extensions + ypos += lineHeight + VGAP; + myLauncherExtensionsWidget = new CheckboxWidget(myTab, _font, xpos, ypos + 1, + "Display file extensions"); + wid.push_back(myLauncherExtensionsWidget); + ypos += lineHeight + VGAP * 4; // ROM launcher info/snapshot viewer @@ -352,6 +359,8 @@ void UIDialog::loadConfig() const string& launcherFont = settings.getString("launcherfont"); myLauncherFontPopup->setSelected(launcherFont, "medium"); + myLauncherExtensionsWidget->setState(settings.getBool("launcherextensions")); + // ROM launcher info viewer float zoom = instance().settings().getFloat("romviewer"); int percentage = zoom * TIAConstants::viewableWidth * 100 / w; @@ -435,6 +444,9 @@ void UIDialog::saveConfig() settings.setValue("launcherfont", myLauncherFontPopup->getSelectedTag().toString()); + // Display launcher extensions + settings.setValue("launcherextensions", myLauncherExtensionsWidget->getState()); + // ROM launcher info viewer int w = myLauncherWidthSlider->getValue(); float zoom = myRomViewerSize->getValue() * w / 100.F / TIAConstants::viewableWidth; @@ -518,6 +530,7 @@ void UIDialog::setDefaults() myLauncherWidthSlider->setValue(w); myLauncherHeightSlider->setValue(h); myLauncherFontPopup->setSelected("medium", ""); + myLauncherExtensionsWidget->setState(false); myRomViewerSize->setValue(35); mySnapLoadPath->setText(instance().userDir().getShortPath()); myLauncherExitWidget->setState(false); @@ -535,12 +548,16 @@ void UIDialog::handleCommand(CommandSender* sender, int cmd, int data, int id) { case GuiObject::kOKCmd: { - bool inform = myIsGlobal && + bool informPath = myIsGlobal && myRomPath->getText() != instance().settings().getString("romdir"); + bool informExt = myIsGlobal && + myLauncherExtensionsWidget->getState() != instance().settings().getBool("launcherextensions"); saveConfig(); close(); - if(inform) // Let the boss know romdir has changed + if(informPath) // Let the boss know romdir has changed sendCommand(LauncherDialog::kRomDirChosenCmd, 0, 0); + if(informExt) // Let the boss know the file extension display setting has changed + sendCommand(LauncherDialog::kExtChangedCmd, 0, 0); break; } case GuiObject::kDefaultsCmd: diff --git a/src/gui/UIDialog.hxx b/src/gui/UIDialog.hxx index 6c390147f..adea520f8 100644 --- a/src/gui/UIDialog.hxx +++ b/src/gui/UIDialog.hxx @@ -57,6 +57,7 @@ class UIDialog : public Dialog, public CommandSender SliderWidget* myLauncherWidthSlider{nullptr}; SliderWidget* myLauncherHeightSlider{nullptr}; PopUpWidget* myLauncherFontPopup{nullptr}; + CheckboxWidget* myLauncherExtensionsWidget{nullptr}; SliderWidget* myRomViewerSize{nullptr}; ButtonWidget* myOpenBrowserButton{nullptr}; EditTextWidget* mySnapLoadPath{nullptr};