Ticket #3888: mythflixqueue.cpp.diff

File mythflixqueue.cpp.diff, 2.1 KB (added by Britney Fransen <britney.fransen@…>, 17 years ago)
  • .cpp

    old new  
    245245                ttype =
    246246                    (UITextType *)container->GetType("description");
    247247                if (ttype)
    248                     ttype->SetText(article->description());
     248                // removes html tags
     249                {
     250                    QString artText = article->description();
     251                    // Replace paragraph and break HTML with newlines
     252                    if( artText.find(QRegExp("</(p|P)>")) )
     253                    {
     254                        artText.replace( QRegExp("<(p|P)>"), "");
     255                        artText.replace( QRegExp("</(p|P)>"), "\n\n");
     256                    }
     257                    else
     258                    {
     259                        artText.replace( QRegExp("<(p|P)>"), "\n\n");
     260                        artText.replace( QRegExp("</(p|P)>"), "");
     261                    }                       
     262                    artText.replace( QRegExp("<(br|BR|)/>"), "\n");
     263                    artText.replace( QRegExp("<(br|BR|)>"), "\n");
     264                    // These are done instead of simplifyWhitespace
     265                    // because that function also strips out newlines
     266                    // Replace tab characters with nothing
     267                    artText.replace( QRegExp("\t"), "");
     268                    // Replace double space with single
     269                    artText.replace( QRegExp("  "), "");
     270                    // Replace whitespace at beginning of lines with newline
     271                    artText.replace( QRegExp("\n "), "\n");
     272                    // Remove any remaining HTML tags
     273                    QRegExp removeHTML(QRegExp("</?.+>"));
     274                    removeHTML.setMinimal(true);
     275                    artText.remove((const QRegExp&) removeHTML);
     276                    artText = artText.stripWhiteSpace();
     277                    ttype->SetText(artText);
     278                }                       
    249279
    250280                QString imageLoc = article->articleURL();
    251281                int index = imageLoc.find("movieid=");