File indexing completed on 2024-12-22 04:28:24

0001 /*
0002   SPDX-FileCopyrightText: 2023-2024 Laurent Montel <montel.org>
0003 
0004   SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #include "speechtotextconfiguredialog.h"
0008 #include "speechtotextconfigurewidget.h"
0009 #include <KLocalizedString>
0010 #include <QDialogButtonBox>
0011 #include <QVBoxLayout>
0012 
0013 using namespace TextSpeechToText;
0014 SpeechToTextConfigureDialog::SpeechToTextConfigureDialog(QWidget *parent)
0015     : QDialog(parent)
0016     , mSpeechToTextConfigureWidget(new SpeechToTextConfigureWidget(this))
0017 {
0018     setWindowTitle(i18nc("@title:window", "Configure Speech To Text"));
0019     auto mainLayout = new QVBoxLayout(this);
0020     mainLayout->setObjectName(QStringLiteral("mainLayout"));
0021 
0022     mSpeechToTextConfigureWidget->setObjectName(QStringLiteral("mSpeechToTextConfigureWidget"));
0023     mainLayout->addWidget(mSpeechToTextConfigureWidget);
0024     mainLayout->addStretch();
0025 
0026     auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
0027     buttonBox->setObjectName(QStringLiteral("buttonBox"));
0028     mainLayout->addWidget(buttonBox);
0029 
0030     connect(buttonBox, &QDialogButtonBox::accepted, this, &SpeechToTextConfigureDialog::slotAccept);
0031     connect(buttonBox, &QDialogButtonBox::rejected, this, &SpeechToTextConfigureDialog::reject);
0032     mSpeechToTextConfigureWidget->loadSettings();
0033 }
0034 
0035 SpeechToTextConfigureDialog::~SpeechToTextConfigureDialog() = default;
0036 
0037 void SpeechToTextConfigureDialog::slotAccept()
0038 {
0039     mSpeechToTextConfigureWidget->saveSettings();
0040     accept();
0041 }
0042 
0043 #include "moc_speechtotextconfiguredialog.cpp"