plugins: simplify integratePlugins(); ...

* CPluginsExec(): switch to singleton
* move CPluginsExec() to pluginlist.cpp|h
 because it's not really a settings_helper


Origin commit data
------------------
Commit: 389c4c232f
Author: vanhofen <vanhofen@gmx.de>
Date: 2014-11-10 (Mon, 10 Nov 2014)

Origin message was:
------------------
- plugins: simplify integratePlugins(); ...

* CPluginsExec(): switch to singleton
* move CPluginsExec() to pluginlist.cpp|h
 because it's not really a settings_helper
This commit is contained in:
vanhofen
2014-11-10 22:41:08 +01:00
parent 419e281a1e
commit cb354188c7
11 changed files with 55 additions and 52 deletions

View File

@@ -137,3 +137,40 @@ int CPluginChooser::run()
*selectedFilePtr = g_PluginList->getFileName(number);
return menu_return::RETURN_EXIT;
}
CPluginsExec* CPluginsExec::getInstance()
{
static CPluginsExec* pluginsExec = NULL;
if (!pluginsExec)
pluginsExec = new CPluginsExec();
return pluginsExec;
}
int CPluginsExec::exec(CMenuTarget* parent, const std::string & actionKey)
{
if (actionKey.empty())
return menu_return::RETURN_NONE;
//printf("CPluginsExec exec: %s\n", actionKey.c_str());
int sel = atoi(actionKey.c_str());
if (parent != NULL)
parent->hide();
if (actionKey == "teletext") {
g_RCInput->postMsg(CRCInput::RC_timeout, 0);
g_RCInput->postMsg(CRCInput::RC_text, 0);
}
else if (sel >= 0)
g_PluginList->startPlugin(sel);
if (!g_PluginList->getScriptOutput().empty())
ShowMsg(LOCALE_PLUGINS_RESULT, g_PluginList->getScriptOutput(), CMessageBox::mbrBack, CMessageBox::mbBack, NEUTRINO_ICON_SHELL);
if (g_PluginList->getIntegration(sel) == CPlugins::I_TYPE_DISABLED)
return menu_return::RETURN_EXIT;
return menu_return::RETURN_REPAINT;
}