Commit d648886b authored by Laurent Montel's avatar Laurent Montel 😁

Fix save/load value

parent d1e1da81
......@@ -57,8 +57,8 @@ void TextToSpeech::reloadSettings()
connect(mTextToSpeech, &QTextToSpeech::stateChanged, this, &TextToSpeech::slotStateChanged);
}
mDefaultEngine = engineName;
mTextToSpeech->setRate(grp.readEntry("rate", 0));
mTextToSpeech->setPitch(grp.readEntry("pitch", 0));
mTextToSpeech->setRate(grp.readEntry("rate", 0.0));
mTextToSpeech->setPitch(grp.readEntry("pitch", 0.0));
mTextToSpeech->setVolume(grp.readEntry("volume", 0));
mTextToSpeech->setLocale(QLocale(grp.readEntry("localeName")));
//It doesn't have api for it mTextToSpeech->setVoice(grp.readEntry("voice"));
......
......@@ -105,8 +105,8 @@ void TextToSpeechConfigWidget::readConfig()
{
KConfig config(QStringLiteral("texttospeechrc"));
KConfigGroup grp = config.group("Settings");
mRate->setValue(static_cast<int>(grp.readEntry("rate", 0) * 100));
mPitch->setValue(static_cast<int>(grp.readEntry("pitch", 0) * 100));
mRate->setValue(static_cast<int>(grp.readEntry("rate", 0.0) * 100));
mPitch->setValue(static_cast<int>(grp.readEntry("pitch", 0.0) * 100));
mVolume->setValue(static_cast<int>(grp.readEntry("volume", 50)));
updateLocale();
}
......@@ -116,8 +116,8 @@ void TextToSpeechConfigWidget::writeConfig()
KConfig config(QStringLiteral("texttospeechrc"));
KConfigGroup grp = config.group("Settings");
grp.writeEntry("volume", mVolume->value());
grp.writeEntry("rate", static_cast<double>(mRate->value() / 100));
grp.writeEntry("pitch", static_cast<double>(mPitch->value() / 100));
grp.writeEntry("rate", (static_cast<int>((static_cast<double>(mRate->value()) / 100.0))));
grp.writeEntry("pitch", (static_cast<int>((static_cast<double>(mPitch->value()) / 100.0))));
grp.writeEntry("localeName", mLanguage->currentData().toLocale().name());
grp.writeEntry("engine", mAvailableEngine->currentData().toString());
grp.writeEntry("voice", mVoice->currentData().toString());
......
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