mirror of
https://invent.kde.org/graphics/okular
synced 2024-10-05 23:49:20 +00:00
19d98d6a74
find . \( -name "*.cpp" -or -name "*.h" -or -name "*.c" -or -name "*.cc" \) -exec clang-format -i {} \; If you reached this file doing a git blame, please see README.clang-format (added 2 commits in the future of this one)
126 lines
3.2 KiB
C++
126 lines
3.2 KiB
C++
/***************************************************************************
|
|
* 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 "okularcore_export.h"
|
|
|
|
#include <KConfigSkeleton>
|
|
#include <QFont>
|
|
#include <QObject>
|
|
#include <QWidget>
|
|
|
|
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;
|
|
* ...
|
|
* }
|
|
* \endcode
|
|
*
|
|
* In .cpp module:
|
|
* \code
|
|
* #include <KIntSpinBox>
|
|
* ...
|
|
* bool YourGenerator::reparseConfig()
|
|
* {
|
|
* ... Do something with customArgumentWidget and customArgument ...
|
|
* }
|
|
* void YourGenerator::addPages( KConfigDialog* dlg )
|
|
* {
|
|
* Okular::TextDocumentSettingsWidget *widget = new Okular::TextDocumentSettingsWidget();
|
|
*
|
|
* 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, ... );
|
|
* }
|
|
* \endcode
|
|
*/
|
|
|
|
/**
|
|
* 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 OKULARCORE_EXPORT TextDocumentSettingsWidget : public QWidget
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit TextDocumentSettingsWidget(QWidget *parent = nullptr);
|
|
~TextDocumentSettingsWidget() override;
|
|
|
|
void addRow(const QString &labelText, QWidget *widget);
|
|
|
|
private:
|
|
friend class TextDocumentGenerator;
|
|
|
|
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 OKULARCORE_EXPORT TextDocumentSettings : public KConfigSkeleton
|
|
{
|
|
Q_OBJECT
|
|
|
|
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
|