summaryrefslogtreecommitdiffstats
path: root/src/translators/freedbimporter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/translators/freedbimporter.cpp')
-rw-r--r--src/translators/freedbimporter.cpp220
1 files changed, 110 insertions, 110 deletions
diff --git a/src/translators/freedbimporter.cpp b/src/translators/freedbimporter.cpp
index 14d92d8..1364b4e 100644
--- a/src/translators/freedbimporter.cpp
+++ b/src/translators/freedbimporter.cpp
@@ -24,14 +24,14 @@
#include <config.h>
#ifdef HAVE_KCDDB
-#ifdef QT_NO_CAST_ASCII
-#define HAD_QT_NO_CAST_ASCII
-#undef QT_NO_CAST_ASCII
+#ifdef TQT_NO_CAST_ASCII
+#define HAD_TQT_NO_CAST_ASCII
+#undef TQT_NO_CAST_ASCII
#endif
#include <libkcddb/client.h>
-#ifdef HAD_QT_NO_CAST_ASCII
-#define QT_NO_CAST_ASCII
-#undef HAD_QT_NO_CAST_ASCII
+#ifdef HAD_TQT_NO_CAST_ASCII
+#define TQT_NO_CAST_ASCII
+#undef HAD_TQT_NO_CAST_ASCII
#endif
#endif
@@ -40,16 +40,16 @@
#include <kapplication.h>
#include <kinputdialog.h>
-#include <qfile.h>
-#include <qdir.h>
-#include <qlabel.h>
-#include <qlayout.h>
-#include <qgroupbox.h>
-#include <qwhatsthis.h>
-#include <qradiobutton.h>
-#include <qbuttongroup.h>
-#include <qhbox.h>
-#include <qcheckbox.h>
+#include <tqfile.h>
+#include <tqdir.h>
+#include <tqlabel.h>
+#include <tqlayout.h>
+#include <tqgroupbox.h>
+#include <tqwhatsthis.h>
+#include <tqradiobutton.h>
+#include <tqbuttongroup.h>
+#include <tqhbox.h>
+#include <tqcheckbox.h>
using Tellico::Import::FreeDBImporter;
@@ -79,16 +79,16 @@ Tellico::Data::CollPtr FreeDBImporter::collection() {
void FreeDBImporter::readCDROM() {
#ifdef HAVE_KCDDB
- QString drivePath = m_driveCombo->currentText();
+ TQString drivePath = m_driveCombo->currentText();
if(drivePath.isEmpty()) {
- setStatusMessage(i18n("<qt>Tellico was unable to access the CD-ROM device - <i>%1</i>.</qt>").arg(drivePath));
+ setStatusMessage(i18n("<qt>Tellico was unable to access the CD-ROM device - <i>%1</i>.</qt>").tqarg(drivePath));
myDebug() << "FreeDBImporter::readCDROM() - no drive!" << endl;
return;
}
// now it's ok to add device to saved list
m_driveCombo->insertItem(drivePath);
- QStringList drives;
+ TQStringList drives;
for(int i = 0; i < m_driveCombo->count(); ++i) {
if(drives.findIndex(m_driveCombo->text(i)) == -1) {
drives += m_driveCombo->text(i);
@@ -96,14 +96,14 @@ void FreeDBImporter::readCDROM() {
}
{
- KConfigGroup config(KGlobal::config(), QString::fromLatin1("ImportOptions - FreeDB"));
+ KConfigGroup config(KGlobal::config(), TQString::tqfromLatin1("ImportOptions - FreeDB"));
config.writeEntry("CD-ROM Devices", drives);
config.writeEntry("Last Device", drivePath);
config.writeEntry("Cache Files Only", false);
}
- QCString drive = QFile::encodeName(drivePath);
- QValueList<uint> lengths;
+ TQCString drive = TQFile::encodeName(drivePath);
+ TQValueList<uint> lengths;
KCDDB::TrackOffsetList list;
#if 0
// a1107d0a - Kruder & Dorfmeister - The K&D Sessions - Disc One.
@@ -167,7 +167,7 @@ void FreeDBImporter::readCDROM() {
#endif
if(list.isEmpty()) {
- setStatusMessage(i18n("<qt>Tellico was unable to access the CD-ROM device - <i>%1</i>.</qt>").arg(drivePath));
+ setStatusMessage(i18n("<qt>Tellico was unable to access the CD-ROM device - <i>%1</i>.</qt>").tqarg(drivePath));
return;
}
// myDebug() << KCDDB::CDDB::trackOffsetListToId(list) << endl;
@@ -182,24 +182,24 @@ void FreeDBImporter::readCDROM() {
KCDDB::CDDB::Result r = client.lookup(list);
// KCDDB doesn't return MultipleRecordFound properly, so check outselves
if(r == KCDDB::CDDB::MultipleRecordFound || client.lookupResponse().count() > 1) {
- QStringList list;
+ TQStringList list;
KCDDB::CDInfoList infoList = client.lookupResponse();
for(KCDDB::CDInfoList::iterator it = infoList.begin(); it != infoList.end(); ++it) {
- list.append(QString::fromLatin1("%1, %2, %3").arg((*it).artist)
- .arg((*it).title)
- .arg((*it).genre));
+ list.append(TQString::tqfromLatin1("%1, %2, %3").tqarg((*it).artist)
+ .tqarg((*it).title)
+ .tqarg((*it).genre));
}
// switch back to pointer cursor
- GUI::CursorSaver cs(Qt::arrowCursor);
+ GUI::CursorSaver cs(TQt::arrowCursor);
bool ok;
- QString res = KInputDialog::getItem(i18n("Select CDDB Entry"),
+ TQString res = KInputDialog::getItem(i18n("Select CDDB Entry"),
i18n("Select a CDDB entry:"),
list, 0, false, &ok,
Kernel::self()->widget());
if(ok) {
uint i = 0;
- for(QStringList::ConstIterator it = list.begin(); it != list.end(); ++it, ++i) {
+ for(TQStringList::ConstIterator it = list.begin(); it != list.end(); ++it, ++i) {
if(*it == res) {
break;
}
@@ -214,7 +214,7 @@ void FreeDBImporter::readCDROM() {
info = client.bestLookupResponse();
} else {
// myDebug() << "FreeDBImporter::readCDROM() - no success! Return value = " << r << endl;
- QString s;
+ TQString s;
switch(r) {
case KCDDB::CDDB::NoRecordFound:
s = i18n("<qt>No records were found to match the CD.</qt>");
@@ -254,25 +254,25 @@ void FreeDBImporter::readCDROM() {
Data::EntryPtr entry = new Data::Entry(m_coll);
// obviously a CD
- entry->setField(QString::fromLatin1("medium"), i18n("Compact Disc"));
- entry->setField(QString::fromLatin1("title"), info.title);
- entry->setField(QString::fromLatin1("artist"), info.artist);
- entry->setField(QString::fromLatin1("genre"), info.genre);
+ entry->setField(TQString::tqfromLatin1("medium"), i18n("Compact Disc"));
+ entry->setField(TQString::tqfromLatin1("title"), info.title);
+ entry->setField(TQString::tqfromLatin1("artist"), info.artist);
+ entry->setField(TQString::tqfromLatin1("genre"), info.genre);
if(info.year > 0) {
- entry->setField(QString::fromLatin1("year"), QString::number(info.year));
+ entry->setField(TQString::tqfromLatin1("year"), TQString::number(info.year));
}
- entry->setField(QString::fromLatin1("keyword"), info.category);
- QString extd = info.extd;
- extd.replace('\n', QString::fromLatin1("<br/>"));
- entry->setField(QString::fromLatin1("comments"), extd);
+ entry->setField(TQString::tqfromLatin1("keyword"), info.category);
+ TQString extd = info.extd;
+ extd.tqreplace('\n', TQString::tqfromLatin1("<br/>"));
+ entry->setField(TQString::tqfromLatin1("comments"), extd);
- QStringList trackList;
+ TQStringList trackList;
KCDDB::TrackInfoList t = info.trackInfoList;
for(uint i = 0; i < t.count(); ++i) {
#if KDE_IS_VERSION(3,4,90)
- QString s = t[i].get(QString::fromLatin1("title")).toString() + "::" + info.artist;
+ TQString s = t[i].get(TQString::tqfromLatin1("title")).toString() + "::" + info.artist;
#else
- QString s = t[i].title + "::" + info.artist;
+ TQString s = t[i].title + "::" + info.artist;
#endif
if(i < lengths.count()) {
s += "::" + Tellico::minutes(lengths[i]);
@@ -280,7 +280,7 @@ void FreeDBImporter::readCDROM() {
trackList << s;
// TODO: KDE4 will probably have track length too
}
- entry->setField(QString::fromLatin1("track"), trackList.join(QString::fromLatin1("; ")));
+ entry->setField(TQString::tqfromLatin1("track"), trackList.join(TQString::tqfromLatin1("; ")));
m_coll->addEntries(entry);
readCDText(drive);
@@ -291,41 +291,41 @@ void FreeDBImporter::readCache() {
#ifdef HAVE_KCDDB
{
// remember the import options
- KConfigGroup config(KGlobal::config(), QString::fromLatin1("ImportOptions - FreeDB"));
+ KConfigGroup config(KGlobal::config(), TQString::tqfromLatin1("ImportOptions - FreeDB"));
config.writeEntry("Cache Files Only", true);
}
KCDDB::Config cfg;
cfg.readConfig();
- QStringList dirs = cfg.cacheLocations();
- for(QStringList::ConstIterator it = dirs.begin(); it != dirs.end(); ++it) {
+ TQStringList dirs = cfg.cacheLocations();
+ for(TQStringList::ConstIterator it = dirs.begin(); it != dirs.end(); ++it) {
dirs += Tellico::findAllSubDirs(*it);
}
- // using a QMap is a lazy man's way of getting unique keys
+ // using a TQMap is a lazy man's way of getting unique keys
// the cddb info may be in multiple files, all with the same filename, the cddb id
- QMap<QString, QString> files;
- for(QStringList::ConstIterator it = dirs.begin(); it != dirs.end(); ++it) {
+ TQMap<TQString, TQString> files;
+ for(TQStringList::ConstIterator it = dirs.begin(); it != dirs.end(); ++it) {
if((*it).isEmpty()) {
continue;
}
- QDir dir(*it);
- dir.setFilter(QDir::Files | QDir::Readable | QDir::Hidden); // hidden since I want directory files
- const QStringList list = dir.entryList();
- for(QStringList::ConstIterator it2 = list.begin(); it2 != list.end(); ++it2) {
+ TQDir dir(*it);
+ dir.setFilter(TQDir::Files | TQDir::Readable | TQDir::Hidden); // hidden since I want directory files
+ const TQStringList list = dir.entryList();
+ for(TQStringList::ConstIterator it2 = list.begin(); it2 != list.end(); ++it2) {
files.insert(*it2, dir.absFilePath(*it2), false);
}
// kapp->processEvents(); // really needed ?
}
- const QString title = QString::fromLatin1("title");
- const QString artist = QString::fromLatin1("artist");
- const QString year = QString::fromLatin1("year");
- const QString genre = QString::fromLatin1("genre");
- const QString track = QString::fromLatin1("track");
- const QString comments = QString::fromLatin1("comments");
+ const TQString title = TQString::tqfromLatin1("title");
+ const TQString artist = TQString::tqfromLatin1("artist");
+ const TQString year = TQString::tqfromLatin1("year");
+ const TQString genre = TQString::tqfromLatin1("genre");
+ const TQString track = TQString::tqfromLatin1("track");
+ const TQString comments = TQString::tqfromLatin1("comments");
uint numFiles = files.count();
if(numFiles == 0) {
@@ -335,32 +335,32 @@ void FreeDBImporter::readCache() {
m_coll = new Data::MusicCollection(true);
- const uint stepSize = QMAX(1, numFiles / 100);
+ const uint stepSize = TQMAX(1, numFiles / 100);
const bool showProgress = options() & ImportProgress;
ProgressItem& item = ProgressManager::self()->newProgressItem(this, progressLabel(), true);
item.setTotalSteps(numFiles);
- connect(&item, SIGNAL(signalCancelled(ProgressItem*)), SLOT(slotCancel()));
+ connect(&item, TQT_SIGNAL(signalCancelled(ProgressItem*)), TQT_SLOT(slotCancel()));
ProgressItem::Done done(this);
uint step = 1;
KCDDB::CDInfo info;
- for(QMap<QString, QString>::Iterator it = files.begin(); !m_cancelled && it != files.end(); ++it, ++step) {
+ for(TQMap<TQString, TQString>::Iterator it = files.begin(); !m_cancelled && it != files.end(); ++it, ++step) {
// open file and read content
- QFileInfo fileinfo(it.data()); // skip files larger than 10 kB
+ TQFileInfo fileinfo(it.data()); // skip files larger than 10 kB
if(!fileinfo.exists() || !fileinfo.isReadable() || fileinfo.size() > 10*1024) {
myDebug() << "FreeDBImporter::readCache() - skipping " << it.data() << endl;
continue;
}
- QFile file(it.data());
+ TQFile file(it.data());
if(!file.open(IO_ReadOnly)) {
continue;
}
- QTextStream ts(&file);
+ TQTextStream ts(&file);
// libkcddb always writes the cache files in utf-8
- ts.setEncoding(QTextStream::UnicodeUTF8);
- QString cddbData = ts.read();
+ ts.setEncoding(TQTextStream::UnicodeUTF8);
+ TQString cddbData = ts.read();
file.close();
if(cddbData.isEmpty() || !info.load(cddbData) || !info.isValid()) {
@@ -372,45 +372,45 @@ void FreeDBImporter::readCache() {
// create a new entry and set fields
Data::EntryPtr entry = new Data::Entry(m_coll);
// obviously a CD
- entry->setField(QString::fromLatin1("medium"), i18n("Compact Disc"));
+ entry->setField(TQString::tqfromLatin1("medium"), i18n("Compact Disc"));
entry->setField(title, info.title);
entry->setField(artist, info.artist);
entry->setField(genre, info.genre);
if(info.year > 0) {
- entry->setField(QString::fromLatin1("year"), QString::number(info.year));
+ entry->setField(TQString::tqfromLatin1("year"), TQString::number(info.year));
}
- entry->setField(QString::fromLatin1("keyword"), info.category);
- QString extd = info.extd;
- extd.replace('\n', QString::fromLatin1("<br/>"));
- entry->setField(QString::fromLatin1("comments"), extd);
+ entry->setField(TQString::tqfromLatin1("keyword"), info.category);
+ TQString extd = info.extd;
+ extd.tqreplace('\n', TQString::tqfromLatin1("<br/>"));
+ entry->setField(TQString::tqfromLatin1("comments"), extd);
// step through trackList
- QStringList trackList;
+ TQStringList trackList;
KCDDB::TrackInfoList t = info.trackInfoList;
for(uint i = 0; i < t.count(); ++i) {
#if KDE_IS_VERSION(3,4,90)
- trackList << t[i].get(QString::fromLatin1("title")).toString();
+ trackList << t[i].get(TQString::tqfromLatin1("title")).toString();
#else
trackList << t[i].title;
#endif
}
- entry->setField(track, trackList.join(QString::fromLatin1("; ")));
+ entry->setField(track, trackList.join(TQString::tqfromLatin1("; ")));
#if 0
// add CDDB info
- const QString br = QString::fromLatin1("<br/>");
- QString comment;
+ const TQString br = TQString::tqfromLatin1("<br/>");
+ TQString comment;
if(!info.extd.isEmpty()) {
comment.append(info.extd + br);
}
if(!info.id.isEmpty()) {
- comment.append(QString::fromLatin1("CDDB-ID: ") + info.id + br);
+ comment.append(TQString::tqfromLatin1("CDDB-ID: ") + info.id + br);
}
if(info.length > 0) {
- comment.append("Length: " + QString::number(info.length) + br);
+ comment.append("Length: " + TQString::number(info.length) + br);
}
if(info.revision > 0) {
- comment.append("Revision: " + QString::number(info.revision) + br);
+ comment.append("Revision: " + TQString::number(info.revision) + br);
}
entry->setField(comments, comment);
#endif
@@ -427,11 +427,11 @@ void FreeDBImporter::readCache() {
}
#define SETFIELD(name,value) \
- if(entry->field(QString::fromLatin1(name)).isEmpty()) { \
- entry->setField(QString::fromLatin1(name), value); \
+ if(entry->field(TQString::tqfromLatin1(name)).isEmpty()) { \
+ entry->setField(TQString::tqfromLatin1(name), value); \
}
-void FreeDBImporter::readCDText(const QCString& drive_) {
+void FreeDBImporter::readCDText(const TQCString& drive_) {
#ifdef USE_CDTEXT
Data::EntryPtr entry;
if(m_coll) {
@@ -443,7 +443,7 @@ void FreeDBImporter::readCDText(const QCString& drive_) {
}
if(!entry) {
entry = new Data::Entry(m_coll);
- entry->setField(QString::fromLatin1("medium"), i18n("Compact Disc"));
+ entry->setField(TQString::tqfromLatin1("medium"), i18n("Compact Disc"));
m_coll->addEntries(entry);
}
@@ -456,11 +456,11 @@ void FreeDBImporter::readCDText(const QCString& drive_) {
}
*/
- QString artist = cdtext.artist;
+ TQString artist = cdtext.artist;
SETFIELD("title", cdtext.title);
SETFIELD("artist", artist);
SETFIELD("comments", cdtext.message);
- QStringList tracks;
+ TQStringList tracks;
for(uint i = 0; i < cdtext.trackTitles.size(); ++i) {
tracks << cdtext.trackTitles[i] + "::" + cdtext.trackArtists[i];
if(artist.isEmpty()) {
@@ -470,7 +470,7 @@ void FreeDBImporter::readCDText(const QCString& drive_) {
artist = i18n("Various");
}
}
- SETFIELD("track", tracks.join(QString::fromLatin1("; ")));
+ SETFIELD("track", tracks.join(TQString::tqfromLatin1("; ")));
// something special for compilations and such
SETFIELD("title", i18n(Data::Collection::s_emptyGroupTitle));
@@ -479,53 +479,53 @@ void FreeDBImporter::readCDText(const QCString& drive_) {
}
#undef SETFIELD
-QWidget* FreeDBImporter::widget(QWidget* parent_, const char* name_/*=0*/) {
+TQWidget* FreeDBImporter::widget(TQWidget* tqparent_, const char* name_/*=0*/) {
if(m_widget) {
return m_widget;
}
- m_widget = new QWidget(parent_, name_);
- QVBoxLayout* l = new QVBoxLayout(m_widget);
+ m_widget = new TQWidget(tqparent_, name_);
+ TQVBoxLayout* l = new TQVBoxLayout(m_widget);
- QGroupBox* bigbox = new QGroupBox(1, Qt::Horizontal, i18n("Audio CD Options"), m_widget);
+ TQGroupBox* bigbox = new TQGroupBox(1, Qt::Horizontal, i18n("Audio CD Options"), m_widget);
// cdrom stuff
- QHBox* box = new QHBox(bigbox);
- m_radioCDROM = new QRadioButton(i18n("Read data from CD-ROM device"), box);
+ TQHBox* box = new TQHBox(bigbox);
+ m_radioCDROM = new TQRadioButton(i18n("Read data from CD-ROM device"), box);
m_driveCombo = new KComboBox(true, box);
m_driveCombo->setDuplicatesEnabled(false);
- QString w = i18n("Select or input the CD-ROM device location.");
- QWhatsThis::add(m_radioCDROM, w);
- QWhatsThis::add(m_driveCombo, w);
+ TQString w = i18n("Select or input the CD-ROM device location.");
+ TQWhatsThis::add(m_radioCDROM, w);
+ TQWhatsThis::add(m_driveCombo, w);
/********************************************************************************/
- m_radioCache = new QRadioButton(i18n("Read all CDDB cache files only"), bigbox);
- QWhatsThis::add(m_radioCache, i18n("Read data recursively from all the CDDB cache files "
+ m_radioCache = new TQRadioButton(i18n("Read all CDDB cache files only"), bigbox);
+ TQWhatsThis::add(m_radioCache, i18n("Read data recursively from all the CDDB cache files "
"contained in the default cache folders."));
// cddb cache stuff
- m_buttonGroup = new QButtonGroup(m_widget);
- m_buttonGroup->hide(); // only use as button parent
+ m_buttonGroup = new TQButtonGroup(m_widget);
+ m_buttonGroup->hide(); // only use as button tqparent
m_buttonGroup->setExclusive(true);
m_buttonGroup->insert(m_radioCDROM);
m_buttonGroup->insert(m_radioCache);
- connect(m_buttonGroup, SIGNAL(clicked(int)), SLOT(slotClicked(int)));
+ connect(m_buttonGroup, TQT_SIGNAL(clicked(int)), TQT_SLOT(slotClicked(int)));
l->addWidget(bigbox);
l->addStretch(1);
// now read config options
- KConfigGroup config(KGlobal::config(), QString::fromLatin1("ImportOptions - FreeDB"));
- QStringList devices = config.readListEntry("CD-ROM Devices");
+ KConfigGroup config(KGlobal::config(), TQString::tqfromLatin1("ImportOptions - FreeDB"));
+ TQStringList devices = config.readListEntry("CD-ROM Devices");
if(devices.isEmpty()) {
#if defined(__OpenBSD__)
- devices += QString::fromLatin1("/dev/rcd0c");
+ devices += TQString::tqfromLatin1("/dev/rcd0c");
#endif
- devices += QString::fromLatin1("/dev/cdrom");
- devices += QString::fromLatin1("/dev/dvd");
+ devices += TQString::tqfromLatin1("/dev/cdrom");
+ devices += TQString::tqfromLatin1("/dev/dvd");
}
m_driveCombo->insertStringList(devices);
- QString device = config.readEntry("Last Device");
+ TQString device = config.readEntry("Last Device");
if(!device.isEmpty()) {
m_driveCombo->setCurrentText(device);
}
@@ -541,7 +541,7 @@ QWidget* FreeDBImporter::widget(QWidget* parent_, const char* name_/*=0*/) {
}
void FreeDBImporter::slotClicked(int id_) {
- QButton* button = m_buttonGroup->find(id_);
+ TQButton* button = m_buttonGroup->tqfind(id_);
if(!button) {
return;
}