Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Complete TODO: Refactor DBChannel and ChannelInfo into a single class

  • Loading branch information...
commit c37f105c6a2f106bfbc06ba35b778a2378b37e5a 1 parent 2ee3b82
@pinkylinc authored
Showing with 182 additions and 227 deletions.
  1. +8 −8 mythtv/libs/libmythtv/channelbase.cpp
  2. +3 −3 mythtv/libs/libmythtv/channelbase.h
  3. +2 −2 mythtv/libs/libmythtv/channelgroupsettings.cpp
  4. +41 −11 mythtv/libs/libmythtv/channelutil.cpp
  5. +6 −5 mythtv/libs/libmythtv/channelutil.h
  6. +21 −51 mythtv/libs/libmythtv/dbchannelinfo.cpp
  7. +16 −29 mythtv/libs/libmythtv/dbchannelinfo.h
  8. +2 −34 mythtv/libs/libmythtv/dtvchannel.cpp
  9. +10 −10 mythtv/libs/libmythtv/inputinfo.h
  10. +4 −4 mythtv/libs/libmythtv/tv_play.cpp
  11. +2 −2 mythtv/libs/libmythtv/tv_play.h
  12. +4 −4 mythtv/libs/libmythtv/tvbrowsehelper.cpp
  13. +3 −3 mythtv/libs/libmythtv/tvbrowsehelper.h
  14. +1 −2  mythtv/libs/libmythtv/videosource.cpp
  15. +1 −1  mythtv/programs/mythfilldatabase/channeldata.cpp
  16. +19 −19 mythtv/programs/mythfrontend/channelrecpriority.cpp
  17. +4 −4 mythtv/programs/mythfrontend/channelrecpriority.h
  18. +23 −23 mythtv/programs/mythfrontend/guidegrid.cpp
  19. +6 −6 mythtv/programs/mythfrontend/guidegrid.h
  20. +2 −2 mythtv/programs/mythfrontend/manualschedule.cpp
  21. +2 −2 mythtv/programs/mythfrontend/proglist.cpp
  22. +2 −2 mythtv/programs/mythfrontend/proglist_helpers.cpp
