summaryrefslogtreecommitdiffstats
path: root/kioslave/audiocd/audiocd.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kioslave/audiocd/audiocd.cpp')
-rw-r--r--kioslave/audiocd/audiocd.cpp126
1 files changed, 63 insertions, 63 deletions
diff --git a/kioslave/audiocd/audiocd.cpp b/kioslave/audiocd/audiocd.cpp
index af81c13d..d092ffda 100644
--- a/kioslave/audiocd/audiocd.cpp
+++ b/kioslave/audiocd/audiocd.cpp
@@ -44,13 +44,13 @@ extern "C"
#include <sys/resource.h>
#include <kmacroexpander.h>
-#include <qfile.h>
-#include <qfileinfo.h>
+#include <tqfile.h>
+#include <tqfileinfo.h>
#include <kcmdlineargs.h>
#include <kdebug.h>
#include <kapplication.h>
#include <klocale.h>
-#include <qregexp.h>
+#include <tqregexp.h>
// CDDB
#include <client.h>
@@ -59,7 +59,7 @@ extern "C"
using namespace KIO;
using namespace KCDDB;
-#define QFL1(x) QString::fromLatin1(x)
+#define QFL1(x) TQString::fromLatin1(x)
#define DEFAULT_CD_DEVICE "/dev/cdrom"
#define CDDB_INFORMATION "CDDB Information"
@@ -121,17 +121,17 @@ public:
bool req_allTracks;
Which_dir which_dir;
int req_track;
- QString fname;
+ TQString fname;
AudioCDEncoder *encoder_dir_type;
// Misc settings
- QString device; // URL settable
+ TQString device; // URL settable
int paranoiaLevel; // URL settable
bool reportErrors;
// Directory strings, never change after init
- QString s_info;
- QString s_fullCD;
+ TQString s_info;
+ TQString s_fullCD;
// Current CD
unsigned discid;
@@ -146,19 +146,19 @@ public:
KCDDB::CDInfo cddbBestChoice;
// Template for ..
- QString fileNameTemplate; // URL settable
- QString albumTemplate; // URL settable
- QString rsearch;
- QString rreplace;
+ TQString fileNameTemplate; // URL settable
+ TQString albumTemplate; // URL settable
+ TQString rsearch;
+ TQString rreplace;
// Current strings for this CD and or cddb selection
- QStringList templateTitles;
- QString templateAlbumName;
+ TQStringList templateTitles;
+ TQString templateAlbumName;
};
int paranoia_read_limited_error;
-AudioCDProtocol::AudioCDProtocol(const QCString & protocol, const QCString & pool, const QCString & app)
+AudioCDProtocol::AudioCDProtocol(const TQCString & protocol, const TQCString & pool, const TQCString & app)
: SlaveBase(protocol, pool, app)
{
d = new Private;
@@ -175,18 +175,18 @@ AudioCDProtocol::~AudioCDProtocol()
delete d;
}
-AudioCDEncoder *AudioCDProtocol::encoderFromExtension(const QString& extension)
+AudioCDEncoder *AudioCDProtocol::encoderFromExtension(const TQString& extension)
{
AudioCDEncoder *encoder;
for ( encoder = encoders.first(); encoder; encoder = encoders.next() ){
- if(QString(".")+encoder->fileType() == extension)
+ if(TQString(".")+encoder->fileType() == extension)
return encoder;
}
Q_ASSERT(false);
return NULL;
}
-AudioCDEncoder *AudioCDProtocol::determineEncoder(const QString & filename)
+AudioCDEncoder *AudioCDProtocol::determineEncoder(const TQString & filename)
{
int len = filename.length();
int pos = filename.findRev('.');
@@ -251,7 +251,7 @@ struct cdrom_drive * AudioCDProtocol::initRequest(const KURL & url)
// circumstances, so build a representation from
// the unit number and SCSI device name.
//
- QString devname = QString::fromLatin1( "/dev/%1%2" )
+ TQString devname = TQString::fromLatin1( "/dev/%1%2" )
.arg( drive->dev->given_dev_name )
.arg( drive->dev->given_unit_number ) ;
kdDebug(7117) << " Using derived name " << devname << endl;
@@ -275,7 +275,7 @@ struct cdrom_drive * AudioCDProtocol::initRequest(const KURL & url)
// Determine what file or folder that is wanted.
d->fname = url.fileName(false);
- QString dname = url.directory(true, false);
+ TQString dname = url.directory(true, false);
if (!dname.isEmpty() && dname[0] == '/')
dname = dname.mid(1);
@@ -323,7 +323,7 @@ struct cdrom_drive * AudioCDProtocol::initRequest(const KURL & url)
// See if the url is a track
d->req_track = -1;
if (!d->fname.isEmpty()){
- QString name(d->fname);
+ TQString name(d->fname);
// Remove extension
int dot = name.findRev('.');
@@ -399,7 +399,7 @@ void AudioCDProtocol::get(const KURL & url)
if( d->fname.contains(i18n(CDDB_INFORMATION))){
uint choice = 1;
- if(d->fname != QString("%1.txt").arg(i18n(CDDB_INFORMATION))){
+ if(d->fname != TQString("%1.txt").arg(i18n(CDDB_INFORMATION))){
choice= d->fname.section('_',1,1).section('.',0,0).toInt();
}
uint count = 1;
@@ -408,9 +408,9 @@ void AudioCDProtocol::get(const KURL & url)
for ( it = d->cddbList.begin(); it != d->cddbList.end(); ++it ){
if(count == choice){
mimeType("text/html");
- data(QCString( (*it).toString().latin1() ));
- // send an empty QByteArray to signal end of data.
- data(QByteArray());
+ data(TQCString( (*it).toString().latin1() ));
+ // send an empty TQByteArray to signal end of data.
+ data(TQByteArray());
finished();
found = true;
break;
@@ -419,9 +419,9 @@ void AudioCDProtocol::get(const KURL & url)
}
if(!found && d->fname.contains(i18n(CDDB_INFORMATION)+":")){
mimeType("text/html");
- //data(QCString( d->fname.latin1() ));
- // send an empty QByteArray to signal end of data.
- data(QByteArray());
+ //data(TQCString( d->fname.latin1() ));
+ // send an empty TQByteArray to signal end of data.
+ data(TQByteArray());
finished();
found = true;
}
@@ -470,8 +470,8 @@ void AudioCDProtocol::get(const KURL & url)
// Read data (track/disk) from the cd
paranoiaRead(drive, firstSector, lastSector, encoder, url.fileName(), size);
- // send an empty QByteArray to signal end of data.
- data(QByteArray());
+ // send an empty TQByteArray to signal end of data.
+ data(TQByteArray());
cdda_close(drive);
@@ -541,7 +541,7 @@ void AudioCDProtocol::stat(const KURL & url)
finished();
}
-static void app_entry(UDSEntry& e, unsigned int uds, const QString& str)
+static void app_entry(UDSEntry& e, unsigned int uds, const TQString& str)
{
UDSAtom a;
a.m_uds = uds;
@@ -557,20 +557,20 @@ static void app_entry(UDSEntry& e, unsigned int uds, long l)
e.append(a);
}
-static void app_dir(UDSEntry& e, const QString & n, size_t s)
+static void app_dir(UDSEntry& e, const TQString & n, size_t s)
{
e.clear();
- app_entry(e, KIO::UDS_NAME, QFile::decodeName(n.local8Bit()));
+ app_entry(e, KIO::UDS_NAME, TQFile::decodeName(n.local8Bit()));
app_entry(e, KIO::UDS_FILE_TYPE, S_IFDIR);
app_entry(e, KIO::UDS_ACCESS, 0400);
app_entry(e, KIO::UDS_SIZE, s);
app_entry(e, KIO::UDS_MIME_TYPE, "inode/directory");
}
-static void app_file(UDSEntry& e, const QString & n, size_t s)
+static void app_file(UDSEntry& e, const TQString & n, size_t s)
{
e.clear();
- app_entry(e, KIO::UDS_NAME, QFile::decodeName(n.local8Bit()));
+ app_entry(e, KIO::UDS_NAME, TQFile::decodeName(n.local8Bit()));
app_entry(e, KIO::UDS_FILE_TYPE, S_IFREG);
app_entry(e, KIO::UDS_ACCESS, 0400);
app_entry(e, KIO::UDS_SIZE, s);
@@ -610,15 +610,15 @@ void AudioCDProtocol::listDir(const KURL & url)
for ( it = d->cddbList.begin(); it != d->cddbList.end(); ++it ){
(*it).toString();
if(count == 1)
- app_file(entry, QString("%1.txt").arg(i18n(CDDB_INFORMATION)), ((*it).toString().length())+1);
+ app_file(entry, TQString("%1.txt").arg(i18n(CDDB_INFORMATION)), ((*it).toString().length())+1);
else
- app_file(entry, QString("%1_%2.txt").arg(i18n(CDDB_INFORMATION)).arg(count), ((*it).toString().length())+1);
+ app_file(entry, TQString("%1_%2.txt").arg(i18n(CDDB_INFORMATION)).arg(count), ((*it).toString().length())+1);
count++;
listEntry(entry, false);
}
// Error
if( count == 1 ) {
- app_file(entry, QString("%1: %2.txt").arg(i18n(CDDB_INFORMATION)).arg(CDDB::resultToString(d->cddbResult)), ((*it).toString().length())+1);
+ app_file(entry, TQString("%1: %2.txt").arg(i18n(CDDB_INFORMATION)).arg(CDDB::resultToString(d->cddbResult)), ((*it).toString().length())+1);
count++;
listEntry(entry, false);
}
@@ -694,7 +694,7 @@ void AudioCDProtocol::listDir(const KURL & url)
finished();
}
-void AudioCDProtocol::addEntry(const QString& trackTitle, AudioCDEncoder *encoder, struct cdrom_drive * drive, int trackNo)
+void AudioCDProtocol::addEntry(const TQString& trackTitle, AudioCDEncoder *encoder, struct cdrom_drive * drive, int trackNo)
{
if(!encoder || !drive)
return;
@@ -713,7 +713,7 @@ void AudioCDProtocol::addEntry(const QString& trackTitle, AudioCDEncoder *encode
theFileSize = fileSize(firstSector, lastSector, encoder);
}
UDSEntry entry;
- app_file(entry, trackTitle + QString(".")+encoder->fileType(), theFileSize);
+ app_file(entry, trackTitle + TQString(".")+encoder->fileType(), theFileSize);
listEntry(entry, false);
}
@@ -730,7 +730,7 @@ long AudioCDProtocol::fileSize(long firstSector, long lastSector, AudioCDEncoder
struct cdrom_drive *AudioCDProtocol::getDrive()
{
- QCString device(QFile::encodeName(d->device));
+ TQCString device(TQFile::encodeName(d->device));
struct cdrom_drive * drive = 0;
@@ -742,7 +742,7 @@ struct cdrom_drive *AudioCDProtocol::getDrive()
if (0 == drive)
{
- if (QFile(QFile::decodeName(DEFAULT_CD_DEVICE)).exists())
+ if (TQFile(TQFile::decodeName(DEFAULT_CD_DEVICE)).exists())
drive = cdda_identify(DEFAULT_CD_DEVICE, CDDA_MESSAGE_PRINTIT, 0);
}
}
@@ -750,7 +750,7 @@ struct cdrom_drive *AudioCDProtocol::getDrive()
if (0 == drive) {
kdDebug(7117) << "Can't find an audio CD on: \"" << d->device << "\"" << endl;
- QFileInfo fi(d->device);
+ TQFileInfo fi(d->device);
if(!fi.isReadable())
error(KIO::ERR_SLAVE_DEFINED, i18n("Device doesn't have read permissions for this account. Check the read permissions on the device."));
else if(!fi.isWritable())
@@ -778,7 +778,7 @@ void AudioCDProtocol::paranoiaRead(
long firstSector,
long lastSector,
AudioCDEncoder* encoder,
- const QString& fileName,
+ const TQString& fileName,
unsigned long size
)
{
@@ -848,8 +848,8 @@ void AudioCDProtocol::paranoiaRead(
if(encoderProcessed == -1){
kdDebug(7117) << "Encoder processing error, stopping." << endl;
ok = false;
- QString errMsg = i18n( "Couldn't read %1: encoding failed" ).arg( fileName );
- QString details = encoder->lastErrorMessage();
+ TQString errMsg = i18n( "Couldn't read %1: encoding failed" ).arg( fileName );
+ TQString details = encoder->lastErrorMessage();
if ( !details.isEmpty() )
errMsg += "\n" + details;
error( ERR_SLAVE_DEFINED, errMsg );
@@ -940,25 +940,25 @@ void AudioCDProtocol::parseURLArgs(const KURL & url)
{
d->clearURLargs();
- QString query(KURL::decode_string(url.query()));
+ TQString query(KURL::decode_string(url.query()));
if (query.isEmpty() || query[0] != '?')
return;
query = query.mid(1); // Strip leading '?'.
- QStringList tokens(QStringList::split('&', query));
+ TQStringList tokens(TQStringList::split('&', query));
- for (QStringList::ConstIterator it(tokens.begin()); it != tokens.end(); ++it)
+ for (TQStringList::ConstIterator it(tokens.begin()); it != tokens.end(); ++it)
{
- QString token(*it);
+ TQString token(*it);
int equalsPos(token.find('='));
if (-1 == equalsPos)
continue;
- QString attribute(token.left(equalsPos));
- QString value(token.mid(equalsPos + 1));
+ TQString attribute(token.left(equalsPos));
+ TQString value(token.mid(equalsPos + 1));
if (attribute == QFL1("device"))
d->device = value;
@@ -1021,7 +1021,7 @@ void AudioCDProtocol::loadSettings()
// otherwise it is not possible to search for a space " ", since an empty (only spaces) value is not
// supported by KConfig, so the space has to be qouted, but then here the regexp searches really for " "
// instead of just the space. Alex
- QRegExp qoutedString("^\".*\"$");
+ TQRegExp qoutedString("^\".*\"$");
if (qoutedString.exactMatch(d->rsearch))
{
d->rsearch=d->rsearch.mid(1, d->rsearch.length()-2);
@@ -1057,7 +1057,7 @@ void AudioCDProtocol::generateTemplateTitles()
if (d->cddbResult != KCDDB::CDDB::Success)
{
for (unsigned int i = 0; i < d->tracks; i++){
- QString n;
+ TQString n;
d->templateTitles.append( i18n("Track %1").arg(n.sprintf("%02d", i + 1)));
}
return;
@@ -1070,28 +1070,28 @@ void AudioCDProtocol::generateTemplateTitles()
// Then generate the templates
d->templateTitles.clear();
for (uint i = 0; i < d->tracks; i++) {
- QMap<QString, QString> macros;
+ TQMap<TQString, TQString> macros;
macros["albumartist"] = info.artist;
macros["albumtitle"] = info.title;
macros["title"] = (info.trackInfoList[i].title);
- QString n;
+ TQString n;
macros["number"] = n.sprintf("%02d", i + 1);
- //macros["number"] = QString("%1").arg(i+1, 2, 10);
+ //macros["number"] = TQString("%1").arg(i+1, 2, 10);
macros["genre"] = info.genre;
- macros["year"] = QString::number(info.year);
+ macros["year"] = TQString::number(info.year);
- QString title = KMacroExpander::expandMacros(d->fileNameTemplate, macros, '%').replace('/', QFL1("%2F"));
- title.replace( QRegExp(d->rsearch), d->rreplace );
+ TQString title = KMacroExpander::expandMacros(d->fileNameTemplate, macros, '%').replace('/', QFL1("%2F"));
+ title.replace( TQRegExp(d->rsearch), d->rreplace );
d->templateTitles.append(title);
}
- QMap<QString, QString> macros;
+ TQMap<TQString, TQString> macros;
macros["albumartist"] = info.artist;
macros["albumtitle"] = info.title;
macros["genre"] = info.genre;
- macros["year"] = QString::number(info.year);
+ macros["year"] = TQString::number(info.year);
d->templateAlbumName = KMacroExpander::expandMacros(d->albumTemplate, macros, '%').replace('/', QFL1("%2F"));
- d->templateAlbumName.replace( QRegExp(d->rsearch), d->rreplace );
+ d->templateAlbumName.replace( TQRegExp(d->rsearch), d->rreplace );
}
/**