2013-05-18 11:57:46 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* 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>
|
2014-10-07 21:04:36 +00:00
|
|
|
#include <KLocalizedString>
|
2013-05-18 11:57:46 +00:00
|
|
|
|
|
|
|
using namespace Okular;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* TextDocumentSettingsWidget
|
|
|
|
*/
|
|
|
|
|
|
|
|
TextDocumentSettingsWidget::TextDocumentSettingsWidget(QWidget *parent)
|
|
|
|
: QWidget(parent)
|
|
|
|
, d_ptr(new TextDocumentSettingsWidgetPrivate(new Ui_TextDocumentSettings()))
|
|
|
|
{
|
|
|
|
Q_D(TextDocumentSettingsWidget);
|
|
|
|
|
|
|
|
d->mUi->setupUi(this);
|
|
|
|
|
2013-06-24 10:46:16 +00:00
|
|
|
// @notice I think this will be useful in future.
|
2013-05-18 11:57:46 +00:00
|
|
|
#define ADD_WIDGET(property, widget, objectName, labelName) \
|
|
|
|
d->property = new widget(this); \
|
|
|
|
d->property->setObjectName(QString::fromUtf8(objectName)); \
|
|
|
|
addRow(labelName, d->property);
|
|
|
|
|
2013-05-19 07:59:43 +00:00
|
|
|
ADD_WIDGET(mFont, KFontRequester, "kcfg_Font", i18n("&Default Font:"));
|
2013-05-18 11:57:46 +00:00
|
|
|
#undef ADD_WIDGET
|
|
|
|
}
|
|
|
|
|
|
|
|
TextDocumentSettingsWidget::~TextDocumentSettingsWidget()
|
|
|
|
{
|
|
|
|
Q_D(TextDocumentSettingsWidget);
|
|
|
|
|
|
|
|
delete d->mUi;
|
2017-08-27 11:18:31 +00:00
|
|
|
delete d;
|
2013-05-18 11:57:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void TextDocumentSettingsWidget::addRow(const QString &labelText, QWidget *widget)
|
|
|
|
{
|
|
|
|
Q_D(TextDocumentSettingsWidget);
|
|
|
|
|
|
|
|
d->mUi->formLayout->addRow(labelText, widget);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* TextDocumentSettings
|
|
|
|
*/
|
|
|
|
|
|
|
|
TextDocumentSettings::TextDocumentSettings(const QString &config, QObject *parent)
|
|
|
|
: KConfigSkeleton(config, parent)
|
2017-08-27 11:18:31 +00:00
|
|
|
, d_ptr(new TextDocumentSettingsPrivate(this))
|
2013-05-18 11:57:46 +00:00
|
|
|
{
|
|
|
|
Q_D(TextDocumentSettings);
|
|
|
|
|
2015-10-29 12:37:11 +00:00
|
|
|
addItemFont(QStringLiteral("Font"), d->mFont);
|
2013-05-18 11:57:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
QFont TextDocumentSettings::font() const
|
|
|
|
{
|
|
|
|
Q_D(const TextDocumentSettings);
|
|
|
|
return d->mFont;
|
|
|
|
}
|