From ca6d1f69ee024c0b1a3bc0cc03d624ae1446d13b Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Tue, 1 Mar 2016 09:53:55 +0100 Subject: [PATCH] - adzap: allow user-definable zap back time > 9 min --- src/gui/adzap.cpp | 21 ++++++++++++++++++++- src/gui/adzap.h | 4 +++- src/gui/epgview.cpp | 6 +++--- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/src/gui/adzap.cpp b/src/gui/adzap.cpp index 9a14efbec..d9b693fc3 100644 --- a/src/gui/adzap.cpp +++ b/src/gui/adzap.cpp @@ -62,7 +62,7 @@ CAdZapMenu *CAdZapMenu::getInstance() CAdZapMenu::CAdZapMenu() { frameBuffer = CFrameBuffer::getInstance(); - width = 40; + width = 35; 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'; for (int shortcut = 1; shortcut < 10; shortcut++) forwarders[shortcut - 1]->setMarked(shortcut == g_settings.adzap_zapBackPeriod); + nc->setMarked(false); g_settings.adzap_zapBackPeriod *= 60; return menu_return::RETURN_REPAINT; } @@ -331,9 +332,27 @@ void CAdZapMenu::ShowMenu() 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->exec(NULL, ""); menu->hide(); delete menu; 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; +} diff --git a/src/gui/adzap.h b/src/gui/adzap.h index 26b2eea62..1317e5019 100644 --- a/src/gui/adzap.h +++ b/src/gui/adzap.h @@ -31,7 +31,7 @@ #include #include -class CAdZapMenu: public CMenuTarget +class CAdZapMenu: public CMenuTarget, CChangeObserver { private: CFrameBuffer * frameBuffer; @@ -43,6 +43,7 @@ class CAdZapMenu: public CMenuTarget struct timespec zapBackTime; std::string channelName; CMenuForwarder *forwarders[9]; + CMenuOptionNumberChooser *nc; CChannelEventList evtlist; struct timespec monitorLifeTime; t_channel_id channelId; @@ -57,6 +58,7 @@ class CAdZapMenu: public CMenuTarget public: static CAdZapMenu *getInstance(); int exec(CMenuTarget * parent, const std::string & actionKey); + bool changeNotify(const neutrino_locale_t, void * data); bool isActive() { return (armed || monitor); }; }; #endif // __adzap__ diff --git a/src/gui/epgview.cpp b/src/gui/epgview.cpp index 1a4715062..dfd7bcd24 100644 --- a/src/gui/epgview.cpp +++ b/src/gui/epgview.cpp @@ -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: if(isCurrentEPG(channel_id)){ int zapBackPeriod = g_settings.adzap_zapBackPeriod / 60; - if (zapBackPeriod < 9) + if (zapBackPeriod < 120) zapBackPeriod++; - if (zapBackPeriod > 9) - zapBackPeriod = 9; + if (zapBackPeriod > 120) + zapBackPeriod = 120; g_settings.adzap_zapBackPeriod = zapBackPeriod * 60; showTimerEventBar(true, true); }