View
16 mythtv/libs/libmythtv/channelbase.cpp
@@ -99,9 +99,9 @@ bool ChannelBase::Init(QString &inputname, QString &startchannel, bool setchan)
QStringList::const_iterator it = start;
while (it != inputs.end())
{
- DBChanList channels = GetChannels(*it);
+ DBChanInfoList channels = GetChannels(*it);
- DBChanList::const_iterator cit = channels.begin();
+ DBChanInfoList::const_iterator cit = channels.begin();
for (; cit != channels.end(); ++cit)
{
if ((*cit).channum == startchannel &&
@@ -126,7 +126,7 @@ bool ChannelBase::Init(QString &inputname, QString &startchannel, bool setchan)
{
uint mplexid_restriction = 0;
- DBChanList channels = GetChannels(*it);
+ DBChanInfoList channels = GetChannels(*it);
if (channels.size() &&
IsInputAvailable(GetInputByName(*it), mplexid_restriction))
{
@@ -134,7 +134,7 @@ bool ChannelBase::Init(QString &inputname, QString &startchannel, bool setchan)
channels, channels[0].chanid,
mplexid_restriction, CHANNEL_DIRECTION_UP);
- DBChanList::const_iterator cit =
+ DBChanInfoList::const_iterator cit =
find(channels.begin(), channels.end(), chanid);
if (chanid && cit != channels.end())
@@ -610,11 +610,11 @@ uint ChannelBase::GetInputCardID(int inputNum) const
return 0;
}
-DBChanList ChannelBase::GetChannels(int inputNum) const
+DBChanInfoList ChannelBase::GetChannels(int inputNum) const
{
int inputid = (inputNum > 0) ? inputNum : m_currentInputID;
- DBChanList ret;
+ DBChanInfoList ret;
InputMap::const_iterator it = m_inputs.find(inputid);
if (it != m_inputs.end())
ret = (*it)->channels;
@@ -622,7 +622,7 @@ DBChanList ChannelBase::GetChannels(int inputNum) const
return ret;
}
-DBChanList ChannelBase::GetChannels(const QString &inputname) const
+DBChanInfoList ChannelBase::GetChannels(const QString &inputname) const
{
int inputid = m_currentInputID;
if (!inputname.isEmpty())
@@ -958,7 +958,7 @@ bool ChannelBase::InitializeInputs(void)
while (query.next())
{
uint sourceid = query.value(5).toUInt(); //HERE IS WHERE A BLANKET SOURCEID IS BEING DETERMINED FOR THE CARD!!!!
- DBChanList channels = ChannelUtil::GetChannels(sourceid, false);
+ DBChanInfoList channels = ChannelUtil::GetChannels(sourceid, false);
ChannelUtil::SortChannels(channels, order);
View
6 mythtv/libs/libmythtv/channelbase.h
@@ -80,8 +80,8 @@ class ChannelBase
virtual uint GetSourceID(int inputID) const
{ return m_inputs[inputID]->sourceid; }
virtual uint GetInputCardID(int inputNum) const;
- virtual DBChanList GetChannels(int inputNum) const;
- virtual DBChanList GetChannels(const QString &inputname) const;
+ virtual DBChanInfoList GetChannels(int inputNum) const;
+ virtual DBChanInfoList GetChannels(const QString &inputname) const;
virtual vector<InputInfo> GetFreeInputs(
const vector<uint> &excluded_cards) const;
virtual QStringList GetConnectedInputs(void) const;
@@ -160,7 +160,7 @@ class ChannelBase
bool m_commfree;
uint m_cardid;
InputMap m_inputs;
- DBChanList m_allchannels; ///< channels across all inputs
+ DBChanInfoList m_allchannels; ///< channels across all inputs
QMutex m_system_lock;
MythSystem *m_system;
View
4 mythtv/libs/libmythtv/channelgroupsettings.cpp
@@ -94,10 +94,10 @@ ChannelGroupConfig::ChannelGroupConfig(QString _name)
VerticalConfigurationGroup *cgroup;
HorizontalConfigurationGroup *columns;
- DBChanList chanlist = ChannelUtil::GetChannels(0, true, "channum, callsign");
+ DBChanInfoList chanlist = ChannelUtil::GetChannels(0, true, "channum, callsign");
ChannelUtil::SortChannels(chanlist, "channum", true);
- DBChanList::iterator it = chanlist.begin();
+ DBChanInfoList::iterator it = chanlist.begin();
int i,j = 0;
int p = 1;
int pages = (int)((float)chanlist.size() / 8.0 / 3.0 + 0.5);
View
52 mythtv/libs/libmythtv/channelutil.cpp
@@ -1841,7 +1841,7 @@ bool ChannelUtil::GetATSCChannel(uint sourceid, const QString &channum,
return false;
}
-bool ChannelUtil::GetChannelData( //TODO: MODIFIY THIS
+bool ChannelUtil::GetChannelData(
uint sourceid, const QString &channum,
QString &tvformat, QString &modulation,
QString &freqtable, QString &freqid,
@@ -1915,11 +1915,11 @@ bool ChannelUtil::GetChannelData( //TODO: MODIFIY THIS
dvb_transportid, dvb_networkid, dtv_si_std);
}
-DBChanList ChannelUtil::GetChannelsInternal( //TODO: MODIFIY THIS
+DBChanInfoList ChannelUtil::GetChannelsInternal( //TODO: MODIFIY THIS
uint sourceid, bool vis_only, bool include_disconnected,
const QString &grp, uint changrpid)
{
- DBChanList list;
+ DBChanInfoList list;
MSqlQuery query(MSqlQuery::InitCon());
@@ -1973,7 +1973,7 @@ DBChanList ChannelUtil::GetChannelsInternal( //TODO: MODIFIY THI
if (query.value(0).toString().isEmpty() || !query.value(2).toUInt())
continue; // skip if channum blank, or chanid empty
- DBChannel chan(
+ DBChannelInfo chan(
query.value(0).toString(), /* channum */
query.value(1).toString(), /* callsign */
query.value(2).toUInt(), /* chanid */
@@ -1993,6 +1993,36 @@ DBChanList ChannelUtil::GetChannelsInternal( //TODO: MODIFIY THI
return list;
}
+bool ChannelUtil::GetChannelSourceID(uint sourceid, const QString channum, const uint cardinputid, QString maptypes) //todo:finish
+{
+ MSqlQuery query(MSqlQuery::InitCon());
+ QString querystr =
+ "SELECT channel.sourceid "
+ "FROM videosourcemap as map, channel "
+ "WHERE channel.sourceid = map.sourceid AND "
+ " map.cardinputid = :CARDINPUTID AND "
+ " map.type in (MAPTYPES) AND "
+ " channum = :CHANNUM ";
+ querystr.replace("MAPTYPES", maptypes);
+ query.prepare(querystr);
+ query.bindValue(":CARDINPUTID", cardinputid);
+ query.bindValue(":CHANNUM", channum);
+
+ if (!query.exec() || !query.isActive())
+ {
+ MythDB::DBError("ChannelUtil::GetChannelSourceID", query);
+ return false;
+ }
+ else if (!query.next())
+ {
+ LOG(VB_GENERAL, LOG_ERR, QString("ChannelUtil::GetChannelSourceID failed because if could not\n "
+ "find a source map for channel number %1 on cardinputid %2").arg(channum).arg(cardinputid));
+ }
+
+ sourceid = query.value(0).toInt();
+ return true;
+}
+
vector<uint> ChannelUtil::GetChanIDs(int sourceid)
{
MSqlQuery query(MSqlQuery::InitCon());
@@ -2014,12 +2044,12 @@ vector<uint> ChannelUtil::GetChanIDs(int sourceid)
return list;
}
-inline bool lt_callsign(const DBChannel &a, const DBChannel &b)
+inline bool lt_callsign(const DBChannelInfo &a, const DBChannelInfo &b)
{
return QString::localeAwareCompare(a.callsign, b.callsign) < 0;
}
-inline bool lt_smart(const DBChannel &a, const DBChannel &b)
+inline bool lt_smart(const DBChannelInfo &a, const DBChannelInfo &b)
{
static QMutex sepExprLock;
static const QRegExp sepExpr(ChannelUtil::kATSCSeparators);
@@ -2127,7 +2157,7 @@ uint ChannelUtil::GetChannelCount(int sourceid)
return query.size();
}
-void ChannelUtil::SortChannels(DBChanList &list, const QString &order,
+void ChannelUtil::SortChannels(DBChanInfoList &list, const QString &order,
bool eliminate_duplicates)
{
bool cs = order.toLower() == "callsign";
@@ -2138,7 +2168,7 @@ void ChannelUtil::SortChannels(DBChanList &list, const QString &order,
if (eliminate_duplicates && !list.empty())
{
- DBChanList tmp;
+ DBChanInfoList tmp;
tmp.push_back(list[0]);
for (uint i = 1; i < list.size(); i++)
{
@@ -2154,14 +2184,14 @@ void ChannelUtil::SortChannels(DBChanList &list, const QString &order,
}
uint ChannelUtil::GetNextChannel(
- const DBChanList &sorted,
+ const DBChanInfoList &sorted,
uint old_chanid,
uint mplexid_restriction,
int direction,
bool skip_non_visible,
bool skip_same_channum_and_callsign)
{
- DBChanList::const_iterator it =
+ DBChanInfoList::const_iterator it =
find(sorted.begin(), sorted.end(), old_chanid);
if (it == sorted.end())
@@ -2170,7 +2200,7 @@ uint ChannelUtil::GetNextChannel(
if (it == sorted.end())
return 0; // no channels..
- DBChanList::const_iterator start = it;
+ DBChanInfoList::const_iterator start = it;
if (CHANNEL_DIRECTION_DOWN == direction)
{
View
11 mythtv/libs/libmythtv/channelutil.h
@@ -173,7 +173,7 @@ class MTV_PUBLIC ChannelUtil
static QString GetVideoFilters(uint sourceid, const QString &channum)
{ return GetChannelValueStr("videofilters", sourceid, channum); }
- static DBChanList GetChannels(
+ static DBChanInfoList GetChannels(
uint sourceid, bool visible_only,
const QString &group_by = QString(), uint channel_groupid = 0)
{
@@ -182,16 +182,17 @@ class MTV_PUBLIC ChannelUtil
}
/// Returns channels that are not connected to a capture card
/// and channels that are not marked as visible.
- static DBChanList GetAllChannels(uint sourceid)
+ static DBChanInfoList GetAllChannels(uint sourceid)
{
return GetChannelsInternal(sourceid, false, true, QString(), 0);
}
+ static bool GetChannelSourceID(uint sourceid, const QString channum, const uint cardinputid, QString maptypes = "main");
static vector<uint> GetChanIDs(int sourceid = -1);
static uint GetChannelCount(int sourceid = -1);
- static void SortChannels(DBChanList &list, const QString &order,
+ static void SortChannels(DBChanInfoList &list, const QString &order,
bool eliminate_duplicates = false);
- static uint GetNextChannel(const DBChanList &sorted,
+ static uint GetNextChannel(const DBChanInfoList &sorted,
uint old_chanid,
uint mplexid_restriction,
int direction,
@@ -269,7 +270,7 @@ class MTV_PUBLIC ChannelUtil
static const QString kATSCSeparators;
private:
- static DBChanList GetChannelsInternal(
+ static DBChanInfoList GetChannelsInternal(
uint sourceid, bool visible_only, bool include_disconnected,
const QString &group_by, uint channel_groupid);
static QString GetChannelStringField(int chanid, const QString &field);
View
72 mythtv/libs/libmythtv/dbchannelinfo.cpp
@@ -17,9 +17,9 @@
#include "channelgroup.h"
#include "sourceutil.h"
-DBChannel::DBChannel(const DBChannel &other) :
+DBChannelInfo::DBChannelInfo(const DBChannelInfo &other) :
channum(other.channum), callsign(other.callsign),
- name(other.name), icon(other.icon),
+ name(other.name), iconpath(other.iconpath),
chanid(other.chanid),
major_chan(other.major_chan), minor_chan(other.minor_chan),
mplexid((other.mplexid == 32767) ? 0 : other.mplexid),
@@ -28,29 +28,32 @@ DBChannel::DBChannel(const DBChannel &other) :
{
}
-DBChannel::DBChannel(
+DBChannelInfo::DBChannelInfo(
const QString &_channum, const QString &_callsign,
uint _chanid, uint _major_chan, uint _minor_chan,
uint _mplexid, bool _visible,
- const QString &_name, const QString &_icon,
+ const QString &_name, const QString &_iconpath,
uint _sourceid, uint _cardid, uint _grpid) :
channum(_channum),
callsign(_callsign),
- name(_name), icon((_icon == "none") ? QString() : _icon),
+ name(_name),
+ iconpath((_iconpath == "none") ? QString() : _iconpath),
chanid(_chanid),
- major_chan(_major_chan), minor_chan(_minor_chan),
+ major_chan(_major_chan),
+ minor_chan(_minor_chan),
mplexid((_mplexid == 32767) ? 0 : _mplexid),
- sourceid(_sourceid), cardid(_cardid), grpid(_grpid),
- visible(_visible)
+ sourceid(_sourceid),
+ cardid(_cardid),
+ grpid(_grpid)
{
}
-DBChannel &DBChannel::operator=(const DBChannel &other)
+DBChannelInfo &DBChannelInfo::operator=(const DBChannelInfo &other)
{
channum = other.channum;
callsign = other.callsign;
name = other.name;
- icon = other.icon;
+ iconpath = other.iconpath;
chanid = other.chanid;
major_chan = other.major_chan;
minor_chan = other.minor_chan;
@@ -59,27 +62,31 @@ DBChannel &DBChannel::operator=(const DBChannel &other)
cardid = other.cardid;
grpid = other.grpid;
visible = other.visible;
+ favid = other.favid;
+ sourcename = other.sourcename;
+ recpriority= other.recpriority;
return *this;
}
-void DBChannel::ToMap(InfoMap& infoMap) const
+void DBChannelInfo::ToMap(InfoMap& infoMap) const
{
infoMap["channelnumber"] = channum;
infoMap["callsign"] = callsign;
infoMap["channelname"] = name;
- infoMap["channeliconpath"] = icon;
+ infoMap["channeliconpath"] = iconpath;
infoMap["channelid"] = QString().setNum(chanid);
infoMap["majorchan"] = QString().setNum(major_chan);
infoMap["minorchan"] = QString().setNum(minor_chan);
infoMap["mplexid"] = QString().setNum(mplexid);
infoMap["channelvisible"] = visible ? QObject::tr("Yes") : QObject::tr("No");
-
infoMap["channelgroupname"] = ChannelGroup::GetChannelGroupName(grpid);
infoMap["channelsourcename"] = SourceUtil::GetSourceName(sourceid);
+ //infoMap["channelsourcename"] = sourcename;
+ infoMap["channelrecpriority"] = recpriority;
}
-QString DBChannel::GetFormatted(const ChannelFormat &format) const
+QString DBChannelInfo::GetFormatted(const ChannelFormat &format) const
{
QString tmp;
@@ -99,43 +106,6 @@ QString DBChannel::GetFormatted(const ChannelFormat &format) const
return tmp;
}
-////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////
-
-QString ChannelInfo::GetFormatted(const ChannelFormat &format) const
-{
- QString tmp;
-
- if (format & kChannelLong)
- tmp = gCoreContext->GetSetting("LongChannelFormat", "<num> <name>");
- else // kChannelShort
- tmp = gCoreContext->GetSetting("ChannelFormat", "<num> <sign>");
-
-
- if (tmp.isEmpty())
- return QString();
-
- tmp.replace("<num>", chanstr);
- tmp.replace("<sign>", callsign);
- tmp.replace("<name>", channame);
-
- return tmp;
-}
-
-void ChannelInfo::ToMap(InfoMap& infoMap) const
-{
- infoMap["callsign"] = callsign;
- infoMap["channeliconpath"] = iconpath;
- infoMap["chanstr"] = chanstr;
- infoMap["channelname"] = channame;
- infoMap["channelid"] = QString().setNum(chanid);
- infoMap["channelsourcename"] = sourcename;
- infoMap["channelrecpriority"] = recpriority;
-}
-
-////////////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////////
-
bool ChannelInsertInfo::SaveScan(uint scanid, uint transportid) const
{
MSqlQuery query(MSqlQuery::InitCon());
View
45 mythtv/libs/libmythtv/dbchannelinfo.h
@@ -17,18 +17,18 @@ using namespace std;
#include "mythtvexp.h"
#include "programtypes.h"
-// TODO: Refactor DBChannel and ChannelInfo into a single class
-
-class MTV_PUBLIC DBChannel
+class MTV_PUBLIC DBChannelInfo
{
public:
- DBChannel(const DBChannel&);
- DBChannel(const QString &_channum, const QString &_callsign,
- uint _chanid, uint _major_chan, uint _minor_chan,
+ DBChannelInfo() : chanid(0), sourceid(0), favid(0) {}
+ DBChannelInfo(const DBChannelInfo&);
+ DBChannelInfo(const QString &_channum, const QString &_callsign,
+ uint _chanid, uint _major_chan, uint _minor_chan,
uint _mplexid, bool _visible,
- const QString &_name, const QString &_icon,
+ const QString &_name, const QString &_iconpath,
uint _sourceid, uint _cardid, uint _grpid);
- DBChannel& operator=(const DBChannel&);
+
+ DBChannelInfo& operator=(const DBChannelInfo&);
bool operator == (uint _chanid) const
{ return chanid == _chanid; }
@@ -36,41 +36,28 @@ class MTV_PUBLIC DBChannel
enum ChannelFormat { kChannelShort, kChannelLong };
QString GetFormatted(const ChannelFormat &format) const;
void ToMap(InfoMap &infoMap) const;
-
public:
QString channum;
QString callsign;
- QString name;
- QString icon;
uint chanid;
+
+ QString name;
+ QString iconpath;
+
uint major_chan;
uint minor_chan;
uint mplexid;
+
uint sourceid;
uint cardid;
uint grpid;
bool visible;
-};
-typedef vector<DBChannel> DBChanList;
-
-class MTV_PUBLIC ChannelInfo
-{
- public:
- ChannelInfo() : chanid(-1), sourceid(-1), favid(-1) {}
- enum ChannelFormat { kChannelShort, kChannelLong };
- QString GetFormatted(const ChannelFormat &format) const;
- void ToMap(InfoMap &infoMap) const;
- QString callsign;
- QString iconpath;
- QString chanstr;
- QString channame;
- int chanid;
- int sourceid;
- QString sourcename;
int favid;
+ QString sourcename;
QString recpriority;
};
+typedef vector<DBChannelInfo> DBChanInfoList;
class MTV_PUBLIC ChannelInsertInfo
{
@@ -177,6 +164,6 @@ class MTV_PUBLIC ChannelInsertInfo
};
typedef vector<ChannelInsertInfo> ChannelInsertInfoList;
-Q_DECLARE_METATYPE(ChannelInfo*)
+Q_DECLARE_METATYPE(DBChannelInfo*)
#endif // DB_CHANNEL_INFO_H_
View
36 mythtv/libs/libmythtv/dtvchannel.cpp
@@ -229,41 +229,9 @@ bool DTVChannel::SetChannelByString(const QString &channum, QString maptypes)
bool use_on_air_guide, visible;
QString xmltvid, default_authority, icon;
-////////////////////////////////////////////////////
-////////////////////////////////////////////////////
-// Look up the sourcemap based on cardid and then pass the cardid on
-// to getchanneldata along with a map.types string. Done :-)
-//cardid is: (*it)->cardid
-//m_currentInputID, GetCurrentInputNum()
-//maptpyes is: maptypes
-MSqlQuery query(MSqlQuery::InitCon());
-QString querystr =
- "SELECT channel.sourceid "
- "FROM videosourcemap as map, channel "
- "WHERE channel.sourceid = map.sourceid AND "
- " map.cardinputid = :CARDINPUTID AND "
- " map.type in (MAPTYPES) AND "
- " channum = :CHANNUM ";
-querystr.replace("MAPTYPES", maptypes);
-query.prepare(querystr);
-query.bindValue(":CARDINPUTID", GetCurrentInputNum());
-query.bindValue(":CHANNUM", channum);
-
-if (!query.exec() || !query.isActive())
-{
- MythDB::DBError("LincsGetMapData", query);
- //return false;
-}
-else if (!query.next())
-{
- LOG(VB_GENERAL, LOG_ERR,
- QString("LINC.......... blah blah blah linc query.next failed\n\n\n\n\n\n\n\n"));
- //return false;
-}
-int variablesrcid = query.value(0).toInt();
-////////////////////////////////////////////////////
-////////////////////////////////////////////////////
+int variablesrcid = 0;
+ChannelUtil::GetChannelSourceID(variablesrcid, channum, GetCurrentInputNum(), maptypes);
View
20 mythtv/libs/libmythtv/inputinfo.h
@@ -7,7 +7,7 @@
#include <QMap>
// MythTV headers
-#include "channelutil.h" // for DBChanList
+#include "channelutil.h" // for DBChanInfoList
class MTV_PUBLIC InputInfo
{
@@ -79,7 +79,7 @@ class MTV_PUBLIC ChannelInputInfo : public InputInfo
uint _sourceid, uint _cardid,
uint _inputid, uint _mplexid,
uint _livetvorder,
- const DBChanList &_channels) :
+ const DBChanInfoList &_channels) :
InputInfo(_name, _sourceid, _inputid, _cardid, _mplexid, _livetvorder),
startChanNum(_startChanNum),
tuneToChannel(_tuneToChannel), externalChanger(_externalChanger),
@@ -93,14 +93,14 @@ class MTV_PUBLIC ChannelInputInfo : public InputInfo
virtual void Clear(void);
public:
- QString startChanNum; ///< channel to start on
- QString tuneToChannel; ///< for using a cable box & S-Video
- QString externalChanger; ///< for using a cable box...
- DBChanList channels;
- vector<uint> groups;
- int inputNumV4L;
- int videoModeV4L1;
- int videoModeV4L2;
+ QString startChanNum; ///< channel to start on
+ QString tuneToChannel; ///< for using a cable box & S-Video
+ QString externalChanger; ///< for using a cable box...
+ DBChanInfoList channels;
+ vector<uint> groups;
+ int inputNumV4L;
+ int videoModeV4L1;
+ int videoModeV4L2;
};
typedef QMap<uint, ChannelInputInfo*> InputMap;
View
8 mythtv/libs/libmythtv/tv_play.cpp
@@ -1387,7 +1387,7 @@ void TV::UpdateChannelList(int groupID)
if (groupID == channelGroupId)
return;
- DBChanList list;
+ DBChanInfoList list;
if (groupID != -1)
{
list = ChannelUtil::GetChannels(
@@ -7245,7 +7245,7 @@ void TV::ChangeChannel(PlayerContext *ctx, uint chanid, const QString &chan)
UpdateOSDInput(ctx);
}
-void TV::ChangeChannel(const PlayerContext *ctx, const DBChanList &options)
+void TV::ChangeChannel(const PlayerContext *ctx, const DBChanInfoList &options)
{
for (uint i = 0; i < options.size(); i++)
{
@@ -10229,11 +10229,11 @@ void TV::OSDDialogEvent(int result, QString text, QString action)
if (actx->tvchain)
{
QMutexLocker locker(&channelGroupLock);
- const DBChanList &list = channelGroupChannelList;
+ const DBChanInfoList &list = channelGroupChannelList;
cur_channum = actx->tvchain->GetChannelName(-1);
new_channum = cur_channum;
- DBChanList::const_iterator it = list.begin();
+ DBChanInfoList::const_iterator it = list.begin();
for (; it != list.end(); ++it)
{
if ((*it).channum == cur_channum)
View
4 mythtv/libs/libmythtv/tv_play.h
@@ -265,7 +265,7 @@ class MTV_PUBLIC TV : public QObject
QSet<uint> IsTunableOn(const PlayerContext*, uint chanid,
bool use_cache, bool early_exit);
void ClearTunableCache(void);
- void ChangeChannel(const PlayerContext*, const DBChanList &options);
+ void ChangeChannel(const PlayerContext*, const DBChanInfoList &options);
void DrawUnusedRects(void);
void DoEditSchedule(int editType = kScheduleProgramGuide);
QString GetRecordingGroup(int player_idx) const;
@@ -790,7 +790,7 @@ class MTV_PUBLIC TV : public QObject
/// to read this value in the UI thread.
mutable QMutex channelGroupLock;
volatile int channelGroupId;
- DBChanList channelGroupChannelList;
+ DBChanInfoList channelGroupChannelList;
// Network Control stuff
MythDeque<QString> networkControlCommands;
View
8 mythtv/libs/libmythtv/tvbrowsehelper.cpp
@@ -53,7 +53,7 @@ TVBrowseHelper::TVBrowseHelper(
ChannelUtil::SortChannels(
db_all_channels, db_channel_ordering, false);
- DBChanList::const_iterator it = db_all_channels.begin();
+ DBChanInfoList::const_iterator it = db_all_channels.begin();
for (; it != db_all_channels.end(); ++it)
{
db_chanid_to_channum[(*it).chanid] = (*it).channum;
@@ -236,7 +236,7 @@ uint TVBrowseHelper::GetChanId(
{
if (pref_sourceid)
{
- DBChanList::const_iterator it = db_all_channels.begin();
+ DBChanInfoList::const_iterator it = db_all_channels.begin();
for (; it != db_all_channels.end(); ++it)
{
if ((*it).sourceid == pref_sourceid && (*it).channum == channum)
@@ -246,7 +246,7 @@ uint TVBrowseHelper::GetChanId(
if (pref_cardid)
{
- DBChanList::const_iterator it = db_all_channels.begin();
+ DBChanInfoList::const_iterator it = db_all_channels.begin();
for (; it != db_all_channels.end(); ++it)
{
if ((*it).cardid == pref_cardid && (*it).channum == channum)
@@ -256,7 +256,7 @@ uint TVBrowseHelper::GetChanId(
if (db_browse_all_tuners)
{
- DBChanList::const_iterator it = db_all_channels.begin();
+ DBChanInfoList::const_iterator it = db_all_channels.begin();
for (; it != db_all_channels.end(); ++it)
{
if ((*it).channum == channum)
View
6 mythtv/libs/libmythtv/tvbrowsehelper.h
@@ -8,7 +8,7 @@
#include <QString>
#include <QHash>
-#include "dbchannelinfo.h" // for DBChanList
+#include "dbchannelinfo.h" // for DBChanInfoList
#include "programtypes.h" // for InfoMap
#include "mthread.h"
#include "tv.h" // for BrowseDirection
@@ -113,8 +113,8 @@ class TVBrowseHelper : public MThread
virtual void run();
TV *m_tv;
- DBChanList db_all_channels;
- DBChanList db_all_visible_channels;
+ DBChanInfoList db_all_channels;
+ DBChanInfoList db_all_visible_channels;
QString db_time_format;
QString db_short_date_format;
uint db_browse_max_forward;
View
3  mythtv/libs/libmythtv/videosource.cpp
@@ -2953,8 +2953,7 @@ void StartingChannel::SetSourceID(const QString &sourceid)
// Get the existing starting channel
QString startChan = CardUtil::GetStartingChannel(getInputID());
-
- DBChanList channels = ChannelUtil::GetAllChannels(sourceid.toUInt());
+ DBChanInfoList channels = ChannelUtil::GetAllChannels(sourceid.toUInt());
if (channels.empty())
{
View
2  mythtv/programs/mythfilldatabase/channeldata.cpp
@@ -124,7 +124,7 @@ unsigned int ChannelData::promptForChannelUpdates(
(*chaninfo).tvformat);
(*chaninfo).iconpath = getResponse("Choose a channel icon image (any path "
- "name) ",(*chaninfo).iconpath);
+ "name) ",(*chaninfo).iconpath);
return(chanid);
}
View
38 mythtv/programs/mythfrontend/channelrecpriority.cpp
@@ -23,7 +23,7 @@ using namespace std;
typedef struct RecPriorityInfo
{
- ChannelInfo *chan;
+ DBChannelInfo *chan;
int cnt;
} RecPriorityInfo;
@@ -32,9 +32,9 @@ class channelSort
public:
bool operator()(const RecPriorityInfo &a, const RecPriorityInfo &b)
{
- if (a.chan->chanstr.toInt() == b.chan->chanstr.toInt())
+ if (a.chan->channum.toInt() == b.chan->channum.toInt())
return(a.chan->sourceid > b.chan->sourceid);
- return(a.chan->chanstr.toInt() > b.chan->chanstr.toInt());
+ return(a.chan->channum.toInt() > b.chan->channum.toInt());
}
};
@@ -44,7 +44,7 @@ class channelRecPrioritySort
bool operator()(const RecPriorityInfo &a, const RecPriorityInfo &b)
{
if (a.chan->recpriority.toInt() == b.chan->recpriority.toInt())
- return (a.chan->chanstr.toInt() > b.chan->chanstr.toInt());
+ return (a.chan->channum.toInt() > b.chan->channum.toInt());
return (a.chan->recpriority.toInt() < b.chan->recpriority.toInt());
}
};
@@ -191,7 +191,7 @@ void ChannelRecPriority::changeRecPriority(int howMuch)
if (!item)
return;
- ChannelInfo *chanInfo = qVariantValue<ChannelInfo *>(item->GetData());
+ DBChannelInfo *chanInfo = qVariantValue<DBChannelInfo *>(item->GetData());
// inc/dec recording priority
int tempRecPriority = chanInfo->recpriority.toInt() + howMuch;
@@ -225,11 +225,11 @@ void ChannelRecPriority::applyChannelRecPriorityChange(QString chanid,
void ChannelRecPriority::saveRecPriority(void)
{
- QMap<QString, ChannelInfo>::Iterator it;
+ QMap<QString, DBChannelInfo>::Iterator it;
for (it = m_channelData.begin(); it != m_channelData.end(); ++it)
{
- ChannelInfo *chanInfo = &(*it);
+ DBChannelInfo *chanInfo = &(*it);
QString key = QString::number(chanInfo->chanid);
// if this channel's recording priority changed from when we entered
@@ -267,14 +267,14 @@ void ChannelRecPriority::FillList(void)
int cnt = 999;
while (result.next())
{
- ChannelInfo *chaninfo = new ChannelInfo;
+ DBChannelInfo *chaninfo = new DBChannelInfo;
chaninfo->chanid = result.value(0).toInt();
- chaninfo->chanstr = result.value(1).toString();
+ chaninfo->channum = result.value(1).toString();
chaninfo->sourceid = result.value(2).toInt();
chaninfo->callsign = result.value(3).toString();
chaninfo->iconpath = result.value(4).toString();
chaninfo->recpriority = result.value(5).toString();
- chaninfo->channame = result.value(6).toString();
+ chaninfo->name = result.value(6).toString();
if (result.value(7).toInt() > 0)
m_visMap[chaninfo->chanid] = true;
chaninfo->sourcename = srcMap[chaninfo->sourceid];
@@ -299,11 +299,11 @@ void ChannelRecPriority::updateList()
{
m_channelList->Reset();
- QMap<QString, ChannelInfo*>::Iterator it;
+ QMap<QString, DBChannelInfo*>::Iterator it;
MythUIButtonListItem *item;
for (it = m_sortedChannel.begin(); it != m_sortedChannel.end(); ++it)
{
- ChannelInfo *chanInfo = *it;
+ DBChannelInfo *chanInfo = *it;
item = new MythUIButtonListItem(m_channelList, "",
qVariantFromValue(chanInfo));
@@ -312,7 +312,7 @@ void ChannelRecPriority::updateList()
if (!m_visMap[chanInfo->chanid])
fontState = "disabled";
- item->SetText(chanInfo->GetFormatted(ChannelInfo::kChannelLong),
+ item->SetText(chanInfo->GetFormatted(DBChannelInfo::kChannelLong),
fontState);
InfoMap infomap;
@@ -347,15 +347,15 @@ void ChannelRecPriority::SortList()
if (item)
{
- ChannelInfo *channelItem = qVariantValue<ChannelInfo *>(item->GetData());
+ DBChannelInfo *channelItem = qVariantValue<DBChannelInfo *>(item->GetData());
m_currentItem = channelItem;
}
int i, j;
vector<RecPriorityInfo> sortingList;
- QMap<QString, ChannelInfo>::iterator pit;
+ QMap<QString, DBChannelInfo>::iterator pit;
vector<RecPriorityInfo>::iterator sit;
- ChannelInfo *chanInfo;
+ DBChannelInfo *chanInfo;
RecPriorityInfo *recPriorityInfo;
// copy m_channelData into sortingList
@@ -401,7 +401,7 @@ void ChannelRecPriority::updateInfo(MythUIButtonListItem *item)
if (!item)
return;
- ChannelInfo *channelItem = qVariantValue<ChannelInfo *>(item->GetData());
+ DBChannelInfo *channelItem = qVariantValue<DBChannelInfo *>(item->GetData());
if (!m_channelData.isEmpty() && channelItem)
{
QString rectype;
@@ -416,7 +416,7 @@ void ChannelRecPriority::updateInfo(MythUIButtonListItem *item)
SetTextFromMap(chanmap);
if (m_chanstringText)
- m_chanstringText->SetText(channelItem->GetFormatted(ChannelInfo::kChannelLong));
+ m_chanstringText->SetText(channelItem->GetFormatted(DBChannelInfo::kChannelLong));
}
MythUIText *norecordingText = dynamic_cast<MythUIText*>
@@ -433,7 +433,7 @@ void ChannelRecPriority::upcoming()
if (!item)
return;
- ChannelInfo *chanInfo = qVariantValue<ChannelInfo *>(item->GetData());
+ DBChannelInfo *chanInfo = qVariantValue<DBChannelInfo *>(item->GetData());
if (!chanInfo || chanInfo->chanid < 1)
return;
View
8 mythtv/programs/mythfrontend/channelrecpriority.h
@@ -5,7 +5,7 @@
#include "programinfo.h"
-class ChannelInfo;
+class DBChannelInfo;
class MythUIText;
class MythUIImage;
@@ -50,8 +50,8 @@ class ChannelRecPriority : public MythScreenType
void saveRecPriority(void);
- QMap<QString, ChannelInfo> m_channelData;
- QMap<QString, ChannelInfo*> m_sortedChannel;
+ QMap<QString, DBChannelInfo> m_channelData;
+ QMap<QString, DBChannelInfo*> m_sortedChannel;
QMap<QString, QString> m_origRecPriorityData;
QMap<int, bool> m_visMap;
@@ -69,7 +69,7 @@ class ChannelRecPriority : public MythScreenType
SortType m_sortType;
- ChannelInfo *m_currentItem;
+ DBChannelInfo *m_currentItem;
};
#endif
View
46 mythtv/programs/mythfrontend/guidegrid.cpp
@@ -172,7 +172,7 @@ void GuideGrid::RunProgramGuide(uint chanid, const QString &channum,
changrpid = gCoreContext->GetNumSetting("ChannelGroupDefault", -1);
// check there are some channels setup
- DBChanList channels = ChannelUtil::GetChannels(
+ DBChanInfoList channels = ChannelUtil::GetChannels(
0, true, "", (changrpid<0) ? 0 : changrpid);
if (!channels.size())
{
@@ -657,7 +657,7 @@ void GuideGrid::ShowRecordingMenu(void)
}
}
-DBChannel *GuideGrid::GetChannelInfo(uint chan_idx, int sel)
+DBChannelInfo *GuideGrid::GetChannelInfo(uint chan_idx, int sel)
{
sel = (sel >= 0) ? sel : m_channelInfoIdx[chan_idx];
@@ -670,7 +670,7 @@ DBChannel *GuideGrid::GetChannelInfo(uint chan_idx, int sel)
return &(m_channelInfos[chan_idx][sel]);
}
-const DBChannel *GuideGrid::GetChannelInfo(uint chan_idx, int sel) const
+const DBChannelInfo *GuideGrid::GetChannelInfo(uint chan_idx, int sel) const
{
return ((GuideGrid*)this)->GetChannelInfo(chan_idx, sel);
}
@@ -715,7 +715,7 @@ uint GuideGrid::GetAlternateChannelIndex(
uint chan_idx, bool with_same_channum) const
{
uint si = m_channelInfoIdx[chan_idx];
- const DBChannel *chinfo = GetChannelInfo(chan_idx, si);
+ const DBChannelInfo *chinfo = GetChannelInfo(chan_idx, si);
PlayerContext *ctx = m_player->GetPlayerReadLock(-1, __FILE__, __LINE__);
@@ -725,7 +725,7 @@ uint GuideGrid::GetAlternateChannelIndex(
if (i == si)
continue;
- const DBChannel *ciinfo = GetChannelInfo(chan_idx, i);
+ const DBChannelInfo *ciinfo = GetChannelInfo(chan_idx, i);
if (!ciinfo)
continue;
@@ -770,9 +770,9 @@ uint GuideGrid::GetAlternateChannelIndex(
#define MKKEY(IDX,SEL) ((((uint64_t)IDX) << 32) | SEL)
-DBChanList GuideGrid::GetSelection(void) const
+DBChanInfoList GuideGrid::GetSelection(void) const
{
- DBChanList selected;
+ DBChanInfoList selected;
int idx = GetStartChannelOffset();
if (idx < 0)
@@ -783,7 +783,7 @@ DBChanList GuideGrid::GetSelection(void) const
vector<uint64_t> sel;
sel.push_back( MKKEY(idx, si) );
- const DBChannel *ch = GetChannelInfo(sel[0]>>32, sel[0]&0xffff);
+ const DBChannelInfo *ch = GetChannelInfo(sel[0]>>32, sel[0]&0xffff);
if (!ch)
return selected;
@@ -798,7 +798,7 @@ DBChanList GuideGrid::GetSelection(void) const
for (uint i = 0; i < m_channelInfos[idx].size(); ++i)
{
- const DBChannel *ci = GetChannelInfo(idx, i);
+ const DBChannelInfo *ci = GetChannelInfo(idx, i);
if (ci && (i != si) &&
(ci->callsign == ch->callsign) && (ci->channum == ch->channum))
{
@@ -808,7 +808,7 @@ DBChanList GuideGrid::GetSelection(void) const
for (uint i = 0; i < m_channelInfos[idx].size(); ++i)
{
- const DBChannel *ci = GetChannelInfo(idx, i);
+ const DBChannelInfo *ci = GetChannelInfo(idx, i);
if (ci && (i != si) &&
(ci->callsign == ch->callsign) && (ci->channum != ch->channum))
{
@@ -818,7 +818,7 @@ DBChanList GuideGrid::GetSelection(void) const
for (uint i = 0; i < m_channelInfos[idx].size(); ++i)
{
- const DBChannel *ci = GetChannelInfo(idx, i);
+ const DBChannelInfo *ci = GetChannelInfo(idx, i);
if ((i != si) && (ci->callsign != ch->callsign))
{
sel.push_back( MKKEY(idx, i) );
@@ -827,7 +827,7 @@ DBChanList GuideGrid::GetSelection(void) const
for (uint i = 1; i < sel.size(); ++i)
{
- const DBChannel *ci = GetChannelInfo(sel[i]>>32, sel[i]&0xffff);
+ const DBChannelInfo *ci = GetChannelInfo(sel[i]>>32, sel[i]&0xffff);
const ProgramList ch_proglist = GetProgramList(ch->chanid);
if (!ci || proglist.size() != ch_proglist.size())
@@ -860,7 +860,7 @@ void GuideGrid::fillChannelInfos(bool gotostartchannel)
m_channelInfoIdx.clear();
m_currentStartChannel = 0;
- DBChanList channels = ChannelUtil::GetChannels(
+ DBChanInfoList channels = ChannelUtil::GetChannels(
0, true, "", (m_changrpid < 0) ? 0 : m_changrpid);
ChannelUtil::SortChannels(channels, m_channelOrdering, false);
@@ -882,7 +882,7 @@ void GuideGrid::fillChannelInfos(bool gotostartchannel)
if (ndup && cdup)
continue;
- DBChannel val(channels[chan]);
+ DBChannelInfo val(channels[chan]);
channum_to_index_map[val.channum].push_back(GetChannelCount());
callsign_to_index_map[val.callsign].push_back(GetChannelCount());
@@ -1508,7 +1508,7 @@ void GuideGrid::updateChannels(void)
{
m_channelList->Reset();
- DBChannel *chinfo = GetChannelInfo(m_currentStartChannel);
+ DBChannelInfo *chinfo = GetChannelInfo(m_currentStartChannel);
if (m_player)
m_player->ClearTunableCache();
@@ -1558,7 +1558,7 @@ void GuideGrid::updateChannels(void)
MythUIButtonListItem *item =
new MythUIButtonListItem(m_channelList,
- chinfo ? chinfo->GetFormatted(DBChannel::kChannelShort) : QString());
+ chinfo ? chinfo->GetFormatted(DBChannelInfo::kChannelShort) : QString());
QString state = "available";
if (unavailable)
@@ -1575,11 +1575,11 @@ void GuideGrid::updateChannels(void)
chinfo->ToMap(infomap);
item->SetTextFromMap(infomap);
- if (!chinfo->icon.isEmpty())
+ if (!chinfo->iconpath.isEmpty())
{
QString iconurl =
gCoreContext->GetMasterHostPrefix("ChannelIcons",
- chinfo->icon);
+ chinfo->iconpath);
item->SetImage(iconurl, "channelicon");
}
}
@@ -1605,15 +1605,15 @@ void GuideGrid::updateInfo(void)
if (chanNum < 0)
chanNum = 0;
- DBChannel *chinfo = GetChannelInfo(chanNum);
+ DBChannelInfo *chinfo = GetChannelInfo(chanNum);
if (m_channelImage)
{
m_channelImage->Reset();
- if (!chinfo->icon.isEmpty())
+ if (!chinfo->iconpath.isEmpty())
{
QString iconurl = gCoreContext->GetMasterHostPrefix("ChannelIcons",
- chinfo->icon);
+ chinfo->iconpath);
m_channelImage->SetFilename(iconurl);
m_channelImage->Load();
@@ -1736,7 +1736,7 @@ void GuideGrid::toggleChannelFavorite(int grpid)
if (chanNum < 0)
chanNum = 0;
- DBChannel *ch = GetChannelInfo(chanNum);
+ DBChannelInfo *ch = GetChannelInfo(chanNum);
uint chanid = ch->chanid;
if (m_changrpid == -1)
@@ -2083,7 +2083,7 @@ void GuideGrid::channelUpdate(void)
if (!m_player)
return;
- DBChanList sel = GetSelection();
+ DBChanInfoList sel = GetSelection();
if (sel.size())
{
View
12 mythtv/programs/mythfrontend/guidegrid.h
@@ -31,7 +31,7 @@ class MythUIGuideGrid;
#define MAX_DISPLAY_TIMES 36
-typedef vector<DBChannel> db_chan_list_t;
+typedef vector<DBChannelInfo> db_chan_list_t;
typedef vector<db_chan_list_t> db_chan_list_list_t;
class JumpToChannel;
@@ -89,7 +89,7 @@ class GuideGrid : public ScheduleCommon, public JumpToChannelListener
bool allowFinder = true,
int changrpid = -1);
- DBChanList GetSelection(void) const;
+ DBChanInfoList GetSelection(void) const;
virtual void GoTo(int start, int cur_row);
virtual void SetJumpToChannel(JumpToChannel *ptr);
@@ -180,10 +180,10 @@ class GuideGrid : public ScheduleCommon, public JumpToChannelListener
void setStartChannel(int newStartChannel);
- DBChannel *GetChannelInfo(uint chan_idx, int sel = -1);
- const DBChannel *GetChannelInfo(uint chan_idx, int sel = -1) const;
- uint GetChannelCount(void) const;
- int GetStartChannelOffset(int row = -1) const;
+ DBChannelInfo *GetChannelInfo(uint chan_idx, int sel = -1);
+ const DBChannelInfo *GetChannelInfo(uint chan_idx, int sel = -1) const;
+ uint GetChannelCount(void) const;
+ int GetStartChannelOffset(int row = -1) const;
ProgramList GetProgramList(uint chanid) const;
uint GetAlternateChannelIndex(uint chan_idx, bool with_same_channum) const;
View
4 mythtv/programs/mythfrontend/manualschedule.cpp
@@ -68,12 +68,12 @@ bool ManualSchedule::Create(void)
}
QString chanorder = gCoreContext->GetSetting("ChannelOrdering", "channum");
- DBChanList channels = ChannelUtil::GetChannels(0, false, "channum,callsign");
+ DBChanInfoList channels = ChannelUtil::GetChannels(0, false, "channum,callsign");
ChannelUtil::SortChannels(channels, chanorder);
for (uint i = 0; i < channels.size(); i++)
{
- QString chantext = channels[i].GetFormatted(DBChannel::kChannelLong);
+ QString chantext = channels[i].GetFormatted(DBChannelInfo::kChannelLong);
MythUIButtonListItem *item =
new MythUIButtonListItem(m_channelList, chantext);
View
4 mythtv/programs/mythfrontend/proglist.cpp
@@ -770,13 +770,13 @@ void ProgLister::FillViewList(const QString &view)
if (m_type == plChannel) // list by channel
{
- DBChanList channels = ChannelUtil::GetChannels(
+ DBChanInfoList channels = ChannelUtil::GetChannels(
0, true, "channum, chanid");
ChannelUtil::SortChannels(channels, m_channelOrdering, true);
for (uint i = 0; i < channels.size(); ++i)
{
- QString chantext = channels[i].GetFormatted(DBChannel::kChannelShort);
+ QString chantext = channels[i].GetFormatted(DBChannelInfo::kChannelShort);
m_viewList.push_back(QString::number(channels[i].chanid));
m_viewTextList.push_back(chantext);
View
4 mythtv/programs/mythfrontend/proglist_helpers.cpp
@@ -564,13 +564,13 @@ void EditPowerSearchPopup::initLists(void)
new MythUIButtonListItem(m_channelList, tr("(Any Channel)"), NULL, false);
m_channels << "";
- DBChanList channels = ChannelUtil::GetChannels(0, true, "callsign");
+ DBChanInfoList channels = ChannelUtil::GetChannels(0, true, "callsign");
ChannelUtil::SortChannels(channels, channelOrdering, true);
MythUIButtonListItem *item;
for (uint i = 0; i < channels.size(); ++i)
{
- QString chantext = channels[i].GetFormatted(DBChannel::kChannelShort);
+ QString chantext = channels[i].GetFormatted(DBChannelInfo::kChannelShort);
m_parent->m_viewList << QString::number(channels[i].chanid);
m_parent->m_viewTextList << chantext;
Please sign in to comment.
Something went wrong with that request. Please try again.