- adzap: allow user-definable zap back time > 9 min

This commit is contained in:
svenhoefer
2016-03-01 09:53:55 +01:00
parent 2b0996e3d3
commit ca6d1f69ee
3 changed files with 26 additions and 5 deletions

View File

@@ -62,7 +62,7 @@ CAdZapMenu *CAdZapMenu::getInstance()
CAdZapMenu::CAdZapMenu() CAdZapMenu::CAdZapMenu()
{ {
frameBuffer = CFrameBuffer::getInstance(); frameBuffer = CFrameBuffer::getInstance();
width = 40; width = 35;
sem_init(&sem, 0, 0); sem_init(&sem, 0, 0);
@@ -289,6 +289,7 @@ int CAdZapMenu::exec(CMenuTarget *parent, const std::string & actionKey)
g_settings.adzap_zapBackPeriod = actionKey[0] - '0'; g_settings.adzap_zapBackPeriod = actionKey[0] - '0';
for (int shortcut = 1; shortcut < 10; shortcut++) for (int shortcut = 1; shortcut < 10; shortcut++)
forwarders[shortcut - 1]->setMarked(shortcut == g_settings.adzap_zapBackPeriod); forwarders[shortcut - 1]->setMarked(shortcut == g_settings.adzap_zapBackPeriod);
nc->setMarked(false);
g_settings.adzap_zapBackPeriod *= 60; g_settings.adzap_zapBackPeriod *= 60;
return menu_return::RETURN_REPAINT; return menu_return::RETURN_REPAINT;
} }
@@ -331,9 +332,27 @@ void CAdZapMenu::ShowMenu()
minute = LOCALE_ADZAP_MINUTES; minute = LOCALE_ADZAP_MINUTES;
} }
menu->addItem(GenericMenuSeparator);
int zapBackPeriod = g_settings.adzap_zapBackPeriod / 60;
nc = new CMenuOptionNumberChooser(minute, &zapBackPeriod, true, 10, 120, this, CRCInput::RC_0);
nc->setMarked(g_settings.adzap_zapBackPeriod / 60 > 9);
nc->setHint(NEUTRINO_ICON_HINT_ADZAP, "");
menu->addItem(nc);
menu->setFooter(CAdZapMenuFooterButtons, CAdZapMenuFooterButtonCount - (show_monitor ? 0 : 1)); menu->setFooter(CAdZapMenuFooterButtons, CAdZapMenuFooterButtonCount - (show_monitor ? 0 : 1));
menu->exec(NULL, ""); menu->exec(NULL, "");
menu->hide(); menu->hide();
delete menu; delete menu;
Update(); Update();
} }
bool CAdZapMenu::changeNotify(const neutrino_locale_t, void * data)
{
int z = (*(int *)data);
g_settings.adzap_zapBackPeriod = z * 60;
for (int shortcut = 1; shortcut < 10; shortcut++)
forwarders[shortcut - 1]->setMarked(false);
nc->setMarked(true);
return false;
}

View File

@@ -31,7 +31,7 @@
#include <string> #include <string>
#include <semaphore.h> #include <semaphore.h>
class CAdZapMenu: public CMenuTarget class CAdZapMenu: public CMenuTarget, CChangeObserver
{ {
private: private:
CFrameBuffer * frameBuffer; CFrameBuffer * frameBuffer;
@@ -43,6 +43,7 @@ class CAdZapMenu: public CMenuTarget
struct timespec zapBackTime; struct timespec zapBackTime;
std::string channelName; std::string channelName;
CMenuForwarder *forwarders[9]; CMenuForwarder *forwarders[9];
CMenuOptionNumberChooser *nc;
CChannelEventList evtlist; CChannelEventList evtlist;
struct timespec monitorLifeTime; struct timespec monitorLifeTime;
t_channel_id channelId; t_channel_id channelId;
@@ -57,6 +58,7 @@ class CAdZapMenu: public CMenuTarget
public: public:
static CAdZapMenu *getInstance(); static CAdZapMenu *getInstance();
int exec(CMenuTarget * parent, const std::string & actionKey); int exec(CMenuTarget * parent, const std::string & actionKey);
bool changeNotify(const neutrino_locale_t, void * data);
bool isActive() { return (armed || monitor); }; bool isActive() { return (armed || monitor); };
}; };
#endif // __adzap__ #endif // __adzap__

View File

@@ -784,10 +784,10 @@ int CEpgData::show(const t_channel_id channel_id, uint64_t a_id, time_t* a_start
case CRCInput::RC_page_up: case CRCInput::RC_page_up:
if(isCurrentEPG(channel_id)){ if(isCurrentEPG(channel_id)){
int zapBackPeriod = g_settings.adzap_zapBackPeriod / 60; int zapBackPeriod = g_settings.adzap_zapBackPeriod / 60;
if (zapBackPeriod < 9) if (zapBackPeriod < 120)
zapBackPeriod++; zapBackPeriod++;
if (zapBackPeriod > 9) if (zapBackPeriod > 120)
zapBackPeriod = 9; zapBackPeriod = 120;
g_settings.adzap_zapBackPeriod = zapBackPeriod * 60; g_settings.adzap_zapBackPeriod = zapBackPeriod * 60;
showTimerEventBar(true, true); showTimerEventBar(true, true);
} }