

Given the constaints, we will now see what the header file
theme2k.h looks
like this:
Example 5.1. Listing for theme2k.h
#ifndef __THEME2K_H__
#define __THEME2K_H__
#include <qlabel.h>
#include <qwidget.h>
#include <kdialogbase.h>
#include <kpixmap.h>
#include <ksplash/themeengine.h>
class RotWidget;
class Cfg2k: public ThemeEngineConfig
{
Q_OBJECT
public:
Cfg2k( KConfig * );
};
class ObjKsTheme;
class Theme2k: public ThemeEngine
{
Q_OBJECT
public:
Theme2k( QWidget *, const char *, const QStringList& );
inline const QString name()
{
return( QString("KSplash2k") );
}
inline const KDialogBase *config( KConfig *kc )
{
return new Cfg2k( kc );
}
static QStringList names()
{
QStringList Names;
Names << "KSplash2k";
Names << "ks2k";
Names << "2k";
Names << "2000";
return( Names );
};
public slots:
inline void slotSetText( const QString& s )
{
if( mText && mText->text() != s ) mText->setText( s );
};
private:
void initUi();
void readSettings();
QLabel *mText;
RotWidget *mRotator;
QColor mTBgColor, mTFgColor, mRotColor1, mRotColor2, mStatusColor;
int mRotSpeed;
QString mWndTitle, mLogoFile;
};
#endif
Let us analyze the listing above. The Theme2k class
satisfies
the naming conventions, and is inherited from
ThemeEngine. It provides
a Theme2k::names(), and has a constructor that takes
the required
parameters: Theme2k( QWidget *, const char *, const QStringList&
);
and also provides a simple Theme2k::slotSetText()
method. For the moment,
do not worry about the RotWidget class. It is a small
widget that provides
some eye candy for the user. Our plugin is very simple and does not display any
icons or show
a progressbar. If you would like to display icons, override the
slotSetPixmap
function. Similar functions exist for setting the progressbar range
(slotUpdateSteps)
and incrementing(slotUpdateProgress) the current step.