diff options
Diffstat (limited to 'src/translators/audiofileimporter.cpp')
-rw-r--r-- | src/translators/audiofileimporter.cpp | 168 |
1 files changed, 84 insertions, 84 deletions
diff --git a/src/translators/audiofileimporter.cpp b/src/translators/audiofileimporter.cpp index f825964..0d23fa5 100644 --- a/src/translators/audiofileimporter.cpp +++ b/src/translators/audiofileimporter.cpp @@ -37,12 +37,12 @@ #include <klocale.h> #include <kapplication.h> -#include <qlabel.h> -#include <qlayout.h> -#include <qvgroupbox.h> -#include <qcheckbox.h> -#include <qdir.h> -#include <qwhatsthis.h> +#include <tqlabel.h> +#include <tqlayout.h> +#include <tqvgroupbox.h> +#include <tqcheckbox.h> +#include <tqdir.h> +#include <tqwhatsthis.h> using Tellico::Import::AudioFileImporter; @@ -67,11 +67,11 @@ Tellico::Data::CollPtr AudioFileImporter::collection() { ProgressItem& item = ProgressManager::self()->newProgressItem(this, i18n("Scanning audio files..."), true); item.setTotalSteps(100); - connect(&item, SIGNAL(signalCancelled(ProgressItem*)), SLOT(slotCancel())); + connect(&item, TQT_SIGNAL(signalCancelled(ProgressItem*)), TQT_SLOT(slotCancel())); ProgressItem::Done done(this); // TODO: allow remote audio file importing - QStringList dirs = url().path(); + TQStringList dirs = url().path(); if(m_recursive->isChecked()) { dirs += Tellico::findAllSubDirs(dirs[0]); } @@ -82,16 +82,16 @@ Tellico::Data::CollPtr AudioFileImporter::collection() { const bool showProgress = options() & ImportProgress; - QStringList files; - for(QStringList::ConstIterator it = dirs.begin(); !m_cancelled && it != dirs.end(); ++it) { + TQStringList files; + for(TQStringList::ConstIterator it = dirs.begin(); !m_cancelled && 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 += dir.absFilePath(*it2); } // kapp->processEvents(); not needed ? @@ -102,13 +102,13 @@ Tellico::Data::CollPtr AudioFileImporter::collection() { } item.setTotalSteps(files.count()); - 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 QString file = QString::fromLatin1("file"); + 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"); + const TQString file = TQString::tqfromLatin1("file"); m_coll = new Data::MusicCollection(true); @@ -122,52 +122,52 @@ Tellico::Data::CollPtr AudioFileImporter::collection() { f = new Data::Field(file, i18n("Files"), Data::Field::Table); m_coll->addField(f); } - f->setProperty(QString::fromLatin1("column1"), i18n("Files")); + f->setProperty(TQString::tqfromLatin1("column1"), i18n("Files")); if(addBitrate) { - f->setProperty(QString::fromLatin1("columns"), QChar('2')); - f->setProperty(QString::fromLatin1("column2"), i18n("Bitrate")); + f->setProperty(TQString::tqfromLatin1("columns"), TQChar('2')); + f->setProperty(TQString::tqfromLatin1("column2"), i18n("Bitrate")); } else { - f->setProperty(QString::fromLatin1("columns"), QChar('1')); + f->setProperty(TQString::tqfromLatin1("columns"), TQChar('1')); } } - QMap<QString, Data::EntryPtr> albumMap; + TQMap<TQString, Data::EntryPtr> albumMap; - QStringList directoryFiles; - const uint stepSize = QMAX(static_cast<size_t>(1), files.count() / 100); + TQStringList directoryFiles; + const uint stepSize = TQMAX(static_cast<size_t>(1), files.count() / 100); bool changeTrackTitle = true; uint j = 0; - for(QStringList::ConstIterator it = files.begin(); !m_cancelled && it != files.end(); ++it, ++j) { - TagLib::FileRef f(QFile::encodeName(*it)); + for(TQStringList::ConstIterator it = files.begin(); !m_cancelled && it != files.end(); ++it, ++j) { + TagLib::FileRef f(TQFile::encodeName(*it)); if(f.isNull() || !f.tag()) { - if((*it).endsWith(QString::fromLatin1("/.directory"))) { + if((*it).endsWith(TQString::tqfromLatin1("/.directory"))) { directoryFiles += *it; } continue; } TagLib::Tag* tag = f.tag(); - QString album = TStringToQString(tag->album()).stripWhiteSpace(); + TQString album = TQString(TStringToQString(tag->album())).stripWhiteSpace(); if(album.isEmpty()) { // can't do anything since tellico entries are by album kdWarning() << "Skipping: no album listed for " << *it << endl; continue; } int disc = discNumber(f); - if(disc > 1 && !m_coll->hasField(QString::fromLatin1("track%1").arg(disc))) { - Data::FieldPtr f2 = new Data::Field(QString::fromLatin1("track%1").arg(disc), - i18n("Tracks (Disc %1)").arg(disc), + if(disc > 1 && !m_coll->hasField(TQString::tqfromLatin1("track%1").tqarg(disc))) { + Data::FieldPtr f2 = new Data::Field(TQString::tqfromLatin1("track%1").tqarg(disc), + i18n("Tracks (Disc %1)").tqarg(disc), Data::Field::Table); f2->setFormatFlag(Data::Field::FormatTitle); - f2->setProperty(QString::fromLatin1("columns"), QChar('3')); - f2->setProperty(QString::fromLatin1("column1"), i18n("Title")); - f2->setProperty(QString::fromLatin1("column2"), i18n("Artist")); - f2->setProperty(QString::fromLatin1("column3"), i18n("Length")); + f2->setProperty(TQString::tqfromLatin1("columns"), TQChar('3')); + f2->setProperty(TQString::tqfromLatin1("column1"), i18n("Title")); + f2->setProperty(TQString::tqfromLatin1("column2"), i18n("Artist")); + f2->setProperty(TQString::tqfromLatin1("column3"), i18n("Length")); m_coll->addField(f2); if(changeTrackTitle) { Data::FieldPtr newTrack = new Data::Field(*m_coll->fieldByName(track)); - newTrack->setTitle(i18n("Tracks (Disc %1)").arg(1)); + newTrack->setTitle(i18n("Tracks (Disc %1)").tqarg(1)); m_coll->modifyField(newTrack); changeTrackTitle = false; } @@ -182,7 +182,7 @@ Tellico::Data::CollPtr AudioFileImporter::collection() { } // album entries use the album name as the title entry->setField(title, album); - QString a = TStringToQString(tag->artist()).stripWhiteSpace(); + TQString a = TQString(TStringToQString(tag->artist())).stripWhiteSpace(); if(!a.isEmpty()) { if(exists && entry->field(artist).lower() != a.lower()) { various = true; @@ -192,18 +192,18 @@ Tellico::Data::CollPtr AudioFileImporter::collection() { } } if(tag->year() > 0) { - entry->setField(year, QString::number(tag->year())); + entry->setField(year, TQString::number(tag->year())); } if(!tag->genre().isEmpty()) { - entry->setField(genre, TStringToQString(tag->genre()).stripWhiteSpace()); + entry->setField(genre, TQString(TStringToQString(tag->genre())).stripWhiteSpace()); } if(!tag->title().isEmpty()) { int trackNum = tag->track(); if(trackNum <= 0) { // try to figure out track number from file name - QFileInfo f(*it); - QString fileName = f.baseName(); - QString numString; + TQFileInfo f(*it); + TQString fileName = f.baseName(); + TQString numString; int i = 0; const int len = fileName.length(); while(fileName[i].isNumber() && i < len) { @@ -228,18 +228,18 @@ Tellico::Data::CollPtr AudioFileImporter::collection() { } } if(trackNum > 0) { - QString t = TStringToQString(tag->title()).stripWhiteSpace(); + TQString t = TQString(TStringToQString(tag->title())).stripWhiteSpace(); t += "::" + a; const int len = f.audioProperties()->length(); if(len > 0) { t += "::" + Tellico::minutes(len); } - QString realTrack = disc > 1 ? track + QString::number(disc) : track; + TQString realTrack = disc > 1 ? track + TQString::number(disc) : track; entry->setField(realTrack, insertValue(entry->field(realTrack), t, trackNum)); if(addFile) { - QString fileValue = *it; + TQString fileValue = *it; if(addBitrate) { - fileValue += "::" + QString::number(f.audioProperties()->bitrate()); + fileValue += "::" + TQString::number(f.audioProperties()->bitrate()); } entry->setField(file, insertValue(entry->field(file), fileValue, trackNum)); } @@ -250,14 +250,14 @@ Tellico::Data::CollPtr AudioFileImporter::collection() { myDebug() << *it << " has an empty title, so the track is not imported." << endl; } if(!tag->comment().stripWhiteSpace().isEmpty()) { - QString c = entry->field(comments); + TQString c = entry->field(comments); if(!c.isEmpty()) { - c += QString::fromLatin1("<br/>"); + c += TQString::tqfromLatin1("<br/>"); } if(!tag->title().isEmpty()) { - c += QString::fromLatin1("<em>") + TStringToQString(tag->title()).stripWhiteSpace() + QString::fromLatin1("</em> - "); + c += TQString::tqfromLatin1("<em>") + TQString(TStringToQString(tag->title())).stripWhiteSpace() + TQString::tqfromLatin1("</em> - "); } - c += TStringToQString(tag->comment().stripWhiteSpace()).stripWhiteSpace(); + c += TQString(TStringToQString(tag->comment().stripWhiteSpace())).stripWhiteSpace(); entry->setField(comments, c); } @@ -285,31 +285,31 @@ Tellico::Data::CollPtr AudioFileImporter::collection() { return 0; } - QTextStream ts; - QRegExp iconRx(QString::fromLatin1("Icon\\s*=\\s*(.*)")); - for(QStringList::ConstIterator it = directoryFiles.begin(); !m_cancelled && it != directoryFiles.end(); ++it, ++j) { - QFile file(*it); + TQTextStream ts; + TQRegExp iconRx(TQString::tqfromLatin1("Icon\\s*=\\s*(.*)")); + for(TQStringList::ConstIterator it = directoryFiles.begin(); !m_cancelled && it != directoryFiles.end(); ++it, ++j) { + TQFile file(*it); if(!file.open(IO_ReadOnly)) { continue; } ts.unsetDevice(); - ts.setDevice(&file); - for(QString line = ts.readLine(); !line.isNull(); line = ts.readLine()) { + ts.setDevice(TQT_TQIODEVICE(&file)); + for(TQString line = ts.readLine(); !line.isNull(); line = ts.readLine()) { if(!iconRx.exactMatch(line)) { continue; } - QDir thisDir(*it); + TQDir thisDir(*it); thisDir.cdUp(); - QFileInfo fi(thisDir, iconRx.cap(1)); + TQFileInfo fi(thisDir, iconRx.cap(1)); Data::EntryPtr entry = albumMap[thisDir.dirName()]; if(!entry) { continue; } KURL u; u.setPath(fi.absFilePath()); - QString id = ImageFactory::addImage(u, true); + TQString id = ImageFactory::addImage(u, true); if(!id.isEmpty()) { - entry->setField(QString::fromLatin1("cover"), id); + entry->setField(TQString::tqfromLatin1("cover"), id); } break; } @@ -329,28 +329,28 @@ Tellico::Data::CollPtr AudioFileImporter::collection() { #endif } -QWidget* AudioFileImporter::widget(QWidget* parent_, const char* name_) { +TQWidget* AudioFileImporter::widget(TQWidget* tqparent_, const char* name_) { 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); - QVGroupBox* box = new QVGroupBox(i18n("Audio File Options"), m_widget); + TQVGroupBox* box = new TQVGroupBox(i18n("Audio File Options"), m_widget); - m_recursive = new QCheckBox(i18n("Recursive &folder search"), box); - QWhatsThis::add(m_recursive, i18n("If checked, folders are recursively searched for audio files.")); + m_recursive = new TQCheckBox(i18n("Recursive &folder search"), box); + TQWhatsThis::add(m_recursive, i18n("If checked, folders are recursively searched for audio files.")); // by default, make it checked m_recursive->setChecked(true); - m_addFilePath = new QCheckBox(i18n("Include file &location"), box); - QWhatsThis::add(m_addFilePath, i18n("If checked, the file names for each track are added to the entries.")); + m_addFilePath = new TQCheckBox(i18n("Include file &location"), box); + TQWhatsThis::add(m_addFilePath, i18n("If checked, the file names for each track are added to the entries.")); m_addFilePath->setChecked(false); - connect(m_addFilePath, SIGNAL(toggled(bool)), SLOT(slotAddFileToggled(bool))); + connect(m_addFilePath, TQT_SIGNAL(toggled(bool)), TQT_SLOT(slotAddFileToggled(bool))); - m_addBitrate = new QCheckBox(i18n("Include &bitrate"), box); - QWhatsThis::add(m_addBitrate, i18n("If checked, the bitrate for each track is added to the entries.")); + m_addBitrate = new TQCheckBox(i18n("Include &bitrate"), box); + TQWhatsThis::add(m_addBitrate, i18n("If checked, the bitrate for each track is added to the entries.")); m_addBitrate->setChecked(false); m_addBitrate->setEnabled(false); @@ -360,10 +360,10 @@ QWidget* AudioFileImporter::widget(QWidget* parent_, const char* name_) { } // pos_ is NOT zero-indexed! -QString AudioFileImporter::insertValue(const QString& str_, const QString& value_, uint pos_) { - QStringList list = Data::Field::split(str_, true); +TQString AudioFileImporter::insertValue(const TQString& str_, const TQString& value_, uint pos_) { + TQStringList list = Data::Field::split(str_, true); for(uint i = list.count(); i < pos_; ++i) { - list += QString::null; + list += TQString(); } if(!list[pos_-1].isNull()) { myDebug() << "AudioFileImporter::insertValue() - overwriting track " << pos_ << endl; @@ -371,7 +371,7 @@ QString AudioFileImporter::insertValue(const QString& str_, const QString& value myDebug() << "*** New value: " << value_ << endl; } list[pos_-1] = value_; - return list.join(QString::fromLatin1("; ")); + return list.join(TQString::tqfromLatin1("; ")); } void AudioFileImporter::slotCancel() { @@ -389,23 +389,23 @@ int AudioFileImporter::discNumber(const TagLib::FileRef& ref_) const { // default to 1 unless otherwise int num = 1; #ifdef HAVE_TAGLIB - QString disc; + TQString disc; if(TagLib::MPEG::File* file = dynamic_cast<TagLib::MPEG::File*>(ref_.file())) { if(file->ID3v2Tag() && !file->ID3v2Tag()->frameListMap()["TPOS"].isEmpty()) { - disc = TStringToQString(file->ID3v2Tag()->frameListMap()["TPOS"].front()->toString()).stripWhiteSpace(); + disc = TQString(TStringToQString(file->ID3v2Tag()->frameListMap()["TPOS"].front()->toString())).stripWhiteSpace(); } } else if(TagLib::Ogg::Vorbis::File* file = dynamic_cast<TagLib::Ogg::Vorbis::File*>(ref_.file())) { if(file->tag() && !file->tag()->fieldListMap()["DISCNUMBER"].isEmpty()) { - disc = TStringToQString(file->tag()->fieldListMap()["DISCNUMBER"].front()).stripWhiteSpace(); + disc = TQString(TStringToQString(file->tag()->fieldListMap()["DISCNUMBER"].front())).stripWhiteSpace(); } } else if(TagLib::FLAC::File* file = dynamic_cast<TagLib::FLAC::File*>(ref_.file())) { if(file->xiphComment() && !file->xiphComment()->fieldListMap()["DISCNUMBER"].isEmpty()) { - disc = TStringToQString(file->xiphComment()->fieldListMap()["DISCNUMBER"].front()).stripWhiteSpace(); + disc = TQString(TStringToQString(file->xiphComment()->fieldListMap()["DISCNUMBER"].front())).stripWhiteSpace(); } } if(!disc.isEmpty()) { - int pos = disc.find('/'); + int pos = disc.tqfind('/'); int n; bool ok; if(pos == -1) { |