summaryrefslogtreecommitdiff
path: root/rbutil/rbutilqt/ttsgui.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'rbutil/rbutilqt/ttsgui.cpp')
-rw-r--r--rbutil/rbutilqt/ttsgui.cpp59
1 files changed, 30 insertions, 29 deletions
diff --git a/rbutil/rbutilqt/ttsgui.cpp b/rbutil/rbutilqt/ttsgui.cpp
index cd4dab1fcf..ead32f17c3 100644
--- a/rbutil/rbutilqt/ttsgui.cpp
+++ b/rbutil/rbutilqt/ttsgui.cpp
@@ -36,18 +36,18 @@ TTSSapiGui::TTSSapiGui(TTSSapi* sapi,QDialog* parent) : QDialog(parent)
36void TTSSapiGui::showCfg() 36void TTSSapiGui::showCfg()
37{ 37{
38 // try to get config from settings 38 // try to get config from settings
39 ui.ttsoptions->setText(settings->ttsOptions("sapi")); 39 ui.ttsoptions->setText(settings->subValue("sapi", RbSettings::TtsOptions).toString());
40 QString selLang = settings->ttsLang("sapi"); 40 QString selLang = settings->subValue("sapi", RbSettings::TtsLanguage).toString();
41 QString selVoice = settings->ttsVoice("sapi"); 41 QString selVoice = settings->subValue("sapi", RbSettings::TtsVoice).toString();
42 ui.speed->setValue(settings->ttsSpeed("sapi")); 42 ui.speed->setValue(settings->subValue("sapi", RbSettings::TtsSpeed).toInt());
43 if(settings->ttsUseSapi4()) 43 if(settings->value(RbSettings::TtsUseSapi4).toBool())
44 ui.usesapi4->setCheckState(Qt::Checked); 44 ui.usesapi4->setCheckState(Qt::Checked);
45 else 45 else
46 ui.usesapi4->setCheckState(Qt::Unchecked); 46 ui.usesapi4->setCheckState(Qt::Unchecked);
47 47
48 // fill in language combobox 48 // fill in language combobox
49 QStringList languages = settings->allLanguages(); 49 QStringList languages = settings->languages();
50 50
51 languages.sort(); 51 languages.sort();
52 ui.languagecombo->clear(); 52 ui.languagecombo->clear();
53 ui.languagecombo->addItems(languages); 53 ui.languagecombo->addItems(languages);
@@ -78,14 +78,14 @@ void TTSSapiGui::reset()
78void TTSSapiGui::accept(void) 78void TTSSapiGui::accept(void)
79{ 79{
80 //save settings in user config 80 //save settings in user config
81 settings->setTTSOptions("sapi",ui.ttsoptions->text()); 81 settings->setSubValue("sapi", RbSettings::TtsOptions, ui.ttsoptions->text());
82 settings->setTTSLang("sapi",ui.languagecombo->currentText()); 82 settings->setSubValue("sapi", RbSettings::TtsLanguage, ui.languagecombo->currentText());
83 settings->setTTSVoice("sapi",ui.voicecombo->currentText()); 83 settings->setSubValue("sapi", RbSettings::TtsVoice, ui.voicecombo->currentText());
84 settings->setTTSSpeed("sapi",ui.speed->value()); 84 settings->setSubValue("sapi", RbSettings::TtsSpeed, ui.speed->value());
85 if(ui.usesapi4->checkState() == Qt::Checked) 85 if(ui.usesapi4->checkState() == Qt::Checked)
86 settings->setTTSUseSapi4(true); 86 settings->setValue(RbSettings::TtsUseSapi4, true);
87 else 87 else
88 settings->setTTSUseSapi4(false); 88 settings->setValue(RbSettings::TtsUseSapi4, false);
89 // sync settings 89 // sync settings
90 settings->sync(); 90 settings->sync();
91 91
@@ -108,9 +108,9 @@ void TTSSapiGui::updateVoices(QString language)
108void TTSSapiGui::useSapi4Changed(int) 108void TTSSapiGui::useSapi4Changed(int)
109{ 109{
110 if(ui.usesapi4->checkState() == Qt::Checked) 110 if(ui.usesapi4->checkState() == Qt::Checked)
111 settings->setTTSUseSapi4(true); 111 settings->setValue(RbSettings::TtsUseSapi4, true);
112 else 112 else
113 settings->setTTSUseSapi4(false); 113 settings->setValue(RbSettings::TtsUseSapi4, false);
114 // sync settings 114 // sync settings
115 settings->sync(); 115 settings->sync();
116 updateVoices(ui.languagecombo->currentText()); 116 updateVoices(ui.languagecombo->currentText());
@@ -136,8 +136,8 @@ void TTSExesGui::showCfg(QString name)
136{ 136{
137 m_name = name; 137 m_name = name;
138 // try to get config from settings 138 // try to get config from settings
139 QString exepath =settings->ttsPath(m_name); 139 QString exepath =settings->subValue(m_name, RbSettings::TtsPath).toString();
140 ui.ttsoptions->setText(settings->ttsOptions(m_name)); 140 ui.ttsoptions->setText(settings->subValue(m_name, RbSettings::TtsOptions).toString());
141 ui.ttspath->setText(exepath); 141 ui.ttspath->setText(exepath);
142 142
143 //show dialog 143 //show dialog
@@ -148,8 +148,8 @@ void TTSExesGui::showCfg(QString name)
148void TTSExesGui::accept(void) 148void TTSExesGui::accept(void)
149{ 149{
150 //save settings in user config 150 //save settings in user config
151 settings->setTTSPath(m_name,ui.ttspath->text()); 151 settings->setSubValue(m_name, RbSettings::TtsPath, ui.ttspath->text());
152 settings->setTTSOptions(m_name,ui.ttsoptions->text()); 152 settings->setSubValue(m_name, RbSettings::TtsOptions, ui.ttsoptions->text());
153 // sync settings 153 // sync settings
154 settings->sync(); 154 settings->sync();
155 155
@@ -199,15 +199,15 @@ TTSFestivalGui::TTSFestivalGui(TTSFestival* api, QDialog* parent) :
199 199
200void TTSFestivalGui::showCfg() 200void TTSFestivalGui::showCfg()
201{ 201{
202 qDebug() << "show\tpaths: " << settings->ttsPath("festival") << "\n" 202 qDebug() << "show\tpaths: " << settings->subValue("festival", RbSettings::TtsPath) << "\n"
203 << "\tvoice: " << settings->ttsVoice("festival"); 203 << "\tvoice: " << settings->subValue("festival", RbSettings::TtsVoice);
204 204
205 // will populate the voices if the paths are correct, 205 // will populate the voices if the paths are correct,
206 // otherwise, it will require the user to press Refresh 206 // otherwise, it will require the user to press Refresh
207 updateVoices(); 207 updateVoices();
208 208
209 // try to get config from settings 209 // try to get config from settings
210 QStringList paths = settings->ttsPath("festival").split(":"); 210 QStringList paths = settings->subValue("festival", RbSettings::TtsPath).toString().split(":");
211 if(paths.size() == 2) 211 if(paths.size() == 2)
212 { 212 {
213 ui.serverPath->setText(paths[0]); 213 ui.serverPath->setText(paths[0]);
@@ -223,8 +223,8 @@ void TTSFestivalGui::accept(void)
223 //save settings in user config 223 //save settings in user config
224 QString newPath = QString("%1:%2").arg(ui.serverPath->text().trimmed()).arg(ui.clientPath->text().trimmed()); 224 QString newPath = QString("%1:%2").arg(ui.serverPath->text().trimmed()).arg(ui.clientPath->text().trimmed());
225 qDebug() << "set\tpaths: " << newPath << "\n\tvoice: " << ui.voicesBox->currentText(); 225 qDebug() << "set\tpaths: " << newPath << "\n\tvoice: " << ui.voicesBox->currentText();
226 settings->setTTSPath("festival", newPath); 226 settings->setSubValue("festival", RbSettings::TtsPath, newPath);
227 settings->setTTSVoice("festival", ui.voicesBox->currentText()); 227 settings->setSubValue("festival", RbSettings::TtsVoice, ui.voicesBox->currentText());
228 228
229 settings->sync(); 229 settings->sync();
230 230
@@ -288,13 +288,13 @@ void TTSFestivalGui::onRefreshButton()
288{ 288{
289 /* Temporarily commit the settings so that we get the new path when we check for voices */ 289 /* Temporarily commit the settings so that we get the new path when we check for voices */
290 QString newPath = QString("%1:%2").arg(ui.serverPath->text().trimmed()).arg(ui.clientPath->text().trimmed()); 290 QString newPath = QString("%1:%2").arg(ui.serverPath->text().trimmed()).arg(ui.clientPath->text().trimmed());
291 QString oldPath = settings->ttsPath("festival"); 291 QString oldPath = settings->subValue("festival", RbSettings::TtsPath).toString();
292 qDebug() << "new path: " << newPath << "\n" << "old path: " << oldPath << "\nuse new: " << (newPath != oldPath); 292 qDebug() << "new path: " << newPath << "\n" << "old path: " << oldPath << "\nuse new: " << (newPath != oldPath);
293 293
294 if(newPath != oldPath) 294 if(newPath != oldPath)
295 { 295 {
296 qDebug() << "Using new paths for getVoiceList"; 296 qDebug() << "Using new paths for getVoiceList";
297 settings->setTTSPath("festival", newPath); 297 settings->setSubValue("festival", RbSettings::TtsPath, newPath);
298 settings->sync(); 298 settings->sync();
299 } 299 }
300 300
@@ -302,7 +302,7 @@ void TTSFestivalGui::onRefreshButton()
302 302
303 if(newPath != oldPath) 303 if(newPath != oldPath)
304 { 304 {
305 settings->setTTSPath("festival", oldPath); 305 settings->setSubValue("festival", RbSettings::TtsPath, oldPath);
306 settings->sync(); 306 settings->sync();
307 } 307 }
308} 308}
@@ -324,9 +324,10 @@ void TTSFestivalGui::updateVoices()
324 ui.voicesBox->clear(); 324 ui.voicesBox->clear();
325 ui.voicesBox->addItems(voiceList); 325 ui.voicesBox->addItems(voiceList);
326 326
327 ui.voicesBox->setCurrentIndex(ui.voicesBox->findText(settings->ttsVoice("festival"))); 327 ui.voicesBox->setCurrentIndex(ui.voicesBox->findText(
328 settings->subValue("festival", RbSettings::TtsVoice).toString()));
328 329
329 updateDescription(settings->ttsVoice("festival")); 330 updateDescription(settings->subValue("festival", RbSettings::TtsVoice).toString());
330} 331}
331 332
332void TTSFestivalGui::updateDescription(QString value) 333void TTSFestivalGui::updateDescription(QString value)