Ticket #4530: watched_filter.diff

File watched_filter.diff, 3.4 KB (added by cpinkham, 13 years ago)

Add a 'Show Watched Programs' filter to the Group View popup.

  • programs/mythfrontend/playbackbox.cpp

     
    18581858                  ((p->category == "") && (recGroup == tr("Unknown")))) &&
    18591859                 ( !recGroupPwCache.contains(p->recgroup))))
    18601860            {
     1861                if ((!(viewMask & VIEW_WATCHED)) &&
     1862                    (p->programflags & FL_WATCHED))
     1863                    continue;
     1864
    18611865                if (viewMask != VIEW_NONE)
    18621866                    progLists[""].prepend(p);
    18631867
     
    49954999        recGroupPopup->addWidget(checkBox, false);
    49965000    }
    49975001
     5002    checkBox = new MythCheckBox(tr("Show Watched Programs"), recGroupPopup);
     5003    checkBox->setChecked(viewMask & VIEW_WATCHED);
     5004    connect(checkBox, SIGNAL(toggled(bool)), this,
     5005            SLOT(toggleWatchedView(bool)));
     5006    recGroupPopup->addWidget(checkBox, false);
     5007
    49985008    MythPushButton *okbutton = new MythPushButton(recGroupPopup);
    49995009    okbutton->setText(tr("Save Current View"));
    50005010    recGroupPopup->addWidget(okbutton);
     
    50525062    recGroupListBox = new MythListBox(recGroupPopup);
    50535063
    50545064    // Find each recording group, and the number of recordings in each
    5055     query.prepare(
     5065    query.prepare(QString(
    50565066        "SELECT recgroup, COUNT(title) "
    50575067        "FROM recorded "
    5058         "WHERE deletepending = 0 "
    5059         "GROUP BY recgroup");
     5068        "WHERE deletepending = 0 %1 "
     5069        "GROUP BY recgroup")
     5070        .arg((viewMask & VIEW_WATCHED) ? "" : "AND watched = 0"));
     5071
    50605072    if (query.exec() && query.isActive() && query.size() > 0)
    50615073    {
    50625074        while (query.next())
     
    50945106    groups.clear();
    50955107
    50965108    // Find each category, and the number of recordings in each
    5097     query.prepare(
     5109    query.prepare(QString(
    50985110        "SELECT DISTINCT category, COUNT(title) "
    50995111        "FROM recorded "
    5100         "WHERE deletepending = 0 "
    5101         "GROUP BY category");
     5112        "WHERE deletepending = 0 %1 "
     5113        "GROUP BY category")
     5114        .arg((viewMask & VIEW_WATCHED) ? "" : "AND watched = 0"));
     5115
    51025116    if (query.exec() && query.isActive() && query.size() > 0)
    51035117    {
    51045118        int unknownCount = 0;
  • programs/mythfrontend/playbackbox.h

     
    8585    } ViewTitleSort;
    8686
    8787    typedef enum {
    88         VIEW_NONE       =  0x00,
    89         VIEW_TITLES     =  0x01,
    90         VIEW_CATEGORIES =  0x02,
    91         VIEW_RECGROUPS  =  0x04,
    92         VIEW_WATCHLIST  =  0x08,
    93         VIEW_SEARCHES   =  0x10,
    94         VIEW_LIVETVGRP  =  0x20,
     88        VIEW_NONE       =  0x0000,
     89        VIEW_TITLES     =  0x0001,
     90        VIEW_CATEGORIES =  0x0002,
     91        VIEW_RECGROUPS  =  0x0004,
     92        VIEW_WATCHLIST  =  0x0008,
     93        VIEW_SEARCHES   =  0x0010,
     94        VIEW_LIVETVGRP  =  0x0020,
     95        // insert new entries above here
     96        VIEW_WATCHED    =  0x8000
    9597    } ViewMask;
    9698
    9799    typedef enum
     
    205207    void toggleWatchListView(bool setOn) { toggleView(VIEW_WATCHLIST, setOn); }
    206208    void toggleSearchView(bool setOn)    { toggleView(VIEW_SEARCHES, setOn); }
    207209    void toggleLiveTVView(bool setOn)    { toggleView(VIEW_LIVETVGRP, setOn); }
     210    void toggleWatchedView(bool setOn)   { toggleView(VIEW_WATCHED, setOn); }
    208211
    209212    void exitWin();
    210213