- plugin-code: cleanup from many unused code; ...

* remove intergration conversion because we can use the integer as it is
* update headers

  Do we need /src/plugin.h anymore? Maybe this code could be merged into src/gui/plugins.h.

Signed-off-by: Thilo Graf <dbt@novatux.de>
This commit is contained in:
svenhoefer
2017-09-08 10:53:03 +02:00
committed by Thilo Graf
parent 2ace914324
commit f2ec46311c
11 changed files with 80 additions and 265 deletions

View File

@@ -90,16 +90,18 @@ int CInfoMenu::showMenu()
mf = new CMenuForwarder(LOCALE_STREAMINFO_HEAD, !CNeutrinoApp::getInstance()->channelList->isEmpty(), NULL, &streaminfo, NULL, CRCInput::RC_yellow);
mf->setHint(NEUTRINO_ICON_HINT_STREAMINFO, LOCALE_MENU_HINT_STREAMINFO);
info->addItem(mf);
#if 0
mf = new CMenuForwarder(LOCALE_HDD_INFO_HEAD, true, NULL, &hddinfo, NULL, CRCInput::RC_blue);
mf->setHint(NEUTRINO_ICON_HINT_HDD_INFO, LOCALE_MENU_HINT_HDD_INFO);
info->addItem(mf);
CBuildInfo buildinfo;
mf = new CMenuForwarder(LOCALE_BUILDINFO_MENU, true, NULL, &buildinfo, NULL, CRCInput::RC_blue);
mf->setHint(NEUTRINO_ICON_HINT_IMAGEINFO, LOCALE_MENU_HINT_BUILDINFO);
info->addItem(mf);
#endif
//add I_TYPE_INFORMATION plugins
info->integratePlugins(CPlugins::I_TYPE_INFORMATION, 1);
//add PLUGIN_INTEGRATION_INFORMATION plugins
info->integratePlugins(PLUGIN_INTEGRATION_INFORMATION, 1);
int res = info->exec(NULL, "");
delete info;

View File

@@ -197,9 +197,9 @@ int CMediaPlayerMenu::initMenuMedia(CMenuWidget *m, CPersonalizeGui *p)
//adding personalized items
personalize->addPersonalizedItems();
//add I_TYPE_MULTIMEDIA plugins
//add PLUGIN_INTEGRATION_MULTIMEDIA plugins
unsigned int nextShortcut = (unsigned int)multimedia_menu->getNextShortcut();
multimedia_menu->integratePlugins(CPlugins::I_TYPE_MULTIMEDIA, nextShortcut, enabled);
multimedia_menu->integratePlugins(PLUGIN_INTEGRATION_MULTIMEDIA, nextShortcut, enabled);
res = multimedia_menu->exec(NULL, "");

View File

