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