Skip to content
Permalink
Browse files

Stop passing around ChannelChangeDirection enum values as ints which …

…defeats the point of using enums in the first place.
  • Loading branch information
stuartm committed Jun 4, 2013
1 parent fb48465 commit dcc69811bfc5fc561d34313c6ba97ee3cbdd9bdf
@@ -15,7 +15,6 @@ using namespace std;
#include "channelutil.h"
#include "mythdb.h"
#include "dvbtables.h"
#include "tv.h" // for CHANNEL_DIRECTION

#define LOC QString("ChanUtil: ")

@@ -2359,7 +2358,7 @@ uint ChannelUtil::GetNextChannel(
const ChannelInfoList &sorted,
uint old_chanid,
uint mplexid_restriction,
int direction,
ChannelChangeDirection direction,
bool skip_non_visible,
bool skip_same_channum_and_callsign)
{
@@ -18,6 +18,7 @@ using namespace std;
#include "dtvmultiplex.h"
#include "channelinfo.h"
#include "iptvtuningdata.h"
#include "tv.h" // for CHANNEL_DIRECTION

class NetworkInformationTable;

@@ -214,7 +215,7 @@ class MTV_PUBLIC ChannelUtil
static uint GetNextChannel(const ChannelInfoList &sorted,
uint old_chanid,
uint mplexid_restriction,
int direction,
ChannelChangeDirection direction,
bool skip_non_visible = true,
bool skip_same_channum_and_callsign = false);

@@ -236,7 +236,7 @@ bool ChannelBase::IsTunable(const QString &input, const QString &channum) const
return true;
}

uint ChannelBase::GetNextChannel(uint chanid, int direction) const
uint ChannelBase::GetNextChannel(uint chanid, ChannelChangeDirection direction) const
{
if (!chanid)
{
@@ -254,7 +254,7 @@ uint ChannelBase::GetNextChannel(uint chanid, int direction) const
m_allchannels, chanid, mplexid_restriction, direction);
}

uint ChannelBase::GetNextChannel(const QString &channum, int direction) const
uint ChannelBase::GetNextChannel(const QString &channum, ChannelChangeDirection direction) const
{
InputMap::const_iterator it = m_inputs.find(m_currentInputID);
if (it == m_inputs.end())
@@ -59,8 +59,8 @@ class ChannelBase
virtual bool IsExternalChannelChangeSupported(void) { return false; }

// Gets
virtual uint GetNextChannel(uint chanid, int direction) const;
virtual uint GetNextChannel(const QString &channum, int direction) const;
virtual uint GetNextChannel(uint chanid, ChannelChangeDirection direction) const;
virtual uint GetNextChannel(const QString &channum, ChannelChangeDirection direction) const;
virtual int GetInputByName(const QString &input) const;
virtual QString GetInputByNum(int capchannel) const;
virtual QString GetCurrentName(void) const
@@ -7435,7 +7435,7 @@ bool TV::CommitQueuedInput(PlayerContext *ctx)
return commited;
}

void TV::ChangeChannel(PlayerContext *ctx, int direction)
void TV::ChangeChannel(PlayerContext *ctx, ChannelChangeDirection direction)
{
if (db_use_channel_groups || (direction == CHANNEL_DIRECTION_FAVORITE))
{
@@ -511,7 +511,7 @@ class MTV_PUBLIC TV : public QObject, public MenuItemDisplayer
// Channels
void ToggleChannelFavorite(PlayerContext *ctx);
void ToggleChannelFavorite(PlayerContext*, QString);
void ChangeChannel(PlayerContext*, int direction);
void ChangeChannel(PlayerContext*, ChannelChangeDirection direction);
void ChangeChannel(PlayerContext*, uint chanid, const QString &channum);

void ShowPreviousChannel(PlayerContext*);
@@ -3431,8 +3431,9 @@ QString TVRec::TuningGetChanNum(const TuningRequest &request,

if (channel && !channum.isEmpty() && (channum.indexOf("NextChannel") >= 0))
{
// FIXME This is just horrible
int dir = channum.right(channum.length() - 12).toInt();
uint chanid = channel->GetNextChannel(0, dir);
uint chanid = channel->GetNextChannel(0, static_cast<ChannelChangeDirection>(dir));
channum = ChannelUtil::GetChanNum(chanid);
}

@@ -359,7 +359,8 @@ void TVBrowseHelper::GetNextProgramDB(
{
chanid = ChannelUtil::GetNextChannel(
db_all_visible_channels, chanid, 0 /*mplexid_restriction*/,
chandir, true /*skip non visible*/, true /*skip same callsign*/);
static_cast<ChannelChangeDirection>(chandir),
true /*skip non visible*/, true /*skip same callsign*/);
}

infoMap["chanid"] = QString::number(chanid);
@@ -487,7 +488,7 @@ void TVBrowseHelper::run()
m_tv->channelGroupLock.lock();
if (m_tv->channelGroupId > -1)
{
int dir = CHANNEL_DIRECTION_SAME;
ChannelChangeDirection dir = CHANNEL_DIRECTION_SAME;
if ((direction == BROWSE_UP) || (direction == BROWSE_FAVORITE))
dir = CHANNEL_DIRECTION_UP;
else if (direction == BROWSE_DOWN)

0 comments on commit dcc6981

Please sign in to comment.
You can’t perform that action at this time.