Ticket #6318: recGroup-ui-v3.patch

File recGroup-ui-v3.patch, 3.0 KB (added by John Patrick Poet <jppoet@…>, 16 years ago)

Don't display recGroup buttonlist if there is only one recording group.

  • programs/mythfrontend/playbackbox.cpp

     
    436436    if (!LoadWindowFromXML("recordings-ui.xml", "watchrecordings", this))
    437437        return false;
    438438
     439    m_recgroupList  = dynamic_cast<MythUIButtonList *> (GetChild("recgroups"));
    439440    m_groupList     = dynamic_cast<MythUIButtonList *> (GetChild("groups"));
    440441    m_recordingList = dynamic_cast<MythUIButtonList *> (GetChild("recordings"));
    441442
     
    452453        return false;
    453454    }
    454455
     456    if (m_recgroupList)
     457        m_recgroupList->SetCanTakeFocus(false);
     458
    455459    connect(m_groupList, SIGNAL(itemSelected(MythUIButtonListItem*)),
    456460            SLOT(updateRecList(MythUIButtonListItem*)));
    457461    connect(m_groupList, SIGNAL(itemClicked(MythUIButtonListItem*)),
     
    899903    }
    900904}
    901905
     906/*
     907 * \fn PlaybackBox::updateRecGroupList(void)
     908 * \brief called when the list of recording groups may have changed
     909 */
     910void PlaybackBox::updateRecGroupList(void)
     911{
     912    if (m_recGroupIdx < 0 || !m_recgroupList || m_recGroups.size() < 2)
     913        return;
     914
     915    m_recgroupList->Reset();
     916
     917    QStringList::iterator it;
     918    int idx;
     919    MythUIButtonListItem *item = NULL;
     920    QString name;
     921    QString state;
     922
     923    for (it = m_recGroups.begin(), idx = 0;
     924         it != m_recGroups.end(); ++it, ++idx)
     925    {
     926        name = (*it).simplified();
     927        if (name == "All Programs")
     928            name = "All";
     929
     930        item = new MythUIButtonListItem(m_recgroupList, "",
     931                                        qVariantFromValue(name.toLower()));
     932
     933        if (idx == m_recGroupIdx)
     934            m_recgroupList->SetItemCurrent(item);
     935
     936        item->SetText(name);
     937    }
     938}
     939
    902940void PlaybackBox::updateGroupList()
    903941{
    904942    m_groupList->Reset();
     
    11671205    m_progLists.clear();
    11681206    m_recordingList->Reset();
    11691207    m_groupList->Reset();
     1208    if (m_recgroupList)
     1209        m_recgroupList->Reset();
    11701210    // Clear autoDelete for the "all" list since it will share the
    11711211    // objects with the title lists.
    11721212    m_progLists[""] = ProgramList(false);
     
    16291669        }
    16301670    }
    16311671
     1672    updateRecGroupList();
    16321673    updateGroupList();
    16331674    updateUsage();
    16341675
  • programs/mythfrontend/playbackbox.h

     
    314314    QString findArtworkFile(QString &seriesID, QString &titleIn,
    315315                            QString imagetype, QString host);
    316316
     317    void updateRecGroupList();
    317318    void updateGroupList();
    318319    void updateIcons(const ProgramInfo *pginfo = NULL);
    319320    void updateUsage();
     
    327328
    328329    void ShowMenu(void);
    329330
     331    MythUIButtonList *m_recgroupList;
    330332    MythUIButtonList *m_groupList;
    331333    MythUIButtonList *m_recordingList;
    332334