Sonnet

configdialog.cpp
1 /*
2  * configdialog.cpp
3  *
4  * SPDX-FileCopyrightText: 2004 Zack Rusin <[email protected]>
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 
14 using namespace Sonnet;
15 
16 class ConfigDialogPrivate
17 {
18 public:
19  ConfigDialogPrivate(ConfigDialog *parent)
20  : q(parent)
21  {
22  }
23 
24  ConfigWidget *ui = nullptr;
25  ConfigDialog *const q;
26  void slotConfigChanged();
27 };
28 
29 void ConfigDialogPrivate::slotConfigChanged()
30 {
31  Q_EMIT q->languageChanged(ui->language());
32 }
33 
34 ConfigDialog::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 
58 ConfigDialog::~ConfigDialog()
59 {
60  delete d;
61 }
62 
63 void ConfigDialog::slotOk()
64 {
65  d->ui->save();
66  accept();
67 }
68 
69 void ConfigDialog::slotApply()
70 {
71  d->ui->save();
72 }
73 
74 void ConfigDialog::setLanguage(const QString &language)
75 {
76  d->ui->setLanguage(language);
77 }
78 
80 {
81  return d->ui->language();
82 }
83 
84 #include "moc_configdialog.cpp"
virtual void reject()
void configChanged()
This is emitted when configChanged.
QString language() const
return selected language
QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
void setStandardButtons(QDialogButtonBox::StandardButtons buttons)
void addWidget(QWidget *widget, int stretch, Qt::Alignment alignment)
virtual void accept()
void setLanguage(const QString &language)
Sets the language/dictionary that will be selected by default in this config dialog.
The sonnet ConfigWidget.
Definition: configwidget.h:17
The sonnet namespace.
void configChanged()
Signal sends when config was changed.
void setObjectName(const QString &name)
QString tr(const char *sourceText, const char *disambiguation, int n)
The sonnet ConfigDialog.
Definition: configdialog.h:18
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Sun Sep 25 2022 04:14:52 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.