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