Commit 56a93683 authored by Laurent Montel's avatar Laurent Montel 😁

Start to create restore value

parent 1676b0d1
...@@ -37,12 +37,13 @@ TextToSpeechConfigDialog::TextToSpeechConfigDialog(QWidget *parent) ...@@ -37,12 +37,13 @@ TextToSpeechConfigDialog::TextToSpeechConfigDialog(QWidget *parent)
mTextToSpeechConfigWidget = new TextToSpeechConfigWidget(parent); mTextToSpeechConfigWidget = new TextToSpeechConfigWidget(parent);
mainLayout->addWidget(mTextToSpeechConfigWidget); mainLayout->addWidget(mTextToSpeechConfigWidget);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this); QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel | QDialogButtonBox::RestoreDefaults, this);
QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok); QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
okButton->setDefault(true); okButton->setDefault(true);
okButton->setShortcut(Qt::CTRL | Qt::Key_Return); okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
connect(buttonBox, &QDialogButtonBox::accepted, this, &TextToSpeechConfigDialog::slotAccepted); connect(buttonBox, &QDialogButtonBox::accepted, this, &TextToSpeechConfigDialog::slotAccepted);
connect(buttonBox, &QDialogButtonBox::rejected, this, &TextToSpeechConfigDialog::reject); connect(buttonBox, &QDialogButtonBox::rejected, this, &TextToSpeechConfigDialog::reject);
connect(buttonBox->button(QDialogButtonBox::RestoreDefaults), &QPushButton::clicked, this, &TextToSpeechConfigDialog::slotRestoreDefaults);
mainLayout->addWidget(buttonBox); mainLayout->addWidget(buttonBox);
mTextToSpeechConfigWidget->readConfig(); mTextToSpeechConfigWidget->readConfig();
readConfig(); readConfig();
...@@ -53,6 +54,11 @@ TextToSpeechConfigDialog::~TextToSpeechConfigDialog() ...@@ -53,6 +54,11 @@ TextToSpeechConfigDialog::~TextToSpeechConfigDialog()
writeConfig(); writeConfig();
} }
void TextToSpeechConfigDialog::slotRestoreDefaults()
{
mTextToSpeechConfigWidget->restoreDefaults();
}
void TextToSpeechConfigDialog::readConfig() void TextToSpeechConfigDialog::readConfig()
{ {
KConfigGroup group(KSharedConfig::openConfig(), "TextToSpeechConfigDialog"); KConfigGroup group(KSharedConfig::openConfig(), "TextToSpeechConfigDialog");
......
...@@ -31,10 +31,9 @@ public: ...@@ -31,10 +31,9 @@ public:
explicit TextToSpeechConfigDialog(QWidget *parent = nullptr); explicit TextToSpeechConfigDialog(QWidget *parent = nullptr);
~TextToSpeechConfigDialog(); ~TextToSpeechConfigDialog();
private Q_SLOTS:
void slotAccepted();
private: private:
void slotAccepted();
void slotRestoreDefaults();
void readConfig(); void readConfig();
void writeConfig(); void writeConfig();
KPIMTextEdit::TextToSpeechConfigWidget *mTextToSpeechConfigWidget; KPIMTextEdit::TextToSpeechConfigWidget *mTextToSpeechConfigWidget;
......
...@@ -135,6 +135,11 @@ void TextToSpeechConfigWidget::setTextToSpeechConfigInterface(AbstractTextToSpee ...@@ -135,6 +135,11 @@ void TextToSpeechConfigWidget::setTextToSpeechConfigInterface(AbstractTextToSpee
slotUpdateSettings(); slotUpdateSettings();
} }
void TextToSpeechConfigWidget::restoreDefaults()
{
//TODO
}
void TextToSpeechConfigWidget::updateAvailableEngine() void TextToSpeechConfigWidget::updateAvailableEngine()
{ {
mAvailableEngine->clear(); mAvailableEngine->clear();
......
...@@ -37,6 +37,7 @@ public: ...@@ -37,6 +37,7 @@ public:
void readConfig(); void readConfig();
void setTextToSpeechConfigInterface(AbstractTextToSpeechConfigInterface *interface); void setTextToSpeechConfigInterface(AbstractTextToSpeechConfigInterface *interface);
void restoreDefaults();
Q_SIGNALS: Q_SIGNALS:
void configChanged(bool state); void configChanged(bool state);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment