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)
|
| 939 | 939 | item->SetFontState(state); |
| 940 | 940 | |
| 941 | 941 | 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 | |
| 942 | 952 | pginfo->ToMap(infoMap); |
| 943 | 953 | item->SetTextFromMap(infoMap); |
| 944 | 954 | |
| … |
… |
bool PlaybackBox::UpdateUILists(void)
|
| 1609 | 1619 | m_progsInDB = 0; |
| 1610 | 1620 | m_titleList.clear(); |
| 1611 | 1621 | m_progLists.clear(); |
| | 1622 | m_watchlistCount.clear(); |
| 1612 | 1623 | m_recordingList->Reset(); |
| 1613 | 1624 | m_groupList->Reset(); |
| 1614 | 1625 | if (m_recgroupList) |
| … |
… |
bool PlaybackBox::UpdateUILists(void)
|
| 1623 | 1634 | |
| 1624 | 1635 | QMap<QString, QString> sortedList; |
| 1625 | 1636 | QMap<int, QString> searchRule; |
| 1626 | | QMap<QString, int> watchlistCount; |
| 1627 | 1637 | TitleMap watchEpisode; |
| 1628 | 1638 | |
| 1629 | 1639 | m_programInfoCache.Refresh(); |
| … |
… |
bool PlaybackBox::UpdateUILists(void)
|
| 1779 | 1789 | else |
| 1780 | 1790 | { |
| 1781 | 1791 | QString title = extract_watchlist_title(*p); |
| 1782 | | ++watchlistCount[title]; |
| | 1792 | ++m_watchlistCount[title]; |
| 1783 | 1793 | |
| 1784 | 1794 | ProgramInfo* curEp = watchEpisode[title]; |
| 1785 | 1795 | if (curEp) |
| … |
… |
bool PlaybackBox::UpdateUILists(void)
|
| 1978 | 1988 | // add point equal to baseValue for each additional episode |
| 1979 | 1989 | if (recid && maxEpisodes[recid] == 0) |
| 1980 | 1990 | { |
| 1981 | | score += (watchlistCount[extract_watchlist_title(*p)] - 1) * |
| | 1991 | score += (m_watchlistCount[extract_watchlist_title(*p)] - 1) * |
| 1982 | 1992 | baseValue; |
| 1983 | 1993 | } |
| 1984 | 1994 | |
diff --git a/mythtv/programs/mythfrontend/playbackbox.h b/mythtv/programs/mythfrontend/playbackbox.h
index be160d3..ff4b692 100644
|
a
|
b
|
class PlaybackBox : public ScheduleCommon
|
| 379 | 379 | QString m_watchGroupLabel; |
| 380 | 380 | ViewMask m_viewMask; |
| 381 | 381 | |
| | 382 | // Watchlist support |
| | 383 | QMap<QString, int> m_watchlistCount; |
| | 384 | |
| 382 | 385 | // Popup support ////////////////////////////////////////////////////////// |
| 383 | 386 | // General popup support |
| 384 | 387 | MythDialogBox *m_menuDialog; |