adzap: add "zap on timer activation" to adzap menu too

Origin commit data
------------------
Branch: ni/coolstream
Commit: 35904d55c2
Author: Jacek Jendrzej <overx300@gmail.com>
Date: 2019-04-28 (Sun, 28 Apr 2019)

Origin message was:
------------------
- adzap: add "zap on timer activation" to adzap menu too

------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
Jacek Jendrzej
2019-04-28 18:34:24 +02:00
committed by vanhofen
parent e208d75458
commit fa1cc55abd
3 changed files with 26 additions and 15 deletions

View File

@@ -261,6 +261,9 @@ int CAdZapMenu::exec(CMenuTarget *parent, const std::string & actionKey)
armed = true; armed = true;
alerted = false; alerted = false;
Update(); Update();
if (CNeutrinoApp::getInstance()->channelList && g_settings.adzap_zapOnActivation != SNeutrinoSettings::ADZAP_ZAP_OFF)
Zap_On_Activation(CNeutrinoApp::getInstance()->channelList->getActiveChannel_ChannelID());
return res; return res;
} }
if (actionKey == "disable") if (actionKey == "disable")
@@ -382,3 +385,21 @@ bool CAdZapMenu::changeNotify(const neutrino_locale_t, void * data)
nc->setMarked(true); nc->setMarked(true);
return false; return false;
} }
void CAdZapMenu::Zap_On_Activation(t_channel_id channel_id)
{
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_START)
{
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);
}
}

View File

@@ -62,5 +62,6 @@ class CAdZapMenu: public CMenuTarget, CChangeObserver
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 changeNotify(const neutrino_locale_t, void * data);
bool isActive() { return (armed || monitor); }; bool isActive() { return (armed || monitor); };
void Zap_On_Activation(t_channel_id channel_id);
}; };
#endif // __adzap__ #endif // __adzap__

View File

@@ -1276,22 +1276,11 @@ int CEpgData::show(const t_channel_id channel_id, uint64_t a_id, time_t* a_start
tmp_msg += to_string(g_settings.adzap_zapBackPeriod / 60); tmp_msg += to_string(g_settings.adzap_zapBackPeriod / 60);
tmp_msg += " "; tmp_msg += " ";
tmp_msg += g_Locale->getText(LOCALE_UNIT_SHORT_MINUTE); 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) if (g_settings.adzap_zapOnActivation != SNeutrinoSettings::ADZAP_ZAP_OFF)
{ CAdZapMenu::getInstance()->Zap_On_Activation(channel_id);
CNeutrinoApp::getInstance()->channelList->numericZap(g_settings.key_lastchannel);
} ShowMsg(LOCALE_ADZAP, tmp_msg, CMsgBox::mbrBack, CMsgBox::mbBack, NEUTRINO_ICON_INFO);
else if (g_settings.adzap_zapOnActivation == SNeutrinoSettings::ADZAP_ZAP_TO_START)
{
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; //CTimerdClient timerdclient;
else if (g_Timerd->isTimerdAvailable()) else if (g_Timerd->isTimerdAvailable())