Ticket #4765: CategoryOverTime-list.patch

File CategoryOverTime-list.patch, 1.5 KB (added by jppoet@…, 16 years ago)

Patch category over-time to list categories.

  • programs/mythfrontend/globalsettings.cpp

     
    770770    return bs;
    771771}
    772772
    773 static GlobalLineEdit *OverTimeCategory()
     773static GlobalComboBox *OverTimeCategory()
    774774{
    775     GlobalLineEdit *ge = new GlobalLineEdit("OverTimeCategory");
    776     ge->setLabel(QObject::tr("Category of shows to be extended"));
    777     ge->setValue(QObject::tr("category name"));
    778     ge->setHelpText(QObject::tr("For a specific category (e.g. "
     775    GlobalComboBox *gc = new GlobalComboBox("OverTimeCategory");
     776    gc->setLabel(QObject::tr("Category of shows to be extended"));
     777    gc->setHelpText(QObject::tr("For a special category (e.g. "
    779778                    "\"Sports event\"), request that shows be autoextended. "
    780779                    "Only works if a show's category can be determined."));
    781     return ge;
     780
     781    MSqlQuery query(MSqlQuery::InitCon());
     782    query.prepare("SELECT DISTINCT category FROM program GROUP BY category;");
     783
     784    gc->addSelection("category name", "category name");
     785    if (query.exec() && query.isActive() && query.size() > 0)
     786    {
     787        while (query.next())
     788        {
     789            QString key = QString::fromUtf8(query.value(0).toString());
     790            if (!key.stripWhiteSpace().isEmpty())
     791                gc->addSelection(key, key);
     792        }
     793    }
     794
     795    return gc;
    782796}
    783797
    784798static GlobalSpinBox *CategoryOverTime()