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
(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!

View File

@ -21,6 +21,7 @@
#include "Version.hxx"
#include "OSystem.hxx"
#include "Settings.hxx"
#include "FSNode.hxx"
#include "FrameBuffer.hxx"
#include "bspf.hxx"
@ -57,7 +58,19 @@ FBInitStatus Launcher::initializeVideo()
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string Launcher::selectedRomMD5()
const string& Launcher::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 OSystem;
class FilesystemNode;
#include "DialogContainer.hxx"
#include "FrameBuffer.hxx"
@ -53,7 +54,17 @@ class Launcher : public DialogContainer
/**
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:
// The width and height of this dialog

View File

@ -213,13 +213,13 @@ LauncherDialog::~LauncherDialog()
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string LauncherDialog::selectedRomMD5()
const string& LauncherDialog::selectedRomMD5()
{
string extension;
int item = myList->getSelected();
if(item < 0 || myGameList->isDir(item) ||
!LauncherFilterDialog::isValidRomName(myGameList->name(item), extension))
return "";
return EmptyString;
// Make sure we have a valid md5 for this ROM
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
// 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
*/
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:
virtual void handleKeyDown(int ascii, int keycode, int modifiers);
@ -83,7 +95,7 @@ class LauncherDialog : public Dialog
void loadRomInfo();
void handleContextMenu();
void setListFilters();
bool matchPattern(const string& s, const string& pattern);
bool matchPattern(const string& s, const string& pattern) const;
private:
ButtonWidget* myStartButton;

View File

@ -22,6 +22,7 @@
#include "bspf.hxx"
#include "Launcher.hxx"
#include "LauncherFilterDialog.hxx"
#include "BrowserDialog.hxx"
#include "DialogContainer.hxx"
@ -107,7 +108,12 @@ RomAuditDialog::~RomAuditDialog()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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("");
myResults2->setLabel("");
}
@ -192,6 +198,7 @@ void RomAuditDialog::handleCommand(CommandSender* sender, int cmd,
case kConfirmAuditCmd:
auditRoms();
instance().launcher().reload();
break;
case kChooseAuditDirCmd:
@ -202,7 +209,7 @@ void RomAuditDialog::handleCommand(CommandSender* sender, int cmd,
case kAuditDirChosenCmd:
{
FilesystemNode dir(myBrowser->getResult());
myRomPath->setEditString(dir.getPath());
myRomPath->setEditString(dir.getRelativePath());
myResults1->setLabel("");
myResults2->setLabel("");
break;