[Scummvm-cvs-logs] SF.net SVN: scummvm:[42670] tools/branches/gsoc2009-gui
Remere at users.sourceforge.net
Remere at users.sourceforge.net
Thu Jul 23 03:41:14 CEST 2009
Revision: 42670
http://scummvm.svn.sourceforge.net/scummvm/?rev=42670&view=rev
Author: Remere
Date: 2009-07-23 01:41:14 +0000 (Thu, 23 Jul 2009)
Log Message:
-----------
*Started on CLI interface, already works but there are many edges to sort out.
*Added a common 'Tools' class to be used by both the CLI and the GUI, right now it's NOT in use by the GUI, so there is some code clutter.
*Rename gui/tools.h to gui/tools.cpp
*Tools now know their own type.
*Some other small changes.
Modified Paths:
--------------
tools/branches/gsoc2009-gui/compress.cpp
tools/branches/gsoc2009-gui/compress.h
tools/branches/gsoc2009-gui/compress_agos.cpp
tools/branches/gsoc2009-gui/compress_gob.cpp
tools/branches/gsoc2009-gui/compress_kyra.cpp
tools/branches/gsoc2009-gui/compress_queen.cpp
tools/branches/gsoc2009-gui/compress_saga.cpp
tools/branches/gsoc2009-gui/compress_scumm_bun.cpp
tools/branches/gsoc2009-gui/compress_scumm_san.cpp
tools/branches/gsoc2009-gui/compress_scumm_sou.cpp
tools/branches/gsoc2009-gui/compress_sword1.cpp
tools/branches/gsoc2009-gui/compress_sword2.cpp
tools/branches/gsoc2009-gui/compress_tinsel.cpp
tools/branches/gsoc2009-gui/compress_touche.cpp
tools/branches/gsoc2009-gui/compress_tucker.cpp
tools/branches/gsoc2009-gui/extract_agos.cpp
tools/branches/gsoc2009-gui/extract_gob_stk.cpp
tools/branches/gsoc2009-gui/extract_kyra.cpp
tools/branches/gsoc2009-gui/extract_loom_tg16.cpp
tools/branches/gsoc2009-gui/extract_mm_apple.cpp
tools/branches/gsoc2009-gui/extract_mm_c64.cpp
tools/branches/gsoc2009-gui/extract_mm_nes.cpp
tools/branches/gsoc2009-gui/extract_parallaction.cpp
tools/branches/gsoc2009-gui/extract_scumm_mac.cpp
tools/branches/gsoc2009-gui/extract_zak_c64.cpp
tools/branches/gsoc2009-gui/gui/pages.cpp
tools/branches/gsoc2009-gui/tool.cpp
tools/branches/gsoc2009-gui/tool.h
Added Paths:
-----------
tools/branches/gsoc2009-gui/cli_main.cpp
tools/branches/gsoc2009-gui/cli_tools.cpp
tools/branches/gsoc2009-gui/cli_tools.h
tools/branches/gsoc2009-gui/gui/gui_tools.cpp
tools/branches/gsoc2009-gui/gui/gui_tools.h
tools/branches/gsoc2009-gui/tools.cpp
tools/branches/gsoc2009-gui/tools.h
Removed Paths:
-------------
tools/branches/gsoc2009-gui/gui/tools.cpp
tools/branches/gsoc2009-gui/gui/tools.h
Property Changed:
----------------
tools/branches/gsoc2009-gui/
Property changes on: tools/branches/gsoc2009-gui
___________________________________________________________________
Added: svn:mergeinfo
+ /tools/trunk:41370-42088
Added: tools/branches/gsoc2009-gui/cli_main.cpp
===================================================================
--- tools/branches/gsoc2009-gui/cli_main.cpp (rev 0)
+++ tools/branches/gsoc2009-gui/cli_main.cpp 2009-07-23 01:41:14 UTC (rev 42670)
@@ -0,0 +1,30 @@
+/* cli_main.cpp - Main entry point for the CLI tool, very thin
+ * Copyright (C) 2009 The ScummVM project
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL
+ * $Id
+ *
+ */
+
+#include "cli_tools.h"
+
+int main(int argc, char *argv[]) {
+ ToolsCLI cli;
+ return cli.run(argc, argv);
+}
+
+
Property changes on: tools/branches/gsoc2009-gui/cli_main.cpp
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Date Rev Author URL Id
Added: svn:eol-style
+ native
Added: tools/branches/gsoc2009-gui/cli_tools.cpp
===================================================================
--- tools/branches/gsoc2009-gui/cli_tools.cpp (rev 0)
+++ tools/branches/gsoc2009-gui/cli_tools.cpp 2009-07-23 01:41:14 UTC (rev 42670)
@@ -0,0 +1,146 @@
+/* cli_tools - CLI interface for the tools
+ * Copyright (C) 2009 The ScummVM project
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL
+ * $Id
+ *
+ */
+
+#include <iostream>
+
+#include "cli_tools.h"
+
+ToolsCLI::ToolsCLI() {
+}
+
+ToolsCLI::~ToolsCLI() {
+}
+
+int ToolsCLI::run(int argc, char *argv[]) {
+ // No matter what we ouput, we should begin with a newline
+ std::cout << "\n";
+
+ if (argc == 1) {
+ // Run without any arguments
+ printHelp();
+ return 0;
+ }
+
+ std::deque<char *> arguments(argv, argv + argc);
+ arguments.pop_front(); // Pop our own name
+
+ ToolType type = TOOLTYPE_ALL;
+
+ // Check first argument
+ std::string option = arguments.front();
+ if (option == "--tool" || option == "-t") {
+ arguments.pop_front();
+ for (ToolList::iterator iter = _tools.begin(); iter != _tools.end(); ++iter) {
+ Tool *tool = *iter;
+ if (arguments.front() == tool->getName()) {
+ // Run the tool, first argument will be name, very nice!
+ return tool->run(arguments.size(), &arguments.front());
+ }
+ }
+ std::cout << "\tUnknown tool, make sure you input one of the following:\n";
+ printTools();
+ } else if (option == "--help" || option == "-h") {
+ printHelp();
+ } else if (option == "--list" || option == "-l") {
+ printTools();
+ } else {
+ // Allow user to the narrow choices
+ if(option == "compress") {
+ type = TOOLTYPE_COMPRESSION;
+ arguments.pop_front();
+ } else if(option == "extract") {
+ type = TOOLTYPE_EXTRACTION;
+ arguments.pop_front();
+ }
+
+ // Find out what tools take this file as input
+ ToolList choices = inspectInput(type, arguments);
+ Tool *tool = NULL;
+
+ if (choices.size() > 1) {
+ std::cout << "\tMultiple tools accept this input:\n\n";
+
+ // Present a list of possible tools
+ int i = 1;
+ for (ToolList::iterator choice = choices.begin(); choice != choices.end(); ++choice, ++i) {
+ std::cout << "\t" << i << ") " << (*choice)->getName() << "\n";
+ }
+
+ std::cout << "Which tool to use: ";
+ i = 0;
+ while(true) {
+
+ // Read input
+ std::cin >> i;
+
+ // Valid ?
+ if(std::cin && i >= 1 && i < choices.size())
+ break;
+
+ std::cout << "Invalid input, try again: ";
+
+ // Clear any error flags
+ std::cin.clear();
+
+ // Skip invalid input characters
+ std::cin.ignore(1000, '\n');
+ }
+
+ // Account for the fact arrays start at 0
+ tool = choices[i - 1];
+ } else {
+ tool = choices.front();
+ }
+
+ std::cout << "\tRunning using " << tool->getName() << "\n";
+
+ // Run the tool, with the remaining arguments
+ // We also add the name of the tool so it can displayed (requires an evil cast but it's safe)
+ std::string name = tool->getName();
+ arguments.push_front(const_cast<char *>(name.c_str()));
+ return tool->run(arguments.size(), &arguments.front());
+ }
+
+ return 0;
+}
+
+void ToolsCLI::printHelp() {
+ std::cout <<
+ "\tScumm VM Tools master interface\n" <<
+ "\n" <<
+ "\tCommon use:\n" <<
+ "\ttools [--tool <tool name>] [compression options] [-o output directory] <input args>\n" <<
+ "\ttools [extract|compress] <input args>\n" <<
+ "\n" <<
+ "\tOther Options:\n" <<
+ "\t--help\tDisplay this text\n" <<
+ "\t--list\tList all tools that are available\n" <<
+ "";
+}
+
+void ToolsCLI::printTools() {
+ for (ToolList::iterator tool = _tools.begin(); tool != _tools.end(); ++tool)
+ // There *really* should be a short version of the help text available
+ std::cout << "\t" << (*tool)->getName() << ": " << (*tool)->getHelp() << "\n";
+}
+
+
Property changes on: tools/branches/gsoc2009-gui/cli_tools.cpp
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Date Rev Author URL Id
Added: svn:eol-style
+ native
Added: tools/branches/gsoc2009-gui/cli_tools.h
===================================================================
--- tools/branches/gsoc2009-gui/cli_tools.h (rev 0)
+++ tools/branches/gsoc2009-gui/cli_tools.h 2009-07-23 01:41:14 UTC (rev 42670)
@@ -0,0 +1,42 @@
+/* cli_tools - CLI interface for the tools
+ * Copyright (C) 2009 The ScummVM project
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL
+ * $Id
+ *
+ */
+
+
+#ifndef CLI_TOOLS_H
+#define CLI_TOOLS_H
+
+#include "tools.h"
+
+// Does nothing
+
+class ToolsCLI : public Tools {
+public:
+ ToolsCLI();
+ ~ToolsCLI();
+
+ int run(int argc, char *argv[]);
+
+ void printHelp();
+ void printTools();
+};
+
+#endif
Property changes on: tools/branches/gsoc2009-gui/cli_tools.h
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Date Rev Author URL Id
Added: svn:eol-style
+ native
Modified: tools/branches/gsoc2009-gui/compress.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress.cpp 2009-07-22 22:22:08 UTC (rev 42669)
+++ tools/branches/gsoc2009-gui/compress.cpp 2009-07-23 01:41:14 UTC (rev 42670)
@@ -871,7 +871,7 @@
// Duplicates code above in the new way
// The old code can be removed once all tools have been converted
-CompressionTool::CompressionTool(const std::string &name) : Tool(name) {
+CompressionTool::CompressionTool(const std::string &name, ToolType type) : Tool(name, type) {
_format = AUDIO_MP3;
}
Modified: tools/branches/gsoc2009-gui/compress.h
===================================================================
--- tools/branches/gsoc2009-gui/compress.h 2009-07-22 22:22:08 UTC (rev 42669)
+++ tools/branches/gsoc2009-gui/compress.h 2009-07-23 01:41:14 UTC (rev 42670)
@@ -68,7 +68,7 @@
class CompressionTool : public Tool {
public:
- CompressionTool(const std::string &name);
+ CompressionTool(const std::string &name, ToolType type);
void parseAudioArguments();
public:
Modified: tools/branches/gsoc2009-gui/compress_agos.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_agos.cpp 2009-07-22 22:22:08 UTC (rev 42669)
+++ tools/branches/gsoc2009-gui/compress_agos.cpp 2009-07-23 01:41:14 UTC (rev 42670)
@@ -25,7 +25,7 @@
#define TEMP_DAT "tempfile.dat"
#define TEMP_IDX "tempfile.idx"
-CompressAgos::CompressAgos(const std::string &name) : CompressionTool(name) {
+CompressAgos::CompressAgos(const std::string &name) : CompressionTool(name, TOOLTYPE_COMPRESSION) {
_convertMac = false;
_outputToDirectory = false;
Modified: tools/branches/gsoc2009-gui/compress_gob.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_gob.cpp 2009-07-22 22:22:08 UTC (rev 42669)
+++ tools/branches/gsoc2009-gui/compress_gob.cpp 2009-07-23 01:41:14 UTC (rev 42670)
@@ -35,7 +35,7 @@
};
-CompressGob::CompressGob(const std::string &name) : CompressionTool(name) {
+CompressGob::CompressGob(const std::string &name) : CompressionTool(name, TOOLTYPE_COMPRESSION) {
_execMode = MODE_NORMAL;
_chunks = NULL;
Modified: tools/branches/gsoc2009-gui/compress_kyra.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_kyra.cpp 2009-07-22 22:22:08 UTC (rev 42669)
+++ tools/branches/gsoc2009-gui/compress_kyra.cpp 2009-07-23 01:41:14 UTC (rev 42670)
@@ -27,7 +27,7 @@
#define TEMPFILE "TEMP.VOC"
-CompressKyra::CompressKyra(const std::string &name) : CompressionTool(name) {
+CompressKyra::CompressKyra(const std::string &name) : CompressionTool(name, TOOLTYPE_COMPRESSION) {
ToolInput input;
input.format = "*.*";
_inputPaths.push_back(input);
Modified: tools/branches/gsoc2009-gui/compress_queen.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_queen.cpp 2009-07-22 22:22:08 UTC (rev 42669)
+++ tools/branches/gsoc2009-gui/compress_queen.cpp 2009-07-23 01:41:14 UTC (rev 42670)
@@ -89,7 +89,7 @@
{ "BUD1.DOG", 'I' }
};
-CompressQueen::CompressQueen(const std::string &name) : CompressionTool(name) {
+CompressQueen::CompressQueen(const std::string &name) : CompressionTool(name, TOOLTYPE_COMPRESSION) {
_outputToDirectory = false;
_supportsProgressBar = true;
Modified: tools/branches/gsoc2009-gui/compress_saga.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_saga.cpp 2009-07-22 22:22:08 UTC (rev 42669)
+++ tools/branches/gsoc2009-gui/compress_saga.cpp 2009-07-23 01:41:14 UTC (rev 42670)
@@ -109,7 +109,7 @@
} Record;
// Constructor
-CompressSaga::CompressSaga(const std::string &name) : CompressionTool(name) {
+CompressSaga::CompressSaga(const std::string &name) : CompressionTool(name, TOOLTYPE_COMPRESSION) {
_currentGameDescription = NULL;
_currentFileDescription = NULL;
Modified: tools/branches/gsoc2009-gui/compress_scumm_bun.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_scumm_bun.cpp 2009-07-22 22:22:08 UTC (rev 42669)
+++ tools/branches/gsoc2009-gui/compress_scumm_bun.cpp 2009-07-23 01:41:14 UTC (rev 42670)
@@ -1065,7 +1065,7 @@
_cbundleCurIndex++;
}
-CompressScummBun::CompressScummBun(const std::string &name) : CompressionTool(name) {
+CompressScummBun::CompressScummBun(const std::string &name) : CompressionTool(name, TOOLTYPE_COMPRESSION) {
_cbundleCurIndex = 0;
ToolInput input;
Modified: tools/branches/gsoc2009-gui/compress_scumm_san.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_scumm_san.cpp 2009-07-22 22:22:08 UTC (rev 42669)
+++ tools/branches/gsoc2009-gui/compress_scumm_san.cpp 2009-07-23 01:41:14 UTC (rev 42670)
@@ -572,7 +572,7 @@
handleAudioTrack(index, trackId, frame, nbframes, input, outputDir, inputFilename, size, volume, pan, false);
}
-CompressScummSan::CompressScummSan(const std::string &name) : CompressionTool(name) {
+CompressScummSan::CompressScummSan(const std::string &name) : CompressionTool(name, TOOLTYPE_COMPRESSION) {
_IACTpos = 0;
ToolInput input;
Modified: tools/branches/gsoc2009-gui/compress_scumm_sou.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_scumm_sou.cpp 2009-07-22 22:22:08 UTC (rev 42669)
+++ tools/branches/gsoc2009-gui/compress_scumm_sou.cpp 2009-07-23 01:41:14 UTC (rev 42670)
@@ -129,7 +129,7 @@
_output_idx.writeUint32BE(tot_size);
}
-CompressScummSou::CompressScummSou(const std::string &name) : CompressionTool(name) {
+CompressScummSou::CompressScummSou(const std::string &name) : CompressionTool(name, TOOLTYPE_COMPRESSION) {
_audioOuputFilename = OUTPUT_MP3;
ToolInput input;
Modified: tools/branches/gsoc2009-gui/compress_sword1.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_sword1.cpp 2009-07-22 22:22:08 UTC (rev 42669)
+++ tools/branches/gsoc2009-gui/compress_sword1.cpp 2009-07-23 01:41:14 UTC (rev 42670)
@@ -557,7 +557,7 @@
}
}
-CompressSword1::CompressSword1(const std::string &name) : CompressionTool(name) {
+CompressSword1::CompressSword1(const std::string &name) : CompressionTool(name, TOOLTYPE_COMPRESSION) {
_compSpeech = true;
_compMusic = true;
Modified: tools/branches/gsoc2009-gui/compress_sword2.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_sword2.cpp 2009-07-22 22:22:08 UTC (rev 42669)
+++ tools/branches/gsoc2009-gui/compress_sword2.cpp 2009-07-23 01:41:14 UTC (rev 42670)
@@ -49,7 +49,7 @@
#define GetCompressedSign(n) (((n) >> 3) & 1)
#define GetCompressedAmplitude(n) ((n) & 7)
-CompressSword2::CompressSword2(const std::string &name) : CompressionTool(name) {
+CompressSword2::CompressSword2(const std::string &name) : CompressionTool(name, TOOLTYPE_COMPRESSION) {
ToolInput input;
input.format = "*.clu";
Modified: tools/branches/gsoc2009-gui/compress_tinsel.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_tinsel.cpp 2009-07-22 22:22:08 UTC (rev 42669)
+++ tools/branches/gsoc2009-gui/compress_tinsel.cpp 2009-07-23 01:41:14 UTC (rev 42670)
@@ -47,7 +47,7 @@
#define TEMP_RAW "tempfile.raw"
#define TEMP_ENC "tempfile.enc"
-CompressTinsel::CompressTinsel(const std::string &name) : CompressionTool(name) {
+CompressTinsel::CompressTinsel(const std::string &name) : CompressionTool(name, TOOLTYPE_COMPRESSION) {
ToolInput input1;
input1.format = "*.smp";
_inputPaths.push_back(input1);
Modified: tools/branches/gsoc2009-gui/compress_touche.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_touche.cpp 2009-07-22 22:22:08 UTC (rev 42669)
+++ tools/branches/gsoc2009-gui/compress_touche.cpp 2009-07-23 01:41:14 UTC (rev 42670)
@@ -38,7 +38,7 @@
static uint32 input_Vxx_offs[Vxx_HDR_LEN];
static uint32 input_Vxx_size[Vxx_HDR_LEN];
-CompressTouche::CompressTouche(const std::string &name) : CompressionTool(name) {
+CompressTouche::CompressTouche(const std::string &name) : CompressionTool(name, TOOLTYPE_COMPRESSION) {
ToolInput input;
input.format = "/";
Modified: tools/branches/gsoc2009-gui/compress_tucker.cpp
===================================================================
--- tools/branches/gsoc2009-gui/compress_tucker.cpp 2009-07-22 22:22:08 UTC (rev 42669)
+++ tools/branches/gsoc2009-gui/compress_tucker.cpp 2009-07-23 01:41:14 UTC (rev 42670)
@@ -39,7 +39,7 @@
static CompressedData temp_table[10000];
-CompressTucker::CompressTucker(const std::string &name) : CompressionTool(name) {
+CompressTucker::CompressTucker(const std::string &name) : CompressionTool(name, TOOLTYPE_COMPRESSION) {
ToolInput input;
input.format = "/";
Modified: tools/branches/gsoc2009-gui/extract_agos.cpp
===================================================================
--- tools/branches/gsoc2009-gui/extract_agos.cpp 2009-07-22 22:22:08 UTC (rev 42669)
+++ tools/branches/gsoc2009-gui/extract_agos.cpp 2009-07-23 01:41:14 UTC (rev 42670)
@@ -27,7 +27,7 @@
#include "extract_agos.h"
-ExtractAgos::ExtractAgos(const std::string &name) : Tool(name) {
+ExtractAgos::ExtractAgos(const std::string &name) : Tool(name, TOOLTYPE_EXTRACTION) {
_filelen = 0;
ToolInput input;
Modified: tools/branches/gsoc2009-gui/extract_gob_stk.cpp
===================================================================
--- tools/branches/gsoc2009-gui/extract_gob_stk.cpp 2009-07-22 22:22:08 UTC (rev 42669)
+++ tools/branches/gsoc2009-gui/extract_gob_stk.cpp 2009-07-23 01:41:14 UTC (rev 42670)
@@ -38,7 +38,7 @@
~Chunk() { delete next; }
};
-ExtractGobStk::ExtractGobStk(const std::string &name) : Tool(name) {
+ExtractGobStk::ExtractGobStk(const std::string &name) : Tool(name, TOOLTYPE_EXTRACTION) {
_chunks = NULL;
ToolInput input;
Modified: tools/branches/gsoc2009-gui/extract_kyra.cpp
===================================================================
--- tools/branches/gsoc2009-gui/extract_kyra.cpp 2009-07-22 22:22:08 UTC (rev 42669)
+++ tools/branches/gsoc2009-gui/extract_kyra.cpp 2009-07-23 01:41:14 UTC (rev 42670)
@@ -26,7 +26,7 @@
#include "kyra_pak.h"
#include "kyra_ins.h"
-ExtractKyra::ExtractKyra(const std::string &name) : Tool(name) {
+ExtractKyra::ExtractKyra(const std::string &name) : Tool(name, TOOLTYPE_EXTRACTION) {
extractAll = true;
extractOne = false;
isAmiga = false;
Modified: tools/branches/gsoc2009-gui/extract_loom_tg16.cpp
===================================================================
--- tools/branches/gsoc2009-gui/extract_loom_tg16.cpp 2009-07-22 22:22:08 UTC (rev 42669)
+++ tools/branches/gsoc2009-gui/extract_loom_tg16.cpp 2009-07-23 01:41:14 UTC (rev 42670)
@@ -1223,7 +1223,7 @@
return CRC ^ 0xFFFFFFFF;
}
-ExtractLoomTG16::ExtractLoomTG16(const std::string &name) : Tool(name) {
+ExtractLoomTG16::ExtractLoomTG16(const std::string &name) : Tool(name, TOOLTYPE_EXTRACTION) {
ToolInput input;
input.format = "*.iso";
Modified: tools/branches/gsoc2009-gui/extract_mm_apple.cpp
===================================================================
--- tools/branches/gsoc2009-gui/extract_mm_apple.cpp 2009-07-22 22:22:08 UTC (rev 42669)
+++ tools/branches/gsoc2009-gui/extract_mm_apple.cpp 2009-07-23 01:41:14 UTC (rev 42670)
@@ -42,7 +42,7 @@
3, 10, 1, 0, 0
};
-ExtractMMApple::ExtractMMApple(const std::string &name) : Tool(name) {
+ExtractMMApple::ExtractMMApple(const std::string &name) : Tool(name, TOOLTYPE_EXTRACTION) {
ToolInput input1;
input1.format = "*.dsk";
Modified: tools/branches/gsoc2009-gui/extract_mm_c64.cpp
===================================================================
--- tools/branches/gsoc2009-gui/extract_mm_c64.cpp 2009-07-22 22:22:08 UTC (rev 42669)
+++ tools/branches/gsoc2009-gui/extract_mm_c64.cpp 2009-07-23 01:41:14 UTC (rev 42670)
@@ -43,7 +43,7 @@
3, 10, 1, 0, 0
};
-ExtractMMC64::ExtractMMC64(const std::string &name) : Tool(name) {
+ExtractMMC64::ExtractMMC64(const std::string &name) : Tool(name, TOOLTYPE_EXTRACTION) {
ToolInput input1;
input1.format = "*.d64";
Modified: tools/branches/gsoc2009-gui/extract_mm_nes.cpp
===================================================================
--- tools/branches/gsoc2009-gui/extract_mm_nes.cpp 2009-07-22 22:22:08 UTC (rev 42669)
+++ tools/branches/gsoc2009-gui/extract_mm_nes.cpp 2009-07-23 01:41:14 UTC (rev 42670)
@@ -1111,7 +1111,7 @@
return CRC ^ 0xFFFFFFFF;
}
-ExtractMMNes::ExtractMMNes(const std::string &name) : Tool(name) {
+ExtractMMNes::ExtractMMNes(const std::string &name) : Tool(name, TOOLTYPE_EXTRACTION) {
ToolInput input;
input.format = "*.PRG";
Modified: tools/branches/gsoc2009-gui/extract_parallaction.cpp
===================================================================
--- tools/branches/gsoc2009-gui/extract_parallaction.cpp 2009-07-22 22:22:08 UTC (rev 42669)
+++ tools/branches/gsoc2009-gui/extract_parallaction.cpp 2009-07-23 01:41:14 UTC (rev 42670)
@@ -292,7 +292,7 @@
}
-ExtractParallaction::ExtractParallaction(const std::string &name) : Tool(name) {
+ExtractParallaction::ExtractParallaction(const std::string &name) : Tool(name, TOOLTYPE_EXTRACTION) {
ToolInput input;
input.format = "*.*";
Modified: tools/branches/gsoc2009-gui/extract_scumm_mac.cpp
===================================================================
--- tools/branches/gsoc2009-gui/extract_scumm_mac.cpp 2009-07-22 22:22:08 UTC (rev 42669)
+++ tools/branches/gsoc2009-gui/extract_scumm_mac.cpp 2009-07-23 01:41:14 UTC (rev 42670)
@@ -26,7 +26,7 @@
/* this makes extract_scumm_mac convert extracted file names to lower case */
#define CHANGECASE
-ExtractScummMac::ExtractScummMac(const std::string &name) : Tool(name) {
+ExtractScummMac::ExtractScummMac(const std::string &name) : Tool(name, TOOLTYPE_EXTRACTION) {
ToolInput input;
input.format = "*.*";
Modified: tools/branches/gsoc2009-gui/extract_zak_c64.cpp
===================================================================
--- tools/branches/gsoc2009-gui/extract_zak_c64.cpp 2009-07-22 22:22:08 UTC (rev 42669)
+++ tools/branches/gsoc2009-gui/extract_zak_c64.cpp 2009-07-23 01:41:14 UTC (rev 42670)
@@ -43,7 +43,7 @@
3, 1, 2, 1, 2, 1, 10, 1, 1
};
-ExtractZakC64::ExtractZakC64(const std::string &name) : Tool(name) {
+ExtractZakC64::ExtractZakC64(const std::string &name) : Tool(name, TOOLTYPE_EXTRACTION) {
ToolInput input;
input.format = "*.d64";
_inputPaths.push_back(input);
Added: tools/branches/gsoc2009-gui/gui/gui_tools.cpp
===================================================================
--- tools/branches/gsoc2009-gui/gui/gui_tools.cpp (rev 0)
+++ tools/branches/gsoc2009-gui/gui/gui_tools.cpp 2009-07-23 01:41:14 UTC (rev 42670)
@@ -0,0 +1,231 @@
+/* tools.cpp - List & description of all supported tools
+ * Copyright (C) 2009 The ScummVM project
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL
+ * $Id
+ *
+ */
+
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+ #include "wx/wx.h"
+#endif
+
+#include <algorithm>
+
+#include "tools.h"
+
+// Include all tools
+#include "../compress_agos.h"
+#include "../compress_gob.h"
+#include "../compress_kyra.h"
+#include "../compress_queen.h"
+#include "../compress_saga.h"
+#include "../compress_scumm_bun.h"
+#include "../compress_scumm_san.h"
+#include "../compress_scumm_sou.h"
+#include "../compress_sword1.h"
+#include "../compress_sword2.h"
+#include "../compress_touche.h"
+#include "../compress_tinsel.h"
+#include "../compress_touche.h"
+#include "../compress_tucker.h"
+#include "../encode_dxa.h"
+#include "../extract_agos.h"
+#include "../extract_gob_stk.h"
+#include "../extract_kyra.h"
+#include "../extract_loom_tg16.h"
+#include "../extract_mm_apple.h"
+#include "../extract_mm_c64.h"
+#include "../extract_mm_nes.h"
+#include "../extract_parallaction.h"
+#include "../extract_scumm_mac.h"
+#include "../extract_zak_c64.h"
+
+
+// Our global tools object, which holds all tools
+Tools g_tools;
+
+Tools::Tools() {
+}
+
+void Tools::init() {
+
+ // Compress agos also has a --mac parameter, need to add an additional page / option for this
+ addTool(new ToolGUI(new CompressAgos()));
+ // Compress gob also has a --f parameter, need to add an additional page / option for this
+ addTool(new ToolGUI(new CompressGob()));
+ addTool(new ToolGUI(new CompressKyra()));
+ addTool(new ToolGUI(new CompressQueen()));
+ addTool(new ToolGUI(new CompressSaga()));
+ addTool(new ToolGUI(new CompressScummBun()));
+ addTool(new ToolGUI(new CompressScummSan()));
+ addTool(new ToolGUI(new CompressScummSou()));
+ addTool(new ToolGUI(new CompressSword1()));
+ addTool(new ToolGUI(new CompressSword2()));
+ addTool(new ToolGUI(new CompressTinsel()));
+ addTool(new ToolGUI(new CompressTouche()));
+ addTool(new ToolGUI(new CompressTucker()));
+ addTool(new ToolGUI(new EncodeDXA(), TOOLTYPE_COMPRESSION));
+
+ addTool(new ToolGUI(new ExtractAgos()));
+ addTool(new ToolGUI(new ExtractGobStk()));
+ addTool(new ToolGUI(new ExtractKyra()));
+ addTool(new ToolGUI(new ExtractLoomTG16()));
+ addTool(new ToolGUI(new ExtractMMApple()));
+ addTool(new ToolGUI(new ExtractMMC64()));
+ addTool(new ToolGUI(new ExtractMMNes()));
+ addTool(new ToolGUI(new ExtractParallaction()));
+ addTool(new ToolGUI(new ExtractScummMac()));
+ addTool(new ToolGUI(new ExtractZakC64()));
+}
+
+Tools::~Tools() {
+ for (std::map<wxString, ToolGUI *>::iterator iter = tools.begin(); iter != tools.end(); ++iter)
+ delete iter->second;
+}
+
+void Tools::addTool(ToolGUI* tool) {
+ tools[tool->_name] = tool;
+}
+
+wxArrayString Tools::getToolList(ToolType tt) const {
+ wxArrayString l;
+ for (std::map<wxString, ToolGUI *>::const_iterator iter = tools.begin(); iter != tools.end(); ++iter)
+ if (tt == TOOLTYPE_ALL || iter->second->_type == tt)
+ l.Add(iter->first);
+ l.Sort();
+ std::unique(l.begin(), l.end());
+ return l;
+}
+
+wxArrayString Tools::getToolList(const Filename &filename, ToolType tt) const {
+ wxArrayString l;
+ for (std::map<wxString, ToolGUI *>::const_iterator iter = tools.begin(); iter != tools.end(); ++iter)
+ if (tt == TOOLTYPE_ALL || iter->second->_type == tt)
+ if (iter->second->inspectInput(filename))
+ l.Add(iter->second->_name);
+ l.Sort();
+ std::unique(l.begin(), l.end());
+ return l;
+}
+
+const ToolGUI &Tools::operator[](const wxString& name) const {
+ std::map<wxString, ToolGUI *>::const_iterator iter = tools.find(name);
+
+ wxASSERT_MSG(iter != tools.end(), wxT("All tools should be added, never try to access a tool that does not exist."));
+
+ return *iter->second;
+}
+
+const ToolGUI *Tools::get(const wxString& name) const {
+ std::map<wxString, ToolGUI *>::const_iterator iter = tools.find(name);
+
+ if (iter == tools.end())
+ return NULL;
+
+ return iter->second;
+}
+
+// The Tool class
+
+ToolGUI::ToolGUI(Tool *tool, ToolType type) {
+ _backend = tool;
+ _name = wxString(tool->_name.c_str(), wxConvUTF8);
+
+ if(type == TOOLTYPE_UNKNOWN) {
+ if (_name.Find(wxT("extract")) != wxNOT_FOUND)
+ _type = TOOLTYPE_EXTRACTION;
+ else if (_name.Find(wxT("compress")) != wxNOT_FOUND)
+ _type = TOOLTYPE_COMPRESSION;
+ else {
+ wxLogError(wxT("Tools with unknown type shouldn't exist."));
+ _type = TOOLTYPE_UNKNOWN;
+ }
+ } else
+ _type = type;
+
+ _inHelpText = wxT("Please select any additional input files.");
+}
+
+ToolGUI::~ToolGUI() {
+ delete _backend;
+}
+
+bool ToolGUI::inspectInput(const Filename &filename) const {
+ return _backend->inspectInput(filename);
+}
+
+ToolInputs ToolGUI::getInputList() const {
+ return _backend->_inputPaths;
+}
+
+bool ToolGUI::supportsAudioFormat(AudioFormat format) const {
+ return (_backend->_supportedFormats & format) == format;
+}
+
+bool ToolGUI::supportsProgressBar() const {
+ return _backend->_supportsProgressBar;
+}
+
+bool ToolGUI::outputToDirectory() const {
+ return _backend->_outputToDirectory;
+}
+
+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();
+ _backend->_outputPath = std::string(conf.outputPath.mb_str());
+
+ CompressionTool *compression = dynamic_cast<CompressionTool *>(_backend);
+ if (compression) {
+ // mp3
+ compression->_mp3ABRBitrate = (const char *)conf.mp3ABRBitrate.mb_str();
+ compression->_mp3CompressionType = (const char *)conf.mp3CompressionType.mb_str();
+ compression->_mp3MpegQuality = (const char *)conf.mp3MpegQuality.mb_str();
+ compression->_mp3ABRBitrate = (const char *)conf.mp3ABRBitrate.mb_str();
+ compression->_mp3VBRMinBitrate = (const char *)conf.mp3VBRMinBitrate.mb_str();
+ compression->_mp3VBRMaxBitrate = (const char *)conf.mp3VBRMaxBitrate.mb_str();
+ compression->_mp3VBRQuality = (const char *)conf.mp3VBRQuality.mb_str();
+
+ // flac
+ compression->_flacCompressionLevel = (const char *)conf.flacCompressionLevel.mb_str();
+ compression->_flacBlockSize = (const char *)conf.flacBlockSize.mb_str();
+
+ // vorbis
+ compression->_oggQuality = (const char *)conf.oggQuality.mb_str();
+ compression->_oggMinBitrate = (const char *)conf.oggMinBitrate.mb_str();
+ compression->_oggAvgBitrate = (const char *)conf.oggAvgBitrate.mb_str();
+ compression->_oggMaxBitrate = (const char *)conf.oggMaxBitrate.mb_str();
+ }
+
+ _backend->run();
+}
+
+wxString ToolGUI::getExecutable() const {
+#ifdef WIN32
+ return _name + wxT(".exe");
+#else
+ return _name;
+#endif
+}
Property changes on: tools/branches/gsoc2009-gui/gui/gui_tools.cpp
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Date Rev Author URL Id
Added: svn:eol-style
+ native
Added: tools/branches/gsoc2009-gui/gui/gui_tools.h
===================================================================
--- tools/branches/gsoc2009-gui/gui/gui_tools.h (rev 0)
+++ tools/branches/gsoc2009-gui/gui/gui_tools.h 2009-07-23 01:41:14 UTC (rev 42670)
@@ -0,0 +1,181 @@
+/* tools.h - List & description of all supported tools
+ * Copyright (C) 2009 The ScummVM project
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL
+ * $Id
+ *
+ */
+
+#ifndef TOOLS_H
+#define TOOLS_H
+
+#include <wx/string.h>
+
+#include <map>
+#include <vector>
+
+#include "configuration.h"
+#include "../tool.h"
+
+
+/**
+ * A tool supported by the Wizard, holds all information about what format it supports
+ * what input it requires etc.
+ * This is just the frontend, for the backend, the 'Tool' class is used, which this class
+ * holds an instance off.
+ *
+ * @todo Move some logic to the 'Tool' class
+ * @todo Add some way to represent extra arguments to the tool
+ */
+class ToolGUI {
+ // Block copy-construction
+ ToolGUI(const ToolGUI &);
+
+public:
+ /**
+ * Creates a new tool, can be stack allocated and copied without problems
+ * The type of tool is deduced from the name, if it contains 'extract', it's an extraction tool
+ * and if it contains 'compress' it's a compression tool. If the tool does not contain either,
+ * you must set the type manually.
+ *
+ * @param name The name of the tool, should match the executable name (without the extension)
+ */
+ ToolGUI(Tool *tool, ToolType type = TOOLTYPE_UNKNOWN);
+ ~ToolGUI();
+
+ /**
+ * Adds a supported game to this tool
+ *
+ * @param game_name The name of the game this tool supports
+ */
+ void addGame(const wxString &game_name);
+
+ /**
+ * Returns true if the file appears to be valid input to this tool.
+ *
+ * @param filename The file to inspect.
+ * @return True if we can possibly parse this file.
+ */
+ bool inspectInput(const Filename &filename) const;
+
+ /**
+ *
+ */
+ ToolInputs getInputList() const;
+
+ // Helper functions to get info about the tool
+
+ /**
+ * Returns true if the audio format(s) is supported by this tool
+ *
+ * @param format The audio format(s) to test for
+ */
+ bool supportsAudioFormat(AudioFormat format) const;
+
+ /**
+ * Returns true if the tool supports a load bar for displaying progress
+ */
+ bool supportsProgressBar() const;
+
+ /**
+ * Returns true if the tool outputs to an entire directory, not a single file
+ */
+ bool outputToDirectory() const;
+
+ /**
+ * Returns the name of the executable of this tool.
+ * This simple returns the name under *nix, and name.exe under Windows
+ */
+ wxString getExecutable() const;
+
+ /**
+ * Runs the actual tool, will throw errors if it fails
+ */
+ void run(const Configuration &conf) const;
+
+
+ /** Name of the tool */
+ wxString _name;
+ /** The actual tool instance, which runs the compression/extraction */
+ Tool *_backend;
+ /** Type of tool, either extract, compress or unknown */
+ ToolType _type;
+ /** The help text displayed on the input/output page */
+ wxString _inHelpText;
+};
+
+// Collection of all tools
+class Tools {
+public:
+ Tools();
+ ~Tools();
+
+ /**
+ * Must be called before the tools can be used
+ * Setup cannot be done in the constructor since it depends on wx setup code
+ * that must be run before it.
+ */
+ void init();
+
+ /**
+ * Returns a tool by name
+ * asserts if the tool is not found
+ *
+ * @param name Name of the tool to fetch
+ * @return A reference to the tool, tools cannot be modified.
+ */
+
+ const ToolGUI &operator[](const wxString &name) const;
+ /**
+ * Returns a tool by name
+ *
+ * @param name Name of the tool to fetch
+ * @return A pointer to the tool, NULL if there is no tool by that name.
+ */
+ const ToolGUI *get(const wxString &name) const;
+
+ /**
+ * Returns a list of all tools
+ *
+ * @param tt Filter by this type of tool
+ * @return Returns all tools of this type, list is sorted and contains no duplicates
+ */
+ wxArrayString getToolList(ToolType tt = TOOLTYPE_ALL) const;
+
+ /**
+ * Inspects the file and returns a list of tools that might be able to handle it
+ *
+ * @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
+ */
+ wxArrayString getToolList(const Filename &filename, ToolType tt = TOOLTYPE_ALL) const;
+
+protected:
+ /**
+ * Adds a supported tool. Should not be done after construction, since it might break pointers
+ *
+ * @param tool the tool to add.
+ */
+ void addTool(ToolGUI *tool);
+
+ std::map<wxString, ToolGUI *> tools;
+};
+
+extern Tools g_tools;
+
+#endif
Property changes on: tools/branches/gsoc2009-gui/gui/gui_tools.h
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Date Rev Author URL Id
Added: svn:eol-style
+ native
Modified: tools/branches/gsoc2009-gui/gui/pages.cpp
===================================================================
--- tools/branches/gsoc2009-gui/gui/pages.cpp 2009-07-22 22:22:08 UTC (rev 42669)
+++ tools/branches/gsoc2009-gui/gui/pages.cpp 2009-07-23 01:41:14 UTC (rev 42670)
@@ -36,7 +36,7 @@
#include "main.h"
#include "pages.h"
-#include "tools.h"
+#include "gui_tools.h"
BEGIN_EVENT_TABLE(WizardPage, wxEvtHandler)
@@ -44,7 +44,7 @@
WizardPage::WizardPage(ScummToolsFrame *frame)
: _topframe(frame),
- _configuration(frame->_configuration)
+ _configuration(frame->_configuration)
{
}
@@ -238,7 +238,7 @@
if(!picker)
picker = panel->FindWindowByName(wxT("InputPicker"));
- const ToolGUI *tool = _topframe->_configuration.selectedTool;
+ const ToolGUI *tool = _configuration.selectedTool;
if(tool && !picker) {
for(size_t i = 1; i < tool->getInputList().size(); ++i) {
wxString name(wxT("InputPicker"));
@@ -295,8 +295,8 @@
wxT("InputPicker"));
sizer->Add(picker);
panel->Connect(wxEVT_COMMAND_FILEPICKER_CHANGED, wxFileDirPickerEventHandler(ChooseIOPage::onSelectFile), NULL, this);
- if(_topframe->_configuration.inputFilePaths.size() > 0)
- picker->SetPath(_topframe->_configuration.inputFilePaths[0]);
+ if(_configuration.inputFilePaths.size() > 0)
+ picker->SetPath(_configuration.inputFilePaths[0]);
sizer->AddSpacer(30);
/*
@@ -391,8 +391,8 @@
windowName << i;
wxString inputFile;
- if(_topframe->_configuration.inputFilePaths.size() > (size_t)i)
- inputFile = _topframe->_configuration.inputFilePaths[i];
+ if(_configuration.inputFilePaths.size() > (size_t)i)
+ inputFile = _configuration.inputFilePaths[i];
if (input.file) {
inputbox->Add(new wxFilePickerCtrl(
@@ -501,7 +501,7 @@
box->Add(picker);
panel->Connect(wxEVT_COMMAND_DIRPICKER_CHANGED, wxFileDirPickerEventHandler(ChooseIOPage::onSelectFile), NULL, this);
- picker->SetPath(_topframe->_configuration.outputPath);
+ picker->SetPath(_configuration.outputPath);
sizer->Add(box);
} else {
@@ -516,7 +516,7 @@
box->Add(picker);
panel->Connect(wxEVT_COMMAND_FILEPICKER_CHANGED, wxFileDirPickerEventHandler(ChooseIOPage::onSelectFile), NULL, this);
- picker->SetPath(_topframe->_configuration.outputPath);
+ picker->SetPath(_configuration.outputPath);
sizer->Add(box);
}
@@ -728,15 +728,15 @@
// Load settings
- if (_topframe->_configuration.mp3CompressionType == wxT("ABR"))
+ if (_configuration.mp3CompressionType == wxT("ABR"))
abrButton->SetValue(true);
else
vbrButton->SetValue(true);
- vbrMinBitrate->SetStringSelection(_topframe->_configuration.mp3VBRMinBitrate);
- vbrMaxBitrate->SetStringSelection(_topframe->_configuration.mp3VBRMaxBitrate);
- abrAvgBitrate->SetStringSelection(_topframe->_configuration.mp3ABRBitrate);
- vbrQuality ->SetStringSelection(_topframe->_configuration.mp3VBRQuality);
- mpegQuality ->SetStringSelection(_topframe->_configuration.mp3MpegQuality);
+ vbrMinBitrate->SetStringSelection(_configuration.mp3VBRMinBitrate);
+ vbrMaxBitrate->SetStringSelection(_configuration.mp3VBRMaxBitrate);
+ abrAvgBitrate->SetStringSelection(_configuration.mp3ABRBitrate);
+ vbrQuality ->SetStringSelection(_configuration.mp3VBRQuality);
+ mpegQuality ->SetStringSelection(_configuration.mp3MpegQuality);
updateFields(panel);
@@ -753,15 +753,15 @@
wxChoice *vbrQuality = static_cast<wxChoice *>(panel->FindWindowByName(wxT("VBRQuality")));
wxChoice *mpegQuality = static_cast<wxChoice *>(panel->FindWindowByName(wxT("MpegQuality")));
- _topframe->_configuration.mp3VBRMinBitrate = vbrMinBitrate->GetStringSelection();
- _topframe->_configuration.mp3VBRMaxBitrate = vbrMaxBitrate->GetStringSelection();
- _topframe->_configuration.mp3ABRBitrate = abrAvgBitrate->GetStringSelection();
- _topframe->_configuration.mp3VBRQuality = vbrQuality ->GetStringSelection();
- _topframe->_configuration.mp3MpegQuality = mpegQuality ->GetStringSelection();
+ _configuration.mp3VBRMinBitrate = vbrMinBitrate->GetStringSelection();
+ _configuration.mp3VBRMaxBitrate = vbrMaxBitrate->GetStringSelection();
+ _configuration.mp3ABRBitrate = abrAvgBitrate->GetStringSelection();
+ _configuration.mp3VBRQuality = vbrQuality ->GetStringSelection();
+ _configuration.mp3MpegQuality = mpegQuality ->GetStringSelection();
if (abr->GetValue())
- _topframe->_configuration.mp3CompressionType = wxT("ABR");
+ _configuration.mp3CompressionType = wxT("ABR");
else
- _topframe->_configuration.mp3CompressionType = wxT("VBR");
+ _configuration.mp3CompressionType = wxT("VBR");
}
void ChooseAudioOptionsMp3Page::updateFields(wxWindow *panel) {
@@ -860,8 +860,8 @@
// Load settings
- compressionLevel->SetStringSelection(_topframe->_configuration.flacCompressionLevel);
- blockSize->SetStringSelection(_topframe->_configuration.flacBlockSize);
+ compressionLevel->SetStringSelection(_configuration.flacCompressionLevel);
+ blockSize->SetStringSelection(_configuration.flacBlockSize);
return panel;
}
@@ -870,8 +870,8 @@
wxChoice *compressionLevel = static_cast<wxChoice *>(panel->FindWindowByName(wxT("CompressionLevel")));
wxChoice *blockSize = static_cast<wxChoice *>(panel->FindWindowByName(wxT("BlockSize")));
- _topframe->_configuration.flacCompressionLevel = compressionLevel->GetStringSelection();
- _topframe->_configuration.flacBlockSize = blockSize->GetStringSelection();
+ _configuration.flacCompressionLevel = compressionLevel->GetStringSelection();
+ _configuration.flacBlockSize = blockSize->GetStringSelection();
}
void ChooseAudioOptionsFlacPage::onNext(wxWindow *panel) {
@@ -949,10 +949,10 @@
// Load settings
- MinBitrate->SetStringSelection(_topframe->_configuration.oggMinBitrate);
- AvgBitrate->SetStringSelection(_topframe->_configuration.oggAvgBitrate);
- MaxBitrate->SetStringSelection(_topframe->_configuration.oggMaxBitrate);
- quality ->SetStringSelection(_topframe->_configuration.oggQuality);
+ MinBitrate->SetStringSelection(_configuration.oggMinBitrate);
+ AvgBitrate->SetStringSelection(_configuration.oggAvgBitrate);
+ MaxBitrate->SetStringSelection(_configuration.oggMaxBitrate);
+ quality ->SetStringSelection(_configuration.oggQuality);
return panel;
}
@@ -963,10 +963,10 @@
wxChoice *maxBitrate = static_cast<wxChoice *>(panel->FindWindowByName(wxT("MaximumBitrate")));
wxChoice *quality = static_cast<wxChoice *>(panel->FindWindowByName(wxT("Quality")));
- _topframe->_configuration.oggMinBitrate = minBitrate->GetStringSelection();
- _topframe->_configuration.oggAvgBitrate = avgBitrate->GetStringSelection();
- _topframe->_configuration.oggMaxBitrate = maxBitrate->GetStringSelection();
- _topframe->_configuration.oggQuality = quality ->GetStringSelection();
+ _configuration.oggMinBitrate = minBitrate->GetStringSelection();
+ _configuration.oggAvgBitrate = avgBitrate->GetStringSelection();
+ _configuration.oggMaxBitrate = maxBitrate->GetStringSelection();
+ _configuration.oggQuality = quality ->GetStringSelection();
}
void ChooseAudioOptionsVorbisPage::onNext(wxWindow *panel) {
@@ -1018,13 +1018,13 @@
}
void ProcessPage::runTool() {
- const ToolGUI *tool = _topframe->_configuration.selectedTool;
+ const ToolGUI *tool = _configuration.selectedTool;
// Write some text that we've started...
_outwin->WriteText(wxT("Running ") + tool->_name + wxT("\n\n"));
// Child thread to run the tool
- _thread = new ProcessToolThread(tool, _topframe->_configuration, _output);
+ _thread = new ProcessToolThread(tool, _configuration, _output);
// We should check return value of this
_thread->Create();
@@ -1033,7 +1033,7 @@
}
bool ProcessPage::onIdle(wxPanel *panel) {
- const ToolGUI *tool = _topframe->_configuration.selectedTool;
+ const ToolGUI *tool = _configuration.selectedTool;
if (!_thread)
return false;
@@ -1222,7 +1222,7 @@
sizer->AddSpacer(15);
wxString text;
- if (_topframe->_configuration.selectedTool->_type == TOOLTYPE_COMPRESSION)
+ if (_configuration.selectedTool->_type == TOOLTYPE_COMPRESSION)
text = wxT("You have finished the wizard! Your files should now be compressed.");
else
text = wxT("You have finished the wizard! Your files should now be extracted.");
@@ -1246,7 +1246,7 @@
// There is no standard way to do this
// On windows we can simply spawn an explorer instance
#ifdef __WINDOWS__
- wxExecute(wxT("explorer.exe \"") + _topframe->_configuration.outputPath + wxT("\""));
+ wxExecute(wxT("explorer.exe \"") + _configuration.outputPath + wxT("\""));
#else
#endif
}
Deleted: tools/branches/gsoc2009-gui/gui/tools.cpp
===================================================================
--- tools/branches/gsoc2009-gui/gui/tools.cpp 2009-07-22 22:22:08 UTC (rev 42669)
+++ tools/branches/gsoc2009-gui/gui/tools.cpp 2009-07-23 01:41:14 UTC (rev 42670)
@@ -1,231 +0,0 @@
-/* tools.cpp - List & description of all supported tools
- * Copyright (C) 2009 The ScummVM project
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL
- * $Id
- *
- */
-
-#include "wx/wxprec.h"
-
-#ifdef __BORLANDC__
- #pragma hdrstop
-#endif
-
-#ifndef WX_PRECOMP
- #include "wx/wx.h"
-#endif
-
-#include <algorithm>
-
-#include "tools.h"
-
-// Include all tools
-#include "../compress_agos.h"
-#include "../compress_gob.h"
-#include "../compress_kyra.h"
-#include "../compress_queen.h"
-#include "../compress_saga.h"
-#include "../compress_scumm_bun.h"
-#include "../compress_scumm_san.h"
-#include "../compress_scumm_sou.h"
-#include "../compress_sword1.h"
-#include "../compress_sword2.h"
-#include "../compress_touche.h"
-#include "../compress_tinsel.h"
-#include "../compress_touche.h"
-#include "../compress_tucker.h"
-#include "../encode_dxa.h"
-#include "../extract_agos.h"
-#include "../extract_gob_stk.h"
-#include "../extract_kyra.h"
-#include "../extract_loom_tg16.h"
-#include "../extract_mm_apple.h"
-#include "../extract_mm_c64.h"
-#include "../extract_mm_nes.h"
-#include "../extract_parallaction.h"
-#include "../extract_scumm_mac.h"
-#include "../extract_zak_c64.h"
-
-
-// Our global tools object, which holds all tools
-Tools g_tools;
-
-Tools::Tools() {
-}
-
-void Tools::init() {
-
- // Compress agos also has a --mac parameter, need to add an additional page / option for this
- addTool(new ToolGUI(new CompressAgos()));
- // Compress gob also has a --f parameter, need to add an additional page / option for this
- addTool(new ToolGUI(new CompressGob()));
- addTool(new ToolGUI(new CompressKyra()));
- addTool(new ToolGUI(new CompressQueen()));
- addTool(new ToolGUI(new CompressSaga()));
- addTool(new ToolGUI(new CompressScummBun()));
- addTool(new ToolGUI(new CompressScummSan()));
- addTool(new ToolGUI(new CompressScummSou()));
- addTool(new ToolGUI(new CompressSword1()));
- addTool(new ToolGUI(new CompressSword2()));
- addTool(new ToolGUI(new CompressTinsel()));
- addTool(new ToolGUI(new CompressTouche()));
- addTool(new ToolGUI(new CompressTucker()));
- addTool(new ToolGUI(new EncodeDXA(), TOOLTYPE_COMPRESSION));
-
- addTool(new ToolGUI(new ExtractAgos()));
- addTool(new ToolGUI(new ExtractGobStk()));
- addTool(new ToolGUI(new ExtractKyra()));
- addTool(new ToolGUI(new ExtractLoomTG16()));
- addTool(new ToolGUI(new ExtractMMApple()));
- addTool(new ToolGUI(new ExtractMMC64()));
- addTool(new ToolGUI(new ExtractMMNes()));
- addTool(new ToolGUI(new ExtractParallaction()));
- addTool(new ToolGUI(new ExtractScummMac()));
- addTool(new ToolGUI(new ExtractZakC64()));
-}
-
-Tools::~Tools() {
- for (std::map<wxString, ToolGUI *>::iterator iter = tools.begin(); iter != tools.end(); ++iter)
- delete iter->second;
-}
-
-void Tools::addTool(ToolGUI* tool) {
- tools[tool->_name] = tool;
-}
-
-wxArrayString Tools::getToolList(ToolType tt) const {
- wxArrayString l;
- for (std::map<wxString, ToolGUI *>::const_iterator iter = tools.begin(); iter != tools.end(); ++iter)
- if (tt == TOOLTYPE_ALL || iter->second->_type == tt)
- l.Add(iter->first);
- l.Sort();
- std::unique(l.begin(), l.end());
- return l;
-}
-
-wxArrayString Tools::getToolList(const Filename &filename, ToolType tt) const {
- wxArrayString l;
- for (std::map<wxString, ToolGUI *>::const_iterator iter = tools.begin(); iter != tools.end(); ++iter)
- if (tt == TOOLTYPE_ALL || iter->second->_type == tt)
- if (iter->second->inspectInput(filename))
- l.Add(iter->second->_name);
- l.Sort();
- std::unique(l.begin(), l.end());
- return l;
-}
-
-const ToolGUI &Tools::operator[](const wxString& name) const {
- std::map<wxString, ToolGUI *>::const_iterator iter = tools.find(name);
-
- wxASSERT_MSG(iter != tools.end(), wxT("All tools should be added, never try to access a tool that does not exist."));
-
- return *iter->second;
-}
-
-const ToolGUI *Tools::get(const wxString& name) const {
- std::map<wxString, ToolGUI *>::const_iterator iter = tools.find(name);
-
- if (iter == tools.end())
- return NULL;
-
- return iter->second;
-}
-
-// The Tool class
-
-ToolGUI::ToolGUI(Tool *tool, ToolType type) {
- _backend = tool;
- _name = wxString(tool->_name.c_str(), wxConvUTF8);
-
- if(type == TOOLTYPE_UNKNOWN) {
- if (_name.Find(wxT("extract")) != wxNOT_FOUND)
- _type = TOOLTYPE_EXTRACTION;
- else if (_name.Find(wxT("compress")) != wxNOT_FOUND)
- _type = TOOLTYPE_COMPRESSION;
- else {
- wxLogError(wxT("Tools with unknown type shouldn't exist."));
- _type = TOOLTYPE_UNKNOWN;
- }
- } else
- _type = type;
-
- _inHelpText = wxT("Please select any additional input files.");
-}
-
-ToolGUI::~ToolGUI() {
- delete _backend;
-}
-
-bool ToolGUI::inspectInput(const Filename &filename) const {
- return _backend->inspectInput(filename);
-}
-
-ToolInputs ToolGUI::getInputList() const {
- return _backend->_inputPaths;
-}
-
-bool ToolGUI::supportsAudioFormat(AudioFormat format) const {
- return (_backend->_supportedFormats & format) == format;
-}
-
-bool ToolGUI::supportsProgressBar() const {
- return _backend->_supportsProgressBar;
-}
-
-bool ToolGUI::outputToDirectory() const {
- return _backend->_outputToDirectory;
-}
-
-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();
- _backend->_outputPath = std::string(conf.outputPath.mb_str());
-
- CompressionTool *compression = dynamic_cast<CompressionTool *>(_backend);
- if (compression) {
- // mp3
- compression->_mp3ABRBitrate = (const char *)conf.mp3ABRBitrate.mb_str();
- compression->_mp3CompressionType = (const char *)conf.mp3CompressionType.mb_str();
- compression->_mp3MpegQuality = (const char *)conf.mp3MpegQuality.mb_str();
- compression->_mp3ABRBitrate = (const char *)conf.mp3ABRBitrate.mb_str();
- compression->_mp3VBRMinBitrate = (const char *)conf.mp3VBRMinBitrate.mb_str();
- compression->_mp3VBRMaxBitrate = (const char *)conf.mp3VBRMaxBitrate.mb_str();
- compression->_mp3VBRQuality = (const char *)conf.mp3VBRQuality.mb_str();
-
- // flac
- compression->_flacCompressionLevel = (const char *)conf.flacCompressionLevel.mb_str();
- compression->_flacBlockSize = (const char *)conf.flacBlockSize.mb_str();
-
- // vorbis
- compression->_oggQuality = (const char *)conf.oggQuality.mb_str();
- compression->_oggMinBitrate = (const char *)conf.oggMinBitrate.mb_str();
- compression->_oggAvgBitrate = (const char *)conf.oggAvgBitrate.mb_str();
- compression->_oggMaxBitrate = (const char *)conf.oggMaxBitrate.mb_str();
- }
-
- _backend->run();
-}
-
-wxString ToolGUI::getExecutable() const {
-#ifdef WIN32
- return _name + wxT(".exe");
-#else
- return _name;
-#endif
-}
Deleted: tools/branches/gsoc2009-gui/gui/tools.h
===================================================================
--- tools/branches/gsoc2009-gui/gui/tools.h 2009-07-22 22:22:08 UTC (rev 42669)
+++ tools/branches/gsoc2009-gui/gui/tools.h 2009-07-23 01:41:14 UTC (rev 42670)
@@ -1,191 +0,0 @@
-/* tools.h - List & description of all supported tools
- * Copyright (C) 2009 The ScummVM project
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL
- * $Id
- *
- */
-
-#ifndef TOOLS_H
-#define TOOLS_H
-
-#include <wx/string.h>
-
-#include <map>
-#include <vector>
-
-#include "configuration.h"
-#include "../tool.h"
-
-
-/** Different types of tools, used to differentiate them when
- * fetching lists of games & tools
- */
-enum ToolType {
- TOOLTYPE_COMPRESSION,
- TOOLTYPE_EXTRACTION,
- TOOLTYPE_UNKNOWN,
- TOOLTYPE_ALL,
-};
-
-/**
- * A tool supported by the Wizard, holds all information about what format it supports
- * what input it requires etc.
- * This is just the frontend, for the backend, the 'Tool' class is used, which this class
- * holds an instance off.
- *
- * @todo Move some logic to the 'Tool' class
- * @todo Add some way to represent extra arguments to the tool
- */
-class ToolGUI {
- // Block copy-construction
- ToolGUI(const ToolGUI &);
-
-public:
- /**
- * Creates a new tool, can be stack allocated and copied without problems
- * The type of tool is deduced from the name, if it contains 'extract', it's an extraction tool
- * and if it contains 'compress' it's a compression tool. If the tool does not contain either,
- * you must set the type manually.
- *
- * @param name The name of the tool, should match the executable name (without the extension)
- */
- ToolGUI(Tool *tool, ToolType type = TOOLTYPE_UNKNOWN);
- ~ToolGUI();
-
- /**
- * Adds a supported game to this tool
- *
- * @param game_name The name of the game this tool supports
- */
- void addGame(const wxString &game_name);
-
- /**
- * Returns true if the file appears to be valid input to this tool.
- *
- * @param filename The file to inspect.
- * @return True if we can possibly parse this file.
- */
- bool inspectInput(const Filename &filename) const;
-
- /**
- *
- */
- ToolInputs getInputList() const;
-
- // Helper functions to get info about the tool
-
- /**
- * Returns true if the audio format(s) is supported by this tool
- *
- * @param format The audio format(s) to test for
- */
- bool supportsAudioFormat(AudioFormat format) const;
-
- /**
- * Returns true if the tool supports a load bar for displaying progress
- */
- bool supportsProgressBar() const;
-
- /**
- * Returns true if the tool outputs to an entire directory, not a single file
- */
- bool outputToDirectory() const;
-
- /**
- * Returns the name of the executable of this tool.
- * This simple returns the name under *nix, and name.exe under Windows
- */
- wxString getExecutable() const;
-
- /**
- * Runs the actual tool, will throw errors if it fails
- */
- void run(const Configuration &conf) const;
-
-
- /** Name of the tool */
- wxString _name;
- /** The actual tool instance, which runs the compression/extraction */
- Tool *_backend;
- /** Type of tool, either extract, compress or unknown */
- ToolType _type;
- /** The help text displayed on the input/output page */
- wxString _inHelpText;
-};
-
-// Collection of all tools
-class Tools {
-public:
- Tools();
- ~Tools();
-
- /**
- * Must be called before the tools can be used
- * Setup cannot be done in the constructor since it depends on wx setup code
- * that must be run before it.
- */
- void init();
-
- /**
- * Returns a tool by name
- * asserts if the tool is not found
- *
- * @param name Name of the tool to fetch
- * @return A reference to the tool, tools cannot be modified.
- */
-
- const ToolGUI &operator[](const wxString &name) const;
- /**
- * Returns a tool by name
- *
- * @param name Name of the tool to fetch
- * @return A pointer to the tool, NULL if there is no tool by that name.
- */
- const ToolGUI *get(const wxString &name) const;
-
- /**
- * Returns a list of all tools
- *
- * @param tt Filter by this type of tool
- * @return Returns all tools of this type, list is sorted and contains no duplicates
- */
- wxArrayString getToolList(ToolType tt = TOOLTYPE_ALL) const;
-
- /**
- * Inspects the file and returns a list of tools that might be able to handle it
- *
- * @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
- */
- wxArrayString getToolList(const Filename &filename, ToolType tt = TOOLTYPE_ALL) const;
-
-protected:
- /**
- * Adds a supported tool. Should not be done after construction, since it might break pointers
- *
- * @param tool the tool to add.
- */
- void addTool(ToolGUI *tool);
-
- std::map<wxString, ToolGUI *> tools;
-};
-
-extern Tools g_tools;
-
-#endif
Modified: tools/branches/gsoc2009-gui/tool.cpp
===================================================================
--- tools/branches/gsoc2009-gui/tool.cpp 2009-07-22 22:22:08 UTC (rev 42669)
+++ tools/branches/gsoc2009-gui/tool.cpp 2009-07-23 01:41:14 UTC (rev 42670)
@@ -26,8 +26,9 @@
#include "util.h"
#include "tool.h"
-Tool::Tool(const std::string &name) {
+Tool::Tool(const std::string &name, ToolType type) {
_name = name;
+ _type = type;
_arguments_parsed = 0;
_argv = NULL;
@@ -126,7 +127,7 @@
// Change output to directory if necessary
- if (_outputToDirectory) {
+ if (_outputToDirectory && _outputPath.empty() == false) {
// Ensure last character is a /, this way we force directory output
char lastchr = _outputPath.getFullPath()[_outputPath.getFullPath().size() - 1];
if (lastchr != '/' && lastchr != '\\') {
@@ -266,6 +267,18 @@
void Tool::parseExtraArguments() {
}
+std::string Tool::getName() const {
+ return _name;
+}
+
+std::string Tool::getHelp() const {
+ return _helptext;
+}
+
+ToolType Tool::getType() const {
+ return _type;
+}
+
// Standard print function
void Tool::standardPrint(void * /*udata*/, const char *text) {
puts(text);
Modified: tools/branches/gsoc2009-gui/tool.h
===================================================================
--- tools/branches/gsoc2009-gui/tool.h 2009-07-22 22:22:08 UTC (rev 42669)
+++ tools/branches/gsoc2009-gui/tool.h 2009-07-23 01:41:14 UTC (rev 42670)
@@ -1,4 +1,3 @@
-
/* tool.h - Common base class for all tools
* Copyright (C) 2009 The ScummVM project
*
@@ -31,20 +30,31 @@
class ToolGUI;
+/**
+ * Different types of tools, used to differentiate them when
+ * fetching lists of games & tools.
+ */
+enum ToolType {
+ TOOLTYPE_COMPRESSION,
+ TOOLTYPE_EXTRACTION,
+ TOOLTYPE_UNKNOWN,
+ TOOLTYPE_ALL,
+};
+
/**
* Describes a possible input to the tool (since some take two seperate files,
- * some a dir and some a single file
+ * some a dir and some a single file.
*/
struct ToolInput {
ToolInput() : format("*.*"), file(true) {}
- /** The expected format of the input file, in wildcard fashion */
+ /** The expected format of the input file, in wildcard fashion. */
std::string format;
- /** A short description of what file is expected, displayed in the UI */
+ /** A short description of what file is expected, displayed in the UI. */
std::string description;
- /** The path filled in */
+ /** The path filled in. */
std::string path;
- /** If false, this input is a directory */
+ /** If false, this input is a directory. */
bool file;
};
@@ -52,7 +62,7 @@
class Tool {
public:
- Tool(const std::string &name);
+ Tool(const std::string &name, ToolType type);
virtual ~Tool();
// Run with CLI args (parses them, and then calls run())
@@ -93,7 +103,12 @@
/** Returns name of the tool */
std::string getName() const;
+ /** Returns the helpstring of the tool */
+ std::string getHelp() const;
+ /** Returns the type of the tool */
+ ToolType getType() const;
+
/**
* Notifies of progress, normally just prints a dot if enough time has passed since the last call
* This may through an AbortException, you should generally not catch this
@@ -184,9 +199,11 @@
/** If this tool can display output progress in % */
bool _supportsProgressBar;
- /** Name of the tool */
+ /** Name of the tool. */
std::string _name;
- /** The text to display to help the user */
+ /** Type of the tool. */
+ ToolType _type;
+ /** The text to display to help the user. */
std::string _helptext;
/** Status of internal abort flag, if set, next call to *Progress will throw */
Added: tools/branches/gsoc2009-gui/tools.cpp
===================================================================
--- tools/branches/gsoc2009-gui/tools.cpp (rev 0)
+++ tools/branches/gsoc2009-gui/tools.cpp 2009-07-23 01:41:14 UTC (rev 42670)
@@ -0,0 +1,105 @@
+/* tools - Interface for accessing all the tools in a conveinient fashion
+ * Copyright (C) 2009 The ScummVM project
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL
+ * $Id
+ *
+ */
+
+
+#include "tools.h"
+#include "tool.h"
+
+#include "compress_agos.h"
+#include "compress_gob.h"
+#include "compress_kyra.h"
+#include "compress_queen.h"
+#include "compress_saga.h"
+#include "compress_scumm_bun.h"
+#include "compress_scumm_san.h"
+#include "compress_scumm_sou.h"
+#include "compress_sword1.h"
+#include "compress_sword2.h"
+#include "compress_touche.h"
+#include "compress_tinsel.h"
+#include "compress_touche.h"
+#include "compress_tucker.h"
+#include "encode_dxa.h"
+#include "extract_agos.h"
+#include "extract_gob_stk.h"
+#include "extract_kyra.h"
+#include "extract_loom_tg16.h"
+#include "extract_mm_apple.h"
+#include "extract_mm_c64.h"
+#include "extract_mm_nes.h"
+#include "extract_parallaction.h"
+#include "extract_scumm_mac.h"
+#include "extract_zak_c64.h"
+
+Tools::Tools() {
+
+ // TODO: Rather than having the list here and in gui/tools.cpp
+ // those "tools" should inherit this class with the complete list
+ _tools.push_back(new CompressAgos());
+ _tools.push_back(new CompressGob());
+ _tools.push_back(new CompressKyra());
+ _tools.push_back(new CompressQueen());
+ _tools.push_back(new CompressSaga());
+ _tools.push_back(new CompressScummBun());
+ _tools.push_back(new CompressScummSan());
+ _tools.push_back(new CompressScummSou());
+ _tools.push_back(new CompressSword1());
+ _tools.push_back(new CompressSword2());
+ _tools.push_back(new CompressTinsel());
+ _tools.push_back(new CompressTouche());
+ _tools.push_back(new CompressTucker());
+ //_tools.push_back(new EncodeDXA());
+
+ _tools.push_back(new ExtractAgos());
+ _tools.push_back(new ExtractGobStk());
+ _tools.push_back(new ExtractKyra());
+ _tools.push_back(new ExtractLoomTG16());
+ _tools.push_back(new ExtractMMApple());
+ _tools.push_back(new ExtractMMC64());
+ _tools.push_back(new ExtractMMNes());
+ _tools.push_back(new ExtractParallaction());
+ _tools.push_back(new ExtractScummMac());
+ _tools.push_back(new ExtractZakC64());
+}
+
+Tools::~Tools() {
+ for (ToolList::iterator iter = _tools.begin(); iter != _tools.end(); ++iter) {
+ delete *iter;
+ }
+}
+
+Tools::ToolList Tools::inspectInput(ToolType type, std::deque<char *> arguments) {
+ ToolList choices;
+ for (ToolList::iterator tool = _tools.begin(); tool != _tools.end(); ++tool) {
+ if (type == TOOLTYPE_ALL || (*tool)->getType() == type) {
+ if ((*tool)->_inputPaths.size() == arguments.size()) {
+ for (std::deque<char *>::const_iterator filename = arguments.begin(); filename != arguments.end(); ++filename) {
+ if((*tool)->inspectInput(*filename)) {
+ choices.push_back(*tool);
+ break;
+ }
+ }
+ }
+ }
+ }
+ return choices;
+}
Property changes on: tools/branches/gsoc2009-gui/tools.cpp
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Date Rev Author URL Id
Added: svn:eol-style
+ native
Added: tools/branches/gsoc2009-gui/tools.h
===================================================================
--- tools/branches/gsoc2009-gui/tools.h (rev 0)
+++ tools/branches/gsoc2009-gui/tools.h 2009-07-23 01:41:14 UTC (rev 42670)
@@ -0,0 +1,43 @@
+/* tools - Interface for accessing all the tools in a conveinient fashion
+ * Copyright (C) 2009 The ScummVM project
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL
+ * $Id
+ *
+ */
+
+#ifndef TOOLS_H
+#define TOOLS_H
+
+#include "tool.h"
+
+#include <deque>
+
+class Tools {
+public:
+ Tools();
+ ~Tools();
+
+ typedef std::vector<Tool *> ToolList;
+
+ ToolList inspectInput(ToolType type, std::deque<char *> arguments);
+
+protected:
+ ToolList _tools;
+};
+
+#endif
Property changes on: tools/branches/gsoc2009-gui/tools.h
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Date Rev Author URL Id
Added: svn:eol-style
+ native
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