summaryrefslogtreecommitdiff
path: root/libopie2
authorzecke <zecke>2004-03-13 20:18:55 (UTC)
committer zecke <zecke>2004-03-13 20:18:55 (UTC)
commitcf61e44678f1b74e97c61e57ffb63a7bcf794577 (patch) (unidiff)
tree2a85e577d92a818447d866c70460196d2fc8c32f /libopie2
parent6d08277737e22b7a1527124623f3571969073ddf (diff)
downloadopie-cf61e44678f1b74e97c61e57ffb63a7bcf794577.zip
opie-cf61e44678f1b74e97c61e57ffb63a7bcf794577.tar.gz
opie-cf61e44678f1b74e97c61e57ffb63a7bcf794577.tar.bz2
Change OApplicationFactory to be in Opie::Core as well
Diffstat (limited to 'libopie2') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/oapplicationfactory.h14
1 files changed, 8 insertions, 6 deletions
diff --git a/libopie2/opiecore/oapplicationfactory.h b/libopie2/opiecore/oapplicationfactory.h
index 6e10552..4518174 100644
--- a/libopie2/opiecore/oapplicationfactory.h
+++ b/libopie2/opiecore/oapplicationfactory.h
@@ -52,12 +52,13 @@
52#include <qmetaobject.h> 52#include <qmetaobject.h>
53 53
54#include <qtopia/qcom.h> 54#include <qtopia/qcom.h>
55#include <qtopia/applicationinterface.h> 55#include <qtopia/applicationinterface.h>
56 56
57namespace Opie { 57namespace Opie {
58namespace Core {
58 struct NullType; 59 struct NullType;
59 60
60 template <class T, class U> 61 template <class T, class U>
61 struct Typelist 62 struct Typelist
62 { 63 {
63 typedef T Head; 64 typedef T Head;
@@ -91,13 +92,12 @@ public:
91template<> 92template<>
92struct MakeTypelist<> 93struct MakeTypelist<>
93{ 94{
94 typedef NullType Result; 95 typedef NullType Result;
95}; 96};
96 97
97}
98 98
99/** 99/**
100 * To allow your application to be quick launched some one needs 100 * To allow your application to be quick launched some one needs
101 * to create the QWidget. 101 * to create the QWidget.
102 * This is this factory. Make surce your widget has static QString Widget::appName() 102 * This is this factory. Make surce your widget has static QString Widget::appName()
103 * as one of its functions. 103 * as one of its functions.
@@ -160,13 +160,13 @@ struct OPrivate {
160 list << Product::appName(); 160 list << Product::appName();
161 return list; 161 return list;
162 } 162 }
163}; 163};
164 164
165template <> 165template <>
166struct OPrivate<Opie::NullType > { 166struct OPrivate<Opie::Core::NullType > {
167 inline static QWidget* multiFactory ( const QString& , QWidget* , 167 inline static QWidget* multiFactory ( const QString& , QWidget* ,
168 const char* , Qt::WFlags ) { 168 const char* , Qt::WFlags ) {
169 return 0l; 169 return 0l;
170 } 170 }
171 inline static QStringList multiString( const QStringList& _list ) { 171 inline static QStringList multiString( const QStringList& _list ) {
172 return _list; 172 return _list;
@@ -185,13 +185,13 @@ struct OPrivate <Opie::NullType, Opie::NullType > {
185 return _list; 185 return _list;
186 } 186 }
187}; 187};
188*/ 188*/
189 189
190template <class Product, class ProductListTail> 190template <class Product, class ProductListTail>
191struct OPrivate< Opie::Typelist<Product, ProductListTail> > { 191struct OPrivate< Opie::Core::Typelist<Product, ProductListTail> > {
192 inline static QWidget* multiFactory( const QString& appName, QWidget* parent, 192 inline static QWidget* multiFactory( const QString& appName, QWidget* parent,
193 const char* name, Qt::WFlags fl) { 193 const char* name, Qt::WFlags fl) {
194 QWidget* wid = OPrivate<Product>::multiFactory( appName, parent, name, fl ); 194 QWidget* wid = OPrivate<Product>::multiFactory( appName, parent, name, fl );
195 195
196 if (!wid ) 196 if (!wid )
197 wid = OPrivate<ProductListTail>::multiFactory( appName, parent, name, fl ); 197 wid = OPrivate<ProductListTail>::multiFactory( appName, parent, name, fl );
@@ -225,13 +225,13 @@ struct OPrivate< Opie::Typelist<Product, ProductListTail> > {
225 * 225 *
226 * typedef Opie::MakeTypeList<MyWidget, MyDialog, MyMediaPlayer >::Result MyTypes; 226 * typedef Opie::MakeTypeList<MyWidget, MyDialog, MyMediaPlayer >::Result MyTypes;
227 * OPIE_EXPORT_APP( OApplicationFactory<MyTypes> ) 227 * OPIE_EXPORT_APP( OApplicationFactory<MyTypes> )
228 */ 228 */
229 229
230template<class Product, class ProductListTail> 230template<class Product, class ProductListTail>
231struct OApplicationFactory< Opie::Typelist<Product, ProductListTail > > 231struct OApplicationFactory< Opie::Core::Typelist<Product, ProductListTail > >
232 : ApplicationInterface { 232 : ApplicationInterface {
233 QRESULT queryInterface( const QUuid &uuid, QUnknownInterface **iface ) { 233 QRESULT queryInterface( const QUuid &uuid, QUnknownInterface **iface ) {
234 *iface = 0; 234 *iface = 0;
235 if ( uuid == IID_QUnknown ) *iface = this; 235 if ( uuid == IID_QUnknown ) *iface = this;
236 else if ( uuid ==IID_QtopiaApplication ) *iface = this; 236 else if ( uuid ==IID_QtopiaApplication ) *iface = this;
237 else return QS_FALSE; 237 else return QS_FALSE;
@@ -239,23 +239,25 @@ struct OApplicationFactory< Opie::Typelist<Product, ProductListTail > >
239 return QS_OK; 239 return QS_OK;
240 } 240 }
241 241
242 QWidget* createMainWindow ( const QString& appName, QWidget* parent, 242 QWidget* createMainWindow ( const QString& appName, QWidget* parent,
243 const char* name, Qt::WFlags fl ) { 243 const char* name, Qt::WFlags fl ) {
244 qWarning("StringList is %s", applications().join(":").latin1() ); 244 qWarning("StringList is %s", applications().join(":").latin1() );
245 return OPrivate< Opie::Typelist<Product, ProductListTail > >::multiFactory( appName, parent, name, fl ); 245 return OPrivate< Opie::Core::Typelist<Product, ProductListTail > >::multiFactory( appName, parent, name, fl );
246 } 246 }
247 247
248 QStringList applications()const { 248 QStringList applications()const {
249 QStringList _list; 249 QStringList _list;
250 return OPrivate< Opie::Typelist<Product, ProductListTail> >::multiString( _list ); 250 return OPrivate< Opie::Core::Typelist<Product, ProductListTail> >::multiString( _list );
251 } 251 }
252 252
253 Q_REFCOUNT 253 Q_REFCOUNT
254}; 254};
255 255
256}
257}
256 258
257/* If the library version should be build */ 259/* If the library version should be build */
258#ifdef OPIE_APP_INTERFACE 260#ifdef OPIE_APP_INTERFACE
259#define OPIE_EXPORT_APP( factory ) Q_EXPORT_INTERFACE() { Q_CREATE_INSTANCE( factory ) } 261#define OPIE_EXPORT_APP( factory ) Q_EXPORT_INTERFACE() { Q_CREATE_INSTANCE( factory ) }
260#else 262#else
261 263