diff -rup mythtv.orig/libs/libmythtv/channelutil.cpp mythtv/libs/libmythtv/channelutil.cpp
old
|
new
|
bool ChannelUtil::GetChannelData( |
1265 | 1265 | dvb_transportid, dvb_networkid); |
1266 | 1266 | } |
1267 | 1267 | |
1268 | | DBChanList ChannelUtil::GetChannels(uint sourceid, bool vis_only, QString grp) |
| 1268 | DBChanList ChannelUtil::GetChannels(uint sourceid, bool vis_only, QString grp, |
| 1269 | int guideGroup) |
1269 | 1270 | { |
1270 | 1271 | DBChanList list; |
1271 | 1272 | QMap<uint,uint> favorites; |
… |
… |
DBChanList ChannelUtil::GetChannels(uint |
1282 | 1283 | } |
1283 | 1284 | |
1284 | 1285 | QString qstr = |
1285 | | "SELECT channum, callsign, chanid, " |
| 1286 | "SELECT channum, callsign, channel.chanid, " |
1286 | 1287 | " atsc_major_chan, atsc_minor_chan, " |
1287 | 1288 | " name, icon, visible " |
1288 | 1289 | "FROM channel "; |
1289 | 1290 | |
| 1291 | if (guideGroup > -1) |
| 1292 | qstr += ", guidechannels "; |
| 1293 | |
1290 | 1294 | if (sourceid) |
1291 | 1295 | qstr += QString("WHERE sourceid='%1' ").arg(sourceid); |
1292 | 1296 | else |
… |
… |
DBChanList ChannelUtil::GetChannels(uint |
1297 | 1301 | if (vis_only) |
1298 | 1302 | qstr += "AND visible=1 "; |
1299 | 1303 | |
| 1304 | if (guideGroup > -1) |
| 1305 | qstr += "AND channel.chanid = guidechannels.chanid AND " |
| 1306 | " guidechannels.groupid = :GUIDEGROUP "; |
| 1307 | |
1300 | 1308 | if (!grp.isEmpty()) |
1301 | 1309 | qstr += QString("GROUP BY %1 ").arg(grp); |
1302 | 1310 | |
1303 | 1311 | query.prepare(qstr); |
| 1312 | |
| 1313 | if (guideGroup > -1) |
| 1314 | query.bindValue(":GUIDEGROUP", guideGroup); |
| 1315 | |
1304 | 1316 | if (!query.exec() || !query.isActive()) |
1305 | 1317 | { |
1306 | 1318 | MythContext::DBError("get channels -- sourceid", query); |
1307 | 1319 | return list; |
1308 | 1320 | } |
1309 | 1321 | |
| 1322 | if ((guideGroup > -1) && (query.size() == 0)) |
| 1323 | { |
| 1324 | VERBOSE(VB_PLAYBACK, QString("GetChannels(): failed to find any channels " |
| 1325 | "associated with group %1").arg(guideGroup)); |
| 1326 | return GetChannels(sourceid, vis_only, grp, -1); |
| 1327 | } |
| 1328 | |
1310 | 1329 | while (query.next()) |
1311 | 1330 | { |
1312 | 1331 | if (query.value(0).toString().isEmpty() || !query.value(2).toUInt()) |
diff -rup mythtv.orig/libs/libmythtv/channelutil.h mythtv/libs/libmythtv/channelutil.h
old
|
new
|
class ChannelUtil |
146 | 146 | static QString GetVideoFilters(uint sourceid, const QString &channum) |
147 | 147 | { return GetChannelValueStr("videofilters", sourceid, channum); } |
148 | 148 | |
149 | | static DBChanList GetChannels(uint srcid, bool vis_only, QString grp=""); |
| 149 | static DBChanList GetChannels(uint srcid, bool vis_only, QString grp="", |
| 150 | int guideGroup = -1); |
150 | 151 | static void SortChannels(DBChanList &list, const QString &order, |
151 | 152 | bool eliminate_duplicates = false); |
152 | 153 | static void EliminateDuplicateChanNum(DBChanList &list); |
diff -rup mythtv.orig/libs/libmythtv/guidegrid.cpp mythtv/libs/libmythtv/guidegrid.cpp
old
|
new
|
using namespace std; |
35 | 35 | |
36 | 36 | bool RunProgramGuide(uint &chanid, QString &channum, |
37 | 37 | bool thread, TV *player, |
38 | | bool allowsecondaryepg) |
| 38 | bool allowsecondaryepg, |
| 39 | int guideGroup) |
39 | 40 | { |
40 | 41 | bool channel_changed = false; |
41 | 42 | |
… |
… |
bool RunProgramGuide(uint &chanid, QStri |
46 | 47 | |
47 | 48 | GuideGrid *gg = new GuideGrid(gContext->GetMainWindow(), |
48 | 49 | chanid, channum, |
49 | | player, allowsecondaryepg, "guidegrid"); |
| 50 | player, allowsecondaryepg, |
| 51 | guideGroup, "guidegrid"); |
50 | 52 | |
51 | 53 | gg->Show(); |
52 | 54 | |
… |
… |
bool RunProgramGuide(uint &chanid, QStri |
83 | 85 | GuideGrid::GuideGrid(MythMainWindow *parent, |
84 | 86 | uint chanid, QString channum, |
85 | 87 | TV *player, bool allowsecondaryepg, |
| 88 | int guideGroup, |
86 | 89 | const char *name) |
87 | 90 | : MythDialog(parent, name) |
88 | 91 | { |
… |
… |
GuideGrid::GuideGrid(MythMainWindow *par |
91 | 94 | int maxchannel = 0; |
92 | 95 | m_currentStartChannel = 0; |
93 | 96 | |
| 97 | m_currentGuideGroup = guideGroup; |
| 98 | |
94 | 99 | m_player = player; |
95 | 100 | |
96 | 101 | m_context = 0; |
… |
… |
void GuideGrid::fillChannelInfos(bool go |
562 | 567 | { |
563 | 568 | m_channelInfos.clear(); |
564 | 569 | |
| 570 | // Handle any special guide groups |
| 571 | if (m_currentGuideGroup == GUIDEGROUP_FAVORITES) |
| 572 | showFavorites = true; |
| 573 | |
565 | 574 | DBChanList channels = ChannelUtil::GetChannels(0, true, |
566 | | "channum, callsign"); |
| 575 | "channum, callsign", |
| 576 | m_currentGuideGroup); |
567 | 577 | ChannelUtil::SortChannels(channels, channelOrdering, true); |
568 | 578 | |
569 | 579 | if (showFavorites) |
diff -rup mythtv.orig/libs/libmythtv/guidegrid.h mythtv/libs/libmythtv/guidegrid.h
old
|
new
|
class QWidget; |
25 | 25 | #define MAX_DISPLAY_CHANS 12 |
26 | 26 | #define MAX_DISPLAY_TIMES 30 |
27 | 27 | |
| 28 | #define GUIDEGROUP_FAVORITES 9999 // Guide Group Favorites |
| 29 | |
28 | 30 | // Use this function to instantiate a guidegrid instance. |
29 | 31 | bool RunProgramGuide(uint &startChanId, QString &startChanNum, |
30 | 32 | bool thread = false, TV *player = NULL, |
31 | | bool allowsecondaryepg = true); |
| 33 | bool allowsecondaryepg = true, |
| 34 | int guideGroup = -1); |
32 | 35 | |
33 | 36 | |
34 | 37 | class GuideGrid : public MythDialog |
… |
… |
class GuideGrid : public MythDialog |
38 | 41 | GuideGrid(MythMainWindow *parent, |
39 | 42 | uint chanid = 0, QString channum = "", |
40 | 43 | TV *player = NULL, bool allowsecondaryepg = true, |
| 44 | int guideGroup = -1, |
41 | 45 | const char *name = "GuideGrid"); |
42 | 46 | ~GuideGrid(); |
43 | 47 | |
… |
… |
class GuideGrid : public MythDialog |
108 | 112 | |
109 | 113 | int m_context; |
110 | 114 | |
| 115 | int m_currentGuideGroup; |
| 116 | |
111 | 117 | bool selectChangesChannel; |
112 | 118 | int selectRecThreshold; |
113 | 119 | |
diff -rup mythtv.orig/libs/libmythtv/tv_play.cpp mythtv/libs/libmythtv/tv_play.cpp
old
|
new
|
bool TV::Init(bool createWindow) |
378 | 378 | return false; |
379 | 379 | } |
380 | 380 | |
| 381 | currentGuideGroup = -1; |
| 382 | GetGuideGroups(); |
| 383 | |
381 | 384 | baseFilters += gContext->GetSetting("CustomFilters"); |
382 | 385 | db_time_format = gContext->GetSetting("TimeFormat", "h:mm AP"); |
383 | 386 | db_short_date_format = gContext->GetSetting("ShortDateFormat", "M/d"); |
… |
… |
void TV::ProcessKeypress(QKeyEvent *e) |
2744 | 2747 | ToggleInputs(); |
2745 | 2748 | else if (action == "SWITCHCARDS") |
2746 | 2749 | SwitchCards(); |
2747 | | else if (action == "GUIDE") |
2748 | | EditSchedule(kScheduleProgramGuide); |
| 2750 | else if (!action.find("GUIDE")) |
| 2751 | ProcessGuideEntry(action); |
2749 | 2752 | else if (action == "TOGGLEPIPMODE") |
2750 | 2753 | TogglePIPView(); |
2751 | 2754 | else if (action == "TOGGLEPIPWINDOW") |
… |
… |
void TV::ProcessKeypress(QKeyEvent *e) |
2798 | 2801 | } |
2799 | 2802 | else if (action == "JUMPTODVDROOTMENU") |
2800 | 2803 | activenvp->GoToDVDMenu("menu"); |
2801 | | else if (action == "GUIDE") |
2802 | | EditSchedule(kScheduleProgramGuide); |
| 2804 | else if (!action.find("GUIDE")) |
| 2805 | ProcessGuideEntry(action); |
2803 | 2806 | else if (action == "FINDER") |
2804 | 2807 | EditSchedule(kScheduleProgramFinder); |
2805 | 2808 | else if (action == "TOGGLEEDIT" && !activerbuffer->isDVD()) |
… |
… |
void TV::ProcessKeypress(QKeyEvent *e) |
2838 | 2841 | } |
2839 | 2842 | } |
2840 | 2843 | |
| 2844 | void TV::ProcessGuideEntry(QString action) |
| 2845 | { |
| 2846 | currentGuideGroup = -1; |
| 2847 | |
| 2848 | if (action == "GUIDE_FAVORITES") |
| 2849 | currentGuideGroup = GUIDEGROUP_FAVORITES; |
| 2850 | else if (!action.find("GUIDE_")) |
| 2851 | { |
| 2852 | action.remove("GUIDE_"); |
| 2853 | |
| 2854 | QMapIterator<QString, int> it; |
| 2855 | |
| 2856 | for(it = guideGroups.begin(); it != guideGroups.end(); ++it) |
| 2857 | { |
| 2858 | if(action == it.key()) |
| 2859 | currentGuideGroup = it.data(); |
| 2860 | } |
| 2861 | } |
| 2862 | |
| 2863 | EditSchedule(kScheduleProgramGuide); |
| 2864 | } |
| 2865 | |
2841 | 2866 | void TV::processNetworkControlCommand(QString command) |
2842 | 2867 | { |
2843 | 2868 | QStringList tokens = QStringList::split(" ", command); |
… |
… |
void TV::doEditSchedule(int editType) |
4761 | 4786 | return; |
4762 | 4787 | } |
4763 | 4788 | |
| 4789 | if (currentGuideGroup > -1) |
| 4790 | VERBOSE(VB_PLAYBACK, QString("doEditSchedule(): using guide groupid %1") |
| 4791 | .arg(currentGuideGroup)); |
| 4792 | else |
| 4793 | VERBOSE(VB_PLAYBACK, "doEditSchedule(): guide defaulting to all channels"); |
| 4794 | |
4764 | 4795 | // Resize window to the MythTV GUI size |
4765 | 4796 | MythMainWindow *mwnd = gContext->GetMainWindow(); |
4766 | 4797 | bool using_gui_size_for_tv = gContext->GetNumSetting("GuiSizeForTV", 0); |
… |
… |
void TV::doEditSchedule(int editType) |
4787 | 4818 | allowsecondary = nvp->getVideoOutput()->AllowPreviewEPG(); |
4788 | 4819 | |
4789 | 4820 | // Start up EPG |
4790 | | changeChannel = RunProgramGuide(chanid, channum, true, this, allowsecondary); |
| 4821 | changeChannel = RunProgramGuide(chanid, channum, true, this, |
| 4822 | allowsecondary, currentGuideGroup); |
4791 | 4823 | |
4792 | 4824 | StopEmbeddingOutput(); |
4793 | 4825 | } |
… |
… |
void TV::TreeMenuSelected(OSDListTreeTyp |
6118 | 6150 | ToggleLetterbox(action.right(1).toInt()); |
6119 | 6151 | hidetree = false; |
6120 | 6152 | } |
6121 | | else if (action == "GUIDE") |
6122 | | EditSchedule(kScheduleProgramGuide); |
| 6153 | else if (!action.find("GUIDE")) |
| 6154 | ProcessGuideEntry(action); |
6123 | 6155 | else if (action == "FINDER") |
6124 | 6156 | EditSchedule(kScheduleProgramFinder); |
6125 | 6157 | else if (action == "SCHEDULE") |
… |
… |
void TV::BuildOSDTreeMenu(void) |
6309 | 6341 | if (!freeRecorders) |
6310 | 6342 | freeRecorders = RemoteGetFreeRecorderCount(); |
6311 | 6343 | |
6312 | | item = new OSDGenericTree(treeMenu, tr("Program Guide"), "GUIDE"); |
| 6344 | item = new OSDGenericTree(treeMenu, tr("Program Guide"), "GUIDE"); |
| 6345 | BuildOSDGuideMenu(item); |
6313 | 6346 | |
6314 | 6347 | if (freeRecorders) |
6315 | 6348 | { |
… |
… |
void TV::BuildOSDTreeMenu(void) |
6534 | 6567 | subitem = new OSDGenericTree(item, "120 " + tr("minutes"), "TOGGLESLEEP120"); |
6535 | 6568 | } |
6536 | 6569 | |
| 6570 | void TV::BuildOSDGuideMenu(OSDGenericTree *treeMenu) |
| 6571 | { |
| 6572 | OSDGenericTree *subitem; |
| 6573 | |
| 6574 | subitem = new OSDGenericTree(treeMenu, tr("All Channels"), "GUIDE"); |
| 6575 | subitem = new OSDGenericTree(treeMenu, tr("Favorites"), "GUIDE_FAVORITES"); |
| 6576 | |
| 6577 | QMapIterator<QString, int> it; |
| 6578 | |
| 6579 | for(it = guideGroups.begin(); it != guideGroups.end(); ++it) |
| 6580 | { |
| 6581 | QString name = it.key(); |
| 6582 | QString int_name = name; |
| 6583 | int_name.prepend("GUIDE_"); |
| 6584 | |
| 6585 | subitem = new OSDGenericTree(treeMenu, name, int_name.latin1()); |
| 6586 | } |
| 6587 | } |
| 6588 | |
| 6589 | void TV::GetGuideGroups(void) |
| 6590 | { |
| 6591 | guideGroups.clear(); |
| 6592 | |
| 6593 | MSqlQuery query(MSqlQuery::InitCon()); |
| 6594 | query.prepare("SELECT groupid, name FROM guidegroups ORDER BY groupid"); |
| 6595 | |
| 6596 | if (query.exec() && query.isActive() && query.size() > 0) |
| 6597 | while(query.next()) |
| 6598 | guideGroups.insert(query.value(1).toString(), query.value(0).toInt()); |
| 6599 | } |
| 6600 | |
6537 | 6601 | bool TV::FillMenuTracks(OSDGenericTree *treeMenu, uint type) |
6538 | 6602 | { |
6539 | 6603 | QString mainMsg = QString::null; |
diff -rup mythtv.orig/libs/libmythtv/tv_play.h mythtv/libs/libmythtv/tv_play.h
old
|
new
|
class TV : public QObject |
213 | 213 | void ChangeTrack(uint type, int dir); |
214 | 214 | void SetTrack(uint type, int trackNo); |
215 | 215 | |
| 216 | void GetGuideGroups(void); |
| 217 | void ProcessGuideEntry(QString action); |
| 218 | |
216 | 219 | // key queue commands |
217 | 220 | void AddKeyToInputQueue(char key); |
218 | 221 | void ClearInputQueues(bool hideosd = false); |
… |
… |
class TV : public QObject |
327 | 330 | void DoChangePictureAttribute(int type, int control, bool up); |
328 | 331 | |
329 | 332 | void BuildOSDTreeMenu(void); |
| 333 | void BuildOSDGuideMenu(OSDGenericTree *treeMenu); |
330 | 334 | void ShowOSDTreeMenu(void); |
331 | 335 | |
332 | 336 | void UpdateLCD(void); |
… |
… |
class TV : public QObject |
411 | 415 | bool needToJumpMenu; |
412 | 416 | QMap<QString,ProgramList> progLists; |
413 | 417 | |
| 418 | QMap<QString,int> guideGroups; |
| 419 | int currentGuideGroup; |
| 420 | |
414 | 421 | mutable QMutex chanEditMapLock; ///< Lock for chanEditMap and ddMap |
415 | 422 | InfoMap chanEditMap; ///< Channel Editing initial map |
416 | 423 | DDKeyMap ddMap; ///< DataDirect channel map |