2021-05-24 07:25:56 +00:00
|
|
|
/*
|
|
|
|
SPDX-FileCopyrightText: 2013 Azat Khuzhin <a3at.mail@gmail.com>
|
|
|
|
|
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
*/
|
2013-05-18 11:57:46 +00:00
|
|
|
|
|
|
|
#ifndef _OKULAR_TEXTDOCUMENTSETTINGS_H_
|
|
|
|
#define _OKULAR_TEXTDOCUMENTSETTINGS_H_
|
|
|
|
|
2014-10-27 21:35:06 +00:00
|
|
|
#include "okularcore_export.h"
|
2013-05-18 11:57:46 +00:00
|
|
|
|
|
|
|
#include <KConfigSkeleton>
|
|
|
|
#include <QFont>
|
|
|
|
#include <QObject>
|
|
|
|
#include <QWidget>
|
|
|
|
|
|
|
|
namespace Okular
|
2020-07-10 22:15:05 +00:00
|
|
|
{
|
2013-05-18 11:57:46 +00:00
|
|
|
class TextDocumentSettingsWidgetPrivate;
|
|
|
|
class TextDocumentSettingsPrivate;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Here is example of how you can add custom settings per-backend:
|
|
|
|
*
|
|
|
|
* In .h header:
|
2018-10-27 07:43:35 +00:00
|
|
|
* \code
|
2013-05-18 11:57:46 +00:00
|
|
|
* class KIntSpinBox;
|
|
|
|
* ...
|
|
|
|
*
|
|
|
|
* class YourGenerator
|
|
|
|
* {
|
|
|
|
* ...
|
|
|
|
* public:
|
|
|
|
* bool reparseConfig();
|
|
|
|
* void addPages( KConfigDialog* dlg );
|
|
|
|
* ...
|
|
|
|
* private:
|
|
|
|
* QString customArgument;
|
|
|
|
* KIntSpinBox *customArgumentWidget;
|
|
|
|
* ...
|
|
|
|
* }
|
2018-10-27 07:43:35 +00:00
|
|
|
* \endcode
|
2013-05-18 11:57:46 +00:00
|
|
|
*
|
|
|
|
* In .cpp module:
|
2018-10-27 07:43:35 +00:00
|
|
|
* \code
|
2013-05-18 11:57:46 +00:00
|
|
|
* #include <KIntSpinBox>
|
|
|
|
* ...
|
|
|
|
* bool YourGenerator::reparseConfig()
|
|
|
|
* {
|
|
|
|
* ... Do something with customArgumentWidget and customArgument ...
|
|
|
|
* }
|
|
|
|
* void YourGenerator::addPages( KConfigDialog* dlg )
|
|
|
|
* {
|
2013-06-06 22:11:35 +00:00
|
|
|
* Okular::TextDocumentSettingsWidget *widget = new Okular::TextDocumentSettingsWidget();
|
2013-05-18 11:57:46 +00:00
|
|
|
*
|
|
|
|
* 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, ... );
|
|
|
|
* }
|
2018-10-27 07:43:35 +00:00
|
|
|
* \endcode
|
2013-05-18 11:57:46 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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)
|
|
|
|
*/
|
2014-10-27 21:35:06 +00:00
|
|
|
class OKULARCORE_EXPORT TextDocumentSettingsWidget : public QWidget
|
2013-05-18 11:57:46 +00:00
|
|
|
{
|
2016-10-29 14:32:24 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
2013-05-18 11:57:46 +00:00
|
|
|
public:
|
2018-09-01 08:25:57 +00:00
|
|
|
explicit TextDocumentSettingsWidget(QWidget *parent = nullptr);
|
2019-12-18 11:51:13 +00:00
|
|
|
~TextDocumentSettingsWidget() override;
|
2013-05-18 11:57:46 +00:00
|
|
|
|
|
|
|
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)
|
|
|
|
*/
|
2014-10-27 21:35:06 +00:00
|
|
|
class OKULARCORE_EXPORT TextDocumentSettings : public KConfigSkeleton
|
2013-05-18 11:57:46 +00:00
|
|
|
{
|
2016-10-29 14:32:24 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
2013-05-18 11:57:46 +00:00
|
|
|
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
|