mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-30 00:41:09 +02:00
adzap: move non-menu code to Init() function
Origin commit data
------------------
Commit: a5bc5093e7
Author: vanhofen <vanhofen@gmx.de>
Date: 2016-02-28 (Sun, 28 Feb 2016)
Origin message was:
------------------
- adzap: move non-menu code to Init() function
This commit is contained in:
@@ -79,6 +79,32 @@ static bool sortByDateTime(const CChannelEvent & a, const CChannelEvent & b)
|
|||||||
return a.startTime < b.startTime;
|
return a.startTime < b.startTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CAdZapMenu::Init()
|
||||||
|
{
|
||||||
|
CChannelList *channelList = CNeutrinoApp::getInstance()->channelList;
|
||||||
|
channelId = channelList ? channelList->getActiveChannel_ChannelID() : -1;
|
||||||
|
channelName = channelList->getActiveChannelName();
|
||||||
|
CChannelEventList evtlist;
|
||||||
|
CEitManager::getInstance()->getEventsServiceKey(channelId & 0xFFFFFFFFFFFFULL, evtlist);
|
||||||
|
monitorLifeTime.tv_sec = 0;
|
||||||
|
if (!evtlist.empty())
|
||||||
|
{
|
||||||
|
sort(evtlist.begin(), evtlist.end(), sortByDateTime);
|
||||||
|
CChannelEventList::iterator eli;
|
||||||
|
struct timespec ts;
|
||||||
|
clock_gettime(CLOCK_REALTIME, &ts);
|
||||||
|
for (eli = evtlist.begin(); eli != evtlist.end(); ++eli)
|
||||||
|
{
|
||||||
|
if ((u_int) eli->startTime + (u_int) eli->duration > (u_int) ts.tv_sec)
|
||||||
|
{
|
||||||
|
monitorLifeTime.tv_sec = (uint) eli->startTime + eli->duration;
|
||||||
|
Update();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CAdZapMenu::Update()
|
void CAdZapMenu::Update()
|
||||||
{
|
{
|
||||||
clock_gettime(CLOCK_REALTIME, &zapBackTime);
|
clock_gettime(CLOCK_REALTIME, &zapBackTime);
|
||||||
@@ -174,6 +200,8 @@ void CAdZapMenu::Run()
|
|||||||
|
|
||||||
int CAdZapMenu::exec(CMenuTarget *parent, const std::string & actionKey)
|
int CAdZapMenu::exec(CMenuTarget *parent, const std::string & actionKey)
|
||||||
{
|
{
|
||||||
|
Init();
|
||||||
|
|
||||||
int res = menu_return::RETURN_EXIT_ALL;
|
int res = menu_return::RETURN_EXIT_ALL;
|
||||||
|
|
||||||
if (actionKey == "enable")
|
if (actionKey == "enable")
|
||||||
@@ -223,6 +251,7 @@ int CAdZapMenu::exec(CMenuTarget *parent, const std::string & actionKey)
|
|||||||
if (parent)
|
if (parent)
|
||||||
parent->hide();
|
parent->hide();
|
||||||
|
|
||||||
|
monitor = false;
|
||||||
Settings();
|
Settings();
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
@@ -230,31 +259,7 @@ int CAdZapMenu::exec(CMenuTarget *parent, const std::string & actionKey)
|
|||||||
|
|
||||||
void CAdZapMenu::Settings()
|
void CAdZapMenu::Settings()
|
||||||
{
|
{
|
||||||
CChannelList *channelList = CNeutrinoApp::getInstance()->channelList;
|
bool show_monitor = monitorLifeTime.tv_sec;
|
||||||
channelId = channelList ? channelList->getActiveChannel_ChannelID() : -1;
|
|
||||||
channelName = channelList->getActiveChannelName();
|
|
||||||
CChannelEventList evtlist;
|
|
||||||
CEitManager::getInstance()->getEventsServiceKey(channelId & 0xFFFFFFFFFFFFULL, evtlist);
|
|
||||||
monitorLifeTime.tv_sec = 0;
|
|
||||||
bool show_monitor = false;
|
|
||||||
if (!evtlist.empty())
|
|
||||||
{
|
|
||||||
sort(evtlist.begin(), evtlist.end(), sortByDateTime);
|
|
||||||
CChannelEventList::iterator eli;
|
|
||||||
struct timespec ts;
|
|
||||||
clock_gettime(CLOCK_REALTIME, &ts);
|
|
||||||
for (eli = evtlist.begin(); eli != evtlist.end(); ++eli)
|
|
||||||
{
|
|
||||||
if ((u_int) eli->startTime + (u_int) eli->duration > (u_int) ts.tv_sec)
|
|
||||||
{
|
|
||||||
monitorLifeTime.tv_sec = (uint) eli->startTime + eli->duration;
|
|
||||||
show_monitor = true;
|
|
||||||
Update();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
monitor = false;
|
|
||||||
|
|
||||||
CMenuWidget *menu = new CMenuWidget(LOCALE_ADZAP, "settings", width);
|
CMenuWidget *menu = new CMenuWidget(LOCALE_ADZAP, "settings", width);
|
||||||
menu->addKey(CRCInput::RC_red, this, "disable");
|
menu->addKey(CRCInput::RC_red, this, "disable");
|
||||||
|
@@ -47,6 +47,7 @@ class CAdZapMenu: public CMenuTarget
|
|||||||
t_channel_id channelId;
|
t_channel_id channelId;
|
||||||
sem_t sem;
|
sem_t sem;
|
||||||
CAdZapMenu();
|
CAdZapMenu();
|
||||||
|
void Init();
|
||||||
void Settings();
|
void Settings();
|
||||||
void Update();
|
void Update();
|
||||||
void Run(void);
|
void Run(void);
|
||||||
|
Reference in New Issue
Block a user