![]() Qtopia Home - Classes - Hierachy - Annotated - Functions - Qt Embedded |
![]() |
Qtopia Desktop has modular and flexible design allowing end-users to easily install plugins to integrate Qtopia into their daily work environment.
Developers can access this architecture by writing a plugin for Qtopia Desktop. A plugin is written by implementing interfaces defined by Qtopia Desktop.
The available interfaces allow the developer to:
Qtopia Desktop provides each plugin with access to the CenterInterface. The CenterInterface class allows each plugin to use the functionality provided by Qtopia Desktop.
When Qtopia Desktop starts up it scans for plugins and registers any
plugins that support the interfaces. Qtopia Desktop will look in the
subdirectory under the installed directory called lib. Plugin
installations should place their shared object libraries in the
Each plugin implementation needs to define some pure virtual methods defined
in the plugin hierarchy. Each plugin must define the following methods:
The name() method and queryInterface() are the most important. The
description(), version() and author() methods are all purely
informational and not currently displayed by Qtopia Desktop but maybe
in the future.
The PluginInterface::name() method defines the display name shown in
the plugin selection area on the left hand side of the screen. The
name() method is purely descriptive for all other interfaces.
The implementation of queryInterface() allows Qtopia
Desktop determine what type of interface your plugin implements when
it registers your plugin at startup.
In the the interfaces .cpp file, the following code must be present
The exact implementation of the queryInterface() method depends on
which interfaces your plugin is implementing. Each plugin should
only have one implementation of queryInterface. Each plugin can
implement more than one interface as shown above. (And multiple
interfaces can be implemented by the same class as shown
above). Every interface other than SyncAppInterface implements both
QUnknownInterface and QComponentInformationInterface and should
return as such as shown above.
Implementing a Plugin
QRESULT queryInterface( const QUuid&, QUnknownInterface** );
Q_REFCOUNT
QString name() const;
QString description() const;
QString version() const;
QString author() const;
Q_EXPORT_INTERFACE()
{
Q_CREATE_INSTANCE( AddressBook )
}
QRESULT AddressBook::queryInterface( const QUuid &uuid,
QUnknownInterface** iface )
{
*iface = 0;
if ( uuid == IID_QUnknown )
*iface = (QUnknownInterface*) (PluginInterface*) this;
else if ( uuid == IID_QComponentInformation )
*iface = (QComponentInformationInterface*)(PluginInterface *) this;
else if ( uuid == IID_PalmtopCenterPlugin )
*iface = (PluginInterface*)this;
else if ( uuid == IID_SyncAppInterface )
*iface = (SyncAppInterface*)this;
else if ( uuid == IID_MergeInterface )
*iface = (MergeInterface*)this;
else
return QE_NOINTERFACE;
(*iface)->addRef();
return QS_OK;
}
Copyright © 2001-2005 Trolltech
Trademarks