00001 #ifndef PLUGIN_LOADER_H
00002 #define PLUGIN_LOADER_H
00003
00004 #include <qstring.h>
00005 #include <qvaluelist.h>
00006 #include <qstringlist.h>
00007 #include <noatun/app.h>
00008
00009 #include <klibloader.h>
00010 #include <qdict.h>
00011
00012 struct NoatunLibraryInfo
00013 {
00014 QString specfile;
00015 QString filename;
00016 QString author;
00017 QString license;
00018 QString type;
00019 QString site;
00020 QString email;
00021 QString name;
00022 QString comment;
00023 QStringList require;
00024 };
00025
00026 bool operator ==(const NoatunLibraryInfo &, const NoatunLibraryInfo &);
00027
00028 class Playlist;
00029 class Visualization;
00030 class Plugin;
00031
00032 class LibraryLoader
00033 {
00034 friend class Plugin;
00035 struct PluginLibrary
00036 {
00037 Plugin *plugin;
00038 KLibrary *library;
00039 };
00040
00041 public:
00042 LibraryLoader();
00043 ~LibraryLoader();
00044
00045 QValueList<NoatunLibraryInfo> available() const;
00046 QValueList<NoatunLibraryInfo> loaded() const;
00047
00048
00049
00050
00051 bool loadAll(void);
00052 bool loadAll(const QStringList &);
00053
00054 bool isLoaded(const QString &spec) const;
00055 void add(const QString &spec);
00056 void setModules(const QStringList &mods);
00057
00058
00059
00060 bool remove(const QString &spec);
00061
00062
00063
00064 bool remove(const LibraryLoader::PluginLibrary *plugin);
00065 bool remove(const Plugin *plugin);
00066
00067 Playlist *playlist() const;
00068
00069
00070
00071
00072
00073
00074 NoatunLibraryInfo getInfo(const QString &spec) const;
00075 QPtrList<Plugin> plugins() const;
00076
00077 private:
00078 bool loadSO(const QString &spec);
00079 void removeNow(const QString &spec);
00080
00081 private:
00082 QDict<LibraryLoader::PluginLibrary> mLibHash;
00083 Playlist *mPlaylist;
00084 };
00085
00086 #endif
00087