author | kergoth <kergoth> | 2003-05-13 20:02:32 (UTC) |
---|---|---|
committer | kergoth <kergoth> | 2003-05-13 20:02:32 (UTC) |
commit | 4dd58bba07b8bf3a52c3a0464675c39cc5153c85 (patch) (unidiff) | |
tree | a9031549d675f3c108f05b06d2fcdd62f2433c7e | |
parent | ad81c3ef20399c22663e67c5ac09aae4d0aeda21 (diff) | |
download | opie-4dd58bba07b8bf3a52c3a0464675c39cc5153c85.zip opie-4dd58bba07b8bf3a52c3a0464675c39cc5153c85.tar.gz opie-4dd58bba07b8bf3a52c3a0464675c39cc5153c85.tar.bz2 |
Add beginnings of a new plugin interface.
-rw-r--r-- | core/apps/oapp/.cvsignore | 1 | ||||
-rw-r--r-- | core/apps/oapp/config.in | 4 | ||||
-rw-r--r-- | core/apps/oapp/oapp.pro | 21 | ||||
-rw-r--r-- | core/apps/oapp/oappinterface.h | 24 | ||||
-rw-r--r-- | core/apps/oapp/oappplugin.cpp | 43 | ||||
-rw-r--r-- | core/apps/oapp/oappplugin.h | 30 |
6 files changed, 123 insertions, 0 deletions
diff --git a/core/apps/oapp/.cvsignore b/core/apps/oapp/.cvsignore new file mode 100644 index 0000000..24e5b0a --- a/dev/null +++ b/core/apps/oapp/.cvsignore | |||
@@ -0,0 +1 @@ | |||
.build | |||
diff --git a/core/apps/oapp/config.in b/core/apps/oapp/config.in new file mode 100644 index 0000000..2ace6dd --- a/dev/null +++ b/core/apps/oapp/config.in | |||
@@ -0,0 +1,4 @@ | |||
1 | config OAPP | ||
2 | boolean "OApp Plugin" | ||
3 | default "n" | ||
4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE | ||
diff --git a/core/apps/oapp/oapp.pro b/core/apps/oapp/oapp.pro new file mode 100644 index 0000000..4ef07af --- a/dev/null +++ b/core/apps/oapp/oapp.pro | |||
@@ -0,0 +1,21 @@ | |||
1 | TEMPLATE= lib | ||
2 | CONFIG = qt warn_on release | ||
3 | |||
4 | TARGET = oapp | ||
5 | VERSION = 1.0.0 | ||
6 | |||
7 | LIBS += -lqpe -lopie | ||
8 | HEADERS = \ | ||
9 | oappplugin.h \ | ||
10 | oappinterface.h | ||
11 | SOURCES = \ | ||
12 | oappplugin.cpp | ||
13 | |||
14 | DESTDIR = $(OPIEDIR)/lib$(PROJMAK) | ||
15 | INCLUDEPATH+= $(OPIEDIR)/include | ||
16 | DEPENDPATH+= $(OPIEDIR)/include . | ||
17 | MOC_DIR = .build | ||
18 | OBJECTS_DIR= .build | ||
19 | UI_DIR = .build | ||
20 | |||
21 | include ( $(OPIEDIR)/include.pro ) | ||
diff --git a/core/apps/oapp/oappinterface.h b/core/apps/oapp/oappinterface.h new file mode 100644 index 0000000..6474852 --- a/dev/null +++ b/core/apps/oapp/oappinterface.h | |||
@@ -0,0 +1,24 @@ | |||
1 | #ifndef __OPIEAPPINTERFACE_H | ||
2 | #define __OPIEAPPINTERFACE_H | ||
3 | |||
4 | #include <qlist.h> | ||
5 | #include <qpe/qcom.h> | ||
6 | |||
7 | class QWidget; | ||
8 | |||
9 | #ifndef QT_NO_COMPONENT | ||
10 | // {16556BFC-891D-46A9-BE59-DBa158C3A266} | ||
11 | #ifndef IID_OAppInterface | ||
12 | #define IID_OAppInterface QUuid( 0x16556bfc, 0x891d, 0x46a9, 0xbe, 0x59, 0xdb, 0xa1, 0x58, 0xc3, 0xa2, 0x66) | ||
13 | #endif | ||
14 | #endif | ||
15 | |||
16 | enum OAppPos { leftPos, midPos, rightPos }; | ||
17 | |||
18 | struct OAppInterface : public QUnknownInterface | ||
19 | { | ||
20 | virtual QList<QWidget> widgets() = 0; | ||
21 | virtual OAppPos position() const = 0; | ||
22 | }; | ||
23 | |||
24 | #endif // __OPIEAPPINTERFACE_H | ||
diff --git a/core/apps/oapp/oappplugin.cpp b/core/apps/oapp/oappplugin.cpp new file mode 100644 index 0000000..934594f --- a/dev/null +++ b/core/apps/oapp/oappplugin.cpp | |||
@@ -0,0 +1,43 @@ | |||
1 | #include "oappinterface.h" | ||
2 | #include "oappplugin.h" | ||
3 | #include <qlist.h> | ||
4 | #include <qwidget.h> | ||
5 | #include <qpe/quuid.h> | ||
6 | |||
7 | OAppPlugin::OAppPlugin(OAppPos pos) | ||
8 | { | ||
9 | m_position = pos; | ||
10 | }; | ||
11 | |||
12 | OAppPlugin::OAppPlugin(QWidget *widget, OAppPos pos) | ||
13 | { | ||
14 | m_widgets.append( widget ); | ||
15 | m_position = pos; | ||
16 | }; | ||
17 | |||
18 | OAppPlugin::~OAppPlugin() | ||
19 | { | ||
20 | }; | ||
21 | |||
22 | QList<QWidget> OAppPlugin::widgets() | ||
23 | { | ||
24 | return m_widgets; | ||
25 | }; | ||
26 | |||
27 | OAppPos OAppPlugin::position() const | ||
28 | { | ||
29 | return m_position; | ||
30 | } | ||
31 | |||
32 | QRESULT OAppPlugin::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) | ||
33 | { | ||
34 | *iface = 0; | ||
35 | if ( uuid == IID_QUnknown ) | ||
36 | *iface = this; | ||
37 | else if ( uuid == IID_OAppInterface ) | ||
38 | *iface = this; | ||
39 | |||
40 | if ( *iface ) | ||
41 | (*iface)->addRef(); | ||
42 | return QS_OK; | ||
43 | } | ||
diff --git a/core/apps/oapp/oappplugin.h b/core/apps/oapp/oappplugin.h new file mode 100644 index 0000000..698d171 --- a/dev/null +++ b/core/apps/oapp/oappplugin.h | |||
@@ -0,0 +1,30 @@ | |||
1 | #ifndef __OAPPPLUGIN_H | ||
2 | #define __OAPPPLUGIN_H | ||
3 | |||
4 | #include "oappinterface.h" | ||
5 | #include <qlist.h> | ||
6 | #include <qpe/quuid.h> | ||
7 | |||
8 | class QWidget; | ||
9 | |||
10 | class OAppPlugin : public OAppInterface | ||
11 | { | ||
12 | public: | ||
13 | OAppPlugin(OAppPos pos = midPos); | ||
14 | OAppPlugin(QWidget *widget, OAppPos pos = midPos); | ||
15 | virtual ~OAppPlugin(); | ||
16 | |||
17 | QList<QWidget> widgets(); | ||
18 | OAppPos position() const; | ||
19 | |||
20 | #ifndef QT_NO_COMPONENT | ||
21 | QRESULT queryInterface( const QUuid &uuid, QUnknownInterface **iface ); | ||
22 | Q_REFCOUNT | ||
23 | #endif | ||
24 | |||
25 | private: | ||
26 | QList<QWidget> m_widgets; | ||
27 | OAppPos m_position; | ||
28 | }; | ||
29 | |||
30 | #endif // __OAPPPLUGIN_H | ||