Ticket #1771: PlayBoxAllOrdering5b.patch

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

Fix typo: effected affected

  • 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),
     
    265281    titleList << "";
    266282    playList.clear();
    267283
     284    // Split out sort order modes
     285    // Done using a switch instead of a bit-map to maintain
     286    // backward compatibility
     287    switch (listOrder) {
     288      case 0:
     289        allOrder = 0;
     290        break;
     291      case 1:
     292        allOrder = 1;
     293        break;
     294      case 2:
     295        listOrder = 1;
     296        allOrder = 0;
     297        break;
     298      case 3:
     299        listOrder = 0;
     300        allOrder = 1;
     301        break;
     302    }
     303
    268304    // recording group stuff
    269305    recGroupType.clear();
    270306    recGroupType[recGroup] = (displayCat) ? "category" : "recgroup";
     
    15031539    {
    15041540        clearProgramCache();
    15051541
    1506         progCache = RemoteGetRecordedList(listOrder == 0 || type == Delete);
     1542        progCache = RemoteGetRecordedList(allOrder == 0 || type == Delete);
    15071543    }
    15081544
    15091545    if (progCache)
     
    16661702            }
    16671703        }
    16681704    }
     1705    else if (episodeSort == "Date")
     1706    {
     1707        QMap<QString, ProgramList>::Iterator Iprog;
     1708        for (Iprog = progLists.begin(); Iprog != progLists.end(); ++Iprog)
     1709        {
     1710            if (!Iprog.key().isEmpty())
     1711            {
     1712                if (listOrder == 0 || type == Delete)
     1713                    Iprog.data().Sort(comp_recordDate_rev);
     1714                else
     1715                    Iprog.data().Sort(comp_recordDate);
     1716            }
     1717        }
     1718    }
     1719
    16691720    if (progLists[watchGroup].count() > 1)
    16701721    {
    16711722        QDateTime now = QDateTime::currentDateTime();
     
    18691920
    18701921            if (oldtitle != watchGroup)
    18711922            {
    1872                 if (listOrder == 0 || type == Delete)
     1923                if (titleIndex == 0)
    18731924                {
    1874                     if (episodeSort == "OrigAirDate" && titleIndex > 0)
     1925                    if (allOrder == 0 || type == Delete)
    18751926                    {
    1876                         if (oldoriginalAirDate > p->originalAirDate)
     1927                        if (oldstartts > p->recstartts)
    18771928                            break;
    18781929                    }
    1879                     else if (episodeSort == "Id" && titleIndex > 0)
    1880                     {
    1881                         if (oldprogramid > p->programid)
    1882                             break;
     1930                    else {
     1931                        if (oldstartts < p->recstartts)
     1932                            break; 
    18831933                    }
    1884                     else
    1885                     {
    1886                         if (oldstartts > p->recstartts)
    1887                             break;
    1888                     }
    18891934                }
    18901935                else
    18911936                {
    1892                     if (episodeSort == "OrigAirDate" && titleIndex > 0)
     1937                    if (listOrder == 0 || type == Delete)
    18931938                    {
    1894                         if (oldoriginalAirDate < p->originalAirDate)
    1895                             break;
     1939                        if (episodeSort == "OrigAirDate")
     1940                        {
     1941                            if (oldoriginalAirDate > p->originalAirDate)
     1942                                break;
     1943                        }
     1944                        else if (episodeSort == "Id")
     1945                        {
     1946                            if (oldprogramid > p->programid)
     1947                                break;
     1948                        }
     1949                        else
     1950                        {
     1951                            if (oldstartts > p->recstartts)
     1952                                break;
     1953                        }
    18961954                    }
    1897                     else if (episodeSort == "Id" && titleIndex > 0)
    1898                     {
    1899                         if (oldprogramid < p->programid)
    1900                             break;
    1901                     }
    19021955                    else
    19031956                    {
    1904                         if (oldstartts < p->recstartts)
    1905                             break;
     1957                        if (episodeSort == "OrigAirDate")
     1958                        {
     1959                            if (oldoriginalAirDate < p->originalAirDate)
     1960                                break;
     1961                        }
     1962                        else if (episodeSort == "Id")
     1963                        {
     1964                            if (oldprogramid < p->programid)
     1965                                break;
     1966                        }
     1967                        else
     1968                        {
     1969                            if (oldstartts < p->recstartts)
     1970                                break;
     1971                        }
    19061972                    }
    19071973                }
    19081974            }
  • programs/mythfrontend/globalsettings.cpp

     
    704704    return vcg;
    705705}
    706706
    707 static HostCheckBox *PlayBoxOrdering()
     707static HostComboBox *PlayBoxOrdering()
    708708{
    709     HostCheckBox *gc = new HostCheckBox("PlayBoxOrdering");
    710     gc->setLabel(QObject::tr("List Newest Recording First"));
    711     gc->setValue(true);
    712     gc->setHelpText(QObject::tr("When enabled, the most recent recording "
    713                     "will be listed first in the 'Watch Recordings' "
    714                     "screen, otherwise the oldest recording will be "
    715                     "listed first."));
     709    HostComboBox *gc = new HostComboBox("PlayBoxOrdering");
     710    gc->setLabel(QObject::tr("(sub)Title sort order"));
     711    gc->addSelection(QObject::tr("Sort all sub-titles/multi-titles Ascending"), "0");
     712    gc->addSelection(QObject::tr("Sort all sub-titles/multi-titles Descending"), "1");
     713    gc->addSelection(QObject::tr("Sort sub-titles Descending, multi-titles Ascending"), "2");
     714    gc->addSelection(QObject::tr("Sort sub-titles Ascending, multi-titles Descending"), "3");
     715    gc->setValue(1);
     716    gc->setHelpText(QObject::tr("Selects how to sort show episodes. "
     717                                "Sub-titles refers to the episodes listed "
     718                                "under a specific show title. "
     719                                "multi-title refers to sections "
     720                                "(e.g. \"All Programs\") which list "
     721                                "multiple titles.  Sections in parentheses "
     722                                "are not affected."));
    716723    return gc;
    717724}
    718725
  • 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