From 0254ebaa5e056092461fd585b6851d15faa43035 Mon Sep 17 00:00:00 2001 From: tpearson Date: Wed, 10 Aug 2011 06:08:18 +0000 Subject: rename the following methods: tqfind find tqreplace replace tqcontains contains git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/tellico@1246075 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- src/fetch/imdbfetcher.cpp | 112 +++++++++++++++++++++++----------------------- 1 file changed, 56 insertions(+), 56 deletions(-) (limited to 'src/fetch/imdbfetcher.cpp') diff --git a/src/fetch/imdbfetcher.cpp b/src/fetch/imdbfetcher.cpp index d70429f..682ae1f 100644 --- a/src/fetch/imdbfetcher.cpp +++ b/src/fetch/imdbfetcher.cpp @@ -140,7 +140,7 @@ void IMDBFetcher::search(FetchKey key_, const TQString& value_) { m_url = KURL(); m_url.setProtocol(TQString::tqfromLatin1("http")); m_url.setHost(m_host.isEmpty() ? TQString::tqfromLatin1(IMDB_SERVER) : m_host); - m_url.setPath(TQString::tqfromLatin1("/tqfind")); + m_url.setPath(TQString::tqfromLatin1("/find")); switch(key_) { case Title: @@ -263,7 +263,7 @@ void IMDBFetcher::parseSingleTitleResult() { s_titleRx->search(Tellico::decodeHTML(TQString(m_data))); // split title at parenthesis const TQString cap1 = s_titleRx->cap(1); - int pPos = cap1.tqfind('('); + int pPos = cap1.find('('); // FIXME: maybe remove parentheses here? SearchResult* r = new SearchResult(this, pPos == -1 ? cap1 : cap1.left(pPos), @@ -282,9 +282,9 @@ void IMDBFetcher::parseMultipleTitleResults() { // IMDb can return three title lists, popular, exact, and partial // the popular titles are in the first table, after the "Popular Results" text - int pos_popular = output.tqfind(TQString::tqfromLatin1("Popular Titles"), 0, false); - int pos_exact = output.tqfind(TQString::tqfromLatin1("Exact Matches"), TQMAX(pos_popular, 0), false); - int pos_partial = output.tqfind(TQString::tqfromLatin1("Partial Matches"), TQMAX(pos_exact, 0), false); + int pos_popular = output.find(TQString::tqfromLatin1("Popular Titles"), 0, false); + int pos_exact = output.find(TQString::tqfromLatin1("Exact Matches"), TQMAX(pos_popular, 0), false); + int pos_partial = output.find(TQString::tqfromLatin1("Partial Matches"), TQMAX(pos_exact, 0), false); int end_popular = pos_exact; // keep track of where to end if(end_popular == -1) { end_popular = pos_partial == -1 ? output.length() : pos_partial; @@ -348,10 +348,10 @@ void IMDBFetcher::parseTitleBlock(const TQString& str_) { const TQString cap1 = s_anchorTitleRx->cap(1); // the anchor url const TQString cap2 = s_anchorTitleRx->cap(2).stripWhiteSpace(); // the anchor text start += s_anchorTitleRx->matchedLength(); - int pPos = cap2.tqfind('('); // if it has parentheses, use that for description + int pPos = cap2.find('('); // if it has parentheses, use that for description TQString desc; if(pPos > -1) { - int pPos2 = cap2.tqfind(')', pPos+1); + int pPos2 = cap2.find(')', pPos+1); if(pPos2 > -1) { desc = cap2.mid(pPos+1, pPos2-pPos-1); } @@ -362,11 +362,11 @@ void IMDBFetcher::parseTitleBlock(const TQString& str_) { end = str_.length(); } TQString text = str_.mid(start, end-start); - pPos = text.tqfind('('); + pPos = text.find('('); if(pPos > -1) { - int pNewLine = text.tqfind(TQString::tqfromLatin1("cap(0).length(); // split title at parenthesis const TQString cap2 = s_anchorTitleRx->cap(2).stripWhiteSpace(); - int pPos = cap2.tqfind('('); + int pPos = cap2.find('('); if(pPos > -1) { desc = cap2.mid(pPos); } else { // look until the next -1) { + if(tmp.find(tvRegExp) > -1) { isEpisode = true; } - pPos = tmp.tqfind('('); + pPos = tmp.find('('); if(pPos > -1) { - int pNewLine = tmp.tqfind(TQString::tqfromLatin1("cap(1)); s = s_anchorNameRx->cap(2).stripWhiteSpace() + ' '; // if more than one exact, add parentheses - if(nameMap.tqcontains(s) && nameMap[s] > 0) { + if(nameMap.contains(s) && nameMap[s] > 0) { // fix the first one that didn't have a number if(nameMap[s] == 1) { KURL u2 = map[s]; @@ -552,7 +552,7 @@ void IMDBFetcher::parseMultipleNameResults() { while(pos > -1 && m_matches.size() < m_limit) { KURL u(m_url, s_anchorNameRx->cap(1)); // relative URL s = s_anchorNameRx->cap(2).stripWhiteSpace(); - if(nameMap.tqcontains(s) && nameMap[s] > 0) { + if(nameMap.contains(s) && nameMap[s] > 0) { // fix the first one that didn't have a number if(nameMap[s] == 1) { KURL u2 = map[s]; @@ -685,7 +685,7 @@ Tellico::Data::EntryPtr IMDBFetcher::parseEntry(const TQString& str_) { } const TQString imdb = TQString::tqfromLatin1("imdb"); - if(!coll->hasField(imdb) && m_fields.tqfindIndex(imdb) > -1) { + if(!coll->hasField(imdb) && m_fields.findIndex(imdb) > -1) { Data::FieldPtr field = new Data::Field(imdb, i18n("IMDB Link"), Data::Field::URL); field->setCategory(i18n("General")); coll->addField(field); @@ -701,7 +701,7 @@ void IMDBFetcher::doTitle(const TQString& str_, Data::EntryPtr entry_) { if(s_titleRx->search(str_) > -1) { const TQString cap1 = s_titleRx->cap(1); // titles always have parentheses - int pPos = cap1.tqfind('('); + int pPos = cap1.find('('); TQString title = cap1.left(pPos).stripWhiteSpace(); // remove first and last quotes is there if(title.startsWith(TQChar('"')) && title.endsWith(TQChar('"'))) { @@ -742,7 +742,7 @@ void IMDBFetcher::doAspectRatio(const TQString& str_, Data::EntryPtr entry_) { } void IMDBFetcher::doAlsoKnownAs(const TQString& str_, Data::EntryPtr entry_) { - if(m_fields.tqfindIndex(TQString::tqfromLatin1("alttitle")) == -1) { + if(m_fields.findIndex(TQString::tqfromLatin1("alttitle")) == -1) { return; } @@ -770,7 +770,7 @@ void IMDBFetcher::doAlsoKnownAs(const TQString& str_, Data::EntryPtr entry_) { for(TQStringList::Iterator it = list.begin(); it != list.end(); ++it) { TQString s = *it; // sometimes, the word "more" gets linked to the releaseinfo page, check that - if(s.tqfind(TQString::tqfromLatin1("releaseinfo")) > -1) { + if(s.find(TQString::tqfromLatin1("releaseinfo")) > -1) { continue; } s.remove(*s_tagRx); @@ -807,7 +807,7 @@ void IMDBFetcher::doPlot(const TQString& str_, Data::EntryPtr entry_, const KURL thisPlot = plotRx.cap(1); thisPlot.remove(*s_tagRx); // remove HTML tags entry_->setField(TQString::tqfromLatin1("plot"), thisPlot); - // if thisPlot ends with (more) or tqcontains + // if thisPlot ends with (more) or contains // a url that ends with plotsummary, then we'll grab it, otherwise not if(plotRx.cap(0).endsWith(TQString::tqfromLatin1("(more) -1) { useUserSummary = true; @@ -843,14 +843,14 @@ void IMDBFetcher::doPerson(const TQString& str_, Data::EntryPtr entry_, TQString name = TQString::tqfromLatin1("/name/"); StringSet people; - for(int pos = str_.tqfind(imdbHeader_); pos > 0; pos = str_.tqfind(imdbHeader_, pos)) { + for(int pos = str_.find(imdbHeader_); pos > 0; pos = str_.find(imdbHeader_, pos)) { // loop until repeated
tags or tag - const int endPos1 = str_.tqfind(br2Rx, pos); - const int endPos2 = str_.tqfind(divRx, pos); + const int endPos1 = str_.find(br2Rx, pos); + const int endPos2 = str_.find(divRx, pos); const int endPos = TQMIN(endPos1, endPos2); // ok to be -1 pos = s_anchorRx->search(str_, pos+1); while(pos > -1 && pos < endPos) { - if(s_anchorRx->cap(1).tqfind(name) > -1) { + if(s_anchorRx->cap(1).find(name) > -1) { people.add(s_anchorRx->cap(2).stripWhiteSpace()); } pos = s_anchorRx->search(str_, pos+1); @@ -883,28 +883,28 @@ void IMDBFetcher::doCast(const TQString& str_, Data::EntryPtr entry_, const KURL if(castText.isEmpty()) { // fall back to short list castText = str_; - pos = castText.tqfind(TQString::tqfromLatin1("cast overview"), 0, false); + pos = castText.find(TQString::tqfromLatin1("cast overview"), 0, false); if(pos == -1) { - pos = castText.tqfind(TQString::tqfromLatin1("credited cast"), 0, false); + pos = castText.find(TQString::tqfromLatin1("credited cast"), 0, false); } } else { // first look for anchor TQRegExp castAnchorRx(TQString::tqfromLatin1(" 9) { // back up 9 places if(castText.mid(pos-9, 9).startsWith(TQString::tqfromLatin1("episodes"))) { // find next cast list - pos = castText.tqfind(TQString::tqfromLatin1("castsearch(castText, pos+1); while(pos > -1 && pos < endPos && static_cast(cast.count()) < m_numCast) { - if(s_anchorRx->cap(1).tqfind(name) > -1) { + if(s_anchorRx->cap(1).find(name) > -1) { // now search for item with character name // there's a column with ellipses then the character const int pos2 = tdRx.search(castText, pos); @@ -944,7 +944,7 @@ void IMDBFetcher::doCast(const TQString& str_, Data::EntryPtr entry_, const KURL } void IMDBFetcher::doRating(const TQString& str_, Data::EntryPtr entry_) { - if(m_fields.tqfindIndex(TQString::tqfromLatin1("imdb-rating")) == -1) { + if(m_fields.findIndex(TQString::tqfromLatin1("imdb-rating")) == -1) { return; } @@ -996,7 +996,7 @@ void IMDBFetcher::doCover(const TQString& str_, Data::EntryPtr entry_, const KUR // didn't find the cover, IMDb also used to put "cover" inside the url pos = imgRx.search(str_); while(pos > -1) { - if(imgRx.cap(0).tqfind(cover, 0, false) > -1) { + if(imgRx.cap(0).find(cover, 0, false) > -1) { KURL u(baseURL_, imgRx.cap(1)); TQString id = ImageFactory::addImage(u, true); if(!id.isEmpty()) { @@ -1026,28 +1026,28 @@ void IMDBFetcher::doLists(const TQString& str_, Data::EntryPtr entry_) { TQStringList genres, countries, langs, certs, tracks, studios; for(int pos = s_anchorRx->search(str_); pos > -1; pos = s_anchorRx->search(str_, pos+1)) { const TQString cap1 = s_anchorRx->cap(1); - if(cap1.tqfind(genre) > -1) { - if(s_anchorRx->cap(2).tqfind(TQString::tqfromLatin1(" section"), 0, false) == -1) { + if(cap1.find(genre) > -1) { + if(s_anchorRx->cap(2).find(TQString::tqfromLatin1(" section"), 0, false) == -1) { genres += s_anchorRx->cap(2).stripWhiteSpace(); } - } else if(cap1.tqfind(country) > -1) { - if(s_anchorRx->cap(2).tqfind(TQString::tqfromLatin1(" section"), 0, false) == -1) { + } else if(cap1.find(country) > -1) { + if(s_anchorRx->cap(2).find(TQString::tqfromLatin1(" section"), 0, false) == -1) { countries += s_anchorRx->cap(2).stripWhiteSpace(); } - } else if(cap1.tqfind(lang) > -1) { + } else if(cap1.find(lang) > -1) { langs += s_anchorRx->cap(2).stripWhiteSpace(); - } else if(cap1.tqfind(colorInfo) > -1) { + } else if(cap1.find(colorInfo) > -1) { // change "black and white" to "black & white" entry_->setField(TQString::tqfromLatin1("color"), - s_anchorRx->cap(2).tqreplace(TQString::tqfromLatin1("and"), TQChar('&')).stripWhiteSpace()); - } else if(cap1.tqfind(cert) > -1) { + s_anchorRx->cap(2).replace(TQString::tqfromLatin1("and"), TQChar('&')).stripWhiteSpace()); + } else if(cap1.find(cert) > -1) { certs += s_anchorRx->cap(2).stripWhiteSpace(); - } else if(cap1.tqfind(soundMix) > -1) { + } else if(cap1.find(soundMix) > -1) { tracks += s_anchorRx->cap(2).stripWhiteSpace(); - } else if(cap1.tqfind(company) > -1) { + } else if(cap1.find(company) > -1) { studios += s_anchorRx->cap(2).stripWhiteSpace(); // if year field wasn't set before, do it now - } else if(entry_->field(TQString::tqfromLatin1("year")).isEmpty() && cap1.tqfind(year) > -1) { + } else if(entry_->field(TQString::tqfromLatin1("year")).isEmpty() && cap1.find(year) > -1) { entry_->setField(TQString::tqfromLatin1("year"), s_anchorRx->cap(2).stripWhiteSpace()); } } @@ -1067,7 +1067,7 @@ void IMDBFetcher::doLists(const TQString& str_, Data::EntryPtr entry_) { cert = TQChar('U'); } cert += TQString::tqfromLatin1(" (") + country + ')'; - if(certsAllowed.tqfindIndex(cert) > -1) { + if(certsAllowed.findIndex(cert) > -1) { entry_->setField(TQString::tqfromLatin1("certification"), cert); break; } @@ -1075,7 +1075,7 @@ void IMDBFetcher::doLists(const TQString& str_, Data::EntryPtr entry_) { // now add new field for all certifications const TQString allc = TQString::tqfromLatin1("allcertification"); - if(m_fields.tqfindIndex(allc) > -1) { + if(m_fields.findIndex(allc) > -1) { Data::FieldPtr f = entry_->collection()->fieldByName(allc); if(!f) { f = new Data::Field(allc, i18n("Certifications"), Data::Field::Table); -- cgit v1.2.1