Ticket #199: channelgroup.3.diff
File channelgroup.3.diff, 52.7 KB (added by , 15 years ago) |
---|
-
libs/libmythtv/channelgroup.cpp
diff -Naurp -x '*.orig' mythtv-orig/libs/libmythtv/channelgroup.cpp mythtv/libs/libmythtv/channelgroup.cpp
old new 1 #include "mythcontext.h" 2 #include "libmythdb/mythdbcon.h" 3 #include <qsqldatabase.h> 4 #include <qcursor.h> 5 #include <qlayout.h> 6 #include <iostream> 7 #include "mythstorage.h" 8 #include "mythdb.h" 9 #include "channelutil.h" 10 #include "channelgroup.h" 11 12 #define LOC QString("Channel Group: ") 13 #define LOC_ERR QString("Channel Group, Error: ") 14 15 ChannelGroupItem& ChannelGroupItem::operator=(const ChannelGroupItem &other) 16 { 17 grpid = other.grpid; 18 name = (other.name); 19 20 return *this; 21 } 22 23 ChannelGroupItem::ChannelGroupItem(const ChannelGroupItem &other) 24 { 25 (*this) = other; 26 } 27 28 inline bool lt_group(const ChannelGroupItem &a, const ChannelGroupItem &b) 29 { 30 return QString::localeAwareCompare(a.name, b.name) < 0; 31 } 32 33 bool ChannelGroup::ToggleChannel(uint chanid,int changrpid, int delete_chan) 34 { 35 // Check if it already exists for that chanid... 36 MSqlQuery query(MSqlQuery::InitCon()); 37 query.prepare( 38 "SELECT channelgroup.id " 39 "FROM channelgroup " 40 "WHERE channelgroup.chanid = :CHANID AND " 41 "channelgroup.grpid = :GRPID " 42 "LIMIT 1"); 43 query.bindValue(":CHANID", chanid); 44 query.bindValue(":GRPID", changrpid); 45 46 if (!query.exec() || !query.isActive()) 47 { 48 MythDB::DBError("ChannelGroup::ToggleChannel", query); 49 return false; 50 } 51 else if ((query.size() > 0) && delete_chan) 52 { 53 // We have a record...Remove it to toggle... 54 query.next(); 55 QString id = query.value(0).toString(); 56 query.prepare( 57 QString("DELETE FROM channelgroup " 58 "WHERE id = '%1'").arg(id)); 59 query.exec(); 60 VERBOSE(VB_IMPORTANT, LOC + QString("Removing channel with id=%1.").arg(id)); 61 } 62 else if (query.size() == 0) 63 { 64 // We have no record...Add one to toggle... 65 query.prepare( 66 QString("INSERT INTO channelgroup (chanid,grpid) " 67 "VALUES ('%1','%2')").arg(chanid).arg(changrpid)); 68 query.exec(); 69 VERBOSE(VB_IMPORTANT, LOC + QString("Adding channel %1 to group %2.").arg(chanid).arg(changrpid)); 70 } 71 72 return true; 73 } 74 75 ChannelGroupList ChannelGroup::GetChannelGroups(void) 76 { 77 ChannelGroupList list; 78 79 MSqlQuery query(MSqlQuery::InitCon()); 80 81 QString qstr = "SELECT grpid, name FROM channelgroupnames"; 82 83 query.prepare(qstr); 84 85 if (!query.exec() || !query.isActive()) 86 MythDB::DBError("ChannelGroup::GetChannelGroups", query); 87 else 88 { 89 while (query.next()) 90 { 91 ChannelGroupItem group(query.value(0).toUInt(), 92 query.value(1).toString()); 93 list.push_back(group); 94 } 95 } 96 97 stable_sort(list.begin(), list.end(), lt_group); 98 99 return list; 100 } 101 102 // Cycle through the available groups, then all channels 103 // Will cycle through to end then return -1 104 // To signify all channels. 105 int ChannelGroup::GetNextChannelGroup(const ChannelGroupList &sorted, int grpid) 106 { 107 // If no groups return -1 for all channels 108 if (sorted.empty()) 109 return -1; 110 111 // If grpid is all channels (-1), then return the first grpid 112 if (grpid == -1) 113 return sorted[0].grpid; 114 115 ChannelGroupList::const_iterator it = find(sorted.begin(), sorted.end(), grpid); 116 117 // If grpid is not in the list, return -1 for all channels 118 if (it == sorted.end()) 119 return -1; 120 121 ++it; 122 123 // If we reached the end, the next option is all channels (-1) 124 if (it == sorted.end()) 125 return -1; 126 127 return it->grpid; 128 } 129 130 QString ChannelGroup::GetChannelGroupName(const ChannelGroupList &sorted, int grpid) 131 { 132 // All Channels 133 if (grpid == -1) 134 return "All Channels"; 135 136 ChannelGroupList::const_iterator it = find(sorted.begin(), sorted.end(), grpid); 137 138 // If grpid wasn't found, return blank. 139 if (it == sorted.end()) 140 return ""; 141 else 142 return it->name; 143 } -
libs/libmythtv/channelgroup.h
diff -Naurp -x '*.orig' mythtv-orig/libs/libmythtv/channelgroup.h mythtv/libs/libmythtv/channelgroup.h
old new 1 #ifndef CHANNELGROUP_H 2 #define CHANNELGROUP_H 3 4 class ChannelGroupItem 5 { 6 public: 7 ChannelGroupItem(const ChannelGroupItem&); 8 ChannelGroupItem(const uint _grpid, 9 const QString &_name) : 10 grpid(_grpid), name(_name) {} 11 12 bool operator == (uint _grpid) const 13 { return grpid == _grpid; } 14 15 ChannelGroupItem& operator=(const ChannelGroupItem&); 16 17 public: 18 uint grpid; 19 QString name; 20 }; 21 typedef vector<ChannelGroupItem> ChannelGroupList; 22 23 /** \class ChannelGroup 24 */ 25 class MPUBLIC ChannelGroup 26 { 27 public: 28 // ChannelGroup 29 static ChannelGroupList GetChannelGroups(void); 30 static bool ToggleChannel(uint chanid,int changrpid, int delete_chan); 31 static int GetNextChannelGroup(const ChannelGroupList &sorted, int grpid); 32 static QString GetChannelGroupName(const ChannelGroupList &sorted, int grpid); 33 34 35 private: 36 37 }; 38 39 #endif -
libs/libmythtv/channelgroupsettings.cpp
diff -Naurp -x '*.orig' mythtv-orig/libs/libmythtv/channelgroupsettings.cpp mythtv/libs/libmythtv/channelgroupsettings.cpp
old new 1 #include "mythcontext.h" 2 #include "libmythdb/mythdbcon.h" 3 #include <qsqldatabase.h> 4 #include <qcursor.h> 5 #include <qlayout.h> 6 #include <iostream> 7 #include "mythstorage.h" 8 #include "mythdb.h" 9 #include "channelutil.h" 10 #include "channelgroup.h" 11 #include "channelgroupsettings.h" 12 13 #define LOC QString("Channel Group Settings: ") 14 #define LOC_ERR QString("Channel Group Settings, Error: ") 15 16 // Storage class for channel group editor in settings 17 class ChannelGroupStorage : public Storage 18 { 19 public: 20 ChannelGroupStorage(Setting *_setting, 21 uint _chanid, QString _grpname) : 22 setting(_setting), chanid(_chanid), grpname(_grpname) {} 23 virtual ~ChannelGroupStorage() {}; 24 25 virtual void Load(void); 26 virtual void Save(void); 27 virtual void Save(QString destination); 28 29 protected: 30 Setting *setting; 31 uint chanid; 32 QString grpname; 33 int grpid; 34 }; 35 36 void ChannelGroupStorage::Load(void) 37 { 38 setting->setValue("0"); 39 setting->setUnchanged(); 40 41 MSqlQuery query(MSqlQuery::InitCon()); 42 43 QString qstr = "SELECT grpid FROM channelgroupnames WHERE name = :GRPNAME"; 44 45 query.prepare(qstr); 46 query.bindValue(":GRPNAME", grpname); 47 48 if (!query.exec() || !query.isActive()) 49 MythDB::DBError("ChannelGroupStorage::Load", query); 50 else 51 { 52 query.next(); 53 grpid = query.value(0).toUInt(); 54 55 qstr = "SELECT * FROM channelgroup WHERE grpid = :GRPID AND chanid = :CHANID"; 56 query.prepare(qstr); 57 query.bindValue(":GRPID", grpid); 58 query.bindValue(":CHANID", chanid); 59 60 if (!query.exec() || !query.isActive()) 61 MythDB::DBError("ChannelGroupStorage::Load", query); 62 else if (query.size() > 0) 63 setting->setValue("1"); 64 } 65 } 66 67 void ChannelGroupStorage::Save(void) 68 { 69 if (!setting->isChanged()) 70 return; 71 72 QString value = setting->getValue(); 73 74 if (value == "1") 75 ChannelGroup::ToggleChannel(chanid, grpid, false); 76 else 77 ChannelGroup::ToggleChannel(chanid, grpid, true); 78 } 79 80 void ChannelGroupStorage::Save(QString destination) 81 { 82 Save(); 83 } 84 85 class ChannelCheckBox : public CheckBoxSetting, public ChannelGroupStorage 86 { 87 public: 88 ChannelCheckBox(const ChannelGroupConfig& _parent, const uint chanid, const QString channum, 89 const QString channame, const QString grpname): 90 CheckBoxSetting(this), 91 ChannelGroupStorage(this, chanid, grpname) 92 { 93 setLabel(QString("%1 %2").arg(channum).arg(channame)); 94 setHelpText(QObject::tr("Select/Unselect channels for this channel group")); 95 }; 96 }; 97 98 ChannelGroupConfig::ChannelGroupConfig(QString _name) 99 : name(_name) 100 { 101 VerticalConfigurationGroup *cgroup; 102 HorizontalConfigurationGroup *columns; 103 104 DBChanList chanlist = ChannelUtil::GetChannels(0, true, "channum, callsign"); 105 ChannelUtil::SortChannels(chanlist, "channum", true); 106 107 DBChanList::iterator it = chanlist.begin(); 108 int i,j = 0; 109 int p = 1; 110 int pages = (int)((float)chanlist.size() / 8.0 / 3.0 + 0.5); 111 112 do 113 { 114 columns = new HorizontalConfigurationGroup(false,false,false,false); 115 columns->setLabel(getName() + " " + 116 QObject::tr("Channel Group - Page ") + QString("%1").arg(p) + 117 QObject::tr("of") + QString("%1").arg(pages)); 118 119 for (j = 0; ((j < 3) && (it < chanlist.end())); ++j) 120 { 121 cgroup = new VerticalConfigurationGroup(false,false,false,false); 122 123 for (i = 0; ((i < 8) && (it < chanlist.end())); ++i) 124 { 125 cgroup->addChild(new ChannelCheckBox(*this, it->chanid, it->channum, it->name, _name)); 126 ++it; 127 } 128 columns->addChild(cgroup); 129 } 130 131 ++p; 132 addChild(columns); 133 } while (it < chanlist.end()); 134 135 } 136 137 ChannelGroupEditor::ChannelGroupEditor(void) : 138 listbox(new ListBoxSetting(this)), lastValue("__CREATE_NEW_GROUP__") 139 { 140 listbox->setLabel(tr("Channel Groups")); 141 addChild(listbox); 142 } 143 144 void ChannelGroupEditor::open(QString name) 145 { 146 lastValue = name; 147 bool created = false; 148 149 if (name == "__CREATE_NEW_GROUP__") 150 { 151 name = ""; 152 153 bool ok = MythPopupBox::showGetTextPopup(gContext->GetMainWindow(), 154 tr("Create New Channel Group"), 155 tr("Enter group name or press SELECT to enter text via the " 156 "On Screen Keyboard"), name); 157 if (!ok) 158 return; 159 160 MSqlQuery query(MSqlQuery::InitCon()); 161 query.prepare("INSERT INTO channelgroupnames (name) VALUES (:NAME);"); 162 query.bindValue(":NAME", name); 163 if (!query.exec()) 164 MythDB::DBError("ChannelGroupEditor::open", query); 165 else 166 created = true; 167 } 168 169 ChannelGroupConfig group(name); 170 171 if (group.exec() == QDialog::Accepted || !created) 172 lastValue = name; 173 174 }; 175 176 void ChannelGroupEditor::doDelete(void) 177 { 178 QString name = listbox->getValue(); 179 if (name == "__CREATE_NEW_GROUP__") 180 return; 181 182 QString message = tr("Delete '%1' Channel group?").arg(name); 183 184 DialogCode value = MythPopupBox::Show2ButtonPopup( 185 gContext->GetMainWindow(), 186 "", message, 187 tr("Yes, delete group"), 188 tr("No, Don't delete group"), kDialogCodeButton1); 189 190 if (kDialogCodeButton0 == value) 191 { 192 MSqlQuery query(MSqlQuery::InitCon()); 193 194 // Find out channel group id 195 query.prepare("SELECT grpid FROM channelgroupnames WHERE name = :NAME;"); 196 query.bindValue(":NAME", name); 197 if (!query.exec()) 198 MythDB::DBError("ChannelGroupEditor::doDelete", query); 199 query.next(); 200 uint grpid = query.value(0).toUInt(); 201 202 // Delete channels from this group 203 query.prepare("DELETE FROM channelgroup WHERE grpid = :GRPID;"); 204 query.bindValue(":GRPID", grpid); 205 if (!query.exec()) 206 MythDB::DBError("ChannelGroupEditor::doDelete", query); 207 208 // Now delete the group from channelgroupnames 209 query.prepare("DELETE FROM channelgroupnames WHERE name = :NAME;"); 210 query.bindValue(":NAME", name); 211 if (!query.exec()) 212 MythDB::DBError("ChannelGroupEditor::doDelete", query); 213 214 lastValue = "__CREATE_NEW_GROUP__"; 215 Load(); 216 } 217 218 listbox->setFocus(); 219 } 220 221 void ChannelGroupEditor::Load(void) 222 { 223 listbox->clearSelections(); 224 225 ChannelGroupList changrplist; 226 227 changrplist = ChannelGroup::GetChannelGroups(); 228 229 ChannelGroupList::iterator it; 230 231 for (it = changrplist.begin(); it < changrplist.end(); ++it) 232 listbox->addSelection(it->name); 233 234 listbox->addSelection(tr("(Create new group)"), "__CREATE_NEW_GROUP__"); 235 236 listbox->setValue(lastValue); 237 } 238 239 DialogCode ChannelGroupEditor::exec(void) 240 { 241 while (ConfigurationDialog::exec() == kDialogCodeAccepted) 242 open(listbox->getValue()); 243 244 return kDialogCodeRejected; 245 } 246 247 MythDialog* ChannelGroupEditor::dialogWidget(MythMainWindow* parent, 248 const char* widgetName) 249 { 250 dialog = ConfigurationDialog::dialogWidget(parent, widgetName); 251 connect(dialog, SIGNAL(menuButtonPressed()), this, SLOT(doDelete())); 252 connect(dialog, SIGNAL(deleteButtonPressed()), this, SLOT(doDelete())); 253 return dialog; 254 } -
libs/libmythtv/channelgroupsettings.h
diff -Naurp -x '*.orig' mythtv-orig/libs/libmythtv/channelgroupsettings.h mythtv/libs/libmythtv/channelgroupsettings.h
old new 1 #ifndef CHANNELGROUPSETTINGS_H 2 #define CHANNELGROUPSETTINGS_H 3 4 #include "libmyth/settings.h" 5 6 class MPUBLIC ChannelGroupConfig: public ConfigurationWizard 7 { 8 public: 9 ChannelGroupConfig(QString _name); 10 QString getName(void) const { return name; } 11 12 private: 13 QString name; 14 }; 15 16 class MPUBLIC ChannelGroupEditor : public QObject, public ConfigurationDialog 17 { 18 Q_OBJECT 19 20 public: 21 ChannelGroupEditor(void); 22 virtual DialogCode exec(void); 23 virtual void Load(void); 24 virtual void Save(void) { }; 25 virtual void Save(QString) { }; 26 virtual MythDialog* dialogWidget(MythMainWindow* parent, 27 const char* widgetName=0); 28 29 protected slots: 30 void open(QString name); 31 void doDelete(void); 32 33 protected: 34 ListBoxSetting *listbox; 35 QString lastValue; 36 }; 37 38 #endif -
libs/libmythtv/channelutil.cpp
diff -Naurp -x '*.orig' mythtv-orig/libs/libmythtv/channelutil.cpp mythtv/libs/libmythtv/channelutil.cpp
old new bool ChannelUtil::GetChannelSettings(int 1570 1570 return true; 1571 1571 } 1572 1572 1573 DBChanList ChannelUtil::GetChannels(uint sourceid, bool vis_only, QString grp )1573 DBChanList ChannelUtil::GetChannels(uint sourceid, bool vis_only, QString grp, int changrpid) 1574 1574 { 1575 1575 DBChanList list; 1576 QMap<uint,uint> favorites;1576 1577 1577 MSqlQuery query(MSqlQuery::InitCon()); 1578 query.prepare(1579 "SELECT chanid, favid "1580 "FROM favorites");1581 if (!query.exec() || !query.isActive())1582 MythDB::DBError("get channels -- favorites", query);1583 else1584 {1585 while (query.next())1586 favorites[query.value(0).toUInt()] = query.value(1).toUInt();1587 }1588 1578 1589 1579 QString qstr = 1590 "SELECT channum, callsign, chan id, "1580 "SELECT channum, callsign, channel.chanid, " 1591 1581 " atsc_major_chan, atsc_minor_chan, " 1592 1582 " name, icon, mplexid, visible " 1593 1583 "FROM channel "; 1594 1584 1585 // Select only channels from the specified channel group 1586 if (changrpid > -1) 1587 qstr += QString(",channelgroup "); 1588 1595 1589 if (sourceid) 1596 1590 qstr += QString("WHERE sourceid='%1' ").arg(sourceid); 1597 1591 else … … DBChanList ChannelUtil::GetChannels(uint 1599 1593 "WHERE cardinput.sourceid = channel.sourceid AND " 1600 1594 " cardinput.cardid = capturecard.cardid "; 1601 1595 1596 if (changrpid > -1) 1597 { 1598 qstr += QString("AND channel.chanid = channelgroup.chanid " 1599 "AND channelgroup.grpid ='%1' ").arg(changrpid); 1600 } 1601 1602 1602 if (vis_only) 1603 1603 qstr += "AND visible=1 "; 1604 1604 … … DBChanList ChannelUtil::GetChannels(uint 1623 1623 query.value(2).toUInt(), /* chanid */ 1624 1624 query.value(3).toUInt(), /* ATSC major */ 1625 1625 query.value(4).toUInt(), /* ATSC minor */ 1626 favorites[query.value(2).toUInt()], /* favid */1627 1626 query.value(7).toUInt(), /* mplexid */ 1628 1627 query.value(8).toBool(), /* visible */ 1629 1628 query.value(5).toString(), /* name */ … … uint ChannelUtil::GetNextChannel( 1806 1805 (mplexid_restriction && 1807 1806 (mplexid_restriction != it->mplexid)))); 1808 1807 } 1809 else if ( CHANNEL_DIRECTION_UP == direction)1808 else if ((CHANNEL_DIRECTION_UP == direction) || (CHANNEL_DIRECTION_FAVORITE == direction)) 1810 1809 { 1811 1810 do 1812 1811 { … … uint ChannelUtil::GetNextChannel( 1819 1818 (mplexid_restriction && 1820 1819 (mplexid_restriction != it->mplexid)))); 1821 1820 } 1822 else if (CHANNEL_DIRECTION_FAVORITE == direction)1823 {1824 do1825 {1826 it++;1827 if (it == sorted.end())1828 it = sorted.begin();1829 }1830 while ((it != start) &&1831 (!it->favorite ||1832 (skip_non_visible && !it->visible) ||1833 (mplexid_restriction &&1834 (mplexid_restriction != it->mplexid))));1835 }1836 1821 1837 1822 return it->chanid; 1838 1823 } -
libs/libmythtv/channelutil.h
diff -Naurp -x '*.orig' mythtv-orig/libs/libmythtv/channelutil.h mythtv/libs/libmythtv/channelutil.h
old new class MPUBLIC ChannelUtil 168 168 static QString GetVideoFilters(uint sourceid, const QString &channum) 169 169 { return GetChannelValueStr("videofilters", sourceid, channum); } 170 170 171 static DBChanList GetChannels(uint srcid, bool vis_only, QString grp="" );171 static DBChanList GetChannels(uint srcid, bool vis_only, QString grp="", int changrpid=-1); 172 172 static void SortChannels(DBChanList &list, const QString &order, 173 173 bool eliminate_duplicates = false); 174 174 static void EliminateDuplicateChanNum(DBChanList &list); -
libs/libmythtv/dbchannelinfo.cpp
diff -Naurp -x '*.orig' mythtv-orig/libs/libmythtv/dbchannelinfo.cpp mythtv/libs/libmythtv/dbchannelinfo.cpp
old new DBChannel::DBChannel(const DBChannel &ot 16 16 DBChannel::DBChannel( 17 17 const QString &_channum, const QString &_callsign, 18 18 uint _chanid, uint _major_chan, uint _minor_chan, 19 uint _ favorite, uint _mplexid, bool _visible,19 uint _mplexid, bool _visible, 20 20 const QString &_name, const QString &_icon) : 21 21 channum(_channum), 22 22 callsign(_callsign), chanid(_chanid), 23 23 major_chan(_major_chan), minor_chan(_minor_chan), 24 favorite(_favorite),mplexid(_mplexid), visible(_visible),24 mplexid(_mplexid), visible(_visible), 25 25 name(_name), icon(_icon) 26 26 { 27 27 channum.detach(); … … DBChannel &DBChannel::operator=(const DB 39 39 chanid = other.chanid; 40 40 major_chan = other.major_chan; 41 41 minor_chan = other.minor_chan; 42 favorite = other.favorite;43 42 mplexid = (other.mplexid == 32767) ? 0 : other.mplexid; 44 43 visible = other.visible; 45 44 name = other.name; name.detach(); -
libs/libmythtv/dbchannelinfo.h
diff -Naurp -x '*.orig' mythtv-orig/libs/libmythtv/dbchannelinfo.h mythtv/libs/libmythtv/dbchannelinfo.h
old new class MPUBLIC DBChannel 21 21 DBChannel(const DBChannel&); 22 22 DBChannel(const QString &_channum, const QString &_callsign, 23 23 uint _chanid, uint _major_chan, uint _minor_chan, 24 uint _ favorite, uint _mplexid, bool _visible,24 uint _mplexid, bool _visible, 25 25 const QString &_name, const QString &_icon); 26 26 DBChannel& operator=(const DBChannel&); 27 27 … … class MPUBLIC DBChannel 34 34 uint chanid; 35 35 uint major_chan; 36 36 uint minor_chan; 37 uint favorite;38 37 uint mplexid; 39 38 bool visible; 40 39 QString name; -
libs/libmythtv/guidegrid.cpp
diff -Naurp -x '*.orig' mythtv-orig/libs/libmythtv/guidegrid.cpp mythtv/libs/libmythtv/guidegrid.cpp
old new using namespace std; 21 21 #include "libmyth/mythcontext.h" 22 22 #include "libmythdb/mythdbcon.h" 23 23 #include "libmythdb/mythverbose.h" 24 #include "guidegrid.h"25 24 #include "infostructs.h" 26 25 #include "programinfo.h" 27 26 #include "scheduledrecording.h" … … using namespace std; 34 33 #include "util.h" 35 34 #include "remoteutil.h" 36 35 #include "channelutil.h" 36 #include "guidegrid.h" 37 37 #include "cardutil.h" 38 38 39 39 #define LOC QString("GuideGrid: ") … … DBChanList GuideGrid::Run( 161 161 const QString &channum, 162 162 bool thread, 163 163 TV *player, 164 bool allowsecondaryepg) 164 bool allowsecondaryepg, 165 int *changrpid) 165 166 { 166 167 DBChanList channel_changed; 168 int channel_group = -1; 169 170 if (changrpid != NULL) 171 channel_group = *changrpid; 167 172 168 173 //if (thread) 169 174 // qApp->lock(); … … DBChanList GuideGrid::Run( 172 177 173 178 GuideGrid *gg = new GuideGrid(gContext->GetMainWindow(), 174 179 chanid, channum, 175 player, allowsecondaryepg, "guidegrid"); 180 player, allowsecondaryepg, "guidegrid", 181 channel_group); 176 182 177 183 gg->Show(); 178 184 … … DBChanList GuideGrid::Run( 199 205 //if (thread) 200 206 // qApp->lock(); 201 207 208 if (changrpid != NULL) 209 *changrpid = gg->GetChanGrp(); 210 202 211 delete gg; 203 212 204 213 gContext->removeCurrentLocation(); … … DBChanList GuideGrid::Run( 212 221 GuideGrid::GuideGrid(MythMainWindow *parent, 213 222 uint chanid, QString channum, 214 223 TV *player, bool allowsecondaryepg, 215 const char *name ) :224 const char *name, int changrpid) : 216 225 MythDialog(parent, name), 217 226 jumpToChannelLock(QMutex::Recursive), 218 227 jumpToChannel(NULL), … … GuideGrid::GuideGrid(MythMainWindow *par 223 232 DISPLAY_TIMES = 30; 224 233 int maxchannel = 0; 225 234 m_currentStartChannel = 0; 235 m_changrpid = changrpid; 236 m_changrplist = ChannelGroup::GetChannelGroups(); 226 237 227 238 m_player = player; 228 239 … … GuideGrid::GuideGrid(MythMainWindow *par 237 248 infoRect = QRect(0, 0, 0, 0); 238 249 curInfoRect = QRect(0, 0, 0, 0); 239 250 videoRect = QRect(0, 0, 0, 0); 251 changrpRect = QRect(0, 0, 0, 0); 240 252 241 253 jumpToChannelEnabled = 242 254 gContext->GetNumSetting("EPGEnableJumpToChannel", 1); … … GuideGrid::GuideGrid(MythMainWindow *par 254 266 if (m_player && m_player->IsRunning() && !allowsecondaryepg) 255 267 videoRect = QRect(0, 0, 1, 1); 256 268 257 showFavorites = gContext->GetNumSetting("EPGShowFavorites", 0);258 269 gridfilltype = gContext->GetNumSetting("EPGFillType", UIGuideType::Alpha); 259 270 if (gridfilltype < (int)UIGuideType::Alpha) 260 271 { // update old settings to new fill types … … GuideGrid::GuideGrid(MythMainWindow *par 311 322 container->SetDrawFontShadow(false); 312 323 } 313 324 325 container = theme->GetSet("channel_group"); 326 if (container) 327 { 328 UITextType *type = (UITextType *)container->GetType("changroup"); 329 QString changroup; 330 331 changroup = ChannelGroup::GetChannelGroupName(m_changrplist, m_changrpid); 332 333 if (type) 334 type->SetText(changroup); 335 } 336 314 337 channelOrdering = gContext->GetSetting("ChannelOrdering", "channum"); 315 338 dateformat = gContext->GetSetting("ShortDateFormat", "ddd d"); 316 339 unknownTitle = gContext->GetSetting("UnknownTitle", "Unknown"); … … void GuideGrid::parseContainer(QDomEleme 687 710 curInfoRect = area; 688 711 if (name.toLower() == "current_video") 689 712 videoRect = area; 713 if (name.toLower() == "channel_group") 714 changrpRect = area; 690 715 } 691 716 692 717 PixmapChannel *GuideGrid::GetChannelInfo(uint chan_idx, int sel) … … void GuideGrid::fillChannelInfos(bool go 885 910 m_channelInfoIdx.clear(); 886 911 m_currentStartChannel = 0; 887 912 888 DBChanList channels = ChannelUtil::GetChannels(0, true );913 DBChanList channels = ChannelUtil::GetChannels(0, true, "", m_changrpid); 889 914 ChannelUtil::SortChannels(channels, channelOrdering, false); 890 915 891 if (showFavorites)892 {893 DBChanList tmp;894 for (uint i = 0; i < channels.size(); i++)895 {896 if (channels[i].favorite)897 tmp.push_back(channels[i]);898 }899 900 if (!tmp.empty())901 channels = tmp;902 }903 904 916 typedef vector<uint> uint_list_t; 905 917 QMap<QString,uint_list_t> channum_to_index_map; 906 918 QMap<QString,uint_list_t> callsign_to_index_map; … … void GuideGrid::fillProgramInfos(void) 1116 1128 } 1117 1129 } 1118 1130 1131 void GuideGrid::fillChanGroupInfo(void) 1132 { 1133 LayerSet *container = NULL; 1134 UITextType *type = NULL; 1135 1136 container = theme->GetSet("channel_group"); 1137 if (container) 1138 { 1139 type = (UITextType *)container->GetType("changroup"); 1140 QString changroup; 1141 1142 changroup = ChannelGroup::GetChannelGroupName(m_changrplist, m_changrpid); 1143 1144 if (type) 1145 type->SetText(changroup); 1146 } 1147 } 1148 1119 1149 void GuideGrid::fillProgramRowInfos(unsigned int row) 1120 1150 { 1121 1151 LayerSet *container = NULL; … … void GuideGrid::paintEvent(QPaintEvent * 1396 1426 paintPrograms(&p); 1397 1427 if (r.intersects(curInfoRect)) 1398 1428 paintCurrentInfo(&p); 1429 if (r.intersects(changrpRect)) 1430 paintChanGroupInfo(&p); 1399 1431 1400 1432 // if jumpToChannel has its own rect, use that; 1401 1433 // otherwise use the date's rect … … void GuideGrid::paintCurrentInfo(QPainte 1518 1550 p->drawPixmap(dr.topLeft(), pix); 1519 1551 } 1520 1552 1553 void GuideGrid::paintChanGroupInfo(QPainter *p) 1554 { 1555 QRect dr = changrpRect; 1556 QPixmap pix(dr.size()); 1557 pix.fill(this, dr.topLeft()); 1558 QPainter tmp(&pix); 1559 1560 LayerSet *container = NULL; 1561 container = theme->GetSet("channel_group"); 1562 if (container) 1563 { 1564 container->Draw(&tmp, 1, m_context); 1565 container->Draw(&tmp, 2, m_context); 1566 container->Draw(&tmp, 3, m_context); 1567 container->Draw(&tmp, 4, m_context); 1568 container->Draw(&tmp, 5, m_context); 1569 container->Draw(&tmp, 6, m_context); 1570 container->Draw(&tmp, 7, m_context); 1571 container->Draw(&tmp, 8, m_context); 1572 } 1573 tmp.end(); 1574 p->drawPixmap(dr.topLeft(), pix); 1575 } 1576 1521 1577 bool GuideGrid::paintChannels(QPainter *p) 1522 1578 { 1523 1579 QRect cr = channelRect; … … bool GuideGrid::paintChannels(QPainter * 1603 1659 } 1604 1660 1605 1661 QString tmpChannelFormat = channelFormat; 1606 if (chinfo->favorite > 0)1607 {1608 tmpChannelFormat.insert(1609 tmpChannelFormat.indexOf('<'), "<MARK:fav>");1610 }1611 1662 1612 1663 if (unavailable) 1613 1664 { … … bool GuideGrid::paintChannels(QPainter * 1643 1694 } 1644 1695 } 1645 1696 1697 if (m_channelInfos.size() == 0) 1698 { 1699 // if the user has selected a channel group with no channels 1700 // Reset the text and icon. This will display one blank line 1701 // to show that the channel group has no channels 1702 if (type) 1703 { 1704 type->SetText(0, ""); 1705 type->ResetImage(0); 1706 } 1707 } 1708 1646 1709 if (container) 1647 1710 { 1648 1711 container->Draw(&tmp, 1, m_context); … … void GuideGrid::paintInfo(QPainter *p) 1778 1841 1779 1842 void GuideGrid::toggleGuideListing() 1780 1843 { 1781 showFavorites = (!showFavorites); 1782 generateListings(); 1844 int oldchangrpid = m_changrpid; 1845 1846 m_changrpid = ChannelGroup::GetNextChannelGroup(m_changrplist, oldchangrpid); 1847 1848 if (oldchangrpid != m_changrpid) 1849 generateListings(); 1850 1851 fillChanGroupInfo(); 1852 update(changrpRect); 1783 1853 } 1784 1854 1785 1855 void GuideGrid::generateListings() … … void GuideGrid::generateListings() 1798 1868 update(fullRect); 1799 1869 } 1800 1870 1871 int GuideGrid::SelectChannelGroup() 1872 { 1873 if (m_changrplist.empty()) 1874 { 1875 MythPopupBox::showOkPopup(gContext->GetMainWindow(), "", 1876 "You don't have any channel groups defined"); 1877 1878 return -1; 1879 } 1880 1881 MythPopupBox *popup = new MythPopupBox(gContext->GetMainWindow(), "SelectChannelGroup Popup"); 1882 popup->addLabel("Select Channel Group"); 1883 1884 for (uint i = 0; i < m_changrplist.size(); i++) 1885 popup->addButton(m_changrplist[i].name); 1886 1887 popup->addButton(tr("Cancel"))->setFocus(); 1888 1889 DialogCode result = popup->ExecPopup(); 1890 1891 popup->deleteLater(); 1892 1893 // If the user cancelled, return a special value 1894 if (result == MythDialog::Rejected) 1895 return -1; 1896 else 1897 return m_changrplist[result - kDialogCodeListStart].grpid; 1898 } 1899 1801 1900 void GuideGrid::toggleChannelFavorite() 1802 1901 { 1803 MSqlQuery query(MSqlQuery::InitCon()); 1902 int grpid; 1903 1904 if (m_changrpid == -1) 1905 { 1906 grpid = SelectChannelGroup(); 1907 1908 if (grpid == -1) 1909 return; 1910 } 1911 else 1912 grpid = m_changrpid; 1804 1913 1805 1914 // Get current channel id, and make sure it exists... 1806 1915 int chanNum = m_currentRow + m_currentStartChannel; … … void GuideGrid::toggleChannelFavorite() 1812 1921 chanNum = 0; 1813 1922 1814 1923 PixmapChannel *ch = GetChannelInfo(chanNum); 1815 uint favid = ch->favorite;1816 1924 uint chanid = ch->chanid; 1817 1925 1818 if (favid > 0) 1819 { 1820 query.prepare("DELETE FROM favorites WHERE favid = :FAVID ;"); 1821 query.bindValue(":FAVID", favid); 1822 query.exec(); 1823 } 1824 else 1825 { 1826 // We have no favorites record...Add one to toggle... 1827 query.prepare("INSERT INTO favorites (chanid) VALUES (:FAVID);"); 1828 query.bindValue(":FAVID", chanid); 1829 query.exec(); 1830 } 1831 1832 if (showFavorites) 1926 if (m_changrpid == -1) 1927 // If currently viewing all channels, allow to add only not delete 1928 ChannelGroup::ToggleChannel(chanid, grpid, false); 1929 else 1930 // Only allow delete if viewing the favorite group in question 1931 ChannelGroup::ToggleChannel(chanid, grpid, true); 1932 1933 // If viewing favorites, refresh because a channel was removed 1934 if (m_changrpid != -1) 1833 1935 generateListings(); 1834 else1835 {1836 int maxchannel = 0;1837 DISPLAY_CHANS = desiredDisplayChans;1838 fillChannelInfos(false);1839 maxchannel = max((int)GetChannelCount() - 1, 0);1840 DISPLAY_CHANS = min(DISPLAY_CHANS, maxchannel + 1);1841 1842 repaint(channelRect);1843 }1844 1936 } 1845 1937 1846 1938 void GuideGrid::cursorLeft() -
libs/libmythtv/guidegrid.h
diff -Naurp -x '*.orig' mythtv-orig/libs/libmythtv/guidegrid.h mythtv/libs/libmythtv/guidegrid.h
old new 16 16 #include "uitypes.h" 17 17 #include "xmlparse.h" 18 18 #include "libmythtv/programinfo.h" 19 #include "libmythtv/channelgroup.h" 19 20 #include "channelutil.h" 20 21 21 22 using namespace std; … … class MPUBLIC GuideGrid : public MythDia 81 82 const QString &startChanNum, 82 83 bool thread = false, 83 84 TV *player = NULL, 84 bool allowsecondaryepg = true); 85 bool allowsecondaryepg = true, 86 int *changrpid = NULL); 85 87 86 88 DBChanList GetSelection(void) const; 87 89 … … class MPUBLIC GuideGrid : public MythDia 131 133 GuideGrid(MythMainWindow *parent, 132 134 uint chanid = 0, QString channum = "", 133 135 TV *player = NULL, bool allowsecondaryepg = true, 134 const char *name = "GuideGrid"); 136 const char *name = "GuideGrid", 137 int changrpid=-1); 135 138 ~GuideGrid(); 136 139 140 int GetChanGrp(void) {return m_changrpid;} 137 141 void paintEvent(QPaintEvent *); 138 142 139 143 private slots: … … class MPUBLIC GuideGrid : public MythDia 152 156 void paintPrograms(QPainter *); 153 157 void paintCurrentInfo(QPainter *); 154 158 void paintInfo(QPainter *); 159 void paintChanGroupInfo(QPainter *p); 155 160 156 161 void resizeImage(QPixmap *, QString); 157 162 void LoadWindow(QDomElement &); … … class MPUBLIC GuideGrid : public MythDia 176 181 QRect infoRect; 177 182 QRect curInfoRect; 178 183 QRect videoRect; 184 QRect changrpRect; 179 185 180 186 void fillChannelInfos(bool gotostartchannel = true); 181 187 int FindChannel(uint chanid, const QString &channum, … … class MPUBLIC GuideGrid : public MythDia 185 191 186 192 void fillProgramInfos(void); 187 193 void fillProgramRowInfos(unsigned int row); 194 195 void fillChanGroupInfo(void); 188 196 189 197 void setStartChannel(int newStartChannel); 190 198 191 199 void createProgramLabel(int, int); 200 201 int SelectChannelGroup(); 192 202 193 203 PixmapChannel *GetChannelInfo(uint chan_idx, int sel = -1); 194 204 const PixmapChannel *GetChannelInfo(uint chan_idx, int sel = -1) const; … … class MPUBLIC GuideGrid : public MythDia 218 228 int m_currentCol; 219 229 220 230 bool selectState; 221 bool showFavorites;222 231 bool sortReverse; 223 232 QString channelFormat; 224 233 … … class MPUBLIC GuideGrid : public MythDia 241 250 QTimer *videoRepaintTimer; 242 251 243 252 bool keyDown; 253 254 int m_changrpid; 255 ChannelGroupList m_changrplist; 244 256 245 257 QMutex jumpToChannelLock; 246 258 JumpToChannel *jumpToChannel; -
libs/libmythtv/libmythtv.pro
diff -Naurp -x '*.orig' mythtv-orig/libs/libmythtv/libmythtv.pro mythtv/libs/libmythtv/libmythtv.pro
old new HEADERS += playgroup.h prog 147 147 HEADERS += channeleditor.h channelsettings.h 148 148 HEADERS += previewgenerator.h transporteditor.h 149 149 HEADERS += importicons.h 150 HEADERS += channelgroup.h channelgroupsettings.h 150 151 151 152 SOURCES += programinfo.cpp proglist.cpp 152 153 SOURCES += RingBuffer.cpp avfringbuffer.cpp … … SOURCES += progdetails.cpp 169 170 SOURCES += channeleditor.cpp channelsettings.cpp 170 171 SOURCES += previewgenerator.cpp transporteditor.cpp 171 172 SOURCES += importicons.cpp 173 SOURCES += channelgroup.cpp channelgroupsettings.cpp 172 174 173 175 # DiSEqC 174 176 HEADERS += diseqc.h diseqcsettings.h -
libs/libmythtv/tv_play.cpp
diff -Naurp -x '*.orig' mythtv-orig/libs/libmythtv/tv_play.cpp mythtv/libs/libmythtv/tv_play.cpp
old new bool TV::StartTV (ProgramInfo *tvrec, bo 263 263 264 264 bool allowrerecord = tv->getAllowRerecord(); 265 265 bool deleterecording = tv->getRequestDelete(); 266 267 tv->SaveChannelGroup(); 266 268 267 269 delete tv; 268 270 … … void TV::InitKeys(void) 325 327 "in the program guide", "0"); 326 328 REG_KEY("TV Frontend", "GUIDE", "Show the Program Guide", "S"); 327 329 REG_KEY("TV Frontend", "FINDER", "Show the Program Finder", "#"); 328 REG_KEY("TV Frontend", "NEXTFAV", " Toggle showing all channels or just"329 " favorites in the program guide.", "/");330 REG_KEY("TV Frontend", "NEXTFAV", "Cycle through channel groups and all channels " 331 "in the program guide.", "/,S"); 330 332 REG_KEY("TV Frontend", "CHANUPDATE", "Switch channels without exiting " 331 333 "guide in Live TV mode.", "X"); 332 334 REG_KEY("TV Frontend", "VOLUMEDOWN", "Volume down", "[,{,F10,Volume Down"); … … bool TV::Init(bool createWindow) 664 666 autoCommercialSkip = (enum commSkipMode)gContext->GetNumSetting( 665 667 "AutoCommercialSkip", CommSkipOff); 666 668 tryUnflaggedSkip = gContext->GetNumSetting("TryUnflaggedSkip", 0); 669 channel_group_id = gContext->GetNumSetting("ChannelGroupDefault", -1); 670 browse_changrp = gContext->GetNumSetting("BrowseChannelGroup", 0); 667 671 smartForward = gContext->GetNumSetting("SmartForward", 0); 668 672 stickykeys = gContext->GetNumSetting("StickyKeys"); 669 673 ff_rew_repos = gContext->GetNumSetting("FFRewReposTime", 100)/100.0; … … bool TV::Init(bool createWindow) 678 682 if (!feVBI.isEmpty()) 679 683 vbimode = VBIMode::Parse(gContext->GetSetting(feVBI)); 680 684 685 channel_group_id = gContext->GetNumSetting("ChannelGroupDefault", -1); 686 browse_changrp = gContext->GetNumSetting("BrowseChannelGroup", 0); 687 688 if (browse_changrp && (channel_group_id > -1)) 689 { 690 m_channellist = ChannelUtil::GetChannels(0, true, "channum, callsign", channel_group_id); 691 ChannelUtil::SortChannels(m_channellist, "channum", true); 692 } 693 694 m_changrplist = ChannelGroup::GetChannelGroups(); 695 681 696 if (createWindow) 682 697 { 683 698 MythMainWindow *mainWindow = gContext->GetMainWindow(); … … TV::~TV(void) 853 868 } 854 869 } 855 870 871 void TV::SaveChannelGroup(void) 872 { 873 int changrpid = gContext->GetNumSetting("ChannelGroupDefault", -1); 874 int remember_last_changrp = gContext->GetNumSetting("ChannelGroupRememberLast", 0); 875 876 if (remember_last_changrp && (changrpid != channel_group_id)) 877 gContext->SaveSetting("ChannelGroupDefault", channel_group_id); 878 } 879 856 880 TVState TV::GetState(void) const 857 881 { 858 882 if (InStateChange()) … … void TV::ToggleInputs(uint inputid) 4768 4792 4769 4793 void TV::ToggleChannelFavorite(void) 4770 4794 { 4771 activerecorder->ToggleChannelFavorite();4795 // activerecorder->ToggleChannelFavorite(); 4772 4796 } 4773 4797 4774 4798 void TV::ChangeChannel(int direction) 4775 4799 { 4776 4800 bool muted = false; 4777 4801 4802 if ((browse_changrp || (direction == CHANNEL_DIRECTION_FAVORITE)) && 4803 (channel_group_id > -1) && (direction != CHANNEL_DIRECTION_SAME)) 4804 { 4805 uint chanid; 4806 4807 // Collect channel info 4808 pbinfoLock.lock(); 4809 uint old_chanid = playbackinfo->chanid.toUInt(); 4810 pbinfoLock.unlock(); 4811 4812 chanid = ChannelUtil::GetNextChannel(m_channellist, old_chanid, 0, direction); 4813 4814 ChangeChannel(chanid, ""); 4815 return; 4816 } else if (direction == CHANNEL_DIRECTION_FAVORITE) 4817 direction = CHANNEL_DIRECTION_UP; 4818 4778 4819 if (activenvp && (activenvp == nvp)) 4779 4820 muted = activenvp->SetMuted(true); 4780 4821 … … void TV::doEditSchedule(int editType) 5898 5939 5899 5940 DBChanList changeChannel; 5900 5941 ProgramInfo *nextProgram = NULL; 5942 int changrpid = channel_group_id; 5901 5943 5902 5944 bool stayPaused = paused; 5903 5945 TV *player = NULL; … … void TV::doEditSchedule(int editType) 5916 5958 if (StateIsLiveTV(GetState())) 5917 5959 { 5918 5960 changeChannel = GuideGrid::Run(chanid, channum, false, 5919 player, allowsecondary );5961 player, allowsecondary, &changrpid); 5920 5962 } 5921 5963 else 5922 GuideGrid::Run(chanid, channum, false, player );5964 GuideGrid::Run(chanid, channum, false, player, true, &changrpid); 5923 5965 break; 5924 5966 } 5925 5967 case kScheduleProgramFinder: … … void TV::doEditSchedule(int editType) 5964 6006 exitPlayer = true; 5965 6007 delete nextProgram; 5966 6008 } 6009 5967 6010 // Resize the window back to the MythTV Player size 5968 6011 if (!using_gui_size_for_tv) 5969 6012 { … … void TV::doEditSchedule(int editType) 5974 6017 if (nvp && nvp->getVideoOutput()) 5975 6018 nvp->getVideoOutput()->ResizeForVideo(); 5976 6019 6020 // if channel group was changed in EPG update local info 6021 if ((changrpid != channel_group_id) && (editType == kScheduleProgramGuide)) 6022 { 6023 channel_group_id = changrpid; 6024 6025 if (browse_changrp) 6026 { 6027 VERBOSE(VB_IMPORTANT, LOC + 6028 QString("Reloading channel group list for %1").arg(channel_group_id)); 6029 6030 m_channellist = ChannelUtil::GetChannels(0, true, "channum, callsign", channel_group_id); 6031 ChannelUtil::SortChannels(m_channellist, "channum", true); 6032 } 6033 } 6034 5977 6035 // If user selected a new channel in the EPG, change to that channel 5978 6036 if (changeChannel.size()) 5979 6037 ChangeChannel(changeChannel); … … void TV::BrowseDispInfo(int direction) 6624 6682 { 6625 6683 if (!browsemode) 6626 6684 BrowseStart(); 6685 VERBOSE(VB_IMPORTANT,"In BrowseDispInfo"); 6686 // if browsing channel groups is enabled or direction if BROWSE_FAVORITES 6687 // Then pick the next channel in the channel group list to browse 6688 // If channel group is ALL CHANNELS (-1), then bypass picking from 6689 // the channel group list 6690 if ((browse_changrp || (direction == BROWSE_FAVORITE)) && 6691 (channel_group_id > -1) && (direction != BROWSE_SAME) && 6692 (direction != BROWSE_RIGHT) && (direction != BROWSE_LEFT)) 6693 { 6694 uint chanid; 6695 int dir; 6696 6697 if ( (direction == BROWSE_UP) || (direction == BROWSE_FAVORITE) ) 6698 dir = CHANNEL_DIRECTION_UP; 6699 else if (direction == BROWSE_DOWN) 6700 dir = CHANNEL_DIRECTION_DOWN; 6701 else // this should never happen, but just in case 6702 dir = direction; 6703 6704 chanid = ChannelUtil::GetNextChannel(m_channellist, browsechanid.toUInt(), 0, dir); 6705 VERBOSE(VB_IMPORTANT, QString("Get channel: %1").arg(chanid)); 6706 browsechanid = QString("%1").arg(chanid); 6707 browsechannum = QString::null; 6708 direction = BROWSE_SAME; 6709 } 6710 else if ((channel_group_id == -1) && (direction == BROWSE_FAVORITE)) 6711 direction = BROWSE_UP; 6627 6712 6628 6713 InfoMap infoMap; 6629 6714 QDateTime curtime = QDateTime::currentDateTime(); … … void TV::TreeMenuSelected(OSDListTreeTyp 7399 7484 } 7400 7485 else if (action == "GUIDE") 7401 7486 EditSchedule(kScheduleProgramGuide); 7487 else if (action.left(10) == "CHANGROUP_") 7488 processChanGroupEntry(action); 7402 7489 else if (action == "FINDER") 7403 7490 EditSchedule(kScheduleProgramFinder); 7404 7491 else if (action == "SCHEDULE") … … void TV::TreeMenuSelected(OSDListTreeTyp 7500 7587 } 7501 7588 } 7502 7589 7590 void TV::processChanGroupEntry(QString action) 7591 { 7592 if (action == "CHANGROUP_ALL_CHANNELS") 7593 channel_group_id = -1; 7594 else 7595 { 7596 action.remove("CHANGROUP_"); 7597 channel_group_id = action.toInt(); 7598 7599 if (browse_changrp) 7600 { 7601 m_channellist = ChannelUtil::GetChannels(0, true, "channum, callsign", channel_group_id); 7602 ChannelUtil::SortChannels(m_channellist, "channum", true); 7603 } 7604 } 7605 } 7606 7503 7607 void TV::ShowOSDTreeMenu(void) 7504 7608 { 7505 7609 BuildOSDTreeMenu(); … … void TV::FillMenuLiveTV(OSDGenericTree * 7686 7790 7687 7791 new OSDGenericTree(treeMenu, tr("Program Guide"), "GUIDE"); 7688 7792 7793 OSDGenericTree *cg_item = new OSDGenericTree(treeMenu, tr("Channel Groups"), 7794 "CHANGROUP"); 7795 new OSDGenericTree(cg_item, tr("All Channels"), "CHANGROUP_ALL_CHANNELS", 7796 (channel_group_id == -1) ? 1 : 0, 7797 NULL, "CHANNELGROUP"); 7798 7799 ChannelGroupList::iterator it; 7800 7801 for (it = m_changrplist.begin(); it != m_changrplist.end(); ++it) 7802 { 7803 QString name = QString("CHANGROUP_%1").arg(it->grpid); 7804 new OSDGenericTree(cg_item, it->name, name, 7805 ((int)(it->grpid) == channel_group_id) ? 1 : 0, 7806 NULL, "CHANNELGROUP"); 7807 } 7808 7689 7809 if (!gContext->GetNumSetting("JumpToProgramOSD", 1)) 7690 7810 { 7691 7811 OSDGenericTree *jtpo_item = -
libs/libmythtv/tv_play.h
diff -Naurp -x '*.orig' mythtv-orig/libs/libmythtv/tv_play.h mythtv/libs/libmythtv/tv_play.h
old new 20 20 #include "channelutil.h" 21 21 #include "videoouttypes.h" 22 22 #include "inputinfo.h" 23 #include "channelgroup.h" 23 24 24 25 #include <qobject.h> 25 26 … … class MPUBLIC TV : public QThread 239 240 // Used by EPG 240 241 void ChangeVolume(bool up); 241 242 void ToggleMute(void); 243 244 // Channel Groups 245 void SaveChannelGroup(void); 242 246 243 247 // Used for UDPNotify 244 248 bool HasUDPNotifyEvent(void) const; … … class MPUBLIC TV : public QThread 414 418 void ShowOSDTreeMenu(void); 415 419 void FillMenuLiveTV(OSDGenericTree *treeMenu); 416 420 void FillMenuPlaying(OSDGenericTree *treeMenu); 421 void processChanGroupEntry(QString action); 417 422 418 423 void UpdateLCD(void); 419 424 void ShowLCDChannelInfo(void); … … class MPUBLIC TV : public QThread 710 715 static const uint kNextSource; 711 716 static const uint kPreviousSource; 712 717 718 // Channel favorite group stuff 719 int channel_group_id; 720 uint browse_changrp; 721 ChannelGroupList m_changrplist; 722 DBChanList m_channellist; 723 713 724 // Network Control stuff 714 725 MythDeque<QString> networkControlCommands; 715 726 QMutex ncLock; -
programs/mythfrontend/globalsettings.cpp
diff -Naurp -x '*.orig' mythtv-orig/programs/mythfrontend/globalsettings.cpp mythtv/programs/mythfrontend/globalsettings.cpp
old new static HostCheckBox *EPGShowChannelIcon( 3092 3092 return gc; 3093 3093 } 3094 3094 3095 static HostCheckBox *EPGShowFavorites()3096 {3097 HostCheckBox *gc = new HostCheckBox("EPGShowFavorites");3098 gc->setLabel(QObject::tr("Only display 'favorite' channels"));3099 gc->setHelpText(QObject::tr("If enabled, the EPG will initially display "3100 "only the channels marked as favorites. Pressing "3101 "\"4\" will toggle between displaying favorites and all "3102 "channels."));3103 gc->setValue(false);3104 return gc;3105 }3106 3095 3107 3096 static HostSpinBox *EPGChanDisplay() 3108 3097 { … … static GlobalCheckBox *EPGEnableJumpToCh 3130 3119 return gc; 3131 3120 } 3132 3121 3122 static HostCheckBox *ChannelGroupRememberLast() 3123 { 3124 HostCheckBox *gc = new HostCheckBox("ChannelGroupRememberLast"); 3125 gc->setLabel(QObject::tr("Remember last channel group")); 3126 gc->setHelpText(QObject::tr("If enabled, the EPG will initially display " 3127 "only the channels from the last channel group selected. Pressing " 3128 "\"4\" will toggle channel group.")); 3129 gc->setValue(false); 3130 return gc; 3131 } 3132 3133 static HostComboBox *ChannelGroupDefault() 3134 { 3135 HostComboBox *gc = new HostComboBox("ChannelGroupDefault"); 3136 gc->setLabel(QObject::tr("Default channel group")); 3137 3138 ChannelGroupList changrplist; 3139 3140 changrplist = ChannelGroup::GetChannelGroups(); 3141 3142 gc->addSelection(QObject::tr("All Channels"), "-1"); 3143 3144 ChannelGroupList::iterator it; 3145 3146 for (it = changrplist.begin(); it < changrplist.end(); ++it) 3147 gc->addSelection(it->name, QString("%1").arg(it->grpid)); 3148 3149 gc->setHelpText(QObject::tr("Default channel group to be shown in the the EPG" 3150 "Pressing " 3151 "\"4\" will toggle channel group.")); 3152 gc->setValue(false); 3153 return gc; 3154 } 3155 3156 static HostCheckBox *BrowseChannelGroup() 3157 { 3158 HostCheckBox *gc = new HostCheckBox("BrowseChannelGroup"); 3159 gc->setLabel(QObject::tr("Browse/Change channels from Channel Group")); 3160 gc->setHelpText(QObject::tr("If enabled, LiveTV will browse or change channels " 3161 "from the selected channel group. \"All Channels\" " 3162 "channel group may be selected to browse all channels.")); 3163 gc->setValue(false); 3164 return gc; 3165 } 3166 3167 // Channel Group Settings 3168 class ChannelGroupSettings : public TriggeredConfigurationGroup 3169 { 3170 public: 3171 ChannelGroupSettings() : TriggeredConfigurationGroup(false, true, false, false) 3172 { 3173 setLabel(QObject::tr("Remember last channel group")); 3174 setUseLabel(false); 3175 3176 Setting* RememberChanGrpEnabled = ChannelGroupRememberLast(); 3177 addChild(RememberChanGrpEnabled); 3178 setTrigger(RememberChanGrpEnabled); 3179 3180 ConfigurationGroup* settings = new VerticalConfigurationGroup(false); 3181 settings->addChild(ChannelGroupDefault()); 3182 addTarget("0", settings); 3183 3184 // show nothing if RememberChanGrpEnabled is on 3185 addTarget("1", new VerticalConfigurationGroup(true)); 3186 }; 3187 }; 3188 3133 3189 // General RecPriorities settings 3134 3190 3135 3191 static GlobalCheckBox *GRSchedMoveHigher() … … GeneralSettings::GeneralSettings() 4896 4952 general2->addChild(CategoryOverTimeSettings()); 4897 4953 addChild(general2); 4898 4954 4955 VerticalConfigurationGroup* changrp = new VerticalConfigurationGroup(false); 4956 changrp->setLabel(QObject::tr("General (Channel Groups)")); 4957 ChannelGroupSettings *changroupsettings = new ChannelGroupSettings(); 4958 changrp->addChild(changroupsettings); 4959 changrp->addChild(BrowseChannelGroup()); 4960 addChild(changrp); 4899 4961 } 4900 4962 4901 4963 EPGSettings::EPGSettings() 4902 4964 { 4903 4965 VerticalConfigurationGroup* epg = new VerticalConfigurationGroup(false); 4904 epg->setLabel(QObject::tr("Program Guide") + " 1/ 2");4966 epg->setLabel(QObject::tr("Program Guide") + " 1/3"); 4905 4967 epg->addChild(EPGFillType()); 4906 4968 epg->addChild(EPGShowCategoryColors()); 4907 4969 epg->addChild(EPGShowCategoryText()); 4908 4970 epg->addChild(EPGScrollType()); 4909 4971 epg->addChild(EPGShowChannelIcon()); 4910 epg->addChild(EPGShowFavorites());4911 4972 epg->addChild(WatchTVGuide()); 4912 4973 epg->addChild(EPGChanDisplay()); 4913 4974 epg->addChild(EPGTimeDisplay()); 4914 4975 addChild(epg); 4915 4976 4916 4977 VerticalConfigurationGroup* gen = new VerticalConfigurationGroup(false); 4917 gen->setLabel(QObject::tr("Program Guide") + " 2/ 2");4978 gen->setLabel(QObject::tr("Program Guide") + " 2/3"); 4918 4979 gen->addChild(UnknownTitle()); 4919 4980 gen->addChild(UnknownCategory()); 4920 4981 gen->addChild(DefaultTVChannel()); 4921 4982 gen->addChild(SelectChangesChannel()); 4922 4983 gen->addChild(EPGRecThreshold()); 4923 4984 gen->addChild(EPGEnableJumpToChannel()); 4924 addChild(gen); 4985 addChild(gen); 4925 4986 } 4926 4987 4927 4988 GeneralRecPrioritiesSettings::GeneralRecPrioritiesSettings() -
programs/mythfrontend/main.cpp
diff -Naurp -x '*.orig' mythtv-orig/programs/mythfrontend/main.cpp mythtv/programs/mythfrontend/main.cpp
old new using namespace std; 53 53 #include "lcddevice.h" 54 54 #include "langsettings.h" 55 55 #include "mythcommandlineparser.h" 56 #include "channelgroupsettings.h" 56 57 57 58 #include "myththemedmenu.h" 58 59 #include "myththemebase.h" … … void TVMenuCallback(void *data, QString 443 444 EPGSettings settings; 444 445 settings.exec(); 445 446 } 447 else if (sel == "settings channelgroups") 448 { 449 ChannelGroupEditor editor; 450 editor.exec(); 451 } 446 452 else if (sel == "settings generalrecpriorities") 447 453 { 448 454 GeneralRecPrioritiesSettings settings; -
programs/mythfrontend/tv_settings.xml
diff -Naurp -x '*.orig' mythtv-orig/programs/mythfrontend/tv_settings.xml mythtv/programs/mythfrontend/tv_settings.xml
old new 90 90 <text lang="DE">Wiedergabe OSD</text> 91 91 <action>SETTINGS OSD</action> 92 92 </button> 93 94 <button> 95 <type>TV_SETTINGS_CHANNEL_GROUP</type> 96 <text>Channel Groups</text> 97 <action>SETTINGS CHANNELGROUPS</action> 98 </button> 93 99 94 100 <button> 95 101 <type>TV_SETTINGS_PLAYBACK_GROUPS</type> -
themes/classic/tv_settings.xml
diff -Naurp -x '*.orig' mythtv-orig/themes/classic/tv_settings.xml mythtv/themes/classic/tv_settings.xml
old new 71 71 </button> 72 72 73 73 <button> 74 <type>TV_SETTINGS_CHANNEL_GROUP</type> 75 <text>Channel Groups</text> 76 <action>SETTINGS CHANNELGROUPS</action> 77 </button> 78 79 <button> 74 80 <type>TV_SETTINGS_PLAYBACK_GROUPS</type> 75 81 <text>Playback Groups</text> 76 82 <text lang="IT">Gruppi di Riproduzione</text> -
themes/DVR/tv_settings.xml
diff -Naurp -x '*.orig' mythtv-orig/themes/DVR/tv_settings.xml mythtv/themes/DVR/tv_settings.xml
old new 74 74 </button> 75 75 76 76 <button> 77 <type>TV_SETTINGS_CHANNEL_GROUP</type> 78 <text>Channel Groups</text> 79 <action>SETTINGS CHANNELGROUPS</action> 80 </button> 81 82 <button> 77 83 <type>TV_SETTINGS_PLAYBACK_GROUPS</type> 78 84 <text>Playback Groups</text> 79 85 <text lang="SV">Uppspelningsgrupper</text>