mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-26 15:02:56 +02:00
Add a --enable-lua switch to enable LUA support
This commit is contained in:
12
configure.ac
12
configure.ac
@@ -171,12 +171,24 @@ AC_ARG_ENABLE(pip,
|
|||||||
[AC_DEFINE(ENABLE_PIP,1,[enable picture in picture support])])
|
[AC_DEFINE(ENABLE_PIP,1,[enable picture in picture support])])
|
||||||
|
|
||||||
|
|
||||||
|
AC_ARG_ENABLE(testmenu,
|
||||||
|
AS_HELP_STRING(--enable-testmenu,include test menu in neutrino main menu))
|
||||||
|
|
||||||
AM_CONDITIONAL(ENABLE_TEST_MENU,test "$enable_testmenu" = "yes")
|
AM_CONDITIONAL(ENABLE_TEST_MENU,test "$enable_testmenu" = "yes")
|
||||||
if test "$enable_testmenu" = "yes"; then
|
if test "$enable_testmenu" = "yes"; then
|
||||||
AC_DEFINE(ENABLE_TEST_MENU,1,[include test menu in neutrino main menu - not recommended for general users!])
|
AC_DEFINE(ENABLE_TEST_MENU,1,[include test menu in neutrino main menu - not recommended for general users!])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
AC_ARG_ENABLE(lua,
|
||||||
|
AS_HELP_STRING(--enable-lua,enable LUA support))
|
||||||
|
|
||||||
|
AM_CONDITIONAL(ENABLE_LUA,test "$enable_lua" = "yes")
|
||||||
|
if test "$enable_lua" = "yes"; then
|
||||||
|
AC_DEFINE(ENABLE_LUA,1,[include LUA support])
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
if test "$BOXTYPE" = "coolstream"; then
|
if test "$BOXTYPE" = "coolstream"; then
|
||||||
if test -e ${srcdir}/lib/libcoolstream/nevis_ir.h; then
|
if test -e ${srcdir}/lib/libcoolstream/nevis_ir.h; then
|
||||||
AC_DEFINE(HAVE_COOLSTREAM_NEVIS_IR_H,1,[Define to 1 if you have the <nevis_ir.h> header file.])
|
AC_DEFINE(HAVE_COOLSTREAM_NEVIS_IR_H,1,[Define to 1 if you have the <nevis_ir.h> header file.])
|
||||||
|
@@ -122,7 +122,9 @@ neutrino_LDADD += -lgif
|
|||||||
else
|
else
|
||||||
neutrino_LDADD += -lungif
|
neutrino_LDADD += -lungif
|
||||||
endif
|
endif
|
||||||
|
if ENABLE_LUA
|
||||||
neutrino_LDADD += @LUA_LIBS@
|
neutrino_LDADD += @LUA_LIBS@
|
||||||
|
endif
|
||||||
|
|
||||||
if ENABLE_UPNP
|
if ENABLE_UPNP
|
||||||
neutrino_LDADD += \
|
neutrino_LDADD += \
|
||||||
|
@@ -28,9 +28,14 @@ AM_CPPFLAGS += \
|
|||||||
-I$(top_srcdir)/lib/xmltree \
|
-I$(top_srcdir)/lib/xmltree \
|
||||||
-I$(top_srcdir)/lib/libupnpclient \
|
-I$(top_srcdir)/lib/libupnpclient \
|
||||||
@CURL_CFLAGS@ \
|
@CURL_CFLAGS@ \
|
||||||
@LUA_CFLAGS@ \
|
|
||||||
@FREETYPE_CFLAGS@
|
@FREETYPE_CFLAGS@
|
||||||
|
|
||||||
|
if ENABLE_LUA
|
||||||
|
AM_CPPFLAGS += \
|
||||||
|
@LUA_CFLAGS@
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
if BOXTYPE_COOL
|
if BOXTYPE_COOL
|
||||||
if BOXMODEL_APOLLO
|
if BOXMODEL_APOLLO
|
||||||
AM_CPPFLAGS += -I$(top_srcdir)/lib/libcoolstream2
|
AM_CPPFLAGS += -I$(top_srcdir)/lib/libcoolstream2
|
||||||
@@ -115,8 +120,10 @@ libneutrino_gui_a_SOURCES += \
|
|||||||
test_menu.cpp
|
test_menu.cpp
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if ENABLE_LUA
|
||||||
libneutrino_gui_a_SOURCES += \
|
libneutrino_gui_a_SOURCES += \
|
||||||
luainstance.cpp
|
luainstance.cpp
|
||||||
|
endif
|
||||||
|
|
||||||
libneutrino_gui2_a_SOURCES = \
|
libneutrino_gui2_a_SOURCES = \
|
||||||
cam_menu.cpp \
|
cam_menu.cpp \
|
||||||
|
@@ -69,7 +69,9 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <daemonc/remotecontrol.h>
|
#include <daemonc/remotecontrol.h>
|
||||||
|
#if ENABLE_LUA
|
||||||
#include <gui/luainstance.h>
|
#include <gui/luainstance.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
extern CPlugins * g_PluginList; /* neutrino.cpp */
|
extern CPlugins * g_PluginList; /* neutrino.cpp */
|
||||||
extern CRemoteControl * g_RemoteControl; /* neutrino.cpp */
|
extern CRemoteControl * g_RemoteControl; /* neutrino.cpp */
|
||||||
@@ -128,8 +130,10 @@ void CPlugins::scanDir(const char *dir)
|
|||||||
new_plugin.pluginfile = fname;
|
new_plugin.pluginfile = fname;
|
||||||
if (new_plugin.type == CPlugins::P_TYPE_SCRIPT)
|
if (new_plugin.type == CPlugins::P_TYPE_SCRIPT)
|
||||||
new_plugin.pluginfile.append(".sh");
|
new_plugin.pluginfile.append(".sh");
|
||||||
|
#if ENABLE_LUA
|
||||||
else if (new_plugin.type == CPlugins::P_TYPE_LUA)
|
else if (new_plugin.type == CPlugins::P_TYPE_LUA)
|
||||||
new_plugin.pluginfile.append(".lua");
|
new_plugin.pluginfile.append(".lua");
|
||||||
|
#endif
|
||||||
else
|
else
|
||||||
new_plugin.pluginfile.append(".so");
|
new_plugin.pluginfile.append(".so");
|
||||||
// We do not check if new_plugin.pluginfile exists since .cfg in
|
// We do not check if new_plugin.pluginfile exists since .cfg in
|
||||||
@@ -344,6 +348,7 @@ void CPlugins::startScriptPlugin(int number)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if ENABLE_LUA
|
||||||
void CPlugins::startLuaPlugin(int number)
|
void CPlugins::startLuaPlugin(int number)
|
||||||
{
|
{
|
||||||
const char *script = plugin_list[number].pluginfile.c_str();
|
const char *script = plugin_list[number].pluginfile.c_str();
|
||||||
@@ -358,6 +363,7 @@ void CPlugins::startLuaPlugin(int number)
|
|||||||
lua->runScript(script);
|
lua->runScript(script);
|
||||||
delete lua;
|
delete lua;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void CPlugins::startPlugin(int number,int /*param*/)
|
void CPlugins::startPlugin(int number,int /*param*/)
|
||||||
{
|
{
|
||||||
@@ -384,11 +390,13 @@ void CPlugins::startPlugin(int number,int /*param*/)
|
|||||||
startScriptPlugin(number);
|
startScriptPlugin(number);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#if ENABLE_LUA
|
||||||
if (plugin_list[number].type == CPlugins::P_TYPE_LUA)
|
if (plugin_list[number].type == CPlugins::P_TYPE_LUA)
|
||||||
{
|
{
|
||||||
startLuaPlugin(number);
|
startLuaPlugin(number);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if (!file_exists(plugin_list[number].pluginfile.c_str()))
|
if (!file_exists(plugin_list[number].pluginfile.c_str()))
|
||||||
{
|
{
|
||||||
printf("[CPlugins] could not find %s,\nperhaps wrong plugin type in %s\n",
|
printf("[CPlugins] could not find %s,\nperhaps wrong plugin type in %s\n",
|
||||||
@@ -655,8 +663,10 @@ CPlugins::p_type_t CPlugins::getPluginType(int type)
|
|||||||
case PLUGIN_TYPE_SCRIPT:
|
case PLUGIN_TYPE_SCRIPT:
|
||||||
return P_TYPE_SCRIPT;
|
return P_TYPE_SCRIPT;
|
||||||
break;
|
break;
|
||||||
|
#if ENABLE_LUA
|
||||||
case PLUGIN_TYPE_LUA:
|
case PLUGIN_TYPE_LUA:
|
||||||
return P_TYPE_LUA;
|
return P_TYPE_LUA;
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
return P_TYPE_DISABLED;
|
return P_TYPE_DISABLED;
|
||||||
}
|
}
|
||||||
|
@@ -51,8 +51,12 @@ class CPlugins
|
|||||||
P_TYPE_DISABLED = 0x1,
|
P_TYPE_DISABLED = 0x1,
|
||||||
P_TYPE_GAME = 0x2,
|
P_TYPE_GAME = 0x2,
|
||||||
P_TYPE_TOOL = 0x4,
|
P_TYPE_TOOL = 0x4,
|
||||||
P_TYPE_SCRIPT = 0x8,
|
P_TYPE_SCRIPT = 0x8
|
||||||
|
|
||||||
|
#if ENABLE_LUA
|
||||||
|
,
|
||||||
P_TYPE_LUA = 0x10
|
P_TYPE_LUA = 0x10
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
p_type_t;
|
p_type_t;
|
||||||
|
|
||||||
@@ -123,8 +127,9 @@ class CPlugins
|
|||||||
void startPlugin(int number,int param);
|
void startPlugin(int number,int param);
|
||||||
void start_plugin_by_name(const std::string & filename,int param);// start plugins by "name=" in .cfg
|
void start_plugin_by_name(const std::string & filename,int param);// start plugins by "name=" in .cfg
|
||||||
void startScriptPlugin(int number);
|
void startScriptPlugin(int number);
|
||||||
|
#if ENABLE_LUA
|
||||||
void startLuaPlugin(int number);
|
void startLuaPlugin(int number);
|
||||||
|
#endif
|
||||||
void startPlugin(const char * const filename); // start plugins also by name
|
void startPlugin(const char * const filename); // start plugins also by name
|
||||||
bool hasPlugin(CPlugins::p_type_t type);
|
bool hasPlugin(CPlugins::p_type_t type);
|
||||||
|
|
||||||
|
@@ -308,8 +308,11 @@ bool CUserMenu::showUserMenu(int button)
|
|||||||
int cnt = 0;
|
int cnt = 0;
|
||||||
for (unsigned int count = 0; count < (unsigned int) g_PluginList->getNumberOfPlugins(); count++)
|
for (unsigned int count = 0; count < (unsigned int) g_PluginList->getNumberOfPlugins(); count++)
|
||||||
{
|
{
|
||||||
bool show = g_PluginList->getType(count) == CPlugins::P_TYPE_TOOL ||
|
bool show = g_PluginList->getType(count) == CPlugins::P_TYPE_TOOL;
|
||||||
g_PluginList->getType(count) == CPlugins::P_TYPE_LUA;
|
|
||||||
|
#if ENABLE_LUA
|
||||||
|
show = show || g_PluginList->getType(count) == CPlugins::P_TYPE_LUA;
|
||||||
|
#endif
|
||||||
if (show && !g_PluginList->isHidden(count))
|
if (show && !g_PluginList->isHidden(count))
|
||||||
{
|
{
|
||||||
sprintf(id, "%d", count);
|
sprintf(id, "%d", count);
|
||||||
|
@@ -1260,10 +1260,12 @@ int CMenuOptionNumberChooser::exec(CMenuTarget*)
|
|||||||
else
|
else
|
||||||
(*optionValue)++;
|
(*optionValue)++;
|
||||||
}
|
}
|
||||||
|
#if ENABLE_LUA
|
||||||
if(observ && !luaAction.empty()) {
|
if(observ && !luaAction.empty()) {
|
||||||
// optionValue is int*
|
// optionValue is int*
|
||||||
observ->changeNotify(luaState, luaAction, luaId, (void *) to_string(*optionValue).c_str());
|
observ->changeNotify(luaState, luaAction, luaId, (void *) to_string(*optionValue).c_str());
|
||||||
} else
|
} else
|
||||||
|
#endif
|
||||||
if(observ)
|
if(observ)
|
||||||
observ->changeNotify(name, optionValue);
|
observ->changeNotify(name, optionValue);
|
||||||
|
|
||||||
@@ -1484,8 +1486,9 @@ int CMenuOptionChooser::exec(CMenuTarget*)
|
|||||||
{
|
{
|
||||||
bool wantsRepaint = false;
|
bool wantsRepaint = false;
|
||||||
int ret = menu_return::RETURN_NONE;
|
int ret = menu_return::RETURN_NONE;
|
||||||
|
#if ENABLE_LUA
|
||||||
char *optionValname = NULL;
|
char *optionValname = NULL;
|
||||||
|
#endif
|
||||||
if (optionsSort) {
|
if (optionsSort) {
|
||||||
optionsSort = false;
|
optionsSort = false;
|
||||||
clearChooserOptions();
|
clearChooserOptions();
|
||||||
@@ -1538,7 +1541,9 @@ int CMenuOptionChooser::exec(CMenuTarget*)
|
|||||||
if(select >= 0)
|
if(select >= 0)
|
||||||
{
|
{
|
||||||
*optionValue = options[select].key;
|
*optionValue = options[select].key;
|
||||||
|
#if ENABLE_LUA
|
||||||
optionValname = (char *) options[select].valname;
|
optionValname = (char *) options[select].valname;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
delete menu;
|
delete menu;
|
||||||
delete selector;
|
delete selector;
|
||||||
@@ -1547,23 +1552,31 @@ int CMenuOptionChooser::exec(CMenuTarget*)
|
|||||||
if (options[count].key == (*optionValue)) {
|
if (options[count].key == (*optionValue)) {
|
||||||
if(msg == CRCInput::RC_left) {
|
if(msg == CRCInput::RC_left) {
|
||||||
if(count > 0)
|
if(count > 0)
|
||||||
|
#if ENABLE_LUA
|
||||||
optionValname = (char *) options[(count-1) % number_of_options].valname,
|
optionValname = (char *) options[(count-1) % number_of_options].valname,
|
||||||
|
#endif
|
||||||
*optionValue = options[(count-1) % number_of_options].key;
|
*optionValue = options[(count-1) % number_of_options].key;
|
||||||
else
|
else
|
||||||
|
#if ENABLE_LUA
|
||||||
optionValname = (char *) options[number_of_options-1].valname,
|
optionValname = (char *) options[number_of_options-1].valname,
|
||||||
|
#endif
|
||||||
*optionValue = options[number_of_options-1].key;
|
*optionValue = options[number_of_options-1].key;
|
||||||
} else
|
} else
|
||||||
|
#if ENABLE_LUA
|
||||||
optionValname = (char *) options[(count+1) % number_of_options].valname,
|
optionValname = (char *) options[(count+1) % number_of_options].valname,
|
||||||
|
#endif
|
||||||
*optionValue = options[(count+1) % number_of_options].key;
|
*optionValue = options[(count+1) % number_of_options].key;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
paint(true);
|
paint(true);
|
||||||
|
#if ENABLE_LUA
|
||||||
if(observ && !luaAction.empty()) {
|
if(observ && !luaAction.empty()) {
|
||||||
if (optionValname)
|
if (optionValname)
|
||||||
wantsRepaint = observ->changeNotify(luaState, luaAction, luaId, optionValname);
|
wantsRepaint = observ->changeNotify(luaState, luaAction, luaId, optionValname);
|
||||||
} else
|
} else
|
||||||
|
#endif
|
||||||
if(observ)
|
if(observ)
|
||||||
wantsRepaint = observ->changeNotify(name, optionValue);
|
wantsRepaint = observ->changeNotify(name, optionValue);
|
||||||
|
|
||||||
@@ -1724,9 +1737,11 @@ int CMenuOptionStringChooser::exec(CMenuTarget* parent)
|
|||||||
|
|
||||||
paint(true);
|
paint(true);
|
||||||
}
|
}
|
||||||
|
#if ENABLE_LUA
|
||||||
if(observ && !luaAction.empty())
|
if(observ && !luaAction.empty())
|
||||||
wantsRepaint = observ->changeNotify(luaState, luaAction, luaId, (void *)(optionValueString ? optionValueString->c_str() : ""));
|
wantsRepaint = observ->changeNotify(luaState, luaAction, luaId, (void *)(optionValueString ? optionValueString->c_str() : ""));
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
if(observ) {
|
if(observ) {
|
||||||
wantsRepaint = observ->changeNotify(name, (void *)(optionValueString ? optionValueString->c_str() : ""));
|
wantsRepaint = observ->changeNotify(name, (void *)(optionValueString ? optionValueString->c_str() : ""));
|
||||||
}
|
}
|
||||||
|
@@ -45,11 +45,13 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#if ENABLE_LUA
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <lua.h>
|
#include <lua.h>
|
||||||
#include <lauxlib.h>
|
#include <lauxlib.h>
|
||||||
#include <lualib.h>
|
#include <lualib.h>
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#define NO_WIDGET_ID -1
|
#define NO_WIDGET_ID -1
|
||||||
|
|
||||||
@@ -75,10 +77,12 @@ class CChangeObserver
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
#if ENABLE_LUA
|
||||||
virtual bool changeNotify(lua_State * /*L*/, const std::string & /*luaId*/, const std::string & /*luaAction*/, void * /*Data*/)
|
virtual bool changeNotify(lua_State * /*L*/, const std::string & /*luaId*/, const std::string & /*luaAction*/, void * /*Data*/)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
class CMenuTarget
|
class CMenuTarget
|
||||||
@@ -103,9 +107,11 @@ class CMenuItem
|
|||||||
fb_pixel_t item_color, item_bgcolor;
|
fb_pixel_t item_color, item_bgcolor;
|
||||||
|
|
||||||
void initItemColors(const bool select_mode);
|
void initItemColors(const bool select_mode);
|
||||||
|
#if ENABLE_LUA
|
||||||
lua_State *luaState;
|
lua_State *luaState;
|
||||||
std::string luaAction;
|
std::string luaAction;
|
||||||
std::string luaId;
|
std::string luaId;
|
||||||
|
#endif
|
||||||
neutrino_locale_t name;
|
neutrino_locale_t name;
|
||||||
std::string nameString;
|
std::string nameString;
|
||||||
|
|
||||||
@@ -170,8 +176,9 @@ class CMenuItem
|
|||||||
void setHint(const std::string icon, const neutrino_locale_t text) { hintIcon = icon; hint = text; }
|
void setHint(const std::string icon, const neutrino_locale_t text) { hintIcon = icon; hint = text; }
|
||||||
void setHint(const std::string icon, const std::string text) { hintIcon = icon; hintText = text; }
|
void setHint(const std::string icon, const std::string text) { hintIcon = icon; hintText = text; }
|
||||||
|
|
||||||
|
#if ENABLE_LUA
|
||||||
void setLua(lua_State *_luaState, std::string &_luaAction, std::string &_luaId) { luaState = _luaState; luaAction = _luaAction; luaId = _luaId; };
|
void setLua(lua_State *_luaState, std::string &_luaAction, std::string &_luaId) { luaState = _luaState; luaAction = _luaAction; luaId = _luaId; };
|
||||||
|
#endif
|
||||||
virtual const char *getName();
|
virtual const char *getName();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user