diff options
author | Vicent Marti | 2008-10-05 11:21:07 +0000 |
---|---|---|
committer | Vicent Marti | 2008-10-05 11:21:07 +0000 |
commit | 5f30b1f320ca34fa05246736d9fe074c204cdf38 (patch) | |
tree | 9ef23f441455f0f807bb3a59c5d93854a5851456 /gui | |
parent | e32fc0ccca2570fc560969507351cf99a304ebf4 (diff) | |
parent | 99f8add65cb61d1e8da23f734da249687d24919e (diff) | |
download | scummvm-rg350-5f30b1f320ca34fa05246736d9fe074c204cdf38.tar.gz scummvm-rg350-5f30b1f320ca34fa05246736d9fe074c204cdf38.tar.bz2 scummvm-rg350-5f30b1f320ca34fa05246736d9fe074c204cdf38.zip |
Merged several revisions from SVNMerge.
Fixed theme loading to use the new ArchiveMember class.
Original SVNMerge.py log:
=====================
Merged revisions 34686,34688-34689,34691-34698,34700-34705,34707-34713,34715-34722,34725-34727,34731-34732,34734-34738,34746 via svnmerge from
https://tanoku@scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk
........
r34686 | cyx | 2008-09-29 21:09:56 +0200 (Mon, 29 Sep 2008) | 1 line
add constructor to SearchSet::Node for proper init of structure members with gcc 3.4.x (see tracker items #2120595, #2106292)
........
r34688 | cyx | 2008-09-29 22:08:26 +0200 (Mon, 29 Sep 2008) | 1 line
restrict _heXmapNum to HE versions, should fix #2135822
........
r34689 | eriktorbjorn | 2008-09-29 22:40:58 +0200 (Mon, 29 Sep 2008) | 4 lines
Since no one has come up with any better suggestion... this should fix #2123258
("COMI: Crash after video (SAN) play"). The eos() function won't return true
until we've tried to read *past* the end of the stream.
........
r34691 | tanoku | 2008-09-30 00:29:07 +0200 (Tue, 30 Sep 2008) | 1 line
Ported ZipArchive::getAllNames() implementation from GUI branch.
........
r34692 | fingolfin | 2008-09-30 11:07:03 +0200 (Tue, 30 Sep 2008) | 1 line
Order alphabetically
........
r34693 | fingolfin | 2008-09-30 11:08:17 +0200 (Tue, 30 Sep 2008) | 1 line
SAGA: Removed patchesCount from SAGAGameDescription
........
r34694 | fingolfin | 2008-09-30 11:09:39 +0200 (Tue, 30 Sep 2008) | 1 line
SCUMM HE: Use FilesystemNode::openForReading() instead of 'new Common::File' (didn't cover all instances, though)
........
r34695 | fingolfin | 2008-09-30 11:11:25 +0200 (Tue, 30 Sep 2008) | 1 line
SAGA: Forgot to commit saga.h
........
r34696 | fingolfin | 2008-09-30 11:12:02 +0200 (Tue, 30 Sep 2008) | 1 line
Added multiple new open() methods to Common::File, which make it possible to use this class as a generic convenience wrapper around all kinds of SeekableReadStream; also renamed the name() method to the less confusing getName()
........
r34697 | fingolfin | 2008-09-30 13:33:43 +0200 (Tue, 30 Sep 2008) | 1 line
cleanup
........
r34698 | tanoku | 2008-09-30 13:53:37 +0200 (Tue, 30 Sep 2008) | 1 line
Fixed functionality of ZipArchive::getAllNames(). Now it expects a possibly non-empty string list and returns the amount of new filenames added to it.
........
r34700 | fingolfin | 2008-09-30 14:27:38 +0200 (Tue, 30 Sep 2008) | 1 line
Renamed Engine::quit to Engine::shouldQuit (previously, it was easily confused with Engine::quitGame); also cleaned up engine.h a bit
........
r34701 | fingolfin | 2008-09-30 14:37:28 +0200 (Tue, 30 Sep 2008) | 1 line
cleanup
........
r34702 | fingolfin | 2008-09-30 14:38:44 +0200 (Tue, 30 Sep 2008) | 1 line
AdvancedDetector: Do not (ab)use paths to keep track of files, rather, use FSNodes -- partial (?) fix for bug #2137680
........
r34703 | fingolfin | 2008-09-30 14:58:27 +0200 (Tue, 30 Sep 2008) | 1 line
SAGA: Some code cleanup
........
r34704 | fingolfin | 2008-09-30 14:59:29 +0200 (Tue, 30 Sep 2008) | 1 line
SKY: Fix detector to not (ab)use FSNode::getPath; if you want to open a FSNode, just pass it to File::open
........
r34705 | thebluegr | 2008-09-30 15:19:14 +0200 (Tue, 30 Sep 2008) | 1 line
Fixed crash when starting IHNM, a regression from commit #34693
........
r34707 | fingolfin | 2008-09-30 17:42:19 +0200 (Tue, 30 Sep 2008) | 1 line
Fixing ConfigManager::loadConfigFile
........
r34708 | fingolfin | 2008-09-30 18:23:35 +0200 (Tue, 30 Sep 2008) | 1 line
AGI: Another case where it is better to use FSNodes directly, instead of converting them to path strings
........
r34709 | fingolfin | 2008-09-30 18:34:38 +0200 (Tue, 30 Sep 2008) | 1 line
Modified FilePluginProvider to use FSNodes (instead of raw filenames / paths) in its API
........
r34710 | fingolfin | 2008-09-30 18:38:46 +0200 (Tue, 30 Sep 2008) | 1 line
AGI: Got rid of yet another unwarranted use of FSNode::getPath
........
r34711 | fingolfin | 2008-09-30 18:53:04 +0200 (Tue, 30 Sep 2008) | 1 line
AGI: Simplify WagFileParser by not reading data into a memory stream first (this was there to improve performance on systems with slow seeking; those systems should use another approach, see scummvm-devel)
........
r34712 | thebluegr | 2008-09-30 18:55:10 +0200 (Tue, 30 Sep 2008) | 1 line
Fix crash when starting ITE, a regression from commit #34705
........
r34713 | fingolfin | 2008-09-30 19:09:41 +0200 (Tue, 30 Sep 2008) | 1 line
Fix ThemeBrowser to use FSNodes, not getPath()
........
r34715 | Kirben | 2008-10-02 16:41:50 +0200 (Thu, 02 Oct 2008) | 1 line
Correct HE version for Putt-Putt Enters the Race (French/Windows).
........
r34716 | fingolfin | 2008-10-02 18:58:59 +0200 (Thu, 02 Oct 2008) | 1 line
Renamed FilesystemNode -> FSNode
........
r34717 | fingolfin | 2008-10-02 19:08:15 +0200 (Thu, 02 Oct 2008) | 1 line
cleanup
........
r34718 | fingolfin | 2008-10-02 19:17:18 +0200 (Thu, 02 Oct 2008) | 1 line
Ignore String::deleteLastChar when called on an empty string
........
r34719 | fingolfin | 2008-10-02 19:20:21 +0200 (Thu, 02 Oct 2008) | 1 line
Fix for bug #2142743: Assertion on clicking "Theme" in Options
........
r34720 | fingolfin | 2008-10-02 19:48:01 +0200 (Thu, 02 Oct 2008) | 7 lines
Engine class changed:
- Moved initCommonGFX() && GUIErrorMessage() out of class Engine
- got rid of the _autosavePeriod member (this prevented users from
changing the autosave period during runtime)
- Got rid of an evil 'using GUI::Dialog' statement
- Clarified some Doxygen comments
........
r34721 | fingolfin | 2008-10-02 19:52:29 +0200 (Thu, 02 Oct 2008) | 1 line
Add the current dir to the global SearchSet, i.e. to SearchMan (this should fix the problems on Windows, and maybe other systems, see 'bug' #2137680)
........
r34722 | fingolfin | 2008-10-02 19:55:08 +0200 (Thu, 02 Oct 2008) | 1 line
Forgot to mention yet another Engine class change: mainMenuDialog -> openMainMenuDialog; and also forgot to commit this related file :/
........
r34725 | fingolfin | 2008-10-02 20:11:40 +0200 (Thu, 02 Oct 2008) | 1 line
typo
........
r34726 | thebluegr | 2008-10-03 00:04:34 +0200 (Fri, 03 Oct 2008) | 1 line
Merged loadHotSpotsMads() and loadHotSpotsM4()
........
r34727 | lordhoto | 2008-10-03 02:16:21 +0200 (Fri, 03 Oct 2008) | 2 lines
Fixed typos (thanks to Raziel^ for spotting them).
........
r34731 | fingolfin | 2008-10-03 18:07:57 +0200 (Fri, 03 Oct 2008) | 1 line
Fixed Engine::hasFeature to use proper types (i.e., MetaEngine::MetaEngineFeature instead of int)
........
r34732 | fingolfin | 2008-10-03 18:14:12 +0200 (Fri, 03 Oct 2008) | 1 line
SCUMM: Added french Monkey VGA variant, see bug #2129199
........
r34734 | lordhoto | 2008-10-03 18:57:40 +0200 (Fri, 03 Oct 2008) | 2 lines
Committed slightly modified patch #2034983 "Case-insensitivy and directory handling for engines".
........
r34735 | lordhoto | 2008-10-03 20:18:42 +0200 (Fri, 03 Oct 2008) | 2 lines
Check all 'kyra.dat' files in setup paths instead of only the first one found.
........
r34736 | lordhoto | 2008-10-03 20:23:57 +0200 (Fri, 03 Oct 2008) | 2 lines
Cleanup.
........
r34737 | dreammaster | 2008-10-04 13:10:25 +0200 (Sat, 04 Oct 2008) | 1 line
Bugfix to prevent NPC characters managing to walk beyond room exits without leaving the room, and thus getting stuck
........
r34738 | fingolfin | 2008-10-04 15:09:01 +0200 (Sat, 04 Oct 2008) | 1 line
Renamed some MetaEngine feature flags; removed explicit numbers from this feature flag list (nothing should rely on their specific values, anyway); added a note that Engine::hasFeature should become independant of MetaEngine::hasFeature
........
r34746 | john_doe | 2008-10-04 23:40:14 +0200 (Sat, 04 Oct 2008) | 3 lines
- Declared all stack functions as inline
- Sleep some ms after 500 opcodes to reduce CPU load
- Fixed odd bug in LGoP2 where text disappeared quickly without waiting for user input by returning 0x38 in sfShowPage
........
svn-id: r34749
Diffstat (limited to 'gui')
-rw-r--r-- | gui/ThemeEngine.cpp | 19 | ||||
-rw-r--r-- | gui/browser.cpp | 12 | ||||
-rw-r--r-- | gui/browser.h | 6 | ||||
-rw-r--r-- | gui/credits.h | 4 | ||||
-rw-r--r-- | gui/launcher.cpp | 22 | ||||
-rw-r--r-- | gui/massadd.cpp | 6 | ||||
-rw-r--r-- | gui/massadd.h | 4 | ||||
-rw-r--r-- | gui/options.cpp | 10 | ||||
-rw-r--r-- | gui/theme.cpp | 31 | ||||
-rw-r--r-- | gui/theme.h | 2 | ||||
-rw-r--r-- | gui/themebrowser.cpp | 20 | ||||
-rw-r--r-- | gui/themebrowser.h | 4 |
12 files changed, 65 insertions, 75 deletions
diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp index 6af62f7b80..5ed142cb31 100644 --- a/gui/ThemeEngine.cpp +++ b/gui/ThemeEngine.cpp @@ -536,13 +536,14 @@ bool ThemeEngine::loadThemeXML(Common::String themeName) { #ifdef USE_ZLIB Common::ZipArchive zipFile(themeName.c_str()); - Common::StringList zipContents; + Common::ArchiveMemberList zipContents; - if (zipFile.isOpen() && zipFile.getAllNames(zipContents)) { + if (zipFile.isOpen() && zipFile.listMembers(zipContents)) { - for (uint i = 0; i < zipContents.size(); ++i) { - if (!failed && matchString(zipContents[i].c_str(), "*.stx")) { - if (parser()->loadStream(zipFile.openFile(zipContents[i])) == false) { +// for (uint i = 0; i < zipContents.size(); ++i) { + for (Common::ArchiveMemberList::iterator za = zipContents.begin(); za != zipContents.end(); ++za) { + if (!failed && matchString((*za)->getName().c_str(), "*.stx")) { + if (parser()->loadStream((*za)->open()) == false) { warning("Failed to load stream for zipped file '%s'", fileNameBuffer); failed = true; } @@ -554,8 +555,8 @@ bool ThemeEngine::loadThemeXML(Common::String themeName) { parser()->close(); parseCount++; - } else if (zipContents[i] == "THEMERC") { - Common::SeekableReadStream *stream = zipFile.openFile(zipContents[i]); + } else if ((*za)->getName() == "THEMERC") { + Common::SeekableReadStream *stream = (*za)->open(); stxHeader = stream->readLine(); if (!themeConfigParseHeader(stxHeader.c_str(), _themeName)) { @@ -569,10 +570,10 @@ bool ThemeEngine::loadThemeXML(Common::String themeName) { } else { #endif - FilesystemNode node(themeName); + FSNode node(themeName); if (node.exists() && node.isReadable() && node.isDirectory()) { FSList fslist; - if (!node.getChildren(fslist, FilesystemNode::kListFilesOnly)) + if (!node.getChildren(fslist, FSNode::kListFilesOnly)) return false; for (FSList::const_iterator i = fslist.begin(); i != fslist.end(); ++i) { diff --git a/gui/browser.cpp b/gui/browser.cpp index 69f5dcd134..36969d9c54 100644 --- a/gui/browser.cpp +++ b/gui/browser.cpp @@ -107,7 +107,7 @@ int BrowserDialog::runModal() { err = FSRefMakePath(&ref, (UInt8*)buf, sizeof(buf)-1); assert(err == noErr); - _choice = Common::FilesystemNode(buf); + _choice = Common::FSNode(buf); choiceMade = true; } @@ -160,9 +160,9 @@ BrowserDialog::BrowserDialog(const char *title, bool dirBrowser) void BrowserDialog::open() { if (ConfMan.hasKey("browser_lastpath")) - _node = Common::FilesystemNode(ConfMan.get("browser_lastpath")); + _node = Common::FSNode(ConfMan.get("browser_lastpath")); if (!_node.isDirectory()) - _node = Common::FilesystemNode("."); + _node = Common::FSNode("."); // Alway refresh file list updateListing(); @@ -227,9 +227,9 @@ void BrowserDialog::updateListing() { ConfMan.set("browser_lastpath", _node.getPath()); // Read in the data from the file system - Common::FilesystemNode::ListMode listMode = - _isDirBrowser ? Common::FilesystemNode::kListDirectoriesOnly - : Common::FilesystemNode::kListAll; + Common::FSNode::ListMode listMode = + _isDirBrowser ? Common::FSNode::kListDirectoriesOnly + : Common::FSNode::kListAll; if (!_node.getChildren(_nodeContent, listMode)) { _nodeContent.clear(); } else { diff --git a/gui/browser.h b/gui/browser.h index c8bdec26a2..8dc7eda43a 100644 --- a/gui/browser.h +++ b/gui/browser.h @@ -50,7 +50,7 @@ public: virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data); #endif - const Common::FilesystemNode &getResult() { return _choice; } + const Common::FSNode &getResult() { return _choice; } protected: #ifdef MACOSX @@ -58,10 +58,10 @@ protected: #else ListWidget *_fileList; StaticTextWidget *_currentPath; - Common::FilesystemNode _node; + Common::FSNode _node; Common::FSList _nodeContent; #endif - Common::FilesystemNode _choice; + Common::FSNode _choice; bool _isDirBrowser; #ifndef MACOSX diff --git a/gui/credits.h b/gui/credits.h index c04a99ddbd..d311561cc7 100644 --- a/gui/credits.h +++ b/gui/credits.h @@ -109,7 +109,7 @@ static const char *credits[] = { "\\C\\c0""Andrew Kurushin", "\\C\\c0""Eugene Sandulenko", "\\C\\c0""", -"\\C\\c1""Tinsel;", +"\\C\\c1""Tinsel", "\\C\\c0""Torbj\366rn Andersson", "\\C\\c0""Paul Gilbert", "\\C\\c0""Sven Hesse", @@ -217,7 +217,7 @@ static const char *credits[] = { "\\C\\c0""Peter Moraliyski", "\\C\\c2""Port: GP32", "\\C\\c0""Juha Niemim\344ki", -"\\C\\c2""Formaer AmigaOS 4 packager", +"\\C\\c2""Former AmigaOS 4 packager", "\\C\\c0""Jeremy Newman", "\\C\\c2""Former webmaster", "\\C\\c0""Lionel Ulmer", diff --git a/gui/launcher.cpp b/gui/launcher.cpp index e337c718a2..08206c9aab 100644 --- a/gui/launcher.cpp +++ b/gui/launcher.cpp @@ -395,7 +395,7 @@ void EditGameDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat if (browser.runModal() > 0) { // User made this choice... - Common::FilesystemNode file(browser.getResult()); + Common::FSNode file(browser.getResult()); _soundFont->setLabel(file.getPath()); if (!file.getPath().empty() && (file.getPath() != "None")) @@ -413,11 +413,11 @@ void EditGameDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat BrowserDialog browser("Select directory with game data", true); if (browser.runModal() > 0) { // User made his choice... - Common::FilesystemNode dir(browser.getResult()); + Common::FSNode dir(browser.getResult()); // TODO: Verify the game can be found in the new directory... Best // done with optional specific gameid to pluginmgr detectgames? - // FSList files = dir.listDir(FilesystemNode::kListFilesOnly); + // FSList files = dir.listDir(FSNode::kListFilesOnly); _gamePathWidget->setLabel(dir.getPath()); draw(); @@ -431,7 +431,7 @@ void EditGameDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat BrowserDialog browser("Select additional game directory", true); if (browser.runModal() > 0) { // User made his choice... - Common::FilesystemNode dir(browser.getResult()); + Common::FSNode dir(browser.getResult()); _extraPathWidget->setLabel(dir.getPath()); draw(); } @@ -443,7 +443,7 @@ void EditGameDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat BrowserDialog browser("Select directory for saved games", true); if (browser.runModal() > 0) { // User made his choice... - Common::FilesystemNode dir(browser.getResult()); + Common::FSNode dir(browser.getResult()); _savePathWidget->setLabel(dir.getPath()); draw(); } @@ -555,10 +555,10 @@ int SaveLoadChooser::runModal(const EnginePlugin *plugin, const String &target) _plugin = plugin; _target = target; _delSupport = (*_plugin)->hasFeature(MetaEngine::kSupportsDeleteSave); - _metaInfoSupport = (*_plugin)->hasFeature(MetaEngine::kSupportsMetaInfos); - _thumbnailSupport = _metaInfoSupport && (*_plugin)->hasFeature(MetaEngine::kSupportsThumbnails); - _saveDateSupport = _metaInfoSupport && (*_plugin)->hasFeature(MetaEngine::kSupportsSaveDate); - _playTimeSupport = _metaInfoSupport && (*_plugin)->hasFeature(MetaEngine::kSupportsSavePlayTime); + _metaInfoSupport = (*_plugin)->hasFeature(MetaEngine::kSavesSupportMetaInfo); + _thumbnailSupport = _metaInfoSupport && (*_plugin)->hasFeature(MetaEngine::kSavesSupportThumbnail); + _saveDateSupport = _metaInfoSupport && (*_plugin)->hasFeature(MetaEngine::kSavesSupportCreationDate); + _playTimeSupport = _metaInfoSupport && (*_plugin)->hasFeature(MetaEngine::kSavesSupportPlayTime); reflowLayout(); updateSaveList(); @@ -954,9 +954,9 @@ void LauncherDialog::addGame() { if (_browser->runModal() > 0) { // User made his choice... - Common::FilesystemNode dir(_browser->getResult()); + Common::FSNode dir(_browser->getResult()); Common::FSList files; - if (!dir.getChildren(files, Common::FilesystemNode::kListAll)) { + if (!dir.getChildren(files, Common::FSNode::kListAll)) { error("browser returned a node that is not a directory: '%s'", dir.getPath().c_str()); } diff --git a/gui/massadd.cpp b/gui/massadd.cpp index c34c190776..6d40c4e78b 100644 --- a/gui/massadd.cpp +++ b/gui/massadd.cpp @@ -58,7 +58,7 @@ enum { -MassAddDialog::MassAddDialog(const Common::FilesystemNode &startDir) +MassAddDialog::MassAddDialog(const Common::FSNode &startDir) : Dialog("massadddialog"), _dirsScanned(0), _okButton(0), @@ -156,10 +156,10 @@ void MassAddDialog::handleTickle() { // Perform a breadth-first scan of the filesystem. while (!_scanStack.empty() && (g_system->getMillis() - t) < kMaxScanTime) { - Common::FilesystemNode dir = _scanStack.pop(); + Common::FSNode dir = _scanStack.pop(); Common::FSList files; - if (!dir.getChildren(files, Common::FilesystemNode::kListAll)) { + if (!dir.getChildren(files, Common::FSNode::kListAll)) { error("browser returned a node that is not a directory: '%s'", dir.getPath().c_str()); } diff --git a/gui/massadd.h b/gui/massadd.h index 733559cf37..c2a0eff2ba 100644 --- a/gui/massadd.h +++ b/gui/massadd.h @@ -38,14 +38,14 @@ class StaticTextWidget; class MassAddDialog : public Dialog { public: - MassAddDialog(const Common::FilesystemNode &startDir); + MassAddDialog(const Common::FSNode &startDir); //void open(); void handleCommand(CommandSender *sender, uint32 cmd, uint32 data); void handleTickle(); private: - Common::Stack<Common::FilesystemNode> _scanStack; + Common::Stack<Common::FSNode> _scanStack; GameList _games; /** diff --git a/gui/options.cpp b/gui/options.cpp index ea80283f97..5a95101f3d 100644 --- a/gui/options.cpp +++ b/gui/options.cpp @@ -858,7 +858,7 @@ void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint3 BrowserDialog browser("Select directory for savegames", true); if (browser.runModal() > 0) { // User made his choice... - Common::FilesystemNode dir(browser.getResult()); + Common::FSNode dir(browser.getResult()); if (dir.isWritable()) { _savePath->setLabel(dir.getPath()); } else { @@ -874,7 +874,7 @@ void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint3 BrowserDialog browser("Select directory for GUI themes", true); if (browser.runModal() > 0) { // User made his choice... - Common::FilesystemNode dir(browser.getResult()); + Common::FSNode dir(browser.getResult()); _themePath->setLabel(dir.getPath()); draw(); } @@ -884,7 +884,7 @@ void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint3 BrowserDialog browser("Select directory for extra files", true); if (browser.runModal() > 0) { // User made his choice... - Common::FilesystemNode dir(browser.getResult()); + Common::FSNode dir(browser.getResult()); _extraPath->setLabel(dir.getPath()); draw(); } @@ -895,7 +895,7 @@ void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint3 BrowserDialog browser("Select directory for plugins", true); if (browser.runModal() > 0) { // User made his choice... - Common::FilesystemNode dir(browser.getResult()); + Common::FSNode dir(browser.getResult()); _pluginsPath->setLabel(dir.getPath()); draw(); } @@ -906,7 +906,7 @@ void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint3 BrowserDialog browser("Select SoundFont", false); if (browser.runModal() > 0) { // User made his choice... - Common::FilesystemNode file(browser.getResult()); + Common::FSNode file(browser.getResult()); _soundFont->setLabel(file.getPath()); if (!file.getPath().empty() && (file.getPath() != "None")) diff --git a/gui/theme.cpp b/gui/theme.cpp index cf77441267..3205ee6533 100644 --- a/gui/theme.cpp +++ b/gui/theme.cpp @@ -46,9 +46,10 @@ const Graphics::Font *Theme::loadFont(const char *filename) { #ifdef USE_ZLIB Common::ZipArchive zipArchive(getThemeFileName().c_str()); - if (zipArchive.hasFile(cacheFilename)) { - Common::FilePtr stream(zipArchive.openFile(cacheFilename)); - font = Graphics::NewFont::loadFromCache(*stream.get()); + Common::SeekableReadStream *stream(zipArchive.openFile(cacheFilename)); + if (stream) { + font = Graphics::NewFont::loadFromCache(*stream); + delete stream; } #endif if (font) @@ -64,9 +65,10 @@ const Graphics::Font *Theme::loadFont(const char *filename) { if (!font) { Common::ZipArchive zipArchive(getThemeFileName().c_str()); - if (zipArchive.hasFile(filename)) { - Common::FilePtr stream(zipArchive.openFile(filename)); - font = Graphics::NewFont::loadFont(*stream.get()); + Common::SeekableReadStream *stream(zipArchive.openFile(filename)); + if (stream) { + font = Graphics::NewFont::loadFont(*stream); + delete stream; } } #endif @@ -130,22 +132,9 @@ bool Theme::themeConfigParseHeader(Common::String header, Common::String &themeN return tok.empty(); } -bool Theme::themeConfigUseable(const Common::FilesystemNode &node, Common::String &themeName) { +bool Theme::themeConfigUseable(const Common::FSNode &node, Common::String &themeName) { Common::String stxHeader; bool foundHeader = false; - -// Not needed atm, using FSNodes. -/* - if (ConfMan.hasKey("themepath")) - Common::File::addDefaultDirectory(ConfMan.get("themepath")); - -#ifdef DATA_PATH - Common::File::addDefaultDirectoryRecursive(DATA_PATH); -#endif - - if (ConfMan.hasKey("extrapath")) - Common::File::addDefaultDirectoryRecursive(ConfMan.get("extrapath")); -*/ if (node.getName().hasSuffix(".zip")) { @@ -163,7 +152,7 @@ bool Theme::themeConfigUseable(const Common::FilesystemNode &node, Common::Strin #endif } else if (node.isDirectory()) { - Common::FilesystemNode headerfile = node.getChild("THEMERC"); + Common::FSNode headerfile = node.getChild("THEMERC"); if (!headerfile.exists() || !headerfile.isReadable() || headerfile.isDirectory()) return false; diff --git a/gui/theme.h b/gui/theme.h index 5294daa4d4..c4080f884e 100644 --- a/gui/theme.h +++ b/gui/theme.h @@ -305,7 +305,7 @@ public: bool isThemeLoadingRequired(); virtual ThemeEval *evaluator() = 0; - static bool themeConfigUseable(const Common::FilesystemNode &node, Common::String &themeName); + static bool themeConfigUseable(const Common::FSNode &node, Common::String &themeName); static bool themeConfigParseHeader(Common::String header, Common::String &themeName); virtual const Common::String &getThemeFileName() const = 0; diff --git a/gui/themebrowser.cpp b/gui/themebrowser.cpp index 5d8c1e3512..7d3933cfbe 100644 --- a/gui/themebrowser.cpp +++ b/gui/themebrowser.cpp @@ -100,10 +100,10 @@ void ThemeBrowser::updateListing() { // files in other places are ignored in this dialog // TODO: let the user browse the complete FS too/only the FS? if (ConfMan.hasKey("themepath")) - addDir(_themes, ConfMan.get("themepath")); + addDir(_themes, Common::FSNode(ConfMan.get("themepath"))); #ifdef DATA_PATH - addDir(_themes, DATA_PATH); + addDir(_themes, Common::FSNode(DATA_PATH)); #endif #ifdef MACOSX @@ -111,7 +111,7 @@ void ThemeBrowser::updateListing() { if (resourceUrl) { char buf[256]; if (CFURLGetFileSystemRepresentation(resourceUrl, true, (UInt8 *)buf, 256)) { - Common::String resourcePath = buf; + Common::FSNode resourcePath(buf); addDir(_themes, resourcePath); } CFRelease(resourceUrl); @@ -119,9 +119,9 @@ void ThemeBrowser::updateListing() { #endif if (ConfMan.hasKey("extrapath")) - addDir(_themes, ConfMan.get("extrapath")); + addDir(_themes, Common::FSNode(ConfMan.get("extrapath"))); - addDir(_themes, "."); + addDir(_themes, Common::FSNode(".")); // Populate the ListWidget Common::StringList list; @@ -136,18 +136,17 @@ void ThemeBrowser::updateListing() { draw(); } -void ThemeBrowser::addDir(ThList &list, const Common::String &dir) { - - Common::FilesystemNode node(dir); +void ThemeBrowser::addDir(ThList &list, const Common::FSNode &node) { if (!node.exists() || !node.isReadable()) return; Common::FSList fslist; - if (!node.getChildren(fslist, Common::FilesystemNode::kListAll)) + if (!node.getChildren(fslist, Common::FSNode::kListAll)) return; for (Common::FSList::const_iterator i = fslist.begin(); i != fslist.end(); ++i) { + Entry th; if (isTheme(*i, th)) { bool add = true; @@ -166,6 +165,7 @@ void ThemeBrowser::addDir(ThList &list, const Common::String &dir) { if (node.lookupFile(fslist, "THEMERC", false, true, 1)) { for (FSList::const_iterator i = fslist.begin(); i != fslist.end(); ++i) { + Entry th; if (isTheme(i->getParent(), th)) { bool add = true; @@ -184,7 +184,7 @@ void ThemeBrowser::addDir(ThList &list, const Common::String &dir) { } } -bool ThemeBrowser::isTheme(const Common::FilesystemNode &node, Entry &out) { +bool ThemeBrowser::isTheme(const Common::FSNode &node, Entry &out) { out.file = node.getPath(); #ifdef USE_ZLIB diff --git a/gui/themebrowser.h b/gui/themebrowser.h index e47c3aac37..c33e239110 100644 --- a/gui/themebrowser.h +++ b/gui/themebrowser.h @@ -56,8 +56,8 @@ private: void updateListing(); - void addDir(ThList &list, const Common::String &dir); - bool isTheme(const Common::FilesystemNode &node, Entry &out); + void addDir(ThList &list, const Common::FSNode &node); + bool isTheme(const Common::FSNode &node, Entry &out); }; } // end of namespace GUI |