followscreenings: fix CFollowScreenings::FOLLOWSCREENINGS_ALWAYS

* add enumeration for a better readability


Origin commit data
------------------
Commit: 981c6331a6
Author: vanhofen <vanhofen@gmx.de>
Date: 2017-05-30 (Tue, 30 May 2017)

Origin message was:
------------------
- followscreenings: fix CFollowScreenings::FOLLOWSCREENINGS_ALWAYS

* add enumeration for a better readability
This commit is contained in:
vanhofen
2017-05-30 10:11:39 +02:00
parent f1f0683e20
commit 0b3a86f7f5
4 changed files with 20 additions and 10 deletions

View File

@@ -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;

View File

@@ -59,6 +59,14 @@ class CFollowScreenings : public CMenuTarget
std::vector<CMenuForwarder *> 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;

View File

@@ -41,6 +41,7 @@
#include "record_setup.h"
#include <gui/filebrowser.h>
#include <gui/followscreenings.h> //NI
#include <gui/widget/icons.h>
#include <gui/widget/msgbox.h>
@@ -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);

View File

@@ -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 );