[Scummvm-cvs-logs] scummvm-tools master -> 2b398567eb059a01a6f6995b84acf65f4750601c

criezy criezy at scummvm.org
Sat Nov 26 20:01:03 CET 2011


This automated email contains information about 7 new commits which have been
pushed to the 'scummvm-tools' repo located at https://github.com/scummvm/scummvm-tools .

Summary:
7314a7557b TOOLS: Improve input file check in the GUI Tools
adcdbafc33 TOOLS: Fix input files check when running the tool more than once
a7b918e4b4 TOOLS: Improve tools detection from input file in GUI
4d2d34503b TOOL: Fix incorrect documentation
de927fdffc TOOLS: Fix extra inputs page in GUI
804c334960 TOOLS: GUI: Fix inactive previous button on two of the pages
2b398567eb TOOLS: GUI: Go directly to extra input page after tool selection


Commit: 7314a7557bbc957f92d4697726bedfc4f744a5de
    https://github.com/scummvm/scummvm-tools/commit/7314a7557bbc957f92d4697726bedfc4f744a5de
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2011-11-26T04:06:45-08:00

Commit Message:
TOOLS: Improve input file check in the GUI Tools

It now uses the same check that as been recently added when parsing
the input files in the CLI Tools. This is the first part of a fix for tools
expecting multiple inputs, as depending on the first file selected by
the user it could crash the application when trying to run the tool.

Changed paths:
    gui/gui_tools.cpp
    tool.cpp
    tool.h



