add option to adzap: zap on timer activation

This commit is contained in:
Jacek Jendrzej
2019-04-25 18:49:57 +02:00
parent df19fff874
commit 44fb2039e1
8 changed files with 48 additions and 0 deletions

View File

@@ -318,6 +318,14 @@ int CAdZapMenu::exec(CMenuTarget *parent, const std::string & actionKey)
void CAdZapMenu::ShowMenu()
{
#define ADZAP_ZAP_OPTION_COUNT 3
const CMenuOptionChooser::keyval ADZAP_ZAP_OPTIONS[ADZAP_ZAP_OPTION_COUNT] =
{
{ SNeutrinoSettings::ADZAP_ZAP_OFF,LOCALE_ADZAP_ZAP_OFF},
{ SNeutrinoSettings::ADZAP_ZAP_TO_LAST,LOCALE_ADZAP_ZAP_TO_LAST_CHANNEL},
{ SNeutrinoSettings::ADZAP_ZAP_TO_STRAT,LOCALE_ADZAP_ZAP_TO_STRAT_CHANNEL},
};
bool show_monitor = monitorLifeTime.tv_sec;
CMenuWidget *menu = new CMenuWidget(LOCALE_ADZAP, NEUTRINO_ICON_SETTINGS, width);
@@ -330,6 +338,10 @@ void CAdZapMenu::ShowMenu()
oc->setHint(NEUTRINO_ICON_HINT_ADZAP, LOCALE_MENU_HINT_ADZAP_WRITEDATA);
menu->addItem(oc);
CMenuOptionChooser *oc_zap = new CMenuOptionChooser(LOCALE_ADZAP_ZAP, &g_settings.adzap_zapOnActivation, ADZAP_ZAP_OPTIONS, ADZAP_ZAP_OPTION_COUNT, true);
oc_zap->setHint(NEUTRINO_ICON_HINT_ADZAP, LOCALE_MENU_HINT_ADZAP_ZAP);
menu->addItem(oc_zap);
menu->addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_ADZAP_SWITCHBACK));
neutrino_locale_t minute = LOCALE_ADZAP_MINUTE;

View File

@@ -1249,6 +1249,18 @@ int CEpgData::show(const t_channel_id channel_id, uint64_t a_id, time_t* a_start
tmp_msg += " ";
tmp_msg += g_Locale->getText(LOCALE_UNIT_SHORT_MINUTE);
ShowMsg(LOCALE_ADZAP, tmp_msg, CMsgBox::mbrBack, CMsgBox::mbBack, NEUTRINO_ICON_INFO);
if(g_settings.adzap_zapOnActivation == SNeutrinoSettings::ADZAP_ZAP_TO_LAST)
CNeutrinoApp::getInstance()->channelList->numericZap(g_settings.key_lastchannel);
else if(g_settings.adzap_zapOnActivation == SNeutrinoSettings::ADZAP_ZAP_TO_STRAT){
int mode = CNeutrinoApp::getInstance()->getMode();
bool isRadioMode = (mode == NeutrinoModes::mode_radio || mode == NeutrinoModes::mode_webradio);
const t_channel_id cur_channel_id = isRadioMode ? g_settings.startchannelradio_id : g_settings.startchanneltv_id;
if(cur_channel_id != channel_id)
CNeutrinoApp::getInstance()->channelList->zapTo_ChannelID(cur_channel_id, true);
else
CNeutrinoApp::getInstance()->channelList->numericZap(g_settings.key_lastchannel);
}
}
//CTimerdClient timerdclient;
else if (g_Timerd->isTimerdAvailable())