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 "speechtotextconfigurewidget.h"
0008 #include "speechtotextcomboboxwidget.h"
0009 #include "speechtotextselectdevicewidget.h"
0010 #include <KConfigGroup>
0011 #include <KLocalizedString>
0012 #include <KSharedConfig>
0013 #include <QVBoxLayout>
0014 
0015 using namespace TextSpeechToText;
0016 
0017 SpeechToTextConfigureWidget::SpeechToTextConfigureWidget(QWidget *parent)
0018     : QWidget{parent}
0019     , mSpeechToTextComboBox(new SpeechToTextComboBoxWidget(this))
0020     , mSpeechToTextDevice(new SpeechToTextSelectDeviceWidget(this))
0021 {
0022     auto mainLayout = new QVBoxLayout(this);
0023     mainLayout->setObjectName(QStringLiteral("mainLayout"));
0024     mainLayout->setContentsMargins({});
0025 
0026     mSpeechToTextDevice->setObjectName(QStringLiteral("mSpeechToTextDevice"));
0027     mainLayout->addWidget(mSpeechToTextDevice);
0028 
0029     mSpeechToTextComboBox->setObjectName(QStringLiteral("mSpeechToTextComboBox"));
0030     mainLayout->addWidget(mSpeechToTextComboBox);
0031     mSpeechToTextComboBox->fillEngine();
0032 }
0033 
0034 SpeechToTextConfigureWidget::~SpeechToTextConfigureWidget() = default;
0035 
0036 void SpeechToTextConfigureWidget::loadSettings()
0037 {
0038     mSpeechToTextComboBox->load();
0039     mSpeechToTextDevice->loadSettings();
0040 }
0041 
0042 void SpeechToTextConfigureWidget::saveSettings()
0043 {
0044     mSpeechToTextComboBox->save();
0045     mSpeechToTextDevice->saveSettings();
0046 }
0047 
0048 #include "moc_speechtotextconfigurewidget.cpp"