Ticket #199: channelgroup.2.diff
File channelgroup.2.diff, 48.3 KB (added by , 16 years ago) |
---|
-
libs/libmythtv/channelgroup.cpp
diff -Naur --exclude='*.orig' --exclude='*.rej' mythtv-orig/libs/libmythtv/channelgroup.cpp mythtv/libs/libmythtv/channelgroup.cpp
old new 1 #include "libmyth/mythcontext.h" 2 #include "libmyth/mythdbcon.h" 3 #include <qsqldatabase.h> 4 #include <qheader.h> 5 #include <qcursor.h> 6 #include <qlayout.h> 7 #include <iostream> 8 #include "channelutil.h" 9 #include "channelgroup.h" 10 11 #define LOC QString("Channel Group: ") 12 #define LOC_ERR QString("Channel Group, Error: ") 13 14 // Storage class for channel group editor in settings 15 class ChannelGroupStorage : public Storage 16 { 17 public: 18 ChannelGroupStorage(Setting *_setting, 19 uint _chanid, QString _grpname) : 20 setting(_setting), chanid(_chanid), grpname(_grpname) {} 21 virtual ~ChannelGroupStorage() {}; 22 23 virtual void load(void); 24 virtual void save(void); 25 virtual void save(QString destination); 26 27 protected: 28 Setting *setting; 29 uint chanid; 30 QString grpname; 31 int grpid; 32 }; 33 34 void ChannelGroupStorage::load(void) 35 { 36 setting->setValue("0"); 37 setting->setUnchanged(); 38 39 MSqlQuery query(MSqlQuery::InitCon()); 40 41 QString qstr = "SELECT grpid FROM channelgroupnames WHERE name = :GRPNAME"; 42 43 query.prepare(qstr); 44 query.bindValue(":GRPNAME", grpname); 45 46 if (!query.exec() || !query.isActive()) 47 MythContext::DBError("ChannelGroupStorage::load", query); 48 else 49 { 50 query.next(); 51 grpid = query.value(0).toUInt(); 52 53 qstr = "SELECT * FROM channelgroup WHERE grpid = :GRPID AND chanid = :CHANID"; 54 query.prepare(qstr); 55 query.bindValue(":GRPID", grpid); 56 query.bindValue(":CHANID", chanid); 57 58 if (!query.exec() || !query.isActive()) 59 MythContext::DBError("ChannelGroupStorage::load", query); 60 else if (query.size() > 0) 61 setting->setValue("1"); 62 } 63 } 64 65 void ChannelGroupStorage::save(void) 66 { 67 if (!setting->isChanged()) 68 return; 69 70 QString value = setting->getValue(); 71 72 if (value == "1") 73 ChannelGroup::ToggleChannel(chanid, grpid, false); 74 else 75 ChannelGroup::ToggleChannel(chanid, grpid, true); 76 } 77 78 void ChannelGroupStorage::save(QString destination) 79 { 80 save(); 81 } 82 83 ChannelGroupItem& ChannelGroupItem::operator=(const ChannelGroupItem &other) 84 { 85 grpid = other.grpid; 86 name = QDeepCopy<QString>(other.name); 87 88 return *this; 89 } 90 91 ChannelGroupItem::ChannelGroupItem(const ChannelGroupItem &other) 92 { 93 (*this) = other; 94 } 95 96 inline bool lt_group(const ChannelGroupItem &a, const ChannelGroupItem &b) 97 { 98 return QString::localeAwareCompare(a.name, b.name) < 0; 99 } 100 101 bool ChannelGroup::ToggleChannel(uint chanid,int changrpid, int delete_chan) 102 { 103 // Check if it already exists for that chanid... 104 MSqlQuery query(MSqlQuery::InitCon()); 105 query.prepare( 106 "SELECT channelgroup.id " 107 "FROM channelgroup " 108 "WHERE channelgroup.chanid = :CHANID AND " 109 "channelgroup.grpid = :GRPID " 110 "LIMIT 1"); 111 query.bindValue(":CHANID", chanid); 112 query.bindValue(":GRPID", changrpid); 113 114 if (!query.exec() || !query.isActive()) 115 { 116 MythContext::DBError("ChannelGroup::ToggleChannel", query); 117 return false; 118 } 119 else if ((query.size() > 0) && delete_chan) 120 { 121 // We have a record...Remove it to toggle... 122 query.next(); 123 QString id = query.value(0).toString(); 124 query.prepare( 125 QString("DELETE FROM channelgroup " 126 "WHERE id = '%1'").arg(id)); 127 query.exec(); 128 VERBOSE(VB_IMPORTANT, LOC + QString("Removing channel with id=%1.").arg(id)); 129 } 130 else if (query.size() == 0) 131 { 132 // We have no record...Add one to toggle... 133 query.prepare( 134 QString("INSERT INTO channelgroup (chanid,grpid) " 135 "VALUES ('%1','%2')").arg(chanid).arg(changrpid)); 136 query.exec(); 137 VERBOSE(VB_IMPORTANT, LOC + QString("Adding channel %1 to group %2.").arg(chanid).arg(changrpid)); 138 } 139 140 return true; 141 } 142 143 ChannelGroupList ChannelGroup::GetChannelGroups(void) 144 { 145 ChannelGroupList list; 146 147 MSqlQuery query(MSqlQuery::InitCon()); 148 149 QString qstr = "SELECT grpid, name FROM channelgroupnames"; 150 151 query.prepare(qstr); 152 153 if (!query.exec() || !query.isActive()) 154 MythContext::DBError("ChannelGroup::GetChannelGroups", query); 155 else 156 { 157 while (query.next()) 158 { 159 ChannelGroupItem group(query.value(0).toUInt(), 160 query.value(1).toString()); 161 list.push_back(group); 162 } 163 } 164 165 stable_sort(list.begin(), list.end(), lt_group); 166 167 return list; 168 } 169 170 // Cycle through the available groups, then all channels 171 // Will cycle through to end then return -1 172 // To signify all channels. 173 int ChannelGroup::GetNextChannelGroup(const ChannelGroupList &sorted, int grpid) 174 { 175 // If no groups return -1 for all channels 176 if (sorted.empty()) 177 return -1; 178 179 // If grpid is all channels (-1), then return the first grpid 180 if (grpid == -1) 181 return sorted[0].grpid; 182 183 ChannelGroupList::const_iterator it = find(sorted.begin(), sorted.end(), grpid); 184 185 // If grpid is not in the list, return -1 for all channels 186 if (it == sorted.end()) 187 return -1; 188 189 ++it; 190 191 // If we reached the end, the next option is all channels (-1) 192 if (it == sorted.end()) 193 return -1; 194 195 return it->grpid; 196 } 197 198 QString ChannelGroup::GetChannelGroupName(const ChannelGroupList &sorted, int grpid) 199 { 200 // All Channels 201 if (grpid == -1) 202 return "All Channels"; 203 204 ChannelGroupList::const_iterator it = find(sorted.begin(), sorted.end(), grpid); 205 206 // If grpid wasn't found, return blank. 207 if (it == sorted.end()) 208 return ""; 209 else 210 return it->name; 211 } 212 213 class ChannelCheckBox : public CheckBoxSetting, public ChannelGroupStorage 214 { 215 public: 216 ChannelCheckBox(const ChannelGroupConfig& _parent, const uint chanid, const QString channum, 217 const QString channame, const QString grpname): 218 CheckBoxSetting(this), 219 ChannelGroupStorage(this, chanid, grpname) 220 { 221 setLabel(QObject::tr(QString("%1 %2").arg(channum).arg(channame))); 222 setHelpText(QObject::tr("Select/Unselect channels for this channel group")); 223 }; 224 }; 225 226 ChannelGroupConfig::ChannelGroupConfig(QString _name) 227 : name(_name) 228 { 229 VerticalConfigurationGroup *cgroup; 230 HorizontalConfigurationGroup *columns; 231 232 DBChanList chanlist = ChannelUtil::GetChannels(0, true, "channum, callsign"); 233 ChannelUtil::SortChannels(chanlist, "channum", true); 234 235 DBChanList::iterator it = chanlist.begin(); 236 int i,j = 0; 237 int p = 1; 238 int pages = (int)((float)chanlist.size() / 8.0 / 3.0 + 0.5); 239 240 do 241 { 242 columns = new HorizontalConfigurationGroup(false,false,false,false); 243 columns->setLabel(getName() + " " + 244 QObject::tr("Channel Group - Page ") + 245 QObject::tr(QString("%1 of %2").arg(p).arg(pages))); 246 247 for (j = 0; ((j < 3) && (it < chanlist.end())); ++j) 248 { 249 cgroup = new VerticalConfigurationGroup(false,false,false,false); 250 251 for (i = 0; ((i < 8) && (it < chanlist.end())); ++i) 252 { 253 cgroup->addChild(new ChannelCheckBox(*this, it->chanid, it->channum, it->name, _name)); 254 ++it; 255 } 256 columns->addChild(cgroup); 257 } 258 259 ++p; 260 addChild(columns); 261 } while (it < chanlist.end()); 262 263 } 264 265 ChannelGroupEditor::ChannelGroupEditor(void) : 266 listbox(new ListBoxSetting(this)), lastValue("__CREATE_NEW_GROUP__") 267 { 268 listbox->setLabel(tr("Channel Groups")); 269 addChild(listbox); 270 } 271 272 void ChannelGroupEditor::open(QString name) 273 { 274 lastValue = name; 275 bool created = false; 276 277 if (name == "__CREATE_NEW_GROUP__") 278 { 279 name = ""; 280 281 bool ok = MythPopupBox::showGetTextPopup(gContext->GetMainWindow(), 282 tr("Create New Channel Group"), 283 tr("Enter group name or press SELECT to enter text via the " 284 "On Screen Keyboard"), name); 285 if (!ok) 286 return; 287 288 MSqlQuery query(MSqlQuery::InitCon()); 289 query.prepare("INSERT INTO channelgroupnames (name) VALUES (:NAME);"); 290 query.bindValue(":NAME", name.utf8()); 291 if (!query.exec()) 292 MythContext::DBError("ChannelGroupEditor::open", query); 293 else 294 created = true; 295 } 296 297 ChannelGroupConfig group(name); 298 299 if (group.exec() == QDialog::Accepted || !created) 300 lastValue = name; 301 302 }; 303 304 void ChannelGroupEditor::doDelete(void) 305 { 306 QString name = listbox->getValue(); 307 if (name == "__CREATE_NEW_GROUP__") 308 return; 309 310 QString message = tr("Delete '%1' Channel group?").arg(name); 311 312 DialogCode value = MythPopupBox::Show2ButtonPopup( 313 gContext->GetMainWindow(), 314 "", message, 315 tr("Yes, delete group"), 316 tr("No, Don't delete group"), kDialogCodeButton1); 317 318 if (kDialogCodeButton0 == value) 319 { 320 MSqlQuery query(MSqlQuery::InitCon()); 321 322 // Find out channel group id 323 query.prepare("SELECT grpid FROM channelgroupnames WHERE name = :NAME;"); 324 query.bindValue(":NAME", name.utf8()); 325 if (!query.exec()) 326 MythContext::DBError("ChannelGroupEditor::doDelete", query); 327 query.next(); 328 uint grpid = query.value(0).toUInt(); 329 330 // Delete channels from this group 331 query.prepare("DELETE FROM channelgroup WHERE grpid = :GRPID;"); 332 query.bindValue(":GRPID", grpid); 333 if (!query.exec()) 334 MythContext::DBError("ChannelGroupEditor::doDelete", query); 335 336 // Now delete the group from channelgroupnames 337 query.prepare("DELETE FROM channelgroupnames WHERE name = :NAME;"); 338 query.bindValue(":NAME", name.utf8()); 339 if (!query.exec()) 340 MythContext::DBError("ChannelGroupEditor::doDelete", query); 341 342 lastValue = "__CREATE_NEW_GROUP__"; 343 load(); 344 } 345 346 listbox->setFocus(); 347 } 348 349 void ChannelGroupEditor::load(void) 350 { 351 listbox->clearSelections(); 352 353 ChannelGroupList changrplist; 354 355 changrplist = ChannelGroup::GetChannelGroups(); 356 357 ChannelGroupList::iterator it; 358 359 for (it = changrplist.begin(); it < changrplist.end(); ++it) 360 listbox->addSelection(it->name); 361 362 listbox->addSelection(tr("(Create new group)"), "__CREATE_NEW_GROUP__"); 363 364 listbox->setValue(lastValue); 365 } 366 367 DialogCode ChannelGroupEditor::exec(void) 368 { 369 while (ConfigurationDialog::exec() == kDialogCodeAccepted) 370 open(listbox->getValue()); 371 372 return kDialogCodeRejected; 373 } 374 375 MythDialog* ChannelGroupEditor::dialogWidget(MythMainWindow* parent, 376 const char* widgetName) 377 { 378 dialog = ConfigurationDialog::dialogWidget(parent, widgetName); 379 connect(dialog, SIGNAL(menuButtonPressed()), this, SLOT(doDelete())); 380 connect(dialog, SIGNAL(deleteButtonPressed()), this, SLOT(doDelete())); 381 return dialog; 382 } -
libs/libmythtv/channelgroup.h
diff -Naur --exclude='*.orig' --exclude='*.rej' mythtv-orig/libs/libmythtv/channelgroup.h mythtv/libs/libmythtv/channelgroup.h
old new 1 #ifndef CHANNELGROUP_H 2 #define CHANNELGROUP_H 3 4 #include "qstringlist.h" 5 #include "libmyth/settings.h" 6 #include "libmyth/mythwidgets.h" 7 8 class ChannelGroupItem 9 { 10 public: 11 ChannelGroupItem(const ChannelGroupItem&); 12 ChannelGroupItem(const uint _grpid, 13 const QString &_name) : 14 grpid(_grpid), name(_name) {} 15 16 bool operator == (uint _grpid) const 17 { return grpid == _grpid; } 18 19 ChannelGroupItem& operator=(const ChannelGroupItem&); 20 21 public: 22 uint grpid; 23 QString name; 24 }; 25 typedef vector<ChannelGroupItem> ChannelGroupList; 26 27 /** \class ChannelGroup 28 */ 29 class MPUBLIC ChannelGroup 30 { 31 public: 32 // ChannelGroup 33 static ChannelGroupList GetChannelGroups(void); 34 static bool ToggleChannel(uint chanid,int changrpid, int delete_chan); 35 static int GetNextChannelGroup(const ChannelGroupList &sorted, int grpid); 36 static QString GetChannelGroupName(const ChannelGroupList &sorted, int grpid); 37 38 39 private: 40 41 }; 42 43 class MPUBLIC ChannelGroupConfig: public ConfigurationWizard 44 { 45 public: 46 ChannelGroupConfig(QString _name); 47 QString getName(void) const { return name; } 48 49 private: 50 QString name; 51 }; 52 53 class MPUBLIC ChannelGroupEditor : public QObject, public ConfigurationDialog 54 { 55 Q_OBJECT 56 57 public: 58 ChannelGroupEditor(void); 59 virtual DialogCode exec(void); 60 virtual void load(void); 61 virtual void save(void) { }; 62 virtual void save(QString) { }; 63 virtual MythDialog* dialogWidget(MythMainWindow* parent, 64 const char* widgetName=0); 65 66 protected slots: 67 void open(QString name); 68 void doDelete(void); 69 70 protected: 71 ListBoxSetting *listbox; 72 QString lastValue; 73 }; 74 75 #endif -
libs/libmythtv/channelutil.cpp
diff -Naur --exclude='*.orig' --exclude='*.rej' mythtv-orig/libs/libmythtv/channelutil.cpp mythtv/libs/libmythtv/channelutil.cpp
old new 1413 1413 dvb_transportid, dvb_networkid, dtv_si_std); 1414 1414 } 1415 1415 1416 DBChanList ChannelUtil::GetChannels(uint sourceid, bool vis_only, QString grp )1416 DBChanList ChannelUtil::GetChannels(uint sourceid, bool vis_only, QString grp, int changrpid) 1417 1417 { 1418 1418 DBChanList list; 1419 QMap<uint,uint> favorites;1420 1419 MSqlQuery query(MSqlQuery::InitCon()); 1421 query.prepare(1422 "SELECT chanid, favid "1423 "FROM favorites");1424 if (!query.exec() || !query.isActive())1425 MythContext::DBError("get channels -- favorites", query);1426 else1427 {1428 while (query.next())1429 favorites[query.value(0).toUInt()] = query.value(1).toUInt();1430 }1431 1420 1432 1421 QString qstr = 1433 "SELECT channum, callsign, chan id, "1422 "SELECT channum, callsign, channel.chanid, " 1434 1423 " atsc_major_chan, atsc_minor_chan, " 1435 1424 " name, icon, mplexid, visible " 1436 1425 "FROM channel "; 1437 1426 1427 // Select only channels from the specified channel group 1428 if (changrpid > -1) 1429 qstr += QString(",channelgroup "); 1430 1438 1431 if (sourceid) 1439 1432 qstr += QString("WHERE sourceid='%1' ").arg(sourceid); 1440 1433 else … … 1442 1435 "WHERE cardinput.sourceid = channel.sourceid AND " 1443 1436 " cardinput.cardid = capturecard.cardid "; 1444 1437 1438 if (changrpid > -1) 1439 { 1440 qstr += QString("AND channel.chanid = channelgroup.chanid " 1441 "AND channelgroup.grpid ='%1' ").arg(changrpid); 1442 } 1443 1445 1444 if (vis_only) 1446 1445 qstr += "AND visible=1 "; 1447 1446 … … 1466 1465 query.value(2).toUInt(), /* chanid */ 1467 1466 query.value(3).toUInt(), /* ATSC major */ 1468 1467 query.value(4).toUInt(), /* ATSC minor */ 1469 favorites[query.value(2).toUInt()], /* favid*/1468 0, /* Was favid, need to remove */ 1470 1469 query.value(7).toUInt(), /* mplexid */ 1471 1470 query.value(8).toBool(), /* visible */ 1472 1471 QString::fromUtf8(query.value(5).toString()), /* name */ … … 1649 1648 (mplexid_restriction && 1650 1649 (mplexid_restriction != it->mplexid)))); 1651 1650 } 1652 else if ( CHANNEL_DIRECTION_UP == direction)1651 else if ((CHANNEL_DIRECTION_UP == direction) || (CHANNEL_DIRECTION_FAVORITE == direction)) 1653 1652 { 1654 1653 do 1655 1654 { … … 1662 1661 (mplexid_restriction && 1663 1662 (mplexid_restriction != it->mplexid)))); 1664 1663 } 1665 else if (CHANNEL_DIRECTION_FAVORITE == direction)1666 1667 do1668 {1669 it++;1670 if (it == sorted.end())1671 it = sorted.begin();1672 }1673 while ((it != start) &&1674 (!it->favorite ||1675 (skip_non_visible && !it->visible) ||1676 (mplexid_restriction &&1677 (mplexid_restriction != it->mplexid))));1678 }1664 // else if (CHANNEL_DIRECTION_FAVORITE == direction) 1665 // { 1666 // do 1667 // { 1668 // it++; 1669 // if (it == sorted.end()) 1670 // it = sorted.begin(); 1671 // } 1672 // while ((it != start) && 1673 // (!it->favorite || 1674 // (skip_non_visible && !it->visible) || 1675 // (mplexid_restriction && 1676 // (mplexid_restriction != it->mplexid)))); 1677 // } 1679 1678 1680 1679 return it->chanid; 1681 1680 } -
libs/libmythtv/channelutil.h
diff -Naur --exclude='*.orig' --exclude='*.rej' mythtv-orig/libs/libmythtv/channelutil.h mythtv/libs/libmythtv/channelutil.h
old new 59 59 mutable bool iconLoaded; 60 60 }; 61 61 62 63 62 /** \class ChannelUtil 64 63 * \brief Collection of helper utilities for channel DB use 65 64 */ … … 182 181 static QString GetVideoFilters(uint sourceid, const QString &channum) 183 182 { return GetChannelValueStr("videofilters", sourceid, channum); } 184 183 185 static DBChanList GetChannels(uint srcid, bool vis_only, QString grp="" );184 static DBChanList GetChannels(uint srcid, bool vis_only, QString grp="", int changrpid=-1); 186 185 static void SortChannels(DBChanList &list, const QString &order, 187 186 bool eliminate_duplicates = false); 188 187 static void EliminateDuplicateChanNum(DBChanList &list); -
libs/libmythtv/guidegrid.cpp
diff -Naur --exclude='*.orig' --exclude='*.rej' mythtv-orig/libs/libmythtv/guidegrid.cpp mythtv/libs/libmythtv/guidegrid.cpp
old new 21 21 22 22 #include "mythcontext.h" 23 23 #include "mythdbcon.h" 24 #include "guidegrid.h"25 24 #include "infostructs.h" 26 25 #include "programinfo.h" 27 26 #include "scheduledrecording.h" … … 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 DBChanList GuideGrid::Run( … … 41 41 const QString &channum, 42 42 bool thread, 43 43 TV *player, 44 bool allowsecondaryepg) 44 bool allowsecondaryepg, 45 int *changrpid) 45 46 { 46 47 DBChanList channel_changed; 48 int channel_group = -1; 49 50 if (changrpid != NULL) 51 channel_group = *changrpid; 47 52 48 53 if (thread) 49 54 qApp->lock(); … … 52 57 53 58 GuideGrid *gg = new GuideGrid(gContext->GetMainWindow(), 54 59 chanid, channum, 55 player, allowsecondaryepg, "guidegrid"); 60 player, allowsecondaryepg, "guidegrid", 61 channel_group); 56 62 57 63 gg->Show(); 58 64 … … 78 84 79 85 if (thread) 80 86 qApp->lock(); 81 87 88 if (changrpid != NULL) 89 *changrpid = gg->GetChanGrp(); 90 82 91 delete gg; 83 92 84 93 gContext->removeCurrentLocation(); … … 92 101 GuideGrid::GuideGrid(MythMainWindow *parent, 93 102 uint chanid, QString channum, 94 103 TV *player, bool allowsecondaryepg, 95 const char *name )104 const char *name, int changrpid) 96 105 : MythDialog(parent, name) 97 106 { 98 107 desiredDisplayChans = DISPLAY_CHANS = 6; 99 108 DISPLAY_TIMES = 30; 100 109 int maxchannel = 0; 101 110 m_currentStartChannel = 0; 111 112 m_changrpid = changrpid; 113 m_changrplist = ChannelGroup::GetChannelGroups(); 102 114 103 115 m_player = player; 104 116 … … 113 125 infoRect = QRect(0, 0, 0, 0); 114 126 curInfoRect = QRect(0, 0, 0, 0); 115 127 videoRect = QRect(0, 0, 0, 0); 128 changrpRect = QRect(0, 0, 0, 0); 116 129 117 130 jumpToChannelEnabled = gContext->GetNumSetting("EPGEnableJumpToChannel", 0); 118 131 jumpToChannelActive = false; … … 133 146 if (m_player && m_player->IsRunning() && !allowsecondaryepg) 134 147 videoRect = QRect(0, 0, 1, 1); 135 148 136 showFavorites = gContext->GetNumSetting("EPGShowFavorites", 0);137 149 gridfilltype = gContext->GetNumSetting("EPGFillType", UIGuideType::Alpha); 138 150 if (gridfilltype < (int)UIGuideType::Alpha) 139 151 { // update old settings to new fill types … … 190 202 container->SetDrawFontShadow(false); 191 203 } 192 204 205 container = theme->GetSet("channel_group"); 206 if (container) 207 { 208 UITextType *type = (UITextType *)container->GetType("changroup"); 209 QString changroup; 210 211 changroup = ChannelGroup::GetChannelGroupName(m_changrplist, m_changrpid); 212 213 if (type) 214 type->SetText(changroup); 215 } 216 193 217 channelOrdering = gContext->GetSetting("ChannelOrdering", "channum"); 194 218 dateformat = gContext->GetSetting("ShortDateFormat", "ddd d"); 195 219 unknownTitle = gContext->GetSetting("UnknownTitle", "Unknown"); … … 567 591 curInfoRect = area; 568 592 if (name.lower() == "current_video") 569 593 videoRect = area; 594 if (name.lower() == "channel_group") 595 changrpRect = area; 570 596 } 571 597 572 598 PixmapChannel *GuideGrid::GetChannelInfo(uint chan_idx, int sel) … … 764 790 m_channelInfos.clear(); 765 791 m_channelInfoIdx.clear(); 766 792 767 DBChanList channels = ChannelUtil::GetChannels(0, true );793 DBChanList channels = ChannelUtil::GetChannels(0, true, "", m_changrpid); 768 794 ChannelUtil::SortChannels(channels, channelOrdering, false); 769 795 770 if (showFavorites)771 {772 DBChanList tmp;773 for (uint i = 0; i < channels.size(); i++)774 {775 if (channels[i].favorite)776 tmp.push_back(channels[i]);777 }778 779 if (!tmp.empty())780 channels = tmp;781 }782 783 796 typedef vector<uint> uint_list_t; 784 797 QMap<QString,uint_list_t> channum_to_index_map; 785 798 QMap<QString,uint_list_t> callsign_to_index_map; … … 916 929 } 917 930 } 918 931 932 void GuideGrid::fillChanGroupInfo(void) 933 { 934 LayerSet *container = NULL; 935 UITextType *type = NULL; 936 937 container = theme->GetSet("channel_group"); 938 if (container) 939 { 940 type = (UITextType *)container->GetType("changroup"); 941 QString changroup; 942 943 changroup = ChannelGroup::GetChannelGroupName(m_changrplist, m_changrpid); 944 945 if (type) 946 type->SetText(changroup); 947 } 948 } 949 919 950 void GuideGrid::fillProgramRowInfos(unsigned int row) 920 951 { 921 952 LayerSet *container = NULL; … … 1198 1229 paintPrograms(&p); 1199 1230 if (r.intersects(curInfoRect)) 1200 1231 paintCurrentInfo(&p); 1232 if (r.intersects(changrpRect)) 1233 paintChanGroupInfo(&p); 1201 1234 1202 1235 // if jumpToChannel has its own rect, use that; otherwise use the date's rect 1203 1236 if ((jumpToChannelHasRect && r.intersects(jumpToChannelRect)) || … … 1311 1344 p->drawPixmap(dr.topLeft(), pix); 1312 1345 } 1313 1346 1347 void GuideGrid::paintChanGroupInfo(QPainter *p) 1348 { 1349 QRect dr = changrpRect; 1350 QPixmap pix(dr.size()); 1351 pix.fill(this, dr.topLeft()); 1352 QPainter tmp(&pix); 1353 1354 LayerSet *container = NULL; 1355 container = theme->GetSet("channel_group"); 1356 if (container) 1357 { 1358 container->Draw(&tmp, 1, m_context); 1359 container->Draw(&tmp, 2, m_context); 1360 container->Draw(&tmp, 3, m_context); 1361 container->Draw(&tmp, 4, m_context); 1362 container->Draw(&tmp, 5, m_context); 1363 container->Draw(&tmp, 6, m_context); 1364 container->Draw(&tmp, 7, m_context); 1365 container->Draw(&tmp, 8, m_context); 1366 } 1367 tmp.end(); 1368 p->drawPixmap(dr.topLeft(), pix); 1369 } 1370 1314 1371 bool GuideGrid::paintChannels(QPainter *p) 1315 1372 { 1316 1373 QRect cr = channelRect; … … 1393 1450 } 1394 1451 1395 1452 QString tmpChannelFormat = channelFormat; 1396 if (chinfo->favorite > 0)1397 {1398 tmpChannelFormat.insert(tmpChannelFormat.find('<'), "* ");1399 tmpChannelFormat.insert(tmpChannelFormat.find('>') + 1, " *");1400 }1453 // if (chinfo->favorite > 0) 1454 // { 1455 // tmpChannelFormat.insert(tmpChannelFormat.find('<'), "* "); 1456 // tmpChannelFormat.insert(tmpChannelFormat.find('>') + 1, " *"); 1457 // } 1401 1458 1402 1459 if (unavailable) 1403 1460 tmpChannelFormat.insert(tmpChannelFormat.find('<'), "X "); … … 1430 1487 } 1431 1488 } 1432 1489 1490 if (m_channelInfos.size() == 0) 1491 { 1492 // if the user has selected a channel group with no channels 1493 // Reset the text and icon. This will display one blank line 1494 // to show that the channel group has no channels 1495 if (type) 1496 { 1497 type->SetText(0, ""); 1498 type->ResetImage(0); 1499 } 1500 } 1501 1433 1502 if (container) 1434 1503 { 1435 1504 container->Draw(&tmp, 1, m_context); … … 1565 1634 1566 1635 void GuideGrid::toggleGuideListing() 1567 1636 { 1568 showFavorites = (!showFavorites); 1569 generateListings(); 1637 int oldchangrpid = m_changrpid; 1638 1639 m_changrpid = ChannelGroup::GetNextChannelGroup(m_changrplist, oldchangrpid); 1640 1641 if (oldchangrpid != m_changrpid) 1642 generateListings(); 1643 1644 fillChanGroupInfo(); 1645 update(changrpRect); 1570 1646 } 1571 1647 1572 1648 void GuideGrid::generateListings() … … 1585 1661 update(fullRect); 1586 1662 } 1587 1663 1664 int GuideGrid::SelectChannelGroup() 1665 { 1666 if (m_changrplist.empty()) 1667 { 1668 MythPopupBox::showOkPopup(gContext->GetMainWindow(), "", 1669 "You don't have any channel groups defined"); 1670 1671 return -1; 1672 } 1673 1674 MythPopupBox *popup = new MythPopupBox(gContext->GetMainWindow(), "SelectChannelGroup Popup"); 1675 popup->addLabel("Select Channel Group"); 1676 1677 for (uint i = 0; i < m_changrplist.size(); i++) 1678 popup->addButton(m_changrplist[i].name); 1679 1680 popup->addButton(tr("Cancel"))->setFocus(); 1681 1682 DialogCode result = popup->ExecPopup(); 1683 1684 popup->deleteLater(); 1685 1686 // If the user cancelled, return a special value 1687 if (result == MythDialog::Rejected) 1688 return -1; 1689 else 1690 return m_changrplist[result - kDialogCodeListStart].grpid; 1691 } 1692 1588 1693 void GuideGrid::toggleChannelFavorite() 1589 1694 { 1590 MSqlQuery query(MSqlQuery::InitCon()); 1695 int grpid; 1696 1697 if (m_changrpid == -1) 1698 { 1699 grpid = SelectChannelGroup(); 1700 1701 if (grpid == -1) 1702 return; 1703 } 1704 else 1705 grpid = m_changrpid; 1591 1706 1592 1707 // Get current channel id, and make sure it exists... 1593 1708 int chanNum = m_currentRow + m_currentStartChannel; … … 1599 1714 chanNum = 0; 1600 1715 1601 1716 PixmapChannel *ch = GetChannelInfo(chanNum); 1602 uint favid = ch->favorite;1603 1717 uint chanid = ch->chanid; 1604 1605 if (favid > 0) 1606 { 1607 query.prepare("DELETE FROM favorites WHERE favid = :FAVID ;"); 1608 query.bindValue(":FAVID", favid); 1609 query.exec(); 1610 } 1611 else 1612 { 1613 // We have no favorites record...Add one to toggle... 1614 query.prepare("INSERT INTO favorites (chanid) VALUES (:FAVID);"); 1615 query.bindValue(":FAVID", chanid); 1616 query.exec(); 1617 } 1618 1619 if (showFavorites) 1620 generateListings(); 1718 1719 if (m_changrpid == -1) 1720 // If currently viewing all channels, allow to add only not delete 1721 ChannelGroup::ToggleChannel(chanid, grpid, false); 1621 1722 else 1622 { 1623 int maxchannel = 0; 1624 DISPLAY_CHANS = desiredDisplayChans; 1625 fillChannelInfos(false); 1626 maxchannel = max((int)GetChannelCount() - 1, 0); 1627 DISPLAY_CHANS = min(DISPLAY_CHANS, maxchannel + 1); 1628 1629 repaint(channelRect, false); 1630 } 1723 // Only allow delete if viewing the favorite group in question 1724 ChannelGroup::ToggleChannel(chanid, grpid, true); 1725 1726 // If viewing favorites, refresh because a channel was removed 1727 if (m_changrpid != -1) 1728 generateListings(); 1631 1729 } 1632 1730 1633 1731 void GuideGrid::cursorLeft() -
libs/libmythtv/guidegrid.h
diff -Naur --exclude='*.orig' --exclude='*.rej' mythtv-orig/libs/libmythtv/guidegrid.h mythtv/libs/libmythtv/guidegrid.h
old new 13 13 #include "uitypes.h" 14 14 #include "xmlparse.h" 15 15 #include "libmythtv/programinfo.h" 16 #include "libmythtv/channelgroup.h" 16 17 #include "channelutil.h" 17 18 18 19 using namespace std; … … 39 40 const QString &startChanNum, 40 41 bool thread = false, 41 42 TV *player = NULL, 42 bool allowsecondaryepg = true); 43 bool allowsecondaryepg = true, 44 int *changrpid = NULL); 43 45 44 46 DBChanList GetSelection(void) const; 45 47 … … 86 88 GuideGrid(MythMainWindow *parent, 87 89 uint chanid = 0, QString channum = "", 88 90 TV *player = NULL, bool allowsecondaryepg = true, 89 const char *name = "GuideGrid"); 91 const char *name = "GuideGrid", 92 int changrpid=-1); 90 93 ~GuideGrid(); 91 94 95 int GetChanGrp(void) {return m_changrpid;} 92 96 void paintEvent(QPaintEvent *); 93 97 94 98 private slots: … … 108 112 void paintPrograms(QPainter *); 109 113 void paintCurrentInfo(QPainter *); 110 114 void paintInfo(QPainter *); 115 void paintChanGroupInfo(QPainter *p); 111 116 112 117 void resizeImage(QPixmap *, QString); 113 118 void LoadWindow(QDomElement &); … … 132 137 QRect infoRect; 133 138 QRect curInfoRect; 134 139 QRect videoRect; 140 QRect changrpRect; 135 141 136 142 void fillChannelInfos(bool gotostartchannel = true); 137 143 … … 139 145 140 146 void fillProgramInfos(void); 141 147 void fillProgramRowInfos(unsigned int row); 148 149 void fillChanGroupInfo(void); 142 150 143 151 void setStartChannel(int newStartChannel); 144 152 145 153 void createProgramLabel(int, int); 154 155 int SelectChannelGroup(); 146 156 147 157 PixmapChannel *GetChannelInfo(uint chan_idx, int sel = -1); 148 158 const PixmapChannel *GetChannelInfo(uint chan_idx, int sel = -1) const; … … 172 182 int m_currentCol; 173 183 174 184 bool selectState; 175 bool showFavorites;176 185 bool sortReverse; 177 186 QString channelFormat; 178 187 … … 195 204 QTimer *videoRepaintTimer; 196 205 197 206 bool keyDown; 207 208 int m_changrpid; 209 ChannelGroupList m_changrplist; 198 210 199 211 void jumpToChannelResetAndHide(); 200 212 void jumpToChannelCancel(); -
libs/libmythtv/libmythtv.pro
diff -Naur --exclude='*.orig' --exclude='*.rej' mythtv-orig/libs/libmythtv/libmythtv.pro mythtv/libs/libmythtv/libmythtv.pro
old new 142 142 HEADERS += channeleditor.h channelsettings.h 143 143 HEADERS += previewgenerator.h transporteditor.h 144 144 HEADERS += importicons.h 145 HEADERS += channelgroup.h 145 146 146 147 SOURCES += programinfo.cpp proglist.cpp 147 148 SOURCES += storagegroup.cpp … … 165 166 SOURCES += channeleditor.cpp channelsettings.cpp 166 167 SOURCES += previewgenerator.cpp transporteditor.cpp 167 168 SOURCES += importicons.cpp 169 SOURCES += channelgroup.cpp 168 170 169 171 # DiSEqC 170 172 HEADERS += diseqc.h diseqcsettings.h -
libs/libmythtv/tv_play.cpp
diff -Naur --exclude='*.orig' --exclude='*.rej' mythtv-orig/libs/libmythtv/tv_play.cpp mythtv/libs/libmythtv/tv_play.cpp
old new 89 89 bool showDialogs = true; 90 90 bool playCompleted = false; 91 91 ProgramInfo *curProgram = NULL; 92 93 92 94 93 if (tvrec) 95 94 curProgram = new ProgramInfo(*tvrec); … … 229 228 230 229 bool allowrerecord = tv->getAllowRerecord(); 231 230 bool deleterecording = tv->getRequestDelete(); 232 231 232 tv->SaveChannelGroup(); 233 233 234 delete tv; 234 235 235 236 if (curProgram) … … 283 284 "in the program guide", "0"); 284 285 REG_KEY("TV Frontend", "GUIDE", "Show the Program Guide", "S"); 285 286 REG_KEY("TV Frontend", "FINDER", "Show the Program Finder", "#"); 286 REG_KEY("TV Frontend", "NEXTFAV", " Toggle showing all channels or just"287 " favorites in the program guide.", "/");287 REG_KEY("TV Frontend", "NEXTFAV", "Cycle through channel groups and all channels " 288 "in the program guide.", "/,S"); 288 289 REG_KEY("TV Frontend", "CHANUPDATE", "Switch channels without exiting " 289 290 "guide in Live TV mode.", "X"); 290 291 REG_KEY("TV Frontend", "VOLUMEDOWN", "Volume down", "[,{,F10,Volume Down"); … … 629 630 stickykeys = gContext->GetNumSetting("StickyKeys"); 630 631 ff_rew_repos = gContext->GetNumSetting("FFRewReposTime", 100)/100.0; 631 632 ff_rew_reverse = gContext->GetNumSetting("FFRewReverse", 1); 633 channel_group_id = gContext->GetNumSetting("ChannelGroupDefault", -1); 634 browse_changrp = gContext->GetNumSetting("BrowseChannelGroup", 0); 635 636 if (browse_changrp && (channel_group_id > -1)) 637 { 638 m_channellist = ChannelUtil::GetChannels(0, true, "channum, callsign", channel_group_id); 639 ChannelUtil::SortChannels(m_channellist, "channum", true); 640 } 641 642 m_changrplist = ChannelGroup::GetChannelGroups(); 643 632 644 int def[8] = { 3, 5, 10, 20, 30, 60, 120, 180 }; 633 645 for (uint i = 0; i < sizeof(def)/sizeof(def[0]); i++) 634 646 ff_rew_speeds.push_back( … … 792 804 } 793 805 } 794 806 807 void TV::SaveChannelGroup(void) 808 { 809 int changrpid = gContext->GetNumSetting("ChannelGroupDefault", -1); 810 int remember_last_changrp = gContext->GetNumSetting("ChannelGroupRememberLast", 0); 811 812 if (remember_last_changrp && (changrpid != channel_group_id)) 813 gContext->SaveSetting("ChannelGroupDefault", channel_group_id); 814 } 815 795 816 TVState TV::GetState(void) const 796 817 { 797 818 if (InStateChange()) … … 4599 4620 4600 4621 void TV::ToggleChannelFavorite(void) 4601 4622 { 4602 activerecorder->ToggleChannelFavorite();4623 // activerecorder->ToggleChannelFavorite(); 4603 4624 } 4604 4625 4605 4626 void TV::ChangeChannel(int direction) 4606 4627 { 4607 4628 bool muted = false; 4608 4629 4630 if ((browse_changrp || (direction == CHANNEL_DIRECTION_FAVORITE)) && 4631 (channel_group_id > -1) && (direction != CHANNEL_DIRECTION_SAME)) 4632 { 4633 uint chanid; 4634 4635 // Collect channel info 4636 pbinfoLock.lock(); 4637 uint old_chanid = playbackinfo->chanid.toUInt(); 4638 pbinfoLock.unlock(); 4639 4640 chanid = ChannelUtil::GetNextChannel(m_channellist, old_chanid, 0, direction); 4641 4642 ChangeChannel(chanid, ""); 4643 return; 4644 } else if (direction == CHANNEL_DIRECTION_FAVORITE) 4645 direction = CHANNEL_DIRECTION_UP; 4646 4609 4647 if (nvp) 4610 4648 { 4611 4649 AudioOutput *aud = nvp->getAudioOutput(); … … 5670 5708 5671 5709 DBChanList changeChannel; 5672 5710 ProgramInfo *nextProgram = NULL; 5711 int changrpid = channel_group_id; 5673 5712 5674 5713 if (StateIsLiveTV(GetState())) 5675 5714 { … … 5685 5724 5686 5725 // Start up EPG 5687 5726 changeChannel = GuideGrid::Run( 5688 chanid, channum, true, this, allowsecondary );5727 chanid, channum, true, this, allowsecondary, &changrpid); 5689 5728 5690 5729 break; 5691 5730 } … … 5728 5767 { 5729 5768 default: 5730 5769 case kScheduleProgramGuide: 5731 GuideGrid::Run(chanid, channum, true );5770 GuideGrid::Run(chanid, channum, true, NULL, true, &changrpid); 5732 5771 break; 5733 5772 case kScheduleProgramFinder: 5734 5773 RunProgramFind(true, false); … … 5778 5817 DoPause(); 5779 5818 } 5780 5819 5820 // if channel group was changed in EPG update local info 5821 if ((changrpid != channel_group_id) && (editType == kScheduleProgramGuide)) 5822 { 5823 channel_group_id = changrpid; 5824 5825 if (browse_changrp) 5826 { 5827 VERBOSE(VB_IMPORTANT, LOC + 5828 QString("Reloading channel group list for %1").arg(channel_group_id)); 5829 5830 m_channellist = ChannelUtil::GetChannels(0, true, "channum, callsign", channel_group_id); 5831 ChannelUtil::SortChannels(m_channellist, "channum", true); 5832 } 5833 } 5834 5781 5835 // Resize the window back to the MythTV Player size 5782 5836 if (!using_gui_size_for_tv) 5783 5837 { … … 6407 6461 { 6408 6462 if (!browsemode) 6409 6463 BrowseStart(); 6464 VERBOSE(VB_IMPORTANT,"In BrowseDispInfo"); 6465 // if browsing channel groups is enabled or direction if BROWSE_FAVORITES 6466 // Then pick the next channel in the channel group list to browse 6467 // If channel group is ALL CHANNELS (-1), then bypass picking from 6468 // the channel group list 6469 if ((browse_changrp || (direction == BROWSE_FAVORITE)) && 6470 (channel_group_id > -1) && (direction != BROWSE_SAME) && 6471 (direction != BROWSE_RIGHT) && (direction != BROWSE_LEFT)) 6472 { 6473 uint chanid; 6474 int dir; 6475 6476 if ( (direction == BROWSE_UP) || (direction == BROWSE_FAVORITE) ) 6477 dir = CHANNEL_DIRECTION_UP; 6478 else if (direction == BROWSE_DOWN) 6479 dir = CHANNEL_DIRECTION_DOWN; 6480 else // this should never happen, but just in case 6481 dir = direction; 6482 6483 chanid = ChannelUtil::GetNextChannel(m_channellist, browsechanid.toUInt(), 0, dir); 6484 VERBOSE(VB_IMPORTANT, QString("Get channel: %1").arg(chanid)); 6485 browsechanid = QString("%1").arg(chanid); 6486 browsechannum = QString::null; 6487 direction = BROWSE_SAME; 6488 } 6489 else if ((channel_group_id == -1) && (direction == BROWSE_FAVORITE)) 6490 direction = BROWSE_UP; 6410 6491 6411 6492 InfoMap infoMap; 6412 6493 QDateTime curtime = QDateTime::currentDateTime(); … … 7174 7255 } 7175 7256 else if (action == "GUIDE") 7176 7257 EditSchedule(kScheduleProgramGuide); 7258 else if (action.left(10) == "CHANGROUP_") 7259 processChanGroupEntry(action); 7177 7260 else if (action == "FINDER") 7178 7261 EditSchedule(kScheduleProgramFinder); 7179 7262 else if (action == "SCHEDULE") … … 7270 7353 } 7271 7354 } 7272 7355 7356 void TV::processChanGroupEntry(QString action) 7357 { 7358 if (action == "CHANGROUP_ALL_CHANNELS") 7359 channel_group_id = -1; 7360 else 7361 { 7362 action.remove("CHANGROUP_"); 7363 channel_group_id = action.toInt(); 7364 7365 if (browse_changrp) 7366 { 7367 m_channellist = ChannelUtil::GetChannels(0, true, "channum, callsign", channel_group_id); 7368 ChannelUtil::SortChannels(m_channellist, "channum", true); 7369 } 7370 } 7371 } 7372 7273 7373 void TV::ShowOSDTreeMenu(void) 7274 7374 { 7275 7375 BuildOSDTreeMenu(); … … 7451 7551 freeRecorders = RemoteGetFreeRecorderCount(); 7452 7552 7453 7553 item = new OSDGenericTree(treeMenu, tr("Program Guide"), "GUIDE"); 7554 item = new OSDGenericTree(treeMenu, tr("Channel Groups"), "CHANGROUP"); 7555 subitem = new OSDGenericTree(item, tr("All Channels"), 7556 "CHANGROUP_ALL_CHANNELS", 7557 (channel_group_id == -1) ? 1 : 0, 7558 NULL, "CHANNELGROUP"); 7559 7560 ChannelGroupList::iterator it; 7561 7562 for (it = m_changrplist.begin(); it != m_changrplist.end(); ++it) 7563 { 7564 QString name = QString("CHANGROUP_%1").arg(it->grpid); 7565 subitem = new OSDGenericTree(item, it->name, name, 7566 ((int)(it->grpid) == channel_group_id) ? 1 : 0, 7567 NULL, "CHANNELGROUP"); 7568 } 7454 7569 7455 7570 if (!gContext->GetNumSetting("JumpToProgramOSD", 1)) 7456 7571 { -
libs/libmythtv/tv_play.h
diff -Naur --exclude='*.orig' --exclude='*.rej' mythtv-orig/libs/libmythtv/tv_play.h mythtv/libs/libmythtv/tv_play.h
old new 19 19 #include "programinfo.h" 20 20 #include "channelutil.h" 21 21 #include "videoouttypes.h" 22 #include "channelutil.h" 23 #include "channelgroup.h" 22 24 23 25 #include <qobject.h> 24 26 … … 220 222 // Used by EPG 221 223 void ChangeVolume(bool up); 222 224 void ToggleMute(void); 225 226 // Channel Groups 227 void SaveChannelGroup(void); 223 228 224 229 public slots: 225 230 void HandleOSDClosed(int osdType); … … 392 397 void ShowOSDTreeMenu(void); 393 398 void FillMenuLiveTV(OSDGenericTree *treeMenu); 394 399 void FillMenuPlaying(OSDGenericTree *treeMenu); 400 void processChanGroupEntry(QString action); 395 401 396 402 void UpdateLCD(void); 397 403 void ShowLCDChannelInfo(void); … … 672 678 // Network Control stuff 673 679 QValueList<QString> networkControlCommands; 674 680 QMutex ncLock; 681 682 int channel_group_id; 683 uint browse_changrp; 684 ChannelGroupList m_changrplist; 685 DBChanList m_channellist; 675 686 }; 676 687 677 688 #endif -
programs/mythfrontend/globalsettings.cpp
diff -Naur --exclude='*.orig' --exclude='*.rej' mythtv-orig/programs/mythfrontend/globalsettings.cpp mythtv/programs/mythfrontend/globalsettings.cpp
old new 2879 2879 return gc; 2880 2880 } 2881 2881 2882 static HostCheckBox *EPGShowFavorites()2883 {2884 HostCheckBox *gc = new HostCheckBox("EPGShowFavorites");2885 gc->setLabel(QObject::tr("Only display 'favorite' channels"));2886 gc->setHelpText(QObject::tr("If enabled, the EPG will initially display "2887 "only the channels marked as favorites. Pressing "2888 "\"4\" will toggle between displaying favorites and all "2889 "channels."));2890 gc->setValue(false);2891 return gc;2892 }2893 2882 2894 2883 static HostSpinBox *EPGChanDisplay() 2895 2884 { … … 2917 2906 return gc; 2918 2907 } 2919 2908 2909 static HostCheckBox *ChannelGroupRememberLast() 2910 { 2911 HostCheckBox *gc = new HostCheckBox("ChannelGroupRememberLast"); 2912 gc->setLabel(QObject::tr("Remember last channel group")); 2913 gc->setHelpText(QObject::tr("If enabled, the EPG will initially display " 2914 "only the channels from the last channel group selected. Pressing " 2915 "\"4\" will toggle channel group.")); 2916 gc->setValue(false); 2917 return gc; 2918 } 2919 2920 static HostComboBox *ChannelGroupDefault() 2921 { 2922 HostComboBox *gc = new HostComboBox("ChannelGroupDefault"); 2923 gc->setLabel(QObject::tr("Default channel group")); 2924 2925 ChannelGroupList changrplist; 2926 2927 changrplist = ChannelGroup::GetChannelGroups(); 2928 2929 gc->addSelection(QObject::tr("All Channels"), "-1"); 2930 2931 ChannelGroupList::iterator it; 2932 2933 for (it = changrplist.begin(); it < changrplist.end(); ++it) 2934 gc->addSelection(it->name, QString("%1").arg(it->grpid)); 2935 2936 gc->setHelpText(QObject::tr("Default channel group to be shown in the the EPG" 2937 "Pressing " 2938 "\"4\" will toggle channel group.")); 2939 gc->setValue(false); 2940 return gc; 2941 } 2942 2943 static HostCheckBox *BrowseChannelGroup() 2944 { 2945 HostCheckBox *gc = new HostCheckBox("BrowseChannelGroup"); 2946 gc->setLabel(QObject::tr("Browse/Change channels from Channel Group")); 2947 gc->setHelpText(QObject::tr("If enabled, LiveTV will browse or change channels " 2948 "from the selected channel group. \"All Channels\" " 2949 "channel group may be selected to browse all channels.")); 2950 gc->setValue(false); 2951 return gc; 2952 } 2953 2954 // Channel Group Settings 2955 class ChannelGroupSettings : public TriggeredConfigurationGroup 2956 { 2957 public: 2958 ChannelGroupSettings() : TriggeredConfigurationGroup(false, true, false, false) 2959 { 2960 setLabel(QObject::tr("Remember last channel group")); 2961 setUseLabel(false); 2962 2963 Setting* RememberChanGrpEnabled = ChannelGroupRememberLast(); 2964 addChild(RememberChanGrpEnabled); 2965 setTrigger(RememberChanGrpEnabled); 2966 2967 ConfigurationGroup* settings = new VerticalConfigurationGroup(false); 2968 settings->addChild(ChannelGroupDefault()); 2969 addTarget("0", settings); 2970 2971 // show nothing if RememberChanGrpEnabled is on 2972 addTarget("1", new VerticalConfigurationGroup(true)); 2973 }; 2974 }; 2975 2920 2976 // General RecPriorities settings 2921 2977 2922 2978 static GlobalCheckBox *GRSchedMoveHigher() … … 4633 4689 general2->addChild(CategoryOverTimeSettings()); 4634 4690 addChild(general2); 4635 4691 4692 VerticalConfigurationGroup* changrp = new VerticalConfigurationGroup(false); 4693 changrp->setLabel(QObject::tr("General (Channel Groups)")); 4694 ChannelGroupSettings *changroupsettings = new ChannelGroupSettings(); 4695 changrp->addChild(changroupsettings); 4696 changrp->addChild(BrowseChannelGroup()); 4697 addChild(changrp); 4636 4698 } 4637 4699 4638 4700 EPGSettings::EPGSettings() 4639 4701 { 4640 4702 VerticalConfigurationGroup* epg = new VerticalConfigurationGroup(false); 4641 epg->setLabel(QObject::tr("Program Guide") + " 1/ 2");4703 epg->setLabel(QObject::tr("Program Guide") + " 1/3"); 4642 4704 epg->addChild(EPGFillType()); 4643 4705 epg->addChild(EPGShowCategoryColors()); 4644 4706 epg->addChild(EPGShowCategoryText()); 4645 4707 epg->addChild(EPGScrollType()); 4646 4708 epg->addChild(EPGShowChannelIcon()); 4647 epg->addChild(EPGShowFavorites());4648 4709 epg->addChild(WatchTVGuide()); 4649 4710 epg->addChild(EPGChanDisplay()); 4650 4711 epg->addChild(EPGTimeDisplay()); 4651 4712 addChild(epg); 4652 4713 4653 4714 VerticalConfigurationGroup* gen = new VerticalConfigurationGroup(false); 4654 gen->setLabel(QObject::tr("Program Guide") + " 2/ 2");4715 gen->setLabel(QObject::tr("Program Guide") + " 2/3"); 4655 4716 gen->addChild(UnknownTitle()); 4656 4717 gen->addChild(UnknownCategory()); 4657 4718 gen->addChild(DefaultTVChannel()); 4658 4719 gen->addChild(SelectChangesChannel()); 4659 4720 gen->addChild(EPGRecThreshold()); 4660 4721 gen->addChild(EPGEnableJumpToChannel()); 4661 addChild(gen); 4722 addChild(gen); 4662 4723 } 4663 4724 4664 4725 GeneralRecPrioritiesSettings::GeneralRecPrioritiesSettings() -
programs/mythfrontend/main.cpp
diff -Naur --exclude='*.orig' --exclude='*.rej' mythtv-orig/programs/mythfrontend/main.cpp mythtv/programs/mythfrontend/main.cpp
old new 50 50 #include "statusbox.h" 51 51 #include "lcddevice.h" 52 52 #include "langsettings.h" 53 #include "channelgroup.h" 53 54 54 55 #include "libmythui/myththemedmenu.h" 55 56 #include "libmythui/myththemebase.h" … … 405 406 { 406 407 EPGSettings settings; 407 408 settings.exec(); 409 } 410 else if (sel == "settings channelgroups") 411 { 412 ChannelGroupEditor editor; 413 editor.exec(); 408 414 } 409 415 else if (sel == "settings generalrecpriorities") 410 416 { -
programs/mythfrontend/tv_settings.xml
diff -Naur --exclude='*.orig' --exclude='*.rej' mythtv-orig/programs/mythfrontend/tv_settings.xml mythtv/programs/mythfrontend/tv_settings.xml
old new 80 80 <text>Playback OSD</text> 81 81 <action>SETTINGS OSD</action> 82 82 </button> 83 84 <button> 85 <type>TV_SETTINGS_CHANNEL_GROUP</type> 86 <text>Channel Groups</text> 87 <action>SETTINGS CHANNELGROUPS</action> 88 </button> 83 89 84 90 <button> 85 91 <type>TV_SETTINGS_PLAYBACK_GROUPS</type> -
themes/classic/tv_settings.xml
diff -Naur --exclude='*.orig' --exclude='*.rej' mythtv-orig/themes/classic/tv_settings.xml mythtv/themes/classic/tv_settings.xml
old new 67 67 </button> 68 68 69 69 <button> 70 <type>TV_SETTINGS_CHANNEL_GROUP</type> 71 <text>Channel Groups</text> 72 <action>SETTINGS CHANNELGROUPS</action> 73 </button> 74 75 <button> 70 76 <type>TV_SETTINGS_PLAYBACK_GROUPS</type> 71 77 <text>Playback Groups</text> 72 78 <text lang="SV">Uppspelningsgrupper</text> -
themes/DVR/tv_settings.xml
diff -Naur --exclude='*.orig' --exclude='*.rej' 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>