From 0b3a86f7f5f685630308f5eda5ad5ff770b4c051 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Tue, 30 May 2017 10:11:39 +0200 Subject: [PATCH] followscreenings: fix CFollowScreenings::FOLLOWSCREENINGS_ALWAYS * add enumeration for a better readability Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/981c6331a6576ab0e0949540602132df3a8b9cc2 Author: vanhofen Date: 2017-05-30 (Tue, 30 May 2017) Origin message was: ------------------ - followscreenings: fix CFollowScreenings::FOLLOWSCREENINGS_ALWAYS * add enumeration for a better readability --- src/gui/followscreenings.cpp | 12 ++++++------ src/gui/followscreenings.h | 8 ++++++++ src/gui/record_setup.cpp | 7 ++++--- src/neutrino.cpp | 3 ++- 4 files changed, 20 insertions(+), 10 deletions(-) diff --git a/src/gui/followscreenings.cpp b/src/gui/followscreenings.cpp index 99446da95..d5e87231f 100644 --- a/src/gui/followscreenings.cpp +++ b/src/gui/followscreenings.cpp @@ -69,7 +69,7 @@ CChannelEventList *CFollowScreenings::getFollowScreenings(void) continue; followlist.push_back(*e); - if (followlist.size() == 1 && !g_settings.timer_followscreenings) + if (followlist.size() == 1 && g_settings.timer_followscreenings == FOLLOWSCREENINGS_OFF) //NI break; } } @@ -92,7 +92,7 @@ int CFollowScreenings::exec(CMenuTarget* /*parent*/, const std::string & actionK if (i->eventType == CTimerd::TIMER_RECORD) { if (channel_id == i->channel_id && e->startTime == i->epg_starttime) { Timer.removeTimerEvent(i->eventID); - if (!forwarders.empty() && (followlist.size() > 1 || g_settings.timer_followscreenings == 2 /*always*/)) //NI + if (!forwarders.empty() && (followlist.size() > 1 || g_settings.timer_followscreenings == FOLLOWSCREENINGS_ALWAYS)) //NI forwarders[ix]->iconName_Info_right = ""; #if 0 else @@ -115,9 +115,9 @@ int CFollowScreenings::exec(CMenuTarget* /*parent*/, const std::string & actionK e->startTime, e->startTime - (ANNOUNCETIME + 120 ), apids, true, e->startTime - (ANNOUNCETIME + 120) > time(NULL), recDir, true, ch->bUseCI) == -1) { //NI //FIXME -- no error handling, but this shouldn't happen ... } else { - if (!forwarders.empty() && (followlist.size() > 1 || g_settings.timer_followscreenings == 2 /*always*/)) //NI + if (!forwarders.empty() && (followlist.size() > 1 || g_settings.timer_followscreenings == FOLLOWSCREENINGS_ALWAYS)) //NI forwarders[ix]->iconName_Info_right = NEUTRINO_ICON_REC; - else if (g_settings.timer_followscreenings != 2 /*always*/) //NI + else if (g_settings.timer_followscreenings != FOLLOWSCREENINGS_ALWAYS) //NI ShowMsg(LOCALE_TIMER_EVENTRECORD_TITLE, LOCALE_TIMER_EVENTRECORD_MSG, CMsgBox::mbrBack, CMsgBox::mbBack, NEUTRINO_ICON_INFO); return menu_return::RETURN_REPAINT; @@ -158,12 +158,12 @@ void CFollowScreenings::show() getFollowScreenings(); - if (followlist.size() == 1 && g_settings.timer_followscreenings < 2 /*always*/) //NI + if (followlist.size() == 1 && g_settings.timer_followscreenings != FOLLOWSCREENINGS_ALWAYS) //NI { snprintf(actionstr, sizeof(actionstr), "%lu", followlist.front().startTime); exec(NULL, actionstr); } - else if (followlist.size() > 1) + else if (followlist.size() > 1 || g_settings.timer_followscreenings == FOLLOWSCREENINGS_ALWAYS) //NI { CMenuWidget m(LOCALE_EPGVIEWER_SELECT_SCREENING, NEUTRINO_ICON_SETTINGS); const char *icon = NEUTRINO_ICON_BUTTON_RED; diff --git a/src/gui/followscreenings.h b/src/gui/followscreenings.h index 53e362e3e..3c48df8bf 100644 --- a/src/gui/followscreenings.h +++ b/src/gui/followscreenings.h @@ -59,6 +59,14 @@ class CFollowScreenings : public CMenuTarget std::vector forwarders; void updateRightIcon(int i, time_t start, unsigned int duration); public: + //NI + enum + { + FOLLOWSCREENINGS_OFF = 0, + FOLLOWSCREENINGS_ON = 1, + FOLLOWSCREENINGS_ALWAYS = 2 + }; + CFollowScreenings(const t_channel_id Channel_id, time_t Starttime, time_t Stoptime, const std::string &Title, uint64_t EpgID=0, unsigned char Apids=TIMERD_APIDS_STD, bool Safety=false, std::string RecDir="", CChannelEventList *Evtlist=NULL) : CMenuTarget () { this->channel_id = Channel_id; diff --git a/src/gui/record_setup.cpp b/src/gui/record_setup.cpp index 59368fbd1..02e685aaa 100644 --- a/src/gui/record_setup.cpp +++ b/src/gui/record_setup.cpp @@ -41,6 +41,7 @@ #include "record_setup.h" #include +#include //NI #include #include @@ -176,9 +177,9 @@ const CMenuOptionChooser::keyval END_OF_RECORDING[END_OF_RECORDING_COUNT] = //NI const CMenuOptionChooser::keyval timer_followscreenings_options[] = { - {0, LOCALE_OPTIONS_OFF}, - {1, LOCALE_OPTIONS_ON}, - {2, LOCALE_OPTIONS_ALWAYS} + {CFollowScreenings::FOLLOWSCREENINGS_OFF , LOCALE_OPTIONS_OFF }, + {CFollowScreenings::FOLLOWSCREENINGS_ON , LOCALE_OPTIONS_ON }, + {CFollowScreenings::FOLLOWSCREENINGS_ALWAYS , LOCALE_OPTIONS_ALWAYS} }; size_t timer_followscreenings_options_count = sizeof(timer_followscreenings_options)/sizeof(CMenuOptionChooser::keyval); diff --git a/src/neutrino.cpp b/src/neutrino.cpp index fb822252a..641a43c3b 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -77,6 +77,7 @@ #include "gui/eventlist.h" #include "gui/favorites.h" #include "gui/filebrowser.h" +#include "gui/followscreenings.h" //NI #include "gui/hdd_menu.h" #include "gui/infoviewer.h" #include "gui/mediaplayer.h" @@ -543,7 +544,7 @@ int CNeutrinoApp::loadSetup(const char * fname) g_settings.timer_remotebox_ip.push_back(timer_rb); } } - g_settings.timer_followscreenings = configfile.getInt32( "timer_followscreenings", 1 ); + g_settings.timer_followscreenings = configfile.getInt32( "timer_followscreenings", CFollowScreenings::FOLLOWSCREENINGS_ON ); //NI g_settings.infobar_sat_display = configfile.getBool("infobar_sat_display" , true ); g_settings.infobar_show_channeldesc = configfile.getBool("infobar_show_channeldesc" , false );