mirror of
https://github.com/scummvm/scummvm-tools.git
synced 2026-05-21 05:40:44 +00:00
*Improved input recognition with information from the mailing list.
*A tool can now either match input perfectly, possibly or awful. So less options are displayed to the user (meaning the ChooseTool page can now be skipped most of the time). *Improved layout. *The Line Label at the bottom now show the name of the tool that's 'running'. svn-id: r43031
This commit is contained in:
@@ -158,12 +158,13 @@ void Tool::run() {
|
||||
execute();
|
||||
}
|
||||
|
||||
bool Tool::inspectInput(const Filename &filename) {
|
||||
InspectionMatch Tool::inspectInput(const Filename &filename) {
|
||||
for (ToolInputs::iterator iter = _inputPaths.begin(); iter != _inputPaths.end(); ++iter) {
|
||||
std::string p = iter->format;
|
||||
if (p == "/") {
|
||||
// Directory, we don't handle this yet, display all tools
|
||||
return true;
|
||||
// TODO
|
||||
// Directory, we don't handle this yet, don't display at all
|
||||
return IMATCH_AWFUL;
|
||||
}
|
||||
|
||||
Filename cmp_filename = p;
|
||||
@@ -171,24 +172,24 @@ bool Tool::inspectInput(const Filename &filename) {
|
||||
if (cmp_filename.getName() == "*") {
|
||||
if (cmp_filename.getExtension() == "*")
|
||||
// Match anything!
|
||||
return true;
|
||||
return IMATCH_POSSIBLE;
|
||||
else if (scumm_stricmp(cmp_filename.getExtension().c_str(), filename.getExtension().c_str()) == 0)
|
||||
// Extensions are the same
|
||||
return true;
|
||||
return IMATCH_PERFECT;
|
||||
} else {
|
||||
// Match on filename
|
||||
if (cmp_filename.getName() == filename.getName()) {
|
||||
if (cmp_filename.getExtension() == "*")
|
||||
return true;
|
||||
return IMATCH_PERFECT;
|
||||
else if (scumm_stricmp(cmp_filename.getExtension().c_str(), filename.getExtension().c_str()) == 0)
|
||||
// Filenames are identical
|
||||
return true;
|
||||
return IMATCH_PERFECT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Didn't match any of our inputs
|
||||
return false;
|
||||
return IMATCH_AWFUL;
|
||||
}
|
||||
|
||||
void Tool::setPrintFunction(void (*f)(void *, const char *), void *udata) {
|
||||
|
||||
Reference in New Issue
Block a user