Ticket #9603: playbackbox-sort_description.diff

File playbackbox-sort_description.diff, 2.3 KB (added by FabriceMG <mgf@…>, 13 years ago)
  • mythtv/programs/mythfrontend/playbackbox.cpp

    diff --git a/mythtv/programs/mythfrontend/playbackbox.cpp b/mythtv/programs/mythfrontend/playbackbox.cpp
    index f421f72..793031f 100644
    a b static int comp_recordDate_rev(const ProgramInfo *a, const ProgramInfo *b) 
    120120                b->GetScheduledStartTime().date() ? 1 : -1);
    121121}
    122122
     123static int comp_description(const ProgramInfo *a, const ProgramInfo *b)
     124{
     125    if (a->GetDescription() == b->GetDescription())
     126        return (a->GetRecordingStartTime() <
     127                b->GetRecordingStartTime() ? 1 : -1);
     128    else
     129        return (a->GetDescription() < b->GetDescription() ? 1 : -1);
     130}
     131
     132static int comp_description_rev(const ProgramInfo *a, const ProgramInfo *b)
     133{
     134    if (a->GetDescription() == b->GetDescription())
     135        return (a->GetRecordingStartTime() >
     136                b->GetRecordingStartTime() ? 1 : -1);
     137    else
     138        return (a->GetDescription() > b->GetDescription() ? 1 : -1);
     139}
     140
    123141static bool comp_programid_less_than(
    124142    const ProgramInfo *a, const ProgramInfo *b)
    125143{
    static bool comp_recordDate_rev_less_than( 
    162180    return comp_recordDate_rev(a, b) < 0;
    163181}
    164182
     183static bool comp_description_less_than(
     184    const ProgramInfo *a, const ProgramInfo *b)
     185{
     186    return comp_description(a, b) < 0;
     187}
     188
     189static bool comp_description_rev_less_than(
     190    const ProgramInfo *a, const ProgramInfo *b)
     191{
     192    return comp_description_rev(a, b) < 0;
     193}
     194
    165195static const ArtworkType s_artType[] =
    166196    { kArtworkFan,        kArtworkBanner,        kArtworkCover, };
    167197static const uint s_artDelay[] =
    bool PlaybackBox::UpdateUILists(void) 
    17221752            }
    17231753        }
    17241754    }
     1755    else if (episodeSort == "Description")
     1756    {
     1757        QMap<QString, ProgramList>::Iterator Iprog;
     1758        for (Iprog = m_progLists.begin(); Iprog != m_progLists.end(); ++Iprog)
     1759        {
     1760            if (!Iprog.key().isEmpty())
     1761            {
     1762                std::stable_sort((*Iprog).begin(), (*Iprog).end(),
     1763                                 (m_listOrder == 0 || m_type == kDeleteBox) ?
     1764                                 comp_description_rev_less_than :
     1765                                 comp_description_less_than);
     1766            }
     1767        }
     1768    }
    17251769
    17261770    if (!m_progLists[m_watchGroupLabel].empty())
    17271771    {