Ticket #1771: PlayBoxAllOrdering4.patch

File PlayBoxAllOrdering4.patch, 7.2 KB (added by John Poet <jppoet@…>, 18 years ago)

Compatible with 11373

  • programs/mythfrontend/playbackbox.cpp

     
    169169    return sTitle;
    170170}
    171171
     172static int comp_recordDate(ProgramInfo *a, ProgramInfo *b)
     173{
     174    if (a->startts.date() == b->startts.date())
     175        return (a->recstartts < b->recstartts ? 1 : -1);
     176    else
     177        return (a->startts.date() < b->startts.date() ? 1 : -1);
     178}
     179
     180static int comp_recordDate_rev(ProgramInfo *a, ProgramInfo *b)
     181{
     182    if (a->startts.date() == b->startts.date())
     183        return (a->recstartts > b->recstartts ? 1 : -1);
     184    else
     185        return (a->startts.date() > b->startts.date() ? 1 : -1);
     186}
     187
    172188PlaybackBox::PlaybackBox(BoxType ltype, MythMainWindow *parent,
    173189                         const char *name)
    174190    : MythDialog(parent, name),
     
    241257    formatTime         = gContext->GetSetting("TimeFormat", "h:mm AP");
    242258    recGroup           = gContext->GetSetting("DisplayRecGroup","All Programs");
    243259    listOrder          = gContext->GetNumSetting("PlayBoxOrdering", 1);
     260    allOrder           = gContext->GetNumSetting("PlayBoxAllOrdering", 1);
    244261    useSearches        = gContext->GetNumSetting("PlaybackSearches", 0);
    245262    useWatchList       = gContext->GetNumSetting("PlaybackWatchList", 1);
    246263    watchListAutoExpire= gContext->GetNumSetting("PlaybackWLAutoExpire", 0);
     
    15031520    {
    15041521        clearProgramCache();
    15051522
    1506         progCache = RemoteGetRecordedList(listOrder == 0 || type == Delete);
     1523        progCache = RemoteGetRecordedList(allOrder == 0 || type == Delete);
    15071524    }
    15081525
    15091526    if (progCache)
     
    16661683            }
    16671684        }
    16681685    }
     1686    else if (episodeSort == "Date")
     1687    {
     1688        QMap<QString, ProgramList>::Iterator Iprog;
     1689        for (Iprog = progLists.begin(); Iprog != progLists.end(); ++Iprog)
     1690        {
     1691            if (!Iprog.key().isEmpty())
     1692            {
     1693                if (listOrder == 0 || type == Delete)
     1694                    Iprog.data().Sort(comp_recordDate_rev);
     1695                else
     1696                    Iprog.data().Sort(comp_recordDate);
     1697            }
     1698        }
     1699    }
     1700
    16691701    if (progLists[watchGroup].count() > 1)
    16701702    {
    16711703        QDateTime now = QDateTime::currentDateTime();
     
    18691901
    18701902            if (oldtitle != watchGroup)
    18711903            {
    1872                 if (listOrder == 0 || type == Delete)
     1904                if (titleIndex == 0)
    18731905                {
    1874                     if (episodeSort == "OrigAirDate" && titleIndex > 0)
     1906                    if (allOrder == 0 || type == Delete)
    18751907                    {
    1876                         if (oldoriginalAirDate > p->originalAirDate)
     1908                        if (oldstartts > p->recstartts)
    18771909                            break;
    18781910                    }
    1879                     else if (episodeSort == "Id" && titleIndex > 0)
    1880                     {
    1881                         if (oldprogramid > p->programid)
    1882                             break;
     1911                    else {
     1912                        if (oldstartts < p->recstartts)
     1913                            break; 
    18831914                    }
    1884                     else
    1885                     {
    1886                         if (oldstartts > p->recstartts)
    1887                             break;
    1888                     }
    18891915                }
    18901916                else
    18911917                {
    1892                     if (episodeSort == "OrigAirDate" && titleIndex > 0)
     1918                    if (listOrder == 0 || type == Delete)
    18931919                    {
    1894                         if (oldoriginalAirDate < p->originalAirDate)
    1895                             break;
     1920                        if (episodeSort == "OrigAirDate")
     1921                        {
     1922                            if (oldoriginalAirDate > p->originalAirDate)
     1923                                break;
     1924                        }
     1925                        else if (episodeSort == "Id")
     1926                        {
     1927                            if (oldprogramid > p->programid)
     1928                                break;
     1929                        }
     1930                        else
     1931                        {
     1932                            if (oldstartts > p->recstartts)
     1933                                break;
     1934                        }
    18961935                    }
    1897                     else if (episodeSort == "Id" && titleIndex > 0)
    1898                     {
    1899                         if (oldprogramid < p->programid)
    1900                             break;
    1901                     }
    19021936                    else
    19031937                    {
    1904                         if (oldstartts < p->recstartts)
    1905                             break;
     1938                        if (episodeSort == "OrigAirDate")
     1939                        {
     1940                            if (oldoriginalAirDate < p->originalAirDate)
     1941                                break;
     1942                        }
     1943                        else if (episodeSort == "Id")
     1944                        {
     1945                            if (oldprogramid < p->programid)
     1946                                break;
     1947                        }
     1948                        else
     1949                        {
     1950                            if (oldstartts < p->recstartts)
     1951                                break;
     1952                        }
    19061953                    }
    19071954                }
    19081955            }
  • programs/mythfrontend/globalsettings.cpp

     
    716716    return gc;
    717717}
    718718
     719static HostCheckBox *PlayBoxAllOrdering()
     720{
     721    HostCheckBox *gc = new HostCheckBox("PlayBoxAllOrdering");
     722    gc->setLabel(QObject::tr("All Programs: List Newest Recording First"));
     723    gc->setValue(true);
     724    gc->setHelpText(QObject::tr("When enabled, the most recent recording "
     725                    "will be listed first in the 'All Programs' or 'Default' "
     726                    "section of the 'Watch Recordings' screen, otherwise "
     727                    "the oldest recording will be listed first."));
     728    return gc;
     729}
     730
    719731static HostComboBox *PlayBoxEpisodeSort()
    720732{
    721733    HostComboBox *gc = new HostComboBox("PlayBoxEpisodeSort");
     
    35543566    VerticalConfigurationGroup* pbox = new VerticalConfigurationGroup(false);
    35553567    pbox->setLabel(QObject::tr("View Recordings"));
    35563568    pbox->addChild(PlayBoxOrdering());
     3569    pbox->addChild(PlayBoxAllOrdering());
    35573570    pbox->addChild(PlayBoxEpisodeSort());
    35583571    pbox->addChild(GeneratePreviewPixmaps());
    35593572    pbox->addChild(PreviewPixmapOffset());
  • programs/mythfrontend/playbackbox.h

     
    326326    bool                arrowAccel;
    327327    /// if true keypress events are ignored 
    328328    bool                ignoreKeyPressEvents;
     329    /// allOrder controls the ordering of the "All Programs" list
     330    int                 allOrder;
    329331    /// listOrder controls the ordering of the recordings in the list
    330332    int                 listOrder;
    331333    /// Number of items in selector that can be shown on the screen at once