Ticket #6318: recGroup-ui.patch

File recGroup-ui.patch, 3.3 KB (added by jppoet@…, 12 years ago)
  • programs/mythfrontend/playbackbox.cpp

    old new bool PlaybackBox::Create() 
    400400    if (!LoadWindowFromXML("recordings-ui.xml", "watchrecordings", this))
    401401        return false;
    402402
     403    m_recgroupList  = dynamic_cast<MythUIButtonList *> (GetChild("recgroups"));
    403404    m_groupList     = dynamic_cast<MythUIButtonList *> (GetChild("groups"));
    404405    m_recordingList = dynamic_cast<MythUIButtonList *> (GetChild("recordings"));
    405406
    bool PlaybackBox::Create() 
    422423    connect(m_recordingList, SIGNAL(itemClicked(MythUIButtonListItem*)),
    423424            SLOT(playSelected(MythUIButtonListItem*)));
    424425
     426    if (m_recgroupList)
     427        m_recgroupList->SetCanTakeFocus(false);
     428
    425429    if (!m_player && !m_recGroupPassword.isEmpty())
    426430        displayRecGroup(m_recGroup);
    427431    else if (gContext->GetNumSetting("QueryInitialFilter", 0) == 1)
    void PlaybackBox::updateUsage() 
    752756    }
    753757}
    754758
     759/*
     760 * \fn PlaybackBox::updateRecGroupList(void)
     761 * \brief called when the list of recording groups may have changed
     762 */
     763void PlaybackBox::updateRecGroupList(void)
     764{
     765    if (m_recGroupIdx < 0 || !m_recgroupList)
     766        return;
     767
     768    m_recgroupList->Reset();
     769
     770    QStringList::iterator it;
     771    int idx;
     772    MythUIButtonListItem *item = NULL;
     773    QString name;
     774    QString state;
     775
     776    for (it = m_recGroups.begin(), idx = 0;
     777         it != m_recGroups.end(); ++it, ++idx)
     778    {
     779        name = (*it).simplified();
     780        if (name == "All Programs")
     781            name = "All";
     782
     783        item = new MythUIButtonListItem(m_recgroupList, "",
     784                                        qVariantFromValue(name.toLower()));
     785        if (idx == m_recGroupIdx)
     786        {
     787            state = "selected";
     788            m_recgroupList->SetItemCurrent(item);
     789        }
     790        else
     791            state = "active";
     792
     793        item->SetText(name, "buttonitem", state);
     794    }
     795}
     796
    755797void PlaybackBox::updateGroupList()
    756798{
    757799    m_groupList->Reset();
    bool PlaybackBox::FillList(bool useCache 
    10031045    m_progLists.clear();
    10041046    m_recordingList->Reset();
    10051047    m_groupList->Reset();
     1048    if (m_recgroupList)
     1049        m_recgroupList->Reset();
    10061050    // Clear autoDelete for the "all" list since it will share the
    10071051    // objects with the title lists.
    10081052    m_progLists[""] = ProgramList(false);
    bool PlaybackBox::FillList(bool useCache 
    14651509        }
    14661510    }
    14671511
     1512    updateRecGroupList();
    14681513    updateGroupList();
    14691514    updateUsage();
    14701515
  • programs/mythfrontend/playbackbox.h

    old new class PlaybackBox : public MythScreenTyp 
    293293    QString getRecGroupPassword(const QString &recGroup);
    294294    void fillRecGroupPasswordCache(void);
    295295
     296    void updateRecGroupList();
    296297    void updateGroupList();
    297298    void updateIcons(const ProgramInfo *pginfo = NULL);
    298299    void updateUsage();
    class PlaybackBox : public MythScreenTyp 
    304305
    305306    void HandlePreviewEvent(const ProgramInfo &evinfo);
    306307
     308    MythUIButtonList *m_recgroupList;
    307309    MythUIButtonList *m_groupList;
    308310    MythUIButtonList *m_recordingList;
    309311