summaryrefslogtreecommitdiffstats
path: root/noatun-plugins/oblique/base.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'noatun-plugins/oblique/base.cpp')
-rw-r--r--noatun-plugins/oblique/base.cpp112
1 files changed, 56 insertions, 56 deletions
diff --git a/noatun-plugins/oblique/base.cpp b/noatun-plugins/oblique/base.cpp
index 60bb272..c9e6fb6 100644
--- a/noatun-plugins/oblique/base.cpp
+++ b/noatun-plugins/oblique/base.cpp
@@ -7,10 +7,10 @@
#include "kdbt.h"
#include "kbuffer.h"
-#include <qstringlist.h>
-#include <qmap.h>
-#include <qfile.h>
-#include <qdom.h>
+#include <tqstringlist.h>
+#include <tqmap.h>
+#include <tqfile.h>
+#include <tqdom.h>
#include <cstdlib>
#include <assert.h>
@@ -23,24 +23,24 @@ struct Base::Private
Private() : db(0, DB_CXX_NO_EXCEPTIONS) { }
Db db;
typedef KDbt<FileId> Key;
- typedef KDbt<QStringList> Data;
+ typedef KDbt<TQStringList> Data;
FileId high;
FileId cachedId;
- mutable QMap<QString,QString> cachedProperties;
+ mutable TQMap<TQString,TQString> cachedProperties;
- QPtrList<Slice> slices;
+ TQPtrList<Slice> slices;
int sliceHigh;
};
-Base::Base(const QString &file)
+Base::Base(const TQString &file)
{
d = new Private;
d->cachedId = 0;
- QCString filename = QFile::encodeName(file);
+ TQCString filename = TQFile::encodeName(file);
bool create = true;
if (d->db.open(
@@ -55,7 +55,7 @@ Base::Base(const QString &file)
Private::Key key(0);
if (d->db.get(0, &key, &data, 0)==0)
{
- QStringList strs;
+ TQStringList strs;
data.get(strs);
mFormatVersion = strs[0].toUInt(0, 16); // TODO
@@ -71,7 +71,7 @@ Base::Base(const QString &file)
}
if (create)
{ // failure
- QFile(filename).remove();
+ TQFile(filename).remove();
d->db.open(
#if DB_VERSION_MINOR > 0 && DB_VERSION_MAJOR >= 4
NULL,
@@ -80,7 +80,7 @@ Base::Base(const QString &file)
);
d->high=0;
- QStringList strs;
+ TQStringList strs;
strs << "00010002" << "0" << "";
resetFormatVersion();
loadMetaXML("");
@@ -102,8 +102,8 @@ void Base::resetFormatVersion()
Base::~Base()
{
- QStringList strs;
- strs << QString::number(mFormatVersion, 16) << QString::number(d->high);
+ TQStringList strs;
+ strs << TQString::number(mFormatVersion, 16) << TQString::number(d->high);
strs << saveMetaXML();
Private::Data data(strs);
@@ -114,10 +114,10 @@ Base::~Base()
delete d;
}
-File Base::add(const QString &file)
+File Base::add(const TQString &file)
{
Private::Key key(++d->high);
- QStringList properties;
+ TQStringList properties;
properties << "file" << file;
Private::Data data(properties);
@@ -180,23 +180,23 @@ File Base::first(FileId first)
return File(this, first);
}
-QString Base::property(FileId id, const QString &property) const
+TQString Base::property(FileId id, const TQString &property) const
{
loadIntoCache(id);
- if (!d->cachedProperties.contains(property)) return QString::null;
- QMap<QString,QString>::Iterator i = d->cachedProperties.find(property);
+ if (!d->cachedProperties.contains(property)) return TQString::null;
+ TQMap<TQString,TQString>::Iterator i = d->cachedProperties.find(property);
return i.data();
}
-void Base::setProperty(FileId id, const QString &key, const QString &value)
+void Base::setProperty(FileId id, const TQString &key, const TQString &value)
{
loadIntoCache(id);
d->cachedProperties.insert(key, value);
// reinsert it into the DB
- QStringList props;
+ TQStringList props;
for (
- QMap<QString,QString>::Iterator i(d->cachedProperties.begin());
+ TQMap<TQString,TQString>::Iterator i(d->cachedProperties.begin());
i != d->cachedProperties.end(); ++i
)
{
@@ -211,12 +211,12 @@ void Base::setProperty(FileId id, const QString &key, const QString &value)
emit modified(File(this, id));
}
-QStringList Base::properties(FileId id) const
+TQStringList Base::properties(FileId id) const
{
loadIntoCache(id);
- QStringList props;
+ TQStringList props;
for (
- QMap<QString,QString>::Iterator i(d->cachedProperties.begin());
+ TQMap<TQString,TQString>::Iterator i(d->cachedProperties.begin());
i != d->cachedProperties.end(); ++i
)
{
@@ -225,15 +225,15 @@ QStringList Base::properties(FileId id) const
return props;
}
-void Base::clearProperty(FileId id, const QString &key)
+void Base::clearProperty(FileId id, const TQString &key)
{
loadIntoCache(id);
d->cachedProperties.remove(key);
// reinsert it into the DB
- QStringList props;
+ TQStringList props;
for (
- QMap<QString,QString>::Iterator i(d->cachedProperties.begin());
+ TQMap<TQString,TQString>::Iterator i(d->cachedProperties.begin());
i != d->cachedProperties.end(); ++i
)
{
@@ -275,7 +275,7 @@ void Base::loadIntoCache(FileId id) const
Private::Data data;
unless (d->db.get(0, &key, &data, 0))
{
- QStringList props;
+ TQStringList props;
data.get(props);
if (props.count() % 2)
@@ -284,28 +284,28 @@ void Base::loadIntoCache(FileId id) const
return;
}
- for (QStringList::Iterator i(props.begin()); i != props.end(); ++i)
+ for (TQStringList::Iterator i(props.begin()); i != props.end(); ++i)
{
- QString &key = *i;
- QString &value = *++i;
+ TQString &key = *i;
+ TQString &value = *++i;
d->cachedProperties.insert(key, value);
}
}
}
-QString Base::saveMetaXML()
+TQString Base::saveMetaXML()
{
- QDomDocument doc;
- doc.setContent(QString("<meta />"));
- QDomElement doce = doc.documentElement();
+ TQDomDocument doc;
+ doc.setContent(TQString("<meta />"));
+ TQDomElement doce = doc.documentElement();
- QDomElement e = doc.createElement("slices");
- e.setAttribute("highslice", QString::number(d->sliceHigh));
+ TQDomElement e = doc.createElement("slices");
+ e.setAttribute("highslice", TQString::number(d->sliceHigh));
doce.appendChild(e);
- for (QPtrListIterator<Slice> i(d->slices); *i; ++i)
+ for (TQPtrListIterator<Slice> i(d->slices); *i; ++i)
{
- QDomElement slice = doc.createElement("slice");
+ TQDomElement slice = doc.createElement("slice");
slice.setAttribute("id", (*i)->id());
slice.setAttribute("name", (*i)->name());
e.appendChild(slice);
@@ -319,7 +319,7 @@ void Base::move(FileId oldid, FileId newid)
Private::Data data;
unless (d->db.get(0, &key, &data, 0))
{
- QStringList props;
+ TQStringList props;
data.get(props);
d->db.del(0, &key, 0);
@@ -332,11 +332,11 @@ void Base::dump()
{
for (FileId id=1; id <= high(); id++)
{
- QStringList props = properties(id);
+ TQStringList props = properties(id);
std::cerr << id << '.';
- for (QStringList::Iterator i(props.begin()); i != props.end(); ++i)
+ for (TQStringList::Iterator i(props.begin()); i != props.end(); ++i)
{
- QString prop = *i;
+ TQString prop = *i;
std::cerr << ' ' << prop.latin1() << '=' << property(id, prop).latin1();
}
std::cerr << std::endl;
@@ -349,12 +349,12 @@ void Base::notifyChanged(const File &file)
}
-QPtrList<Slice> Base::slices()
+TQPtrList<Slice> Base::slices()
{
return d->slices;
}
-Slice *Base::addSlice(const QString &name)
+Slice *Base::addSlice(const TQString &name)
{
Slice *sl = new Slice(this, d->sliceHigh++, name);
d->slices.append(sl);
@@ -364,7 +364,7 @@ Slice *Base::addSlice(const QString &name)
Slice *Base::defaultSlice()
{
- for (QPtrListIterator<Slice> i(d->slices); *i; ++i)
+ for (TQPtrListIterator<Slice> i(d->slices); *i; ++i)
{
if ((*i)->id() == 0) return *i;
}
@@ -382,7 +382,7 @@ void Base::removeSlice(Slice *slice)
Slice *Base::sliceById(int id)
{
- for (QPtrListIterator<Slice> i(d->slices); *i; ++i)
+ for (TQPtrListIterator<Slice> i(d->slices); *i; ++i)
{
if ((*i)->id() == id) return *i;
}
@@ -390,35 +390,35 @@ Slice *Base::sliceById(int id)
}
-void Base::loadMetaXML(const QString &xml)
+void Base::loadMetaXML(const TQString &xml)
{
d->slices.setAutoDelete(true);
d->slices.clear();
d->slices.setAutoDelete(false);
- QDomDocument doc;
+ TQDomDocument doc;
doc.setContent(xml);
- QDomElement doce = doc.documentElement();
+ TQDomElement doce = doc.documentElement();
bool loadedId0=false;
- for (QDomNode n = doce.firstChild(); !n.isNull(); n = n.nextSibling())
+ for (TQDomNode n = doce.firstChild(); !n.isNull(); n = n.nextSibling())
{
- QDomElement e = n.toElement();
+ TQDomElement e = n.toElement();
if (e.isNull()) continue;
if (e.tagName().lower() == "slices")
{
d->sliceHigh = e.attribute("highslice", "1").toInt();
- for (QDomNode n = e.firstChild(); !n.isNull(); n = n.nextSibling())
+ for (TQDomNode n = e.firstChild(); !n.isNull(); n = n.nextSibling())
{
- QDomElement e = n.toElement();
+ TQDomElement e = n.toElement();
if (e.isNull()) continue;
if (e.tagName().lower() == "slice")
{
int id = e.attribute("id").toInt();
if (id==0 && loadedId0) break;
loadedId0=true;
- QString name = e.attribute("name");
+ TQString name = e.attribute("name");
d->slices.append(new Slice(this, id, name));
}
}