Sonnet

configdialog.cpp
1/*
2 * configdialog.cpp
3 *
4 * SPDX-FileCopyrightText: 2004 Zack Rusin <zack@kde.org>
5 *
6 * SPDX-License-Identifier: LGPL-2.1-or-later
7 */
8#include "configdialog.h"
9#include "configwidget.h"
10
11#include <QDialogButtonBox>
12#include <QVBoxLayout>
13
14using namespace Sonnet;
15
16class Sonnet::ConfigDialogPrivate
17{
18public:
19 ConfigDialogPrivate(ConfigDialog *parent)
20 : q(parent)
21 {
22 }
23
24 ConfigWidget *ui = nullptr;
25 ConfigDialog *const q;
26 void slotConfigChanged();
27};
28
29void ConfigDialogPrivate::slotConfigChanged()
30{
31 Q_EMIT q->languageChanged(ui->language());
32}
33
34ConfigDialog::ConfigDialog(QWidget *parent)
35 : QDialog(parent)
36 , d(new ConfigDialogPrivate(this))
37{
38 setObjectName(QStringLiteral("SonnetConfigDialog"));
39 setModal(true);
40 setWindowTitle(tr("Spell Checking Configuration"));
41
42 QVBoxLayout *layout = new QVBoxLayout(this);
43
44 d->ui = new ConfigWidget(this);
45 layout->addWidget(d->ui);
46
47 QDialogButtonBox *buttonBox = new QDialogButtonBox(this);
49 layout->addWidget(buttonBox);
50
51 connect(buttonBox, &QDialogButtonBox::accepted, this, &ConfigDialog::slotOk);
53 connect(d->ui, SIGNAL(configChanged()), this, SLOT(slotConfigChanged()));
54
56}
57
58ConfigDialog::~ConfigDialog() = default;
59
60void ConfigDialog::slotOk()
61{
62 d->ui->save();
63 accept();
64}
65
66void ConfigDialog::slotApply()
67{
68 d->ui->save();
69}
70
72{
73 d->ui->setLanguage(language);
74}
75
77{
78 return d->ui->language();
79}
80
81#include "moc_configdialog.cpp"
The sonnet ConfigDialog.
void languageChanged(const QString &language)
This is emitted all the time when we change config and not just language.
QString language() const
return selected language
void configChanged()
This is emitted when configChanged.
void setLanguage(const QString &language)
Sets the language/dictionary that will be selected by default in this config dialog.
The sonnet ConfigWidget.
void configChanged()
Signal sends when config was changed.
QString language() const
Get the currently selected language for spell checking.
The sonnet namespace.
void addWidget(QWidget *widget, int stretch, Qt::Alignment alignment)
virtual void accept()
virtual void reject()
void setStandardButtons(StandardButtons buttons)
QFuture< ArgsType< Signal > > connect(Sender *sender, Signal signal)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri May 10 2024 11:48:53 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.