Ticket #199: changroups.19873.3.diff
File changroups.19873.3.diff, 35.0 KB (added by , 15 years ago) |
---|
-
mythtv/themes/classic/tv_settings.xml
71 71 </button> 72 72 73 73 <button> 74 <type>TV_SETTINGS_CHANNEL_GROUP</type> 75 <text>Channel Groups</text> 76 <action>SETTINGS CHANNELGROUPS</action> 77 </button> 78 79 <button> 74 80 <type>TV_SETTINGS_PLAYBACK_GROUPS</type> 75 81 <text>Playback Groups</text> 76 82 <text lang="IT">Gruppi di Riproduzione</text> -
mythtv/themes/DVR/tv_settings.xml
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> -
mythtv/libs/libmythtv/dbchannelinfo.cpp
16 16 DBChannel::DBChannel( 17 17 const QString &_channum, const QString &_callsign, 18 18 uint _chanid, uint _major_chan, uint _minor_chan, 19 uint _ favorite, uint _mplexid, bool _visible,19 uint _mplexid, bool _visible, 20 20 const QString &_name, const QString &_icon) : 21 21 channum(_channum), 22 22 callsign(_callsign), chanid(_chanid), 23 23 major_chan(_major_chan), minor_chan(_minor_chan), 24 favorite(_favorite),mplexid(_mplexid), visible(_visible),24 mplexid(_mplexid), visible(_visible), 25 25 name(_name), icon(_icon) 26 26 { 27 27 channum.detach(); … … 39 39 chanid = other.chanid; 40 40 major_chan = other.major_chan; 41 41 minor_chan = other.minor_chan; 42 favorite = other.favorite;43 42 mplexid = (other.mplexid == 32767) ? 0 : other.mplexid; 44 43 visible = other.visible; 45 44 name = other.name; name.detach(); -
mythtv/libs/libmythtv/channelutil.h
168 168 static QString GetVideoFilters(uint sourceid, const QString &channum) 169 169 { return GetChannelValueStr("videofilters", sourceid, channum); } 170 170 171 static DBChanList GetChannels(uint srcid, bool vis_only, QString grp="" );171 static DBChanList GetChannels(uint srcid, bool vis_only, QString grp="", int changrpid=-1); 172 172 static void SortChannels(DBChanList &list, const QString &order, 173 173 bool eliminate_duplicates = false); 174 174 static void EliminateDuplicateChanNum(DBChanList &list); -
mythtv/libs/libmythtv/dbchannelinfo.h
21 21 DBChannel(const DBChannel&); 22 22 DBChannel(const QString &_channum, const QString &_callsign, 23 23 uint _chanid, uint _major_chan, uint _minor_chan, 24 uint _ favorite, uint _mplexid, bool _visible,24 uint _mplexid, bool _visible, 25 25 const QString &_name, const QString &_icon); 26 26 DBChannel& operator=(const DBChannel&); 27 27 … … 34 34 uint chanid; 35 35 uint major_chan; 36 36 uint minor_chan; 37 uint favorite;38 37 uint mplexid; 39 38 bool visible; 40 39 QString name; -
mythtv/libs/libmythtv/libmythtv.pro
156 156 HEADERS += channeleditor.h channelsettings.h 157 157 HEADERS += previewgenerator.h transporteditor.h 158 158 HEADERS += importicons.h 159 HEADERS += channelgroup.h channelgroupsettings.h 159 160 160 161 # Remove when everything is switched to MythUI 161 162 HEADERS += proglist_qt.h … … 181 182 SOURCES += channeleditor.cpp channelsettings.cpp 182 183 SOURCES += previewgenerator.cpp transporteditor.cpp 183 184 SOURCES += importicons.cpp 185 SOURCES += channelgroup.cpp channelgroupsettings.cpp 184 186 185 187 # Remove when everything is switched to MythUI 186 188 SOURCES += proglist_qt.cpp -
mythtv/libs/libmythtv/guidegrid.h
18 18 #include "programinfo.h" 19 19 #include "programlist.h" 20 20 #include "channelutil.h" 21 #include "channelgroup.h" 21 22 22 23 using namespace std; 23 24 … … 84 85 const QString &startChanNum, 85 86 bool thread = false, 86 87 TV *player = NULL, 87 bool allowsecondaryepg = true); 88 bool allowsecondaryepg = true, 89 int *changrpid = NULL); 88 90 89 91 DBChanList GetSelection(void) const; 90 92 … … 134 136 GuideGrid(MythMainWindow *parent, 135 137 uint chanid = 0, QString channum = "", 136 138 TV *player = NULL, bool allowsecondaryepg = true, 137 const char *name = "GuideGrid"); 139 const char *name = "GuideGrid", 140 int changrpid=-1); 138 141 ~GuideGrid(); 139 142 143 int GetChanGrp(void) {return m_changrpid;} 140 144 void paintEvent(QPaintEvent *); 141 145 142 146 private slots: … … 155 159 void paintPrograms(QPainter *); 156 160 void paintCurrentInfo(QPainter *); 157 161 void paintInfo(QPainter *); 162 void paintChanGroupInfo(QPainter *p); 158 163 void paintVideo(QPainter *); 159 164 160 165 void resizeImage(QPixmap *, QString); … … 180 185 QRect infoRect; 181 186 QRect curInfoRect; 182 187 QRect videoRect; 188 QRect changrpRect; 183 189 184 190 void fillChannelInfos(bool gotostartchannel = true); 185 191 int FindChannel(uint chanid, const QString &channum, … … 189 195 190 196 void fillProgramInfos(void); 191 197 void fillProgramRowInfos(unsigned int row); 198 199 void fillChanGroupInfo(void); 192 200 193 201 void setStartChannel(int newStartChannel); 194 202 195 203 void createProgramLabel(int, int); 204 205 int SelectChannelGroup(); 196 206 197 207 PixmapChannel *GetChannelInfo(uint chan_idx, int sel = -1); 198 208 const PixmapChannel *GetChannelInfo(uint chan_idx, int sel = -1) const; … … 222 232 int m_currentCol; 223 233 224 234 bool selectState; 225 bool showFavorites;226 235 bool sortReverse; 227 236 QString channelFormat; 228 237 … … 247 256 QTimer *timeCheck; 248 257 249 258 bool keyDown; 259 260 int m_changrpid; 261 ChannelGroupList m_changrplist; 250 262 251 263 QMutex jumpToChannelLock; 252 264 JumpToChannel *jumpToChannel; -
mythtv/libs/libmythtv/tv_play.h
25 25 #include "videoouttypes.h" 26 26 #include "volumebase.h" 27 27 #include "inputinfo.h" 28 #include "channelgroup.h" 28 29 29 30 #include <qobject.h> 30 31 … … 264 265 void ChangeVolume(PlayerContext*, bool up); 265 266 void ToggleMute(PlayerContext*); 266 267 268 // Channel Groups 269 void SaveChannelGroup(void); 270 271 267 272 void SetNextProgPIPState(PIPState state) { jumpToProgramPIPState = state; } 268 273 269 274 // Used for UDPNotify … … 509 514 510 515 void FillOSDTreeMenu( const PlayerContext*, OSDGenericTree*) const; 511 516 void FillMenuPlaying( const PlayerContext*, OSDGenericTree*) const; 517 void processChanGroupEntry(QString action); 512 518 void FillMenuPxP( const PlayerContext*, OSDGenericTree*) const; 513 519 void FillMenuInputSwitching(const PlayerContext*, OSDGenericTree*) const; 514 520 void FillMenuVideoAspect( const PlayerContext*, OSDGenericTree*) const; … … 745 751 QMap<int,int> recorderPlaybackInfoTimerId; 746 752 QMap<int,ProgramInfo> recorderPlaybackInfo; 747 753 754 // Channel favorite group stuff 755 int channel_group_id; 756 uint browse_changrp; 757 ChannelGroupList m_changrplist; 758 DBChanList m_channellist; 759 748 760 // Network Control stuff 749 761 MythDeque<QString> networkControlCommands; 750 762 -
mythtv/libs/libmythtv/guidegrid.cpp
34 34 #include "util.h" 35 35 #include "remoteutil.h" 36 36 #include "channelutil.h" 37 //#include "guidegrid.h" 37 38 #include "cardutil.h" 38 39 39 40 QWaitCondition epgIsVisibleCond; … … 171 172 const QString &channum, 172 173 bool thread, 173 174 TV *player, 174 bool allowsecondaryepg) 175 bool allowsecondaryepg, 176 int *changrpid) 175 177 { 176 178 DBChanList channel_changed; 179 int channel_group = -1; 177 180 181 if (changrpid != NULL) 182 channel_group = *changrpid; 183 178 184 //if (thread) 179 185 // qApp->lock(); 180 186 … … 182 188 183 189 GuideGrid *gg = new GuideGrid(gContext->GetMainWindow(), 184 190 chanid, channum, 185 player, allowsecondaryepg, "guidegrid"); 191 player, allowsecondaryepg, "guidegrid", 192 channel_group); 186 193 187 194 gg->Show(); 188 195 … … 210 217 //if (thread) 211 218 // qApp->lock(); 212 219 220 if (changrpid != NULL) 221 *changrpid = gg->GetChanGrp(); 222 213 223 delete gg; 214 224 215 225 gContext->removeCurrentLocation(); … … 223 233 GuideGrid::GuideGrid(MythMainWindow *parent, 224 234 uint chanid, QString channum, 225 235 TV *player, bool allowsecondaryepg, 226 const char *name ) :236 const char *name, int changrpid) : 227 237 MythDialog(parent, name), 228 238 m_player(player), 229 239 using_null_video(false), … … 240 250 DISPLAY_TIMES = 30; 241 251 int maxchannel = 0; 242 252 m_currentStartChannel = 0; 253 m_changrpid = changrpid; 254 m_changrplist = ChannelGroup::GetChannelGroups(); 243 255 244 256 m_context = 0; 245 257 … … 252 264 infoRect = QRect(0, 0, 0, 0); 253 265 curInfoRect = QRect(0, 0, 0, 0); 254 266 videoRect = QRect(0, 0, 0, 0); 267 changrpRect = QRect(0, 0, 0, 0); 255 268 256 269 jumpToChannelEnabled = 257 270 gContext->GetNumSetting("EPGEnableJumpToChannel", 1); … … 274 287 EmbedTVWindow(); 275 288 } 276 289 277 showFavorites = gContext->GetNumSetting("EPGShowFavorites", 0);278 290 gridfilltype = gContext->GetNumSetting("EPGFillType", UIGuideType::Alpha); 279 291 if (gridfilltype < (int)UIGuideType::Alpha) 280 292 { // update old settings to new fill types … … 331 343 container->SetDrawFontShadow(false); 332 344 } 333 345 346 container = theme->GetSet("channel_group"); 347 if (container) 348 { 349 UITextType *type = (UITextType *)container->GetType("changroup"); 350 QString changroup; 351 352 changroup = ChannelGroup::GetChannelGroupName(m_changrplist, m_changrpid); 353 354 if (type) 355 type->SetText(changroup); 356 } 357 334 358 channelOrdering = gContext->GetSetting("ChannelOrdering", "channum"); 335 359 dateformat = gContext->GetSetting("ShortDateFormat", "ddd d"); 336 360 unknownTitle = gContext->GetSetting("UnknownTitle", "Unknown"); … … 703 727 curInfoRect = area; 704 728 if (name.toLower() == "current_video") 705 729 videoRect = area; 730 if (name.toLower() == "channel_group") 731 changrpRect = area; 706 732 } 707 733 708 734 PixmapChannel *GuideGrid::GetChannelInfo(uint chan_idx, int sel) … … 891 917 m_channelInfoIdx.clear(); 892 918 m_currentStartChannel = 0; 893 919 894 DBChanList channels = ChannelUtil::GetChannels(0, true );920 DBChanList channels = ChannelUtil::GetChannels(0, true, "", m_changrpid); 895 921 ChannelUtil::SortChannels(channels, channelOrdering, false); 896 922 897 if (showFavorites)898 {899 DBChanList tmp;900 for (uint i = 0; i < channels.size(); i++)901 {902 if (channels[i].favorite)903 tmp.push_back(channels[i]);904 }905 906 if (!tmp.empty())907 channels = tmp;908 }909 910 923 typedef vector<uint> uint_list_t; 911 924 QMap<QString,uint_list_t> channum_to_index_map; 912 925 QMap<QString,uint_list_t> callsign_to_index_map; … … 1124 1137 } 1125 1138 } 1126 1139 1140 void GuideGrid::fillChanGroupInfo(void) 1141 { 1142 LayerSet *container = NULL; 1143 UITextType *type = NULL; 1144 1145 container = theme->GetSet("channel_group"); 1146 if (container) 1147 { 1148 type = (UITextType *)container->GetType("changroup"); 1149 QString changroup; 1150 1151 changroup = ChannelGroup::GetChannelGroupName(m_changrplist, m_changrpid); 1152 1153 if (type) 1154 type->SetText(changroup); 1155 } 1156 } 1157 1127 1158 void GuideGrid::fillProgramRowInfos(unsigned int row) 1128 1159 { 1129 1160 LayerSet *container = NULL; … … 1401 1432 paintPrograms(&p); 1402 1433 if (r.intersects(curInfoRect)) 1403 1434 paintCurrentInfo(&p); 1435 if (r.intersects(changrpRect)) 1436 paintChanGroupInfo(&p); 1404 1437 1405 1438 // if jumpToChannel has its own rect, use that; 1406 1439 // otherwise use the date's rect … … 1538 1571 p->drawPixmap(dr.topLeft(), pix); 1539 1572 } 1540 1573 1574 void GuideGrid::paintChanGroupInfo(QPainter *p) 1575 { 1576 QRect dr = changrpRect; 1577 QPixmap pix(dr.size()); 1578 pix.fill(this, dr.topLeft()); 1579 QPainter tmp(&pix); 1580 1581 LayerSet *container = NULL; 1582 container = theme->GetSet("channel_group"); 1583 if (container) 1584 { 1585 container->Draw(&tmp, 1, m_context); 1586 container->Draw(&tmp, 2, m_context); 1587 container->Draw(&tmp, 3, m_context); 1588 container->Draw(&tmp, 4, m_context); 1589 container->Draw(&tmp, 5, m_context); 1590 container->Draw(&tmp, 6, m_context); 1591 container->Draw(&tmp, 7, m_context); 1592 container->Draw(&tmp, 8, m_context); 1593 } 1594 tmp.end(); 1595 p->drawPixmap(dr.topLeft(), pix); 1596 } 1597 1541 1598 bool GuideGrid::paintChannels(QPainter *p) 1542 1599 { 1543 1600 QRect cr = channelRect; … … 1633 1690 } 1634 1691 1635 1692 QString tmpChannelFormat = channelFormat; 1636 if (chinfo->favorite > 0)1637 {1638 tmpChannelFormat.insert(1639 tmpChannelFormat.indexOf('<'), "<MARK:fav>");1640 }1641 1693 1642 1694 if (unavailable) 1643 1695 { … … 1673 1725 } 1674 1726 } 1675 1727 1728 if (m_channelInfos.size() == 0) 1729 { 1730 // if the user has selected a channel group with no channels 1731 // Reset the text and icon. This will display one blank line 1732 // to show that the channel group has no channels 1733 if (type) 1734 { 1735 type->SetText(0, ""); 1736 type->ResetImage(0); 1737 } 1738 } 1739 1676 1740 if (container) 1677 1741 { 1678 1742 container->Draw(&tmp, 1, m_context); … … 1808 1872 1809 1873 void GuideGrid::toggleGuideListing() 1810 1874 { 1811 showFavorites = (!showFavorites); 1812 generateListings(); 1875 int oldchangrpid = m_changrpid; 1876 1877 m_changrpid = ChannelGroup::GetNextChannelGroup(m_changrplist, oldchangrpid); 1878 1879 if (oldchangrpid != m_changrpid) 1880 generateListings(); 1881 1882 fillChanGroupInfo(); 1883 update(changrpRect); 1813 1884 } 1814 1885 1815 1886 void GuideGrid::generateListings() … … 1828 1899 update(fullRect); 1829 1900 } 1830 1901 1902 int GuideGrid::SelectChannelGroup() 1903 { 1904 if (m_changrplist.empty()) 1905 { 1906 MythPopupBox::showOkPopup(gContext->GetMainWindow(), "", 1907 "You don't have any channel groups defined"); 1908 1909 return -1; 1910 } 1911 1912 MythPopupBox *popup = new MythPopupBox(gContext->GetMainWindow(), "SelectChannelGroup Popup"); 1913 popup->addLabel("Select Channel Group"); 1914 1915 for (uint i = 0; i < m_changrplist.size(); i++) 1916 popup->addButton(m_changrplist[i].name); 1917 1918 popup->addButton(tr("Cancel"))->setFocus(); 1919 1920 DialogCode result = popup->ExecPopup(); 1921 1922 popup->deleteLater(); 1923 1924 // If the user cancelled, return a special value 1925 if (result == MythDialog::Rejected) 1926 return -1; 1927 else 1928 return m_changrplist[result - kDialogCodeListStart].grpid; 1929 } 1930 1831 1931 void GuideGrid::toggleChannelFavorite() 1832 1932 { 1833 MSqlQuery query(MSqlQuery::InitCon());1933 int grpid; 1834 1934 1935 if (m_changrpid == -1) 1936 { 1937 grpid = SelectChannelGroup(); 1938 1939 if (grpid == -1) 1940 return; 1941 } 1942 else 1943 grpid = m_changrpid; 1944 1835 1945 // Get current channel id, and make sure it exists... 1836 1946 int chanNum = m_currentRow + m_currentStartChannel; 1837 1947 if (chanNum >= (int)m_channelInfos.size()) … … 1842 1952 chanNum = 0; 1843 1953 1844 1954 PixmapChannel *ch = GetChannelInfo(chanNum); 1845 uint favid = ch->favorite;1846 1955 uint chanid = ch->chanid; 1847 1956 1848 if (favid > 0) 1849 { 1850 query.prepare("DELETE FROM favorites WHERE favid = :FAVID ;"); 1851 query.bindValue(":FAVID", favid); 1852 query.exec(); 1853 } 1854 else 1855 { 1856 // We have no favorites record...Add one to toggle... 1857 query.prepare("INSERT INTO favorites (chanid) VALUES (:FAVID);"); 1858 query.bindValue(":FAVID", chanid); 1859 query.exec(); 1860 } 1861 1862 if (showFavorites) 1957 if (m_changrpid == -1) 1958 // If currently viewing all channels, allow to add only not delete 1959 ChannelGroup::ToggleChannel(chanid, grpid, false); 1960 else 1961 // Only allow delete if viewing the favorite group in question 1962 ChannelGroup::ToggleChannel(chanid, grpid, true); 1963 1964 // If viewing favorites, refresh because a channel was removed 1965 if (m_changrpid != -1) 1863 1966 generateListings(); 1864 else1865 {1866 int maxchannel = 0;1867 DISPLAY_CHANS = desiredDisplayChans;1868 fillChannelInfos(false);1869 maxchannel = max((int)GetChannelCount() - 1, 0);1870 DISPLAY_CHANS = min(DISPLAY_CHANS, maxchannel + 1);1871 1872 repaint(channelRect);1873 }1874 1967 } 1875 1968 1876 1969 void GuideGrid::cursorLeft() -
mythtv/libs/libmythtv/channelutil.cpp
1570 1570 return true; 1571 1571 } 1572 1572 1573 DBChanList ChannelUtil::GetChannels(uint sourceid, bool vis_only, QString grp )1573 DBChanList ChannelUtil::GetChannels(uint sourceid, bool vis_only, QString grp, int changrpid) 1574 1574 { 1575 1575 DBChanList list; 1576 QMap<uint,uint> favorites;1576 1577 1577 MSqlQuery query(MSqlQuery::InitCon()); 1578 query.prepare(1579 "SELECT chanid, favid "1580 "FROM favorites");1581 if (!query.exec() || !query.isActive())1582 MythDB::DBError("get channels -- favorites", query);1583 else1584 {1585 while (query.next())1586 favorites[query.value(0).toUInt()] = query.value(1).toUInt();1587 }1588 1578 1589 1579 QString qstr = 1590 "SELECT channum, callsign, chan id, "1580 "SELECT channum, callsign, channel.chanid, " 1591 1581 " atsc_major_chan, atsc_minor_chan, " 1592 1582 " name, icon, mplexid, visible " 1593 1583 "FROM channel "; 1594 1584 1585 // Select only channels from the specified channel group 1586 if (changrpid > -1) 1587 qstr += QString(",channelgroup "); 1588 1595 1589 if (sourceid) 1596 1590 qstr += QString("WHERE sourceid='%1' ").arg(sourceid); 1597 1591 else … … 1599 1593 "WHERE cardinput.sourceid = channel.sourceid AND " 1600 1594 " cardinput.cardid = capturecard.cardid "; 1601 1595 1596 if (changrpid > -1) 1597 { 1598 qstr += QString("AND channel.chanid = channelgroup.chanid " 1599 "AND channelgroup.grpid ='%1' ").arg(changrpid); 1600 } 1601 1602 1602 if (vis_only) 1603 1603 qstr += "AND visible=1 "; 1604 1604 … … 1623 1623 query.value(2).toUInt(), /* chanid */ 1624 1624 query.value(3).toUInt(), /* ATSC major */ 1625 1625 query.value(4).toUInt(), /* ATSC minor */ 1626 favorites[query.value(2).toUInt()], /* favid */1627 1626 query.value(7).toUInt(), /* mplexid */ 1628 1627 query.value(8).toBool(), /* visible */ 1629 1628 query.value(5).toString(), /* name */ … … 1806 1805 (mplexid_restriction && 1807 1806 (mplexid_restriction != it->mplexid)))); 1808 1807 } 1809 else if ( CHANNEL_DIRECTION_UP == direction)1808 else if ((CHANNEL_DIRECTION_UP == direction) || (CHANNEL_DIRECTION_FAVORITE == direction)) 1810 1809 { 1811 1810 do 1812 1811 { … … 1819 1818 (mplexid_restriction && 1820 1819 (mplexid_restriction != it->mplexid)))); 1821 1820 } 1822 else if (CHANNEL_DIRECTION_FAVORITE == direction)1823 {1824 do1825 {1826 it++;1827 if (it == sorted.end())1828 it = sorted.begin();1829 }1830 while ((it != start) &&1831 (!it->favorite ||1832 (skip_non_visible && !it->visible) ||1833 (mplexid_restriction &&1834 (mplexid_restriction != it->mplexid))));1835 }1836 1821 1837 1822 return it->chanid; 1838 1823 } -
mythtv/libs/libmythtv/tv_play.cpp
346 346 347 347 bool allowrerecord = tv->getAllowRerecord(); 348 348 bool deleterecording = tv->getRequestDelete(); 349 350 tv->SaveChannelGroup(); 349 351 350 352 delete tv; 351 353 … … 421 423 "in the program guide", "0"); 422 424 REG_KEY("TV Frontend", "GUIDE", "Show the Program Guide", "S"); 423 425 REG_KEY("TV Frontend", "FINDER", "Show the Program Finder", "#"); 424 REG_KEY("TV Frontend", "NEXTFAV", " Toggle showing all channels or just"425 " favorites in the program guide.", "/");426 REG_KEY("TV Frontend", "NEXTFAV", "Cycle through channel groups and all channels " 427 "in the program guide.", "/,S"); 426 428 REG_KEY("TV Frontend", "CHANUPDATE", "Switch channels without exiting " 427 429 "guide in Live TV mode.", "X"); 428 430 REG_KEY("TV Frontend", "VOLUMEDOWN", "Volume down", "[,{,F10,Volume Down"); … … 784 786 osd_general_timeout = gContext->GetNumSetting("OSDGeneralTimeout", 2); 785 787 osd_prog_info_timeout= gContext->GetNumSetting("OSDProgramInfoTimeout", 3); 786 788 tryUnflaggedSkip = gContext->GetNumSetting("TryUnflaggedSkip", 0); 789 channel_group_id = gContext->GetNumSetting("ChannelGroupDefault", -1); 790 browse_changrp = gContext->GetNumSetting("BrowseChannelGroup", 0); 787 791 smartForward = gContext->GetNumSetting("SmartForward", 0); 788 792 stickykeys = gContext->GetNumSetting("StickyKeys"); 789 793 ff_rew_repos = gContext->GetNumSetting("FFRewReposTime", 100)/100.0; … … 798 802 if (!feVBI.isEmpty()) 799 803 vbimode = VBIMode::Parse(gContext->GetSetting(feVBI)); 800 804 805 channel_group_id = gContext->GetNumSetting("ChannelGroupDefault", -1); 806 browse_changrp = gContext->GetNumSetting("BrowseChannelGroup", 0); 807 808 if (browse_changrp && (channel_group_id > -1)) 809 { 810 m_channellist = ChannelUtil::GetChannels(0, true, "channum, callsign", channel_group_id); 811 ChannelUtil::SortChannels(m_channellist, "channum", true); 812 } 813 814 m_changrplist = ChannelGroup::GetChannelGroups(); 815 801 816 if (createWindow) 802 817 { 803 818 MythMainWindow *mainWindow = gContext->GetMainWindow(); … … 973 988 return ret; 974 989 } 975 990 991 void TV::SaveChannelGroup(void) 992 { 993 int changrpid = gContext->GetNumSetting("ChannelGroupDefault", -1); 994 int remember_last_changrp = gContext->GetNumSetting("ChannelGroupRememberLast", 0); 995 if (remember_last_changrp && (changrpid != channel_group_id)) 996 gContext->SaveSetting("ChannelGroupDefault", channel_group_id); 997 } 998 999 976 1000 /** 977 1001 * \brief get tv state of active player context 978 1002 */ … … 6153 6177 void TV::ToggleChannelFavorite(PlayerContext *ctx) 6154 6178 { 6155 6179 if (ctx->recorder) 6156 ctx->recorder->ToggleChannelFavorite();6180 ;//ctx->recorder->ToggleChannelFavorite(); 6157 6181 } 6158 6182 6159 6183 QString TV::GetQueuedInput(void) const … … 6408 6432 void TV::ChangeChannel(PlayerContext *ctx, int direction) 6409 6433 { 6410 6434 bool muted = false; 6435 if ((browse_changrp || (direction == CHANNEL_DIRECTION_FAVORITE)) && 6436 (channel_group_id > -1) && (direction != CHANNEL_DIRECTION_SAME)) 6437 { 6438 uint chanid; 6439 // Collect channel info 6440 ctx->LockPlayingInfo(__FILE__, __LINE__); 6441 uint old_chanid = ctx->playingInfo->chanid.toUInt(); 6442 ctx->UnlockPlayingInfo(__FILE__, __LINE__); 6443 chanid = ChannelUtil::GetNextChannel(m_channellist, old_chanid, 0, direction); 6444 ChangeChannel(ctx,chanid, ""); 6445 return; 6446 } else if (direction == CHANNEL_DIRECTION_FAVORITE) 6447 direction = CHANNEL_DIRECTION_UP; 6411 6448 6412 6449 QString oldinputname = ctx->recorder->GetInput(); 6413 6450 … … 7579 7616 7580 7617 // Actually show the pop-up UI 7581 7618 DBChanList changeChannel; 7619 int changrpid = channel_group_id; 7582 7620 ProgramInfo *nextProgram = NULL; 7621 7583 7622 switch (editType) 7584 7623 { 7585 7624 case kScheduleProgramGuide: 7586 7625 { 7587 7626 TV *player = (pause_active) ? NULL : this; 7588 7627 changeChannel = GuideGrid::Run( 7589 chanid, channum, false, player, isLiveTV && player );7628 chanid, channum, false, player, isLiveTV && player,&changrpid); 7590 7629 break; 7591 7630 } 7592 7631 case kScheduleProgramFinder: … … 7625 7664 actx = GetPlayerReadLock(-1, __FILE__, __LINE__); 7626 7665 StopEmbedding(actx); // Undo any embedding 7627 7666 DoSetPauseState(actx, was_paused); // Restore pause states 7667 7668 // if channel group was changed in EPG update local info 7669 if ((changrpid != channel_group_id) && (editType == kScheduleProgramGuide)) 7670 { 7671 channel_group_id = changrpid; 7672 if (browse_changrp) 7673 { 7674 VERBOSE(VB_IMPORTANT, LOC + 7675 QString("Reloading channel group list for %1").arg(channel_group_id)); 7676 m_channellist = ChannelUtil::GetChannels(0, true, "channum, callsign", channel_group_id); 7677 ChannelUtil::SortChannels(m_channellist, "channum", true); 7678 } 7679 } 7680 7681 7628 7682 // If user selected a new channel in the EPG, change to that channel 7629 7683 if (isLiveTV && changeChannel.size()) 7630 7684 ChangeChannel(actx, changeChannel); … … 8474 8528 { 8475 8529 if (!browsemode) 8476 8530 BrowseStart(ctx); 8531 if ((browse_changrp || (direction == BROWSE_FAVORITE)) && 8532 (channel_group_id > -1) && (direction != BROWSE_SAME) && 8533 (direction != BROWSE_RIGHT) && (direction != BROWSE_LEFT)) 8534 { 8535 uint chanid; 8536 int dir; 8477 8537 8538 if ( (direction == BROWSE_UP) || (direction == BROWSE_FAVORITE) ) 8539 dir = CHANNEL_DIRECTION_UP; 8540 else if (direction == BROWSE_DOWN) 8541 dir = CHANNEL_DIRECTION_DOWN; 8542 else // this should never happen, but just in case 8543 dir = direction; 8544 8545 chanid = ChannelUtil::GetNextChannel(m_channellist, browsechanid, 0, dir); 8546 VERBOSE(VB_IMPORTANT, QString("Get channel: %1").arg(chanid)); 8547 browsechanid = chanid; 8548 browsechannum = QString::null; 8549 direction = BROWSE_SAME; 8550 } 8551 else if ((channel_group_id == -1) && (direction == BROWSE_FAVORITE)) 8552 direction = BROWSE_UP; 8478 8553 OSD *osd = GetOSDLock(ctx); 8479 8554 if (ctx->paused || !osd) 8480 8555 { … … 9376 9451 { 9377 9452 ToggleAdjustFill(actx, (AdjustFillMode) action.right(1).toInt()); 9378 9453 } 9454 else if (action.left(10) == "CHANGROUP_") 9455 processChanGroupEntry(action); 9379 9456 else if (action == "GUIDE") 9380 9457 EditSchedule(actx, kScheduleProgramGuide); 9381 9458 else if (action == "FINDER") … … 9525 9602 } 9526 9603 } 9527 9604 9605 void TV::processChanGroupEntry(QString action) 9606 { 9607 if (action == "CHANGROUP_ALL_CHANNELS") 9608 channel_group_id = -1; 9609 else 9610 { 9611 action.remove("CHANGROUP_"); 9612 channel_group_id = action.toInt(); 9613 if (browse_changrp) 9614 { 9615 m_channellist = ChannelUtil::GetChannels(0, true, "channum, callsign", channel_group_id); 9616 ChannelUtil::SortChannels(m_channellist, "channum", true); 9617 } 9618 } 9619 } 9620 9528 9621 void TV::FillOSDTreeMenu( 9529 9622 const PlayerContext *ctx, OSDGenericTree *treeMenu) const 9530 9623 { 9531 9624 new OSDGenericTree(treeMenu, tr("Program Guide"), "GUIDE"); 9625 OSDGenericTree *cg_item = new OSDGenericTree(treeMenu, tr("Channel Groups"),"CHANGROUP"); 9626 new OSDGenericTree(cg_item, tr("All Channels"), "CHANGROUP_ALL_CHANNELS",(channel_group_id == -1) ? 1 : 0,NULL, "CHANNELGROUP"); 9627 ChannelGroupList::const_iterator it = m_changrplist.begin(); 9628 for (; it != m_changrplist.end(); ++it) 9629 { 9630 QString name = QString("CHANGROUP_%1").arg(it->grpid); 9631 new OSDGenericTree(cg_item, it->name, name, 9632 ((int)(it->grpid) == channel_group_id) ? 1 : 0, 9633 NULL, "CHANNELGROUP"); 9634 } 9532 9635 9533 9636 FillMenuPxP(ctx, treeMenu); 9534 9637 -
mythtv/programs/mythfrontend/globalsettings.cpp
3156 3156 return gc; 3157 3157 } 3158 3158 3159 static HostCheckBox *EPGShowFavorites()3160 {3161 HostCheckBox *gc = new HostCheckBox("EPGShowFavorites");3162 gc->setLabel(QObject::tr("Only display 'favorite' channels"));3163 gc->setHelpText(QObject::tr("If enabled, the EPG will initially display "3164 "only the channels marked as favorites. Pressing "3165 "\"4\" will toggle between displaying favorites and all "3166 "channels."));3167 gc->setValue(false);3168 return gc;3169 }3170 3159 3171 3160 static HostSpinBox *EPGChanDisplay() 3172 3161 { … … 3194 3183 return gc; 3195 3184 } 3196 3185 3186 static HostCheckBox *ChannelGroupRememberLast() 3187 { 3188 HostCheckBox *gc = new HostCheckBox("ChannelGroupRememberLast"); 3189 gc->setLabel(QObject::tr("Remember last channel group")); 3190 gc->setHelpText(QObject::tr("If enabled, the EPG will initially display " 3191 "only the channels from the last channel group selected. Pressing " 3192 "\"4\" will toggle channel group.")); 3193 gc->setValue(false); 3194 return gc; 3195 } 3196 3197 static HostComboBox *ChannelGroupDefault() 3198 { 3199 HostComboBox *gc = new HostComboBox("ChannelGroupDefault"); 3200 gc->setLabel(QObject::tr("Default channel group")); 3201 3202 ChannelGroupList changrplist; 3203 3204 changrplist = ChannelGroup::GetChannelGroups(); 3205 3206 gc->addSelection(QObject::tr("All Channels"), "-1"); 3207 3208 ChannelGroupList::iterator it; 3209 3210 for (it = changrplist.begin(); it < changrplist.end(); ++it) 3211 gc->addSelection(it->name, QString("%1").arg(it->grpid)); 3212 3213 gc->setHelpText(QObject::tr("Default channel group to be shown in the the EPG" 3214 "Pressing " 3215 "\"4\" will toggle channel group.")); 3216 gc->setValue(false); 3217 return gc; 3218 } 3219 3220 static HostCheckBox *BrowseChannelGroup() 3221 { 3222 HostCheckBox *gc = new HostCheckBox("BrowseChannelGroup"); 3223 gc->setLabel(QObject::tr("Browse/Change channels from Channel Group")); 3224 gc->setHelpText(QObject::tr("If enabled, LiveTV will browse or change channels " 3225 "from the selected channel group. \"All Channels\" " 3226 "channel group may be selected to browse all channels.")); 3227 gc->setValue(false); 3228 return gc; 3229 } 3230 3231 // Channel Group Settings 3232 class ChannelGroupSettings : public TriggeredConfigurationGroup 3233 { 3234 public: 3235 ChannelGroupSettings() : TriggeredConfigurationGroup(false, true, false, false) 3236 { 3237 setLabel(QObject::tr("Remember last channel group")); 3238 setUseLabel(false); 3239 3240 Setting* RememberChanGrpEnabled = ChannelGroupRememberLast(); 3241 addChild(RememberChanGrpEnabled); 3242 setTrigger(RememberChanGrpEnabled); 3243 3244 ConfigurationGroup* settings = new VerticalConfigurationGroup(false); 3245 settings->addChild(ChannelGroupDefault()); 3246 addTarget("0", settings); 3247 3248 // show nothing if RememberChanGrpEnabled is on 3249 addTarget("1", new VerticalConfigurationGroup(true)); 3250 }; 3251 }; 3252 3197 3253 // General RecPriorities settings 3198 3254 3199 3255 static GlobalCheckBox *GRSchedMoveHigher() … … 4962 5018 general2->addChild(CategoryOverTimeSettings()); 4963 5019 addChild(general2); 4964 5020 5021 VerticalConfigurationGroup* changrp = new VerticalConfigurationGroup(false); 5022 changrp->setLabel(QObject::tr("General (Channel Groups)")); 5023 ChannelGroupSettings *changroupsettings = new ChannelGroupSettings(); 5024 changrp->addChild(changroupsettings); 5025 changrp->addChild(BrowseChannelGroup()); 5026 addChild(changrp); 4965 5027 } 4966 5028 4967 5029 EPGSettings::EPGSettings() 4968 5030 { 4969 5031 VerticalConfigurationGroup* epg = new VerticalConfigurationGroup(false); 4970 epg->setLabel(QObject::tr("Program Guide") + " 1/ 2");5032 epg->setLabel(QObject::tr("Program Guide") + " 1/3"); 4971 5033 epg->addChild(EPGFillType()); 4972 5034 epg->addChild(EPGShowCategoryColors()); 4973 5035 epg->addChild(EPGShowCategoryText()); 4974 5036 epg->addChild(EPGScrollType()); 4975 5037 epg->addChild(EPGShowChannelIcon()); 4976 epg->addChild(EPGShowFavorites());4977 5038 epg->addChild(WatchTVGuide()); 4978 5039 epg->addChild(EPGChanDisplay()); 4979 5040 epg->addChild(EPGTimeDisplay()); 4980 5041 addChild(epg); 4981 5042 4982 5043 VerticalConfigurationGroup* gen = new VerticalConfigurationGroup(false); 4983 gen->setLabel(QObject::tr("Program Guide") + " 2/ 2");5044 gen->setLabel(QObject::tr("Program Guide") + " 2/3"); 4984 5045 gen->addChild(UnknownTitle()); 4985 5046 gen->addChild(UnknownCategory()); 4986 5047 gen->addChild(DefaultTVChannel()); 4987 5048 gen->addChild(SelectChangesChannel()); 4988 5049 gen->addChild(EPGRecThreshold()); 4989 5050 gen->addChild(EPGEnableJumpToChannel()); 4990 addChild(gen); 5051 addChild(gen); 4991 5052 } 4992 5053 4993 5054 GeneralRecPrioritiesSettings::GeneralRecPrioritiesSettings() -
mythtv/programs/mythfrontend/main.cpp
52 52 #include "lcddevice.h" 53 53 #include "langsettings.h" 54 54 #include "mythcommandlineparser.h" 55 #include "channelgroupsettings.h" 55 56 56 57 #include "myththemedmenu.h" 57 58 #include "myththemebase.h" … … 500 501 EPGSettings settings; 501 502 settings.exec(); 502 503 } 504 else if (sel == "settings channelgroups") 505 { 506 ChannelGroupEditor editor; 507 editor.exec(); 508 } 503 509 else if (sel == "settings generalrecpriorities") 504 510 { 505 511 GeneralRecPrioritiesSettings settings; -
mythtv/programs/mythfrontend/tv_settings.xml
90 90 <text lang="DE">Wiedergabe OSD</text> 91 91 <action>SETTINGS OSD</action> 92 92 </button> 93 94 <button> 95 <type>TV_SETTINGS_CHANNEL_GROUP</type> 96 <text>Channel Groups</text> 97 <action>SETTINGS CHANNELGROUPS</action> 98 </button> 93 99 94 100 <button> 95 101 <type>TV_SETTINGS_PLAYBACK_GROUPS</type>