Konqueror • Technical • Embedded tutorial • Part 2

Embedded Components Tutorial - Page 2

Note: This is very old (KDE 1/KDE 2 times) and thus information and links might not be correct anymore.

Introducing aKtion!

Introduction

If you have used konqueror at all, you have no doubt noticed its ability to "embed" components for viewing certain types of files. The two best known examples are viewing images using the embedded kview and viewing postscript or PDF files using kghostview.

The technology behind the embedding is pretty impressive... but the authors took great pains to make the API as easy to use as possible. In fact, this tutorial will show you just how incredibly easy it is to convert an existing application into an embedded component. It will take exactly four tiny steps!

The four steps are as follows:

  1. Convert application to shared library (simple change in Makefile)
  2. Add boilerplate KParts component (add one standard file)
  3. Connect existing app to KParts (a few lines of code)
  4. Add toolbar and menu entries (a few more lines of code)

It took this author exactly 15 minutes to convert the example application to an embedded component.. and it took that long only because of some quirks in the existing app. The conversion to KParts was trivial.

Introducing aKtion!

The application that this tutorial will use as it's example is 'aKtion!' aKtion is a KDE video player based on xanim. It can play most common forms of animation (AVI, Quicktime, MPEG, etc). With the conclusion of this tutorial, it will be able to play those animations inside of Konqueror!

There is one small catch to this: you must start with the version of aKtion supplied with this tutorial. There are two "official" versions of aKtion. One is still based on KDE 1.x and is not suitable for KParts. The other is in kdemultimedia and is already converted to KParts! So, if you want to follow along, use this version.

Getting Started

The first step is to get the aKtion source package compiled and installed just to test what it currently does. This assumes that you have a working KDE2 development system. If you do not, read this first!

Follow these steps:

  1. Unpack the aKtion source package
    % gzip -dc aktion-1.99.tar.gz | tar xvpf -
    
  2. Build and install it
    % cd aktion-1.99 && ./configure && make && make install
    

Now find an animation file somewhere -- either on your local hard drive or on the web and click on it. You should see that Konqueror will download the file (if it is remote) and pass it to aKtion to play. Pretty standard, huh?

[ Edit ]

Global navigation links