Ticket #2611: strip_html_tags_from_text_subtitles.patch

File strip_html_tags_from_text_subtitles.patch, 1.2 KB (added by Pekka Jääskeläinen <pekka.jaaskelainen@…>, 14 years ago)

the patch

  • libs/libmythtv/osd.cpp

    * Strip HTML-tags from the external text file subtitles.
    
    Properly supporting showing subtitles with HTML-tags would 
    require a "rich text" widget of some kind, for example,
    through wrapping the QSimpleRichText widget in the OSDType 
    interface. I might do that as soon as I figure out the 
    easiest way to draw a Qt widget on MythTV OSDSurface.
    
    old new  
    312312    QStringList::const_iterator it = lines.begin();
    313313    for (; it != lines.end(); ++it)
    314314    {
    315         const QString line = *it;
     315        QString line = *it;
     316
     317        // Strip HTML-tags from the subtitle.         
     318        // Properly supporting showing subtitles with HTML-tags would
     319        // require a "rich text" widget of some kind, for example,
     320        // through wrapping the QSimpleRichText widget in the OSDType
     321        // interface. --PJ
     322        QRegExp htmlTagRE = QRegExp("</?.+>");
     323        htmlTagRE.setMinimal(true);
     324        line.replace(htmlTagRE, "");
    316325
    317326        if (line.length() <= MAX_CHARACTERS_PER_ROW)
    318327        {