diff --git a/gui/gui_tools.cpp b/gui/gui_tools.cpp
index 26214fd..e467434 100644
--- a/gui/gui_tools.cpp
+++ b/gui/gui_tools.cpp
@@ -137,8 +137,10 @@ bool ToolGUI::outputToDirectory() const {
 
 void ToolGUI::run(const Configuration &conf) const {
 	size_t i = 0;
-	for (wxArrayString::const_iterator iter = conf.inputFilePaths.begin(); iter != conf.inputFilePaths.end(); ++iter, ++i)
-		_backend->_inputPaths[i].path = (const char *)iter->mb_str();
+	for (wxArrayString::const_iterator iter = conf.inputFilePaths.begin(); iter != conf.inputFilePaths.end(); ++iter, ++i) {
+		if (!_backend->addInputPath(std::string(iter->mb_str())))
+			_backend->error("Unexpected input file '%s'!", (const char*)iter->mb_str());
+	}
 	_backend->_outputPath = std::string(conf.outputPath.mb_str());
 
 	CompressionTool *compression = dynamic_cast<CompressionTool *>(_backend);
diff --git a/tool.cpp b/tool.cpp
index 973c73c..6a131c5 100644
--- a/tool.cpp
+++ b/tool.cpp
@@ -99,33 +99,10 @@ int Tool::run(const std::deque<std::string> &args) {
 	for (int i = 0 ; i < nbExpectedInputs ; ++i) {
 		std::string in = _arguments.front();
 		_arguments.pop_front();
-		int bestMatchIndex = -1;
-		InspectionMatch bestMatch = IMATCH_AWFUL;
-		for (ToolInputs::iterator iter = _inputPaths.begin(); iter != _inputPaths.end(); ++iter) {
-			if (!iter->path.empty())
-				continue;
-			InspectionMatch match = inspectInput(in, iter->file ? iter->format : std::string("/"));
-			if (match == IMATCH_PERFECT) {
-				bestMatch = IMATCH_PERFECT;
-				bestMatchIndex = (iter - _inputPaths.begin());
-				break;
-			} else if (bestMatch == IMATCH_AWFUL && match == IMATCH_POSSIBLE) {
-				bestMatch = IMATCH_POSSIBLE;
-				bestMatchIndex = (iter - _inputPaths.begin());
-			}
-		}
-		if (bestMatch == IMATCH_AWFUL) {
+		if (!addInputPath(in)) {
 			print("Unexpected input file '%s'!", in.c_str());
 			return -2;
 		}
-		if (!_inputPaths[bestMatchIndex].file) {
-			// Append '/' to input if it's not already done
-			size_t s = in.size();
-			if (in[s-1] != '/' && in[s-1] != '\\') {
-				in += '/';
-			}
-		}
-		_inputPaths[bestMatchIndex].path = in;
 	}
 
 	// We should have parsed all arguments by now
@@ -158,6 +135,36 @@ int Tool::run(const std::deque<std::string> &args) {
 	return 0;
 }
 
+bool Tool::addInputPath(const std::string& in) {
+	int bestMatchIndex = -1;
+	InspectionMatch bestMatch = IMATCH_AWFUL;
+	for (ToolInputs::iterator iter = _inputPaths.begin(); iter != _inputPaths.end(); ++iter) {
+		if (!iter->path.empty())
+			continue;
+		InspectionMatch match = inspectInput(in, iter->file ? iter->format : std::string("/"));
+		if (match == IMATCH_PERFECT) {
+			bestMatch = IMATCH_PERFECT;
+			bestMatchIndex = (iter - _inputPaths.begin());
+			break;
+		} else if (bestMatch == IMATCH_AWFUL && match == IMATCH_POSSIBLE) {
+			bestMatch = IMATCH_POSSIBLE;
+			bestMatchIndex = (iter - _inputPaths.begin());
+		}
+	}
+	if (bestMatch == IMATCH_AWFUL) {
+		return false;
+	}
+	_inputPaths[bestMatchIndex].path = in;
+	if (!_inputPaths[bestMatchIndex].file) {
+		// Append '/' to input if it's not already done
+		size_t s = in.size();
+		if (in[s-1] != '/' && in[s-1] != '\\') {
+			_inputPaths[bestMatchIndex].path += '/';
+		}
+	}
+	return true;
+}
+
 void Tool::run() {
 	// Reset abort state
 	_abort = false;
diff --git a/tool.h b/tool.h
index 42d77f7..7f8cba3 100644
--- a/tool.h
+++ b/tool.h
@@ -95,6 +95,15 @@ public:
 	 * @param filename The file to inspect
 	 */
 	virtual InspectionMatch inspectInput(const Common::Filename &filename);
+	
+	/**
+	 * Check the given input path against the expected inputs that have not
+	 * yet been provided. If it finds a match the input is stored and the
+	 * function returns true. Otherwise it returns false.
+	 *
+	 * @param inputPath Input directory of file to store.
+	 */
+	bool addInputPath(const std::string& inputPath);
 
 	/**
 	 * Aborts executing of the tool, can be called from another thread.


Commit: adcdbafc335c5a298479abc409f1bbdeebdcc290
    https://github.com/scummvm/scummvm-tools/commit/adcdbafc335c5a298479abc409f1bbdeebdcc290
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2011-11-26T04:32:56-08:00

Commit Message:
TOOLS: Fix input files check when running the tool more than once

Also add a check on the number of inputs. This ensures the user has selected a file for each required input in the GUI.

Changed paths:
    gui/gui_tools.cpp
    tool.cpp
    tool.h



diff --git a/gui/gui_tools.cpp b/gui/gui_tools.cpp
index e467434..87a99dd 100644
--- a/gui/gui_tools.cpp
+++ b/gui/gui_tools.cpp
@@ -136,11 +136,16 @@ bool ToolGUI::outputToDirectory() const {
 }
 
 void ToolGUI::run(const Configuration &conf) const {
-	size_t i = 0;
-	for (wxArrayString::const_iterator iter = conf.inputFilePaths.begin(); iter != conf.inputFilePaths.end(); ++iter, ++i) {
+	// Set the input paths
+	_backend->clearInputPaths();
+	if (conf.inputFilePaths.size() < _backend->_inputPaths.size())
+		_backend->error("Too few input files!");
+	for (wxArrayString::const_iterator iter = conf.inputFilePaths.begin(); iter != conf.inputFilePaths.end(); ++iter) {
 		if (!_backend->addInputPath(std::string(iter->mb_str())))
 			_backend->error("Unexpected input file '%s'!", (const char*)iter->mb_str());
 	}
+		
+	// Set the output path
 	_backend->_outputPath = std::string(conf.outputPath.mb_str());
 
 	CompressionTool *compression = dynamic_cast<CompressionTool *>(_backend);
diff --git a/tool.cpp b/tool.cpp
index 6a131c5..ce069f0 100644
--- a/tool.cpp
+++ b/tool.cpp
@@ -92,8 +92,7 @@ int Tool::run(const std::deque<std::string> &args) {
 
 	// Read input files from CLI and match them to expected input.
 	// First make sure the all the input paths are unset 
-	for (ToolInputs::iterator iter = _inputPaths.begin(); iter != _inputPaths.end(); ++iter)
-		iter->path.clear();
+	clearInputPaths();
 	// Then match the remaining arguments with the input paths.
 	int nbExpectedInputs = _inputPaths.size();
 	for (int i = 0 ; i < nbExpectedInputs ; ++i) {
@@ -135,6 +134,11 @@ int Tool::run(const std::deque<std::string> &args) {
 	return 0;
 }
 
+void Tool::clearInputPaths() {
+	for (ToolInputs::iterator iter = _inputPaths.begin(); iter != _inputPaths.end(); ++iter)
+			iter->path.clear();
+}
+
 bool Tool::addInputPath(const std::string& in) {
 	int bestMatchIndex = -1;
 	InspectionMatch bestMatch = IMATCH_AWFUL;
diff --git a/tool.h b/tool.h
index 7f8cba3..f6f79be 100644
--- a/tool.h
+++ b/tool.h
@@ -95,7 +95,7 @@ public:
 	 * @param filename The file to inspect
 	 */
 	virtual InspectionMatch inspectInput(const Common::Filename &filename);
-	
+
 	/**
 	 * Check the given input path against the expected inputs that have not
 	 * yet been provided. If it finds a match the input is stored and the
@@ -106,6 +106,14 @@ public:
 	bool addInputPath(const std::string& inputPath);
 
 	/**
+	 * Clear the input paths previously given by calls to addInputPath()
+	 * If you run the same tools multiple times with different inputs you
+	 * will need to call this before giving the inputs for the second run
+	 * (and each additional run thereafter).
+	 */
+	void clearInputPaths();
+
+	/**
 	 * Aborts executing of the tool, can be called from another thread.
 	 * The progress will not be aborted until the next call to notifyProgress.
 	 */


Commit: a7b918e4b40d07c909de17d088af59b651a637b8
    https://github.com/scummvm/scummvm-tools/commit/a7b918e4b40d07c909de17d088af59b651a637b8
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2011-11-26T06:21:27-08:00

Commit Message:
TOOLS: Improve tools detection from input file in GUI

The tools that expected a directory were never detected because the
user could only select a file and not a directory. Now he still needs
to select a file but the directory that contains it is also checked and
the file name is stripped if needed to run the tool.

An alternative would have been to let the user select a directory, but
that would have meant the user needed to know if the tool expect a file
or a directory as input. Also because there is no wxPicker to select either
a file or a directory this would have needed additional radio buttons to
show either a file picker or a directory picker. All in all always asking for
a file here seemed more user friendly.

Changed paths:
    gui/gui_tools.cpp
    gui/gui_tools.h
    gui/pages.cpp
    gui/pages.h
    tools.cpp
    tools.h



diff --git a/gui/gui_tools.cpp b/gui/gui_tools.cpp
index 87a99dd..f7a273f 100644
--- a/gui/gui_tools.cpp
+++ b/gui/gui_tools.cpp
@@ -62,7 +62,7 @@ wxArrayString ToolsGUI::getToolList(ToolType tt) const {
 }
 
 wxArrayString ToolsGUI::getToolList(const Common::Filename &filename, ToolType tt) const {
-	ToolList choices = inspectInput(filename, tt);
+	ToolList choices = inspectInput(filename, tt, true);
 	wxArrayString l;
 
 	for (ToolList::const_iterator tool = choices.begin(); tool != choices.end(); ++tool)
diff --git a/gui/gui_tools.h b/gui/gui_tools.h
index f13c392..387d5aa 100644
--- a/gui/gui_tools.h
+++ b/gui/gui_tools.h
@@ -161,7 +161,7 @@ public:
 	 *
 	 * @param filename The path to the file to inspect
 	 * @param tt Only check tools of this type
-	 * @return Returns all tools might be able to handle the file
+	 * @return Returns all tools might be able to handle the file or the directory containing that file
 	 */
 	wxArrayString getToolList(const Common::Filename &filename, ToolType tt = TOOLTYPE_ALL) const;
 
diff --git a/gui/pages.cpp b/gui/pages.cpp
index 8e820c4..e6f6ff3 100644
--- a/gui/pages.cpp
+++ b/gui/pages.cpp
@@ -283,6 +283,18 @@ wxWindow *ChooseToolPage::CreatePanel(wxWindow *parent) {
 void ChooseToolPage::save(wxWindow *panel) {
 	_configuration.selectedTool =
 		g_tools.get(static_cast<wxChoice *>(panel->FindWindowByName(wxT("ToolSelection")))->GetStringSelection());
+	
+	// Check if we should strip the input file names.
+	if (_configuration.selectedTool != NULL) {
+		wxArrayString filelist = _configuration.inputFilePaths;
+		for (unsigned int i = 0 ; i < filelist.size() ; ++i) {
+			Common::Filename filename = (const char *)filelist[i].mb_str();
+			Common::Filename dirname = filename.getPath();
+			if (_configuration.selectedTool->_backend->inspectInput(filename) == IMATCH_AWFUL &&
+				_configuration.selectedTool->_backend->inspectInput(dirname) != IMATCH_AWFUL)
+				_configuration.inputFilePaths[i] = wxString(dirname.getFullPath().c_str(), wxConvFile);
+		}
+	}
 }
 
 wxString ChooseToolPage::getHelp() {
@@ -300,6 +312,10 @@ void ChooseToolPage::onNext(wxWindow *panel) {
 		switchPage(new ChooseOutPage(_configuration));
 }
 
+void ChooseToolPage::onPrevious(wxWindow *panel) {
+	_configuration.selectedTool = NULL;
+}
+
 void ChooseToolPage::onChangeTool(wxCommandEvent &evt) {
 	wxChoice *tool = dynamic_cast<wxChoice *>(evt.GetEventObject());
 	wxStaticText *text = dynamic_cast<wxStaticText *>(tool->GetParent()->FindWindowByName(wxT("ToolText")));
@@ -384,7 +400,8 @@ wxWindow *ChooseInPage::CreatePanel(wxWindow *parent) {
 	sizer->AddSpacer(10);
 
 
-	//if (input._file) {
+	// Always ask for a file here. When checking the input it will also check the
+	// directory for tools that expect a directory as input.
 	wxSizer *pickersizer = new wxBoxSizer(wxHORIZONTAL);
 
 	wxFilePickerCtrl *picker = new wxFilePickerCtrl(
@@ -402,18 +419,6 @@ wxWindow *ChooseInPage::CreatePanel(wxWindow *parent) {
 
 	sizer->Add(pickersizer, wxSizerFlags().Expand());
 	sizer->AddSpacer(30);
-	/*
-	// TODO: There is no way to select directory input, yet
-	} else {
-		inputbox->Add(new wxDirPickerCtrl(
-				panel, wxID_ANY, wxEmptyString, wxT("Select a folder"),
-				wxDefaultPosition, wxDefaultSize,
-				wxFLP_USE_TEXTCTRL | wxFLP_OPEN, wxDefaultValidator,
-				wxT("InputPicker")),
-			wxSizerFlags().Expand());
-
-	}
-	*/
 
 	SetAlignedSizer(panel, sizer);
 
@@ -423,26 +428,25 @@ wxWindow *ChooseInPage::CreatePanel(wxWindow *parent) {
 void ChooseInPage::save(wxWindow *panel) {
 	_configuration.inputFilePaths.clear();
 
-	wxDirPickerCtrl *inDirWindow = dynamic_cast<wxDirPickerCtrl *>(panel->FindWindowByName(wxT("InputPicker")));
 	wxFilePickerCtrl *inFileWindow = dynamic_cast<wxFilePickerCtrl *>(panel->FindWindowByName(wxT("InputPicker")));
-
-	if (inDirWindow)
-		_configuration.inputFilePaths.Add(inDirWindow ->GetPath());
-	if (inFileWindow)
-		_configuration.inputFilePaths.Add(inFileWindow->GetPath());
+	Common::Filename filename = (const char *)inFileWindow ->GetPath().mb_str();
+
+	// Check if we should strip the file name.
+	// We do it only if the tools is known and it expects a directory as input.
+	if (_configuration.selectedTool != NULL) {
+		Common::Filename dirname = filename.getPath();
+		if (_configuration.selectedTool->_backend->inspectInput(filename) == IMATCH_AWFUL &&
+			_configuration.selectedTool->_backend->inspectInput(dirname) != IMATCH_AWFUL)
+			filename = dirname;
+	}
+	
+	_configuration.inputFilePaths.Add(wxString(filename.getFullPath().c_str(), wxConvFile));
 }
 
 void ChooseInPage::onNext(wxWindow *panel) {
-
-	wxDirPickerCtrl *inDirWindow = dynamic_cast<wxDirPickerCtrl *>(panel->FindWindowByName(wxT("InputPicker")));
 	wxFilePickerCtrl *inFileWindow = dynamic_cast<wxFilePickerCtrl *>(panel->FindWindowByName(wxT("InputPicker")));
 
-	Common::Filename filename;
-
-	if (inDirWindow)
-		filename = (const char *)inDirWindow ->GetPath().mb_str();
-	if (inFileWindow)
-		filename = (const char *)inFileWindow ->GetPath().mb_str();
+	Common::Filename filename = (const char *)inFileWindow ->GetPath().mb_str();
 
 	if (_configuration.advanced) {
 		if (_configuration.selectedTool->getInputList().size() > 1)
@@ -464,6 +468,10 @@ void ChooseInPage::onNext(wxWindow *panel) {
 	}
 }
 
+void ChooseInPage::onPrevious(wxWindow *panel) {
+	_configuration.inputFilePaths.clear();	
+}
+
 wxString ChooseInPage::getHelp() {
 	return wxT("Choose the input file.\n\nIf you are unsure, a general hint ")
 		wxT("is to select the file with an extension that is different from ")
@@ -1607,6 +1615,8 @@ bool FinishPage::onCancel(wxWindow *panel) {
 
 	wxCheckBox *restart = static_cast<wxCheckBox *>(panel->FindWindowByName(wxT("ProcessOther")));
 	if (restart->GetValue()) {
+		_configuration.selectedTool = NULL;
+		_configuration.inputFilePaths.clear();
 		_topframe->switchToFirstPage();
 		return false;
 	} else {
@@ -1659,6 +1669,8 @@ bool FailurePage::onCancel(wxWindow *panel) {
 	// On that page, that's the Finish button
 	wxCheckBox *restart = static_cast<wxCheckBox *>(panel->FindWindowByName(wxT("ProcessOther")));
 	if (restart->GetValue()) {
+		_configuration.selectedTool = NULL;
+		_configuration.inputFilePaths.clear();
 		_topframe->switchToFirstPage();
 		return false;
 	} else {
diff --git a/gui/pages.h b/gui/pages.h
index 2f49a8d..ce5457b 100644
--- a/gui/pages.h
+++ b/gui/pages.h
@@ -179,6 +179,7 @@ public:
 	wxWindow *CreatePanel(wxWindow *parent);
 
 	void onNext(wxWindow *panel);
+	void onPrevious(wxWindow *panel);
 
 	void save(wxWindow *panel);
 
@@ -216,6 +217,7 @@ public:
 	wxWindow *CreatePanel(wxWindow *parent);
 
 	void onNext(wxWindow *panel);
+	void onPrevious(wxWindow *panel);
 
 	wxString getHelp();
 
diff --git a/tools.cpp b/tools.cpp
index 1c678df..651407e 100644
--- a/tools.cpp
+++ b/tools.cpp
@@ -103,18 +103,23 @@ Tools::~Tools() {
 		delete *iter;
 }
 
-Tools::ToolList Tools::inspectInput(const Common::Filename &filename, ToolType type) const {
+Tools::ToolList Tools::inspectInput(const Common::Filename &filename, ToolType type, bool check_directory) const {
 	ToolList perfect_choices;
 	ToolList good_choices;
 	ToolList awful_choices;
+	
+	Common::Filename dirname;
+	if (check_directory && !filename.directory())
+		dirname = filename.getPath();
 
 	for (ToolList::const_iterator tool = _tools.begin(); tool != _tools.end(); ++tool) {
 		if (type == TOOLTYPE_ALL || (*tool)->getType() == type) {
-			InspectionMatch m = (*tool)->inspectInput(filename);
+			InspectionMatch fm = (*tool)->inspectInput(filename);
+			InspectionMatch dm = dirname.empty() ? IMATCH_AWFUL : (*tool)->inspectInput(dirname);
 
-			if (m == IMATCH_PERFECT)
+			if (fm == IMATCH_PERFECT || dm == IMATCH_PERFECT)
 				perfect_choices.push_back(*tool);
-			else if (m == IMATCH_POSSIBLE)
+			else if (fm == IMATCH_POSSIBLE || dm == IMATCH_POSSIBLE)
 				good_choices.push_back(*tool);
 			else
 				awful_choices.push_back(*tool);
diff --git a/tools.h b/tools.h
index 49273dc..7517a98 100644
--- a/tools.h
+++ b/tools.h
@@ -41,7 +41,7 @@ public:
 	 * Returns a list of the tools that supports opening the input file
 	 * specified in the input list.
 	 */
-	ToolList inspectInput(const Common::Filename &filename, ToolType type = TOOLTYPE_ALL) const;
+	ToolList inspectInput(const Common::Filename &filename, ToolType type = TOOLTYPE_ALL, bool check_directory = false) const;
 
 protected:
 	/** List of all tools */


Commit: 4d2d34503bf6317dfa25cbe5962198a12a5f40b7
    https://github.com/scummvm/scummvm-tools/commit/4d2d34503bf6317dfa25cbe5962198a12a5f40b7
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2011-11-26T06:24:37-08:00

Commit Message:
TOOL: Fix incorrect documentation

Changed paths:
    tool.h



diff --git a/tool.h b/tool.h
index f6f79be..f796441 100644
--- a/tool.h
+++ b/tool.h
@@ -90,7 +90,8 @@ public:
 
 	/**
 	 * Returns true if the file appears to be a valid input to this tool.
-	 * Default implementation always return true.
+	 * Default implementation checks the name versus the expected inputs
+	 * format.
 	 *
 	 * @param filename The file to inspect
 	 */


Commit: de927fdffc6e803f2507d0d28a6190b0a560eeac
    https://github.com/scummvm/scummvm-tools/commit/de927fdffc6e803f2507d0d28a6190b0a560eeac
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2011-11-26T10:41:37-08:00

Commit Message:
TOOLS: Fix extra inputs page in GUI

It now matches the inputs already given with the expected inputs from
the tool to know which ones are missing. Also it now shows a picker
for all the inputs even those for which we already have an input file
(but they are initialized with the path we have). This prepares the next
commit.

Changed paths:
    gui/pages.cpp



diff --git a/gui/pages.cpp b/gui/pages.cpp
index e6f6ff3..fcfd26c 100644
--- a/gui/pages.cpp
+++ b/gui/pages.cpp
@@ -469,7 +469,7 @@ void ChooseInPage::onNext(wxWindow *panel) {
 }
 
 void ChooseInPage::onPrevious(wxWindow *panel) {
-	_configuration.inputFilePaths.clear();	
+	_configuration.inputFilePaths.clear();
 }
 
 wxString ChooseInPage::getHelp() {
@@ -505,24 +505,29 @@ wxWindow *ChooseExtraInPage::CreatePanel(wxWindow *parent) {
 	sizer->Add(new wxStaticText(panel, wxID_ANY, tool.getHelp()));
 
 	sizer->AddSpacer(10);
+	
+	// Work out which files are already set
+	tool._backend->clearInputPaths();
+	wxArrayString filelist = _configuration.inputFilePaths;
+	for (unsigned int i = 0 ; i < filelist.size() ; ++i)
+		tool._backend->addInputPath((const char *)filelist[i].mb_str());
 
 	// Create input selection
 	wxSizer *inputbox = new wxBoxSizer(wxHORIZONTAL);
 	wxStaticBoxSizer *inputsizer = new wxStaticBoxSizer(wxVERTICAL, panel, wxT("Input files"));
 
-	int i = 1;
 	const ToolInputs &inputs = tool.getInputList();
-	wxASSERT_MSG(inputs.size() > 1, wxT("Extra input page should not display with only one input"));
 
-	for (ToolInputs::const_iterator iter = inputs.begin() + 1; iter != inputs.end(); ++iter) {
+	int i = 0;
+	for (ToolInputs::const_iterator iter = inputs.begin(); iter != inputs.end(); ++iter, ++i) {
 		const ToolInput &input = *iter;
 
 		wxString windowName = wxT("InputPicker");
 		windowName << i;
 
 		wxString inputFile;
-		if (_configuration.inputFilePaths.size() > (size_t)i)
-			inputFile = _configuration.inputFilePaths[i];
+		if (!input.path.empty())
+			inputFile = wxString(input.path.c_str(), wxConvFile);
 
 		if (input.file) {
 			inputsizer->Add(new wxFilePickerCtrl(
@@ -542,7 +547,6 @@ wxWindow *ChooseExtraInPage::CreatePanel(wxWindow *parent) {
 			panel->Connect(wxEVT_COMMAND_DIRPICKER_CHANGED, wxFileDirPickerEventHandler(ChooseIOPage::onSelectFile), NULL, this);
 
 		}
-		++i;
 	}
 	inputbox->Add(inputsizer, wxSizerFlags(2).Expand());
 	inputbox->Add(20, 20, 1, wxEXPAND);
@@ -566,14 +570,12 @@ void ChooseExtraInPage::save(wxWindow *panel) {
 
 	const ToolGUI &tool = *_configuration.selectedTool;
 
-	// Remove all additional inputs
-	wxArrayString filelist = _configuration.inputFilePaths;
-	if (filelist.size() > 1)
-		filelist.erase(filelist.begin() + 1, filelist.end());
+	// Remove all inputs
+	_configuration.inputFilePaths.clear();
 
-	int i = 1;
+	int i = 0;
 	ToolInputs inputs = tool.getInputList();
-	for (ToolInputs::const_iterator iter = inputs.begin(); iter != inputs.end(); ++iter) {
+	for (ToolInputs::const_iterator iter = inputs.begin(); iter != inputs.end(); ++iter, ++i) {
 		wxString windowName = wxT("InputPicker");
 		windowName << i;
 
@@ -584,13 +586,11 @@ void ChooseExtraInPage::save(wxWindow *panel) {
 			_configuration.inputFilePaths.Add(inDirWindow ->GetPath());
 		if (inFileWindow)
 			_configuration.inputFilePaths.Add(inFileWindow->GetPath());
-
-		++i;
 	}
 }
 
 wxString ChooseExtraInPage::getHelp() {
-	return wxT("Select any additional input files (usually extra disks) for this tool.");
+	return wxT("Select all input files or directories for this tool.");
 }
 
 void ChooseExtraInPage::onNext(wxWindow *panel) {


Commit: 804c334960ba623e76e8691c7628f499c6caa37b
    https://github.com/scummvm/scummvm-tools/commit/804c334960ba623e76e8691c7628f499c6caa37b
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2011-11-26T10:42:58-08:00

Commit Message:
TOOLS: GUI: Fix inactive previous button on two of the pages

Changed paths:
    gui/pages.cpp



diff --git a/gui/pages.cpp b/gui/pages.cpp
index fcfd26c..6cc223f 100644
--- a/gui/pages.cpp
+++ b/gui/pages.cpp
@@ -314,6 +314,7 @@ void ChooseToolPage::onNext(wxWindow *panel) {
 
 void ChooseToolPage::onPrevious(wxWindow *panel) {
 	_configuration.selectedTool = NULL;
+	WizardPage::onPrevious(panel);
 }
 
 void ChooseToolPage::onChangeTool(wxCommandEvent &evt) {
@@ -470,6 +471,7 @@ void ChooseInPage::onNext(wxWindow *panel) {
 
 void ChooseInPage::onPrevious(wxWindow *panel) {
 	_configuration.inputFilePaths.clear();
+	ChooseIOPage::onPrevious(panel);
 }
 
 wxString ChooseInPage::getHelp() {


Commit: 2b398567eb059a01a6f6995b84acf65f4750601c
    https://github.com/scummvm/scummvm-tools/commit/2b398567eb059a01a6f6995b84acf65f4750601c
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2011-11-26T10:59:27-08:00

Commit Message:
TOOLS: GUI: Go directly to extra input page after tool selection

For tools expecting multiple inputs, after selecting the tool the user
had first to go to the normal input page to select one input and then
to the extra input page to select the other inputs. Now he gets directly
to the extra input page where he can select all the inputs.

The other input page is still used when the user decide to select a file
rather than a tool, the tool is then guessed from the file and the user
gets to the extra inputs page if the tools require other inputs (as before).

Changed paths:
    gui/pages.cpp



diff --git a/gui/pages.cpp b/gui/pages.cpp
index 6cc223f..11c7228 100644
--- a/gui/pages.cpp
+++ b/gui/pages.cpp
@@ -304,9 +304,7 @@ wxString ChooseToolPage::getHelp() {
 void ChooseToolPage::onNext(wxWindow *panel) {
 	const ToolGUI *tool = g_tools.get(static_cast<wxChoice *>(panel->FindWindowByName(wxT("ToolSelection")))->GetStringSelection());
 
-	if (_configuration.advanced)
-		switchPage(new ChooseInPage(_configuration));
-	else if (tool && tool->getInputList().size() > 1)
+	if (_configuration.advanced || (tool && tool->getInputList().size() > _configuration.inputFilePaths.size()))
 		switchPage(new ChooseExtraInPage(_configuration));
 	else
 		switchPage(new ChooseOutPage(_configuration));






More information about the Scummvm-git-logs mailing list