1 | Index: mythtv/programs/mythfrontend/playbackbox.cpp |
---|
2 | =================================================================== |
---|
3 | --- mythtv/programs/mythfrontend/playbackbox.cpp (revision 7442) |
---|
4 | +++ mythtv/programs/mythfrontend/playbackbox.cpp (working copy) |
---|
5 | @@ -53,7 +53,7 @@ |
---|
6 | return 1; |
---|
7 | } |
---|
8 | |
---|
9 | -static int comp_originalAirDate(ProgramInfo *a, ProgramInfo *b) |
---|
10 | +static int comp_originalAirDateDesc(ProgramInfo *a, ProgramInfo *b) |
---|
11 | { |
---|
12 | QDate dt1, dt2; |
---|
13 | |
---|
14 | @@ -82,6 +82,35 @@ |
---|
15 | return 1; |
---|
16 | } |
---|
17 | |
---|
18 | +static int comp_originalAirDateAsc(ProgramInfo *a, ProgramInfo *b) |
---|
19 | +{ |
---|
20 | + QDate dt1, dt2; |
---|
21 | + |
---|
22 | + if (a->hasAirDate) |
---|
23 | + dt1 = a->originalAirDate; |
---|
24 | + else |
---|
25 | + dt1 = a->startts.date(); |
---|
26 | + |
---|
27 | + if (b->hasAirDate) |
---|
28 | + dt2 = b->originalAirDate; |
---|
29 | + else |
---|
30 | + dt2 = b->startts.date(); |
---|
31 | + |
---|
32 | + if (dt1 == dt2) |
---|
33 | + { |
---|
34 | + if (a->recstartts == b->recstartts) |
---|
35 | + return 0; |
---|
36 | + if (a->recstartts < b->recstartts) |
---|
37 | + return 1; |
---|
38 | + else |
---|
39 | + return -1; |
---|
40 | + } |
---|
41 | + if (dt1 < dt2) |
---|
42 | + return 1; |
---|
43 | + else |
---|
44 | + return -1; |
---|
45 | +} |
---|
46 | + |
---|
47 | PlaybackBox::PlaybackBox(BoxType ltype, MythMainWindow *parent, |
---|
48 | const char *name) |
---|
49 | : MythDialog(parent, name) |
---|
50 | @@ -1411,7 +1440,12 @@ |
---|
51 | for (Iprog = progLists.begin(); Iprog != progLists.end(); ++Iprog) |
---|
52 | { |
---|
53 | if (!Iprog.key().isEmpty()) |
---|
54 | - Iprog.data().Sort(comp_originalAirDate); |
---|
55 | + { |
---|
56 | + if (listOrder == 1) |
---|
57 | + Iprog.data().Sort(comp_originalAirDateAsc); |
---|
58 | + else |
---|
59 | + Iprog.data().Sort(comp_originalAirDateDesc); |
---|
60 | + } |
---|
61 | } |
---|
62 | } |
---|
63 | else if (episodeSort == "Id") |
---|