- adzap: use footer buttons to enable/disable adzap

This commit is contained in:
svenhoefer
2016-02-28 21:24:26 +01:00
parent 193ef7b14d
commit 2fd298fa22
3 changed files with 33 additions and 29 deletions

View File

@@ -110,11 +110,11 @@ GENRE.UNKNOWN Unbekannt
adzap Werbezapper adzap Werbezapper
adzap.announce In %d Sekunden wird umgeschaltet auf\n%s adzap.announce In %d Sekunden wird umgeschaltet auf\n%s
adzap.cancel Deaktiviert adzap.cancel Deaktiviert
adzap.disable Deaktivieren adzap.disable Aus
adzap.enable Einmalig aktivieren adzap.enable Ein (einmalig)
adzap.minute Minute adzap.minute Minute
adzap.minutes Minuten adzap.minutes Minuten
adzap.monitor Daueraktiv bei aktueller Sendung adzap.monitor Ein (dauerhaft)
adzap.switchback Zurückschalten nach adzap.switchback Zurückschalten nach
apidselector.head Sprachauswahl apidselector.head Sprachauswahl
audio.srs_algo Art audio.srs_algo Art

View File

@@ -110,11 +110,11 @@ GENRE.UNKNOWN unknown
adzap AdZap adzap AdZap
adzap.announce In %d seconds, the channel will be switched to\n%s adzap.announce In %d seconds, the channel will be switched to\n%s
adzap.cancel Timer was cancelled adzap.cancel Timer was cancelled
adzap.disable Deactivate adzap.disable Off
adzap.enable Activate once adzap.enable On (once)
adzap.minute minute adzap.minute minute
adzap.minutes minutes adzap.minutes minutes
adzap.monitor Stay active during current broadcast adzap.monitor On (durable)
adzap.switchback Switch back after adzap.switchback Switch back after
apidselector.head Select language apidselector.head Select language
audio.srs_algo Type audio.srs_algo Type

View File

@@ -40,6 +40,13 @@
#define ZAPBACK_ALERT_PERIOD 15 // seconds #define ZAPBACK_ALERT_PERIOD 15 // seconds
static const struct button_label CAdZapMenuFooterButtons[] = {
{ NEUTRINO_ICON_BUTTON_RED, LOCALE_ADZAP_DISABLE },
{ NEUTRINO_ICON_BUTTON_GREEN, LOCALE_ADZAP_ENABLE },
{ NEUTRINO_ICON_BUTTON_BLUE, LOCALE_ADZAP_MONITOR }
};
#define CAdZapMenuFooterButtonCount (sizeof(CAdZapMenuFooterButtons)/sizeof(button_label))
static CAdZapMenu *azm = NULL; static CAdZapMenu *azm = NULL;
CAdZapMenu *CAdZapMenu::getInstance() CAdZapMenu *CAdZapMenu::getInstance()
@@ -232,26 +239,6 @@ void CAdZapMenu::Settings()
CChannelList *channelList = CNeutrinoApp::getInstance()->channelList; CChannelList *channelList = CNeutrinoApp::getInstance()->channelList;
channelId = channelList ? channelList->getActiveChannel_ChannelID() : -1; channelId = channelList ? channelList->getActiveChannel_ChannelID() : -1;
channelName = channelList->getActiveChannelName(); channelName = channelList->getActiveChannelName();
CMenuWidget *menu = new CMenuWidget(LOCALE_ADZAP, "settings", width);
menu->addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_ADZAP_SWITCHBACK));
neutrino_locale_t minute = LOCALE_ADZAP_MINUTE;
for (int shortcut = 1; shortcut < 10; shortcut++) {
char actionKey[2];
actionKey[0] = '0' + shortcut;
actionKey[1] = 0;
bool selected = g_settings.adzap_zapBackPeriod == 60 * shortcut;
forwarders[shortcut - 1] = new CMenuForwarder(minute, true, NULL, this, actionKey, CRCInput::convertDigitToKey(shortcut));
forwarders[shortcut - 1]->setMarked(selected);
menu->addItem(forwarders[shortcut - 1], selected);
minute = LOCALE_ADZAP_MINUTES;
}
menu->addItem(GenericMenuSeparatorLine);
menu->addItem(new CMenuForwarder(LOCALE_ADZAP_DISABLE, true, NULL, this, "disable", CRCInput::RC_red));
menu->addItem(new CMenuForwarder(LOCALE_ADZAP_ENABLE, true, NULL, this, "enable", CRCInput::RC_green));
CChannelEventList evtlist; CChannelEventList evtlist;
CEitManager::getInstance()->getEventsServiceKey(channelId & 0xFFFFFFFFFFFFULL, evtlist); CEitManager::getInstance()->getEventsServiceKey(channelId & 0xFFFFFFFFFFFFULL, evtlist);
monitorLifeTime.tv_sec = 0; monitorLifeTime.tv_sec = 0;
@@ -271,10 +258,27 @@ void CAdZapMenu::Settings()
} }
} }
} }
menu->addItem(new CMenuForwarder(LOCALE_ADZAP_MONITOR, monitorLifeTime.tv_sec, NULL, this, "monitor", CRCInput::RC_blue));
monitor = false; monitor = false;
CMenuWidget *menu = new CMenuWidget(LOCALE_ADZAP, "settings", width);
menu->addKey(CRCInput::RC_red, this, "disable");
menu->addKey(CRCInput::RC_green, this, "enable");
menu->addKey(CRCInput::RC_blue, this, "monitor");
menu->addIntroItems(NONEXISTANT_LOCALE, LOCALE_ADZAP_SWITCHBACK);
neutrino_locale_t minute = LOCALE_ADZAP_MINUTE;
for (int shortcut = 1; shortcut < 10; shortcut++) {
char actionKey[2];
actionKey[0] = '0' + shortcut;
actionKey[1] = 0;
bool selected = g_settings.adzap_zapBackPeriod == 60 * shortcut;
forwarders[shortcut - 1] = new CMenuForwarder(minute, true, NULL, this, actionKey, CRCInput::convertDigitToKey(shortcut));
forwarders[shortcut - 1]->setMarked(selected);
menu->addItem(forwarders[shortcut - 1], selected);
minute = LOCALE_ADZAP_MINUTES;
}
menu->setFooter(CAdZapMenuFooterButtons, CAdZapMenuFooterButtonCount);
menu->exec(NULL, ""); menu->exec(NULL, "");
menu->hide(); menu->hide();
delete menu; delete menu;