diff options
Diffstat (limited to 'noatun/library/vequalizer.cpp')
-rw-r--r-- | noatun/library/vequalizer.cpp | 146 |
1 files changed, 73 insertions, 73 deletions
diff --git a/noatun/library/vequalizer.cpp b/noatun/library/vequalizer.cpp index 4b131e8a..c081d84b 100644 --- a/noatun/library/vequalizer.cpp +++ b/noatun/library/vequalizer.cpp @@ -56,9 +56,9 @@ #include <kconfig.h> #include <klocale.h> -#include <qdom.h> -#include <qtextstream.h> -#include <qfile.h> +#include <tqdom.h> +#include <tqtextstream.h> +#include <tqfile.h> #include <math.h> @@ -155,13 +155,13 @@ int VBand::center() const return (d->start + d->end)/2; } -static QString formatFreq(int f, bool withHz) +static TQString formatFreq(int f, bool withHz) { - QString format; + TQString format; if (f<991) - format=QString::number(f); + format=TQString::number(f); else - format=QString::number((int)((f+500)/1000.0))+"k"; + format=TQString::number((int)((f+500)/1000.0))+"k"; if (withHz) format+="Hz"; @@ -169,17 +169,17 @@ static QString formatFreq(int f, bool withHz) return format; } -QString VBand::formatStart(bool withHz) const +TQString VBand::formatStart(bool withHz) const { return formatFreq(d->start, withHz); } -QString VBand::formatEnd(bool withHz) const +TQString VBand::formatEnd(bool withHz) const { return formatFreq(d->end, withHz); } -QString VBand::format(bool withHz) const +TQString VBand::format(bool withHz) const { return formatFreq(center(), withHz); } @@ -212,7 +212,7 @@ int VInterpolation::bands() const void VInterpolation::getFrequencies(int num, int *low, int *high) const { - QValueList<int> fs = VEqualizer::frequencies(bands()); + TQValueList<int> fs = VEqualizer::frequencies(bands()); if (num == 0) *low = 1; else *low = fs[num-1]+1; @@ -249,7 +249,7 @@ void VInterpolation::setLevel(int index, int level) } int realbands = EQ->bands(); - QValueList<int> values; + TQValueList<int> values; for (int i=0; i < realbands; ++i) { // i @@ -360,10 +360,10 @@ int VEqualizer::minBands() const } -QValueList<int> VEqualizer::frequencies(int _num) +TQValueList<int> VEqualizer::frequencies(int _num) { #if 0 - QValueList<int> fs; + TQValueList<int> fs; fs += 108; fs += 217; fs += 810; @@ -389,7 +389,7 @@ QValueList<int> VEqualizer::frequencies(int _num) double vend = double(end()); const double base = ::pow(10.0, ::log10(vend-vstart)/num); - QValueList<int> fs; + TQValueList<int> fs; for (double i=1.0; i <= num; i++) { @@ -416,11 +416,11 @@ void VEqualizer::setBands(int num, bool interpolate) if (num == bands()) return; - QValueList<int> fs = VEqualizer::frequencies(num); + TQValueList<int> fs = VEqualizer::frequencies(num); std::vector<Private::BandInfo> modified; int bstart=0; - for (QValueList<int>::Iterator i(fs.begin()); i != fs.end(); ++i) + for (TQValueList<int>::Iterator i(fs.begin()); i != fs.end(); ++i) { Private::BandInfo info; info.start = bstart+1; @@ -514,11 +514,11 @@ void VEqualizer::setLevel(int index, int level) emit modified(); } -void VEqualizer::setLevels(const QValueList<int> &levels) +void VEqualizer::setLevels(const TQValueList<int> &levels) { int index=0; for ( - QValueList<int>::ConstIterator i(levels.begin()); + TQValueList<int>::ConstIterator i(levels.begin()); i != levels.end(); ++i ) { @@ -572,7 +572,7 @@ void VEqualizer::update(bool full) -bool VEqualizer::save(const KURL &filename, const QString &friendly) const +bool VEqualizer::save(const KURL &filename, const TQString &friendly) const { Noatun::KSaver saver(filename); if(!saver.open()) return false; @@ -585,26 +585,26 @@ bool VEqualizer::save(const KURL &filename, const QString &friendly) const bool VEqualizer::load(const KURL &filename) { - QString dest; + TQString dest; if(KIO::NetAccess::download(filename, dest, 0L)) { - QFile file(dest); + TQFile file(dest); if (!file.open(IO_ReadOnly)) return false; - QTextStream t(&file); - QString str = t.read(); + TQTextStream t(&file); + TQString str = t.read(); fromString(str); return true; } return false; } -QString VEqualizer::toString(const QString &name) const +TQString VEqualizer::toString(const TQString &name) const { - QDomDocument doc("noatunequalizer"); - doc.setContent(QString("<!DOCTYPE NoatunEqualizer><noatunequalizer/>")); - QDomElement docElem = doc.documentElement(); + TQDomDocument doc("noatunequalizer"); + doc.setContent(TQString("<!DOCTYPE NoatunEqualizer><noatunequalizer/>")); + TQDomElement docElem = doc.documentElement(); { docElem.setAttribute("level", preamp()); @@ -616,7 +616,7 @@ QString VEqualizer::toString(const QString &name) const for (int i=0; i < bandc; ++i) { VBand band = const_cast<VEqualizer*>(this)->operator[](i); - QDomElement elem = doc.createElement("band"); + TQDomElement elem = doc.createElement("band"); elem.setAttribute("start", band.start()); elem.setAttribute("end", band.end()); elem.setAttribute("level", band.level()); @@ -627,22 +627,22 @@ QString VEqualizer::toString(const QString &name) const return doc.toString(); } -bool VEqualizer::fromString(const QString &str) +bool VEqualizer::fromString(const TQString &str) { - QDomDocument doc("noatunequalizer"); + TQDomDocument doc("noatunequalizer"); if (!doc.setContent(str)) return false; - QDomElement docElem = doc.documentElement(); + TQDomElement docElem = doc.documentElement(); if (docElem.tagName()!="noatunequalizer") return false; setPreamp(docElem.attribute("level", "0").toInt()); std::vector<Private::BandInfo> modified; - for (QDomNode n = docElem.firstChild(); !n.isNull(); n = n.nextSibling()) + for (TQDomNode n = docElem.firstChild(); !n.isNull(); n = n.nextSibling()) { - QDomElement e = n.toElement(); + TQDomElement e = n.toElement(); if(e.isNull()) continue; if (e.tagName().lower() != "band") continue; @@ -662,34 +662,34 @@ bool VEqualizer::fromString(const QString &str) return true; } -static QString makePresetFile() +static TQString makePresetFile() { - QString basedir=kapp->dirs()->localkdedir()+"/share/apps/noatun/eq.preset/"; + TQString basedir=kapp->dirs()->localkdedir()+"/share/apps/noatun/eq.preset/"; // now append a filename that doesn't exist KStandardDirs::makeDir(basedir); - QString fullpath; + TQString fullpath; int num=0; do { if (num) - fullpath=basedir+"preset."+QString::number(num); + fullpath=basedir+"preset."+TQString::number(num); else fullpath=basedir+"preset"; num++; } - while (QFile(fullpath).exists()); + while (TQFile(fullpath).exists()); return fullpath; } -VPreset VEqualizer::createPreset(const QString &name, bool smart) +VPreset VEqualizer::createPreset(const TQString &name, bool smart) { if (presetExists(name) && !smart) return VPreset(); - QString nameReal=name; + TQString nameReal=name; { int number=1; while (presetExists(nameReal)) { - nameReal=name+" ("+QString::number(number)+')'; + nameReal=name+" ("+TQString::number(number)+')'; number++; } } @@ -700,7 +700,7 @@ VPreset VEqualizer::createPreset(const QString &name, bool smart) save(preset.file(), nameReal); KConfig *config=kapp->config(); config->setGroup("Equalizer"); - QStringList list = config->readListEntry("presets"); + TQStringList list = config->readListEntry("presets"); list += preset.file(); config->writeEntry("presets", list); config->sync(); @@ -710,12 +710,12 @@ VPreset VEqualizer::createPreset(const QString &name, bool smart) } -QValueList<VPreset> VEqualizer::presets() const +TQValueList<VPreset> VEqualizer::presets() const { KConfig *conf=KGlobal::config(); conf->setGroup("Equalizer"); - QStringList list; + TQStringList list; if (conf->hasKey("presets")) { list=conf->readListEntry("presets"); @@ -727,17 +727,17 @@ QValueList<VPreset> VEqualizer::presets() const conf->sync(); } - QValueList<VPreset> presets; + TQValueList<VPreset> presets; - for (QStringList::Iterator i = list.begin(); i!=list.end(); ++i) + for (TQStringList::Iterator i = list.begin(); i!=list.end(); ++i) { - QFile file(*i); + TQFile file(*i); if (!file.open(IO_ReadOnly)) continue; - QDomDocument doc("noatunequalizer"); + TQDomDocument doc("noatunequalizer"); if (!doc.setContent(&file)) continue; - QDomElement docElem = doc.documentElement(); + TQDomElement docElem = doc.documentElement(); if (docElem.tagName()!="noatunequalizer") continue; presets.append(VPreset(*i)); @@ -745,11 +745,11 @@ QValueList<VPreset> VEqualizer::presets() const return presets; } -VPreset VEqualizer::presetByName(const QString &name) +VPreset VEqualizer::presetByName(const TQString &name) { - QValueList<VPreset> pr = presets(); + TQValueList<VPreset> pr = presets(); for ( - QValueList<VPreset>::Iterator i(pr.begin()); + TQValueList<VPreset>::Iterator i(pr.begin()); i != pr.end(); ++i ) { @@ -759,21 +759,21 @@ VPreset VEqualizer::presetByName(const QString &name) return VPreset(); } -VPreset VEqualizer::presetByFile(const QString &file) +VPreset VEqualizer::presetByFile(const TQString &file) { KConfig *conf=KGlobal::config(); conf->setGroup("Equalizer"); - QStringList list=kapp->config()->readListEntry("presets"); + TQStringList list=kapp->config()->readListEntry("presets"); if (list.contains(file)) return VPreset(file); return VPreset(); } -bool VEqualizer::presetExists(const QString &name) const +bool VEqualizer::presetExists(const TQString &name) const { - QValueList<VPreset> list=presets(); + TQValueList<VPreset> list=presets(); for ( - QValueList<VPreset>::Iterator i(list.begin()); + TQValueList<VPreset>::Iterator i(list.begin()); i != list.end(); ++i ) { @@ -787,12 +787,12 @@ bool VEqualizer::presetExists(const QString &name) const struct VPreset::Private { - QString file; + TQString file; }; -VPreset::VPreset(const QString &file) +VPreset::VPreset(const TQString &file) { d = new Private; d->file = file; @@ -827,18 +827,18 @@ VPreset & VPreset::operator=(const VPreset ©) return *this; } -QString VPreset::name() const +TQString VPreset::name() const { - QFile file(d->file); + TQFile file(d->file); if (!file.open(IO_ReadOnly)) return 0; - QDomDocument doc("noatunequalizer"); + TQDomDocument doc("noatunequalizer"); if (!doc.setContent(&file)) return 0; - QDomElement docElem = doc.documentElement(); + TQDomElement docElem = doc.documentElement(); if (docElem.tagName()!="noatunequalizer") return 0; bool standard=docElem.attribute("default", "0")=="0"; - QString n=docElem.attribute("name", 0); + TQString n=docElem.attribute("name", 0); { // All the translations for the presets # ifdef I18N_STUFF @@ -857,15 +857,15 @@ QString VPreset::name() const return n; } -bool VPreset::setName(const QString &name) +bool VPreset::setName(const TQString &name) { - QFile file(d->file); + TQFile file(d->file); if (!file.open(IO_ReadOnly)) return false; - QDomDocument doc("noatunequalizer"); + TQDomDocument doc("noatunequalizer"); if (!doc.setContent(&file)) return false; - QDomElement docElem = doc.documentElement(); + TQDomElement docElem = doc.documentElement(); if (docElem.tagName()!="noatunequalizer") return false; if (docElem.attribute("name") == name) return true; @@ -876,7 +876,7 @@ bool VPreset::setName(const QString &name) if (!file.open(IO_ReadWrite | IO_Truncate)) return false; - QTextStream s(&file); + TQTextStream s(&file); s << doc.toString(); file.close(); @@ -904,7 +904,7 @@ void VPreset::load() const EQ->load(url); } -QString VPreset::file() const +TQString VPreset::file() const { return d->file; } @@ -913,7 +913,7 @@ void VPreset::remove() { KConfig *config=kapp->config(); config->setGroup("Equalizer"); - QStringList items=config->readListEntry("presets"); + TQStringList items=config->readListEntry("presets"); items.remove(file()); config->writeEntry("presets", items); config->sync(); @@ -922,7 +922,7 @@ void VPreset::remove() if (file().find(kapp->dirs()->localkdedir())==0) { - QFile f(file()); + TQFile f(file()); f.remove(); } d->file = ""; |