[Scummvm-cvs-logs] SF.net SVN: scummvm: [31960] scummvm/trunk
jvprat at users.sourceforge.net
jvprat at users.sourceforge.net
Fri May 9 03:58:12 CEST 2008
Revision: 31960
http://scummvm.svn.sourceforge.net/scummvm/?rev=31960&view=rev
Author: jvprat
Date: 2008-05-08 18:58:12 -0700 (Thu, 08 May 2008)
Log Message:
-----------
Added the option to specify the custom path for loading plugins
Modified Paths:
--------------
scummvm/trunk/base/plugins.cpp
scummvm/trunk/gui/options.cpp
scummvm/trunk/gui/options.h
scummvm/trunk/gui/theme-config.cpp
scummvm/trunk/gui/themes/classic080.ini
scummvm/trunk/gui/themes/modern.ini
Modified: scummvm/trunk/base/plugins.cpp
===================================================================
--- scummvm/trunk/base/plugins.cpp 2008-05-09 01:42:25 UTC (rev 31959)
+++ scummvm/trunk/base/plugins.cpp 2008-05-09 01:58:12 UTC (rev 31960)
@@ -26,6 +26,10 @@
#include "base/plugins.h"
#include "common/util.h"
+#ifdef DYNAMIC_MODULES
+#include "common/config-manager.h"
+#endif
+
int pluginTypeVersions[PLUGIN_TYPE_MAX] = {
PLUGIN_TYPE_ENGINE_VERSION,
};
@@ -168,13 +172,21 @@
// Prepare the list of directories to search
Common::StringList pluginDirs;
- // TODO: Add the user specified directory (via config file)
+
+ // Add the default directories
pluginDirs.push_back(".");
pluginDirs.push_back("plugins");
// Add the provider's custom directories
addCustomDirectories(pluginDirs);
+ // Add the user specified directory
+ Common::String pluginsPath(ConfMan.get("pluginspath"));
+ if (!pluginsPath.empty()) {
+ FilesystemNode dir(pluginsPath);
+ pluginDirs.push_back(dir.getPath());
+ }
+
Common::StringList::const_iterator d;
for (d = pluginDirs.begin(); d != pluginDirs.end(); d++) {
// Load all plugins.
Modified: scummvm/trunk/gui/options.cpp
===================================================================
--- scummvm/trunk/gui/options.cpp 2008-05-09 01:42:25 UTC (rev 31959)
+++ scummvm/trunk/gui/options.cpp 2008-05-09 01:58:12 UTC (rev 31960)
@@ -55,6 +55,7 @@
kChooseSaveDirCmd = 'chos',
kChooseThemeDirCmd = 'chth',
kChooseExtraDirCmd = 'chex',
+ kChoosePluginsDirCmd = 'chpl',
kChooseThemeCmd = 'chtf'
};
@@ -706,7 +707,12 @@
new ButtonWidget(tab, "globaloptions_extrabutton", "Extra Path:", kChooseExtraDirCmd, 0);
_extraPath = new StaticTextWidget(tab, "globaloptions_extrapath", "None");
+
+#ifdef DYNAMIC_MODULES
+ new ButtonWidget(tab, "globaloptions_pluginsbutton", "Plugins Path:", kChoosePluginsDirCmd, 0);
+ _pluginsPath = new StaticTextWidget(tab, "globaloptions_pluginspath", "None");
#endif
+#endif
#ifdef SMALL_SCREEN_DEVICE
new ButtonWidget(tab, "globaloptions_keysbutton", "Keys", kChooseKeyMappingCmd, 0);
@@ -772,7 +778,16 @@
} else {
_extraPath->setLabel(extraPath);
}
+
+#ifdef DYNAMIC_MODULES
+ Common::String pluginsPath(ConfMan.get("pluginspath", _domain));
+ if (pluginsPath.empty() || !ConfMan.hasKey("pluginspath", _domain)) {
+ _pluginsPath->setLabel("None");
+ } else {
+ _pluginsPath->setLabel(pluginsPath);
+ }
#endif
+#endif
// Misc Tab
_autosavePeriodPopUp->setSelected(1);
@@ -801,6 +816,14 @@
else
ConfMan.removeKey("extrapath", _domain);
+#ifdef DYNAMIC_MODULES
+ String pluginsPath(_pluginsPath->getLabel());
+ if (!pluginsPath.empty() && (pluginsPath != "None"))
+ ConfMan.set("pluginspath", pluginsPath, _domain);
+ else
+ ConfMan.removeKey("pluginspath", _domain);
+#endif
+
ConfMan.setInt("autosave_period", _autosavePeriodPopUp->getSelectedTag(), _domain);
}
OptionsDialog::close();
@@ -844,6 +867,18 @@
}
break;
}
+#ifdef DYNAMIC_MODULES
+ case kChoosePluginsDirCmd: {
+ BrowserDialog browser("Select directory for plugins", true);
+ if (browser.runModal() > 0) {
+ // User made his choice...
+ FilesystemNode dir(browser.getResult());
+ _pluginsPath->setLabel(dir.getPath());
+ draw();
+ }
+ break;
+ }
+#endif
case kChooseSoundFontCmd: {
BrowserDialog browser("Select SoundFont", false);
if (browser.runModal() > 0) {
Modified: scummvm/trunk/gui/options.h
===================================================================
--- scummvm/trunk/gui/options.h 2008-05-09 01:42:25 UTC (rev 31959)
+++ scummvm/trunk/gui/options.h 2008-05-09 01:58:12 UTC (rev 31960)
@@ -158,6 +158,9 @@
StaticTextWidget *_savePath;
StaticTextWidget *_themePath;
StaticTextWidget *_extraPath;
+#ifdef DYNAMIC_MODULES
+ StaticTextWidget *_pluginsPath;
+#endif
//
// Misc controls
Modified: scummvm/trunk/gui/theme-config.cpp
===================================================================
--- scummvm/trunk/gui/theme-config.cpp 2008-05-09 01:42:25 UTC (rev 31959)
+++ scummvm/trunk/gui/theme-config.cpp 2008-05-09 01:58:12 UTC (rev 31960)
@@ -215,6 +215,9 @@
"globaloptions_themebutton=10 yoffset (buttonWidth + 5) buttonHeight\n"
"globaloptions_themepath=(prev.x2 + 20) (yoffset + glOff) (parent.w - (prev.w + 20) - 15) kLineHeight\n"
"yoffset=(yoffset + buttonHeight + 4)\n"
+"globaloptions_pluginsbutton=10 yoffset (buttonWidth + 5) buttonHeight\n"
+"globaloptions_pluginspath=(prev.x2 + 20) (yoffset + glOff) (parent.w - (prev.w + 20) - 15) kLineHeight\n"
+"yoffset=(yoffset + buttonHeight + 4)\n"
"globaloptions_keysbutton=10 yoffset (buttonWidth + 5) buttonHeight\n"
"\n"
"# Misc options\n"
Modified: scummvm/trunk/gui/themes/classic080.ini
===================================================================
--- scummvm/trunk/gui/themes/classic080.ini 2008-05-09 01:42:25 UTC (rev 31959)
+++ scummvm/trunk/gui/themes/classic080.ini 2008-05-09 01:58:12 UTC (rev 31960)
@@ -134,6 +134,9 @@
globaloptions_themebutton=10 yoffset (buttonWidth + 5) buttonHeight
globaloptions_themepath=(prev.x2 + 20) (yoffset + glOff) (parent.w - (prev.w + 20) - 15) kLineHeight
yoffset=(yoffset + buttonHeight + 4)
+globaloptions_pluginsbutton=10 yoffset (buttonWidth + 5) buttonHeight
+globaloptions_pluginspath=(prev.x2 + 20) (yoffset + glOff) (parent.w - (prev.w + 20) - 15) kLineHeight
+yoffset=(yoffset + buttonHeight + 4)
globaloptions_keysbutton=10 yoffset (buttonWidth + 5) buttonHeight
# Misc options
Modified: scummvm/trunk/gui/themes/modern.ini
===================================================================
--- scummvm/trunk/gui/themes/modern.ini 2008-05-09 01:42:25 UTC (rev 31959)
+++ scummvm/trunk/gui/themes/modern.ini 2008-05-09 01:58:12 UTC (rev 31960)
@@ -295,6 +295,9 @@
globaloptions_themebutton=xBorder yoffset buttonWidth buttonHeight
globaloptions_themepath=(prev.x2 + xSeparation) (yoffset + glOff) (parent.w - self.x - xBorder) kLineHeight
yoffset=(yoffset + buttonHeight + ySeparation)
+globaloptions_pluginsbutton=xBorder yoffset buttonWidth buttonHeight
+globaloptions_pluginspath=(prev.x2 + xSeparation) (yoffset + glOff) (parent.w - self.x - xBorder) kLineHeight
+yoffset=(yoffset + buttonHeight + ySeparation)
globaloptions_keysbutton=xBorder yoffset buttonWidth buttonHeight
# Misc options
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