diff options
author | Timothy Pearson <[email protected]> | 2011-12-16 09:57:51 -0600 |
---|---|---|
committer | Timothy Pearson <[email protected]> | 2011-12-16 09:57:51 -0600 |
commit | 2781e27b871150395a5a82e221684108641002b2 (patch) | |
tree | 57f4d7c01a48faef1a840fbe0de8f4ec1e5f606f /src/fetch/animenfofetcher.cpp | |
parent | 031454e56009d576589c28757f6c6fcf4884095e (diff) | |
download | tellico-2781e27b871150395a5a82e221684108641002b2.tar.gz tellico-2781e27b871150395a5a82e221684108641002b2.zip |
Revert "Rename a number of old tq methods that are no longer tq specific"
This reverts commit 031454e56009d576589c28757f6c6fcf4884095e.
Diffstat (limited to 'src/fetch/animenfofetcher.cpp')
-rw-r--r-- | src/fetch/animenfofetcher.cpp | 86 |
1 files changed, 43 insertions, 43 deletions
diff --git a/src/fetch/animenfofetcher.cpp b/src/fetch/animenfofetcher.cpp index bd4460c..8a938a4 100644 --- a/src/fetch/animenfofetcher.cpp +++ b/src/fetch/animenfofetcher.cpp @@ -27,7 +27,7 @@ #include <kio/job.h> #include <tqregexp.h> -#include <layout.h> +#include <tqlayout.h> #include <tqlabel.h> #include <tqfile.h> @@ -44,7 +44,7 @@ AnimeNfoFetcher::AnimeNfoFetcher(TQObject* parent_, const char* name_ /*=0*/) } TQString AnimeNfoFetcher::defaultName() { - return TQString::fromLatin1("AnimeNfo.com"); + return TQString::tqfromLatin1("AnimeNfo.com"); } TQString AnimeNfoFetcher::source() const { @@ -64,22 +64,22 @@ void AnimeNfoFetcher::search(FetchKey key_, const TQString& value_) { m_matches.clear(); #ifdef ANIMENFO_TEST - KURL u = KURL::fromPathOrURL(TQString::fromLatin1("/home/robby/animenfo.html")); + KURL u = KURL::fromPathOrURL(TQString::tqfromLatin1("/home/robby/animenfo.html")); #else - KURL u(TQString::fromLatin1(ANIMENFO_BASE_URL)); - u.addQueryItem(TQString::fromLatin1("action"), TQString::fromLatin1("Go")); - u.addQueryItem(TQString::fromLatin1("option"), TQString::fromLatin1("keywords")); - u.addQueryItem(TQString::fromLatin1("queryin"), TQString::fromLatin1("anime_titles")); + KURL u(TQString::tqfromLatin1(ANIMENFO_BASE_URL)); + u.addQueryItem(TQString::tqfromLatin1("action"), TQString::tqfromLatin1("Go")); + u.addQueryItem(TQString::tqfromLatin1("option"), TQString::tqfromLatin1("keywords")); + u.addQueryItem(TQString::tqfromLatin1("queryin"), TQString::tqfromLatin1("anime_titles")); if(!canFetch(Kernel::self()->collectionType())) { - message(i18n("%1 does not allow searching for this collection type.").arg(source()), MessageHandler::Warning); + message(i18n("%1 does not allow searching for this collection type.").tqarg(source()), MessageHandler::Warning); stop(); return; } switch(key_) { case Keyword: - u.addQueryItem(TQString::fromLatin1("query"), value_); + u.addQueryItem(TQString::tqfromLatin1("query"), value_); break; default: @@ -135,11 +135,11 @@ void AnimeNfoFetcher::slotComplete(KIO::Job* job_) { TQString s = Tellico::decodeHTML(TQString(m_data)); - TQRegExp infoRx(TQString::fromLatin1("<td\\s+[^>]*class\\s*=\\s*[\"']anime_info[\"'][^>]*>(.*)</td>"), false); + TQRegExp infoRx(TQString::tqfromLatin1("<td\\s+[^>]*class\\s*=\\s*[\"']anime_info[\"'][^>]*>(.*)</td>"), false); infoRx.setMinimal(true); - TQRegExp anchorRx(TQString::fromLatin1("<a\\s+[^>]*href\\s*=\\s*[\"'](.*)[\"'][^>]*>(.*)</a>"), false); + TQRegExp anchorRx(TQString::tqfromLatin1("<a\\s+[^>]*href\\s*=\\s*[\"'](.*)[\"'][^>]*>(.*)</a>"), false); anchorRx.setMinimal(true); - TQRegExp yearRx(TQString::fromLatin1("\\d{4}"), false); + TQRegExp yearRx(TQString::tqfromLatin1("\\d{4}"), false); // search page comes in groups of threes int n = 0; @@ -151,9 +151,9 @@ void AnimeNfoFetcher::slotComplete(KIO::Job* job_) { emit signalResultFound(r); #ifdef ANIMENFO_TEST - KURL url = KURL::fromPathOrURL(TQString::fromLatin1("/home/robby/animetitle.html")); + KURL url = KURL::fromPathOrURL(TQString::tqfromLatin1("/home/robby/animetitle.html")); #else - KURL url(TQString::fromLatin1(ANIMENFO_BASE_URL), u); + KURL url(TQString::tqfromLatin1(ANIMENFO_BASE_URL), u); url.setQuery(TQString()); #endif m_matches.insert(r->uid, url); @@ -189,7 +189,7 @@ void AnimeNfoFetcher::slotComplete(KIO::Job* job_) { if(!u.isEmpty()) { SearchResult* r = new SearchResult(this, t, y, TQString()); emit signalResultFound(r); - KURL url(TQString::fromLatin1(ANIMENFO_BASE_URL), u); + KURL url(TQString::tqfromLatin1(ANIMENFO_BASE_URL), u); url.setQuery(TQString()); m_matches.insert(r->uid, url); } @@ -218,7 +218,7 @@ Tellico::Data::EntryPtr AnimeNfoFetcher::fetchEntry(uint uid_) { #if 0 kdWarning() << "Remove debug from animenfofetcher.cpp" << endl; - TQFile f(TQString::fromLatin1("/tmp/test.html")); + TQFile f(TQString::tqfromLatin1("/tmp/test.html")); if(f.open(IO_WriteOnly)) { TQTextStream t(&f); t.setEncoding(TQTextStream::UnicodeUTF8); @@ -239,13 +239,13 @@ Tellico::Data::EntryPtr AnimeNfoFetcher::fetchEntry(uint uid_) { Tellico::Data::EntryPtr AnimeNfoFetcher::parseEntry(const TQString& str_) { // myDebug() << "AnimeNfoFetcher::parseEntry()" << endl; // class might be anime_info_top - TQRegExp infoRx(TQString::fromLatin1("<td\\s+[^>]*class\\s*=\\s*[\"']anime_info[^>]*>(.*)</td>"), false); + TQRegExp infoRx(TQString::tqfromLatin1("<td\\s+[^>]*class\\s*=\\s*[\"']anime_info[^>]*>(.*)</td>"), false); infoRx.setMinimal(true); - TQRegExp tagRx(TQString::fromLatin1("<.*>")); + TQRegExp tagRx(TQString::tqfromLatin1("<.*>")); tagRx.setMinimal(true); - TQRegExp anchorRx(TQString::fromLatin1("<a\\s+[^>]*href\\s*=\\s*[\"'](.*)[\"'][^>]*>(.*)</a>"), false); + TQRegExp anchorRx(TQString::tqfromLatin1("<a\\s+[^>]*href\\s*=\\s*[\"'](.*)[\"'][^>]*>(.*)</a>"), false); anchorRx.setMinimal(true); - TQRegExp jsRx(TQString::fromLatin1("<script.*</script>"), false); + TQRegExp jsRx(TQString::tqfromLatin1("<script.*</script>"), false); jsRx.setMinimal(true); TQString s = str_; @@ -254,32 +254,32 @@ Tellico::Data::EntryPtr AnimeNfoFetcher::parseEntry(const TQString& str_) { Data::CollPtr coll = new Data::VideoCollection(true); // add new fields - Data::FieldPtr f = new Data::Field(TQString::fromLatin1("origtitle"), i18n("Original Title")); + Data::FieldPtr f = new Data::Field(TQString::tqfromLatin1("origtitle"), i18n("Original Title")); coll->addField(f); - f = new Data::Field(TQString::fromLatin1("alttitle"), i18n("Alternative Titles"), Data::Field::Table); + f = new Data::Field(TQString::tqfromLatin1("alttitle"), i18n("Alternative Titles"), Data::Field::Table); f->setFormatFlag(Data::Field::FormatTitle); coll->addField(f); - f = new Data::Field(TQString::fromLatin1("distributor"), i18n("Distributor")); + f = new Data::Field(TQString::tqfromLatin1("distributor"), i18n("Distributor")); f->setCategory(i18n("Other People")); f->setFlags(Data::Field::AllowCompletion | Data::Field::AllowMultiple | Data::Field::AllowGrouped); f->setFormatFlag(Data::Field::FormatPlain); coll->addField(f); - f = new Data::Field(TQString::fromLatin1("episodes"), i18n("Episodes"), Data::Field::Number); + f = new Data::Field(TQString::tqfromLatin1("episodes"), i18n("Episodes"), Data::Field::Number); f->setCategory(i18n("Features")); coll->addField(f); // map captions in HTML to field names TQMap<TQString, TQString> fieldMap; - fieldMap.insert(TQString::fromLatin1("Title"), TQString::fromLatin1("title")); - fieldMap.insert(TQString::fromLatin1("Japanese Title"), TQString::fromLatin1("origtitle")); - fieldMap.insert(TQString::fromLatin1("Total Episodes"), TQString::fromLatin1("episodes")); - fieldMap.insert(TQString::fromLatin1("Genres"), TQString::fromLatin1("genre")); - fieldMap.insert(TQString::fromLatin1("Year Published"), TQString::fromLatin1("year")); - fieldMap.insert(TQString::fromLatin1("Studio"), TQString::fromLatin1("studio")); - fieldMap.insert(TQString::fromLatin1("US Distribution"), TQString::fromLatin1("distributor")); + fieldMap.insert(TQString::tqfromLatin1("Title"), TQString::tqfromLatin1("title")); + fieldMap.insert(TQString::tqfromLatin1("Japanese Title"), TQString::tqfromLatin1("origtitle")); + fieldMap.insert(TQString::tqfromLatin1("Total Episodes"), TQString::tqfromLatin1("episodes")); + fieldMap.insert(TQString::tqfromLatin1("Genres"), TQString::tqfromLatin1("genre")); + fieldMap.insert(TQString::tqfromLatin1("Year Published"), TQString::tqfromLatin1("year")); + fieldMap.insert(TQString::tqfromLatin1("Studio"), TQString::tqfromLatin1("studio")); + fieldMap.insert(TQString::tqfromLatin1("US Distribution"), TQString::tqfromLatin1("distributor")); Data::EntryPtr entry = new Data::Entry(coll); @@ -292,8 +292,8 @@ Tellico::Data::EntryPtr AnimeNfoFetcher::parseEntry(const TQString& str_) { value = value.simplifyWhiteSpace(); if(value.length() > 2) { // might be "-" if(key == Latin1Literal("Genres")) { - entry->setField(fieldMap[key], TQStringList::split(TQRegExp(TQString::fromLatin1("\\s*,\\s*")), - value).join(TQString::fromLatin1("; "))); + entry->setField(fieldMap[key], TQStringList::split(TQRegExp(TQString::tqfromLatin1("\\s*,\\s*")), + value).join(TQString::tqfromLatin1("; "))); } else { entry->setField(fieldMap[key], value); } @@ -315,44 +315,44 @@ Tellico::Data::EntryPtr AnimeNfoFetcher::parseEntry(const TQString& str_) { } // image - TQRegExp imgRx(TQString::fromLatin1("<img\\s+[^>]*src\\s*=\\s*[\"']([^>]*)[\"']\\s+[^>]*alt\\s*=\\s*[\"']%1[\"']") - .arg(entry->field(TQString::fromLatin1("title"))), false); + TQRegExp imgRx(TQString::tqfromLatin1("<img\\s+[^>]*src\\s*=\\s*[\"']([^>]*)[\"']\\s+[^>]*alt\\s*=\\s*[\"']%1[\"']") + .tqarg(entry->field(TQString::tqfromLatin1("title"))), false); imgRx.setMinimal(true); int pos = imgRx.search(s); if(pos > -1) { - KURL imgURL(TQString::fromLatin1(ANIMENFO_BASE_URL), imgRx.cap(1)); + KURL imgURL(TQString::tqfromLatin1(ANIMENFO_BASE_URL), imgRx.cap(1)); TQString id = ImageFactory::addImage(imgURL, true); if(!id.isEmpty()) { - entry->setField(TQString::fromLatin1("cover"), id); + entry->setField(TQString::tqfromLatin1("cover"), id); } } // now look for alternative titles and plot - const TQString a = TQString::fromLatin1("Alternative titles"); + const TQString a = TQString::tqfromLatin1("Alternative titles"); pos = s.find(a, oldpos+1, false); if(pos > -1) { pos += a.length(); } int pos2 = -1; if(pos > -1) { - pos2 = s.find(TQString::fromLatin1("Description"), pos+1, true); + pos2 = s.find(TQString::tqfromLatin1("Description"), pos+1, true); if(pos2 > -1) { value = s.mid(pos, pos2-pos).remove(tagRx).simplifyWhiteSpace(); - entry->setField(TQString::fromLatin1("alttitle"), value); + entry->setField(TQString::tqfromLatin1("alttitle"), value); } } - TQRegExp descRx(TQString::fromLatin1("class\\s*=\\s*[\"']description[\"'][^>]*>(.*)<"), false); + TQRegExp descRx(TQString::tqfromLatin1("class\\s*=\\s*[\"']description[\"'][^>]*>(.*)<"), false); descRx.setMinimal(true); pos = descRx.search(s, TQMAX(pos, pos2)); if(pos > -1) { - entry->setField(TQString::fromLatin1("plot"), descRx.cap(1).simplifyWhiteSpace()); + entry->setField(TQString::tqfromLatin1("plot"), descRx.cap(1).simplifyWhiteSpace()); } return entry; } void AnimeNfoFetcher::updateEntry(Data::EntryPtr entry_) { - TQString t = entry_->field(TQString::fromLatin1("title")); + TQString t = entry_->field(TQString::tqfromLatin1("title")); if(!t.isEmpty()) { search(Fetch::Keyword, t); return; |