Ticket #199: favorites_update.diff
File favorites_update.diff, 49.5 KB (added by , 16 years ago) |
---|
-
libs/libmythtv/channelutil.cpp
diff -Nur --exclude='*.lib' --exclude='*.o' mythtv/libs/libmythtv/channelutil.cpp mythtv-guide/libs/libmythtv/channelutil.cpp
old new 1296 1296 dvb_transportid, dvb_networkid, dtv_si_std); 1297 1297 } 1298 1298 1299 DBChanList ChannelUtil::GetChannels(uint sourceid, bool vis_only, QString grp )1299 DBChanList ChannelUtil::GetChannels(uint sourceid, bool vis_only, QString grp, int favgrpid) 1300 1300 { 1301 1301 DBChanList list; 1302 QMap<uint,uint> favorites;1303 1302 MSqlQuery query(MSqlQuery::InitCon()); 1304 query.prepare( 1305 "SELECT chanid, favid " 1306 "FROM favorites"); 1307 if (!query.exec() || !query.isActive()) 1308 MythContext::DBError("get channels -- favorites", query); 1309 else 1310 { 1311 while (query.next()) 1312 favorites[query.value(0).toUInt()] = query.value(1).toUInt(); 1303 1304 QString qstr = "SELECT channum, callsign, channel.chanid, " 1305 " atsc_major_chan, atsc_minor_chan, " 1306 " name, icon, visible " 1307 "FROM channel"; 1308 1309 1310 if (favgrpid > -1) 1311 { 1312 // Select only favorite channels from the specified group 1313 1314 if (sourceid) 1315 qstr += QString(",favorites WHERE sourceid='%1' AND ").arg(sourceid); 1316 else 1317 qstr += ",cardinput,capturecard,favorites " 1318 "WHERE cardinput.sourceid = channel.sourceid AND " 1319 " cardinput.cardid = capturecard.cardid AND "; 1320 1321 qstr += QString("channel.chanid = favorites.chanid AND favorites.favgrpid ='%1' ").arg(favgrpid); 1313 1322 } 1314 1315 QString qstr =1316 "SELECT channum, callsign, chanid, "1317 " atsc_major_chan, atsc_minor_chan, "1318 " name, icon, visible "1319 "FROM channel ";1320 1321 if (sourceid)1322 qstr += QString("WHERE sourceid='%1' ").arg(sourceid);1323 1323 else 1324 qstr += ",cardinput,capturecard " 1325 "WHERE cardinput.sourceid = channel.sourceid AND " 1326 " cardinput.cardid = capturecard.cardid "; 1324 { 1325 // Select All channels 1326 1327 if (sourceid) 1328 qstr += QString(" WHERE sourceid='%1' ").arg(sourceid); 1329 else 1330 qstr += ",cardinput,capturecard " 1331 "WHERE cardinput.sourceid = channel.sourceid AND " 1332 " cardinput.cardid = capturecard.cardid "; 1333 } 1327 1334 1328 1335 if (vis_only) 1329 1336 qstr += "AND visible=1 "; … … 1349 1356 query.value(2).toUInt(), /* chanid */ 1350 1357 query.value(3).toUInt(), /* ATSC major */ 1351 1358 query.value(4).toUInt(), /* ATSC minor */ 1352 favorites[query.value(2).toUInt()],/* favid */1359 0, /* favid */ 1353 1360 query.value(7).toBool(), /* visible */ 1354 1361 QString::fromUtf8(query.value(5).toString()), /* name */ 1355 1362 query.value(6).toString()); /* icon */ … … 1519 1526 } while ((it != start) && skip_non_visible && !it->visible); 1520 1527 1521 1528 } 1522 else if ( CHANNEL_DIRECTION_UP == direction)1529 else if ((CHANNEL_DIRECTION_UP == direction) || (CHANNEL_DIRECTION_FAVORITE == direction)) 1523 1530 { 1524 1531 do 1525 1532 { … … 1528 1535 it = sorted.begin(); 1529 1536 } while ((it != start) && skip_non_visible && !it->visible); 1530 1537 } 1531 else if (CHANNEL_DIRECTION_FAVORITE == direction)1532 {1533 do1534 {1535 it++;1536 if (it == sorted.end())1537 it = sorted.begin();1538 1539 } while ((it != start) &&1540 (!it->favorite || (skip_non_visible && !it->visible)));1541 }1538 // else if (CHANNEL_DIRECTION_FAVORITE == direction) 1539 // { 1540 // do 1541 // { 1542 // it++; 1543 // if (it == sorted.end()) 1544 // it = sorted.begin(); 1545 1546 // } while ((it != start) && 1547 // (!it->favorite || (skip_non_visible && !it->visible))); 1548 // } 1542 1549 1543 1550 return it->chanid; 1544 1551 } -
libs/libmythtv/channelutil.h
diff -Nur --exclude='*.lib' --exclude='*.o' mythtv/libs/libmythtv/channelutil.h mythtv-guide/libs/libmythtv/channelutil.h
old new 43 43 }; 44 44 typedef vector<DBChannel> DBChanList; 45 45 46 47 46 /** \class ChannelUtil 48 47 * \brief Collection of helper utilities for channel DB use 49 48 */ … … 164 163 static QString GetVideoFilters(uint sourceid, const QString &channum) 165 164 { return GetChannelValueStr("videofilters", sourceid, channum); } 166 165 167 static DBChanList GetChannels(uint srcid, bool vis_only, QString grp="" );166 static DBChanList GetChannels(uint srcid, bool vis_only, QString grp="", int favgrpid=-1); 168 167 static void SortChannels(DBChanList &list, const QString &order, 169 168 bool eliminate_duplicates = false); 170 169 static void EliminateDuplicateChanNum(DBChanList &list); -
libs/libmythtv/favoritegroup.cpp
diff -Nur --exclude='*.lib' --exclude='*.o' mythtv/libs/libmythtv/favoritegroup.cpp mythtv-guide/libs/libmythtv/favoritegroup.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 "favoritegroup.h" 10 11 #define LOC QString("Favorites: ") 12 #define LOC_ERR QString("Favorites, Error: ") 13 14 // Storage class for favorite group channel editor in settings 15 class FavoriteStorage : public Storage 16 { 17 public: 18 FavoriteStorage(Setting *_setting, 19 uint _chanid, QString _grpname) : 20 setting(_setting), chanid(_chanid), grpname(_grpname) {} 21 virtual ~FavoriteStorage() {}; 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 FavoriteStorage::load(void) 35 { 36 setting->setValue("0"); 37 setting->setUnchanged(); 38 39 MSqlQuery query(MSqlQuery::InitCon()); 40 41 QString qstr = "SELECT favgrpid FROM favoritegroups WHERE name = :GRPNAME"; 42 43 query.prepare(qstr); 44 query.bindValue(":GRPNAME", grpname); 45 46 if (!query.exec() || !query.isActive()) 47 MythContext::DBError("get favoriate Groups", query); 48 else 49 { 50 query.next(); 51 grpid = query.value(0).toUInt(); 52 53 qstr = "SELECT * FROM favorites WHERE favgrpid = :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("get favoriate Groups", query); 60 else if (query.size() > 0) 61 setting->setValue("1"); 62 } 63 } 64 65 void FavoriteStorage::save(void) 66 { 67 if (!setting->isChanged()) 68 return; 69 70 QString value = setting->getValue(); 71 72 if (value == "1") 73 Favorites::ToggleFavorite(chanid, grpid, false); 74 else 75 Favorites::ToggleFavorite(chanid, grpid, true); 76 } 77 78 void FavoriteStorage::save(QString destination) 79 { 80 save(); 81 } 82 83 FavoriteGroup& FavoriteGroup::operator=(const FavoriteGroup &other) 84 { 85 grpid = other.grpid; 86 name = QDeepCopy<QString>(other.name); 87 88 return *this; 89 } 90 91 FavoriteGroup::FavoriteGroup(const FavoriteGroup &other) 92 { 93 (*this) = other; 94 } 95 96 inline bool lt_group(const FavoriteGroup &a, const FavoriteGroup &b) 97 { 98 return QString::localeAwareCompare(a.name, b.name) < 0; 99 } 100 101 bool Favorites::ToggleFavorite(uint chanid,int favgrpid, int delete_fav) 102 { 103 // Check if favorite exists for that chanid... 104 MSqlQuery query(MSqlQuery::InitCon()); 105 query.prepare( 106 "SELECT favorites.favid " 107 "FROM favorites " 108 "WHERE favorites.chanid = :CHANID AND " 109 "favorites.favgrpid = :GRPID " 110 "LIMIT 1"); 111 query.bindValue(":CHANID", chanid); 112 query.bindValue(":GRPID", favgrpid); 113 114 if (!query.exec() || !query.isActive()) 115 { 116 MythContext::DBError("togglechannelfavorite", query); 117 return false; 118 } 119 else if ((query.size() > 0) && delete_fav) 120 { 121 // We have a favorites record...Remove it to toggle... 122 query.next(); 123 QString favid = query.value(0).toString(); 124 query.prepare( 125 QString("DELETE FROM favorites " 126 "WHERE favid = '%1'").arg(favid)); 127 query.exec(); 128 VERBOSE(VB_IMPORTANT, LOC + "Removing Favorite."); 129 } 130 else if (query.size() == 0) 131 { 132 // We have no favorites record...Add one to toggle... 133 query.prepare( 134 QString("INSERT INTO favorites (chanid,favgrpid) " 135 "VALUES ('%1','%2')").arg(chanid).arg(favgrpid)); 136 query.exec(); 137 VERBOSE(VB_IMPORTANT, LOC + "Adding Favorite."); 138 } 139 140 return true; 141 } 142 143 FavoriteGroupList Favorites::GetFavoriteGroups(void) 144 { 145 FavoriteGroupList list; 146 147 MSqlQuery query(MSqlQuery::InitCon()); 148 149 QString qstr = "SELECT favgrpid, name FROM favoritegroups"; 150 151 query.prepare(qstr); 152 153 if (!query.exec() || !query.isActive()) 154 MythContext::DBError("get favoriate Groups", query); 155 else 156 { 157 while (query.next()) 158 { 159 FavoriteGroup 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 Favorites::GetNextFavoriteGroup(const FavoriteGroupList &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 FavoriteGroupList::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 Favorites::GetFavoriteGroupName(const FavoriteGroupList &sorted, int grpid) 199 { 200 // All Channels 201 if (grpid == -1) 202 return "All Channels"; 203 204 FavoriteGroupList::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 FavChannel : public CheckBoxSetting, public FavoriteStorage 214 { 215 public: 216 FavChannel(const FavoriteChannelGroup& _parent, const uint chanid, const QString channum, 217 const QString channame, const QString grpname): 218 CheckBoxSetting(this), 219 FavoriteStorage(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 favorite group")); 223 }; 224 }; 225 226 FavoriteChannelGroup::FavoriteChannelGroup(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 Favorite 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 FavChannel(*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 FavoriteGroupEditor::FavoriteGroupEditor(void) : 266 listbox(new ListBoxSetting(this)), lastValue("__CREATE_NEW_GROUP__") 267 { 268 listbox->setLabel(tr("Channel Favorite Groups")); 269 addChild(listbox); 270 } 271 272 void FavoriteGroupEditor::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 Favorite 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 favoritegroups (name) VALUES (:NAME);"); 290 query.bindValue(":NAME", name.utf8()); 291 if (!query.exec()) 292 MythContext::DBError("FavoriteGroupEditor::open", query); 293 else 294 created = true; 295 } 296 297 FavoriteChannelGroup group(name); 298 299 if (group.exec() == QDialog::Accepted || !created) 300 lastValue = name; 301 302 }; 303 304 void FavoriteGroupEditor::doDelete(void) 305 { 306 QString name = listbox->getValue(); 307 if (name == "__CREATE_NEW_GROUP__") 308 return; 309 310 QString message = tr("Delete favorite group:") + 311 QString("\n'%1'?").arg(name); 312 313 int value = MythPopupBox::show2ButtonPopup(gContext->GetMainWindow(), 314 "", message, 315 tr("Yes, delete group"), 316 tr("No, Don't delete group"), 2); 317 318 if (value == 0) 319 { 320 MSqlQuery query(MSqlQuery::InitCon()); 321 322 // Find out favorite group id 323 query.prepare("SELECT favgrpid FROM favoritegroups WHERE name = :NAME;"); 324 query.bindValue(":NAME", name.utf8()); 325 if (!query.exec()) 326 MythContext::DBError("FavoriteGroupEditor::doDelete", query); 327 query.next(); 328 uint grpid = query.value(0).toUInt(); 329 330 // Delete favorite channels from favorites for this group 331 query.prepare("DELETE FROM favorites WHERE favgrpid = :GRPID;"); 332 query.bindValue(":GRPID", grpid); 333 if (!query.exec()) 334 MythContext::DBError("FavoriteGroupEditor::doDelete", query); 335 336 // Now delete the group from favoritegroups 337 query.prepare("DELETE FROM favoritegroups WHERE name = :NAME;"); 338 query.bindValue(":NAME", name.utf8()); 339 if (!query.exec()) 340 MythContext::DBError("FavoriteGroupEditor::doDelete", query); 341 342 lastValue = "__CREATE_NEW_GROUP__"; 343 load(); 344 } 345 346 listbox->setFocus(); 347 } 348 349 void FavoriteGroupEditor::load(void) 350 { 351 listbox->clearSelections(); 352 353 FavoriteGroupList favgrplist; 354 355 favgrplist = Favorites::GetFavoriteGroups(); 356 357 FavoriteGroupList::iterator it; 358 359 for (it = favgrplist.begin(); it < favgrplist.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 int FavoriteGroupEditor::exec(void) 368 { 369 while (ConfigurationDialog::exec() == QDialog::Accepted) 370 open(listbox->getValue()); 371 372 return QDialog::Rejected; 373 } 374 375 MythDialog* FavoriteGroupEditor::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/favoritegroup.h
diff -Nur --exclude='*.lib' --exclude='*.o' mythtv/libs/libmythtv/favoritegroup.h mythtv-guide/libs/libmythtv/favoritegroup.h
old new 1 #ifndef FAVORITEGROUP_H 2 #define FAVORITEGROUP_H 3 4 #include "qstringlist.h" 5 #include "libmyth/settings.h" 6 #include "libmyth/mythwidgets.h" 7 8 class FavoriteGroup 9 { 10 public: 11 FavoriteGroup(const FavoriteGroup&); 12 FavoriteGroup(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 FavoriteGroup& operator=(const FavoriteGroup&); 20 21 public: 22 uint grpid; 23 QString name; 24 }; 25 typedef vector<FavoriteGroup> FavoriteGroupList; 26 27 /** \class Favorites 28 */ 29 class MPUBLIC Favorites 30 { 31 public: 32 // Favorite 33 static FavoriteGroupList GetFavoriteGroups(void); 34 static bool ToggleFavorite(uint chanid,int favgrpid, int delete_fav); 35 static int GetNextFavoriteGroup(const FavoriteGroupList &sorted, int grpid); 36 static QString GetFavoriteGroupName(const FavoriteGroupList &sorted, int grpid); 37 38 39 private: 40 41 }; 42 43 class MPUBLIC FavoriteChannelGroup: public ConfigurationWizard 44 { 45 public: 46 FavoriteChannelGroup(QString _name); 47 QString getName(void) const { return name; } 48 49 private: 50 QString name; 51 }; 52 53 class MPUBLIC FavoriteGroupEditor : public QObject, public ConfigurationDialog 54 { 55 Q_OBJECT 56 57 public: 58 FavoriteGroupEditor(void); 59 virtual int 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 -
mythtv/libs/libmythtv/guidegrid.cpp
old new using namespace std; 20 20 21 21 #include "mythcontext.h" 22 22 #include "mythdbcon.h" 23 #include "guidegrid.h"24 23 #include "infostructs.h" 25 24 #include "programinfo.h" 26 25 #include "scheduledrecording.h" … … using namespace std; 32 31 #include "customedit.h" 33 32 #include "util.h" 34 33 #include "remoteutil.h" 35 #include " channelutil.h"34 #include "guidegrid.h" 36 35 37 36 bool RunProgramGuide(uint &chanid, QString &channum, 38 37 bool thread, TV *player, 39 bool allowsecondaryepg )38 bool allowsecondaryepg, int *favgrpid) 40 39 { 41 40 bool channel_changed = false; 41 int favorite_group = -1; 42 43 if (favgrpid != NULL) 44 favorite_group = *favgrpid; 42 45 43 46 if (thread) 44 47 qApp->lock(); … … bool RunProgramGuide(uint &chanid, QStri 47 50 48 51 GuideGrid *gg = new GuideGrid(gContext->GetMainWindow(), 49 52 chanid, channum, 50 player, allowsecondaryepg, "guidegrid"); 53 player, allowsecondaryepg, "guidegrid", 54 favorite_group); 51 55 52 56 gg->Show(); 53 57 … … bool RunProgramGuide(uint &chanid, QStri 70 74 71 75 if (thread) 72 76 qApp->lock(); 73 77 78 if (favgrpid != NULL) 79 *favgrpid = gg->GetFavGrp(); 80 74 81 delete gg; 75 82 76 83 gContext->removeCurrentLocation(); … … bool RunProgramGuide(uint &chanid, QStri 84 91 GuideGrid::GuideGrid(MythMainWindow *parent, 85 92 uint chanid, QString channum, 86 93 TV *player, bool allowsecondaryepg, 87 const char *name )94 const char *name, int favgrpid) 88 95 : MythDialog(parent, name) 89 96 { 90 97 desiredDisplayChans = DISPLAY_CHANS = 6; 91 98 DISPLAY_TIMES = 30; 92 99 int maxchannel = 0; 93 100 m_currentStartChannel = 0; 101 102 m_favgrpid = favgrpid; 103 m_favgrplist = Favorites::GetFavoriteGroups(); 94 104 95 105 m_player = player; 96 106 … … GuideGrid::GuideGrid(MythMainWindow *par 105 115 infoRect = QRect(0, 0, 0, 0); 106 116 curInfoRect = QRect(0, 0, 0, 0); 107 117 videoRect = QRect(0, 0, 0, 0); 118 favRect = QRect(0, 0, 0, 0); 108 119 109 120 jumpToChannelEnabled = gContext->GetNumSetting("EPGEnableJumpToChannel", 0); 110 121 jumpToChannelActive = false; … … GuideGrid::GuideGrid(MythMainWindow *par 125 136 if (m_player && m_player->IsRunning() && !allowsecondaryepg) 126 137 videoRect = QRect(0, 0, 1, 1); 127 138 128 showFavorites = gContext->GetNumSetting("EPGShowFavorites", 0);129 139 gridfilltype = gContext->GetNumSetting("EPGFillType", UIGuideType::Alpha); 130 140 if (gridfilltype < (int)UIGuideType::Alpha) 131 141 { // update old settings to new fill types … … GuideGrid::GuideGrid(MythMainWindow *par 181 191 container->SetDrawFontShadow(false); 182 192 } 183 193 194 container = theme->GetSet("favorite_group"); 195 if (container) 196 { 197 UITextType *type = (UITextType *)container->GetType("favgroup"); 198 QString favgroup; 199 200 favgroup = Favorites::GetFavoriteGroupName(m_favgrplist, m_favgrpid); 201 202 if (type) 203 type->SetText(favgroup); 204 } 205 184 206 channelOrdering = gContext->GetSetting("ChannelOrdering", "channum"); 185 207 dateformat = gContext->GetSetting("ShortDateFormat", "ddd d"); 186 208 unknownTitle = gContext->GetSetting("UnknownTitle", "Unknown"); … … void GuideGrid::parseContainer(QDomEleme 552 574 curInfoRect = area; 553 575 if (name.lower() == "current_video") 554 576 videoRect = area; 577 if (name.lower() == "favorite_group") 578 favRect = area; 555 579 } 556 580 557 581 QString GuideGrid::GetChanNum(void) … … void GuideGrid::fillChannelInfos(bool go 611 635 m_channelInfos.clear(); 612 636 613 637 DBChanList channels = ChannelUtil::GetChannels(0, true, 614 "channum, callsign" );638 "channum, callsign", m_favgrpid); 615 639 ChannelUtil::SortChannels(channels, channelOrdering, true); 616 640 617 if (showFavorites)618 {619 DBChanList tmp;620 for (uint i = 0; i < channels.size(); i++)621 {622 if (channels[i].favorite)623 tmp.push_back(channels[i]);624 }625 626 if (!tmp.empty())627 channels = tmp;628 }629 630 641 bool startingset = false; 631 642 for (uint i = 0; i < channels.size(); i++) 632 643 { … … void GuideGrid::fillChannelInfos(bool go 634 645 val.chanstr = channels[i].channum; 635 646 val.chanid = channels[i].chanid; 636 647 val.callsign = channels[i].callsign; 637 val.favid = channels[i].favorite;648 // val.favid = channels[i].favorite; 638 649 val.channame = channels[i].name; 639 650 val.iconpath = channels[i].icon; 640 651 val.iconload = false; … … void GuideGrid::fillProgramInfos(void) 734 745 } 735 746 } 736 747 748 void GuideGrid::fillFavGroupInfo(void) 749 { 750 LayerSet *container = NULL; 751 UITextType *type = NULL; 752 753 container = theme->GetSet("favorite_group"); 754 if (container) 755 { 756 type = (UITextType *)container->GetType("favgroup"); 757 QString favgroup; 758 759 favgroup = Favorites::GetFavoriteGroupName(m_favgrplist, m_favgrpid); 760 761 if (type) 762 type->SetText(favgroup); 763 } 764 } 765 737 766 void GuideGrid::fillProgramRowInfos(unsigned int row) 738 767 { 739 768 LayerSet *container = NULL; … … void GuideGrid::paintEvent(QPaintEvent * 1010 1039 paintPrograms(&p); 1011 1040 if (r.intersects(curInfoRect)) 1012 1041 paintCurrentInfo(&p); 1042 if (r.intersects(favRect)) 1043 paintFavGroupInfo(&p); 1013 1044 1014 1045 // if jumpToChannel has its own rect, use that; otherwise use the date's rect 1015 1046 if ((jumpToChannelHasRect && r.intersects(jumpToChannelRect)) || … … void GuideGrid::paintCurrentInfo(QPainte 1123 1154 p->drawPixmap(dr.topLeft(), pix); 1124 1155 } 1125 1156 1157 void GuideGrid::paintFavGroupInfo(QPainter *p) 1158 { 1159 QRect dr = favRect; 1160 QPixmap pix(dr.size()); 1161 pix.fill(this, dr.topLeft()); 1162 QPainter tmp(&pix); 1163 1164 LayerSet *container = NULL; 1165 container = theme->GetSet("favorite_group"); 1166 if (container) 1167 { 1168 container->Draw(&tmp, 1, m_context); 1169 container->Draw(&tmp, 2, m_context); 1170 container->Draw(&tmp, 3, m_context); 1171 container->Draw(&tmp, 4, m_context); 1172 container->Draw(&tmp, 5, m_context); 1173 container->Draw(&tmp, 6, m_context); 1174 container->Draw(&tmp, 7, m_context); 1175 container->Draw(&tmp, 8, m_context); 1176 } 1177 tmp.end(); 1178 p->drawPixmap(dr.topLeft(), pix); 1179 } 1180 1126 1181 void GuideGrid::paintChannels(QPainter *p) 1127 1182 { 1128 1183 QRect cr = channelRect; … … void GuideGrid::paintChannels(QPainter * 1180 1235 } 1181 1236 1182 1237 QString tmpChannelFormat = channelFormat; 1183 if (chinfo->favid > 0)1184 {1185 tmpChannelFormat.insert(tmpChannelFormat.find('<'), "* ");1186 tmpChannelFormat.insert(tmpChannelFormat.find('>') + 1, " *");1187 }1238 // if (chinfo->favid > 0) 1239 // { 1240 // tmpChannelFormat.insert(tmpChannelFormat.find('<'), "* "); 1241 // tmpChannelFormat.insert(tmpChannelFormat.find('>') + 1, " *"); 1242 // } 1188 1243 1189 1244 if (type) 1190 1245 { … … void GuideGrid::paintChannels(QPainter * 1214 1269 } 1215 1270 } 1216 1271 1272 if (m_channelInfos.size() == 0) 1273 { 1274 // if the user has selected a favorite list with no channels 1275 // Reset the text and icon. This will display one blank line 1276 // to show that the favorite group has no channels 1277 if (type) 1278 { 1279 type->SetText(0, ""); 1280 type->ResetImage(0); 1281 } 1282 } 1283 1217 1284 if (container) 1218 1285 { 1219 1286 container->Draw(&tmp, 1, m_context); … … void GuideGrid::paintInfo(QPainter *p) 1348 1415 1349 1416 void GuideGrid::toggleGuideListing() 1350 1417 { 1351 showFavorites = (!showFavorites); 1352 generateListings(); 1418 int oldfavgrpid = m_favgrpid; 1419 1420 m_favgrpid = Favorites::GetNextFavoriteGroup(m_favgrplist, oldfavgrpid); 1421 1422 if (oldfavgrpid != m_favgrpid) 1423 generateListings(); 1424 1425 fillFavGroupInfo(); 1426 update(favRect); 1353 1427 } 1354 1428 1355 1429 void GuideGrid::generateListings() … … void GuideGrid::generateListings() 1368 1442 update(fullRect); 1369 1443 } 1370 1444 1445 int GuideGrid::SelectFavoriteGroup() 1446 { 1447 if (m_favgrplist.empty()) 1448 { 1449 MythPopupBox::showOkPopup(gContext->GetMainWindow(), "", 1450 "You don't have any favorite groups defined"); 1451 1452 return -1; 1453 } 1454 1455 MythPopupBox box(gContext->GetMainWindow(), "SelectFavoriteGroup Popup"); 1456 box.addLabel("Select Favorite Group"); 1457 1458 for (uint i = 0; i < m_favgrplist.size(); i++) 1459 box.addButton(m_favgrplist[i].name); 1460 1461 box.addButton(tr("Cancel"))->setFocus(); 1462 1463 int ret = box.ExecPopup(); 1464 1465 // If the user cancelled, return a special value 1466 if (ret < 0) 1467 return -1; 1468 else 1469 return m_favgrplist[ret].grpid; 1470 } 1471 1371 1472 void GuideGrid::toggleChannelFavorite() 1372 1473 { 1373 MSqlQuery query(MSqlQuery::InitCon()); 1474 int grpid; 1475 1476 if (m_favgrpid == -1) 1477 { 1478 grpid = SelectFavoriteGroup(); 1479 1480 if (grpid == -1) 1481 return; 1482 } 1483 else 1484 grpid = m_favgrpid; 1374 1485 1375 1486 // Get current channel id, and make sure it exists... 1376 1487 int chanNum = m_currentRow + m_currentStartChannel; … … void GuideGrid::toggleChannelFavorite() 1381 1492 if (chanNum < 0) 1382 1493 chanNum = 0; 1383 1494 1384 int favid = m_channelInfos[chanNum].favid;1385 1495 int chanid = m_channelInfos[chanNum].chanid; 1386 1387 if (favid > 0) 1388 { 1389 query.prepare("DELETE FROM favorites WHERE favid = :FAVID ;"); 1390 query.bindValue(":FAVID", favid); 1391 query.exec(); 1392 } 1393 else 1394 { 1395 // We have no favorites record...Add one to toggle... 1396 query.prepare("INSERT INTO favorites (chanid) VALUES (:FAVID);"); 1397 query.bindValue(":FAVID", chanid); 1398 query.exec(); 1399 } 1400 1401 if (showFavorites) 1402 generateListings(); 1496 1497 if (m_favgrpid == -1) 1498 // If currently viewing all channels, allow to add only not delete 1499 Favorites::ToggleFavorite(chanid, grpid, false); 1403 1500 else 1404 { 1405 int maxchannel = 0; 1406 DISPLAY_CHANS = desiredDisplayChans; 1407 fillChannelInfos(false); 1408 maxchannel = max((int)m_channelInfos.size() - 1, 0); 1409 DISPLAY_CHANS = min(DISPLAY_CHANS, maxchannel + 1); 1410 1411 repaint(channelRect, false); 1412 } 1501 // Only allow delete if viewing the favorite group in question 1502 Favorites::ToggleFavorite(chanid, grpid, true); 1503 1504 // If viewing favorites, refresh because a channel was removed 1505 if (m_favgrpid != -1) 1506 generateListings(); 1413 1507 } 1414 1508 1415 1509 void GuideGrid::cursorLeft() -
libs/libmythtv/guidegrid.h
diff -Nur --exclude='*.lib' --exclude='*.o' mythtv/libs/libmythtv/guidegrid.h mythtv-guide/libs/libmythtv/guidegrid.h
old new 12 12 #include "uitypes.h" 13 13 #include "xmlparse.h" 14 14 #include "libmythtv/programinfo.h" 15 #include "libmythtv/favoritegroup.h" 16 #include "libmythtv/favoritegroup.h" 15 17 16 18 using namespace std; 17 19 … … 29 31 MPUBLIC 30 32 bool RunProgramGuide(uint &startChanId, QString &startChanNum, 31 33 bool thread = false, TV *player = NULL, 32 bool allowsecondaryepg = true );34 bool allowsecondaryepg = true, int *favgrpid = NULL); 33 35 34 36 35 37 class GuideGrid : public MythDialog … … 39 41 GuideGrid(MythMainWindow *parent, 40 42 uint chanid = 0, QString channum = "", 41 43 TV *player = NULL, bool allowsecondaryepg = true, 42 const char *name = "GuideGrid" );44 const char *name = "GuideGrid", int favgrpid = -1); 43 45 ~GuideGrid(); 44 46 45 47 uint GetChanID(void); 46 48 QString GetChanNum(void); 49 int GetFavGrp(void) {return m_favgrpid;} 47 50 48 51 protected slots: 49 52 void cursorLeft(); … … 104 107 void paintPrograms(QPainter *); 105 108 void paintCurrentInfo(QPainter *); 106 109 void paintInfo(QPainter *); 110 void paintFavGroupInfo(QPainter *p); 107 111 108 112 void resizeImage(QPixmap *, QString); 109 113 void LoadWindow(QDomElement &); … … 128 132 QRect infoRect; 129 133 QRect curInfoRect; 130 134 QRect videoRect; 135 QRect favRect; 131 136 132 137 void fillChannelInfos(bool gotostartchannel = true); 133 138 … … 135 140 136 141 void fillProgramInfos(void); 137 142 void fillProgramRowInfos(unsigned int row); 143 144 void fillFavGroupInfo(void); 138 145 139 146 void setStartChannel(int newStartChannel); 140 147 141 148 void createProgramLabel(int, int); 149 150 int SelectFavoriteGroup(); 142 151 143 152 vector<ChannelInfo> m_channelInfos; 144 153 TimeInfo *m_timeInfos[MAX_DISPLAY_TIMES]; … … 157 166 int m_currentCol; 158 167 159 168 bool selectState; 160 bool showFavorites;161 169 QString channelFormat; 162 170 163 171 int desiredDisplayChans; … … 180 188 QTimer *videoRepaintTimer; 181 189 182 190 bool keyDown; 191 192 int m_favgrpid; 193 FavoriteGroupList m_favgrplist; 183 194 184 195 void jumpToChannelResetAndHide(); 185 196 void jumpToChannelCancel(); -
libs/libmythtv/libmythtv.pro
diff -Nur --exclude='*.lib' --exclude='*.o' mythtv/libs/libmythtv/libmythtv.pro mythtv-guide/libs/libmythtv/libmythtv.pro
old new 149 149 HEADERS += playgroup.h progdetails.h 150 150 HEADERS += channeleditor.h channelsettings.h 151 151 HEADERS += previewgenerator.h transporteditor.h 152 HEADERS += favoritegroup.h 152 153 153 154 SOURCES += programinfo.cpp proglist.cpp 154 155 SOURCES += storagegroup.cpp … … 171 172 SOURCES += progdetails.cpp 172 173 SOURCES += channeleditor.cpp channelsettings.cpp 173 174 SOURCES += previewgenerator.cpp transporteditor.cpp 175 SOURCES += favoritegroup.cpp 174 176 175 177 # DiSEqC 176 178 HEADERS += diseqc.h diseqcsettings.h -
libs/libmythtv/tv_play.cpp
diff -Nur --exclude='*.lib' --exclude='*.o' mythtv/libs/libmythtv/tv_play.cpp mythtv-guide/libs/libmythtv/tv_play.cpp
old new 81 81 bool showDialogs = true; 82 82 bool playCompleted = false; 83 83 ProgramInfo *curProgram = NULL; 84 85 84 86 85 if (tvrec) 87 86 curProgram = new ProgramInfo(*tvrec); … … 223 222 224 223 bool allowrerecord = tv->getAllowRerecord(); 225 224 bool deleterecording = tv->getRequestDelete(); 226 225 226 tv->SaveFavoriteGroup(); 227 227 228 delete tv; 228 229 229 230 if (curProgram) … … 268 269 ">,."); 269 270 REG_KEY("TV Frontend", "TOGGLEFAV", "Toggle the current channel as a " 270 271 "favorite", "?"); 271 REG_KEY("TV Frontend", "NEXTFAV", " Toggle showing all channels or just"272 " favorites in the program guide.", "/");272 REG_KEY("TV Frontend", "NEXTFAV", "Cycle through favorite groups and all channels " 273 "in the program guide.", "/,S"); 273 274 REG_KEY("TV Frontend", "CHANUPDATE", "Switch channels without exiting " 274 275 "guide in Live TV mode.", "X"); 275 276 REG_KEY("TV Frontend", "VOLUMEDOWN", "Volume down", "[,{,F10"); … … 608 609 stickykeys = gContext->GetNumSetting("StickyKeys"); 609 610 ff_rew_repos = gContext->GetNumSetting("FFRewReposTime", 100)/100.0; 610 611 ff_rew_reverse = gContext->GetNumSetting("FFRewReverse", 1); 612 favorite_group_id = gContext->GetNumSetting("FavoritesDefaultGroup", -1); 613 browse_favorites = gContext->GetNumSetting("FavoritesChangeChannel", 0); 614 615 if (browse_favorites && (favorite_group_id > -1)) 616 { 617 m_channellist = ChannelUtil::GetChannels(0, true, "channum, callsign", favorite_group_id); 618 ChannelUtil::SortChannels(m_channellist, "channum", true); 619 } 620 621 m_favgrplist = Favorites::GetFavoriteGroups(); 622 611 623 int def[8] = { 3, 5, 10, 20, 30, 60, 120, 180 }; 612 624 for (uint i = 0; i < sizeof(def)/sizeof(def[0]); i++) 613 625 ff_rew_speeds.push_back( … … 770 782 } 771 783 } 772 784 785 void TV::SaveFavoriteGroup(void) 786 { 787 int favgrpid = gContext->GetNumSetting("FavoritesDefaultGroup", -1); 788 int remember_last_fav = gContext->GetNumSetting("FavoritesRememberLast", 0); 789 790 if (remember_last_fav && (favgrpid != favorite_group_id)) 791 gContext->SaveSetting("FavoritesDefaultGroup", favorite_group_id); 792 } 793 773 794 TVState TV::GetState(void) const 774 795 { 775 796 if (InStateChange()) … … 4097 4138 4098 4139 void TV::ToggleChannelFavorite(void) 4099 4140 { 4100 activerecorder->ToggleChannelFavorite();4141 // activerecorder->ToggleChannelFavorite(); 4101 4142 } 4102 4143 4103 4144 void TV::ChangeChannel(int direction) 4104 4145 { 4105 4146 bool muted = false; 4106 4147 4148 if ((browse_favorites || (direction == CHANNEL_DIRECTION_FAVORITE)) && 4149 (favorite_group_id > -1) && (direction != CHANNEL_DIRECTION_SAME)) 4150 { 4151 uint chanid; 4152 4153 // Collect channel info 4154 pbinfoLock.lock(); 4155 uint old_chanid = playbackinfo->chanid.toUInt(); 4156 pbinfoLock.unlock(); 4157 4158 chanid = ChannelUtil::GetNextChannel(m_channellist, old_chanid, direction); 4159 4160 ChangeChannel(chanid, ""); 4161 return; 4162 } else if (direction == CHANNEL_DIRECTION_FAVORITE) 4163 direction = CHANNEL_DIRECTION_UP; 4164 4107 4165 if (nvp) 4108 4166 { 4109 4167 AudioOutput *aud = nvp->getAudioOutput(); … … 5133 5191 5134 5192 bool changeChannel = false; 5135 5193 ProgramInfo *nextProgram = NULL; 5194 int favgrpid = favorite_group_id; 5136 5195 5137 5196 if (StateIsLiveTV(GetState())) 5138 5197 { … … 5147 5206 allowsecondary = nvp->getVideoOutput()->AllowPreviewEPG(); 5148 5207 5149 5208 // Start up EPG 5150 changeChannel = RunProgramGuide(chanid, channum, true, this, allowsecondary); 5209 changeChannel = RunProgramGuide(chanid, channum, true, this, allowsecondary, 5210 &favgrpid); 5151 5211 break; 5152 5212 } 5153 5213 case kPlaybackBox: … … 5189 5249 { 5190 5250 default: 5191 5251 case kScheduleProgramGuide: 5192 RunProgramGuide(chanid, channum, true );5252 RunProgramGuide(chanid, channum, true, NULL, true, &favgrpid); 5193 5253 break; 5194 5254 case kScheduleProgramFinder: 5195 5255 RunProgramFind(true, false); … … 5239 5299 DoPause(); 5240 5300 } 5241 5301 5302 // if favorite group was changed in EPG update local info 5303 if ((favgrpid != favorite_group_id) && (editType == kScheduleProgramGuide)) 5304 { 5305 favorite_group_id = favgrpid; 5306 5307 if (browse_favorites) 5308 { 5309 VERBOSE(VB_IMPORTANT, LOC + 5310 QString("Reloading favorite channel list for %1").arg(favorite_group_id)); 5311 5312 m_channellist = ChannelUtil::GetChannels(0, true, "channum, callsign", favorite_group_id); 5313 ChannelUtil::SortChannels(m_channellist, "channum", true); 5314 } 5315 } 5316 5242 5317 // Resize the window back to the MythTV Player size 5243 5318 if (!using_gui_size_for_tv) 5244 5319 { … … 5863 5938 { 5864 5939 if (!browsemode) 5865 5940 BrowseStart(); 5941 VERBOSE(VB_IMPORTANT,"In BrowseDispInfo"); 5942 // if browsing favorites is enabled or direction if BROWSE_FAVORITES 5943 // Then pick the next channel in the channel favorite list to browse 5944 // If favorite group is ALL CHANNELS (-1), then bypass picking from 5945 // the channel favorite list 5946 if ((browse_favorites || (direction == BROWSE_FAVORITE)) && 5947 (favorite_group_id > -1) && (direction != BROWSE_SAME) && 5948 (direction != BROWSE_RIGHT) && (direction != BROWSE_LEFT)) 5949 { 5950 uint chanid; 5951 int dir; 5952 5953 if ( (direction == BROWSE_UP) || (direction == BROWSE_FAVORITE) ) 5954 dir = CHANNEL_DIRECTION_UP; 5955 else if (direction == BROWSE_DOWN) 5956 dir = CHANNEL_DIRECTION_DOWN; 5957 else // this should never happen, but just in case 5958 dir = direction; 5959 5960 chanid = ChannelUtil::GetNextChannel(m_channellist, browsechanid.toUInt(), dir); 5961 VERBOSE(VB_IMPORTANT, QString("Get channel: %1").arg(chanid)); 5962 browsechanid = QString("%1").arg(chanid); 5963 browsechannum = QString::null; 5964 direction = BROWSE_SAME; 5965 } 5966 else if ((favorite_group_id == -1) && (direction == BROWSE_FAVORITE)) 5967 direction = BROWSE_UP; 5866 5968 5867 5969 InfoMap infoMap; 5868 5970 QDateTime curtime = QDateTime::currentDateTime(); … … 6607 6709 } 6608 6710 else if (action == "GUIDE") 6609 6711 EditSchedule(kScheduleProgramGuide); 6712 else if (action.left(10) == "FAVORITES_") 6713 processFavoritesEntry(action); 6610 6714 else if (action == "FINDER") 6611 6715 EditSchedule(kScheduleProgramFinder); 6612 6716 else if (action == "SCHEDULE") … … 6701 6805 } 6702 6806 } 6703 6807 6808 void TV::processFavoritesEntry(QString action) 6809 { 6810 if (action == "FAVORITES_ALL_CHANNELS") 6811 favorite_group_id = -1; 6812 else 6813 { 6814 action.remove("FAVORITES_"); 6815 favorite_group_id = action.toInt(); 6816 6817 if (browse_favorites) 6818 { 6819 m_channellist = ChannelUtil::GetChannels(0, true, "channum, callsign", favorite_group_id); 6820 ChannelUtil::SortChannels(m_channellist, "channum", true); 6821 } 6822 } 6823 } 6824 6704 6825 void TV::ShowOSDTreeMenu(void) 6705 6826 { 6706 6827 BuildOSDTreeMenu(); … … 6736 6857 freeRecorders = RemoteGetFreeRecorderCount(); 6737 6858 6738 6859 item = new OSDGenericTree(treeMenu, tr("Program Guide"), "GUIDE"); 6860 item = new OSDGenericTree(treeMenu, tr("Favorites"), "FAVORITES"); 6861 subitem = new OSDGenericTree(item, tr("All Channels"), 6862 "FAVORITES_ALL_CHANNELS", 6863 (favorite_group_id == -1) ? 1 : 0, 6864 NULL, "FAVORITEGROUP"); 6865 6866 FavoriteGroupList::iterator it; 6867 6868 for (it = m_favgrplist.begin(); it != m_favgrplist.end(); ++it) 6869 { 6870 QString name = QString("FAVORITES_%1").arg(it->grpid); 6871 subitem = new OSDGenericTree(item, it->name, name, 6872 ((int)(it->grpid) == favorite_group_id) ? 1 : 0, 6873 NULL, "FAVORITEGROUP"); 6874 } 6875 6739 6876 if (!gContext->GetNumSetting("JumpToProgramOSD", 1)) 6740 6877 { 6741 6878 item = new OSDGenericTree(treeMenu, tr("Jump to Program")); -
libs/libmythtv/tv_play.h
diff -Nur --exclude='*.lib' --exclude='*.o' mythtv/libs/libmythtv/tv_play.h mythtv-guide/libs/libmythtv/tv_play.h
old new 16 16 #include "util.h" 17 17 #include "programinfo.h" 18 18 #include "videoouttypes.h" 19 #include "channelutil.h" 20 #include "favoritegroup.h" 19 21 20 22 #include <qobject.h> 21 23 … … 191 193 // Used by EPG 192 194 void ChangeVolume(bool up); 193 195 void ToggleMute(void); 196 197 // Favorites 198 void SaveFavoriteGroup(void); 194 199 195 200 public slots: 196 201 void HandleOSDClosed(int osdType); … … 358 363 359 364 void BuildOSDTreeMenu(void); 360 365 void ShowOSDTreeMenu(void); 366 367 void processFavoritesEntry(QString action); 361 368 362 369 void UpdateLCD(void); 363 370 void ShowLCDChannelInfo(void); … … 626 633 // Network Control stuff 627 634 QValueList<QString> networkControlCommands; 628 635 QMutex ncLock; 636 637 int favorite_group_id; 638 uint browse_favorites; 639 FavoriteGroupList m_favgrplist; 640 DBChanList m_channellist; 629 641 }; 630 642 631 643 #endif -
programs/mythfrontend/globalsettings.cpp
diff -Nur --exclude='*.lib' --exclude='*.o' mythtv/programs/mythfrontend/globalsettings.cpp mythtv-guide/programs/mythfrontend/globalsettings.cpp
old new 2805 2805 return gc; 2806 2806 } 2807 2807 2808 static HostCheckBox *EPGShowFavorites()2809 {2810 HostCheckBox *gc = new HostCheckBox("EPGShowFavorites");2811 gc->setLabel(QObject::tr("Only display 'favorite' channels"));2812 gc->setHelpText(QObject::tr("If enabled, the EPG will initially display "2813 "only the channels marked as favorites. Pressing "2814 "\"4\" will toggle between displaying favorites and all "2815 "channels."));2816 gc->setValue(false);2817 return gc;2818 }2819 2808 2820 2809 static HostSpinBox *EPGChanDisplay() 2821 2810 { … … 2843 2832 return gc; 2844 2833 } 2845 2834 2835 static HostCheckBox *FavoritesRememberLast() 2836 { 2837 HostCheckBox *gc = new HostCheckBox("FavoritesRememberLast"); 2838 gc->setLabel(QObject::tr("Remember channel favorite group")); 2839 gc->setHelpText(QObject::tr("If enabled, the EPG will initially display " 2840 "only the channels from the last favorite group selected. Pressing " 2841 "\"4\" will toggle favorites group.")); 2842 gc->setValue(false); 2843 return gc; 2844 } 2845 2846 static HostComboBox *FavoritesDefaultGroup() 2847 { 2848 HostComboBox *gc = new HostComboBox("FavoritesDefaultGroup"); 2849 gc->setLabel(QObject::tr("Default channel favorite group")); 2850 2851 FavoriteGroupList favgrplist; 2852 2853 favgrplist = Favorites::GetFavoriteGroups(); 2854 2855 gc->addSelection(QObject::tr("All Channels"), "-1"); 2856 2857 FavoriteGroupList::iterator it; 2858 2859 for (it = favgrplist.begin(); it < favgrplist.end(); ++it) 2860 gc->addSelection(it->name, QString("%1").arg(it->grpid)); 2861 2862 gc->setHelpText(QObject::tr("The EPG will initially display " 2863 "only the channels from the last favorite group selected. Pressing " 2864 "\"4\" will toggle favorites group.")); 2865 gc->setValue(false); 2866 return gc; 2867 } 2868 2869 static HostCheckBox *FavoritesChangeChannel() 2870 { 2871 HostCheckBox *gc = new HostCheckBox("FavoritesChangeChannel"); 2872 gc->setLabel(QObject::tr("Browse/Change channels with Favorites")); 2873 gc->setHelpText(QObject::tr("If enabled, LiveTV will browse or change channels " 2874 "from the selected favorite group. \"All Channels\" " 2875 "favorite group may be selected to browse all channels.")); 2876 gc->setValue(false); 2877 return gc; 2878 } 2879 2880 // Favorite Settings 2881 class FavoriteSettings : public TriggeredConfigurationGroup 2882 { 2883 public: 2884 FavoriteSettings() : TriggeredConfigurationGroup(false, true, false, false) 2885 { 2886 setLabel(QObject::tr("Remember last channel favorite group")); 2887 setUseLabel(false); 2888 2889 Setting* RememberFavoriteEnabled = FavoritesRememberLast(); 2890 addChild(RememberFavoriteEnabled); 2891 setTrigger(RememberFavoriteEnabled); 2892 2893 ConfigurationGroup* settings = new VerticalConfigurationGroup(false); 2894 settings->addChild(FavoritesDefaultGroup()); 2895 addTarget("0", settings); 2896 2897 // show nothing if RememberFavoriteEnabled is on 2898 addTarget("1", new VerticalConfigurationGroup(true)); 2899 }; 2900 }; 2901 2846 2902 // General RecPriorities settings 2847 2903 2848 2904 static GlobalCheckBox *GRSchedMoveHigher() … … 4524 4580 general2->addChild(HDRingbufferSize()); 4525 4581 addChild(general2); 4526 4582 4583 VerticalConfigurationGroup* fav = new VerticalConfigurationGroup(false); 4584 fav->setLabel(QObject::tr("General (Favorites)")); 4585 FavoriteSettings *favoritesettings = new FavoriteSettings(); 4586 fav->addChild(favoritesettings); 4587 fav->addChild(FavoritesChangeChannel()); 4588 addChild(fav); 4527 4589 } 4528 4590 4529 4591 EPGSettings::EPGSettings() 4530 4592 { 4531 4593 VerticalConfigurationGroup* epg = new VerticalConfigurationGroup(false); 4532 epg->setLabel(QObject::tr("Program Guide") + " 1/ 2");4594 epg->setLabel(QObject::tr("Program Guide") + " 1/3"); 4533 4595 epg->addChild(EPGFillType()); 4534 4596 epg->addChild(EPGShowCategoryColors()); 4535 4597 epg->addChild(EPGShowCategoryText()); 4536 4598 epg->addChild(EPGScrollType()); 4537 4599 epg->addChild(EPGShowChannelIcon()); 4538 epg->addChild(EPGShowFavorites());4539 4600 epg->addChild(WatchTVGuide()); 4540 4601 epg->addChild(EPGChanDisplay()); 4541 4602 epg->addChild(EPGTimeDisplay()); 4542 4603 addChild(epg); 4543 4604 4544 4605 VerticalConfigurationGroup* gen = new VerticalConfigurationGroup(false); 4545 gen->setLabel(QObject::tr("Program Guide") + " 2/ 2");4606 gen->setLabel(QObject::tr("Program Guide") + " 2/3"); 4546 4607 gen->addChild(UnknownTitle()); 4547 4608 gen->addChild(UnknownCategory()); 4548 4609 gen->addChild(DefaultTVChannel()); 4549 4610 gen->addChild(SelectChangesChannel()); 4550 4611 gen->addChild(EPGRecThreshold()); 4551 4612 gen->addChild(EPGEnableJumpToChannel()); 4552 addChild(gen); 4613 addChild(gen); 4553 4614 } 4554 4615 4555 4616 GeneralRecPrioritiesSettings::GeneralRecPrioritiesSettings() -
programs/mythfrontend/main.cpp
diff -Nur --exclude='*.lib' --exclude='*.o' mythtv/programs/mythfrontend/main.cpp mythtv-guide/programs/mythfrontend/main.cpp
old new 47 47 #include "statusbox.h" 48 48 #include "lcddevice.h" 49 49 #include "langsettings.h" 50 #include "favoritegroup.h" 50 51 51 52 #include "libmythui/myththemedmenu.h" 52 53 #include "libmythui/myththemebase.h" … … 398 399 { 399 400 EPGSettings settings; 400 401 settings.exec(); 402 } 403 else if (sel == "settings favorites") 404 { 405 FavoriteGroupEditor editor; 406 editor.exec(); 401 407 } 402 408 else if (sel == "settings generalrecpriorities") 403 409 { -
programs/mythfrontend/tv_settings.xml
diff -Nur --exclude='*.lib' --exclude='*.o' mythtv/programs/mythfrontend/tv_settings.xml mythtv-guide/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_FAVORITE</type> 86 <text>Channel Favorite Groups</text> 87 <action>SETTINGS FAVORITES</action> 88 </button> 83 89 84 90 <button> 85 91 <type>TV_SETTINGS_PLAYBACK_GROUPS</type> -
themes/classic/tv_settings.xml
diff -Nur --exclude='*.o' --exclude='moc_*' --exclude='Makefil*' mythtv-orig/themes/classic/tv_settings.xml mythtv/themes/classic/tv_settings.xml
old new 66 66 </button> 67 67 68 68 <button> 69 <type>TV_SETTINGS_FAVORITE</type> 70 <text>Channel Favorite Groups</text> 71 <action>SETTINGS FAVORITES</action> 72 </button> 73 74 <button> 69 75 <type>TV_SETTINGS_PLAYBACK_GROUPS</type> 70 76 <text>Playback Groups</text> 71 77 <text lang="SV">Uppspelningsgrupper</text> -
themes/DVR/tv_settings.xml
diff -Nur --exclude='*.o' --exclude='moc_*' --exclude='Makefil*' 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_FAVORITE</type> 78 <text>Channel Favorite Groups</text> 79 <action>SETTINGS FAVORITES</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>