[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdeaccessibility/kttsd
From: Jeremy Paul Whiting <jeremy () scitools ! com>
Date: 2009-09-24 0:59:33
Message-ID: 1253753973.704600.17478.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 1027392 by whiting:
read/write talkers consistently from Talkers config group, for easy rewriting. Save \
talkers on apply or ok, not on add completion. change talker xml so its valid by \
putting the <prosody> tag inside the <voice> tag
M +3 -0 kcmkttsmgr/addtalkerwidget.ui
M +10 -6 kcmkttsmgr/kcmkttsmgr.cpp
M +4 -4 kttsd/talkermgr.cpp
M +27 -15 libkttsd/talkercode.cpp
M +3 -3 libkttsd/talkerlistmodel.cpp
--- trunk/KDE/kdeaccessibility/kttsd/kcmkttsmgr/addtalkerwidget.ui #1027391:1027392
@@ -27,6 +27,9 @@
</item>
<item row="1" column="0" colspan="2">
<widget class="QTableWidget" name="AvailableTalkersTable">
+ <property name="tabKeyNavigation">
+ <bool>false</bool>
+ </property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
--- trunk/KDE/kdeaccessibility/kttsd/kcmkttsmgr/kcmkttsmgr.cpp #1027391:1027392
@@ -537,9 +537,18 @@
generalConfig.writeEntry("EnableKttsd", enableKttsdCheckBox->isChecked());
// Get ordered list of all talker IDs.
+ QList<TalkerCode> talkers;
QStringList talkerIDsList;
+ KConfigGroup talkerGroup(m_config, "Talkers");
+ talkerGroup.deleteGroup();
for (int i = 0; i < m_talkerListModel.rowCount(); ++i)
- talkerIDsList.append(m_talkerListModel.getRow(i).name());
+ {
+ TalkerCode talker = m_talkerListModel.getRow(i);
+ talkers << talker;
+ talkerGroup.writeEntry(talker.name(), talker.getTalkerCode());
+ talkerIDsList << talker.name();
+ }
+
QString talkerIDs = talkerIDsList.join(",");
generalConfig.writeEntry("TalkerIDs", talkerIDs);
@@ -738,11 +747,6 @@
if (dlg->exec() == QDialog::Accepted) {
TalkerCode code = dlg->getTalkerCode();
- // Record configuration data.
- KConfigGroup talkerConfig(m_config, code.name());
- talkerConfig.writeEntry("TalkerCode", code.getTalkerCode());
- m_config->sync();
-
// Add to list of Talkers.
m_talkerListModel.appendRow(code);
--- trunk/KDE/kdeaccessibility/kttsd/kttsd/talkermgr.cpp #1027391:1027392
@@ -79,11 +79,11 @@
// Talker ID.
QString talkerID = *it;
- // Set the group for the language we're loading
- KConfigGroup talkerConfig(c, "Talker_" + talkerID);
+ // Set the group for the talker to load
+ KConfigGroup talkerConfig(c, "Talkers");
// Get the DesktopEntryName of the plugin we will try to load.
- QString desktopEntryName = talkerConfig.readEntry("DesktopEntryName", \
QString()); + //QString desktopEntryName = \
talkerConfig.readEntry("DesktopEntryName", QString());
// // If a DesktopEntryName is not in the config file, it was configured \
before // // we started using them, when we stored translated plugin \
names instead. @@ -100,7 +100,7 @@
// }
// Get the talker code.
- QString talkerCode = talkerConfig.readEntry("TalkerCode", QString());
+ QString talkerCode = talkerConfig.readEntry(talkerID, QString());
// Normalize the talker code.
//QString fullLanguageCode;
--- trunk/KDE/kdeaccessibility/kttsd/libkttsd/talkercode.cpp #1027391:1027392
@@ -115,8 +115,8 @@
QString TalkerCode::getTalkerCode() const
{
- QString code = QString("<voice name=\"%1\" lang=\"%2\" outputModule=\"%3\" \
/>").arg(m_name).arg(m_language).arg(m_outputModule);
- code += QString("<prosody volume=\"%1\" rate=\"%2\" pitch=\"%3\" \
/>").arg(m_volume).arg(m_rate).arg(m_pitch); + QString code = QString("<voice \
name=\"%1\" lang=\"%2\" outputModule=\"%3\" \
voiceType=\"%4\">").arg(m_name).arg(m_language).arg(m_outputModule).arg(m_voiceType); \
+ code += QString("<prosody volume=\"%1\" rate=\"%2\" pitch=\"%3\" \
/></voice>").arg(m_volume).arg(m_rate).arg(m_pitch); return code;
}
@@ -329,22 +329,34 @@
m_name = voice.attribute("name");
m_language = voice.attribute("lang");
m_outputModule = voice.attribute("outputModule");
- }
-
- QDomElement prosody = doc.firstChildElement("prosody");
- if (!prosody.isNull())
- {
bool result = false;
- m_volume = prosody.attribute("volume").toInt(&result);
+ m_voiceType = voice.attribute("voiceType").toInt(&result);
if (!result)
- m_volume = 0;
- m_rate = prosody.attribute("rate").toInt(&result);
- if (!result)
- m_rate = 0;
- m_pitch = prosody.attribute("pitch").toInt(&result);
- if (!result)
- m_pitch = 0;
+ m_voiceType = 1;
+
+ QDomElement prosody = voice.firstChildElement("prosody");
+ if (!prosody.isNull())
+ {
+ bool result = false;
+ m_volume = prosody.attribute("volume").toInt(&result);
+ if (!result)
+ m_volume = 0;
+ m_rate = prosody.attribute("rate").toInt(&result);
+ if (!result)
+ m_rate = 0;
+ m_pitch = prosody.attribute("pitch").toInt(&result);
+ if (!result)
+ m_pitch = 0;
+ }
+ else
+ {
+ kDebug() << "got a voice with no prosody tag";
+ }
}
+ else
+ {
+ kDebug() << "got a voice with no voice tag";
+ }
}
/**
--- trunk/KDE/kdeaccessibility/kttsd/libkttsd/talkerlistmodel.cpp #1027391:1027392
@@ -105,7 +105,7 @@
switch (column)
{
case kNameColumn: return talkerCode.name(); break;
- case kLanguageColumn: return talkerCode.language(); break;
+ case kLanguageColumn: return \
TalkerCode::languageCodeToLanguage(talkerCode.language()); break; case \
kModuleColumn: return talkerCode.outputModule(); break;
case kVoiceTypeColumn: return \
TalkerCode::translatedVoiceType(talkerCode.voiceType()); break; case kVolumeColumn: \
return talkerCode.volume(); break; @@ -204,8 +204,8 @@
{
QString talkerID = *it;
kDebug() << "TalkerListWidget::loadTalkerCodes: talkerID = " << \
talkerID;
- KConfigGroup talkGroup(c, QString("Talker_") + talkerID);
- QString talkerCode = talkGroup.readEntry("TalkerCode");
+ KConfigGroup talkGroup(c, "Talkers");
+ QString talkerCode = talkGroup.readEntry(talkerID);
TalkerCode tc = TalkerCode(talkerCode, true);
kDebug() << "TalkerCodeWidget::loadTalkerCodes: talkerCode = " << \
talkerCode; //tc.setId(talkerID);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic