summaryrefslogtreecommitdiff
authorzecke <zecke>2004-05-28 16:20:57 (UTC)
committer zecke <zecke>2004-05-28 16:20:57 (UTC)
commit9521c1627157bf15824b5b55b9782b87cc610df6 (patch) (side-by-side diff)
treeee0d9dc734e8db0e85a3e4d6ad0ee548c31f4115
parent8db08a3d320e48924d0ccd78d2bd177e316fff90 (diff)
downloadopie-9521c1627157bf15824b5b55b9782b87cc610df6.zip
opie-9521c1627157bf15824b5b55b9782b87cc610df6.tar.gz
opie-9521c1627157bf15824b5b55b9782b87cc610df6.tar.bz2
Ideas of the API of the Generic PluginLoader
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opieui/opluginconfig.h36
-rw-r--r--libopie2/opieui/opluginconfigwidget.cpp136
2 files changed, 167 insertions, 5 deletions
diff --git a/libopie2/opieui/opluginconfig.h b/libopie2/opieui/opluginconfig.h
index bfee5bf..0db1fcb 100644
--- a/libopie2/opieui/opluginconfig.h
+++ b/libopie2/opieui/opluginconfig.h
@@ -22,5 +22,6 @@ namespace Ui {
* call save.
*
- * Internally we operate on Opie::Core::OPluginManager.
+ * Internally we operate on Opie::Core::OPluginManager. You can insert any numbers of loaders
+ * or pluginmanagers. But you need to call load() after you've inserted new items.
*
* @see Opie::Ui::OKeyConfigWidget
@@ -41,19 +42,42 @@ public:
WFlags fl );
- ~OPluginConfig();
+ virtual ~OPluginConfig();
- void setChangeMode( enum Mode );
+ void setChangeMode( enum ChangeMode );
ChangeMode mode()const;
void insert( const QString&, const Opie::Core::OPluginManager* );
- void insert( const QString&, const Opie::Core::OPluginLoader* );
+ void insert( const QString&, const Opie::Core::OGenericPluginLoader* );
signals:
/**
- * @param item The new OPluginItem
+ * A PluginItem was changed. This signal is only emitted if you're
+ * in the immediate ChangeMode.
+ * This is emitted on any change ( disable,enable,pos)
+ *
+ * @param item The OPluginItem that was changed. This is how it looks now
+ * @param old_state If it was enabled before
*/
void pluginChanged ( const Opie::Core::OPluginItem& item, bool old_state);
+
+ /**
+ * emitted only if you're in Immediate when an Item was enabled
+ *
+ * @param item The Item that was enabled
+ */
void pluginEnabled ( const Opie::Core::OPluginItem& item);
+
+ /**
+ * emitted only if you're in Immediate when an Item was enabled
+ *
+ * @param item The Item was disabled
+ */
void pluginDisabled( const Opie::Core::OPluginItem& item);
+
+ /**
+ * Data was saved(). Normally this is emitted when save() is called
+ * @see changed
+ */
+ void changed();
public:
@@ -61,4 +85,6 @@ public:
void save();
private:
+ ChangeMode m_mode;
+ QMap<Opie::Core::OPluginManager*, bool> m_items;
};
diff --git a/libopie2/opieui/opluginconfigwidget.cpp b/libopie2/opieui/opluginconfigwidget.cpp
new file mode 100644
index 0000000..359e7a1
--- a/dev/null
+++ b/libopie2/opieui/opluginconfigwidget.cpp
@@ -0,0 +1,136 @@
+/*
+ * LGPLv2 2004 zecke@handhelds.org
+ */
+
+
+#include "opluginconfig.h"
+
+#include <opie/opluginloader.h>
+
+using Opie::Core::OPluginManager;
+using Opie::Core::OGenericPluginLoader;
+
+namespace Opie {
+namespace Ui {
+
+}
+}
+
+/**
+ * C'tor compatible with all Qt Widgets in its arguments.
+ * After constructing you need to insert and call load()
+ *
+ * The default mode is Queued
+ *
+ * @param wid the Widget
+ * @param name The name of the widget
+ * @param fl The widget flags you may want to set
+ *
+ * @see QWidget::QWidget
+ */
+OPluginConfigWidget::OPluginConfigWidget( QWidget* wid, const char *name, WFlags fl )
+ : QWidget( wid, name, fl ), m_mode( Queued )
+{
+}
+
+/**
+ * C'tor where you can give a Opie::Core::OPluginManager and additional optional
+ * parameters.
+ *
+ * This call insert for the OPluginManager you pass to this method. You'll still
+ * need to call load after constructing this widget.
+ *
+ * Ownership will not be transfered
+ *
+ * The default mode is Queued
+ *
+ * @param manager The OPluginManager you pass
+ * @param wid The QWidget parent
+ * @param name the Name of the widget
+ * @param fl Possible Flags
+ *
+ */
+OPluginConfigWidget::OPluginConfigWidget( Opie::Core::OPluginManager* manager,
+ QWidget* wid, const char* name, WFlags fl )
+ : QWidget( wid, name, fl ), m_mode( Queued )
+{
+ insert( QString::null, manager );
+}
+
+
+/**
+ * C'tor where you can give a Opie::Core::OGenericPluginLoader and additional optional
+ * parameters. Internally we use a Opie::Core::OPluginManager on top of the loader.
+ *
+ * This call insert for the Opie::Core::OGenericPluginLoader you pass to this method.
+ * You'll still need to call load() after constructing this widget.
+ *
+ * It is still your OGenericPluginLoader and ownership is not transfered.
+ *
+ * The default mode is Queued
+ *
+ * @param manager The OGenericPluginLoader you pass
+ * @param wid The QWidget parent
+ * @param name the Name of the widget
+ * @param fl Possible Flags
+ *
+ */
+OPluginConfigWidget::OPluginConfigWidget( Opie::Core::OGenericPluginLoader* load,
+ QWidget* wid, const char* name, WFlags fl )
+ : QWidget( wid, name, fl ), m_mode( Queued )
+{
+ insert( QString::null, load );
+}
+
+/**
+ * d'tor. This does not save the changes if your in Queued mode
+ * make sure to call save() before destructing this widget.
+ */
+OPluginConfigWidget::~OPluginConfigWidget() {
+//
+}
+
+/**
+ * Set the ChangeMode of this widget. Currently there are two possible values.
+ * Immediate - all changes by the user are immediately applied and signals are emitted
+ * the signals emitted are plugin* and also changed() due calling save internally
+ * Queued - changes need to be saved manually. save() emits changed()
+ *
+ * @param mode the ChangeMode to use. Either use Immediate or Queued
+ */
+void OPluginConfigWidget::setChangeMode( enum OPluginConfigWidget::ChangeMode mode ) {
+ m_mode = mode;
+}
+
+/**
+ * Return the Mode
+ *
+ * @return Returns the change mode this widget is in.
+ * @see OPluginConfigWidget::ChangeMode
+ * @see OPluginConfigWidget::setChangeMode
+ */
+OPluginConfigWidget::ChangeMode OPluginConfigWidget::mode()const{
+ return m_mode;
+}
+
+/**
+ * Insert a PluginManager directly. Ownership is not transfered.
+ *
+ * @param name The name represented to the user
+ * @param mana The manager which should be inserted
+ */
+void OPluginConfigWidget::insert( const QString& name, const Opie::Core::OPluginManager* mana) {
+
+}
+
+/**
+ *
+ * @param name The name
+ *
+ */
+void OPluginConfigWidget::insert( const QString& name, const Opie::Core::OGenericPluginLoader* load) {
+
+}
+
+}
+}