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 local environment.
Developers access this architecture by creating a plugin for Qtopia Desktop which is written by implementing interfaces the defined by Qtopia Desktop.
The following table describes available interfaces:
| Interface | Description |
|---|---|
| PlugInterface | Visual plugins for entering information or tranfering documents |
| SyncAppInterface, MergeInterface | Synchronize data and files |
| ImportInterface | Import external data to Qtopia |
| ExportInterface | Export data from Qtopia (not yet supported) |
Qtopia Desktop provides each plugin with access to the CenterInterface class which allows a plugin to use the functionality provided by Qtopia Desktop.
On startup Qtopia Desktop:
Each plugin implementation needs to define some pure virtual methods defined in the plugin hierarchy. Each plugin must define the following methods:
QRESULT queryInterface( const QUuid&, QUnknownInterface** );
Q_REFCOUNT
QString name() const;
QString description() const;
QString version() const;
QString author() const;
The name() method and queryInterface() are the most important while description(), version() and author() methods are all purely informational and not currently displayed by Qtopia Desktop.
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 a plugin implements when it registers the plugin at startup.
In the .cpp file for the interface, the following code must be present
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;
}
The implementation of the queryInterface() method depends on the interfaces a plugin is implementing. Each plugin should have only one implementation of queryInterface(). However, each plugin may implement more than one interface as shown above and multiple interfaces may be implemented by the same class. All interfaces other than SyncAppInterface implement both QUnknownInterface and QComponentInformationInterface and should return as such.
| Copyright © 2005 Trolltech | Trademarks | Qtopia version 2.1.2
|