Provide an example (disabled, of course) of usage of the "new" GuiInterface in the KImageIO backend.

Add also an about data.

svn path=/trunk/KDE/kdegraphics/okular/; revision=705934
This commit is contained in:
Pino Toscano 2007-08-28 23:19:42 +00:00
parent a8d747745f
commit ea48a1b7f4
4 changed files with 51 additions and 1 deletions

View file

@ -20,3 +20,4 @@ install(TARGETS okularGenerator_kimgio DESTINATION ${PLUGIN_INSTALL_DIR})
install( FILES libokularGenerator_kimgio.desktop okularKimgio.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
install( FILES okularApplication_kimgio.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} )
#install( FILES gui.rc DESTINATION ${DATA_INSTALL_DIR}/okular_kimgio )

View file

@ -1,5 +1,7 @@
/***************************************************************************
* Copyright (C) 2005 by Albert Astals Cid <tsdgeos@terra.es> *
* Copyright (C) 2006-2007 by Pino Toscano <pino@kde.org> *
* Copyright (C) 2006-2007 by Tobias Koenig <tokoe@kde.org> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
@ -13,6 +15,10 @@
#include <QtGui/QImageReader>
#include <QtGui/QPainter>
#include <kaboutdata.h>
#include <kaction.h>
#include <kactioncollection.h>
#include <kicon.h>
#include <klocale.h>
#include <kprinter.h>
@ -25,6 +31,33 @@ KIMGIOGenerator::KIMGIOGenerator()
{
setFeature( ReadRawData );
setFeature( Threaded );
KAboutData *about = new KAboutData(
"okular_kimgio",
"okular_kimgio",
ki18n( "Image Backend" ),
"0.1",
ki18n( "A simple image backend" ),
KAboutData::License_GPL,
ki18n( "© 2005 Albert Astals Cid\n"
"© 2006-2007 Pino Toscano\n"
"© 2006-2007 Tobias Koenig" )
);
about->addAuthor( ki18n( "Albert Astals Cid" ), KLocalizedString(), "aacid@kde.org" );
about->addAuthor( ki18n( "Pino Toscano" ), KLocalizedString(), "pino@kde.org" );
about->addAuthor( ki18n( "Tobias Koenig" ), KLocalizedString(), "tokoe@kde.org" );
setAboutData( about );
/*
setComponentData( *ownComponentData() );
setXMLFile( "gui.rc" );
KAction * kimgio_test = new KAction( this );
kimgio_test->setText( "Image test" );
kimgio_test->setIcon( KIcon( "smiley" ) );
connect( kimgio_test, SIGNAL( triggered( bool ) ), this, SLOT( slotTest() ) );
actionCollection()->addAction( "kimgio_test", kimgio_test );
*/
}
KIMGIOGenerator::~KIMGIOGenerator()
@ -104,5 +137,10 @@ bool KIMGIOGenerator::print( KPrinter& printer )
return true;
}
void KIMGIOGenerator::slotTest()
{
kDebug() << "Test";
}
#include "generator_kimgio.moc"

View file

@ -11,12 +11,14 @@
#define _OKULAR_GENERATOR_KIMGIO_H_
#include <core/generator.h>
#include <interfaces/guiinterface.h>
#include <QtGui/QImage>
class KIMGIOGenerator : public Okular::Generator
class KIMGIOGenerator : public Okular::Generator, public Okular::GuiInterface
{
Q_OBJECT
Q_INTERFACES( Okular::GuiInterface )
public:
KIMGIOGenerator();
virtual ~KIMGIOGenerator();
@ -32,6 +34,9 @@ class KIMGIOGenerator : public Okular::Generator
protected:
QImage image( Okular::PixmapRequest * request );
private slots:
void slotTest();
private:
QImage m_img;
};

6
generators/kimgio/gui.rc Normal file
View file

@ -0,0 +1,6 @@
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
<kpartgui version="1" name="okular_kimgio" >
<ToolBar name="mainToolBar"><text>Main Toolbar</text>
<Action name="kimgio_test" />
</ToolBar>
</kpartgui>