aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--base/plugins.cpp14
-rw-r--r--gui/options.cpp35
-rw-r--r--gui/options.h3
-rw-r--r--gui/theme-config.cpp3
-rw-r--r--gui/themes/classic080.ini3
-rw-r--r--gui/themes/modern.ini3
6 files changed, 60 insertions, 1 deletions
diff --git a/base/plugins.cpp b/base/plugins.cpp
index 9e2c2599ce..aa813297fc 100644
--- a/base/plugins.cpp
+++ b/base/plugins.cpp
@@ -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 @@ PluginList FilePluginProvider::getPlugins() {
// 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.
diff --git a/gui/options.cpp b/gui/options.cpp
index 7972ceebb2..d6f5306ce2 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -55,6 +55,7 @@ enum {
kChooseSaveDirCmd = 'chos',
kChooseThemeDirCmd = 'chth',
kChooseExtraDirCmd = 'chex',
+ kChoosePluginsDirCmd = 'chpl',
kChooseThemeCmd = 'chtf'
};
@@ -706,6 +707,11 @@ GlobalOptionsDialog::GlobalOptionsDialog()
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
@@ -772,6 +778,15 @@ void GlobalOptionsDialog::open() {
} 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
@@ -801,6 +816,14 @@ void GlobalOptionsDialog::close() {
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 @@ void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint3
}
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) {
diff --git a/gui/options.h b/gui/options.h
index 6f0fccf3cb..8f4496c753 100644
--- a/gui/options.h
+++ b/gui/options.h
@@ -158,6 +158,9 @@ protected:
StaticTextWidget *_savePath;
StaticTextWidget *_themePath;
StaticTextWidget *_extraPath;
+#ifdef DYNAMIC_MODULES
+ StaticTextWidget *_pluginsPath;
+#endif
//
// Misc controls
diff --git a/gui/theme-config.cpp b/gui/theme-config.cpp
index e6d8026edb..47f60d3d7b 100644
--- a/gui/theme-config.cpp
+++ b/gui/theme-config.cpp
@@ -215,6 +215,9 @@ const char *Theme::_defaultConfigINI =
"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"
diff --git a/gui/themes/classic080.ini b/gui/themes/classic080.ini
index 23d91b701e..b5c911bada 100644
--- a/gui/themes/classic080.ini
+++ b/gui/themes/classic080.ini
@@ -134,6 +134,9 @@ yoffset=(yoffset + buttonHeight + 4)
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
diff --git a/gui/themes/modern.ini b/gui/themes/modern.ini
index b5929511b0..87ef0bcbb9 100644
--- a/gui/themes/modern.ini
+++ b/gui/themes/modern.ini
@@ -295,6 +295,9 @@ yoffset=(yoffset + buttonHeight + ySeparation)
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