Ticket #12296: 0004-Watchlist-Add-watchtotal-widget-theme-support.patch

File 0004-Watchlist-Add-watchtotal-widget-theme-support.patch, 2.9 KB (added by Roger Siddons <dizygotheca@…>, 6 years ago)
  • mythtv/programs/mythfrontend/playbackbox.cpp

    From 04575ddac2175f970a4a4e0d1649304b33504a03 Mon Sep 17 00:00:00 2001
    From: Roger Siddons <dizygotheca@ntlworld.com>
    Date: Sun, 5 Oct 2014 14:27:54 +0100
    Subject: [PATCH 4/6] Watchlist: Add watchtotal widget theme support
    
    
    diff --git a/mythtv/programs/mythfrontend/playbackbox.cpp b/mythtv/programs/mythfrontend/playbackbox.cpp
    index 7927133..c2924df 100644
    a b void PlaybackBox::ItemLoaded(MythUIButtonListItem *item) 
    939939        item->SetFontState(state);
    940940
    941941        InfoMap infoMap;
     942
     943        // watchlist episode count only exists when watchlist group is selected
     944        // and multiple episodes exist
     945        if (groupname == m_watchGroupLabel)
     946        {
     947            QString title = extract_watchlist_title(*pginfo);
     948            infoMap["watchtotal"] = m_watchlistCount[title] > 1
     949                    ? QString("%1").arg(m_watchlistCount[title]) : "";
     950        }
     951
    942952        pginfo->ToMap(infoMap);
    943953        item->SetTextFromMap(infoMap);
    944954
    bool PlaybackBox::UpdateUILists(void) 
    16091619    m_progsInDB = 0;
    16101620    m_titleList.clear();
    16111621    m_progLists.clear();
     1622    m_watchlistCount.clear();
    16121623    m_recordingList->Reset();
    16131624    m_groupList->Reset();
    16141625    if (m_recgroupList)
    bool PlaybackBox::UpdateUILists(void) 
    16231634
    16241635    QMap<QString, QString> sortedList;
    16251636    QMap<int, QString> searchRule;
    1626     QMap<QString, int> watchlistCount;
    16271637    TitleMap watchEpisode;
    16281638
    16291639    m_programInfoCache.Refresh();
    bool PlaybackBox::UpdateUILists(void) 
    17791789                    else
    17801790                    {
    17811791                        QString title = extract_watchlist_title(*p);
    1782                         ++watchlistCount[title];
     1792                        ++m_watchlistCount[title];
    17831793
    17841794                        ProgramInfo* curEp = watchEpisode[title];
    17851795                        if (curEp)
    bool PlaybackBox::UpdateUILists(void) 
    19781988            // add point equal to baseValue for each additional episode
    19791989            if (recid && maxEpisodes[recid] == 0)
    19801990            {
    1981                 score += (watchlistCount[extract_watchlist_title(*p)] - 1) *
     1991                score += (m_watchlistCount[extract_watchlist_title(*p)] - 1) *
    19821992                        baseValue;
    19831993            }
    19841994
  • mythtv/programs/mythfrontend/playbackbox.h

    diff --git a/mythtv/programs/mythfrontend/playbackbox.h b/mythtv/programs/mythfrontend/playbackbox.h
    index be160d3..ff4b692 100644
    a b class PlaybackBox : public ScheduleCommon 
    379379    QString             m_watchGroupLabel;
    380380    ViewMask            m_viewMask;
    381381
     382    // Watchlist support
     383    QMap<QString, int> m_watchlistCount;
     384
    382385    // Popup support //////////////////////////////////////////////////////////
    383386    // General popup support
    384387    MythDialogBox      *m_menuDialog;