File indexing completed on 2024-12-01 04:36:38
0001 /* 0002 SPDX-FileCopyrightText: 2022-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #include "configureaccessibilitywidget.h" 0008 #include "textedittexttospeech_version.h" 0009 #include <TextEditTextToSpeech/TextToSpeechConfigWidget> 0010 0011 #include <QShowEvent> 0012 #include <QVBoxLayout> 0013 0014 ConfigureAccessibilityWidget::ConfigureAccessibilityWidget(QWidget *parent) 0015 : QWidget{parent} 0016 , mTextToSpeechWidget(new TextEditTextToSpeech::TextToSpeechConfigWidget(this)) 0017 { 0018 auto mainLayout = new QVBoxLayout(this); 0019 mainLayout->setObjectName(QStringLiteral("mainLayout")); 0020 mainLayout->setContentsMargins({}); 0021 0022 mTextToSpeechWidget->setObjectName(QStringLiteral("mTextToSpeechWidget")); 0023 mainLayout->addWidget(mTextToSpeechWidget); 0024 } 0025 0026 ConfigureAccessibilityWidget::~ConfigureAccessibilityWidget() = default; 0027 0028 void ConfigureAccessibilityWidget::save() 0029 { 0030 if (mWasInitialized) { 0031 mTextToSpeechWidget->writeConfig(); 0032 } 0033 } 0034 0035 void ConfigureAccessibilityWidget::load() 0036 { 0037 mTextToSpeechWidget->initializeSettings(); 0038 } 0039 0040 void ConfigureAccessibilityWidget::showEvent(QShowEvent *event) 0041 { 0042 if (!event->spontaneous() && !mWasInitialized) { 0043 mWasInitialized = true; 0044 mTextToSpeechWidget->readConfig(); 0045 } 0046 QWidget::showEvent(event); 0047 } 0048 0049 #include "moc_configureaccessibilitywidget.cpp"