diff --git a/src/gui/lua/lua_video.cpp b/src/gui/lua/lua_video.cpp index 285d1d68e..b1736833d 100644 --- a/src/gui/lua/lua_video.cpp +++ b/src/gui/lua/lua_video.cpp @@ -113,3 +113,11 @@ int CLuaInstance::zapitStopPlayBack(lua_State *L) g_Zapit->startPlayBack(); return 0; } + +int CLuaInstance::channelRezap(lua_State */*L*/) +{ + CNeutrinoApp::getInstance()->channelRezap(); + if (CNeutrinoApp::getInstance()->getMode() == CNeutrinoApp::mode_radio) + CFrameBuffer::getInstance()->showFrame("radiomode.jpg"); + return 0; +} diff --git a/src/gui/lua/lua_video.inc b/src/gui/lua/lua_video.inc index f4b89f698..5f70d2171 100644 --- a/src/gui/lua/lua_video.inc +++ b/src/gui/lua/lua_video.inc @@ -4,3 +4,4 @@ static int ShowPicture(lua_State *L); static int StopPicture(lua_State *L); static int PlayFile(lua_State *L); static int zapitStopPlayBack(lua_State *L); +static int channelRezap(lua_State *L); diff --git a/src/gui/lua/luainstance.cpp b/src/gui/lua/luainstance.cpp index 552168028..f223e1f98 100644 --- a/src/gui/lua/luainstance.cpp +++ b/src/gui/lua/luainstance.cpp @@ -589,6 +589,7 @@ const luaL_Reg CLuaInstance::methods[] = { "StopPicture", CLuaInstance::StopPicture }, { "PlayFile", CLuaInstance::PlayFile }, { "zapitStopPlayBack", CLuaInstance::zapitStopPlayBack }, + { "channelRezap", CLuaInstance::channelRezap }, { NULL, NULL } }; diff --git a/src/gui/lua/luainstance.h b/src/gui/lua/luainstance.h index 766341922..dfb2dc8ef 100644 --- a/src/gui/lua/luainstance.h +++ b/src/gui/lua/luainstance.h @@ -34,7 +34,7 @@ extern "C" { #include #define LUA_API_VERSION_MAJOR 1 -#define LUA_API_VERSION_MINOR 19 +#define LUA_API_VERSION_MINOR 21 typedef std::pair fontmap_pair_t; typedef std::map fontmap_t; diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 869cab516..32e043dfb 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -3547,13 +3547,8 @@ void CNeutrinoApp::tvMode( bool rezap ) g_RemoteControl->tvMode(); SetChannelMode(g_settings.channel_mode); - if( rezap ) { - t_channel_id last_chid = CZapit::getInstance()->GetLastTVChannel(); - if(CServiceManager::getInstance()->FindChannel(last_chid)) - channelList->zapTo_ChannelID(last_chid, true); /* force re-zap */ - else - channelList->zapTo(0, true); - } + if( rezap ) + channelRezap(); #ifdef USEACTIONLOG g_ActionLog->println("mode: tv"); #endif @@ -3778,16 +3773,27 @@ void CNeutrinoApp::radioMode( bool rezap) if (g_settings.radiotext_enable && !g_Radiotext) g_Radiotext = new CRadioText; - if( rezap ) { - t_channel_id last_chid = CZapit::getInstance()->GetLastRADIOChannel(); - if(CServiceManager::getInstance()->FindChannel(last_chid)) - channelList->zapTo_ChannelID(last_chid, true); /* force re-zap */ - else - channelList->zapTo(0, true); /* force re-zap */ - } + if( rezap ) + channelRezap(); frameBuffer->showFrame("radiomode.jpg"); } +void CNeutrinoApp::channelRezap() +{ + t_channel_id last_chid = 0; + if (mode == mode_tv) + last_chid = CZapit::getInstance()->GetLastTVChannel(); + else if (mode == mode_radio) + last_chid = CZapit::getInstance()->GetLastRADIOChannel(); + else + return; + + if(CServiceManager::getInstance()->FindChannel(last_chid)) + channelList->zapTo_ChannelID(last_chid, true); + else + channelList->zapTo(0, true); +} + //switching from current mode to tv or radio mode or to optional parameter prev_mode void CNeutrinoApp::switchTvRadioMode(const int prev_mode) { diff --git a/src/neutrino.h b/src/neutrino.h index 45d2e3ad3..192b794be 100644 --- a/src/neutrino.h +++ b/src/neutrino.h @@ -234,6 +234,7 @@ public: void screensaver(bool); //signal/event handler before restart of neutrino gui sigc::signal OnBeforeRestart; + void channelRezap(); }; #endif