Ticket #1083: prevep-sort.diff
File prevep-sort.diff, 2.7 KB (added by , 18 years ago) |
---|
-
libs/libmythtv/previouslist.cpp
170 170 171 171 refillAll = true; 172 172 } 173 else if (action == "3") 174 { 175 if (viewList[curView] == "sort by programid") 176 curView = viewList.findIndex("reverse programid"); 177 else 178 curView = viewList.findIndex("sort by programid"); 179 180 refillAll = true; 181 } 173 182 else 174 183 handled = false; 175 184 } … … 416 425 viewList << "reverse title"; 417 426 viewTextList << tr("Reverse Title"); 418 427 428 viewList << "sort by programid"; 429 viewTextList << tr("Sort by Program ID"); 430 431 viewList << "reverse programid"; 432 viewTextList << tr("Reverse Program ID"); 433 419 434 curView = viewList.findIndex(view); 420 435 421 436 if (curView < 0) 422 437 curView = 0; 423 438 } 424 439 440 class pbProgramIDSort 441 { 442 public: 443 pbProgramIDSort(bool reverseSort = false) {m_reverse = reverseSort;} 444 445 bool operator()(const ProgramInfo *a, const ProgramInfo *b) 446 { 447 if (a->programid == b->programid) 448 { 449 if (a->title == b->title) 450 return (a->startts < b->startts); 451 else 452 return (a->title < b->title); 453 } 454 else if (m_reverse) 455 return (a->programid > b->programid); 456 else 457 return (a->programid < b->programid); 458 } 459 460 private: 461 bool m_reverse; 462 }; 463 425 464 class pbTitleSort 426 465 { 427 466 public: … … 431 470 { 432 471 if (a->sortTitle == b->sortTitle) 433 472 { 473 if (a->subtitle != b->subtitle) 474 { 475 if (m_reverse) 476 return a->subtitle < b->subtitle; 477 else 478 return a->subtitle > b->subtitle; 479 } 434 480 if (a->programid == b->programid) 435 481 return (a->startts < b->startts); 436 482 else … … 497 556 sort(sortedList.begin(), sortedList.end(), pbTimeSort(true)); 498 557 else if (viewList[curView] == "sort by time") 499 558 sort(sortedList.begin(), sortedList.end(), pbTimeSort(false)); 559 else if (viewList[curView] == "reverse programid") 560 sort(sortedList.begin(), sortedList.end(), pbProgramIDSort(true)); 561 else if (viewList[curView] == "sort by programid") 562 sort(sortedList.begin(), sortedList.end(), pbProgramIDSort(false)); 500 563 else if (viewList[curView] == "reverse title") 501 564 sort(sortedList.begin(), sortedList.end(), pbTitleSort(true)); 502 565 else