Upon opening the ROM audit dialog, the current directory from the ROM

launcher is selected, not the actual ROM directory.  This speeds up
access, because generally you'll want to audit the directory you're
actually looking at.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2196 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2010-12-21 18:42:53 +00:00
parent f1bb09d8ac
commit 6478176abb
6 changed files with 55 additions and 9 deletions

View File

@ -19,6 +19,9 @@
* Updated internal ROM properties database to ROM-Hunter version 6 * Updated internal ROM properties database to ROM-Hunter version 6
(thanks go to RomHunter for his tireless research in this area). (thanks go to RomHunter for his tireless research in this area).
* The ROM audit dialog now automatically selects the current
directory in the ROM launcher.
-Have fun! -Have fun!

View File

@ -21,6 +21,7 @@
#include "Version.hxx" #include "Version.hxx"
#include "OSystem.hxx" #include "OSystem.hxx"
#include "Settings.hxx" #include "Settings.hxx"
#include "FSNode.hxx"
#include "FrameBuffer.hxx" #include "FrameBuffer.hxx"
#include "bspf.hxx" #include "bspf.hxx"
@ -57,7 +58,19 @@ FBInitStatus Launcher::initializeVideo()
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string Launcher::selectedRomMD5() const string& Launcher::selectedRomMD5()
{ {
return ((LauncherDialog*)myBaseDialog)->selectedRomMD5(); return ((LauncherDialog*)myBaseDialog)->selectedRomMD5();
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const FilesystemNode& Launcher::currentNode() const
{
return ((LauncherDialog*)myBaseDialog)->currentNode();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Launcher::reload()
{
((LauncherDialog*)myBaseDialog)->reload();
}

View File

@ -22,6 +22,7 @@
class Properties; class Properties;
class OSystem; class OSystem;
class FilesystemNode;
#include "DialogContainer.hxx" #include "DialogContainer.hxx"
#include "FrameBuffer.hxx" #include "FrameBuffer.hxx"
@ -53,7 +54,17 @@ class Launcher : public DialogContainer
/** /**
Wrapper for LauncherDialog::selectedRomMD5() method. Wrapper for LauncherDialog::selectedRomMD5() method.
*/ */
string selectedRomMD5(); const string& selectedRomMD5();
/**
Wrapper for LauncherDialog::currentNode() method.
*/
const FilesystemNode& currentNode() const;
/**
Wrapper for LauncherDialog::reload() method.
*/
void reload();
private: private:
// The width and height of this dialog // The width and height of this dialog

View File

@ -213,13 +213,13 @@ LauncherDialog::~LauncherDialog()
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string LauncherDialog::selectedRomMD5() const string& LauncherDialog::selectedRomMD5()
{ {
string extension; string extension;
int item = myList->getSelected(); int item = myList->getSelected();
if(item < 0 || myGameList->isDir(item) || if(item < 0 || myGameList->isDir(item) ||
!LauncherFilterDialog::isValidRomName(myGameList->name(item), extension)) !LauncherFilterDialog::isValidRomName(myGameList->name(item), extension))
return ""; return EmptyString;
// Make sure we have a valid md5 for this ROM // Make sure we have a valid md5 for this ROM
if(myGameList->md5(item) == "") if(myGameList->md5(item) == "")
@ -433,7 +433,7 @@ void LauncherDialog::setListFilters()
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool LauncherDialog::matchPattern(const string& s, const string& pattern) bool LauncherDialog::matchPattern(const string& s, const string& pattern) const
{ {
// This method is modelled after strcasestr, which we don't use // This method is modelled after strcasestr, which we don't use
// because it isn't guaranteed to be available everywhere // because it isn't guaranteed to be available everywhere

View File

@ -67,7 +67,19 @@ class LauncherDialog : public Dialog
@return md5sum if a valid ROM file, else the empty string @return md5sum if a valid ROM file, else the empty string
*/ */
string selectedRomMD5(); const string& selectedRomMD5();
/**
Get node for the currently selected directory
@return FilesystemNode currently active
*/
const FilesystemNode& currentNode() const { return myCurrentNode; }
/**
Reload the current listing
*/
void reload() { updateListing(); }
protected: protected:
virtual void handleKeyDown(int ascii, int keycode, int modifiers); virtual void handleKeyDown(int ascii, int keycode, int modifiers);
@ -83,7 +95,7 @@ class LauncherDialog : public Dialog
void loadRomInfo(); void loadRomInfo();
void handleContextMenu(); void handleContextMenu();
void setListFilters(); void setListFilters();
bool matchPattern(const string& s, const string& pattern); bool matchPattern(const string& s, const string& pattern) const;
private: private:
ButtonWidget* myStartButton; ButtonWidget* myStartButton;

View File

@ -22,6 +22,7 @@
#include "bspf.hxx" #include "bspf.hxx"
#include "Launcher.hxx"
#include "LauncherFilterDialog.hxx" #include "LauncherFilterDialog.hxx"
#include "BrowserDialog.hxx" #include "BrowserDialog.hxx"
#include "DialogContainer.hxx" #include "DialogContainer.hxx"
@ -107,7 +108,12 @@ RomAuditDialog::~RomAuditDialog()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void RomAuditDialog::loadConfig() void RomAuditDialog::loadConfig()
{ {
myRomPath->setEditString(instance().settings().getString("romdir")); const string& currentdir =
instance().launcher().currentNode().getRelativePath();
const string& path = currentdir == "" ?
instance().settings().getString("romdir") : currentdir;
myRomPath->setEditString(path);
myResults1->setLabel(""); myResults1->setLabel("");
myResults2->setLabel(""); myResults2->setLabel("");
} }
@ -192,6 +198,7 @@ void RomAuditDialog::handleCommand(CommandSender* sender, int cmd,
case kConfirmAuditCmd: case kConfirmAuditCmd:
auditRoms(); auditRoms();
instance().launcher().reload();
break; break;
case kChooseAuditDirCmd: case kChooseAuditDirCmd:
@ -202,7 +209,7 @@ void RomAuditDialog::handleCommand(CommandSender* sender, int cmd,
case kAuditDirChosenCmd: case kAuditDirChosenCmd:
{ {
FilesystemNode dir(myBrowser->getResult()); FilesystemNode dir(myBrowser->getResult());
myRomPath->setEditString(dir.getPath()); myRomPath->setEditString(dir.getRelativePath());
myResults1->setLabel(""); myResults1->setLabel("");
myResults2->setLabel(""); myResults2->setLabel("");
break; break;