KTextAddons

begamotenginedialog.cpp
1/*
2 SPDX-FileCopyrightText: 2023-2024 Laurent Montel <montel.org>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#include "begamotenginedialog.h"
8#include "bergamotenginewidget.h"
9#include <KConfigGroup>
10#include <KLocalizedString>
11#include <KSharedConfig>
12#include <KWindowConfig>
13#include <QDialogButtonBox>
14#include <QVBoxLayout>
15#include <QWindow>
16namespace
17{
18static const char myConfigGroupName[] = "BegamotEngineDialog";
19}
20BegamotEngineDialog::BegamotEngineDialog(QWidget *parent)
21 : QDialog(parent)
22 , mBergamotEngineWidget(new BergamotEngineWidget(this))
23{
24 setWindowTitle(i18nc("@title:window", "Bergamot Plugin Settings"));
25 auto mainLayout = new QVBoxLayout(this);
26 mainLayout->setObjectName(QStringLiteral("mainLayout"));
27
28 mBergamotEngineWidget->setObjectName(QStringLiteral("mBergamotEngineWidget"));
29 mainLayout->addWidget(mBergamotEngineWidget);
30
32 buttonBox->setObjectName(QStringLiteral("buttonBox"));
33 mainLayout->addWidget(buttonBox);
36 readConfig();
37}
38
39BegamotEngineDialog::~BegamotEngineDialog()
40{
41 writeConfig();
42}
43
44void BegamotEngineDialog::writeConfig()
45{
48}
49
50void BegamotEngineDialog::readConfig()
51{
52 create(); // ensure a window is created
53 windowHandle()->resize(QSize(500, 300));
56 resize(windowHandle()->size()); // workaround for QTBUG-40584
57}
58
59void BegamotEngineDialog::setSettingsInfo(const BergamotEngineUtils::SettingsInfo &info)
60{
61 mBergamotEngineWidget->setSettingsInfo(info);
62}
63
64BergamotEngineUtils::SettingsInfo BegamotEngineDialog::settingsInfo() const
65{
66 return mBergamotEngineWidget->settingsInfo();
67}
68
69#include "moc_begamotenginedialog.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)
virtual void accept()
virtual void reject()
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 Sat Dec 21 2024 16:56:02 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.