Ticket #2613: list_genre.diff

File list_genre.diff, 5.1 KB (added by kkuphal, 18 years ago)
  • mythtv/themes/DVR/tv_lists.xml

     
    5656      <text lang="RU">КатегПрОО</text>
    5757      <action>TV_SEARCH_CATEGORY</action>
    5858   </button>
     59
     60   <button>
     61      <type>TV_SEARCH_CATEGORIES</type>
     62      <text>Genres</text>
     63      <action>TV_SEARCH_GENRE</action>
     64   </button>
    5965   
    6066   <button>
    6167      <type>TV_SEARCH_CHANNELS</type>
  • mythtv/libs/libmythtv/proglist.h

     
    2121    plCategory,
    2222    plChannel,
    2323    plTime,
    24     plRecordid
     24    plRecordid,
     25    plGenre
    2526};
    2627
    2728
  • mythtv/libs/libmythtv/proglist.cpp

     
    286286                case plChannel: value = tr("Channel Search"); break;
    287287                case plMovies: value = tr("Movie Search"); break;
    288288                case plTime: value = tr("Time Search"); break;
     289                case plGenre: value = tr("Genre Search"); break;
    289290                default: value = tr("Unknown Search"); break;
    290291            }
    291292            ltype->SetText(value);
     
    674675void ProgLister::chooseView(void)
    675676{
    676677    if (type == plChannel || type == plCategory ||
    677         type == plMovies || type == plNewListings)
     678        type == plMovies || type == plNewListings ||
     679        type == plGenre)
    678680    {
    679681        if (viewList.count() < 2)
    680682            return;
     
    688690            case plChannel: msg = tr("Select Channel"); break;
    689691            case plCategory: msg = tr("Select Category"); break;
    690692            case plNewListings: msg = tr("Select List"); break;
     693            case plGenre: msg = tr("Select Genre"); break;
    691694            default: msg = tr("Select"); break;
    692695        }
    693696        choosePopup->addLabel(msg);
     
    12321235        if (view != "")
    12331236            curView = viewList.findIndex(view);
    12341237    }
     1238    else if (type == plGenre) // list by genre
     1239    {
     1240        MSqlQuery query(MSqlQuery::InitCon());
     1241        query.prepare("SELECT genre FROM programgenres GROUP BY genre;");
     1242        query.exec();
     1243
     1244        if (query.isActive() && query.size())
     1245        {
     1246            while (query.next())
     1247            {
     1248                QString genre = query.value(0).toString();
     1249                if (genre <= " " || genre == NULL)
     1250                    continue;
     1251                genre = QString::fromUtf8(query.value(0).toString());
     1252                viewList << genre;
     1253                viewTextList << genre;
     1254            }
     1255        }
     1256        if (view != "")
     1257            curView = viewList.findIndex(view);
     1258    }
    12351259    else if (type == plTitleSearch || type == plKeywordSearch ||
    12361260             type == plPeopleSearch || type == plPowerSearch)
    12371261    {
     
    15181542                "  AND program.endtime > :PGILSTART "
    15191543                "  AND program.category = :PGILPHRASE ";
    15201544    }
     1545    else if (type == plGenre) // list by category
     1546    {
     1547        where = "LEFT JOIN programgenres ON "
     1548                "  programgenres.chanid = program.chanid AND "
     1549                "  programgenres.starttime = program.starttime "
     1550                "WHERE channel.visible = 1 "
     1551                "  AND program.endtime > :PGILSTART "
     1552                "  AND programgenres.genre = :PGILPHRASE ";
     1553    }
    15211554    else if (type == plMovies) // list movies
    15221555    {
    15231556        where = "WHERE channel.visible = 1 "
  • mythtv/programs/mythfrontend/main.cpp

     
    130130    qApp->lock();
    131131}
    132132
     133void startSearchGenre(void)
     134{
     135    ProgLister searchGenre(plGenre, "", "",
     136                            gContext->GetMainWindow(), "proglist");
     137
     138    qApp->unlock();
     139    searchGenre.exec();
     140    qApp->lock();
     141}
     142
    133143void startSearchMovie(void)
    134144{
    135145    ProgLister searchMovie(plMovies, "", "",
     
    317327        startSearchChannel();
    318328    else if (sel == "tv_search_category")
    319329        startSearchCategory();
     330    else if (sel == "tv_search_genre")
     331        startSearchGenre();
    320332    else if (sel == "tv_search_movie")
    321333        startSearchMovie();
    322334    else if (sel == "tv_search_new")
  • mythtv/programs/mythfrontend/tv_lists.xml

     
    6666      <text lang="RU">КатегПрОО</text>
    6767      <action>TV_SEARCH_CATEGORY</action>
    6868   </button>
     69
     70   <button>
     71      <type>TV_SEARCH_GENRES</type>
     72      <text>Genres</text>
     73      <action>TV_SEARCH_GENRE</action>
     74   </button>
    6975   
    7076   <button>
    7177      <type>TV_SEARCH_CHANNELS</type>