Ticket #1082: prevep-title.diff

File prevep-title.diff, 1.7 KB (added by mythtv@…, 20 years ago)

proposed patch (side effect: removes unused schedList)

  • libs/libmythtv/previouslist.h

     
    5858    QStringList viewTextList;
    5959
    6060    int curItem;
     61    bool titleMatch; ///< do all the matches have the same title?
    6162    ProgramList itemList;
    62     ProgramList schedList;
    6363
    6464    XMLParse *theme;
    6565    QDomElement xmldata;
  • libs/libmythtv/previouslist.cpp

     
    485518    itemList.FromOldRecorded(sql, bindings);
    486519
    487520    vector<ProgramInfo *> sortedList;
     521
     522    if (itemList.count() <= 1) titleMatch = false;
     523    else {
     524        titleMatch = true;
     525        ProgramList::iterator j = itemList.begin();
     526        QString commonTitle = (*j)->title;
     527        while (titleMatch && j != itemList.end()) {
     528            if (commonTitle != (*j)->title) titleMatch = false;
     529            j++;
     530        }
     531    }
     532
    488533    while (itemList.count())
    489534    {
    490535        s = itemList.take();
    491         s->sortTitle = s->title;
     536        if (titleMatch) s->sortTitle = s->title;
     537        else s->sortTitle = s->subtitle;
    492538        s->sortTitle.remove(QRegExp("^(The |A |An )"));
    493539        sortedList.push_back(s);
    494540    }
     
    580630
    581631                if (pi->subtitle == "")
    582632                    tmptitle = pi->title;
     633                else if (titleMatch)
     634                    tmptitle = pi->subtitle;
    583635                else
    584636                {
    585637                     tmptitle = QString("%1 - \"%2\"")