[Scummvm-cvs-logs] SF.net SVN: scummvm: [28631] tools/branches/gsoc2007-toolsgui/tools_gui.cpp

lightcast at users.sourceforge.net lightcast at users.sourceforge.net
Thu Aug 16 08:05:08 CEST 2007


Revision: 28631
          http://scummvm.svn.sourceforge.net/scummvm/?rev=28631&view=rev
Author:   lightcast
Date:     2007-08-15 23:05:08 -0700 (Wed, 15 Aug 2007)

Log Message:
-----------
Selecting files now works on Linux.  On Windows an unspecified wildcard in a wxfileDialog or wxDirDialog would default to *.*, but Linux did not.
Capturing output from the tools now works on Linux.  Now it reads one character at a time instead of reading into a buffer.

Modified Paths:
--------------
    tools/branches/gsoc2007-toolsgui/tools_gui.cpp

Modified: tools/branches/gsoc2007-toolsgui/tools_gui.cpp
===================================================================
--- tools/branches/gsoc2007-toolsgui/tools_gui.cpp	2007-08-15 22:00:31 UTC (rev 28630)
+++ tools/branches/gsoc2007-toolsgui/tools_gui.cpp	2007-08-16 06:05:08 UTC (rev 28631)
@@ -658,6 +658,9 @@
 		for (size_t x = 0; x < inputFiles.Count(); x++) {
 			wxString commandString = wxT("");
 
+#ifndef __WXMSW__
+			commandString += wxT("./");
+#endif
 			commandString += selectedTool;
 			commandString += wxT(" ");
 			commandString += compressionType;
@@ -765,18 +768,14 @@
 			this->_toolOutput->AppendText(wxT("\n\n"));
 
 			wxProcess *command = new wxProcess(wxPROCESS_REDIRECT);
-			wxChar *buffer = new wxChar[1024];
 
 			wxExecute(commandString, wxEXEC_ASYNC, command);
 
 			while (!command->GetInputStream()->Eof()) {
-				command->GetInputStream()->Read(buffer, 1023);
-				buffer[command->GetInputStream()->LastRead()] = wxT('\0');
-				this->_toolOutput->AppendText(buffer);
+				wxChar outputChar = command->GetInputStream()->GetC();
+				this->_toolOutput->AppendText(outputChar);
 			}
 
-			delete [] buffer;
-
 			this->_toolOutput->AppendText(wxT("\n------------------------------\n"));
 			this->_toolOutput->AppendText(wxT("Operation Finished\n"));
 			this->_toolOutput->AppendText(wxT("------------------------------\n"));
@@ -910,7 +909,7 @@
 }
 
 void ExtractionPanel::OnExtractionInput1Browse(wxCommandEvent &event) {
-	LocationDialog *dialog = new LocationDialog(this->_input1Panel->_text, this->_input1Panel->_isFileChooser, wxT(""));
+	LocationDialog *dialog = new LocationDialog(this->_input1Panel->_text, this->_input1Panel->_isFileChooser, wxT("*.*"));
 	dialog->prompt();
 
 	dialog->_dialog->Destroy();
@@ -918,7 +917,7 @@
 }
 
 void ExtractionPanel::OnExtractionInput2Browse(wxCommandEvent &event) {
-	LocationDialog *dialog = new LocationDialog(this->_input2Panel->_text, this->_input2Panel->_isFileChooser, wxT(""));
+	LocationDialog *dialog = new LocationDialog(this->_input2Panel->_text, this->_input2Panel->_isFileChooser, wxT("*.*"));
 	dialog->prompt();
 
 	dialog->_dialog->Destroy();
@@ -926,7 +925,7 @@
 }
 
 void ExtractionPanel::OnExtractionOutputBrowse(wxCommandEvent &event) {
-	LocationDialog *dialog = new LocationDialog(this->_outputPanel->_text, this->_outputPanel->_isFileChooser, wxT(""));
+	LocationDialog *dialog = new LocationDialog(this->_outputPanel->_text, this->_outputPanel->_isFileChooser, wxT("*.*"));
 	dialog->prompt();
 	
 	dialog->_dialog->Destroy();
@@ -967,6 +966,9 @@
 		for (size_t x = 0; x < inputFiles.Count(); x++) {
 			wxString commandString = wxT("");
 
+#ifndef __WXMSW__
+			commandString += wxT("./");
+#endif
 			commandString += selectedTool;
 			commandString += wxT(" ");
 
@@ -1003,18 +1005,13 @@
 			this->_toolOutput->AppendText(wxT("\n\n"));
 
 			wxProcess *command = new wxProcess(wxPROCESS_REDIRECT);
-			wxChar *buffer = new wxChar[1024];
-
 			wxExecute(commandString, wxEXEC_ASYNC, command);
 
 			while (!command->GetInputStream()->Eof()) {
-				command->GetInputStream()->Read(buffer, 1023);
-				buffer[command->GetInputStream()->LastRead()] = wxT('\0');
-				this->_toolOutput->AppendText(buffer);
+				wxChar outputChar = command->GetInputStream()->GetC();
+				this->_toolOutput->AppendText(outputChar);
 			}
 
-			delete [] buffer;
-
 			this->_toolOutput->AppendText(wxT("\n------------------------------\n"));
 			this->_toolOutput->AppendText(wxT("Operation Finished\n"));
 			this->_toolOutput->AppendText(wxT("------------------------------\n"));


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list