mirror of
https://invent.kde.org/graphics/okular
synced 2024-10-02 14:14:10 +00:00
Font selector for TextDocumentGenerator
REVIEW: 109021
This commit is contained in:
parent
7ee70a7140
commit
1fdb0a0a06
|
@ -61,6 +61,7 @@ set(okularcore_SRCS
|
|||
core/sound.cpp
|
||||
core/sourcereference.cpp
|
||||
core/textdocumentgenerator.cpp
|
||||
core/textdocumentsettings.cpp
|
||||
core/textpage.cpp
|
||||
core/tilesmanager.cpp
|
||||
core/utils.cpp
|
||||
|
@ -77,6 +78,10 @@ set(okularcore_SRCS
|
|||
core/script/kjs_util.cpp
|
||||
)
|
||||
|
||||
kde4_add_ui_files(okularcore_SRCS
|
||||
conf/textdocumentsettings.ui
|
||||
)
|
||||
|
||||
install( FILES
|
||||
core/action.h
|
||||
core/annotations.h
|
||||
|
@ -93,6 +98,7 @@ install( FILES
|
|||
core/sound.h
|
||||
core/sourcereference.h
|
||||
core/textdocumentgenerator.h
|
||||
core/textdocumentsettings.h
|
||||
core/textpage.h
|
||||
core/tile.h
|
||||
core/utils.h
|
||||
|
|
13
conf/textdocumentsettings.ui
Normal file
13
conf/textdocumentsettings.ui
Normal file
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>TextDocumentSettings</class>
|
||||
<widget class="QWidget" name="TextDocumentSettings">
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||
</property>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -213,36 +213,73 @@ void TextDocumentGeneratorPrivate::generateTitleInfos()
|
|||
}
|
||||
}
|
||||
|
||||
void TextDocumentGeneratorPrivate::initializeGenerator()
|
||||
{
|
||||
Q_Q( TextDocumentGenerator );
|
||||
|
||||
mConverter->d_ptr->mParent = q->d_func();
|
||||
|
||||
if ( mGeneralSettings ) {
|
||||
mFont = mGeneralSettings->font();
|
||||
}
|
||||
|
||||
q->setFeature( Generator::TextExtraction );
|
||||
q->setFeature( Generator::PrintNative );
|
||||
q->setFeature( Generator::PrintToFile );
|
||||
#ifdef OKULAR_TEXTDOCUMENT_THREADED_RENDERING
|
||||
if ( QFontDatabase::supportsThreadedFontRendering() )
|
||||
q->setFeature( Generator::Threaded );
|
||||
#endif
|
||||
|
||||
QObject::connect( mConverter, SIGNAL(addAction(Action*,int,int)),
|
||||
q, SLOT(addAction(Action*,int,int)) );
|
||||
QObject::connect( mConverter, SIGNAL(addAnnotation(Annotation*,int,int)),
|
||||
q, SLOT(addAnnotation(Annotation*,int,int)) );
|
||||
QObject::connect( mConverter, SIGNAL(addTitle(int,QString,QTextBlock)),
|
||||
q, SLOT(addTitle(int,QString,QTextBlock)) );
|
||||
QObject::connect( mConverter, SIGNAL(addMetaData(QString,QString,QString)),
|
||||
q, SLOT(addMetaData(QString,QString,QString)) );
|
||||
QObject::connect( mConverter, SIGNAL(addMetaData(DocumentInfo::Key,QString)),
|
||||
q, SLOT(addMetaData(DocumentInfo::Key,QString)) );
|
||||
|
||||
QObject::connect( mConverter, SIGNAL(error(QString,int)),
|
||||
q, SIGNAL(error(QString,int)) );
|
||||
QObject::connect( mConverter, SIGNAL(warning(QString,int)),
|
||||
q, SIGNAL(warning(QString,int)) );
|
||||
QObject::connect( mConverter, SIGNAL(notice(QString,int)),
|
||||
q, SIGNAL(notice(QString,int)) );
|
||||
|
||||
QObject::connect( mGeneralSettingsWidget, SIGNAL(destroyed()),
|
||||
q, SLOT(generalSettingsWidgetDestroyed()) );
|
||||
}
|
||||
|
||||
void TextDocumentGeneratorPrivate::generalSettingsWidgetDestroyed()
|
||||
{
|
||||
/**
|
||||
* If addPage() is called from generator, it will install parent for this object,
|
||||
* and parent will destroy this object before ~TextDocumentGeneratorPrivate()
|
||||
*
|
||||
* So just reset it.
|
||||
*/
|
||||
mGeneralSettingsWidget = 0;
|
||||
}
|
||||
|
||||
TextDocumentGenerator::TextDocumentGenerator( TextDocumentConverter *converter, const QString& configName, QObject *parent, const QVariantList &args )
|
||||
: Okular::Generator( *new TextDocumentGeneratorPrivate( converter ), parent, args )
|
||||
{
|
||||
Q_D( TextDocumentGenerator );
|
||||
d->mGeneralSettingsWidget = new TextDocumentSettingsWidget();
|
||||
d->mGeneralSettings = new TextDocumentSettings( configName, this );
|
||||
|
||||
d->initializeGenerator();
|
||||
}
|
||||
|
||||
TextDocumentGenerator::TextDocumentGenerator( TextDocumentConverter *converter, QObject *parent, const QVariantList &args )
|
||||
: Okular::Generator( *new TextDocumentGeneratorPrivate( converter ), parent, args )
|
||||
{
|
||||
converter->d_ptr->mParent = d_func();
|
||||
Q_D( TextDocumentGenerator );
|
||||
|
||||
setFeature( TextExtraction );
|
||||
setFeature( PrintNative );
|
||||
setFeature( PrintToFile );
|
||||
#ifdef OKULAR_TEXTDOCUMENT_THREADED_RENDERING
|
||||
if ( QFontDatabase::supportsThreadedFontRendering() )
|
||||
setFeature( Threaded );
|
||||
#endif
|
||||
|
||||
connect( converter, SIGNAL(addAction(Action*,int,int)),
|
||||
this, SLOT(addAction(Action*,int,int)) );
|
||||
connect( converter, SIGNAL(addAnnotation(Annotation*,int,int)),
|
||||
this, SLOT(addAnnotation(Annotation*,int,int)) );
|
||||
connect( converter, SIGNAL(addTitle(int,QString,QTextBlock)),
|
||||
this, SLOT(addTitle(int,QString,QTextBlock)) );
|
||||
connect( converter, SIGNAL(addMetaData(QString,QString,QString)),
|
||||
this, SLOT(addMetaData(QString,QString,QString)) );
|
||||
connect( converter, SIGNAL(addMetaData(DocumentInfo::Key,QString)),
|
||||
this, SLOT(addMetaData(DocumentInfo::Key,QString)) );
|
||||
|
||||
connect( converter, SIGNAL(error(QString,int)),
|
||||
this, SIGNAL(error(QString,int)) );
|
||||
connect( converter, SIGNAL(warning(QString,int)),
|
||||
this, SIGNAL(warning(QString,int)) );
|
||||
connect( converter, SIGNAL(notice(QString,int)),
|
||||
this, SIGNAL(notice(QString,int)) );
|
||||
d->initializeGenerator();
|
||||
}
|
||||
|
||||
TextDocumentGenerator::~TextDocumentGenerator()
|
||||
|
@ -374,6 +411,7 @@ QImage TextDocumentGeneratorPrivate::image( PixmapRequest * request )
|
|||
#ifdef OKULAR_TEXTDOCUMENT_THREADED_RENDERING
|
||||
q->userMutex()->lock();
|
||||
#endif
|
||||
mDocument->setDefaultFont( mFont );
|
||||
mDocument->drawContents( &p, rect );
|
||||
#ifdef OKULAR_TEXTDOCUMENT_THREADED_RENDERING
|
||||
q->userMutex()->unlock();
|
||||
|
@ -484,5 +522,44 @@ bool TextDocumentGenerator::exportTo( const QString &fileName, const Okular::Exp
|
|||
return false;
|
||||
}
|
||||
|
||||
bool TextDocumentGenerator::reparseConfig()
|
||||
{
|
||||
Q_D( TextDocumentGenerator );
|
||||
|
||||
// don't have settings, just return "no changes".
|
||||
if ( !d->mGeneralSettingsWidget ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const QFont newFont = d->mGeneralSettingsWidget->font();
|
||||
|
||||
if ( newFont != d->mFont ) {
|
||||
d->mFont = newFont;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void TextDocumentGenerator::addPages( KConfigDialog* /*dlg*/ )
|
||||
{
|
||||
kWarning() << "You forgot to reimplement addPages in your TextDocumentGenerator";
|
||||
return;
|
||||
}
|
||||
|
||||
TextDocumentSettingsWidget* TextDocumentGenerator::generalSettingsWidget()
|
||||
{
|
||||
Q_D( TextDocumentGenerator );
|
||||
|
||||
return d->mGeneralSettingsWidget;
|
||||
}
|
||||
|
||||
TextDocumentSettings* TextDocumentGenerator::generalSettings()
|
||||
{
|
||||
Q_D( TextDocumentGenerator );
|
||||
|
||||
return d->mGeneralSettings;
|
||||
}
|
||||
|
||||
#include "textdocumentgenerator.moc"
|
||||
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
|
||||
#include "document.h"
|
||||
#include "generator.h"
|
||||
#include "textdocumentsettings.h"
|
||||
#include "../interfaces/configinterface.h"
|
||||
|
||||
class QTextBlock;
|
||||
class QTextDocument;
|
||||
|
@ -131,22 +133,35 @@ class OKULAR_EXPORT TextDocumentConverter : public QObject
|
|||
* This generator provides a document in the form of a QTextDocument object,
|
||||
* parsed using a specialized TextDocumentConverter.
|
||||
*/
|
||||
class OKULAR_EXPORT TextDocumentGenerator : public Generator
|
||||
class OKULAR_EXPORT TextDocumentGenerator : public Generator, public Okular::ConfigInterface
|
||||
{
|
||||
/// @cond PRIVATE
|
||||
friend class TextDocumentConverter;
|
||||
/// @endcond
|
||||
|
||||
Q_OBJECT
|
||||
Q_INTERFACES( Okular::ConfigInterface )
|
||||
|
||||
public:
|
||||
/**
|
||||
* Creates a new generator that uses the specified @p converter.
|
||||
*
|
||||
* @param configName - see Okular::TextDocumentSettings
|
||||
*
|
||||
* @note the generator will take ownership of the converter, so you
|
||||
* don't have to delete it yourself
|
||||
* @since 0.17 (KDE 4.11)
|
||||
*/
|
||||
TextDocumentGenerator( TextDocumentConverter *converter, const QString& configName, QObject *parent, const QVariantList &args );
|
||||
/**
|
||||
* Creates a new generator that uses the specified @p converter.
|
||||
*
|
||||
* @deprecated use the one with configName
|
||||
*
|
||||
* @note the generator will take ownership of the converter, so you
|
||||
* don't have to delete it yourself
|
||||
*/
|
||||
TextDocumentGenerator( TextDocumentConverter *converter, QObject *parent, const QVariantList &args );
|
||||
KDE_DEPRECATED TextDocumentGenerator( TextDocumentConverter *converter, QObject *parent, const QVariantList &args );
|
||||
virtual ~TextDocumentGenerator();
|
||||
|
||||
// [INHERITED] load a document and fill up the pagesVector
|
||||
|
@ -163,6 +178,36 @@ class OKULAR_EXPORT TextDocumentGenerator : public Generator
|
|||
Okular::ExportFormat::List exportFormats() const;
|
||||
bool exportTo( const QString &fileName, const Okular::ExportFormat &format );
|
||||
|
||||
// [INHERITED] config interface
|
||||
/// By default checks if the default font has changed or not
|
||||
bool reparseConfig();
|
||||
/// Does nothing by default. You need to reimplement it in your generator
|
||||
void addPages( KConfigDialog* dlg );
|
||||
|
||||
/**
|
||||
* General settings
|
||||
*
|
||||
* This method return TextDocumentSettingsWidget
|
||||
* that contain default settings for text based documents.
|
||||
*
|
||||
* @see generalSettings()
|
||||
*
|
||||
* @since 0.17 (KDE 4.11)
|
||||
*/
|
||||
TextDocumentSettingsWidget* generalSettingsWidget();
|
||||
|
||||
/**
|
||||
* Config skeleton for TextDocumentSettingsWidget
|
||||
*
|
||||
* You must use new construtor to initialize TextDocumentSettings,
|
||||
* that contain @param configName.
|
||||
*
|
||||
* @see generalSettingsWidget()
|
||||
*
|
||||
* @since 0.17 (KDE 4.11)
|
||||
*/
|
||||
TextDocumentSettings* generalSettings();
|
||||
|
||||
const Okular::DocumentInfo* generateDocumentInfo();
|
||||
const Okular::DocumentSynopsis* generateDocumentSynopsis();
|
||||
|
||||
|
@ -179,6 +224,7 @@ class OKULAR_EXPORT TextDocumentGenerator : public Generator
|
|||
Q_PRIVATE_SLOT( d_func(), void addTitle( int, const QString&, const QTextBlock& ) )
|
||||
Q_PRIVATE_SLOT( d_func(), void addMetaData( const QString&, const QString&, const QString& ) )
|
||||
Q_PRIVATE_SLOT( d_func(), void addMetaData( DocumentInfo::Key, const QString& ) )
|
||||
Q_PRIVATE_SLOT( d_func(), void generalSettingsWidgetDestroyed() )
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -114,7 +114,7 @@ class TextDocumentGeneratorPrivate : public GeneratorPrivate
|
|||
|
||||
public:
|
||||
TextDocumentGeneratorPrivate( TextDocumentConverter *converter )
|
||||
: mConverter( converter ), mDocument( 0 )
|
||||
: mConverter( converter ), mDocument( 0 ), mGeneralSettingsWidget( 0 ), mGeneralSettings( 0 )
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -122,8 +122,11 @@ class TextDocumentGeneratorPrivate : public GeneratorPrivate
|
|||
{
|
||||
delete mConverter;
|
||||
delete mDocument;
|
||||
delete mGeneralSettingsWidget;
|
||||
}
|
||||
|
||||
void initializeGenerator();
|
||||
|
||||
Q_DECLARE_PUBLIC( TextDocumentGenerator )
|
||||
|
||||
/* reimp */ QVariant metaData( const QString &key, const QVariant &option ) const;
|
||||
|
@ -139,6 +142,8 @@ class TextDocumentGeneratorPrivate : public GeneratorPrivate
|
|||
void addMetaData( const QString &key, const QString &value, const QString &title );
|
||||
void addMetaData( DocumentInfo::Key, const QString &value );
|
||||
|
||||
void generalSettingsWidgetDestroyed();
|
||||
|
||||
void generateLinkInfos();
|
||||
void generateAnnotationInfos();
|
||||
void generateTitleInfos();
|
||||
|
@ -188,6 +193,11 @@ class TextDocumentGeneratorPrivate : public GeneratorPrivate
|
|||
Annotation *annotation;
|
||||
};
|
||||
QList<AnnotationInfo> mAnnotationInfos;
|
||||
|
||||
TextDocumentSettingsWidget *mGeneralSettingsWidget;
|
||||
TextDocumentSettings *mGeneralSettings;
|
||||
|
||||
QFont mFont;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
84
core/textdocumentsettings.cpp
Normal file
84
core/textdocumentsettings.cpp
Normal file
|
@ -0,0 +1,84 @@
|
|||
/***************************************************************************
|
||||
* Copyright (C) 2013 by Azat Khuzhin <a3at.mail@gmail.com> *
|
||||
* *
|
||||
* 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 *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#include "textdocumentsettings.h"
|
||||
#include "textdocumentsettings_p.h"
|
||||
#include "ui_textdocumentsettings.h"
|
||||
|
||||
#include <KFontRequester>
|
||||
#include <KLocale>
|
||||
|
||||
#include <QLabel>
|
||||
|
||||
|
||||
using namespace Okular;
|
||||
|
||||
/**
|
||||
* TextDocumentSettingsWidget
|
||||
*/
|
||||
|
||||
TextDocumentSettingsWidget::TextDocumentSettingsWidget( QWidget *parent )
|
||||
: QWidget( parent )
|
||||
, d_ptr( new TextDocumentSettingsWidgetPrivate( new Ui_TextDocumentSettings() ) )
|
||||
{
|
||||
Q_D( TextDocumentSettingsWidget );
|
||||
|
||||
d->mUi->setupUi( this );
|
||||
|
||||
// @notice I think this will be usefull in future.
|
||||
#define ADD_WIDGET( property, widget, objectName, labelName ) \
|
||||
d->property = new widget( this ); \
|
||||
d->property->setObjectName( QString::fromUtf8( objectName ) ); \
|
||||
addRow( labelName, d->property );
|
||||
|
||||
ADD_WIDGET( mFont, KFontRequester, "kcfg_Font", "&Default Font:" );
|
||||
#undef ADD_WIDGET
|
||||
}
|
||||
|
||||
TextDocumentSettingsWidget::~TextDocumentSettingsWidget()
|
||||
{
|
||||
Q_D( TextDocumentSettingsWidget );
|
||||
|
||||
delete d->mUi;
|
||||
}
|
||||
|
||||
void TextDocumentSettingsWidget::addRow( const QString& labelText, QWidget *widget )
|
||||
{
|
||||
Q_D( TextDocumentSettingsWidget );
|
||||
|
||||
d->mUi->formLayout->addRow( labelText, widget );
|
||||
}
|
||||
|
||||
QFont TextDocumentSettingsWidget::font() const
|
||||
{
|
||||
Q_D( const TextDocumentSettingsWidget );
|
||||
|
||||
return d->mFont->font();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* TextDocumentSettings
|
||||
*/
|
||||
|
||||
TextDocumentSettings::TextDocumentSettings( const QString& config, QObject *parent )
|
||||
: KConfigSkeleton( config, parent )
|
||||
, d_ptr( new TextDocumentSettingsPrivate() )
|
||||
{
|
||||
Q_D( TextDocumentSettings );
|
||||
|
||||
addItemFont( "Font", d->mFont );
|
||||
}
|
||||
|
||||
QFont TextDocumentSettings::font() const
|
||||
{
|
||||
Q_D( const TextDocumentSettings );
|
||||
return d->mFont;
|
||||
}
|
127
core/textdocumentsettings.h
Normal file
127
core/textdocumentsettings.h
Normal file
|
@ -0,0 +1,127 @@
|
|||
/***************************************************************************
|
||||
* Copyright (C) 2013 by Azat Khuzhin <a3at.mail@gmail.com> *
|
||||
* *
|
||||
* 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 *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#ifndef _OKULAR_TEXTDOCUMENTSETTINGS_H_
|
||||
#define _OKULAR_TEXTDOCUMENTSETTINGS_H_
|
||||
|
||||
|
||||
#include "okular_export.h"
|
||||
|
||||
#include <QFont>
|
||||
#include <QWidget>
|
||||
#include <QObject>
|
||||
#include <KConfigSkeleton>
|
||||
|
||||
namespace Okular {
|
||||
|
||||
class TextDocumentSettingsWidgetPrivate;
|
||||
class TextDocumentSettingsPrivate;
|
||||
|
||||
/**
|
||||
* Here is example of how you can add custom settings per-backend:
|
||||
*
|
||||
* In .h header:
|
||||
* {code}
|
||||
* class KIntSpinBox;
|
||||
* ...
|
||||
*
|
||||
* class YourGenerator
|
||||
* {
|
||||
* ...
|
||||
* public:
|
||||
* bool reparseConfig();
|
||||
* void addPages( KConfigDialog* dlg );
|
||||
* ...
|
||||
* private:
|
||||
* QString customArgument;
|
||||
* KIntSpinBox *customArgumentWidget;
|
||||
* ...
|
||||
* }
|
||||
* {/code}
|
||||
*
|
||||
* In .cpp module:
|
||||
* {code}
|
||||
* #include <KIntSpinBox>
|
||||
* ...
|
||||
* bool YourGenerator::reparseConfig()
|
||||
* {
|
||||
* ... Do something with customArgumentWidget and customArgument ...
|
||||
* }
|
||||
* void YourGenerator::addPages( KConfigDialog* dlg )
|
||||
* {
|
||||
* Okular::TextDocumentSettingsWidget *widget = generalSettingsWidget();
|
||||
* widget->setParent( dlg );
|
||||
*
|
||||
* KIntSpinBox *customArgumentWidget = new KIntSpinBox( dlg );
|
||||
* customArgumentWidget->setObjectName( QString::fromUtf8( "kcfg_CustomArgument" ) );
|
||||
* widget->addRow( "Custom argument", customArgumentWidget );
|
||||
*
|
||||
* Okular::TextDocumentSettings *settings = generalSettings();
|
||||
* settings->addItemString( "CustomArgument", customArgument );
|
||||
*
|
||||
* dlg->addPage( widget, settings, ... );
|
||||
* }
|
||||
* {/code}
|
||||
*/
|
||||
|
||||
/**
|
||||
* TextDocumentSettingsWidget
|
||||
*
|
||||
* Contain default settings for text based documents.
|
||||
* (all generators that inherited from TextDocumentGenerator)
|
||||
* Generator can add settings to this object individually.
|
||||
*
|
||||
* @since 0.17 (KDE 4.11)
|
||||
*/
|
||||
class OKULAR_EXPORT TextDocumentSettingsWidget : public QWidget
|
||||
{
|
||||
public:
|
||||
virtual ~TextDocumentSettingsWidget();
|
||||
|
||||
void addRow( const QString& labelText, QWidget *widget );
|
||||
|
||||
QFont font() const;
|
||||
|
||||
private:
|
||||
friend class TextDocumentGenerator;
|
||||
|
||||
TextDocumentSettingsWidget( QWidget *parent = 0 );
|
||||
|
||||
TextDocumentSettingsWidgetPrivate *d_ptr;
|
||||
Q_DECLARE_PRIVATE( TextDocumentSettingsWidget )
|
||||
Q_DISABLE_COPY( TextDocumentSettingsWidget )
|
||||
};
|
||||
|
||||
/**
|
||||
* TextDocumentSettings
|
||||
*
|
||||
* Contain default settings/config skeleton
|
||||
* To save/restore settings.
|
||||
*
|
||||
* @since 0.17 (KDE 4.11)
|
||||
*/
|
||||
class OKULAR_EXPORT TextDocumentSettings : public KConfigSkeleton
|
||||
{
|
||||
public:
|
||||
QFont font() const;
|
||||
|
||||
private:
|
||||
friend class TextDocumentGenerator;
|
||||
|
||||
TextDocumentSettings( const QString& config, QObject *parent );
|
||||
|
||||
TextDocumentSettingsPrivate *d_ptr;
|
||||
Q_DECLARE_PRIVATE( TextDocumentSettings )
|
||||
Q_DISABLE_COPY( TextDocumentSettings )
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
|
@ -14,7 +14,7 @@ set(okularGenerator_epub_PART_SRCS
|
|||
|
||||
kde4_add_plugin(okularGenerator_epub ${okularGenerator_epub_PART_SRCS})
|
||||
|
||||
target_link_libraries(okularGenerator_epub okularcore ${EPUB_LIBRARIES} ${KDE4_KDECORE_LIBS} ${QT_QTGUI_LIBRARY})
|
||||
target_link_libraries(okularGenerator_epub okularcore ${EPUB_LIBRARIES} ${KDE4_KDECORE_LIBS} ${KDE4_KDEUI_LIBS} ${QT_QTGUI_LIBRARY})
|
||||
|
||||
install(TARGETS okularGenerator_epub DESTINATION ${PLUGIN_INSTALL_DIR})
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "converter.h"
|
||||
|
||||
#include <kaboutdata.h>
|
||||
#include <kconfigdialog.h>
|
||||
|
||||
static KAboutData createAboutData()
|
||||
{
|
||||
|
@ -33,6 +34,14 @@ static KAboutData createAboutData()
|
|||
OKULAR_EXPORT_PLUGIN( EPubGenerator, createAboutData() )
|
||||
|
||||
EPubGenerator::EPubGenerator( QObject *parent, const QVariantList &args )
|
||||
: Okular::TextDocumentGenerator( new Epub::Converter, parent, args )
|
||||
: Okular::TextDocumentGenerator( new Epub::Converter, "epub_generator_settings", parent, args )
|
||||
{
|
||||
}
|
||||
|
||||
void EPubGenerator::addPages( KConfigDialog* dlg )
|
||||
{
|
||||
Okular::TextDocumentSettingsWidget *widget = generalSettingsWidget();
|
||||
widget->setParent( dlg );
|
||||
|
||||
dlg->addPage( widget, generalSettings(), i18n("EPub"), "application-epub+zip", i18n("EPub Backend Configuration") );
|
||||
}
|
||||
|
|
|
@ -16,6 +16,9 @@ class EPubGenerator : public Okular::TextDocumentGenerator
|
|||
public:
|
||||
EPubGenerator( QObject *parent, const QVariantList &args );
|
||||
~EPubGenerator() {}
|
||||
|
||||
// [INHERITED] reparse configuration
|
||||
void addPages( KConfigDialog* dlg );
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -120,4 +120,4 @@ MimeType=application/epub+zip;
|
|||
X-KDE-Library=okularGenerator_epub
|
||||
X-KDE-Priority=1
|
||||
X-KDE-okularAPIVersion=1
|
||||
X-KDE-okularHasInternalSettings=false
|
||||
X-KDE-okularHasInternalSettings=true
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
#include <kaboutdata.h>
|
||||
#include <klocale.h>
|
||||
#include <kconfigdialog.h>
|
||||
|
||||
static KAboutData createAboutData()
|
||||
{
|
||||
|
@ -33,6 +34,14 @@ static KAboutData createAboutData()
|
|||
OKULAR_EXPORT_PLUGIN( FictionBookGenerator, createAboutData() )
|
||||
|
||||
FictionBookGenerator::FictionBookGenerator( QObject *parent, const QVariantList &args )
|
||||
: Okular::TextDocumentGenerator( new FictionBook::Converter, parent, args )
|
||||
: Okular::TextDocumentGenerator( new FictionBook::Converter, "fictionbook_generator_settings", parent, args )
|
||||
{
|
||||
}
|
||||
|
||||
void FictionBookGenerator::addPages( KConfigDialog* dlg )
|
||||
{
|
||||
Okular::TextDocumentSettingsWidget *widget = generalSettingsWidget();
|
||||
widget->setParent( dlg );
|
||||
|
||||
dlg->addPage( widget, generalSettings(), i18n("FictionBook"), "application-x-fictionbook+xml", i18n("FictionBook Backend Configuration") );
|
||||
}
|
||||
|
|
|
@ -16,6 +16,9 @@ class FictionBookGenerator : public Okular::TextDocumentGenerator
|
|||
{
|
||||
public:
|
||||
FictionBookGenerator( QObject *parent, const QVariantList &args );
|
||||
|
||||
// [INHERITED] reparse configuration
|
||||
void addPages( KConfigDialog* dlg );
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -123,4 +123,4 @@ MimeType=application/x-fictionbook+xml;
|
|||
X-KDE-Library=okularGenerator_fb
|
||||
X-KDE-Priority=1
|
||||
X-KDE-okularAPIVersion=1
|
||||
X-KDE-okularHasInternalSettings=false
|
||||
X-KDE-okularHasInternalSettings=true
|
||||
|
|
|
@ -585,4 +585,4 @@ bool Converter::convertAnnotation( QTextCursor *cursor, const QDomElement &eleme
|
|||
emit addAnnotation( annotation, position, position + 3 );
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
#include <kaboutdata.h>
|
||||
#include <klocale.h>
|
||||
#include <kconfigdialog.h>
|
||||
|
||||
static KAboutData createAboutData()
|
||||
{
|
||||
|
@ -33,6 +34,14 @@ static KAboutData createAboutData()
|
|||
OKULAR_EXPORT_PLUGIN( KOOOGenerator, createAboutData() )
|
||||
|
||||
KOOOGenerator::KOOOGenerator( QObject *parent, const QVariantList &args )
|
||||
: Okular::TextDocumentGenerator( new OOO::Converter, parent, args )
|
||||
: Okular::TextDocumentGenerator( new OOO::Converter, "ooo_generator_settings", parent, args )
|
||||
{
|
||||
}
|
||||
|
||||
void KOOOGenerator::addPages( KConfigDialog* dlg )
|
||||
{
|
||||
Okular::TextDocumentSettingsWidget *widget = generalSettingsWidget();
|
||||
widget->setParent( dlg );
|
||||
|
||||
dlg->addPage( widget, generalSettings(), i18n("OpenDocument Text"), "application-vnd.oasis.opendocument.text", i18n("OpenDocument Text Backend Configuration") );
|
||||
}
|
||||
|
|
|
@ -16,6 +16,9 @@ class KOOOGenerator : public Okular::TextDocumentGenerator
|
|||
{
|
||||
public:
|
||||
KOOOGenerator( QObject *parent, const QVariantList &args );
|
||||
|
||||
// [INHERITED] reparse configuration
|
||||
void addPages( KConfigDialog* dlg );
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -124,4 +124,4 @@ MimeType=application/vnd.oasis.opendocument.text;
|
|||
X-KDE-Library=okularGenerator_ooo
|
||||
X-KDE-Priority=1
|
||||
X-KDE-okularAPIVersion=1
|
||||
X-KDE-okularHasInternalSettings=false
|
||||
X-KDE-okularHasInternalSettings=true
|
||||
|
|
|
@ -14,7 +14,7 @@ set(okularGenerator_txt_SRCS
|
|||
|
||||
kde4_add_plugin(okularGenerator_txt ${okularGenerator_txt_SRCS})
|
||||
|
||||
target_link_libraries(okularGenerator_txt okularcore ${KDE4_KDECORE_LIBS} ${QT_QTGUI_LIBRARY})
|
||||
target_link_libraries(okularGenerator_txt okularcore ${KDE4_KDECORE_LIBS} ${KDE4_KDEUI_LIBS} ${QT_QTGUI_LIBRARY})
|
||||
|
||||
install(TARGETS okularGenerator_txt DESTINATION ${PLUGIN_INSTALL_DIR})
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "converter.h"
|
||||
|
||||
#include <kaboutdata.h>
|
||||
#include <KConfigDialog>
|
||||
|
||||
static KAboutData createAboutData()
|
||||
{
|
||||
|
@ -31,6 +32,14 @@ static KAboutData createAboutData()
|
|||
OKULAR_EXPORT_PLUGIN( TxtGenerator, createAboutData() )
|
||||
|
||||
TxtGenerator::TxtGenerator( QObject *parent, const QVariantList &args )
|
||||
: Okular::TextDocumentGenerator( new Txt::Converter, parent, args )
|
||||
: Okular::TextDocumentGenerator( new Txt::Converter, "txt_generator_settings", parent, args )
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
void TxtGenerator::addPages( KConfigDialog* dlg )
|
||||
{
|
||||
Okular::TextDocumentSettingsWidget *widget = generalSettingsWidget();
|
||||
widget->setParent( dlg );
|
||||
|
||||
dlg->addPage( widget, generalSettings(), i18n("Txt"), "text-plain", i18n("Txt Backend Configuration") );
|
||||
}
|
||||
|
|
|
@ -19,6 +19,9 @@ class TxtGenerator : public Okular::TextDocumentGenerator
|
|||
public:
|
||||
TxtGenerator( QObject *parent, const QVariantList &args );
|
||||
~TxtGenerator() {}
|
||||
|
||||
// [INHERITED] reparse configuration
|
||||
void addPages( KConfigDialog* dlg );
|
||||
};
|
||||
|
||||
#endif
|
|
@ -65,4 +65,4 @@ MimeType=text/plain;
|
|||
X-KDE-Library=okularGenerator_txt
|
||||
X-KDE-Priority=2
|
||||
X-KDE-okularAPIVersion=1
|
||||
X-KDE-okularHasInternalSettings=false
|
||||
X-KDE-okularHasInternalSettings=true
|
||||
|
|
Loading…
Reference in a new issue