@@ -4,38 +4,28 @@
Copyright (C) 2001 Steffen Hehn 'McClean'
Homepage: http://dbox.cyberphoria.org/
Kommentar:
Diese GUI wurde von Grund auf neu programmiert und sollte nun vom
Aufbau und auch den Ausbaumoeglichkeiten gut aussehen. Neutrino basiert
auf der Client-Server Idee, diese GUI ist also von der direkten DBox-
Steuerung getrennt. Diese wird dann von Daemons uebernommen.
License: GPL
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 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.
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., 675 Mass Ave, Cambridge, MA 02139, USA.
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <plugin.h>
#include <gui/pluginlist.h>
#include <gui/plugins.h>
#include <gui/components/cc.h>
#include <gui/widget/msgbox.h>
#include <gui/widget/icons.h>
@@ -59,8 +49,6 @@
#include <zapit/client/zapittools.h>
#include <system/helpers.h>
#include "plugins.h"
extern CPlugins * g_Plugins; /* neutrino.cpp */
CPluginList::CPluginList(const neutrino_locale_t Title, const uint32_t listtype)
@@ -111,7 +99,7 @@ int CPluginList::exec(CMenuTarget* parent, const std::string &actionKey)
int nop = g_Plugins->getNumberOfPlugins();
for(int count = 0; count < nop; count++) {
if ((g_Plugins->getType(count) & pluginlisttype) && !g_Plugins->isHidden(count) && (g_Plugins->getIntegration(count) == CPlugins::I_TYPE_DISABLED)) {
if ((g_Plugins->getType(count) & pluginlisttype) && !g_Plugins->isHidden(count) && (g_Plugins->getIntegration(count) == PLUGIN_INTEGRATION_DISABLED)) {
neutrino_msg_t d_key = g_Plugins->getKey(count);
keyhelper.get(&key, &dummy, d_key);
CMenuForwarder *f = new CMenuForwarder(std::string(g_Plugins->getName(count)), true, NULL, this, to_string(count).c_str(), key);
@@ -170,7 +158,7 @@ int CPluginsExec::exec(CMenuTarget* parent, const std::string & actionKey)
if (!g_Plugins->getScriptOutput().empty())
ShowMsg(LOCALE_PLUGINS_RESULT, g_Plugins->getScriptOutput(), CMsgBox::mbrBack, CMsgBox::mbBack, NEUTRINO_ICON_SHELL);
if (g_Plugins->getIntegration(sel) == CPlugins::I_TYPE_DISABLED)
if (g_Plugins->getIntegration(sel) == PLUGIN_INTEGRATION_DISABLED)
return menu_return::RETURN_EXIT;
return menu_return::RETURN_REPAINT;

View File

@@ -4,29 +4,20 @@
Copyright (C) 2001 Steffen Hehn 'McClean'
Homepage: http://dbox.cyberphoria.org/
Kommentar:
Diese GUI wurde von Grund auf neu programmiert und sollte nun vom
Aufbau und auch den Ausbaumoeglichkeiten gut aussehen. Neutrino basiert
auf der Client-Server Idee, diese GUI ist also von der direkten DBox-
Steuerung getrennt. Diese wird dann von Daemons uebernommen.
License: GPL
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 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.
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., 675 Mass Ave, Cambridge, MA 02139, USA.
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __pluginlist__
@@ -41,7 +32,6 @@
class CPluginList : public CMenuTarget
{
private:
neutrino_locale_t title;
uint32_t pluginlisttype;

View File

@@ -4,29 +4,20 @@
Copyright (C) 2001 Steffen Hehn 'McClean'
Homepage: http://dbox.cyberphoria.org/
Kommentar:
Diese GUI wurde von Grund auf neu programmiert und sollte nun vom
Aufbau und auch den Ausbaumoeglichkeiten gut aussehen. Neutrino basiert
auf der Client-Server Idee, diese GUI ist also von der direkten DBox-
Steuerung getrennt. Diese wird dann von Daemons uebernommen.
License: GPL
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 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.
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., 675 Mass Ave, Cambridge, MA 02139, USA.
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAVE_CONFIG_H
@@ -199,18 +190,10 @@ bool CPlugins::parseCfg(plugin *plugin_data)
plugin_data->key = CRCInput::RC_nokey;
plugin_data->name = "";
plugin_data->description = "";
#if 0
plugin_data->fb = false;
plugin_data->rc = false;
plugin_data->lcd = false;
plugin_data->vtxtpid = false;
plugin_data->showpig = false;
plugin_data->needoffset = false;
#endif
plugin_data->shellwindow = false;
plugin_data->hide = false;
plugin_data->type = CPlugins::P_TYPE_DISABLED;
plugin_data->integration = CPlugins::I_TYPE_DISABLED;
plugin_data->integration = PLUGIN_INTEGRATION_DISABLED;
plugin_data->hinticon = NEUTRINO_ICON_HINT_PLUGIN;
std::string _hintIcon = plugin_data->plugindir + "/" + plugin_data->filename + "_hint.png";
@@ -266,34 +249,8 @@ bool CPlugins::parseCfg(plugin *plugin_data)
}
else if (cmd == "integration")
{
plugin_data->integration = getPluginIntegration(atoi(parm));
plugin_data->integration = atoi(parm);
}
#if 0
else if (cmd == "needfb")
{
plugin_data->fb = atoi(parm);
}
else if (cmd == "needrc")
{
plugin_data->rc = atoi(parm);
}
else if (cmd == "needlcd")
{
plugin_data->lcd = atoi(parm);
}
else if (cmd == "needvtxtpid")
{
plugin_data->vtxtpid = atoi(parm);
}
else if (cmd == "pigon")
{
plugin_data->showpig = atoi(parm);
}
else if (cmd == "needoffsets")
{
plugin_data->needoffset = atoi(parm);
}
#endif
else if (cmd == "shellwindow")
{
plugin_data->shellwindow = atoi(parm);
@@ -306,7 +263,6 @@ bool CPlugins::parseCfg(plugin *plugin_data)
{
reject = atoi(parm);
}
}
inFile.close();
@@ -327,28 +283,6 @@ bool CPlugins::parseCfg(plugin *plugin_data)
return !reject;
}
#if 0
PluginParam * CPlugins::makeParam(const char * const id, const char * const value, PluginParam * const next)
{
PluginParam * startparam = new PluginParam;
startparam->next = next;
startparam->id = id;
startparam->val = strdup(value);
return startparam;
}
PluginParam * CPlugins::makeParam(const char * const id, const int value, PluginParam * const next)
{
char aval[10];
sprintf(aval, "%d", value);
return makeParam(id, aval, next);
}
#endif
void CPlugins::startPlugin_by_name(const std::string & name)
{
for (int i = 0; i < (int) plugin_list.size(); i++)
@@ -368,7 +302,6 @@ void CPlugins::startPlugin(const char * const filename)
startPlugin(pluginnr);
else
printf("[CPlugins] could not find %s\n", filename);
}
void CPlugins::popenScriptPlugin(const char * script)
@@ -557,35 +490,6 @@ CPlugins::p_type_t CPlugins::getPluginType(int type)
}
}
CPlugins::i_type_t CPlugins::getPluginIntegration(int integration)
{
switch (integration)
{
case INTEGRATION_TYPE_DISABLED:
return I_TYPE_DISABLED;
break;
/*
case INTEGRATION_TYPE_MAIN:
return I_TYPE_MAIN;
break;
*/
case INTEGRATION_TYPE_MULTIMEDIA:
return I_TYPE_MULTIMEDIA;
break;
case INTEGRATION_TYPE_SETTING:
return I_TYPE_SETTING;
break;
case INTEGRATION_TYPE_SERVICE:
return I_TYPE_SERVICE;
break;
case INTEGRATION_TYPE_INFORMATION:
return I_TYPE_INFORMATION;
break;
default:
return I_TYPE_DISABLED;
}
}
neutrino_msg_t CPlugins::getPluginKey(std::string key)
{
if (key == "red")

View File

@@ -4,29 +4,20 @@
Copyright (C) 2001 Steffen Hehn 'McClean'
Homepage: http://dbox.cyberphoria.org/
Kommentar:
Diese GUI wurde von Grund auf neu programmiert und sollte nun vom
Aufbau und auch den Ausbaumoeglichkeiten gut aussehen. Neutrino basiert
auf der Client-Server Idee, diese GUI ist also von der direkten DBox-
Steuerung getrennt. Diese wird dann von Daemons uebernommen.
License: GPL
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 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.
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., 675 Mass Ave, Cambridge, MA 02139, USA.
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __plugins__
@@ -42,8 +33,8 @@
class CFrameBuffer;
class CPlugins
{
public:
// neutrino-internal plugin-type conversion
typedef enum p_type
{
P_TYPE_DISABLED = 0x1,
@@ -54,21 +45,7 @@ class CPlugins
}
p_type_t;
typedef enum i_type
{
I_TYPE_DISABLED = 0x1,
/*
I_TYPE_MAIN = 0x2,
*/
I_TYPE_MULTIMEDIA = 0x4,
I_TYPE_SETTING = 0x8,
I_TYPE_SERVICE = 0x10,
I_TYPE_INFORMATION = 0x20
}
i_type_t;
private:
CFrameBuffer *frameBuffer;
struct plugin
@@ -85,16 +62,7 @@ class CPlugins
std::string description; // UTF-8 encoded
std::string depend;
CPlugins::p_type_t type;
CPlugins::i_type_t integration;
#if 0
bool fb;
bool rc;
bool lcd;
bool vtxtpid;
int posx, posy, sizex, sizey;
bool showpig;
bool needoffset;
#endif
int integration;
bool shellwindow;
bool hide;
bool operator< (const plugin& a) const
@@ -114,8 +82,8 @@ class CPlugins
bool plugin_exists(const std::string & filename);
int find_plugin(const std::string & filename);
CPlugins::p_type_t getPluginType(int type);
CPlugins::i_type_t getPluginIntegration(int integration);
neutrino_msg_t getPluginKey(std::string key="auto");
public:
CPlugins();
~CPlugins();
@@ -124,11 +92,6 @@ class CPlugins
void setPluginDir(const std::string & dir) { plugin_dir = dir; }
#if 0
PluginParam * makeParam(const char * const id, const char * const value, PluginParam * const next);
PluginParam * makeParam(const char * const id, const int value, PluginParam * const next);
#endif
inline int getNumberOfPlugins (void ) const { return plugin_list.size() ; }
inline const char * getName (const int number) const { return plugin_list[number].name.c_str() ; }
inline const char * getPluginFile (const int number) const { return plugin_list[number].pluginfile.c_str(); }

View File

@@ -345,7 +345,7 @@ bool CUserMenu::showUserMenu(neutrino_msg_t msg)
if (g_settings.personalize[SNeutrinoSettings::P_UMENU_PLUGIN_TYPE_LUA])
show = show || g_Plugins->getType(count) == CPlugins::P_TYPE_LUA;
if (show && !g_Plugins->isHidden(count) && (g_Plugins->getIntegration(count) == CPlugins::I_TYPE_DISABLED))
if (show && !g_Plugins->isHidden(count) && (g_Plugins->getIntegration(count) == PLUGIN_INTEGRATION_DISABLED))
{
menu_items++;
neutrino_msg_t d_key = g_Plugins->getKey(count);

View File

@@ -1027,7 +1027,7 @@ int CMenuWidget::exec(CMenuTarget* parent, const std::string &)
return retval;
}
void CMenuWidget::integratePlugins(CPlugins::i_type_t integration, const unsigned int shortcut, bool enabled)
void CMenuWidget::integratePlugins(int integration, const unsigned int shortcut, bool enabled)
{
bool separatorline = false;
unsigned int number_of_plugins = (unsigned int) g_Plugins->getNumberOfPlugins();

View File

@@ -613,7 +613,7 @@ class CMenuWidget : public CMenuTarget, public CComponentsSignals
virtual void hide();
virtual int exec(CMenuTarget* parent, const std::string & actionKey);
virtual const char *getName();
virtual void integratePlugins(CPlugins::i_type_t integration, const unsigned int shortcut=CRCInput::RC_nokey, bool enabled=true);
virtual void integratePlugins(int integration, const unsigned int shortcut=CRCInput::RC_nokey, bool enabled=true);
void setSelected(const int &Preselected){ selected = Preselected; };
void initSelectable();
int getSelected()const { return selected; };

View File

@@ -117,16 +117,16 @@ void CNeutrinoApp::InitMenu()
personalize.addPersonalizedItems();
//add I_TYPE_SETTING plugins
//add PLUGIN_INTEGRATION_SETTING plugins
unsigned int nextShortcut;
CMenuWidget &menuSettings = personalize.getWidget(MENU_SETTINGS);
nextShortcut = (unsigned int)menuSettings.getNextShortcut();
menuSettings.integratePlugins(CPlugins::I_TYPE_SETTING, nextShortcut);
menuSettings.integratePlugins(PLUGIN_INTEGRATION_SETTING, nextShortcut);
//add I_TYPE_SERVICE plugins
//add PLUGIN_INTEGRATION_SERVICE plugins
CMenuWidget &menuService = personalize.getWidget(MENU_SERVICE);
nextShortcut = (unsigned int)menuService.getNextShortcut();
menuService.integratePlugins(CPlugins::I_TYPE_SERVICE, nextShortcut);
menuService.integratePlugins(PLUGIN_INTEGRATION_SERVICE, nextShortcut);
}
//init main menu

View File

@@ -1,60 +1,28 @@
#ifndef TPLUGIN_H
#define TPLUGIN_H
#ifndef __plugin_h__
#define __plugin_h__
typedef struct _PluginParam
{
const char * id;
char * val;
struct _PluginParam * next;
} PluginParam;
typedef int (*PluginExec)( PluginParam *par );
/* das dlsym kann auf PluginExec gecastet werden */
/* NOTE : alle Plugins haben uebergangs-weise neue und alte schnittstelle */
/* neues Symbol : plugin_exec */
/* es muessen nur benutzte ids gesetzt werden : nicht genannt = nicht benutzt */
/* fixed ID definitions */
#define P_ID_FBUFFER "fd_framebuffer"
#define P_ID_RCINPUT "fd_rcinput"
#define P_ID_LCD "fd_lcd"
#define P_ID_NOPIG "no_pig" // 1: plugin dont show internal pig
#define P_ID_VTXTPID "pid_vtxt"
#define P_ID_PROXY "proxy" // set proxy for save into highscore
#define P_ID_PROXY_USER "proxy_user" // format "user:pass"
#define P_ID_HSCORE "hscore" // highscore-server (as url)
#define P_ID_VFORMAT "video_format" // videoformat (0 = auto, 1 = 16:9, 2 = 4:3)
#define P_ID_OFF_X "off_x" // screen-top-offset x
#define P_ID_OFF_Y "off_y" // screen-top-offset y
#define P_ID_END_X "end_x" // screen-end-offset x
#define P_ID_END_Y "end_y" // screen-end-offset y
#define P_ID_RCBLK_ANF "rcblk_anf" // Key-Repeatblocker Anfang
#define P_ID_RCBLK_REP "rcblk_rep" // Key-Repeatblocker Wiederholung
typedef enum plugin_type
// plugin type as defined in plugin's cfg
enum
{
PLUGIN_TYPE_DISABLED = 0,
PLUGIN_TYPE_GAME = 1,
PLUGIN_TYPE_TOOL = 2,
PLUGIN_TYPE_SCRIPT = 3,
PLUGIN_TYPE_LUA = 4
}
plugin_type_t;
};
typedef enum integration_type
// plugin integration as defined in plugin's cfg
enum
{
INTEGRATION_TYPE_DISABLED = 0,
PLUGIN_INTEGRATION_DISABLED = 0,
/*
INTEGRATION_TYPE_MAIN = 1,
PLUGIN_INTEGRATION_MAIN = 1,
*/
INTEGRATION_TYPE_MULTIMEDIA = 2,
INTEGRATION_TYPE_SETTING = 3,
INTEGRATION_TYPE_SERVICE = 4,
INTEGRATION_TYPE_INFORMATION = 5
}
integration_type_t;
PLUGIN_INTEGRATION_MULTIMEDIA = 2,
PLUGIN_INTEGRATION_SETTING = 3,
PLUGIN_INTEGRATION_SERVICE = 4,
PLUGIN_INTEGRATION_INFORMATION = 5
};
#endif
#endif // __plugin_h__