Ticket #199: channelgroup.4.diff

File channelgroup.4.diff, 66.0 KB (added by wstewart@…, 17 years ago)

Updated for SVN 20401

  • libs/libmythtv/channelgroup.cpp

    diff -Naurp -x '*.o' -x '*.lib' -x Makefile -x '*.log' -x '*.pro' -x i18n -x '*.so' -x 'moc*' -x '*.pm' -x '*.old' -x '*.ep' mythtv-orig/libs/libmythtv/channelgroup.cpp mythtv/libs/libmythtv/channelgroup.cpp
    old new  
     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
     12#define LOC QString("Channel Group: ")
     13#define LOC_ERR QString("Channel Group, Error: ")
     14
     15ChannelGroupItem& ChannelGroupItem::operator=(const ChannelGroupItem &other)
     16{
     17    grpid     = other.grpid;
     18    name      = (other.name);
     19 
     20    return *this;
     21}
     22
     23ChannelGroupItem::ChannelGroupItem(const ChannelGroupItem &other)
     24{
     25    (*this) = other;
     26}
     27
     28inline bool lt_group(const ChannelGroupItem &a, const ChannelGroupItem &b)
     29{
     30    return QString::localeAwareCompare(a.name, b.name) < 0;
     31}
     32
     33bool ChannelGroup::ToggleChannel(uint chanid, int changrpid, int delete_chan)
     34{
     35    // Check if it already exists for that chanid...
     36    MSqlQuery query(MSqlQuery::InitCon());
     37    query.prepare(
     38        "SELECT channelgroup.id "
     39        "FROM channelgroup "
     40        "WHERE channelgroup.chanid = :CHANID AND "
     41        "channelgroup.grpid = :GRPID "
     42        "LIMIT 1");
     43    query.bindValue(":CHANID", chanid);
     44    query.bindValue(":GRPID", changrpid);
     45
     46    if (!query.exec() || !query.isActive())
     47    {
     48        MythDB::DBError("ChannelGroup::ToggleChannel", query);
     49        return false;
     50    }
     51    else if ((query.size() > 0) && delete_chan)
     52    {
     53        // We have a record...Remove it to toggle...
     54        query.next();
     55        QString id = query.value(0).toString();
     56        query.prepare(
     57            QString("DELETE FROM channelgroup "
     58                    "WHERE id = '%1'").arg(id));
     59        query.exec();
     60        VERBOSE(VB_IMPORTANT, LOC + QString("Removing channel with id=%1.").arg(id));
     61    }
     62    else if (query.size() == 0)
     63    {
     64        // We have no record...Add one to toggle...
     65        query.prepare(
     66            QString("INSERT INTO channelgroup (chanid,grpid) "
     67                    "VALUES ('%1','%2')").arg(chanid).arg(changrpid));
     68        query.exec();
     69        VERBOSE(VB_IMPORTANT, LOC + QString("Adding channel %1 to group %2.").arg(chanid).arg(changrpid));
     70    }
     71
     72    return true;
     73}
     74
     75bool ChannelGroup::AddChannel(uint chanid, int changrpid)
     76{
     77    // Check if it already exists for that chanid...
     78    MSqlQuery query(MSqlQuery::InitCon());
     79    query.prepare(
     80        "SELECT channelgroup.id "
     81        "FROM channelgroup "
     82        "WHERE channelgroup.chanid = :CHANID AND "
     83        "channelgroup.grpid = :GRPID "
     84        "LIMIT 1");
     85    query.bindValue(":CHANID", chanid);
     86    query.bindValue(":GRPID", changrpid);
     87
     88    if (!query.exec() || !query.isActive())
     89    {
     90        MythDB::DBError("ChannelGroup::ToggleChannel", query);
     91        return false;
     92    }
     93    else if (query.size() == 0)
     94    {
     95        // We have no record...Add one to toggle...
     96        query.prepare(
     97            QString("INSERT INTO channelgroup (chanid,grpid) "
     98                    "VALUES ('%1','%2')").arg(chanid).arg(changrpid));
     99        query.exec();
     100        VERBOSE(VB_IMPORTANT, LOC + QString("Adding channel %1 to group %2.").arg(chanid).arg(changrpid));
     101    }
     102
     103    return true;
     104}
     105
     106bool ChannelGroup::DeleteChannel(uint chanid, int changrpid)
     107{
     108    // Check if it already exists for that chanid...
     109    MSqlQuery query(MSqlQuery::InitCon());
     110    query.prepare(
     111        "SELECT channelgroup.id "
     112        "FROM channelgroup "
     113        "WHERE channelgroup.chanid = :CHANID AND "
     114        "channelgroup.grpid = :GRPID "
     115        "LIMIT 1");
     116    query.bindValue(":CHANID", chanid);
     117    query.bindValue(":GRPID", changrpid);
     118
     119    if (!query.exec() || !query.isActive())
     120    {
     121        MythDB::DBError("ChannelGroup::ToggleChannel", query);
     122        return false;
     123    }
     124    else if (query.size() > 0)
     125    {
     126        // We have a record...Remove it to toggle...
     127        query.next();
     128        QString id = query.value(0).toString();
     129        query.prepare(
     130            QString("DELETE FROM channelgroup "
     131                    "WHERE id = '%1'").arg(id));
     132        query.exec();
     133        VERBOSE(VB_IMPORTANT, LOC + QString("Removing channel with id=%1.").arg(id));
     134    }
     135
     136    return true;
     137}
     138
     139ChannelGroupList ChannelGroup::GetChannelGroups(void)
     140{
     141    ChannelGroupList list;
     142   
     143    MSqlQuery query(MSqlQuery::InitCon());
     144   
     145    QString qstr = "SELECT grpid, name FROM channelgroupnames order by name";
     146   
     147    query.prepare(qstr);
     148
     149    if (!query.exec() || !query.isActive())
     150        MythDB::DBError("ChannelGroup::GetChannelGroups", query);
     151    else
     152    {
     153        while (query.next())
     154        {
     155           ChannelGroupItem group(query.value(0).toUInt(),
     156                              query.value(1).toString());
     157           list.push_back(group);
     158        }
     159    }
     160   
     161//    stable_sort(list.begin(), list.end(), lt_group);
     162
     163    return list;
     164}
     165
     166// Cycle through the available groups, then all channels
     167// Will cycle through to end then return -1
     168// To signify all channels.
     169int ChannelGroup::GetNextChannelGroup(const ChannelGroupList &sorted, int grpid)
     170{
     171    // If no groups return -1 for all channels
     172    if (sorted.empty())
     173      return -1;
     174   
     175    // If grpid is all channels (-1), then return the first grpid 
     176    if (grpid == -1)
     177      return sorted[0].grpid;
     178     
     179    ChannelGroupList::const_iterator it = find(sorted.begin(), sorted.end(), grpid);
     180
     181    // If grpid is not in the list, return -1 for all channels
     182    if (it == sorted.end())
     183        return -1;
     184
     185    ++it;
     186
     187    // If we reached the end, the next option is all channels (-1)
     188    if (it == sorted.end())
     189       return -1;
     190
     191    return it->grpid;
     192}
     193
     194QString ChannelGroup::GetChannelGroupName(int grpid)
     195{
     196    // All Channels
     197    if (grpid == -1)
     198        return "All Channels";
     199
     200    MSqlQuery query(MSqlQuery::InitCon());
     201   
     202    QString qstr = QString("SELECT name FROM channelgroupnames where grpid='%1'")
     203                   .arg(grpid);
     204   
     205    query.prepare(qstr);
     206
     207    if (!query.exec() || !query.isActive())
     208        MythDB::DBError("ChannelGroup::GetChannelGroups", query);
     209    else if (query.size() > 0)
     210    {
     211        query.next();   
     212        return query.value(0).toString();
     213    }
     214   
     215    return "";
     216}
     217
     218int ChannelGroup::GetChannelGroupId(QString changroupname)
     219{
     220    // All Channels
     221    if (changroupname == "All Channels")
     222      return -1;
     223
     224    MSqlQuery query(MSqlQuery::InitCon());
     225   
     226    QString qstr = QString("SELECT grpid FROM channelgroupnames where name='%1'")
     227                   .arg(changroupname);
     228   
     229    query.prepare(qstr);
     230
     231    if (!query.exec() || !query.isActive())
     232        MythDB::DBError("ChannelGroup::GetChannelGroups", query);
     233    else if (query.size() > 0)
     234    {
     235        query.next();   
     236        return query.value(0).toUInt();
     237    }
     238   
     239    return 0;
     240}
     241 No newline at end of file
  • libs/libmythtv/channelgroup.h

    diff -Naurp -x '*.o' -x '*.lib' -x Makefile -x '*.log' -x '*.pro' -x i18n -x '*.so' -x 'moc*' -x '*.pm' -x '*.old' -x '*.ep' mythtv-orig/libs/libmythtv/channelgroup.h mythtv/libs/libmythtv/channelgroup.h
    old new  
     1#ifndef CHANNELGROUP_H
     2#define CHANNELGROUP_H
     3
     4class 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};
     21typedef vector<ChannelGroupItem> ChannelGroupList;
     22
     23/** \class ChannelGroup
     24*/
     25class 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 bool              AddChannel(uint chanid, int changrpid);
     32    static bool              DeleteChannel(uint chanid, int changrpid);
     33    static int               GetNextChannelGroup(const ChannelGroupList &sorted, int grpid);
     34    static QString           GetChannelGroupName(int grpid);
     35    static int               GetChannelGroupId(QString changroupname);
     36   
     37  private:
     38
     39};
     40
     41#endif
  • libs/libmythtv/channelgroupsettings.cpp

    diff -Naurp -x '*.o' -x '*.lib' -x Makefile -x '*.log' -x '*.pro' -x i18n -x '*.so' -x 'moc*' -x '*.pm' -x '*.old' -x '*.ep' mythtv-orig/libs/libmythtv/channelgroupsettings.cpp mythtv/libs/libmythtv/channelgroupsettings.cpp
    old new  
     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
     17class 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
     36void ChannelGroupStorage::Load(void)
     37{
     38    setting->setValue("0");
     39   
     40    MSqlQuery query(MSqlQuery::InitCon());
     41   
     42    QString qstr = "SELECT grpid FROM channelgroupnames WHERE name = :GRPNAME";
     43   
     44    query.prepare(qstr);
     45    query.bindValue(":GRPNAME", grpname);
     46
     47    if (!query.exec() || !query.isActive())
     48        MythDB::DBError("ChannelGroupStorage::Load", query);
     49    else
     50    {
     51      query.next();
     52      grpid = query.value(0).toUInt();
     53   
     54      qstr = "SELECT * FROM channelgroup WHERE grpid = :GRPID AND chanid = :CHANID";
     55      query.prepare(qstr);
     56      query.bindValue(":GRPID",  grpid);
     57      query.bindValue(":CHANID", chanid);
     58
     59      if (!query.exec() || !query.isActive())
     60          MythDB::DBError("ChannelGroupStorage::Load", query);
     61      else if (query.size() > 0)
     62        setting->setValue("1");
     63    }
     64}
     65
     66void ChannelGroupStorage::Save(void)
     67{
     68    QString value = setting->getValue();
     69   
     70    if (value == "1")
     71        ChannelGroup::AddChannel(chanid, grpid);
     72    else
     73        ChannelGroup::DeleteChannel(chanid, grpid);   
     74}
     75
     76void ChannelGroupStorage::Save(QString destination)
     77{
     78    Save();
     79}
     80
     81class ChannelCheckBox : public CheckBoxSetting, public ChannelGroupStorage
     82{
     83  public:
     84    ChannelCheckBox(const ChannelGroupConfig& _parent, const uint chanid, const QString channum,
     85               const QString channame, const QString grpname):
     86        CheckBoxSetting(this),
     87        ChannelGroupStorage(this, chanid, grpname)
     88    {
     89        setLabel(QString("%1 %2").arg(channum).arg(channame));
     90        setHelpText(QObject::tr("Select/Unselect channels for this channel group"));
     91    };
     92};
     93
     94ChannelGroupConfig::ChannelGroupConfig(QString _name)
     95    : name(_name)
     96{
     97    VerticalConfigurationGroup   *cgroup;
     98    HorizontalConfigurationGroup *columns;
     99
     100    DBChanList chanlist = ChannelUtil::GetChannels(0, true, "channum, callsign");
     101    ChannelUtil::SortChannels(chanlist, "channum", true);
     102
     103    DBChanList::iterator it = chanlist.begin();
     104    int i,j = 0;
     105    int p = 1;
     106    int pages = (int)((float)chanlist.size() / 8.0 / 3.0 + 0.5);
     107   
     108    do
     109    { 
     110        columns = new HorizontalConfigurationGroup(false,false,false,false);
     111        columns->setLabel(getName() + " " +
     112                          QObject::tr("Channel Group - Page ") + QString("%1").arg(p) +
     113                          QObject::tr("of") + QString("%1").arg(pages));
     114       
     115        for (j = 0; ((j < 3) && (it < chanlist.end())); ++j)
     116        {
     117            cgroup = new VerticalConfigurationGroup(false,false,false,false);
     118           
     119            for (i = 0; ((i < 8) && (it < chanlist.end())); ++i)
     120            {
     121                cgroup->addChild(new ChannelCheckBox(*this, it->chanid, it->channum, it->name, _name));
     122                ++it;
     123            }
     124            columns->addChild(cgroup);
     125        }
     126       
     127        ++p;
     128        addChild(columns);
     129    } while (it < chanlist.end());
     130
     131}
     132
     133ChannelGroupEditor::ChannelGroupEditor(void) :
     134    listbox(new ListBoxSetting(this)), lastValue("__CREATE_NEW_GROUP__")
     135{
     136    listbox->setLabel(tr("Channel Groups"));
     137    addChild(listbox);
     138}
     139
     140void ChannelGroupEditor::open(QString name)
     141{
     142    lastValue = name;
     143    bool created = false;
     144
     145    if (name == "__CREATE_NEW_GROUP__")
     146    {
     147        name = "";
     148       
     149        bool ok = MythPopupBox::showGetTextPopup(gContext->GetMainWindow(),
     150            tr("Create New Channel Group"),
     151            tr("Enter group name or press SELECT to enter text via the "
     152               "On Screen Keyboard"), name);
     153        if (!ok)
     154            return;
     155
     156        MSqlQuery query(MSqlQuery::InitCon());
     157        query.prepare("INSERT INTO channelgroupnames (name) VALUES (:NAME);");
     158        query.bindValue(":NAME", name);
     159        if (!query.exec())
     160            MythDB::DBError("ChannelGroupEditor::open", query);
     161        else
     162            created = true;
     163    }
     164   
     165    ChannelGroupConfig group(name);
     166   
     167    if (group.exec() == QDialog::Accepted || !created)
     168        lastValue = name;
     169
     170};
     171
     172void ChannelGroupEditor::doDelete(void)
     173{
     174    QString name = listbox->getValue();
     175    if (name == "__CREATE_NEW_GROUP__")
     176        return;
     177
     178    QString message = tr("Delete '%1' Channel group?").arg(name);
     179   
     180    DialogCode value = MythPopupBox::Show2ButtonPopup(
     181        gContext->GetMainWindow(),
     182        "", message,
     183        tr("Yes, delete group"),
     184        tr("No, Don't delete group"), kDialogCodeButton1);
     185
     186    if (kDialogCodeButton0 == value)
     187    {
     188        MSqlQuery query(MSqlQuery::InitCon());
     189
     190        // Find out channel group id
     191        query.prepare("SELECT grpid FROM channelgroupnames WHERE name = :NAME;");
     192        query.bindValue(":NAME", name);
     193        if (!query.exec())
     194            MythDB::DBError("ChannelGroupEditor::doDelete", query);
     195        query.next();
     196        uint grpid = query.value(0).toUInt();
     197
     198        // Delete channels from this group
     199        query.prepare("DELETE FROM channelgroup WHERE grpid = :GRPID;");
     200        query.bindValue(":GRPID", grpid);
     201        if (!query.exec())
     202            MythDB::DBError("ChannelGroupEditor::doDelete", query);
     203       
     204        // Now delete the group from channelgroupnames
     205        query.prepare("DELETE FROM channelgroupnames WHERE name = :NAME;");
     206        query.bindValue(":NAME", name);
     207        if (!query.exec())
     208            MythDB::DBError("ChannelGroupEditor::doDelete", query);
     209
     210        lastValue = "__CREATE_NEW_GROUP__";
     211        Load();
     212    }
     213
     214    listbox->setFocus();
     215}
     216
     217void ChannelGroupEditor::Load(void)
     218{
     219    listbox->clearSelections();
     220   
     221    ChannelGroupList changrplist;
     222
     223    changrplist = ChannelGroup::GetChannelGroups();
     224
     225    ChannelGroupList::iterator it;
     226
     227    for (it = changrplist.begin(); it < changrplist.end(); ++it)
     228       listbox->addSelection(it->name);
     229       
     230    listbox->addSelection(tr("(Create new group)"), "__CREATE_NEW_GROUP__");
     231
     232    listbox->setValue(lastValue);
     233}
     234
     235DialogCode ChannelGroupEditor::exec(void)
     236{VERBOSE(VB_IMPORTANT, "ChannelGroupEditor::exec");
     237    while (ConfigurationDialog::exec() == kDialogCodeAccepted)
     238        open(listbox->getValue());
     239
     240    return kDialogCodeRejected;
     241}
     242
     243MythDialog* ChannelGroupEditor::dialogWidget(MythMainWindow* parent,
     244                                          const char* widgetName)
     245{
     246    dialog = ConfigurationDialog::dialogWidget(parent, widgetName);
     247    connect(dialog, SIGNAL(menuButtonPressed()), this, SLOT(doDelete()));
     248    connect(dialog, SIGNAL(deleteButtonPressed()), this, SLOT(doDelete()));
     249    return dialog;
     250}
  • libs/libmythtv/channelgroupsettings.h

    diff -Naurp -x '*.o' -x '*.lib' -x Makefile -x '*.log' -x '*.pro' -x i18n -x '*.so' -x 'moc*' -x '*.pm' -x '*.old' -x '*.ep' mythtv-orig/libs/libmythtv/channelgroupsettings.h mythtv/libs/libmythtv/channelgroupsettings.h
    old new  
     1#ifndef CHANNELGROUPSETTINGS_H
     2#define CHANNELGROUPSETTINGS_H
     3
     4#include "libmyth/settings.h"
     5
     6class 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
     16class 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
  • libs/libmythtv/channelutil.cpp

    diff -Naurp -x '*.o' -x '*.lib' -x Makefile -x '*.log' -x '*.pro' -x i18n -x '*.so' -x 'moc*' -x '*.pm' -x '*.old' -x '*.ep' mythtv-orig/libs/libmythtv/channelutil.cpp mythtv/libs/libmythtv/channelutil.cpp
    old new bool ChannelUtil::GetChannelSettings(int  
    15701570    return true;
    15711571}
    15721572
    1573 DBChanList ChannelUtil::GetChannels(uint sourceid, bool vis_only, QString grp)
     1573DBChanList ChannelUtil::GetChannels(uint sourceid, bool vis_only, QString grp, int changrpid)
    15741574{
    15751575    DBChanList list;
    1576     QMap<uint,uint> favorites;
     1576   
    15771577    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     else
    1584     {
    1585         while (query.next())
    1586             favorites[query.value(0).toUInt()] = query.value(1).toUInt();
    1587     }
    15881578
    15891579    QString qstr =
    1590         "SELECT channum, callsign, chanid, "
     1580        "SELECT channum, callsign, channel.chanid, "
    15911581        "       atsc_major_chan, atsc_minor_chan, "
    15921582        "       name, icon, mplexid, visible "
    15931583        "FROM channel ";
    15941584
     1585    // Select only channels from the specified channel group
     1586    if (changrpid > -1)
     1587        qstr += QString(",channelgroup ");
     1588
    15951589    if (sourceid)
    15961590        qstr += QString("WHERE sourceid='%1' ").arg(sourceid);
    15971591    else
    DBChanList ChannelUtil::GetChannels(uint  
    15991593            "WHERE cardinput.sourceid = channel.sourceid   AND "
    16001594            "      cardinput.cardid   = capturecard.cardid     ";
    16011595
     1596    if (changrpid > -1)
     1597    {
     1598        qstr += QString("AND channel.chanid = channelgroup.chanid "
     1599                        "AND channelgroup.grpid ='%1' ").arg(changrpid);
     1600    }
     1601
    16021602    if (vis_only)
    16031603        qstr += "AND visible=1 ";
    16041604
    DBChanList ChannelUtil::GetChannels(uint  
    16231623            query.value(2).toUInt(),                      /* chanid     */
    16241624            query.value(3).toUInt(),                      /* ATSC major */
    16251625            query.value(4).toUInt(),                      /* ATSC minor */
    1626             favorites[query.value(2).toUInt()],           /* favid      */
    16271626            query.value(7).toUInt(),                      /* mplexid    */
    16281627            query.value(8).toBool(),                      /* visible    */
    16291628            query.value(5).toString(),                    /* name       */
    uint ChannelUtil::GetNextChannel(  
    18061805                (mplexid_restriction &&
    18071806                 (mplexid_restriction != it->mplexid))));
    18081807    }
    1809     else if (CHANNEL_DIRECTION_UP == direction)
     1808    else if ((CHANNEL_DIRECTION_UP == direction) || (CHANNEL_DIRECTION_FAVORITE == direction))
    18101809    {
    18111810        do
    18121811        {
    uint ChannelUtil::GetNextChannel(  
    18191818                (mplexid_restriction &&
    18201819                 (mplexid_restriction != it->mplexid))));
    18211820    }
    1822     else if (CHANNEL_DIRECTION_FAVORITE == direction)
    1823     {
    1824         do
    1825         {
    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     }
    18361821
    18371822    return it->chanid;
    18381823}
  • libs/libmythtv/channelutil.h

    diff -Naurp -x '*.o' -x '*.lib' -x Makefile -x '*.log' -x '*.pro' -x i18n -x '*.so' -x 'moc*' -x '*.pm' -x '*.old' -x '*.ep' mythtv-orig/libs/libmythtv/channelutil.h mythtv/libs/libmythtv/channelutil.h
    old new class MPUBLIC ChannelUtil  
    168168    static QString GetVideoFilters(uint sourceid, const QString &channum)
    169169        { return GetChannelValueStr("videofilters", sourceid, channum); }
    170170
    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);
    172172    static void    SortChannels(DBChanList &list, const QString &order,
    173173                                bool eliminate_duplicates = false);
    174174    static void    EliminateDuplicateChanNum(DBChanList &list);
  • libs/libmythtv/dbchannelinfo.cpp

    diff -Naurp -x '*.o' -x '*.lib' -x Makefile -x '*.log' -x '*.pro' -x i18n -x '*.so' -x 'moc*' -x '*.pm' -x '*.old' -x '*.ep' mythtv-orig/libs/libmythtv/dbchannelinfo.cpp mythtv/libs/libmythtv/dbchannelinfo.cpp
    old new DBChannel::DBChannel(const DBChannel &ot  
    1616DBChannel::DBChannel(
    1717    const QString &_channum, const QString &_callsign,
    1818    uint _chanid, uint _major_chan, uint _minor_chan,
    19     uint _favorite, uint _mplexid, bool _visible,
     19    uint _mplexid, bool _visible,
    2020    const QString &_name, const QString &_icon) :
    2121    channum(_channum),
    2222    callsign(_callsign), chanid(_chanid),
    2323    major_chan(_major_chan), minor_chan(_minor_chan),
    24     favorite(_favorite), mplexid(_mplexid), visible(_visible),
     24    mplexid(_mplexid), visible(_visible),
    2525    name(_name), icon(_icon)
    2626{
    2727    channum.detach();
    DBChannel &DBChannel::operator=(const DB  
    3939    chanid     = other.chanid;
    4040    major_chan = other.major_chan;
    4141    minor_chan = other.minor_chan;
    42     favorite   = other.favorite;
    4342    mplexid    = (other.mplexid == 32767) ? 0 : other.mplexid;
    4443    visible    = other.visible;
    4544    name       = other.name; name.detach();
  • libs/libmythtv/dbchannelinfo.h

    diff -Naurp -x '*.o' -x '*.lib' -x Makefile -x '*.log' -x '*.pro' -x i18n -x '*.so' -x 'moc*' -x '*.pm' -x '*.old' -x '*.ep' mythtv-orig/libs/libmythtv/dbchannelinfo.h mythtv/libs/libmythtv/dbchannelinfo.h
    old new class MPUBLIC DBChannel  
    2323    DBChannel(const DBChannel&);
    2424    DBChannel(const QString &_channum, const QString &_callsign,
    2525              uint _chanid, uint _major_chan, uint _minor_chan,
    26               uint _favorite, uint _mplexid, bool _visible,
     26              uint _mplexid, bool _visible,
    2727              const QString &_name, const QString &_icon);
    2828    DBChannel& operator=(const DBChannel&);
    2929
    class MPUBLIC DBChannel  
    3636    uint    chanid;
    3737    uint    major_chan;
    3838    uint    minor_chan;
    39     uint    favorite;
    4039    uint    mplexid;
    4140    bool    visible;
    4241    QString name;
  • libs/libmythtv/remoteencoder.cpp

    diff -Naurp -x '*.o' -x '*.lib' -x Makefile -x '*.log' -x '*.pro' -x i18n -x '*.so' -x 'moc*' -x '*.pm' -x '*.old' -x '*.ep' mythtv-orig/libs/libmythtv/remoteencoder.cpp mythtv/libs/libmythtv/remoteencoder.cpp
    old new QString RemoteEncoder::SetInput(QString  
    402402    return (lastinput.isEmpty()) ? "Error" : lastinput;
    403403}
    404404
    405 void RemoteEncoder::ToggleChannelFavorite(void)
     405void RemoteEncoder::ToggleChannelFavorite(QString changroupname)
    406406{
    407407    QStringList strlist( QString("QUERY_RECORDER %1").arg(recordernum) );
    408408    strlist << "TOGGLE_CHANNEL_FAVORITE";
     409    strlist << changroupname;
    409410
    410411    SendReceiveStringList(strlist);
    411412}
  • libs/libmythtv/remoteencoder.h

    diff -Naurp -x '*.o' -x '*.lib' -x Makefile -x '*.log' -x '*.pro' -x i18n -x '*.so' -x 'moc*' -x '*.pm' -x '*.old' -x '*.ep' mythtv-orig/libs/libmythtv/remoteencoder.h mythtv/libs/libmythtv/remoteencoder.h
    old new class MPUBLIC RemoteEncoder  
    5050        PictureAdjustType type, PictureAttribute attr, bool up);
    5151    void ChangeChannel(int channeldirection);
    5252    void ChangeDeinterlacer(int deint_mode);
    53     void ToggleChannelFavorite(void);
     53    void ToggleChannelFavorite(QString);
    5454    void SetChannel(QString channel);
    5555    int  SetSignalMonitoringRate(int msec, bool notifyFrontend = true);
    5656    uint GetSignalLockTimeout(QString input);
  • libs/libmythtv/tvosdmenuentry.cpp

    diff -Naurp -x '*.o' -x '*.lib' -x Makefile -x '*.log' -x '*.pro' -x i18n -x '*.so' -x 'moc*' -x '*.pm' -x '*.old' -x '*.ep' mythtv-orig/libs/libmythtv/tvosdmenuentry.cpp mythtv/libs/libmythtv/tvosdmenuentry.cpp
    old new void TVOSDMenuEntryList::InitDefaultEntr  
    202202    curMenuEntries.append(
    203203        new TVOSDMenuEntry("JUMPREC",                 1,  1,  1,  0, "List of Recorded Shows"));
    204204    curMenuEntries.append(
     205        new TVOSDMenuEntry("CHANNELGROUP",            1,  1,  0,  0, "Channel Groups"));
     206    curMenuEntries.append(
    205207        new TVOSDMenuEntry("TOGGLEBROWSE",     1,  -1,  -1,  -1, "Live TV Browse Mode"));
    206208    curMenuEntries.append(
    207209        new TVOSDMenuEntry("PREVCHAN",              1,  -1,  -1,  -1, "Previous TV Channel"));
  • libs/libmythtv/tv_play.cpp

    diff -Naurp -x '*.o' -x '*.lib' -x Makefile -x '*.log' -x '*.pro' -x i18n -x '*.so' -x 'moc*' -x '*.pm' -x '*.old' -x '*.ep' mythtv-orig/libs/libmythtv/tv_play.cpp mythtv/libs/libmythtv/tv_play.cpp
    old new bool TV::StartTV(ProgramInfo *tvrec, boo  
    357357
    358358    bool allowrerecord = tv->getAllowRerecord();
    359359    bool deleterecording = tv->getRequestDelete();
     360   
     361    tv->SaveChannelGroup();
    360362
    361363    delete tv;
    362364
    void TV::InitKeys(void)  
    436438            "in the program guide", "0");
    437439    REG_KEY("TV Frontend", "GUIDE", "Show the Program Guide", "S");
    438440    REG_KEY("TV Frontend", "FINDER", "Show the Program Finder", "#");
    439     REG_KEY("TV Frontend", "NEXTFAV", "Toggle showing all channels or just "
    440             "favorites in the program guide.", "/");
     441    REG_KEY("TV Frontend", "NEXTFAV", "Cycle through channel groups and all channels "
     442            "in the program guide.", "/,S");
    441443    REG_KEY("TV Frontend", "CHANUPDATE", "Switch channels without exiting "
    442444            "guide in Live TV mode.", "X");
    443445    REG_KEY("TV Frontend", "VOLUMEDOWN", "Volume down", "[,{,F10,Volume Down");
    bool TV::Init(bool createWindow)  
    803805    osd_general_timeout  = gContext->GetNumSetting("OSDGeneralTimeout", 2);
    804806    osd_prog_info_timeout= gContext->GetNumSetting("OSDProgramInfoTimeout", 3);
    805807    tryUnflaggedSkip     = gContext->GetNumSetting("TryUnflaggedSkip", 0);
     808    channel_group_id     = gContext->GetNumSetting("ChannelGroupDefault", -1);
     809    browse_changrp       = gContext->GetNumSetting("BrowseChannelGroup", 0);
    806810    smartForward         = gContext->GetNumSetting("SmartForward", 0);
    807811    stickykeys           = gContext->GetNumSetting("StickyKeys");
    808812    ff_rew_repos         = gContext->GetNumSetting("FFRewReposTime", 100)/100.0;
    bool TV::Init(bool createWindow)  
    817821    if (!feVBI.isEmpty())
    818822        vbimode = VBIMode::Parse(gContext->GetSetting(feVBI));
    819823
     824    channel_group_id     = gContext->GetNumSetting("ChannelGroupDefault", -1);
     825    browse_changrp       = gContext->GetNumSetting("BrowseChannelGroup", 0);
     826   
     827    if (browse_changrp && (channel_group_id > -1))
     828    {
     829      m_channellist = ChannelUtil::GetChannels(0, true, "channum, callsign", channel_group_id);
     830      ChannelUtil::SortChannels(m_channellist, "channum", true);
     831    }
     832   
     833    m_changrplist  = ChannelGroup::GetChannelGroups();
     834
    820835    if (createWindow)
    821836    {
    822837        bool fullscreen = !gContext->GetNumSetting("GuiSizeForTV", 0);
    TV::~TV(void)  
    9851000}
    9861001
    9871002/**
     1003 * \brief save channel group setting to database
     1004 */
     1005void TV::SaveChannelGroup(void)
     1006{
     1007    int remember_last_changrp = gContext->GetNumSetting("ChannelGroupRememberLast", 0);
     1008
     1009    if (remember_last_changrp)
     1010       gContext->SaveSetting("ChannelGroupDefault", channel_group_id);
     1011}
     1012
     1013/**
    9881014 * \brief get tv state of active player context
    9891015 */
    9901016TVState TV::GetState(int player_idx) const
    bool TV::ToggleHandleAction(PlayerContex  
    42804306        ToggleSleepTimer(ctx);
    42814307    else if (has_action("TOGGLERECORD", actions) && islivetv)
    42824308        ToggleRecord(ctx);
    4283     else if (has_action("TOGGLEFAV", actions) && islivetv)
    4284         ToggleChannelFavorite(ctx);
     4309//    else if (has_action("TOGGLEFAV", actions) && islivetv)
     4310//        ToggleChannelFavorite(ctx);
    42854311    else if (has_action("TOGGLECHANCONTROLS", actions) && islivetv)
    42864312        DoTogglePictureAttribute(ctx, kAdjustingPicture_Channel);
    42874313    else if (has_action("TOGGLERECCONTROLS", actions) && islivetv)
    void TV::ToggleInputs(PlayerContext *ctx  
    62566282    UpdateOSDInput(ctx, inputname);
    62576283}
    62586284
    6259 void TV::ToggleChannelFavorite(PlayerContext *ctx)
     6285void TV::ToggleChannelFavorite(PlayerContext *ctx, QString changroup_name)
    62606286{
    62616287    if (ctx->recorder)
    6262         ctx->recorder->ToggleChannelFavorite();
     6288        ctx->recorder->ToggleChannelFavorite(changroup_name);
    62636289}
    62646290
    62656291QString TV::GetQueuedInput(void) const
    void TV::ChangeChannel(PlayerContext *ct  
    65146540{
    65156541    bool muted = false;
    65166542
     6543    if ((browse_changrp || (direction == CHANNEL_DIRECTION_FAVORITE)) &&
     6544        (channel_group_id > -1) && (direction != CHANNEL_DIRECTION_SAME))
     6545    {
     6546       uint    chanid;
     6547
     6548       ctx->LockPlayingInfo(__FILE__, __LINE__);
     6549       if (!ctx->playingInfo)
     6550       {
     6551           VERBOSE(VB_IMPORTANT,
     6552                   LOC_ERR + "ChangeChannel(): no active ctx playingInfo.");
     6553           ctx->UnlockPlayingInfo(__FILE__, __LINE__);
     6554           ReturnPlayerLock(ctx);
     6555           return;
     6556       }
     6557
     6558       // Collect channel info
     6559       const ProgramInfo pginfo(*ctx->playingInfo);
     6560       uint    old_chanid  = pginfo.chanid.toUInt();
     6561       ctx->UnlockPlayingInfo(__FILE__, __LINE__);
     6562     
     6563       chanid = ChannelUtil::GetNextChannel(m_channellist, old_chanid, 0, direction);
     6564
     6565       ChangeChannel(ctx, chanid, "");     
     6566       return;
     6567    } else if (direction == CHANNEL_DIRECTION_FAVORITE)
     6568        direction = CHANNEL_DIRECTION_UP;
     6569
    65176570    QString oldinputname = ctx->recorder->GetInput();
    65186571
    65196572    ctx->LockDeleteNVP(__FILE__, __LINE__);
    void TV::DoEditSchedule(int editType)  
    76367689    const ProgramInfo pginfo(*actx->playingInfo);
    76377690    uint    chanid  = pginfo.chanid.toUInt();
    76387691    QString channum = pginfo.chanstr;
     7692    int changrpid   = channel_group_id;
    76397693    actx->UnlockPlayingInfo(__FILE__, __LINE__);
    76407694
    76417695    ClearOSD(actx);
    void TV::DoEditSchedule(int editType)  
    76957749        {
    76967750            TV *player = (pause_active) ? NULL : this;
    76977751            isEmbedded = (isLiveTV && player && allowEPG);
    7698             RunProgramGuidePtr(chanid, channum, player, true);
     7752            RunProgramGuidePtr(chanid, channum, player, true, changrpid);
    76997753            ignoreKeyPresses = true;
    77007754            break;
    77017755        }
    void TV::DoEditSchedule(int editType)  
    77497803        actx = GetPlayerReadLock(-1, __FILE__, __LINE__);
    77507804        StopEmbedding(actx);               // Undo any embedding
    77517805        DoSetPauseState(actx, saved_pause); // Restore pause states
     7806
    77527807        // If user selected a new channel in the EPG, change to that channel
    77537808        if (isLiveTV && changeChannel.size())
    77547809            ChangeChannel(actx, changeChannel);
    void TV::BrowseDispInfo(PlayerContext *c  
    86438698    if (!browsemode)
    86448699        BrowseStart(ctx);
    86458700
     8701    // if browsing channel groups is enabled or direction if BROWSE_FAVORITES
     8702    // Then pick the next channel in the channel group list to browse
     8703    // If channel group is ALL CHANNELS (-1), then bypass picking from
     8704    // the channel group list
     8705    if ((browse_changrp || (direction == BROWSE_FAVORITE)) &&
     8706        (channel_group_id > -1) && (direction != BROWSE_SAME) &&
     8707        (direction != BROWSE_RIGHT) && (direction != BROWSE_LEFT))
     8708    {
     8709      uint chanid;
     8710      int  dir;
     8711     
     8712      if ( (direction == BROWSE_UP) || (direction == BROWSE_FAVORITE) )
     8713        dir = CHANNEL_DIRECTION_UP;
     8714      else if (direction == BROWSE_DOWN)
     8715        dir = CHANNEL_DIRECTION_DOWN;
     8716      else // this should never happen, but just in case
     8717        dir = direction;
     8718       
     8719      chanid = ChannelUtil::GetNextChannel(m_channellist, browsechanid, 0, dir);
     8720      VERBOSE(VB_IMPORTANT, QString("Get channel: %1").arg(chanid));
     8721      browsechanid  = chanid;
     8722      browsechannum = QString::null;
     8723      direction     = BROWSE_SAME;
     8724    }
     8725    else if ((channel_group_id == -1) && (direction == BROWSE_FAVORITE))
     8726      direction = BROWSE_UP;
     8727     
    86468728    OSD *osd = GetOSDLock(ctx);
    86478729    if (ctx->paused || !osd)
    86488730    {
    void TV::TreeMenuSelected(OSDListTreeTyp  
    95469628    }
    95479629    else if (action == "GUIDE")
    95489630        EditSchedule(actx, kScheduleProgramGuide);
     9631    else if (action.left(10) == "CHANGROUP_")
     9632    {
     9633        if (action == "CHANGROUP_ALL_CHANNELS")
     9634           channel_group_id = -1;
     9635        else
     9636        {
     9637           action.remove("CHANGROUP_");
     9638           channel_group_id = action.toInt();
     9639         
     9640           if (browse_changrp)
     9641           {
     9642               m_channellist = ChannelUtil::GetChannels(0, true, "channum, callsign", channel_group_id);
     9643               ChannelUtil::SortChannels(m_channellist, "channum", true);
     9644           }
     9645        }
     9646    }
    95499647    else if (action == "FINDER")
    95509648        EditSchedule(actx, kScheduleProgramFinder);
    95519649    else if (action == "SCHEDULE")
    void TV::FillOSDTreeMenu(  
    97439841        if (lastProgram != NULL)
    97449842            new OSDGenericTree(jtp_item, lastProgram->title, "JUMPPREV");
    97459843    }
     9844    else if (category == "CHANNELGROUP")
     9845    {
     9846        FillMenuChanGroups(ctx, treeMenu);
     9847    }
    97469848    else if (category == "TOGGLEBROWSE")
    97479849    {
    97489850        if (!db_browse_always)
    void TV::FillOSDTreeMenu(  
    97979899        FillMenuSleepMode(ctx, treeMenu);
    97989900}
    97999901
     9902void TV::FillMenuChanGroups(
     9903    const PlayerContext *ctx, OSDGenericTree *treeMenu) const
     9904{
     9905    OSDGenericTree *cg_item = new OSDGenericTree(treeMenu, tr("Channel Groups"),
     9906                                                 "CHANGROUP");
     9907    new OSDGenericTree(cg_item, tr("All Channels"), "CHANGROUP_ALL_CHANNELS",
     9908                                (channel_group_id == -1) ? 1 : 0,
     9909                                NULL, "CHANNELGROUP");
     9910       
     9911    ChannelGroupList::const_iterator it;
     9912       
     9913    for (it = m_changrplist.begin(); it != m_changrplist.end(); ++it)
     9914    {
     9915        QString name = QString("CHANGROUP_%1").arg(it->grpid);
     9916        new OSDGenericTree(cg_item, it->name, name,
     9917                           ((int)(it->grpid) == channel_group_id) ? 1 : 0,
     9918                           NULL, "CHANNELGROUP");
     9919    }
     9920}
     9921
    98009922void TV::FillMenuPlaying(
    98019923    const PlayerContext *ctx, OSDGenericTree *treeMenu,
    98029924    QString category) const
  • libs/libmythtv/tv_play.h

    diff -Naurp -x '*.o' -x '*.lib' -x Makefile -x '*.log' -x '*.pro' -x i18n -x '*.so' -x 'moc*' -x '*.pm' -x '*.old' -x '*.ep' mythtv-orig/libs/libmythtv/tv_play.h mythtv/libs/libmythtv/tv_play.h
    old new  
    2525#include "videoouttypes.h"
    2626#include "volumebase.h"
    2727#include "inputinfo.h"
     28#include "channelgroup.h"
    2829
    2930#include <qobject.h>
    3031
    typedef QMap<QString,InfoMap> DDValue  
    5253typedef QMap<QString,DDValueMap> DDKeyMap;
    5354typedef ProgramInfo * (*EMBEDRETURNPROGRAM)(void *, bool);
    5455typedef void (*EMBEDRETURNVOID) (void *, bool);
    55 typedef void (*EMBEDRETURNVOIDEPG) (uint, const QString &, TV *, bool);
     56typedef void (*EMBEDRETURNVOIDEPG) (uint, const QString &, TV *, bool, int);
    5657typedef void (*EMBEDRETURNVOIDFINDER) (TV *, bool);
    5758
    5859// Locking order
    class MPUBLIC TV : public QThread  
    276277    bool HasUDPNotifyEvent(void) const;
    277278    void HandleUDPNotifyEvent(void);
    278279
     280    // Channel Groups
     281    void SaveChannelGroup(void);
     282
    279283  public slots:
    280284    void HandleOSDClosed(int osdType);
    281285    void timerEvent(QTimerEvent*);
    class MPUBLIC TV : public QThread  
    346350    void StopStuff(PlayerContext *mctx, PlayerContext *ctx,
    347351                   bool stopRingbuffers, bool stopPlayers, bool stopRecorders);
    348352
    349     void ToggleChannelFavorite(PlayerContext*);
     353    void ToggleChannelFavorite(PlayerContext*, QString);
    350354    void ChangeChannel(PlayerContext*, int direction);
    351355    void ChangeChannel(PlayerContext*, uint chanid, const QString &channum);
    352356    void PauseLiveTV(PlayerContext*);
    class MPUBLIC TV : public QThread  
    527531    void FillMenuTimeStretch(   const PlayerContext*, OSDGenericTree*) const;
    528532    void FillMenuSleepMode(     const PlayerContext*, OSDGenericTree*) const;
    529533    bool FillMenuTracks(        const PlayerContext*, OSDGenericTree*, uint type) const;
     534    void FillMenuChanGroups(    const PlayerContext *ctx, OSDGenericTree *treeMenu) const;
    530535
    531536    void UpdateLCD(void);
    532537    bool HandleLCDTimerEvent(void);
    class MPUBLIC TV : public QThread  
    762767    QMap<int,int>             recorderPlaybackInfoTimerId;
    763768    QMap<int,ProgramInfo>     recorderPlaybackInfo;
    764769
     770    // Channel favorite group stuff   
     771    int channel_group_id;
     772    uint browse_changrp;
     773    ChannelGroupList m_changrplist;
     774    DBChanList m_channellist;
     775
    765776    // Network Control stuff
    766777    MythDeque<QString> networkControlCommands;
    767778
  • libs/libmythtv/tv_rec.cpp

    diff -Naurp -x '*.o' -x '*.lib' -x Makefile -x '*.log' -x '*.pro' -x i18n -x '*.so' -x 'moc*' -x '*.pm' -x '*.old' -x '*.ep' mythtv-orig/libs/libmythtv/tv_rec.cpp mythtv/libs/libmythtv/tv_rec.cpp
    old new using namespace std;  
    5959#include "iptvrecorder.h"
    6060#include "firewirerecorder.h"
    6161
     62#include "channelgroup.h"
     63
    6264#ifdef USING_V4L
    6365#include "v4lchannel.h"
    6466#endif
    void TVRec::RecorderPaused(void)  
    29152917/** \fn TVRec::ToggleChannelFavorite()
    29162918 *  \brief Toggles whether the current channel should be on our favorites list.
    29172919 */
    2918 void TVRec::ToggleChannelFavorite(void)
     2920void TVRec::ToggleChannelFavorite(QString changroupname)
    29192921{
    29202922    QMutexLocker lock(&stateChangeLock);
    29212923
    void TVRec::ToggleChannelFavorite(void)  
    29352937                "\t\t\tCould not toggle favorite.").arg(channum));
    29362938        return;
    29372939    }
    2938 
    2939     // Check if favorite exists for that chanid...
    2940     MSqlQuery query(MSqlQuery::InitCon());
    2941     query.prepare(
    2942         "SELECT favorites.favid "
    2943         "FROM favorites "
    2944         "WHERE favorites.chanid = :CHANID "
    2945         "LIMIT 1");
    2946     query.bindValue(":CHANID", chanid);
    2947 
    2948     if (!query.exec() || !query.isActive())
    2949     {
    2950         MythDB::DBError("togglechannelfavorite", query);
    2951     }
    2952     else if (query.size() > 0)
    2953     {
    2954         // We have a favorites record...Remove it to toggle...
    2955         query.next();
    2956         QString favid = query.value(0).toString();
    2957         query.prepare(
    2958             QString("DELETE FROM favorites "
    2959                     "WHERE favid = '%1'").arg(favid));
    2960         query.exec();
    2961         VERBOSE(VB_RECORD, LOC + "Removing Favorite.");
    2962     }
     2940   
     2941    int  changrpid;
     2942    bool result;
     2943   
     2944    changrpid = ChannelGroup::GetChannelGroupId(changroupname);
     2945   
     2946    if (changrpid <1)
     2947    {
     2948          VERBOSE(VB_RECORD, LOC + QString("ToggleChannelFavorite: Invalid "
     2949                   "channel group name %1, ").arg(changroupname));
     2950    }   
    29632951    else
    29642952    {
    2965         // We have no favorites record...Add one to toggle...
    2966         query.prepare(
    2967             QString("INSERT INTO favorites (chanid) "
    2968                     "VALUES ('%1')").arg(chanid));
    2969         query.exec();
    2970         VERBOSE(VB_RECORD, LOC + "Adding Favorite.");
     2953        result = ChannelGroup::ToggleChannel(chanid, changrpid, true);
     2954
     2955        if (!result)
     2956           VERBOSE(VB_RECORD, LOC + "Unable to toggle channel favorite.");
     2957        else
     2958           VERBOSE(VB_RECORD, LOC + QString("Toggled channel favorite."
     2959                   "channum %1, chan group %2").arg(channum).arg(changroupname));
    29712960    }
    29722961}
    29732962
  • libs/libmythtv/tv_rec.h

    diff -Naurp -x '*.o' -x '*.lib' -x Makefile -x '*.log' -x '*.pro' -x i18n -x '*.so' -x 'moc*' -x '*.pm' -x '*.old' -x '*.ep' mythtv-orig/libs/libmythtv/tv_rec.h mythtv/libs/libmythtv/tv_rec.h
    old new class MPUBLIC TVRec : public SignalMonit  
    203203    QString GetChainID(void);
    204204    void StopLiveTV(void);
    205205    void PauseRecorder(void);
    206     void ToggleChannelFavorite(void);
     206    void ToggleChannelFavorite(QString);
    207207
    208208    void SetLiveRecording(int recording);
    209209
  • programs/mythbackend/encoderlink.cpp

    diff -Naurp -x '*.o' -x '*.lib' -x Makefile -x '*.log' -x '*.pro' -x i18n -x '*.so' -x 'moc*' -x '*.pm' -x '*.old' -x '*.ep' mythtv-orig/programs/mythbackend/encoderlink.cpp mythtv/programs/mythbackend/encoderlink.cpp
    old new QString EncoderLink::SetInput(QString in  
    728728 *         <b>This only works on local recorders.</b>
    729729 *  \return -1 if query does not succeed, otherwise.
    730730 */
    731 void EncoderLink::ToggleChannelFavorite(void)
     731void EncoderLink::ToggleChannelFavorite(QString changroup)
    732732{
    733733    if (local)
    734         tv->ToggleChannelFavorite();
     734        tv->ToggleChannelFavorite(changroup);
    735735    else
    736736        VERBOSE(VB_IMPORTANT, "Should be local only query: ToggleChannelFavorite");
    737737}
  • programs/mythbackend/encoderlink.h

    diff -Naurp -x '*.o' -x '*.lib' -x Makefile -x '*.log' -x '*.pro' -x i18n -x '*.so' -x 'moc*' -x '*.pm' -x '*.old' -x '*.ep' mythtv-orig/programs/mythbackend/encoderlink.h mythtv/programs/mythbackend/encoderlink.h
    old new class EncoderLink  
    111111    vector<InputInfo> GetFreeInputs(const vector<uint> &excluded_cards) const;
    112112    QString GetInput(void) const;
    113113    QString SetInput(QString);
    114     void ToggleChannelFavorite(void);
     114    void ToggleChannelFavorite(QString);
    115115    void ChangeChannel(int channeldirection);
    116116    void SetChannel(const QString &name);
    117117    int  GetPictureAttribute(PictureAttribute attr);
  • programs/mythbackend/mainserver.cpp

    diff -Naurp -x '*.o' -x '*.lib' -x Makefile -x '*.log' -x '*.pro' -x i18n -x '*.so' -x 'moc*' -x '*.pm' -x '*.old' -x '*.ep' mythtv-orig/programs/mythbackend/mainserver.cpp mythtv/programs/mythbackend/mainserver.cpp
    old new void MainServer::HandleRecorderQuery(QSt  
    32593259    }
    32603260    else if (command == "TOGGLE_CHANNEL_FAVORITE")
    32613261    {
    3262         enc->ToggleChannelFavorite();
     3262        QString changroup = slist[2];
     3263        enc->ToggleChannelFavorite(changroup);
    32633264        retlist << "ok";
    32643265    }
    32653266    else if (command == "CHANGE_CHANNEL")
  • programs/mythfrontend/globalsettings.cpp

    diff -Naurp -x '*.o' -x '*.lib' -x Makefile -x '*.log' -x '*.pro' -x i18n -x '*.so' -x 'moc*' -x '*.pm' -x '*.old' -x '*.ep' mythtv-orig/programs/mythfrontend/globalsettings.cpp mythtv/programs/mythfrontend/globalsettings.cpp
    old new static HostCheckBox *EPGShowChannelIcon(  
    31213121    return gc;
    31223122}
    31233123
    3124 static HostCheckBox *EPGShowFavorites()
    3125 {
    3126     HostCheckBox *gc = new HostCheckBox("EPGShowFavorites");
    3127     gc->setLabel(QObject::tr("Only display 'favorite' channels"));
    3128     gc->setHelpText(QObject::tr("If enabled, the EPG will initially display "
    3129                     "only the channels marked as favorites. Pressing "
    3130                     "\"4\" will toggle between displaying favorites and all "
    3131                     "channels."));
    3132     gc->setValue(false);
    3133     return gc;
    3134 }
    31353124
    31363125static GlobalCheckBox *EPGEnableJumpToChannel()
    31373126{
    static GlobalCheckBox *EPGEnableJumpToCh  
    31433132    return gc;
    31443133}
    31453134
     3135static HostCheckBox *ChannelGroupRememberLast()
     3136{
     3137    HostCheckBox *gc = new HostCheckBox("ChannelGroupRememberLast");
     3138    gc->setLabel(QObject::tr("Remember last channel group"));
     3139    gc->setHelpText(QObject::tr("If enabled, the EPG will initially display "
     3140                    "only the channels from the last channel group selected. Pressing "
     3141                    "\"4\" will toggle channel group."));
     3142    gc->setValue(false);
     3143    return gc;
     3144}
     3145
     3146static HostComboBox *ChannelGroupDefault()
     3147{
     3148    HostComboBox *gc = new HostComboBox("ChannelGroupDefault");
     3149    gc->setLabel(QObject::tr("Default channel group"));
     3150
     3151    ChannelGroupList changrplist;
     3152
     3153    changrplist = ChannelGroup::GetChannelGroups();
     3154
     3155    gc->addSelection(QObject::tr("All Channels"), "-1");
     3156
     3157    ChannelGroupList::iterator it;
     3158
     3159    for (it = changrplist.begin(); it < changrplist.end(); ++it)
     3160       gc->addSelection(it->name, QString("%1").arg(it->grpid));
     3161
     3162    gc->setHelpText(QObject::tr("Default channel group to be shown in the the EPG"
     3163                    "Pressing GUIDE key will toggle channel group."));
     3164    gc->setValue(false);
     3165    return gc;
     3166}
     3167
     3168static HostCheckBox *BrowseChannelGroup()
     3169{
     3170    HostCheckBox *gc = new HostCheckBox("BrowseChannelGroup");
     3171    gc->setLabel(QObject::tr("Browse/Change channels from Channel Group"));
     3172    gc->setHelpText(QObject::tr("If enabled, LiveTV will browse or change channels "
     3173                    "from the selected channel group. \"All Channels\" "
     3174                    "channel group may be selected to browse all channels."));
     3175    gc->setValue(false);
     3176    return gc;
     3177}
     3178
     3179// Channel Group Settings
     3180class ChannelGroupSettings : public TriggeredConfigurationGroup
     3181{
     3182  public:
     3183    ChannelGroupSettings() : TriggeredConfigurationGroup(false, true, false, false)
     3184    {
     3185         setLabel(QObject::tr("Remember last channel group"));
     3186         setUseLabel(false);
     3187
     3188         Setting* RememberChanGrpEnabled = ChannelGroupRememberLast();
     3189         addChild(RememberChanGrpEnabled);
     3190         setTrigger(RememberChanGrpEnabled);
     3191
     3192         ConfigurationGroup* settings = new VerticalConfigurationGroup(false,false);
     3193         settings->addChild(ChannelGroupDefault());
     3194         addTarget("0", settings);
     3195
     3196         // show nothing if RememberChanGrpEnabled is on
     3197         addTarget("1", new VerticalConfigurationGroup(true,false));
     3198     };
     3199};
     3200
    31463201// General RecPriorities settings
    31473202
    31483203static GlobalCheckBox *GRSchedMoveHigher()
    GeneralSettings::GeneralSettings()  
    49094964    general2->addChild(RecordOverTime());
    49104965    general2->addChild(CategoryOverTimeSettings());
    49114966    addChild(general2);
    4912 
     4967   
     4968    VerticalConfigurationGroup* changrp = new VerticalConfigurationGroup(false);
     4969    changrp->setLabel(QObject::tr("General (Channel Groups)"));
     4970    ChannelGroupSettings *changroupsettings = new ChannelGroupSettings();
     4971    changrp->addChild(changroupsettings);
     4972    changrp->addChild(BrowseChannelGroup());
     4973    addChild(changrp);
    49134974}
    49144975
    49154976EPGSettings::EPGSettings()
    EPGSettings::EPGSettings()  
    49194980    epg->addChild(EPGShowCategoryColors());
    49204981    epg->addChild(EPGShowCategoryText());
    49214982    epg->addChild(EPGShowChannelIcon());
    4922     epg->addChild(EPGShowFavorites());
    49234983    epg->addChild(WatchTVGuide());
    49244984    addChild(epg);
    49254985
  • programs/mythfrontend/guidegrid.cpp

    diff -Naurp -x '*.o' -x '*.lib' -x Makefile -x '*.log' -x '*.pro' -x i18n -x '*.so' -x 'moc*' -x '*.pm' -x '*.old' -x '*.ep' mythtv-orig/programs/mythfrontend/guidegrid.cpp mythtv/programs/mythfrontend/guidegrid.cpp
    old new bool JumpToChannel::Update(void)  
    174174}
    175175
    176176void GuideGrid::RunProgramGuide(uint chanid, const QString &channum,
    177                     TV *player, bool allowFinder)
     177                    TV *player, bool allowFinder, int changrpid)
    178178{
    179179    MythScreenStack *mainStack = GetMythMainWindow()->GetMainStack();
    180180    GuideGrid *gg = new GuideGrid(mainStack,
    181181                                  chanid, channum,
    182                                   player, allowFinder);
     182                                  player, allowFinder, changrpid);
    183183
    184184    if (gg->Create())
    185185        mainStack->AddScreen(gg, (player == NULL));
    void GuideGrid::RunProgramGuide(uint cha  
    189189
    190190GuideGrid::GuideGrid(MythScreenStack *parent,
    191191                     uint chanid, QString channum,
    192                      TV *player, bool allowFinder)
     192                     TV *player, bool allowFinder, int changrpid)
    193193         : MythScreenType(parent, "guidegrid"),
    194194    m_allowFinder(allowFinder),
    195195    m_player(player),
    GuideGrid::GuideGrid(MythScreenStack *pa  
    207207    m_channelCount = 5;
    208208    m_timeCount = 30;
    209209    m_currentStartChannel = 0;
     210    m_changrpid = changrpid;
     211    m_changrplist = ChannelGroup::GetChannelGroups();
    210212
    211213    m_jumpToChannelEnabled = gContext->GetNumSetting("EPGEnableJumpToChannel", 1);
    212     m_showFavorites = gContext->GetNumSetting("EPGShowFavorites", 0);
    213214    m_sortReverse = gContext->GetNumSetting("EPGSortReverse", 0);
    214215    m_selectChangesChannel = gContext->GetNumSetting("SelectChangesChannel", 0);
    215216    m_selectRecThreshold = gContext->GetNumSetting("SelChangeRecThreshold", 16);
    bool GuideGrid::Create()  
    258259    UIUtilE::Assign(this, m_channelList, "channellist", &err);
    259260    UIUtilE::Assign(this, m_guideGrid, "guidegrid", &err);
    260261    UIUtilW::Assign(this, m_dateText, "datetext");
     262    UIUtilW::Assign(this, m_changroupname, "channelgroup");
    261263    UIUtilW::Assign(this, m_channelImage, "channelicon");
    262264    UIUtilW::Assign(this, m_jumpToText, "jumptotext");
    263265
    bool GuideGrid::Create()  
    300302
    301303    if (m_dateText)
    302304        m_dateText->SetText(m_currentStartTime.toString(m_dateFormat));
     305       
     306    QString changrpname = ChannelGroup::GetChannelGroupName(m_changrpid);
     307   
     308    if (m_changroupname)
     309        m_changroupname->SetText(changrpname);   
    303310
    304311    gContext->addListener(this);
    305312
    bool GuideGrid::keyPressEvent(QKeyEvent  
    490497        else if (action == "TOGGLERECORD")
    491498            quickRecord();
    492499        else if (action == "TOGGLEFAV")
    493             toggleChannelFavorite();
     500        {
     501            if (m_changrpid == -1)
     502                ChannelGroupMenu(0);
     503            else
     504                toggleChannelFavorite();
     505        }
    494506        else if (action == "CHANUPDATE")
    495507            channelUpdate();
    496508        else if (action == "VOLUMEUP")
    void GuideGrid::showMenu(void)  
    540552
    541553        menuPopup->AddButton(tr("Reverse Channel Order"));
    542554
    543         if (m_showFavorites)
    544             menuPopup->AddButton(tr("Show All Channels"));
    545         else
    546             menuPopup->AddButton(tr("Show Favourite Channels"));
     555        menuPopup->AddButton(tr("Choose Channel Group"));
    547556
    548557        menuPopup->AddButton(tr("Cancel"));
    549558
    void GuideGrid::fillChannelInfos(bool go  
    728737    m_channelInfoIdx.clear();
    729738    m_currentStartChannel = 0;
    730739
    731     DBChanList channels = ChannelUtil::GetChannels(0, true);
     740    DBChanList channels = ChannelUtil::GetChannels(0, true, "", m_changrpid);
    732741    ChannelUtil::SortChannels(channels, m_channelOrdering, false);
    733742
    734     if (m_showFavorites)
    735     {
    736         DBChanList tmp;
    737         for (uint i = 0; i < channels.size(); i++)
    738         {
    739             if (channels[i].favorite)
    740                 tmp.push_back(channels[i]);
    741         }
    742 
    743         if (!tmp.empty())
    744             channels = tmp;
    745     }
    746 
    747743    typedef vector<uint> uint_list_t;
    748744    QMap<QString,uint_list_t> channum_to_index_map;
    749745    QMap<QString,uint_list_t> callsign_to_index_map;
    void GuideGrid::customEvent(QEvent *even  
    12681264            }
    12691265            else if (resulttext == tr("Toggle Favourite Channel"))
    12701266            {
    1271                 toggleChannelFavorite();
     1267                if (m_changrpid == -1)
     1268                    ChannelGroupMenu(0);
     1269                else
     1270                    toggleChannelFavorite();
    12721271            }
    1273             else if (resulttext == tr("Show All Channels"))
     1272            else if (resulttext == tr("Choose Channel Group"))
    12741273            {
    1275                 m_showFavorites = false;
    1276                 generateListings();
    1277                 updateChannels();
     1274                ChannelGroupMenu(1);
    12781275            }
    1279             else if (resulttext == tr("Show Favourite Channels"))
     1276        }
     1277    else if (resultid == "channelgrouptogglemenu")
     1278        {
     1279            if (resulttext != tr("Cancel"))
    12801280            {
    1281                 m_showFavorites = true;
    1282                 generateListings();
    1283                 updateChannels();
     1281                int changroupid;
     1282                changroupid = ChannelGroup::GetChannelGroupId(resulttext);
     1283               
     1284                if (changroupid > 0)
     1285                    toggleChannelFavorite(changroupid);
     1286            }
     1287        }
     1288    else if (resultid == "channelgroupmenu")
     1289        {
     1290            if (resulttext != tr("Cancel"))
     1291            {
     1292                int changroupid;
     1293                changroupid = ChannelGroup::GetChannelGroupId(resulttext);
     1294             
     1295                if (changroupid > 0)
     1296                {
     1297                    m_changrpid = changroupid;
     1298                    generateListings();
     1299                    updateChannels();
     1300
     1301                    QString changrpname;
     1302                    changrpname = ChannelGroup::GetChannelGroupName(m_changrpid);
     1303   
     1304                    if (m_changroupname)
     1305                        m_changroupname->SetText(changrpname);
     1306                }
    12841307            }
    12851308        }
    12861309    }
    void GuideGrid::updateChannels(void)  
    13461369                m_channelList, chinfo->GetFormatted(m_channelFormat));
    13471370
    13481371        QString state = "";
    1349 
    1350         if (chinfo->favorite > 0)
    1351         {
    1352             if (unavailable)
    1353                 state = "favunavailable";
    1354             else
    1355                 state = "favourite";
    1356         }
    1357         else if (unavailable)
    1358             state = "unavailable";
    1359 
    13601372        item->SetText(chinfo->GetFormatted(m_channelFormat), "buttontext", state);
    13611373
    13621374        if (showChannelIcon && !chinfo->icon.isEmpty())
    void GuideGrid::updateInfo(void)  
    14311443
    14321444void GuideGrid::toggleGuideListing()
    14331445{
    1434     m_showFavorites = (!m_showFavorites);
    1435     generateListings();
     1446    int oldchangrpid = m_changrpid;
     1447   
     1448    m_changrpid = ChannelGroup::GetNextChannelGroup(m_changrplist, oldchangrpid);
     1449   
     1450    if (oldchangrpid != m_changrpid)
     1451      generateListings();
     1452
    14361453    updateChannels();
     1454   
     1455    QString changrpname = ChannelGroup::GetChannelGroupName(m_changrpid);
     1456   
     1457    if (m_changroupname)
     1458        m_changroupname->SetText(changrpname);
    14371459}
    14381460
    14391461void GuideGrid::generateListings()
    void GuideGrid::generateListings()  
    14501472    fillProgramInfos();
    14511473}
    14521474
    1453 void GuideGrid::toggleChannelFavorite()
     1475void GuideGrid::ChannelGroupMenu(int mode)
     1476{
     1477    if (m_changrplist.empty())
     1478    {
     1479      QString message = tr("You don't have any channel groups defined");
     1480
     1481      MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack");
     1482
     1483      MythConfirmationDialog *okPopup = new MythConfirmationDialog(popupStack,
     1484                                                                   message, false);
     1485      if (okPopup->Create())
     1486          popupStack->AddScreen(okPopup);
     1487      else
     1488          delete okPopup;
     1489
     1490      return;
     1491    }
     1492
     1493    QString label = tr("Select Channel Group");
     1494
     1495    MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack");
     1496    MythDialogBox *menuPopup = new MythDialogBox(label, popupStack, "menuPopup");
     1497
     1498    if (menuPopup->Create())
     1499    {
     1500        if (mode == 0)
     1501            menuPopup->SetReturnEvent(this, "channelgrouptogglemenu");
     1502        else
     1503            menuPopup->SetReturnEvent(this, "channelgroupmenu");           
     1504
     1505        for (uint i = 0; i < m_changrplist.size(); i++)
     1506            menuPopup->AddButton(m_changrplist[i].name);
     1507
     1508        menuPopup->AddButton(tr("Cancel"));
     1509
     1510        popupStack->AddScreen(menuPopup);
     1511    }
     1512    else
     1513    {
     1514        delete menuPopup;
     1515    }
     1516}
     1517
     1518void GuideGrid::toggleChannelFavorite(int grpid)
    14541519{
    14551520    MSqlQuery query(MSqlQuery::InitCon());
     1521   
     1522    if (grpid == -1)
     1523    {
     1524      if (m_changrpid == -1)
     1525          return;
     1526      else
     1527          grpid = m_changrpid;
     1528    }
    14561529
    14571530    // Get current channel id, and make sure it exists...
    14581531    int chanNum = m_currentRow + m_currentStartChannel;
    void GuideGrid::toggleChannelFavorite()  
    14641537        chanNum = 0;
    14651538
    14661539    PixmapChannel *ch = GetChannelInfo(chanNum);
    1467     uint favid  = ch->favorite;
    14681540    uint chanid = ch->chanid;
    14691541
    1470     if (favid > 0)
    1471     {
    1472         query.prepare("DELETE FROM favorites WHERE favid = :FAVID ;");
    1473         query.bindValue(":FAVID", favid);
    1474         query.exec();
    1475     }
     1542    if (m_changrpid == -1)
     1543        // If currently viewing all channels, allow to add only not delete
     1544        ChannelGroup::ToggleChannel(chanid, grpid, false);
    14761545    else
     1546        // Only allow delete if viewing the favorite group in question
     1547        ChannelGroup::ToggleChannel(chanid, grpid, true);
     1548     
     1549    // If viewing favorites, refresh because a channel was removed
     1550    if (m_changrpid != -1)
    14771551    {
    1478         // We have no favorites record...Add one to toggle...
    1479         query.prepare("INSERT INTO favorites (chanid) VALUES (:FAVID);");
    1480         query.bindValue(":FAVID", chanid);
    1481         query.exec();
    1482     }
    1483 
    1484     if (m_showFavorites)
    14851552        generateListings();
    1486     else
    1487     {
    1488         int maxchannel = 0;
    1489         m_channelCount = m_guideGrid->getChannelCount();
    1490         fillChannelInfos(false);
    1491         maxchannel = max((int)GetChannelCount() - 1, 0);
    1492         m_channelCount = min(m_channelCount, maxchannel + 1);
    14931553        updateChannels();
    14941554    }
    14951555}
  • programs/mythfrontend/guidegrid.h

    diff -Naurp -x '*.o' -x '*.lib' -x Makefile -x '*.log' -x '*.pro' -x i18n -x '*.so' -x 'moc*' -x '*.pm' -x '*.old' -x '*.ep' mythtv-orig/programs/mythfrontend/guidegrid.h mythtv/programs/mythfrontend/guidegrid.h
    old new  
    1919#include "mythscreentype.h"
    2020#include "programinfo.h"
    2121#include "programlist.h"
     22#include "channelgroup.h"
    2223#include "channelutil.h"
    2324
    2425using namespace std;
    class MPUBLIC GuideGrid : public MythScr  
    8687    static void RunProgramGuide(uint           startChanId,
    8788                                const QString &startChanNum,
    8889                                TV            *player = NULL,
    89                                 bool           allowFinder = true);
     90                                bool           allowFinder = true,
     91                                int            changrpid = -1);
    9092
    9193    DBChanList GetSelection(void) const;
    9294
    class MPUBLIC GuideGrid : public MythScr  
    117119    void pageDown();
    118120    void pageUp();
    119121    void toggleGuideListing();
    120     void toggleChannelFavorite();
     122    void toggleChannelFavorite(int grpid = -1);
     123    void ChannelGroupMenu(int mode = 0);
    121124    void generateListings();
    122125
    123126    void enter();
    class MPUBLIC GuideGrid : public MythScr  
    141144  protected:
    142145      GuideGrid(MythScreenStack *parentStack,
    143146              uint chanid = 0, QString channum = "",
    144               TV *player = NULL, bool allowFinder = true);
     147              TV *player = NULL, bool allowFinder = true,
     148              int changrpid=-1);
    145149   ~GuideGrid();
    146150
    147151  private slots:
    class MPUBLIC GuideGrid : public MythScr  
    195199    int m_currentRow;
    196200    int m_currentCol;
    197201
    198     bool    m_showFavorites;
    199202    bool    m_sortReverse;
    200203    QString m_channelFormat;
    201204
    class MPUBLIC GuideGrid : public MythScr  
    221224
    222225    QTimer *m_updateTimer;
    223226
     227    int               m_changrpid;
     228    ChannelGroupList  m_changrplist;
     229
    224230    QMutex            m_jumpToChannelLock;
    225231    JumpToChannel    *m_jumpToChannel;
    226232    bool              m_jumpToChannelEnabled;
    class MPUBLIC GuideGrid : public MythScr  
    230236    MythUIGuideGrid  *m_guideGrid;
    231237    MythUIText       *m_dateText;
    232238    MythUIText       *m_jumpToText;
     239    MythUIText       *m_changroupname;
    233240    MythUIImage      *m_channelImage;
    234241};
    235242
  • programs/mythfrontend/main.cpp

    diff -Naurp -x '*.o' -x '*.lib' -x Makefile -x '*.log' -x '*.pro' -x i18n -x '*.so' -x 'moc*' -x '*.pm' -x '*.old' -x '*.ep' mythtv-orig/programs/mythfrontend/main.cpp mythtv/programs/mythfrontend/main.cpp
    old new using namespace std;  
    5151#include "lcddevice.h"
    5252#include "langsettings.h"
    5353#include "mythcommandlineparser.h"
     54#include "channelgroupsettings.h"
    5455
    5556#include "myththemedmenu.h"
    5657#include "myththemebase.h"
    void TVMenuCallback(void *data, QString  
    523524        EPGSettings settings;
    524525        settings.exec();
    525526    }
     527    else if (sel == "settings channelgroups")
     528    {
     529        ChannelGroupEditor editor;
     530        editor.exec();
     531    }
    526532    else if (sel == "settings generalrecpriorities")
    527533    {
    528534        GeneralRecPrioritiesSettings settings;
  • themes/classic/tv_settings.xml

    diff -Naurp -x '*.o' -x '*.lib' -x Makefile -x '*.log' -x '*.pro' -x i18n -x '*.so' -x 'moc*' -x '*.pm' -x '*.old' -x '*.ep' mythtv-orig/themes/classic/tv_settings.xml mythtv/themes/classic/tv_settings.xml
    old new  
    9999    </button>
    100100
    101101    <button>
     102      <type>TV_SETTINGS_CHANNEL_GROUP</type>
     103      <text>Channel Groups</text>
     104      <action>SETTINGS CHANNELGROUPS</action>
     105    </button>
     106
     107    <button>
    102108        <type>TV_SETTINGS_RECORDING_PROFILES</type>
    103109        <text>Recording Profiles</text>
    104110        <text lang="IT">Registrazione</text>
  • themes/defaultmenu/tv_settings.xml

    diff -Naurp -x '*.o' -x '*.lib' -x Makefile -x '*.log' -x '*.pro' -x i18n -x '*.so' -x 'moc*' -x '*.pm' -x '*.old' -x '*.ep' mythtv-orig/themes/defaultmenu/tv_settings.xml mythtv/themes/defaultmenu/tv_settings.xml
    old new  
    123123    </button>
    124124
    125125    <button>
     126      <type>TV_SETTINGS_CHANNEL_GROUP</type>
     127      <text>Channel Groups</text>
     128      <action>SETTINGS CHANNELGROUPS</action>
     129    </button>
     130
     131    <button>
    126132        <type>TV_SETTINGS_RECORDING_PROFILES</type>
    127133        <text>Recording Profiles</text>
    128134        <text lang="IT">Registrazioni</text>
  • themes/default-wide/schedule-ui.xml

    diff -Naurp -x '*.o' -x '*.lib' -x Makefile -x '*.log' -x '*.pro' -x i18n -x '*.so' -x 'moc*' -x '*.pm' -x '*.old' -x '*.ep' mythtv-orig/themes/default-wide/schedule-ui.xml mythtv/themes/default-wide/schedule-ui.xml
    old new  
    3737            <cornerradius>15</cornerradius>
    3838        </shape>
    3939
     40        <textarea name="channelgroup" from="basetextarea">
     41            <area>25,245,190,25</area>
     42            <align>allcenter</align>
     43        </textarea>
     44
    4045        <textarea name="datetext" from="basetextarea">
    41             <area>25,255,190,25</area>
     46            <area>25,265,190,25</area>
    4247            <align>allcenter</align>
    4348        </textarea>
    4449
     
    255260        </imagetype>
    256261       
    257262        <textarea name="datetext" from="basetextarea">
    258             <area>25,255,190,25</area>
     263            <area>25,265,190,25</area>
     264            <align>allcenter</align>
     265        </textarea>
     266
     267        <textarea name="channelgroup" from="basetextarea">
     268            <area>25,245,190,25</area>
    259269            <align>allcenter</align>
    260270        </textarea>
    261271
  • themes/DVR/tv_settings.xml

    diff -Naurp -x '*.o' -x '*.lib' -x Makefile -x '*.log' -x '*.pro' -x i18n -x '*.so' -x 'moc*' -x '*.pm' -x '*.old' -x '*.ep' mythtv-orig/themes/DVR/tv_settings.xml mythtv/themes/DVR/tv_settings.xml
    old new  
    9999    </button>
    100100
    101101    <button>
     102      <type>TV_SETTINGS_CHANNEL_GROUP</type>
     103      <text>Channel Groups</text>
     104      <action>SETTINGS CHANNELGROUPS</action>
     105    </button>
     106
     107    <button>
    102108        <type>TV_SETTINGS_RECORDING_PROFILES</type>
    103109        <text>Recording Profiles</text>
    104110        <text lang="IT">Registrazione</text>