summaryrefslogtreecommitdiffstats
path: root/rbutil
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2007-08-28 23:10:42 +0000
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2007-08-28 23:10:42 +0000
commitc03102b34616f81f35cc2ea17af2942fd009d291 (patch)
treeb6a61535c9e63e9a982b9dc5493f0d27c86f2788 /rbutil
parentf2bf042edfef57e499b4d18694acca92d435d447 (diff)
downloadrockbox-c03102b34616f81f35cc2ea17af2942fd009d291.tar.gz
rockbox-c03102b34616f81f35cc2ea17af2942fd009d291.zip
Completely rework the talk files window: move settings to configuration dialog and add configuration presets. Remove some old cruft from talkfile handling and rely on values from rbutil.ini. Autodetection of executables is missing.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14495 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'rbutil')
-rw-r--r--rbutil/rbutilqt/configure.cpp92
-rw-r--r--rbutil/rbutilqt/configure.h3
-rw-r--r--rbutil/rbutilqt/configurefrm.ui209
-rw-r--r--rbutil/rbutilqt/icons/audio-input-microphone.pngbin0 -> 703 bytes
-rw-r--r--rbutil/rbutilqt/installtalkfrm.ui134
-rw-r--r--rbutil/rbutilqt/installtalkwindow.cpp192
-rw-r--r--rbutil/rbutilqt/installtalkwindow.h21
-rw-r--r--rbutil/rbutilqt/installzip.h2
-rw-r--r--rbutil/rbutilqt/rbutil.ini42
-rw-r--r--rbutil/rbutilqt/rbutilqt.qrc1
-rw-r--r--rbutil/rbutilqt/talkfile.cpp26
-rw-r--r--rbutil/rbutilqt/talkfile.h24
12 files changed, 386 insertions, 360 deletions
diff --git a/rbutil/rbutilqt/configure.cpp b/rbutil/rbutilqt/configure.cpp
index e6b97b214d..b1f778b586 100644
--- a/rbutil/rbutilqt/configure.cpp
+++ b/rbutil/rbutilqt/configure.cpp
@@ -68,6 +68,10 @@ Config::Config(QWidget *parent) : QDialog(parent)
connect(ui.buttonAutodetect,SIGNAL(clicked()),this,SLOT(autodetect()));
connect(ui.buttonCacheBrowse, SIGNAL(clicked()), this, SLOT(browseCache()));
connect(ui.buttonCacheClear, SIGNAL(clicked()), this, SLOT(cacheClear()));
+ connect(ui.browseTts, SIGNAL(clicked()), this, SLOT(browseTts()));
+ connect(ui.comboEncoder, SIGNAL(currentIndexChanged(int)), this, SLOT(updateEncOpts(int)));
+ connect(ui.comboTts, SIGNAL(currentIndexChanged(int)), this, SLOT(updateTtsOpts(int)));
+
}
@@ -119,6 +123,19 @@ void Config::accept()
userSettings->setValue("defaults/cachedisable", ui.cacheDisable->isChecked());
userSettings->setValue("defaults/offline", ui.cacheOfflineMode->isChecked());
+ // tts settings
+ if(QFileInfo(ui.ttsExecutable->text()).isExecutable())
+ userSettings->setValue("ttsbin", ui.ttsExecutable->text());
+ userSettings->setValue("ttsopts", ui.ttsOptions->text());
+ if(QFileInfo(ui.encoderExecutable->text()).isExecutable())
+ userSettings->setValue("encbin", ui.encoderExecutable->text());
+ userSettings->setValue("ttsopts", ui.ttsOptions->text());
+ QString preset;
+ preset = ui.comboEncoder->itemData(ui.comboEncoder->currentIndex(), Qt::UserRole).toString();
+ userSettings->setValue("encpreset", preset);
+ preset = ui.comboTts->itemData(ui.comboTts->currentIndex(), Qt::UserRole).toString();
+ userSettings->setValue("ttspreset", preset);
+
// sync settings
userSettings->sync();
this->close();
@@ -186,6 +203,7 @@ void Config::setUserSettings(QSettings *user)
}
ui.cacheSize->setText(tr("Current cache size is %1 kiB.")
.arg(sz/1024));
+
}
@@ -262,6 +280,58 @@ void Config::setDevices(QSettings *dev)
ui.treeDevices->insertTopLevelItems(0, items);
if(w3 != 0)
ui.treeDevices->setCurrentItem(w3); // hilight old selection
+
+ // tts / encoder tab
+ QStringList keys;
+
+ devices->beginGroup("encoders");
+ keys = devices->allKeys();
+ for(int i=0; i < keys.size();i++)
+ ui.comboEncoder->addItem(devices->value(keys.at(i), "null").toString(),
+ keys.at(i));
+ devices->endGroup();
+
+ devices->beginGroup("tts");
+ keys = devices->allKeys();
+ for(int i=0; i < keys.size();i++)
+ ui.comboTts->addItem(devices->value(keys.at(i), "null").toString(), keys.at(i));
+ devices->endGroup();
+
+ int index;
+ index = ui.comboTts->findData(userSettings->value("ttspreset").toString(),
+ Qt::UserRole, Qt::MatchExactly);
+ ui.comboTts->setCurrentIndex(index);
+ updateTtsOpts(index);
+ ui.ttsExecutable->setText(userSettings->value("ttsbin").toString());
+
+ index = ui.comboEncoder->findData(userSettings->value("encpreset").toString(),
+ Qt::UserRole, Qt::MatchExactly);
+ ui.comboEncoder->setCurrentIndex(index);
+ updateEncOpts(index);
+ ui.encoderExecutable->setText(userSettings->value("encbin").toString());
+
+}
+
+
+void Config::updateEncOpts(int index)
+{
+ qDebug() << "updateEncOpts()";
+ QString c = ui.comboEncoder->itemData(index, Qt::UserRole).toString();
+ devices->beginGroup(c);
+ ui.encoderOptions->setText(devices->value("options").toString());
+ ui.encoderOptions->setEnabled(devices->value("edit").toBool());
+ devices->endGroup();
+}
+
+
+void Config::updateTtsOpts(int index)
+{
+ QString c = ui.comboTts->itemData(index, Qt::UserRole).toString();
+ devices->beginGroup(c);
+ qDebug() << devices->value("edit").toBool();
+ ui.ttsOptions->setText(devices->value("options").toString());
+ ui.ttsOptions->setEnabled(devices->value("edit").toBool());
+ devices->endGroup();
}
@@ -466,3 +536,25 @@ void Config::cacheClear()
qDebug() << "removed:" << f;
}
}
+
+
+void Config::browseTts()
+{
+ BrowseDirtree browser(this);
+ browser.setFilter(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot);
+
+ if(QFileInfo(ui.ttsExecutable->text()).isDir())
+ {
+ QDir d(ui.ttsExecutable->text());
+ browser.setDir(d);
+ }
+ if(browser.exec() == QDialog::Accepted)
+ {
+ qDebug() << browser.getSelected();
+ QString exe = browser.getSelected();
+ if(!QFileInfo(exe).isExecutable())
+ return;
+ ui.ttsExecutable->setText(exe);
+ }
+
+}
diff --git a/rbutil/rbutilqt/configure.h b/rbutil/rbutilqt/configure.h
index 33f30acc0f..ee7ff08604 100644
--- a/rbutil/rbutilqt/configure.h
+++ b/rbutil/rbutilqt/configure.h
@@ -63,6 +63,9 @@ class Config : public QDialog
void setMountpoint(QString);
void setCache(QString);
void cacheClear(void);
+ void browseTts(void);
+ void updateTtsOpts(int);
+ void updateEncOpts(int);
};
#endif
diff --git a/rbutil/rbutilqt/configurefrm.ui b/rbutil/rbutilqt/configurefrm.ui
index 087cdf34bd..af54ad1442 100644
--- a/rbutil/rbutilqt/configurefrm.ui
+++ b/rbutil/rbutilqt/configurefrm.ui
@@ -6,7 +6,7 @@
<x>0</x>
<y>0</y>
<width>500</width>
- <height>400</height>
+ <height>435</height>
</rect>
</property>
<property name="windowTitle" >
@@ -20,39 +20,6 @@
</property>
</widget>
</item>
- <item row="2" column="0" >
- <spacer>
- <property name="orientation" >
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" >
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="2" column="1" >
- <widget class="QPushButton" name="buttonOk" >
- <property name="text" >
- <string>&amp;Ok</string>
- </property>
- <property name="icon" >
- <iconset resource="rbutilqt.qrc" >:/icons/icons/go-next.png</iconset>
- </property>
- </widget>
- </item>
- <item row="2" column="2" >
- <widget class="QPushButton" name="buttonCancel" >
- <property name="text" >
- <string>&amp;Cancel</string>
- </property>
- <property name="icon" >
- <iconset resource="rbutilqt.qrc" >:/icons/icons/process-stop.png</iconset>
- </property>
- </widget>
- </item>
<item row="1" column="0" colspan="3" >
<widget class="QTabWidget" name="tabConfiguration" >
<property name="currentIndex" >
@@ -319,7 +286,7 @@
<string>&amp;Browse</string>
</property>
<property name="icon" >
- <iconset resource="rbutilqt.qrc" >:/icons/icons/system-search.png</iconset>
+ <iconset resource="rbutilqt.qrc" >:/icons/icons/edit-find.png</iconset>
</property>
</widget>
</item>
@@ -384,6 +351,178 @@
</item>
</layout>
</widget>
+ <widget class="QWidget" name="tabTts" >
+ <attribute name="title" >
+ <string>&amp;TTS &amp;&amp; Encoder</string>
+ </attribute>
+ <attribute name="icon" >
+ <iconset resource="rbutilqt.qrc" >:/icons/icons/audio-input-microphone.png</iconset>
+ </attribute>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" colspan="2" >
+ <widget class="QGroupBox" name="groupBox_2" >
+ <property name="title" >
+ <string>TTS Engine</string>
+ </property>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <widget class="QLabel" name="labelTts" >
+ <property name="text" >
+ <string>&amp;Select TTS profile</string>
+ </property>
+ <property name="buddy" >
+ <cstring>comboTts</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1" colspan="2" >
+ <widget class="QComboBox" name="comboTts" />
+ </item>
+ <item row="1" column="0" >
+ <widget class="QLabel" name="labelTtsExecutable" >
+ <property name="text" >
+ <string>TTS executable</string>
+ </property>
+ <property name="buddy" >
+ <cstring>ttsExecutable</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1" >
+ <widget class="QLineEdit" name="ttsExecutable" />
+ </item>
+ <item row="1" column="2" >
+ <widget class="QPushButton" name="browseTts" >
+ <property name="text" >
+ <string>&amp;Browse</string>
+ </property>
+ <property name="icon" >
+ <iconset resource="rbutilqt.qrc" >:/icons/icons/edit-find.png</iconset>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" >
+ <widget class="QLabel" name="labelTtsOptions" >
+ <property name="text" >
+ <string>TTS Options</string>
+ </property>
+ <property name="buddy" >
+ <cstring>ttsOptions</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1" colspan="2" >
+ <widget class="QLineEdit" name="ttsOptions" />
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item rowspan="2" row="1" column="0" colspan="2" >
+ <widget class="QGroupBox" name="groupBox_3" >
+ <property name="title" >
+ <string>Encoder Engine</string>
+ </property>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <widget class="QLabel" name="labelEncoder" >
+ <property name="text" >
+ <string>Select &amp;encoder profile</string>
+ </property>
+ <property name="buddy" >
+ <cstring>comboEncoder</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1" colspan="2" >
+ <widget class="QComboBox" name="comboEncoder" />
+ </item>
+ <item row="1" column="0" >
+ <widget class="QLabel" name="labelEncoderExecutable" >
+ <property name="text" >
+ <string>Encoder executable</string>
+ </property>
+ <property name="buddy" >
+ <cstring>encoderExecutable</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1" >
+ <widget class="QLineEdit" name="encoderExecutable" />
+ </item>
+ <item row="1" column="2" >
+ <widget class="QPushButton" name="browseEncoder" >
+ <property name="text" >
+ <string>B&amp;rowse</string>
+ </property>
+ <property name="icon" >
+ <iconset resource="rbutilqt.qrc" >:/icons/icons/edit-find.png</iconset>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" >
+ <widget class="QLabel" name="labelEncoderOptions" >
+ <property name="text" >
+ <string>Encoder options</string>
+ </property>
+ <property name="buddy" >
+ <cstring>encoderOptions</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1" colspan="2" >
+ <widget class="QLineEdit" name="encoderOptions" />
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="3" column="0" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </item>
+ <item row="2" column="0" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="2" column="1" >
+ <widget class="QPushButton" name="buttonOk" >
+ <property name="text" >
+ <string>&amp;Ok</string>
+ </property>
+ <property name="icon" >
+ <iconset resource="rbutilqt.qrc" >:/icons/icons/go-next.png</iconset>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="2" >
+ <widget class="QPushButton" name="buttonCancel" >
+ <property name="text" >
+ <string>&amp;Cancel</string>
+ </property>
+ <property name="icon" >
+ <iconset resource="rbutilqt.qrc" >:/icons/icons/process-stop.png</iconset>
+ </property>
</widget>
</item>
</layout>
diff --git a/rbutil/rbutilqt/icons/audio-input-microphone.png b/rbutil/rbutilqt/icons/audio-input-microphone.png
new file mode 100644
index 0000000000..53a0393179
--- /dev/null
+++ b/rbutil/rbutilqt/icons/audio-input-microphone.png
Binary files differ
diff --git a/rbutil/rbutilqt/installtalkfrm.ui b/rbutil/rbutilqt/installtalkfrm.ui
index d43326dd6e..ef1a997826 100644
--- a/rbutil/rbutilqt/installtalkfrm.ui
+++ b/rbutil/rbutilqt/installtalkfrm.ui
@@ -8,15 +8,15 @@
<rect>
<x>0</x>
<y>0</y>
- <width>681</width>
- <height>516</height>
+ <width>600</width>
+ <height>450</height>
</rect>
</property>
<property name="windowTitle" >
<string>Install Talk Files</string>
</property>
<layout class="QGridLayout" >
- <item rowspan="5" row="0" column="0" >
+ <item rowspan="6" row="0" column="0" >
<widget class="QLabel" name="label" >
<property name="text" >
<string/>
@@ -29,17 +29,17 @@
</property>
</widget>
</item>
- <item row="0" column="1" colspan="5" >
+ <item row="0" column="1" colspan="3" >
<widget class="QLabel" name="label_2" >
<property name="text" >
<string>Select the Folder to generate Talkfiles for.</string>
</property>
</widget>
</item>
- <item row="1" column="1" colspan="4" >
+ <item row="1" column="1" colspan="2" >
<widget class="QLineEdit" name="lineTalkFolder" />
</item>
- <item row="1" column="5" >
+ <item row="1" column="3" >
<widget class="QPushButton" name="buttonBrowse" >
<property name="text" >
<string>&amp;Browse</string>
@@ -49,134 +49,74 @@
</property>
</widget>
</item>
- <item row="2" column="1" colspan="5" >
- <widget class="QGroupBox" name="groupBox" >
+ <item row="2" column="1" colspan="3" >
+ <widget class="QGroupBox" name="groupBox_2" >
<property name="title" >
- <string>TTS Engine</string>
+ <string>Generation settings</string>
</property>
<layout class="QGridLayout" >
- <item row="0" column="0" colspan="2" >
- <widget class="QLabel" name="label_3" >
- <property name="text" >
- <string>Select a TTS Engine</string>
- </property>
- </widget>
- </item>
- <item row="1" column="0" colspan="2" >
- <widget class="QComboBox" name="TTScbx" />
- </item>
- <item row="2" column="0" colspan="2" >
- <widget class="QLabel" name="label_4" >
- <property name="text" >
- <string>Select the TTS executable in your Filesystem</string>
- </property>
- </widget>
- </item>
- <item row="3" column="0" >
- <widget class="QLineEdit" name="TTSpath" />
- </item>
- <item row="3" column="1" >
- <widget class="QPushButton" name="buttonBrowseTTS" >
+ <item row="0" column="0" >
+ <widget class="QLabel" name="labelEncProfile" >
<property name="text" >
- <string>Browse</string>
+ <string>Encoder profile:</string>
</property>
</widget>
</item>
- <item row="4" column="0" >
- <widget class="QLabel" name="label_7" >
+ <item row="1" column="0" >
+ <widget class="QLabel" name="labelTtsProfile" >
<property name="text" >
- <string>TTS Options</string>
+ <string>TTS profile:</string>
</property>
</widget>
</item>
- <item row="5" column="0" colspan="2" >
- <widget class="QLineEdit" name="TTSOptions" />
- </item>
</layout>
</widget>
</item>
- <item row="3" column="1" colspan="5" >
- <widget class="QGroupBox" name="groupBox_2" >
+ <item row="3" column="1" colspan="3" >
+ <widget class="QGroupBox" name="groupBox" >
<property name="title" >
- <string>Encoder Engine</string>
+ <string>Generation options</string>
</property>
<layout class="QGridLayout" >
- <item row="0" column="0" colspan="2" >
- <widget class="QLabel" name="label_5" >
+ <item row="0" column="0" >
+ <widget class="QCheckBox" name="OverwriteWav" >
<property name="text" >
- <string>Select an Encoder</string>
+ <string>Overwrite Wavefiles</string>
</property>
</widget>
</item>
- <item row="1" column="0" colspan="2" >
- <widget class="QComboBox" name="Encodercbx" />
+ <item row="1" column="0" >
+ <widget class="QCheckBox" name="RemoveWav" >
+ <property name="text" >
+ <string>Remove Wavefiles</string>
+ </property>
+ </widget>
</item>
- <item row="2" column="0" colspan="2" >
- <widget class="QLabel" name="label_6" >
+ <item row="2" column="0" >
+ <widget class="QCheckBox" name="recursive" >
<property name="text" >
- <string>Select the Encoder executable in your Filesystem</string>
+ <string>Run recursive</string>
</property>
</widget>
</item>
<item row="3" column="0" >
- <widget class="QLineEdit" name="Encoderpath" />
- </item>
- <item row="3" column="1" >
- <widget class="QPushButton" name="buttonBrowseEncoder" >
+ <widget class="QCheckBox" name="StripExtensions" >
<property name="text" >
- <string>Browse</string>
+ <string>Strip Extensions</string>
</property>
</widget>
</item>
<item row="4" column="0" >
- <widget class="QLabel" name="label_8" >
+ <widget class="QCheckBox" name="OverwriteTalk" >
<property name="text" >
- <string>Encoder Options</string>
+ <string>Overwrite Talkfiles</string>
</property>
</widget>
</item>
- <item row="5" column="0" colspan="2" >
- <widget class="QLineEdit" name="EncoderOptions" />
- </item>
</layout>
</widget>
</item>
- <item row="4" column="1" >
- <widget class="QCheckBox" name="OverwriteWav" >
- <property name="text" >
- <string>Overwrite Wavefiles</string>
- </property>
- </widget>
- </item>
<item row="4" column="2" >
- <widget class="QCheckBox" name="RemoveWav" >
- <property name="text" >
- <string>Remove Wavefiles</string>
- </property>
- </widget>
- </item>
- <item row="4" column="3" colspan="2" >
- <widget class="QCheckBox" name="recursive" >
- <property name="text" >
- <string>Run recursive</string>
- </property>
- </widget>
- </item>
- <item row="5" column="1" >
- <widget class="QCheckBox" name="OverwriteTalk" >
- <property name="text" >
- <string>Overwrite Talkfiles</string>
- </property>
- </widget>
- </item>
- <item row="5" column="2" >
- <widget class="QCheckBox" name="StripExtensions" >
- <property name="text" >
- <string>Strip Extensions</string>
- </property>
- </widget>
- </item>
- <item row="5" column="4" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
@@ -184,12 +124,12 @@
<property name="sizeHint" >
<size>
<width>20</width>
- <height>111</height>
+ <height>40</height>
</size>
</property>
</spacer>
</item>
- <item row="6" column="1" colspan="3" >
+ <item row="5" column="1" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
@@ -202,7 +142,7 @@
</property>
</spacer>
</item>
- <item row="6" column="4" colspan="2" >
+ <item row="5" column="2" colspan="2" >
<layout class="QHBoxLayout" >
<item>
<widget class="QPushButton" name="buttonOk" >
diff --git a/rbutil/rbutilqt/installtalkwindow.cpp b/rbutil/rbutilqt/installtalkwindow.cpp
index d52d7788ce..cc2def6ab1 100644
--- a/rbutil/rbutilqt/installtalkwindow.cpp
+++ b/rbutil/rbutilqt/installtalkwindow.cpp
@@ -28,19 +28,12 @@ InstallTalkWindow::InstallTalkWindow(QWidget *parent) : QDialog(parent)
talkcreator = new TalkFileCreator(this);
connect(ui.buttonBrowse, SIGNAL(clicked()), this, SLOT(browseFolder()));
- connect(ui.buttonBrowseTTS, SIGNAL(clicked()), this, SLOT(browseTTS()));
- connect(ui.buttonBrowseEncoder, SIGNAL(clicked()), this, SLOT(browseEncoder()));
-
- connect(ui.Encodercbx,SIGNAL(currentIndexChanged(int)),this,SLOT(setEncoderOptions(int)));
- connect(ui.TTScbx,SIGNAL(currentIndexChanged(int)),this,SLOT(setTTSOptions(int)));
-
+
ui.OverwriteWav->setChecked(true);
ui.RemoveWav->setChecked(true);
ui.recursive->setChecked(true);
ui.OverwriteTalk->setChecked(true);
ui.StripExtensions->setChecked(true);
-
-
}
void InstallTalkWindow::browseFolder()
@@ -67,87 +60,9 @@ void InstallTalkWindow::browseFolder()
void InstallTalkWindow::setTalkFolder(QString folder)
{
- ui.lineTalkFolder->clear();
- ui.lineTalkFolder->insert(folder);
+ ui.lineTalkFolder->setText(folder);
}
-void InstallTalkWindow::browseTTS()
-{
- BrowseDirtree browser(this);
- browser.setFilter(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot);
-
- if(QFileInfo(ui.TTSpath->text()).isDir())
- {
- QDir d(ui.TTSpath->text());
- browser.setDir(d);
- }
- else
- {
- QDir d("/media");
- browser.setDir(d);
- }
- if(browser.exec() == QDialog::Accepted)
- {
- qDebug() << browser.getSelected();
- setTTSExec(browser.getSelected());
- }
-
-}
-
-void InstallTalkWindow::setTTSExec(QString path)
-{
- ui.TTSpath->clear();
- ui.TTSpath->insert(path);
-}
-
-void InstallTalkWindow::browseEncoder()
-{
- BrowseDirtree browser(this);
- browser.setFilter(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot);
-
- if(QFileInfo(ui.Encoderpath->text()).isDir())
- {
- QDir d(ui.Encoderpath->text());
- browser.setDir(d);
- }
- else
- {
- QDir d("/media");
- browser.setDir(d);
- }
- if(browser.exec() == QDialog::Accepted)
- {
- qDebug() << browser.getSelected();
- setEncoderExec(browser.getSelected());
- }
-}
-
-void InstallTalkWindow::setEncoderExec(QString path)
-{
- ui.Encoderpath->clear();
- ui.Encoderpath->insert(path);
-}
-
-void InstallTalkWindow::setEncoderOptions(int index)
-{
- QString options = talkcreator->getEncOpts(ui.Encodercbx->itemText(index));
- setEncoderOptions(options);
-}
-void InstallTalkWindow::setEncoderOptions(QString options)
-{
- ui.EncoderOptions->clear();
- ui.EncoderOptions->insert(options);
-}
-void InstallTalkWindow::setTTSOptions(QString options)
-{
- ui.TTSOptions->clear();
- ui.TTSOptions->insert(options);
-}
-void InstallTalkWindow::setTTSOptions(int index)
-{
- QString options = talkcreator->getTTsOpts(ui.TTScbx->itemText(index));
- setEncoderOptions(options);
-}
void InstallTalkWindow::accept()
{
@@ -155,8 +70,8 @@ void InstallTalkWindow::accept()
logger->show();
QString folderToTalk = ui.lineTalkFolder->text();
- QString pathEncoder = ui.Encoderpath->text();
- QString pathTTS = ui.TTSpath->text();
+ QString pathEncoder = userSettings->value("encbin").toString();
+ QString pathTTS = userSettings->value("ttsbin").toString();
if(!QFileInfo(folderToTalk).isDir())
{
@@ -165,33 +80,40 @@ void InstallTalkWindow::accept()
return;
}
- if(!QFileInfo(pathEncoder).exists())
+ if(!QFileInfo(pathEncoder).isExecutable())
{
logger->addItem(tr("Path to Encoder is wrong!"),LOGERROR);
logger->abort();
return;
}
- if(!QFileInfo(pathTTS).exists())
+ if(!QFileInfo(pathTTS).isExecutable())
{
logger->addItem(tr("Path to TTS is wrong!"),LOGERROR);
logger->abort();
return;
}
- userSettings->setValue("defaults/folderToTalk",folderToTalk);
- userSettings->setValue("defaults/pathEncoder",pathEncoder);
- userSettings->setValue("defaults/pathTTS",pathTTS);
+ userSettings->setValue("last_talked_folder", folderToTalk);
userSettings->sync();
-
+
talkcreator->setDir(folderToTalk);
talkcreator->setTTSexe(pathTTS);
talkcreator->setEncexe(pathEncoder);
- talkcreator->setEncOpts(ui.EncoderOptions->text());
- talkcreator->setTTsOpts(ui.TTSOptions->text());
- talkcreator->setTTsType(ui.TTScbx->currentText());
- talkcreator->setEncType(ui.Encodercbx->currentText());
+ talkcreator->setEncOpts(userSettings->value("encopts").toString());
+ talkcreator->setTTsOpts(userSettings->value("ttsopts").toString());
+
+ devices->beginGroup(userSettings->value("ttspreset").toString());
+ talkcreator->setTTsType(devices->value("tts").toString());
+ talkcreator->setTTsOpts(devices->value("options").toString());
+ talkcreator->setTTsTemplate(devices->value("template").toString());
+ devices->endGroup();
+ devices->beginGroup(userSettings->value("encpreset").toString());
+ talkcreator->setEncType(devices->value("encoder").toString());
+ talkcreator->setEncOpts(devices->value("options").toString());
+ talkcreator->setEncTemplate(devices->value("template").toString());
+ devices->endGroup();
talkcreator->setOverwriteTalk(ui.OverwriteTalk->isChecked());
talkcreator->setOverwriteWav(ui.OverwriteWav->isChecked());
@@ -200,7 +122,7 @@ void InstallTalkWindow::accept()
talkcreator->setStripExtensions(ui.StripExtensions->isChecked());
talkcreator->createTalkFiles(logger);
- connect(logger,SIGNAL(closed()),this,SLOT(close()));
+ connect(logger,SIGNAL(closed()),this,SLOT(close()));
}
@@ -208,64 +130,21 @@ void InstallTalkWindow::setDeviceSettings(QSettings *dev)
{
devices = dev;
qDebug() << "Install::setDeviceSettings:" << devices;
-
- QStringList encoders;
- QStringList encodersOpts;
- QStringList encodersTemplates;
-
- QStringList tts;
- QStringList ttsOpts;
- QStringList ttsTemplates;
- devices->beginGroup("encoders");
- QStringList keys = devices->allKeys();
- qDebug() << keys;
- for(int i=0; i < keys.size();i++)
- {
- encoders << devices->value(keys.at(i),"null").toString();
- }
- qDebug() << encoders;
- devices->endGroup();
- for(int i=0; i < encoders.size();i++)
- {
- devices->beginGroup(encoders.at(i));
- encodersOpts << devices->value("options","null").toString();
- encodersTemplates << devices->value("template","null").toString();
- devices->endGroup();
- }
- qDebug() << encodersOpts;
- qDebug() << encodersTemplates;
+ QString profile;
+ profile = userSettings->value("ttspreset").toString();
devices->beginGroup("tts");
- keys = devices->allKeys();
- qDebug() << keys;
- for(int i=0; i < keys.size();i++)
- {
- tts << devices->value(keys.at(i),"null").toString();
- }
- qDebug() << tts;
+ ui.labelTtsProfile->setText(tr("TTS Profile: <b>%1</b>")
+ .arg(devices->value(profile, tr("Invalid TTS profile!")).toString()));
+ qDebug() << profile;
+ devices->endGroup();
+ profile = userSettings->value("encpreset").toString();
+ devices->beginGroup("encoders");
+ ui.labelEncProfile->setText(tr("Encoder Profile: <b>%1</b>")
+ .arg(devices->value(profile, tr("Invalid encoder profile!")).toString()));
+ qDebug() << profile;
devices->endGroup();
- for(int i= 0; i < tts.size();i++)
- {
- devices->beginGroup(tts.at(i));
- ttsOpts << devices->value("options","null").toString();
- ttsTemplates << devices->value("template","null").toString();
- devices->endGroup();
- }
- qDebug() << ttsOpts;
- qDebug() << ttsTemplates;
-
- talkcreator->setSupportedEnc(encoders);
- talkcreator->setSupportedEncOptions(encodersOpts);
- talkcreator->setSupportedEncTemplates(encodersTemplates);
-
- talkcreator->setSupportedTTS(tts);
- talkcreator->setSupportedTTSOptions(ttsOpts);
- talkcreator->setSupportedTTSTemplates(ttsTemplates);
-
- ui.Encodercbx->insertItems(0,talkcreator->getSupportedEnc());
- ui.TTScbx->insertItems(0,talkcreator->getSupportedTTS());
-
}
@@ -277,7 +156,6 @@ void InstallTalkWindow::setUserSettings(QSettings *user)
talkcreator->setMountPoint(userSettings->value("defaults/mountpoint").toString());
- setTalkFolder(userSettings->value("defaults/folderToTalk").toString());
- setEncoderExec(userSettings->value("defaults/pathEncoder").toString());
- setTTSExec(userSettings->value("defaults/pathTTS").toString());
+ setTalkFolder(userSettings->value("last_talked_folder").toString());
+
}
diff --git a/rbutil/rbutilqt/installtalkwindow.h b/rbutil/rbutilqt/installtalkwindow.h
index 0e8f9306c0..f4fce5f61f 100644
--- a/rbutil/rbutilqt/installtalkwindow.h
+++ b/rbutil/rbutilqt/installtalkwindow.h
@@ -32,7 +32,7 @@ class InstallTalkWindow : public QDialog
{
Q_OBJECT
public:
- InstallTalkWindow(QWidget *parent = 0);
+ InstallTalkWindow(QWidget *parent = 0);
void setUserSettings(QSettings*);
void setDeviceSettings(QSettings*);
@@ -40,21 +40,11 @@ class InstallTalkWindow : public QDialog
void accept(void);
private slots:
- void browseFolder(void);
- void browseTTS(void);
- void browseEncoder(void);
-
- void setTalkFolder(QString folder);
- void setTTSExec(QString path);
- void setEncoderExec(QString path);
-
- void setEncoderOptions(int index);
- void setTTSOptions(int index);
- void setEncoderOptions(QString options);
- void setTTSOptions(QString options);
-
+ void browseFolder(void);
+ void setTalkFolder(QString folder);
+
private:
- TalkFileCreator* talkcreator;
+ TalkFileCreator* talkcreator;
Ui::InstallTalkFrm ui;
ProgressLoggerGui* logger;
QSettings *devices;
@@ -62,5 +52,4 @@ class InstallTalkWindow : public QDialog
};
-
#endif
diff --git a/rbutil/rbutilqt/installzip.h b/rbutil/rbutilqt/installzip.h
index 9beeb9bbeb..629445d28f 100644
--- a/rbutil/rbutilqt/installzip.h
+++ b/rbutil/rbutilqt/installzip.h
@@ -47,7 +47,7 @@ public:
void setUnzip(bool i) { m_unzip = i; }
void setTarget(QString t) { m_target = t; }
void setCache(QDir c) { m_cache = c; };
- void setCache(QString c) { m_cache = QDir(c); qDebug() << "!!!set cache:" << m_cache;}
+ void setCache(QString c) { m_cache = QDir(c);}
signals:
void done(bool error);
diff --git a/rbutil/rbutilqt/rbutil.ini b/rbutil/rbutilqt/rbutil.ini
index 09d9e24647..ec75610686 100644
--- a/rbutil/rbutilqt/rbutil.ini
+++ b/rbutil/rbutilqt/rbutil.ini
@@ -342,21 +342,47 @@ manualname=
brand=Sandisk
[encoders]
-encoder01 = lame
+encpreset01 = "Lame (default)"
+encpreset02 = "Lame (user-adjusted)"
-[tts]
-tts01 = espeak
-tts02 = flite
+[encpreset01]
+encoder = lame
+options = ""
+template = "\"%exe\" %options \"%input\" \"%output\""
+edit = false
-[lame]
+[encpreset02]
+encoder = lame
options = ""
template = "\"%exe\" %options \"%input\" \"%output\""
-
-[espeak]
+edit = true
+
+[tts]
+ttspreset01 = "espeak (default)"
+ttspreset02 = "espeak (user-adjusted)"
+ttspreset03 = "flite (default)"
+ttspreset04 = "flite (user-adjusted)"
+
+[ttspreset01]
+tts = "espeak"
options = ""
template = "\"%exe\" %options -w \"%wavfile\" \"%text\""
+edit = false
-[flite]
+[ttspreset02]
+tts = "espeak"
+options = ""
+template = "\"%exe\" %options -w \"%wavfile\" \"%text\""
+edit = true
+
+[ttspreset03]
+tts = "flite"
options = ""
template = "\"%exe\" %options -o \"%wavfile\" \"%text\""
+edit = false
+[ttspreset04]
+tts = "flite"
+options = ""
+template = "\"%exe\" %options -o \"%wavfile\" \"%text\""
+edit = true
diff --git a/rbutil/rbutilqt/rbutilqt.qrc b/rbutil/rbutilqt/rbutilqt.qrc
index 8cc9eea48b..0761fd4f1a 100644
--- a/rbutil/rbutilqt/rbutilqt.qrc
+++ b/rbutil/rbutilqt/rbutilqt.qrc
@@ -4,6 +4,7 @@
<file>gpl-2.0.html</file>
</qresource>
<qresource prefix="/icons" >
+ <file>icons/audio-input-microphone.png</file>
<file>icons/bootloader_btn.png</file>
<file>icons/dialog-error.png</file>
<file>icons/dialog-information.png</file>
diff --git a/rbutil/rbutilqt/talkfile.cpp b/rbutil/rbutilqt/talkfile.cpp
index ee65dc27af..77f5c3fd3f 100644
--- a/rbutil/rbutilqt/talkfile.cpp
+++ b/rbutil/rbutilqt/talkfile.cpp
@@ -24,19 +24,6 @@ TalkFileCreator::TalkFileCreator(QObject* parent): QObject(parent)
}
-void TalkFileCreator::setTTsType(QString tts)
-{
- m_curTTS = tts;
- int index = m_supportedTTS.indexOf(m_curTTS);
- m_curTTSTemplate = m_supportedTTSTemplates.at(index);
-}
-
-void TalkFileCreator::setEncType(QString enc)
-{
- m_curEnc = enc;
- int index = m_supportedEnc.indexOf(m_curEnc);
- m_curEncTemplate = m_supportedEncTemplates.at(index);
-}
bool TalkFileCreator::initEncoder()
{
@@ -203,17 +190,4 @@ bool TalkFileCreator::encode(QString input,QString output)
}
-QString TalkFileCreator::getTTsOpts(QString ttsname)
-{
- int index = m_supportedTTS.indexOf(ttsname);
-
- return m_supportedTTSOpts.at(index);
-}
-
-QString TalkFileCreator::getEncOpts(QString encname)
-{
- int index = m_supportedEnc.indexOf(encname);
-
- return m_supportedEncOpts.at(index);
-}
diff --git a/rbutil/rbutilqt/talkfile.h b/rbutil/rbutilqt/talkfile.h
index 1fabb8514a..8c94b35a4d 100644
--- a/rbutil/rbutilqt/talkfile.h
+++ b/rbutil/rbutilqt/talkfile.h
@@ -35,23 +35,13 @@ public:
void setTTSexe(QString exe){m_TTSexec=exe;}
void setEncexe(QString exe){m_EncExec=exe;}
- void setSupportedTTS(QStringList list) {m_supportedTTS=list;}
- void setSupportedTTSOptions(QStringList list) {m_supportedTTSOpts=list;}
- void setSupportedTTSTemplates(QStringList list) {m_supportedTTSTemplates=list;}
-
- QStringList getSupportedTTS(){return m_supportedTTS;}
- void setTTsType(QString tts);
- QString getTTsOpts(QString ttsname);
+ void setTTsType(QString tts) { m_curTTS = tts; }
void setTTsOpts(QString opts) {m_TTSOpts=opts;}
-
- void setSupportedEnc(QStringList list) {m_supportedEnc=list;}
- void setSupportedEncOptions(QStringList list) {m_supportedEncOpts=list;}
- void setSupportedEncTemplates(QStringList list) {m_supportedEncTemplates=list;}
+ void setTTsTemplate(QString t) { m_curTTSTemplate = t; }
- QStringList getSupportedEnc(){return m_supportedEnc;}
- void setEncType(QString enc);
- QString getEncOpts(QString encname);
+ void setEncType(QString enc) { m_curEnc = enc; }
void setEncOpts(QString opts) {m_EncOpts=opts;}
+ void setEncTemplate(QString t) { m_curEncTemplate = t; }
void setDir(QString dir){m_dir = dir; }
void setMountPoint(QString mountpoint) {m_mountpoint =mountpoint; }
@@ -78,17 +68,11 @@ private:
QString m_mountpoint;
QString m_curTTS;
QString m_TTSexec;
- QStringList m_supportedTTS;
- QStringList m_supportedTTSOpts;
- QStringList m_supportedTTSTemplates;
QString m_TTSOpts;
QString m_curTTSTemplate;
QString m_curEnc;
QString m_EncExec;
- QStringList m_supportedEnc;
- QStringList m_supportedEncOpts;
- QStringList m_supportedEncTemplates;
QString m_EncOpts;
QString m_curEncTemplate;