summaryrefslogtreecommitdiff
authoreilers <eilers>2004-07-18 12:05:48 (UTC)
committer eilers <eilers>2004-07-18 12:05:48 (UTC)
commit4542dd2fd841179a064af1865b0701bdab7eaaf5 (patch) (unidiff)
treef37c7a6c15000eef0a4e9416e06af02b39a7a5ef
parent987705b1c4fac4a33b82b10ef1bac3ebdb49b1b8 (diff)
downloadopie-4542dd2fd841179a064af1865b0701bdab7eaaf5.zip
opie-4542dd2fd841179a064af1865b0701bdab7eaaf5.tar.gz
opie-4542dd2fd841179a064af1865b0701bdab7eaaf5.tar.bz2
Removed forward deklaration of template class. This caused double defined
linker errors on mac Gcc 3.3
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/opluginloader.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/libopie2/opiecore/opluginloader.h b/libopie2/opiecore/opluginloader.h
index 740551c..7582d29 100644
--- a/libopie2/opiecore/opluginloader.h
+++ b/libopie2/opiecore/opluginloader.h
@@ -1,207 +1,207 @@
1/* 1/*
2 * LGPLv2 or later 2 * LGPLv2 or later
3 * zecke@handhelds.org 3 * zecke@handhelds.org
4 */ 4 */
5#ifndef ODP_CORE_OPLUGIN_LOADER_H 5#ifndef ODP_CORE_OPLUGIN_LOADER_H
6#define ODP_CORE_OPLUGIN_LOADER_H 6#define ODP_CORE_OPLUGIN_LOADER_H
7 7
8#include <qpe/qlibrary.h> 8#include <qpe/qlibrary.h>
9 9
10#include <qptrdict.h> 10#include <qptrdict.h>
11#include <qstringlist.h> 11#include <qstringlist.h>
12 12
13namespace Opie { 13namespace Opie {
14namespace Core { 14namespace Core {
15class OConfig; 15class OConfig;
16namespace Internal { 16namespace Internal {
17class OPluginLibraryHolder; 17class OPluginLibraryHolder;
18} 18}
19 19
20template class QPtrDict<QLibrary>; 20// template class QPtrDict<QLibrary>;
21 21
22/** 22/**
23 * \brief A small item representing the Plugin Information 23 * \brief A small item representing the Plugin Information
24 * This class contains the information about a Plugin. It contains 24 * This class contains the information about a Plugin. It contains
25 * a translated name if available to the system, a config key, 25 * a translated name if available to the system, a config key,
26 * and the path location. 26 * and the path location.
27 * 27 *
28 * @since 1.2 28 * @since 1.2
29 * 29 *
30 */ 30 */
31class OPluginItem { 31class OPluginItem {
32public: 32public:
33 typedef QValueList<OPluginItem> List; 33 typedef QValueList<OPluginItem> List;
34 OPluginItem(); 34 OPluginItem();
35 OPluginItem( const QString& name, const QString& path, bool enabled = true, int pos = -1 ); 35 OPluginItem( const QString& name, const QString& path, bool enabled = true, int pos = -1 );
36 ~OPluginItem(); 36 ~OPluginItem();
37 37
38 bool isEmpty()const; 38 bool isEmpty()const;
39 39
40 bool operator==( const OPluginItem& )const; 40 bool operator==( const OPluginItem& )const;
41 bool operator!=( const OPluginItem& )const; 41 bool operator!=( const OPluginItem& )const;
42 42
43 43
44 QString name()const; 44 QString name()const;
45 QString path()const; 45 QString path()const;
46 bool isEnabled()const; 46 bool isEnabled()const;
47 int position()const; 47 int position()const;
48 48
49 void setName( const QString& ); 49 void setName( const QString& );
50 void setPath( const QString& ); 50 void setPath( const QString& );
51 void setEnabled( bool ); 51 void setEnabled( bool );
52 void setPosition( int ); 52 void setPosition( int );
53 53
54private: 54private:
55 QString m_name; 55 QString m_name;
56 QString m_path; 56 QString m_path;
57 bool m_enabled : 1; 57 bool m_enabled : 1;
58 int m_pos; 58 int m_pos;
59 struct Private; 59 struct Private;
60 Private *d; 60 Private *d;
61}; 61};
62 62
63/** 63/**
64 * \brief A generic class to easily load and manage plugins 64 * \brief A generic class to easily load and manage plugins
65 * 65 *
66 * This is the generic non sepcialised loader for plugins. Normally 66 * This is the generic non sepcialised loader for plugins. Normally
67 * you would prefer using the OPluginLoader directly. This class 67 * you would prefer using the OPluginLoader directly. This class
68 * exists to minimize the application binary size due the usage 68 * exists to minimize the application binary size due the usage
69 * of templates in the specialized API 69 * of templates in the specialized API
70 * 70 *
71 * @since 1.2 71 * @since 1.2
72 * @see OPluginLoader 72 * @see OPluginLoader
73 */ 73 */
74class OGenericPluginLoader { 74class OGenericPluginLoader {
75public: 75public:
76 typedef OPluginItem::List List; 76 typedef OPluginItem::List List;
77 OGenericPluginLoader( const QString &name, bool isSorted = false ); 77 OGenericPluginLoader( const QString &name, bool isSorted = false );
78 virtual ~OGenericPluginLoader(); 78 virtual ~OGenericPluginLoader();
79 79
80 void setAutoDelete( bool ); 80 void setAutoDelete( bool );
81 bool autoDelete()const; 81 bool autoDelete()const;
82 void clear(); 82 void clear();
83 83
84 QString name()const; 84 QString name()const;
85 bool isSorted()const; 85 bool isSorted()const;
86 bool isInSafeMode()const; 86 bool isInSafeMode()const;
87 87
88 88
89 List allAvailable(bool sorted = false )const; 89 List allAvailable(bool sorted = false )const;
90 List filtered(bool sorted = false )const; 90 List filtered(bool sorted = false )const;
91 91
92 92
93 virtual QUnknownInterface* load( const OPluginItem& item, const QUuid& ); 93 virtual QUnknownInterface* load( const OPluginItem& item, const QUuid& );
94 virtual void unload( QUnknownInterface* ); 94 virtual void unload( QUnknownInterface* );
95 95
96protected: 96protected:
97 friend class OPluginManager; // we need the static unlibify 97 friend class OPluginManager; // we need the static unlibify
98 void readConfig(); 98 void readConfig();
99 virtual List plugins( const QString& dir, bool sorted, bool disabled )const; 99 virtual List plugins( const QString& dir, bool sorted, bool disabled )const;
100 void setPluginDirs( const QStringList& ); 100 void setPluginDirs( const QStringList& );
101 void setPluginDir( const QString& ); 101 void setPluginDir( const QString& );
102 void setSafeMode(const QString& app = QString::null, bool b = false); 102 void setSafeMode(const QString& app = QString::null, bool b = false);
103 static QString unlibify( const QString& str ); 103 static QString unlibify( const QString& str );
104private: 104private:
105 QStringList languageList(); 105 QStringList languageList();
106 void installTranslators(const QString& type); 106 void installTranslators(const QString& type);
107 QString m_dir; 107 QString m_dir;
108 QStringList m_plugDirs; 108 QStringList m_plugDirs;
109 QStringList m_languages; 109 QStringList m_languages;
110 bool m_autoDelete : 1; 110 bool m_autoDelete : 1;
111 bool m_isSafeMode : 1; 111 bool m_isSafeMode : 1;
112 bool m_isSorted : 1; 112 bool m_isSorted : 1;
113 QPtrDict<QLibrary> m_library; 113 QPtrDict<QLibrary> m_library;
114 114
115 struct Private; 115 struct Private;
116 Private* d; 116 Private* d;
117}; 117};
118 118
119/** 119/**
120 * \brief The class to load your QCOM+ plugins 120 * \brief The class to load your QCOM+ plugins
121 * 121 *
122 * This class takes care of activation and even the order 122 * This class takes care of activation and even the order
123 * if you need it. It is normally good to place a .directory file 123 * if you need it. It is normally good to place a .directory file
124 * into your plugin directory if you need order of activation. 124 * into your plugin directory if you need order of activation.
125 * 125 *
126 * You'll create the OPluginLoader and then use it to load the filtered 126 * You'll create the OPluginLoader and then use it to load the filtered
127 * plugins. 127 * plugins.
128 * 128 *
129 * There is also a GUI for the configuration and a Manager to write the 129 * There is also a GUI for the configuration and a Manager to write the
130 * mentioned .directory file 130 * mentioned .directory file
131 * 131 *
132 * On crash the safe mode is activated for the next run. You can then decide 132 * On crash the safe mode is activated for the next run. You can then decide
133 * if you want to load plugins or come up with the Configuration on 133 * if you want to load plugins or come up with the Configuration on
134 * next start yourself then. 134 * next start yourself then.
135 * 135 *
136 * @since 1.2 136 * @since 1.2
137 */ 137 */
138class OPluginLoader : public OGenericPluginLoader { 138class OPluginLoader : public OGenericPluginLoader {
139public: 139public:
140 OPluginLoader( const QString& name, bool sorted = false ); 140 OPluginLoader( const QString& name, bool sorted = false );
141 virtual ~OPluginLoader(); 141 virtual ~OPluginLoader();
142 142
143 template<class IFace> 143 template<class IFace>
144 IFace* load( const OPluginItem& item, const QUuid& ); 144 IFace* load( const OPluginItem& item, const QUuid& );
145}; 145};
146 146
147/** 147/**
148 * \brief A class to manage order and activation of plugins 148 * \brief A class to manage order and activation of plugins
149 * 149 *
150 * Manage order and activation. This is used by the Opie::Ui::OPluginConfig 150 * Manage order and activation. This is used by the Opie::Ui::OPluginConfig
151 * This class controls the activation and order of plugins depending 151 * This class controls the activation and order of plugins depending
152 * on the OPluginLoader you supply. 152 * on the OPluginLoader you supply.
153 * You must call load() and save after construnction an instance 153 * You must call load() and save after construnction an instance
154 * 154 *
155 * @see Opie::Ui::OPluginConfig 155 * @see Opie::Ui::OPluginConfig
156 * 156 *
157 */ 157 */
158class OPluginManager { 158class OPluginManager {
159public: 159public:
160 typedef QValueList<OPluginManager*> List; 160 typedef QValueList<OPluginManager*> List;
161 OPluginManager( OGenericPluginLoader* ); 161 OPluginManager( OGenericPluginLoader* );
162 OPluginManager( const QString& name, const OPluginItem::List&, bool isSorted = false ); 162 OPluginManager( const QString& name, const OPluginItem::List&, bool isSorted = false );
163 virtual ~OPluginManager(); 163 virtual ~OPluginManager();
164 164
165 OPluginItem crashedPlugin()const; 165 OPluginItem crashedPlugin()const;
166 166
167 OPluginItem::List managedPlugins()const; 167 OPluginItem::List managedPlugins()const;
168 168
169 void setPosition( const OPluginItem& ); 169 void setPosition( const OPluginItem& );
170 void enable( const OPluginItem& ); 170 void enable( const OPluginItem& );
171 void disable( const OPluginItem& ); 171 void disable( const OPluginItem& );
172 void setEnabled( const OPluginItem&, bool = true); 172 void setEnabled( const OPluginItem&, bool = true);
173 173
174 virtual void load(); 174 virtual void load();
175 virtual void save(); 175 virtual void save();
176 176
177protected: 177protected:
178 QString configName()const; 178 QString configName()const;
179 void replace( const OPluginItem& ); 179 void replace( const OPluginItem& );
180private: 180private:
181 OGenericPluginLoader *m_loader; 181 OGenericPluginLoader *m_loader;
182 QString m_cfgName; 182 QString m_cfgName;
183 OPluginItem::List m_plugins; 183 OPluginItem::List m_plugins;
184 OPluginItem m_crashed; 184 OPluginItem m_crashed;
185 bool m_isSorted : 1; 185 bool m_isSorted : 1;
186}; 186};
187 187
188 188
189/** 189/**
190 * This is a template method allowing you to safely cast 190 * This is a template method allowing you to safely cast
191 * your load function 191 * your load function
192 * 192 *
193 * \code 193 * \code
194 * MyTypePlugin *plug = load->load<MyTypePlugin>( item, IID_MyPlugin ); 194 * MyTypePlugin *plug = load->load<MyTypePlugin>( item, IID_MyPlugin );
195 * \endcode 195 * \endcode
196 * 196 *
197 */ 197 */
198template<class IFace> 198template<class IFace>
199IFace* OPluginLoader::load( const OPluginItem& item, const QUuid& uid ) { 199IFace* OPluginLoader::load( const OPluginItem& item, const QUuid& uid ) {
200 return static_cast<IFace*>( OGenericPluginLoader::load( item, uid ) ); 200 return static_cast<IFace*>( OGenericPluginLoader::load( item, uid ) );
201} 201}
202 202
203} 203}
204} 204}
205 205
206 206
207#endif 207#endif