KTextAddons

languagetoolconfigdialog.cpp
1/*
2 SPDX-FileCopyrightText: 2019-2024 Laurent Montel <montel@kde.org>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#include "languagetoolconfigdialog.h"
8#include "languagetoolconfigwidget.h"
9#include <KConfigGroup>
10#include <KLocalizedString>
11#include <KSharedConfig>
12#include <KWindowConfig>
13#include <QDialogButtonBox>
14#include <QPushButton>
15#include <QVBoxLayout>
16#include <QWindow>
17namespace
18{
19static const char myConfigGroupName[] = "LanguageToolConfigDialog";
20}
21using namespace TextGrammarCheck;
22LanguageToolConfigDialog::LanguageToolConfigDialog(QWidget *parent)
23 : QDialog(parent)
24 , mConfigWidget(new LanguageToolConfigWidget(this))
25{
26 setWindowTitle(i18nc("@title:window", "Configure LanguageTool"));
27 auto mainLayout = new QVBoxLayout(this);
28 mainLayout->setObjectName(QStringLiteral("mainlayout"));
29
30 mConfigWidget->setObjectName(QStringLiteral("configwidget"));
31 mainLayout->addWidget(mConfigWidget);
32
34 box->setObjectName(QStringLiteral("box"));
35 mainLayout->addWidget(box);
36 connect(box, &QDialogButtonBox::accepted, this, &LanguageToolConfigDialog::accept);
37 connect(box, &QDialogButtonBox::rejected, this, &LanguageToolConfigDialog::reject);
38 connect(box->button(QDialogButtonBox::Reset), &QPushButton::clicked, mConfigWidget, &LanguageToolConfigWidget::resetValue);
39 readConfig();
40}
41
42LanguageToolConfigDialog::~LanguageToolConfigDialog()
43{
44 writeConfig();
45}
46
47void LanguageToolConfigDialog::writeConfig()
48{
51}
52
53void LanguageToolConfigDialog::readConfig()
54{
55 create(); // ensure a window is created
56 windowHandle()->resize(QSize(500, 300));
59 resize(windowHandle()->size()); // workaround for QTBUG-40584
60}
61
62#include "moc_languagetoolconfigdialog.cpp"
static KSharedConfig::Ptr openStateConfig(const QString &fileName=QString())
QString i18nc(const char *context, const char *text, const TYPE &arg...)
KCONFIGGUI_EXPORT void saveWindowSize(const QWindow *window, KConfigGroup &config, KConfigGroup::WriteConfigFlags options=KConfigGroup::Normal)
KCONFIGGUI_EXPORT void restoreWindowSize(QWindow *window, const KConfigGroup &config)
void clicked(bool checked)
QFuture< ArgsType< Signal > > connect(Sender *sender, Signal signal)
void create(WId window, bool initializeWindow, bool destroyOldWindow)
void resize(const QSize &)
QWindow * windowHandle() const const
void resize(const QSize &newSize)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:29:59 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.