summaryrefslogtreecommitdiffstats
path: root/libk3b/cddb/k3bcddbquery.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-05-27 19:21:21 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-05-27 19:21:21 +0000
commitd8cc8bdfa7fa624a526d5aa1626974e1444cb799 (patch)
treef295f1c545b319963d5357af79fe08991d8141d9 /libk3b/cddb/k3bcddbquery.cpp
parent2a39a080579fb52a2599c02b2939795385b89093 (diff)
downloadk3b-d8cc8bdfa7fa624a526d5aa1626974e1444cb799.tar.gz
k3b-d8cc8bdfa7fa624a526d5aa1626974e1444cb799.zip
TQt4 port k3b
This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/k3b@1233803 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'libk3b/cddb/k3bcddbquery.cpp')
-rw-r--r--libk3b/cddb/k3bcddbquery.cpp88
1 files changed, 44 insertions, 44 deletions
diff --git a/libk3b/cddb/k3bcddbquery.cpp b/libk3b/cddb/k3bcddbquery.cpp
index 783f9a4..6cf8eb0 100644
--- a/libk3b/cddb/k3bcddbquery.cpp
+++ b/libk3b/cddb/k3bcddbquery.cpp
@@ -25,18 +25,18 @@
#include <klocale.h>
-#include <qtextstream.h>
-#include <qstringlist.h>
-#include <qregexp.h>
-#include <qtimer.h>
+#include <tqtextstream.h>
+#include <tqstringlist.h>
+#include <tqregexp.h>
+#include <tqtimer.h>
#include <stdlib.h>
-K3bCddbQuery::K3bCddbQuery( QObject* parent, const char* name )
- : QObject(parent, name)
+K3bCddbQuery::K3bCddbQuery( TQObject* tqparent, const char* name )
+ : TQObject(tqparent, name)
{
m_bQueryFinishedEmited = false;
}
@@ -53,7 +53,7 @@ void K3bCddbQuery::query( const K3bDevice::Toc& toc )
m_toc = toc;
m_inexactMatches.clear();
- QTimer::singleShot( 0, this, SLOT(doQuery()) );
+ TQTimer::singleShot( 0, this, TQT_SLOT(doQuery()) );
}
@@ -64,26 +64,26 @@ void K3bCddbQuery::queryMatch( const K3bCddbResultHeader& header )
m_result.category = header.category;
m_result.discid = header.discid;
- QTimer::singleShot( 0, this, SLOT(doMatchQuery()) );
+ TQTimer::singleShot( 0, this, TQT_SLOT(doMatchQuery()) );
}
-const QStringList& K3bCddbQuery::categories()
+const TQStringList& K3bCddbQuery::categories()
{
- static QStringList s_cat = QStringList::split( ",", "rock,blues,misc,classical,"
+ static TQStringList s_cat = TQStringList::split( ",", "rock,blues,misc,classical,"
"country,data,folk,jazz,newage,reggae,soundtrack" );
return s_cat;
}
-bool K3bCddbQuery::parseEntry( QTextStream& stream, K3bCddbResultEntry& entry )
+bool K3bCddbQuery::parseEntry( TQTextStream& stream, K3bCddbResultEntry& entry )
{
entry.rawData = "";
- stream.setEncoding( QTextStream::UnicodeUTF8 );
+ stream.setEncoding( TQTextStream::UnicodeUTF8 );
// parse data
- QString line;
+ TQString line;
while( !(line = stream.readLine()).isNull() ) {
entry.rawData.append(line + "\n");
@@ -94,7 +94,7 @@ bool K3bCddbQuery::parseEntry( QTextStream& stream, K3bCddbResultEntry& entry )
}
else if( line.startsWith( "DYEAR" ) ) {
- QString year = line.mid( 6 );
+ TQString year = line.mid( 6 );
if( year.length() == 4 )
entry.year = year.toInt();
}
@@ -108,7 +108,7 @@ bool K3bCddbQuery::parseEntry( QTextStream& stream, K3bCddbResultEntry& entry )
}
else if( line.startsWith( "TTITLE" ) ) {
- int eqSgnPos = line.find( "=" );
+ int eqSgnPos = line.tqfind( "=" );
bool ok;
uint trackNum = (uint)line.mid( 6, eqSgnPos - 6 ).toInt( &ok );
if( !ok )
@@ -129,7 +129,7 @@ bool K3bCddbQuery::parseEntry( QTextStream& stream, K3bCddbResultEntry& entry )
}
else if( line.startsWith( "EXTT" ) ) {
- int eqSgnPos = line.find( "=" );
+ int eqSgnPos = line.tqfind( "=" );
bool ok;
uint trackNum = (uint)line.mid( 4, eqSgnPos - 4 ).toInt( &ok );
if( !ok )
@@ -157,8 +157,8 @@ bool K3bCddbQuery::parseEntry( QTextStream& stream, K3bCddbResultEntry& entry )
// now split the titles in the last added match
// if no " / " delimiter is present title and artist are the same
// -------------------------------------------------------------------
- QString fullTitle = entry.cdTitle;
- int splitPos = fullTitle.find( " / " );
+ TQString fullTitle = entry.cdTitle;
+ int splitPos = fullTitle.tqfind( " / " );
if( splitPos < 0 )
entry.cdArtist = fullTitle;
else {
@@ -168,10 +168,10 @@ bool K3bCddbQuery::parseEntry( QTextStream& stream, K3bCddbResultEntry& entry )
}
- for( QStringList::iterator it = entry.titles.begin();
+ for( TQStringList::iterator it = entry.titles.begin();
it != entry.titles.end(); ++it ) {
- QString fullTitle = *it;
- int splitPos = fullTitle.find( " / " );
+ TQString fullTitle = *it;
+ int splitPos = fullTitle.tqfind( " / " );
if( splitPos < 0 )
entry.artists.append( entry.cdArtist );
else {
@@ -183,31 +183,31 @@ bool K3bCddbQuery::parseEntry( QTextStream& stream, K3bCddbResultEntry& entry )
// replace all "\\n" with "\n"
- for( QStringList::iterator it = entry.titles.begin();
+ for( TQStringList::iterator it = entry.titles.begin();
it != entry.titles.end(); ++it ) {
- (*it).replace( "\\\\\\\\n", "\\n" );
+ (*it).tqreplace( "\\\\\\\\n", "\\n" );
}
- for( QStringList::iterator it = entry.artists.begin();
+ for( TQStringList::iterator it = entry.artists.begin();
it != entry.artists.end(); ++it ) {
- (*it).replace( "\\\\\\\\n", "\\n" );
+ (*it).tqreplace( "\\\\\\\\n", "\\n" );
}
- for( QStringList::iterator it = entry.extInfos.begin();
+ for( TQStringList::iterator it = entry.extInfos.begin();
it != entry.extInfos.end(); ++it ) {
- (*it).replace( "\\\\\\\\n", "\\n" );
+ (*it).tqreplace( "\\\\\\\\n", "\\n" );
}
- entry.cdTitle.replace( "\\\\\\\\n", "\\n" );
- entry.cdArtist.replace( "\\\\\\\\n", "\\n" );
- entry.cdExtInfo.replace( "\\\\\\\\n", "\\n" );
- entry.genre.replace( "\\\\\\\\n", "\\n" );
+ entry.cdTitle.tqreplace( "\\\\\\\\n", "\\n" );
+ entry.cdArtist.tqreplace( "\\\\\\\\n", "\\n" );
+ entry.cdExtInfo.tqreplace( "\\\\\\\\n", "\\n" );
+ entry.genre.tqreplace( "\\\\\\\\n", "\\n" );
return true;
}
-int K3bCddbQuery::getCode( const QString& line )
+int K3bCddbQuery::getCode( const TQString& line )
{
bool ok;
int code = line.left( 3 ).toInt( &ok );
@@ -217,44 +217,44 @@ int K3bCddbQuery::getCode( const QString& line )
}
-QString K3bCddbQuery::handshakeString() const
+TQString K3bCddbQuery::handshakeString() const
{
- QString user( getenv("USER") );
- QString host( getenv("HOST") );
+ TQString user( getenv("USER") );
+ TQString host( getenv("HOST") );
if( user.isEmpty() )
user = "kde-user";
if( host.isEmpty() )
host = "kde-host";
- return QString("%1 %2 K3b %3").arg(user).arg(host).arg(kapp->aboutData()->version());
+ return TQString("%1 %2 K3b %3").tqarg(user).tqarg(host).tqarg(kapp->aboutData()->version());
}
-QString K3bCddbQuery::queryString() const
+TQString K3bCddbQuery::queryString() const
{
- QString query = "cddb query "
- + QString::number( m_toc.discId(), 16 ).rightJustify( 8, '0' )
+ TQString query = "cddb query "
+ + TQString::number( m_toc.discId(), 16 ).rightJustify( 8, '0' )
+ " "
- + QString::number( (unsigned int)m_toc.count() );
+ + TQString::number( (unsigned int)m_toc.count() );
for( K3bDevice::Toc::const_iterator it = m_toc.begin(); it != m_toc.end(); ++it ) {
- query.append( QString( " %1" ).arg( (*it).firstSector().lba() ) );
+ query.append( TQString( " %1" ).tqarg( (*it).firstSector().lba() ) );
}
- query.append( QString( " %1" ).arg( m_toc.length().lba() / 75 ) );
+ query.append( TQString( " %1" ).tqarg( m_toc.length().lba() / 75 ) );
return query;
}
-bool K3bCddbQuery::parseMatchHeader( const QString& line, K3bCddbResultHeader& header )
+bool K3bCddbQuery::parseMatchHeader( const TQString& line, K3bCddbResultHeader& header )
{
// format: category id title
// where title could be artist and title splitted with a /
header.category = line.section( ' ', 0, 0 );
header.discid = line.section( ' ', 1, 1 );
header.title = line.mid( header.category.length() + header.discid.length() + 2 );
- int slashPos = header.title.find( "/" );
+ int slashPos = header.title.tqfind( "/" );
if( slashPos > 0 ) {
header.artist = header.title.left(slashPos).stripWhiteSpace();
header.title = header.title.mid( slashPos+1 ).stripWhiteSpace();