diff -r -u -X diff.exclude myth.13871.0712a/mythtv/programs/mythfrontend/viewscheduled.cpp myth.13871.0712b/mythtv/programs/mythfrontend/viewscheduled.cpp
|
|
|
58 | 58 | exit(FRONTEND_BUGGY_EXIT_NO_SELECTOR); |
59 | 59 | } |
60 | 60 | |
61 | | updateBackground(); |
| 61 | curView = -1; |
| 62 | fillViewList("time"); |
| 63 | |
| 64 | if (curView < 0) |
| 65 | QApplication::postEvent(this, new MythEvent("CHOOSE_VIEW")); |
| 66 | |
62 | 67 | |
63 | 68 | inEvent = false; |
64 | 69 | inFill = false; |
… |
… |
|
70 | 75 | maxinput = 0; |
71 | 76 | listPos = 0; |
72 | 77 | FillList(); |
| 78 | |
| 79 | updateBackground(); |
73 | 80 | |
74 | 81 | setNoErase(); |
75 | 82 | |
… |
… |
|
127 | 134 | setShowAll(true); |
128 | 135 | else if (action == "2") |
129 | 136 | setShowAll(false); |
| 137 | |
| 138 | else if (action == "4") |
| 139 | { |
| 140 | if (viewList[curView] == "sort by time") |
| 141 | curView = viewList.findIndex("reverse time"); |
| 142 | else |
| 143 | curView = viewList.findIndex("sort by time"); |
| 144 | |
| 145 | needFill = true; |
| 146 | } |
| 147 | else if (action == "5") |
| 148 | { |
| 149 | if (viewList[curView] == "sort by title") |
| 150 | curView = viewList.findIndex("reverse title"); |
| 151 | else |
| 152 | curView = viewList.findIndex("sort by title"); |
| 153 | |
| 154 | needFill = true; |
| 155 | } |
| 156 | |
130 | 157 | else if (action == "PREVVIEW" || action == "NEXTVIEW") |
131 | 158 | setShowAll(!showAll); |
132 | 159 | else if (action == "VIEWCARD") |
… |
… |
|
254 | 281 | } |
255 | 282 | } |
256 | 283 | |
| 284 | class pbTitleSort |
| 285 | { |
| 286 | public: |
| 287 | pbTitleSort(bool reverseSort = false) {m_reverse = reverseSort;} |
| 288 | |
| 289 | bool operator()(const ProgramInfo *a, const ProgramInfo *b) |
| 290 | { |
| 291 | if (a->sortTitle == b->sortTitle) |
| 292 | { |
| 293 | if (a->programid == b->programid) |
| 294 | return (a->startts < b->startts); |
| 295 | else |
| 296 | return (a->programid < b->programid); |
| 297 | } |
| 298 | else if (m_reverse) |
| 299 | return (a->sortTitle > b->sortTitle); |
| 300 | else |
| 301 | return (a->sortTitle < b->sortTitle); |
| 302 | } |
| 303 | |
| 304 | private: |
| 305 | bool m_reverse; |
| 306 | }; |
| 307 | |
| 308 | class pbTimeSort |
| 309 | { |
| 310 | public: |
| 311 | pbTimeSort(bool reverseSort = false) {m_reverse = reverseSort;} |
| 312 | |
| 313 | bool operator()(const ProgramInfo *a, const ProgramInfo *b) |
| 314 | { |
| 315 | if (m_reverse) |
| 316 | return (a->startts > b->startts); |
| 317 | else |
| 318 | return (a->startts < b->startts); |
| 319 | } |
| 320 | |
| 321 | private: |
| 322 | bool m_reverse; |
| 323 | }; |
| 324 | |
| 325 | |
257 | 326 | void ViewScheduled::FillList(void) |
258 | 327 | { |
259 | 328 | inFill = true; |
… |
… |
|
303 | 372 | } |
304 | 373 | } |
305 | 374 | |
| 375 | if (recList.count() > 0) { |
| 376 | // Sort the list |
| 377 | ProgramInfo *s = recList.first(); |
| 378 | vector<ProgramInfo *> sortedList; |
| 379 | while (recList.count()) |
| 380 | { |
| 381 | s = recList.take(); |
| 382 | s->sortTitle = s->title; |
| 383 | s->sortTitle.remove(QRegExp("^(The |A |An )")); |
| 384 | sortedList.push_back(s); |
| 385 | } |
| 386 | |
| 387 | if (viewList[curView] == "reverse time") |
| 388 | sort(sortedList.begin(), sortedList.end(), pbTimeSort(true)); |
| 389 | else if (viewList[curView] == "sort by time") |
| 390 | sort(sortedList.begin(), sortedList.end(), pbTimeSort(false)); |
| 391 | else if (viewList[curView] == "reverse title") |
| 392 | sort(sortedList.begin(), sortedList.end(), pbTitleSort(true)); |
| 393 | else |
| 394 | sort(sortedList.begin(), sortedList.end(), pbTitleSort(false)); |
| 395 | |
| 396 | vector<ProgramInfo *>::iterator i = sortedList.begin(); |
| 397 | for (; i != sortedList.end(); i++) |
| 398 | recList.append(*i); |
| 399 | } |
| 400 | |
306 | 401 | if (!callsign.isNull()) |
307 | 402 | { |
308 | 403 | listPos = recList.count() - 1; |
… |
… |
|
520 | 615 | UITextType *type = (UITextType *)container->GetType("showlevel"); |
521 | 616 | if (type) |
522 | 617 | { |
| 618 | QString newtag; |
| 619 | |
| 620 | if (viewList[curView] == "sort by time") |
| 621 | newtag += "+Time"; |
| 622 | else if (viewList[curView] == "reverse time") |
| 623 | newtag += "-Time"; |
| 624 | else if (viewList[curView] == "sort by title") |
| 625 | newtag += "+Title"; |
| 626 | else if (viewList[curView] == "reverse title") |
| 627 | newtag += "-Title"; |
| 628 | |
523 | 629 | if (showAll) |
524 | | type->SetText(tr("All")); |
| 630 | newtag += " All"; |
525 | 631 | else |
526 | | type->SetText(tr("Important")); |
| 632 | newtag += " Important"; |
| 633 | |
| 634 | |
| 635 | type->SetText(tr(newtag)); |
527 | 636 | } |
528 | 637 | } |
529 | 638 | |
… |
… |
|
676 | 785 | p->showDetails(); |
677 | 786 | } |
678 | 787 | |
| 788 | void ViewScheduled::fillViewList(const QString &view) |
| 789 | { |
| 790 | viewList.clear(); |
| 791 | viewTextList.clear(); |
| 792 | |
| 793 | viewList << "sort by time"; |
| 794 | viewTextList << tr("Sort by Time"); |
| 795 | |
| 796 | viewList << "reverse time"; |
| 797 | viewTextList << tr("Reverse Time"); |
| 798 | |
| 799 | viewList << "sort by title"; |
| 800 | viewTextList << tr("Sort by Title"); |
| 801 | |
| 802 | viewList << "reverse title"; |
| 803 | viewTextList << tr("Reverse Title"); |
| 804 | |
| 805 | curView = viewList.findIndex(view); |
| 806 | |
| 807 | if (curView < 0) |
| 808 | curView = 0; |
| 809 | } |
| 810 | |
679 | 811 | void ViewScheduled::selected() |
680 | 812 | { |
681 | 813 | ProgramInfo *p = recList[listPos]; |
diff -r -u -X diff.exclude myth.13871.0712a/mythtv/programs/mythfrontend/viewscheduled.h myth.13871.0712b/mythtv/programs/mythfrontend/viewscheduled.h
|
|
|
70 | 70 | int listsize; |
71 | 71 | |
72 | 72 | bool showAll; |
| 73 | int curView; |
| 74 | QStringList viewList; |
| 75 | QStringList viewTextList; |
| 76 | |
| 77 | MythPopupBox *choosePopup; |
| 78 | MythListBox *chooseListBox; |
| 79 | void fillViewList(const QString &view); |
| 80 | |
| 81 | |
73 | 82 | |
74 | 83 | bool inEvent; |
75 | 84 | bool inFill; |