Ticket #6318: recGroup-ui-v2.patch

File recGroup-ui-v2.patch, 3.6 KB (added by jppoet@…, 16 years ago)

Minor optimizations

  • programs/mythfrontend/playbackbox.cpp

    old new bool PlaybackBox::Create()  
    408408    if (!LoadWindowFromXML("recordings-ui.xml", "watchrecordings", this))
    409409        return false;
    410410
     411    m_recgroupList  = dynamic_cast<MythUIButtonList *> (GetChild("recgroups"));
    411412    m_groupList     = dynamic_cast<MythUIButtonList *> (GetChild("groups"));
    412413    m_recordingList = dynamic_cast<MythUIButtonList *> (GetChild("recordings"));
    413414
    bool PlaybackBox::Create()  
    436437    m_groupList->SetLCDTitles(tr("Groups"));
    437438    m_recordingList->SetLCDTitles(tr("Recordings"), "titlesubtitle|shortdate|starttime");
    438439
     440    if (m_recgroupList)
     441        m_recgroupList->SetCanTakeFocus(false);
     442
    439443    if (!m_player && !m_recGroupPassword.isEmpty())
    440444        displayRecGroup(m_recGroup);
    441445    else if (gContext->GetNumSetting("QueryInitialFilter", 0) == 1)
    void PlaybackBox::updateUsage()  
    817821    }
    818822}
    819823
     824/*
     825 * \fn PlaybackBox::updateRecGroupList(void)
     826 * \brief called when the list of recording groups may have changed
     827 */
     828void PlaybackBox::updateRecGroupList(void)
     829{
     830    if (m_recGroupIdx < 0 || !m_recgroupList)
     831        return;
     832
     833    m_recgroupList->Reset();
     834
     835    QStringList::iterator it;
     836    int idx;
     837    MythUIButtonListItem *item = NULL;
     838    QString name;
     839    QString state;
     840
     841    for (it = m_recGroups.begin(), idx = 0;
     842         it != m_recGroups.end(); ++it, ++idx)
     843    {
     844        name = (*it).simplified();
     845        if (name == "All Programs")
     846            name = "All";
     847
     848        item = new MythUIButtonListItem(m_recgroupList, "",
     849                                        qVariantFromValue(name.toLower()));
     850
     851        if (idx == m_recGroupIdx)
     852            m_recgroupList->SetItemCurrent(item);
     853
     854        item->SetText(name);
     855    }
     856}
     857
    820858void PlaybackBox::updateGroupList()
    821859{
    822860    m_groupList->Reset();
    bool PlaybackBox::FillList(bool useCache  
    10301068    m_progLists.clear();
    10311069    m_recordingList->Reset();
    10321070    m_groupList->Reset();
     1071    if (m_recgroupList)
     1072        m_recgroupList->Reset();
    10331073    // Clear autoDelete for the "all" list since it will share the
    10341074    // objects with the title lists.
    10351075    m_progLists[""] = ProgramList(false);
    bool PlaybackBox::FillList(bool useCache  
    14901530        }
    14911531    }
    14921532
     1533    updateRecGroupList();
    14931534    updateGroupList();
    14941535    updateUsage();
    14951536
    bool PlaybackBox::keyPressEvent(QKeyEven  
    33213362                deleteSelected(m_recordingList->GetItemCurrent());
    33223363            else if (action == "PLAYBACK")
    33233364                playSelected(m_recordingList->GetItemCurrent());
    3324             else if (action == "INFO")
     3365            else if (action == "MENU2")
    33253366                showActionsSelected();
    33263367            else if (action == "DETAILS")
    33273368                details();
  • programs/mythfrontend/playbackbox.h

    old new class PlaybackBox : public MythScreenTyp  
    307307    QString testImageFiles(QString &testDirectory,
    308308                           QString &seriesID, QString &titleIn);
    309309
     310    void updateRecGroupList();
    310311    void updateGroupList();
    311312    void updateIcons(const ProgramInfo *pginfo = NULL);
    312313    void updateUsage();
    class PlaybackBox : public MythScreenTyp  
    318319
    319320    void HandlePreviewEvent(const ProgramInfo &evinfo);
    320321
     322    MythUIButtonList *m_recgroupList;
    321323    MythUIButtonList *m_groupList;
    322324    MythUIButtonList *m_recordingList;
    323325