summaryrefslogtreecommitdiffstats
path: root/noatun-plugins/oblique/base.h
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit84da08d7b7fcda12c85caeb5a10b4903770a6f69 (patch)
tree2a6aea76f2dfffb4cc04bb907c4725af94f70e72 /noatun-plugins/oblique/base.h
downloadtdeaddons-84da08d7b7fcda12c85caeb5a10b4903770a6f69.tar.gz
tdeaddons-84da08d7b7fcda12c85caeb5a10b4903770a6f69.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeaddons@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'noatun-plugins/oblique/base.h')
-rw-r--r--noatun-plugins/oblique/base.h105
1 files changed, 105 insertions, 0 deletions
diff --git a/noatun-plugins/oblique/base.h b/noatun-plugins/oblique/base.h
new file mode 100644
index 0000000..c9cb8d4
--- /dev/null
+++ b/noatun-plugins/oblique/base.h
@@ -0,0 +1,105 @@
+// Copyright (c) 2003,2004 Charles Samuels <charles@kde.org>
+// See the file COPYING for redistribution terms.
+#ifndef BASE_H
+#define BASE_H
+
+// ;)
+#define unless(e) if(!(e))
+
+#include <qstring.h>
+#include <qobject.h>
+#include <qptrlist.h>
+
+class File;
+class Slice;
+
+typedef unsigned int FileId;
+
+class Base : public QObject
+{
+Q_OBJECT
+
+ struct Private;
+ Private *d; // not for BC, but for compile times :)
+ friend class Slice;
+ friend class File;
+ unsigned int mFormatVersion;
+
+public:
+ Base(const QString &file);
+ ~Base();
+
+ File add(const QString &file);
+
+ File find(FileId id);
+
+ void clear();
+
+ /**
+ * get the highest FileID
+ **/
+ FileId high() const;
+
+ /**
+ * @return first item after the given id (inclusive)
+ **/
+ File first(FileId id=1);
+
+ QString property(FileId id, const QString &property) const;
+ void setProperty(FileId id, const QString &key, const QString &value);
+ QStringList properties(FileId id) const;
+ void clearProperty(FileId, const QString &key);
+
+ /**
+ * same as File::remove
+ **/
+ void remove(File f);
+
+ /**
+ * change the id of a file
+ **/
+ void move(FileId oldid, FileId newid);
+
+ void dump();
+
+ QPtrList<Slice> slices();
+ Slice *addSlice(const QString &name);
+ Slice *defaultSlice();
+ Slice *sliceById(int id);
+
+ unsigned int formatVersion() const { return mFormatVersion; }
+ void resetFormatVersion();
+
+public slots:
+ void notifyChanged(const File &file);
+
+signals:
+ void added(File file);
+ void removed(File file);
+ void modified(File file);
+
+ void addedTo(Slice *slice, File file);
+ void removedFrom(Slice *slice, File file);
+
+ /**
+ * emitted when something of the slices gets modified
+ * @ref Slice calls this itself via a friendship
+ **/
+ void slicesModified();
+
+private:
+ void loadIntoCache(FileId id) const;
+
+private: // friends for Slice
+ void removeSlice(Slice *slice);
+
+private:
+ /**
+ * load the xml that lives at the head of the db and contains
+ * potentially lots of structured data
+ **/
+ void loadMetaXML(const QString &xml);
+ QString saveMetaXML();
+};
+
+#endif