summaryrefslogtreecommitdiffstats
path: root/src/translators/amcimporter.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-07-02 06:40:27 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-07-02 06:40:27 +0000
commit2595a15ebeb6fc46b7cb241d01ec0c2460ec2111 (patch)
tree18a8f0f4ac5a86dacfa74c3537551ec39bc85e75 /src/translators/amcimporter.cpp
parent1d90725a4001fab9d3922b2cbcceeee5e2d1686f (diff)
downloadtellico-2595a15ebeb6fc46b7cb241d01ec0c2460ec2111.tar.gz
tellico-2595a15ebeb6fc46b7cb241d01ec0c2460ec2111.zip
TQt4 port tellico
This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/tellico@1239054 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/translators/amcimporter.cpp')
-rw-r--r--src/translators/amcimporter.cpp128
1 files changed, 64 insertions, 64 deletions
diff --git a/src/translators/amcimporter.cpp b/src/translators/amcimporter.cpp
index 8e45cb7..399d7a7 100644
--- a/src/translators/amcimporter.cpp
+++ b/src/translators/amcimporter.cpp
@@ -25,13 +25,13 @@
#include <kapplication.h>
-#include <qfile.h>
-#include <qimage.h>
+#include <tqfile.h>
+#include <tqimage.h>
#include <limits.h>
namespace {
- static const QCString AMC_FILE_ID = " AMC_X.Y Ant Movie Catalog 3.5.x www.buypin.com www.antp.be ";
+ static const TQCString AMC_FILE_ID = " AMC_X.Y Ant Movie Catalog 3.5.x www.buypin.com www.antp.be ";
}
using Tellico::Import::AMCImporter;
@@ -55,24 +55,24 @@ Tellico::Data::CollPtr AMCImporter::collection() {
return 0;
}
- QIODevice* f = fileRef().file();
+ TQIODevice* f = fileRef().file();
m_ds.setDevice(f);
// AMC is always little-endian? can't confirm
- m_ds.setByteOrder(QDataStream::LittleEndian);
+ m_ds.setByteOrder(TQDataStream::LittleEndian);
const uint l = AMC_FILE_ID.length();
- QMemArray<char> buffer(l+1);
+ TQMemArray<char> buffer(l+1);
m_ds.readRawBytes(buffer.data(), l);
- QString version = QString::fromLocal8Bit(buffer, l);
- QRegExp versionRx(QString::fromLatin1(".+AMC_(\\d+)\\.(\\d+).+"));
- if(version.find(versionRx) == -1) {
+ TQString version = TQString::fromLocal8Bit(buffer, l);
+ TQRegExp versionRx(TQString::tqfromLatin1(".+AMC_(\\d+)\\.(\\d+).+"));
+ if(version.tqfind(versionRx) == -1) {
myDebug() << "AMCImporter::collection() - no file id match" << endl;
return 0;
}
ProgressItem& item = ProgressManager::self()->newProgressItem(this, progressLabel(), true);
item.setTotalSteps(f->size());
- connect(&item, SIGNAL(signalCancelled(ProgressItem*)), SLOT(slotCancel()));
+ connect(&item, TQT_SIGNAL(signalCancelled(ProgressItem*)), TQT_SLOT(slotCancel()));
ProgressItem::Done done(this);
m_coll = new Data::VideoCollection(true);
@@ -103,13 +103,13 @@ Tellico::Data::CollPtr AMCImporter::collection() {
}
bool AMCImporter::readBool() {
- Q_UINT8 b;
+ TQ_UINT8 b;
m_ds >> b;
return b;
}
-Q_UINT32 AMCImporter::readInt() {
- Q_UINT32 i;
+TQ_UINT32 AMCImporter::readInt() {
+ TQ_UINT32 i;
m_ds >> i;
if(i >= UINT_MAX) {
i = 0;
@@ -117,39 +117,39 @@ Q_UINT32 AMCImporter::readInt() {
return i;
}
-QString AMCImporter::readString() {
+TQString AMCImporter::readString() {
// The serialization format is a length specifier first, then l bytes of data
uint l = readInt();
if(l == 0) {
- return QString();
+ return TQString();
}
- QMemArray<char> buffer(l+1);
+ TQMemArray<char> buffer(l+1);
m_ds.readRawBytes(buffer.data(), l);
- QString s = QString::fromLocal8Bit(buffer, l);
+ TQString s = TQString::fromLocal8Bit(buffer, l);
// myDebug() << "string: " << s << endl;
return s;
}
-QString AMCImporter::readImage(const QString& format_) {
+TQString AMCImporter::readImage(const TQString& format_) {
uint l = readInt();
if(l == 0) {
- return QString();
+ return TQString();
}
- QMemArray<char> buffer(l+1);
+ TQMemArray<char> buffer(l+1);
m_ds.readRawBytes(buffer.data(), l);
- QByteArray bytes;
+ TQByteArray bytes;
bytes.setRawData(buffer.data(), l);
- QImage img(bytes);
+ TQImage img(bytes);
bytes.resetRawData(buffer.data(), l);
if(img.isNull()) {
myDebug() << "AMCImporter::readImage() - null image" << endl;
- return QString();
+ return TQString();
}
- QString format = QString::fromLatin1("PNG");
+ TQString format = TQString::tqfromLatin1("PNG");
if(format_ == Latin1Literal(".jpg")) {
- format = QString::fromLatin1("JPEG");
+ format = TQString::tqfromLatin1("JPEG");
} else if(format_ == Latin1Literal(".gif")) {
- format = QString::fromLatin1("GIF");
+ format = TQString::tqfromLatin1("GIF");
}
return ImageFactory::addImage(img, format);
}
@@ -167,14 +167,14 @@ void AMCImporter::readEntry() {
if(m_majVersion >= 3 && m_minVersion >= 5) {
rating /= 10;
}
- e->setField(QString::fromLatin1("rating"), QString::number(rating));
+ e->setField(TQString::tqfromLatin1("rating"), TQString::number(rating));
int year = readInt();
if(year > 0) {
- e->setField(QString::fromLatin1("year"), QString::number(year));
+ e->setField(TQString::tqfromLatin1("year"), TQString::number(year));
}
int time = readInt();
if(time > 0) {
- e->setField(QString::fromLatin1("running-time"), QString::number(time));
+ e->setField(TQString::tqfromLatin1("running-time"), TQString::number(time));
}
readInt(); // video bitrate
@@ -182,73 +182,73 @@ void AMCImporter::readEntry() {
readInt(); // number of files
readBool(); // checked
readString(); // media label
- e->setField(QString::fromLatin1("medium"), readString());
+ e->setField(TQString::tqfromLatin1("medium"), readString());
readString(); // source
readString(); // borrower
- QString s = readString(); // title
+ TQString s = readString(); // title
if(!s.isEmpty()) {
- e->setField(QString::fromLatin1("title"), s);
+ e->setField(TQString::tqfromLatin1("title"), s);
}
- QString s2 = readString(); // translated title
+ TQString s2 = readString(); // translated title
if(s.isEmpty()) {
- e->setField(QString::fromLatin1("title"), s2);
+ e->setField(TQString::tqfromLatin1("title"), s2);
}
- e->setField(QString::fromLatin1("director"), readString());
+ e->setField(TQString::tqfromLatin1("director"), readString());
s = readString();
- QRegExp roleRx(QString::fromLatin1("(.+) \\(([^(]+)\\)"));
+ TQRegExp roleRx(TQString::tqfromLatin1("(.+) \\(([^(]+)\\)"));
roleRx.setMinimal(true);
- if(s.find(roleRx) > -1) {
- QString role = roleRx.cap(2).lower();
+ if(s.tqfind(roleRx) > -1) {
+ TQString role = roleRx.cap(2).lower();
if(role == Latin1Literal("story") || role == Latin1Literal("written by")) {
- e->setField(QString::fromLatin1("writer"), roleRx.cap(1));
+ e->setField(TQString::tqfromLatin1("writer"), roleRx.cap(1));
} else {
- e->setField(QString::fromLatin1("producer"), s);
+ e->setField(TQString::tqfromLatin1("producer"), s);
}
} else {
- e->setField(QString::fromLatin1("producer"), s);
+ e->setField(TQString::tqfromLatin1("producer"), s);
}
- e->setField(QString::fromLatin1("nationality"), readString());
- e->setField(QString::fromLatin1("genre"), readString().replace(QString::fromLatin1(", "), QString::fromLatin1("; ")));
+ e->setField(TQString::tqfromLatin1("nationality"), readString());
+ e->setField(TQString::tqfromLatin1("genre"), readString().tqreplace(TQString::tqfromLatin1(", "), TQString::tqfromLatin1("; ")));
- e->setField(QString::fromLatin1("cast"), parseCast(readString()).join(QString::fromLatin1("; ")));
+ e->setField(TQString::tqfromLatin1("cast"), parseCast(readString()).join(TQString::tqfromLatin1("; ")));
readString(); // url
- e->setField(QString::fromLatin1("plot"), readString());
- e->setField(QString::fromLatin1("comments"), readString());
+ e->setField(TQString::tqfromLatin1("plot"), readString());
+ e->setField(TQString::tqfromLatin1("comments"), readString());
s = readString(); // video format
- QRegExp regionRx(QString::fromLatin1("Region \\d"));
- if(s.find(regionRx) > -1) {
- e->setField(QString::fromLatin1("region"), regionRx.cap(0));
+ TQRegExp regionRx(TQString::tqfromLatin1("Region \\d"));
+ if(s.tqfind(regionRx) > -1) {
+ e->setField(TQString::tqfromLatin1("region"), regionRx.cap(0));
}
- e->setField(QString::fromLatin1("audio-track"), readString()); // audio format
+ e->setField(TQString::tqfromLatin1("audio-track"), readString()); // audio format
readString(); // resolution
readString(); // frame rate
- e->setField(QString::fromLatin1("language"), readString()); // audio language
- e->setField(QString::fromLatin1("subtitle"), readString()); // subtitle
+ e->setField(TQString::tqfromLatin1("language"), readString()); // audio language
+ e->setField(TQString::tqfromLatin1("subtitle"), readString()); // subtitle
readString(); // file size
s = readString(); // picture extension
s = readImage(s); // picture
if(!s.isEmpty()) {
- e->setField(QString::fromLatin1("cover"), s);
+ e->setField(TQString::tqfromLatin1("cover"), s);
}
m_coll->addEntries(e);
}
-QStringList AMCImporter::parseCast(const QString& text_) {
- QStringList cast;
+TQStringList AMCImporter::parseCast(const TQString& text_) {
+ TQStringList cast;
int nPar = 0;
- QRegExp castRx(QString::fromLatin1("[,()]"));
- QString person, role;
+ TQRegExp castRx(TQString::tqfromLatin1("[,()]"));
+ TQString person, role;
int oldPos = 0;
- for(int pos = text_.find(castRx); pos > -1; pos = text_.find(castRx, pos+1)) {
+ for(int pos = text_.tqfind(castRx); pos > -1; pos = text_.tqfind(castRx, pos+1)) {
if(text_.at(pos) == ',' && nPar%2 == 0) {
// we're done with this one
person += text_.mid(oldPos, pos-oldPos).stripWhiteSpace();
- QString all = person;
+ TQString all = person;
if(!role.isEmpty()) {
- if(role.startsWith(QString::fromLatin1("as "))) {
+ if(role.startsWith(TQString::tqfromLatin1("as "))) {
role = role.mid(3);
}
all += "::" + role;
@@ -260,14 +260,14 @@ QStringList AMCImporter::parseCast(const QString& text_) {
} else if(text_.at(pos) == '(') {
if(nPar == 0) {
person = text_.mid(oldPos, pos-oldPos).stripWhiteSpace();
- oldPos = pos+1; // add one to go past parenthesis
+ oldPos = pos+1; // add one to go past tqparenthesis
}
++nPar;
} else if(text_.at(pos) == ')') {
--nPar;
if(nPar == 0) {
role = text_.mid(oldPos, pos-oldPos).stripWhiteSpace();
- oldPos = pos+1; // add one to go past parenthesis
+ oldPos = pos+1; // add one to go past tqparenthesis
}
}
}
@@ -275,9 +275,9 @@ QStringList AMCImporter::parseCast(const QString& text_) {
if(nPar%2 == 0) {
int pos = text_.length();
person += text_.mid(oldPos, pos-oldPos).stripWhiteSpace();
- QString all = person;
+ TQString all = person;
if(!role.isEmpty()) {
- if(role.startsWith(QString::fromLatin1("as "))) {
+ if(role.startsWith(TQString::tqfromLatin1("as "))) {
role = role.mid(3);
}
all += "::" + role;