Ticket #12809: 0003-Add-Unfinished-recording-filter.patch

File 0003-Add-Unfinished-recording-filter.patch, 9.8 KB (added by Roger Siddons, 4 years ago)
  • mythtv/programs/mythfrontend/playbackbox.cpp

    From 1695a554526200556c043031ae9f4c8a868bbb04 Mon Sep 17 00:00:00 2001
    From: Roger Siddons <rsiddons@mythtv.org>
    Date: Mon, 20 Jun 2016 08:55:43 +0100
    Subject: [PATCH 3/3] Add Unfinished recording filter
    
    Adds a new filter that shows recordings with a last played position
    i.e. they've been partly watched
    
    Ordered by last played position, with 'most progressed' at top.
    
    Only implemented on MythCenter-Wide theme.
    
    diff --git a/mythtv/programs/mythfrontend/playbackbox.cpp b/mythtv/programs/mythfrontend/playbackbox.cpp
    index 76d8ac8..108a547 100644
    a b PlaybackBox::PlaybackBox(MythScreenStack *parent, QString name, 
    393393      // Recording Group settings
    394394      m_groupDisplayName(ProgramInfo::i18n("All Programs")),
    395395      m_recGroup("All Programs"),
     396      m_liveTvGroupName(tr("Live TV")),
     397      m_liveTvGroupLabel(m_liveTvGroupName.toLower()),
    396398      m_watchGroupName(tr("Watch List")),
    397399      m_watchGroupLabel(m_watchGroupName.toLower()),
     400      m_unfinishedGroupName(tr("Unfinished")),
     401      m_unfinishedGroupLabel(m_unfinishedGroupName.toLower()),
    398402      m_viewMask(VIEW_TITLES),
    399403
    400404      // General m_popupMenu support
    bool PlaybackBox::UpdateUILists(void) 
    16271631
    16281632    QMap<QString, QString> sortedList;
    16291633    QMap<int, QString> searchRule;
     1634    QMap<uint, ProgramInfo*> unfinished;
    16301635
    16311636    m_programInfoCache.Refresh();
    16321637
    bool PlaybackBox::UpdateUILists(void) 
    17221727            if (m_recGroup != "LiveTV" &&
    17231728                    pRecgroup == "LiveTV" && (m_viewMask & VIEW_LIVETVGRP))
    17241729            {
    1725                 QString tmpTitle = tr("Live TV");
    1726                 sortedList[tmpTitle.toLower()] = tmpTitle;
    1727                 m_progLists[tmpTitle.toLower()].push_front(p);
    1728                 m_progLists[tmpTitle.toLower()].setAutoDelete(false);
     1730                m_progLists[m_liveTvGroupLabel].push_front(p);
     1731                m_progLists[m_liveTvGroupLabel].setAutoDelete(false);
    17291732                continue;
    17301733            }
    17311734
    bool PlaybackBox::UpdateUILists(void) 
    17781781            {
    17791782                m_watchlist.Add(p);
    17801783            }
     1784
     1785            if ((m_viewMask & VIEW_UNFINISHED) && p->GetProgressPercent() > 0)
     1786            {
     1787                unfinished.insert(p->GetProgressPercent(), p);
     1788            }
    17811789        }
    17821790    }
    17831791
    17841792    if (sortedList.empty())
    17851793    {
    1786         LOG(VB_GENERAL, LOG_WARNING, LOC + "SortedList is Empty");
    1787         m_progLists[""];
     1794        LOG(VB_GENERAL, LOG_WARNING, LOC +
     1795            "No recordings selected for display (formerly SortedList is Empty)");
    17881796        m_titleList << "";
    17891797        m_playList.clear();
    17901798
    bool PlaybackBox::UpdateUILists(void) 
    18601868        m_progLists[m_watchGroupLabel].setAutoDelete(false);
    18611869    }
    18621870
    1863     m_titleList = QStringList("");
     1871    m_titleList = QStringList("");  // All Progs always at top
     1872
    18641873    if (m_progLists[m_watchGroupLabel].size() > 0)
    18651874        m_titleList << m_watchGroupName;
    1866     if ((m_progLists["livetv"].size() > 0) &&
    1867         (!sortedList.values().contains(tr("Live TV"))))
    1868         m_titleList << tr("Live TV");
     1875
     1876    if (!unfinished.isEmpty())
     1877    {
     1878        // Most progressed at top
     1879        foreach (ProgramInfo* p, unfinished)
     1880            m_progLists[m_unfinishedGroupLabel].push_front(p);
     1881
     1882        m_progLists[m_unfinishedGroupLabel].setAutoDelete(false);
     1883        m_titleList << m_unfinishedGroupName;
     1884    }
     1885
     1886    if (m_progLists[m_liveTvGroupLabel].size() > 0
     1887            && !sortedList.values().contains(m_liveTvGroupName))
     1888        m_titleList << m_liveTvGroupName;
     1889
    18691890    m_titleList << sortedList.values();
    18701891
    18711892    // Populate list of recording groups
    bool ChangeView::Create() 
    48744895                m_parentScreen, SLOT(toggleRecGroupView(bool)));
    48754896    }
    48764897
    4877     // TODO Do we need two separate settings to determine whether the watchlist
    4878     //      is shown? The filter setting be enough?
    4879         checkBox = dynamic_cast<MythUICheckBox*>(GetChild("watchlist"));
    4880         if (checkBox)
    4881         {
    4882             if (m_viewMask & PlaybackBox::VIEW_WATCHLIST)
    4883                 checkBox->SetCheckState(MythUIStateType::Full);
    4884             connect(checkBox, SIGNAL(toggled(bool)),
    4885                     m_parentScreen, SLOT(toggleWatchListView(bool)));
    4886         }
    4887     //
    4888 
    48894898    checkBox = dynamic_cast<MythUICheckBox*>(GetChild("searches"));
    48904899    if (checkBox)
    48914900    {
    bool ChangeView::Create() 
    48954904                m_parentScreen, SLOT(toggleSearchView(bool)));
    48964905    }
    48974906
    4898     // TODO Do we need two separate settings to determine whether livetv
    4899     //      recordings are shown? Same issue as the watchlist above
    4900         checkBox = dynamic_cast<MythUICheckBox*>(GetChild("livetv"));
    4901         if (checkBox)
    4902         {
    4903             if (m_viewMask & PlaybackBox::VIEW_LIVETVGRP)
    4904                 checkBox->SetCheckState(MythUIStateType::Full);
    4905             connect(checkBox, SIGNAL(toggled(bool)),
    4906                     m_parentScreen, SLOT(toggleLiveTVView(bool)));
    4907         }
    4908     //
     4907    checkBox = dynamic_cast<MythUICheckBox*>(GetChild("watchlist"));
     4908    if (checkBox)
     4909    {
     4910        if (m_viewMask & PlaybackBox::VIEW_WATCHLIST)
     4911            checkBox->SetCheckState(MythUIStateType::Full);
     4912        connect(checkBox, SIGNAL(toggled(bool)),
     4913                m_parentScreen, SLOT(toggleWatchListView(bool)));
     4914    }
     4915
     4916    checkBox = dynamic_cast<MythUICheckBox*>(GetChild("unfinished"));
     4917    if (checkBox)
     4918    {
     4919        if (m_viewMask & PlaybackBox::VIEW_UNFINISHED)
     4920            checkBox->SetCheckState(MythUIStateType::Full);
     4921        connect(checkBox, SIGNAL(toggled(bool)),
     4922                m_parentScreen, SLOT(toggleUnfinishedView(bool)));
     4923    }
     4924
     4925    checkBox = dynamic_cast<MythUICheckBox*>(GetChild("livetv"));
     4926    if (checkBox)
     4927    {
     4928        if (m_viewMask & PlaybackBox::VIEW_LIVETVGRP)
     4929            checkBox->SetCheckState(MythUIStateType::Full);
     4930        connect(checkBox, SIGNAL(toggled(bool)),
     4931                m_parentScreen, SLOT(toggleLiveTVView(bool)));
     4932    }
    49094933
    49104934    checkBox = dynamic_cast<MythUICheckBox*>(GetChild("watched"));
    49114935    if (checkBox)
  • mythtv/programs/mythfrontend/playbackbox.h

    diff --git a/mythtv/programs/mythfrontend/playbackbox.h b/mythtv/programs/mythfrontend/playbackbox.h
    index b01d13a..cda12ca 100644
    a b class PlaybackBox : public ScheduleCommon 
    153153        VIEW_WATCHLIST  =  0x0008,
    154154        VIEW_SEARCHES   =  0x0010,
    155155        VIEW_LIVETVGRP  =  0x0020,
     156        VIEW_UNFINISHED =  0x0040,
    156157        // insert new entries above here
    157158        VIEW_WATCHED    =  0x8000
    158159    } ViewMask;
    class PlaybackBox : public ScheduleCommon 
    264265    void toggleCategoryView(bool setOn)  { toggleView(VIEW_CATEGORIES, setOn); }
    265266    void toggleRecGroupView(bool setOn)  { toggleView(VIEW_RECGROUPS, setOn); }
    266267    void toggleWatchListView(bool setOn) { toggleView(VIEW_WATCHLIST, setOn); }
     268    void toggleUnfinishedView(bool setOn){ toggleView(VIEW_UNFINISHED, setOn); }
    267269    void toggleSearchView(bool setOn)    { toggleView(VIEW_SEARCHES, setOn); }
    268270    void toggleLiveTVView(bool setOn)    { toggleView(VIEW_LIVETVGRP, setOn); }
    269271    void toggleWatchedView(bool setOn)   { toggleView(VIEW_WATCHED, setOn); }
    class PlaybackBox : public ScheduleCommon 
    437439    QString             m_recGroup;
    438440    QString             m_curGroupPassword;
    439441    QString             m_newRecGroup;
     442    QString             m_liveTvGroupName;
     443    QString             m_liveTvGroupLabel;
    440444    QString             m_watchGroupName;
    441445    QString             m_watchGroupLabel;
     446    QString             m_unfinishedGroupName;
     447    QString             m_unfinishedGroupLabel;
    442448    ViewMask            m_viewMask;
    443449
    444450    // Watchlist support
  • mythtv/themes/MythCenter-wide/recordings-ui.xml

    diff --git a/mythtv/themes/MythCenter-wide/recordings-ui.xml b/mythtv/themes/MythCenter-wide/recordings-ui.xml
    index 0abbb29..1857e74 100644
    a b  
    513513        </textarea>
    514514
    515515        <checkbox name="recgroups" from="basecheckbox">
    516             <position>90,190</position>
     516            <position>90,180</position>
    517517        </checkbox>
    518518
    519519        <textarea name="grouplabel" from="titlelabel">
    520             <position>140,190</position>
     520            <position>140,180</position>
    521521            <value>Show Recording Groups</value>
    522522        </textarea>
    523523
    524524        <checkbox name="watchlist" from="basecheckbox">
    525             <position>90,240</position>
     525            <position>90,220</position>
    526526        </checkbox>
    527527
    528528        <textarea name="watchlabel" from="titlelabel">
    529             <position>140,240</position>
     529            <position>140,220</position>
    530530            <value>Show Watch List</value>
    531531        </textarea>
    532532
     533        <checkbox name="unfinished" from="basecheckbox">
     534            <position>90,260</position>
     535        </checkbox>
     536
     537        <textarea name="unfinishedlabel" from="titlelabel">
     538            <position>140,260</position>
     539            <value>Show Unfinished</value>
     540        </textarea>
     541
    533542        <checkbox name="searches" from="basecheckbox">
    534             <position>90,290</position>
     543            <position>90,300</position>
    535544        </checkbox>
    536545
    537546        <textarea name="searchlabel" from="titlelabel">
    538             <position>140,290</position>
     547            <position>140,300</position>
    539548            <value>Show Searches</value>
    540549        </textarea>
    541550
     
    549558        </textarea>
    550559
    551560        <checkbox name="watched" from="basecheckbox">
    552             <position>90,390</position>
     561            <position>90,380</position>
    553562        </checkbox>
    554563
    555564        <textarea name="watchedlabel" from="titlelabel">
    556             <position>140,390</position>
     565            <position>140,380</position>
    557566            <value>Show Watched Programs</value>
    558567        </textarea>
    559568