Development/Tutorials/Services/Plugins: Difference between revisions

From KDE TechBase
No edit summary
 
No edit summary
Line 10: Line 10:


== Abstract ==
== Abstract ==
Before starting with the code let's see which advantages we can undertake
developing a plugin structured application. First of all an application capable
of managing plugins can extend its features with apparently no limits. Anyway, rather than developing a plugin structured application because "it's so coool!!" the developer should think about the real advantages of this kind of development. For instance we can think about an archive manager application: the main program can delegate the creation/extraction/editing of each type of archive to specific plugins. This way we give modularity to the application so that supporting brand new archive types in the future will simply consist in writing the specific plugin and not rewriting the whole application. Ok, then let's stop talking.. and start coding =).
== The Text Editor Example ==
So, even if an archiving application would be nicer to look at, here we will examine a simple text editing application capable of plugin loading.
Each plugin will simply give a specific text editing feature.


== Creating a Plugin Interface Class ==
== Creating a Plugin Interface Class ==

Revision as of 13:59, 30 October 2008

Creating and Loading Plugins Using KService
Tutorial Series   Services
Previous   Traders: Querying the System
What's Next   n/a
Further Reading   n/a

Abstract

Before starting with the code let's see which advantages we can undertake developing a plugin structured application. First of all an application capable of managing plugins can extend its features with apparently no limits. Anyway, rather than developing a plugin structured application because "it's so coool!!" the developer should think about the real advantages of this kind of development. For instance we can think about an archive manager application: the main program can delegate the creation/extraction/editing of each type of archive to specific plugins. This way we give modularity to the application so that supporting brand new archive types in the future will simply consist in writing the specific plugin and not rewriting the whole application. Ok, then let's stop talking.. and start coding =).

The Text Editor Example

So, even if an archiving application would be nicer to look at, here we will examine a simple text editing application capable of plugin loading. Each plugin will simply give a specific text editing feature.

Creating a Plugin Interface Class

The Plugin Factory Macro

Registering a Plugin Type

Registering a Plugin With the SyCoCa

Finding Plugins

Instantiating Plugins