author | zecke <zecke> | 2004-05-17 21:22:51 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-05-17 21:22:51 (UTC) |
commit | f3d15e6f81369f8495811c7c3624e51d032615ba (patch) (unidiff) | |
tree | 8319000a9aa8634a4214306ca19ac49dbcc5bc2b /libopie2/opiecore/opluginloader.h | |
parent | e0d8fdf2bcf61f8b6793ee757de35b985aef1b8d (diff) | |
download | opie-f3d15e6f81369f8495811c7c3624e51d032615ba.zip opie-f3d15e6f81369f8495811c7c3624e51d032615ba.tar.gz opie-f3d15e6f81369f8495811c7c3624e51d032615ba.tar.bz2 |
OPluginManager first bits of saving, enabling and sorting Plugin Config
At least it compiles, test and GUI will come this week
Diffstat (limited to 'libopie2/opiecore/opluginloader.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opiecore/opluginloader.h | 59 |
1 files changed, 42 insertions, 17 deletions
diff --git a/libopie2/opiecore/opluginloader.h b/libopie2/opiecore/opluginloader.h index 6166b75..2f9ec2a 100644 --- a/libopie2/opiecore/opluginloader.h +++ b/libopie2/opiecore/opluginloader.h | |||
@@ -34,5 +34,7 @@ public: | |||
34 | OPluginItem(); | 34 | OPluginItem(); |
35 | OPluginItem( const QString& name, const QString& path, 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; | ||
39 | |||
38 | bool operator==( const OPluginItem& )const; | 40 | bool operator==( const OPluginItem& )const; |
@@ -43,2 +45,3 @@ public: | |||
43 | QString path()const; | 45 | QString path()const; |
46 | bool isEnabled()const; | ||
44 | int position()const; | 47 | int position()const; |
@@ -47,2 +50,3 @@ public: | |||
47 | void setPath( const QString& ); | 50 | void setPath( const QString& ); |
51 | void setEnabled( bool ); | ||
48 | void setPosition( int ); | 52 | void setPosition( int ); |
@@ -52,2 +56,3 @@ private: | |||
52 | QString m_path; | 56 | QString m_path; |
57 | bool m_enabled : 1; | ||
53 | int m_pos; | 58 | int m_pos; |
@@ -78,3 +83,4 @@ public: | |||
78 | 83 | ||
79 | 84 | QString name()const; | |
85 | bool isSorted()const; | ||
80 | bool isInSafeMode()const; | 86 | bool isInSafeMode()const; |
@@ -82,4 +88,4 @@ public: | |||
82 | 88 | ||
83 | List allAvailable(bool sorted = FALSE)const; | 89 | List allAvailable(bool sorted = false )const; |
84 | List filtered(bool sorted = FALSE)const; | 90 | List filtered(bool sorted = false )const; |
85 | 91 | ||
@@ -90,2 +96,3 @@ public: | |||
90 | protected: | 96 | protected: |
97 | friend class OPluginManager; // we need the static unlibify | ||
91 | void readConfig(); | 98 | void readConfig(); |
@@ -94,6 +101,4 @@ protected: | |||
94 | void setPluginDir( const QString& ); | 101 | void setPluginDir( const QString& ); |
95 | bool isSorted()const; | ||
96 | void setSafeMode(const QString& app = QString::null, bool b = false); | 102 | void setSafeMode(const QString& app = QString::null, bool b = false); |
97 | static QString unlibify( const QString& str ); | 103 | static QString unlibify( const QString& str ); |
98 | |||
99 | private: | 104 | private: |
@@ -135,3 +140,3 @@ public: | |||
135 | OPluginLoader( const QString& name, bool sorted = false ); | 140 | OPluginLoader( const QString& name, bool sorted = false ); |
136 | ~OPluginLoader(); | 141 | virtual ~OPluginLoader(); |
137 | 142 | ||
@@ -142,3 +147,3 @@ public: | |||
142 | /** | 147 | /** |
143 | * \brief A class to manager order and activation of plugins | 148 | * \brief A class to manage order and activation of plugins |
144 | * | 149 | * |
@@ -147,4 +152,5 @@ public: | |||
147 | * on the OPluginLoader you supply. | 152 | * on the OPluginLoader you supply. |
153 | * You must call load() and save after construnction an instance | ||
148 | * | 154 | * |
149 | * @see OPluginConfig | 155 | * @see Opie::Ui::OPluginConfig |
150 | * | 156 | * |
@@ -153,9 +159,9 @@ class OPluginManager { | |||
153 | public: | 159 | public: |
154 | OPluginManager( OGenericPluginLoader* , const QString& name); | 160 | OPluginManager( OGenericPluginLoader* ); |
155 | OPluginManager( OConfig* conf, const QString&, | 161 | OPluginManager( const QString& name, const OPluginItem::List&, bool isSorted = false ); |
156 | const QCString& group, const OPluginItem::List& ); | 162 | virtual ~OPluginManager(); |
157 | ~OPluginManager(); | ||
158 | 163 | ||
159 | QString name(); | 164 | OPluginItem crashedPlugin()const; |
160 | void setName( const QString& ); | 165 | |
166 | OPluginItem::List managedPlugins()const; | ||
161 | 167 | ||
@@ -166,4 +172,14 @@ public: | |||
166 | 172 | ||
167 | void load(); | 173 | virtual void load(); |
168 | void save(); | 174 | virtual void save(); |
175 | |||
176 | protected: | ||
177 | QString configName()const; | ||
178 | void replace( const OPluginItem& ); | ||
179 | private: | ||
180 | OGenericPluginLoader *m_loader; | ||
181 | QString m_cfgName; | ||
182 | OPluginItem::List m_plugins; | ||
183 | OPluginItem m_crashed; | ||
184 | bool m_isSorted : 1; | ||
169 | }; | 185 | }; |
@@ -171,2 +187,11 @@ public: | |||
171 | 187 | ||
188 | /** | ||
189 | * This is a template method allowing you to safely cast | ||
190 | * your load function | ||
191 | * | ||
192 | * \code | ||
193 | * MyTypePlugin *plug = load->load<MyTypePlugin>( item, IID_MyPlugin ); | ||
194 | * \endcode | ||
195 | * | ||
196 | */ | ||
172 | template<class IFace> | 197 | template<class IFace> |