mirror of
https://github.com/vicr123/theshell.git
synced 2025-01-23 12:12:06 -05:00
Add settings for theWave
This commit is contained in:
parent
fd364e4284
commit
8694ff1e8b
5 changed files with 218 additions and 10 deletions
|
@ -61,9 +61,17 @@ InfoPaneDropdown::InfoPaneDropdown(NotificationDBus* notificationEngine, UPowerD
|
|||
}
|
||||
ui->redshiftIntensity->setValue(redshiftVal.toInt());
|
||||
|
||||
QString thewaveVoiceEngine = settings.value("thewave/ttsEngine", "festival").toString();
|
||||
if (thewaveVoiceEngine == "pico2wave") {
|
||||
ui->thewaveTTSpico2wave->setChecked(true);
|
||||
} else if (thewaveVoiceEngine == "festival") {
|
||||
ui->thewaveTTSfestival->setChecked(true);
|
||||
}
|
||||
|
||||
ui->lineEdit_2->setText(settings.value("startup/autostart", "").toString());
|
||||
ui->redshiftPause->setChecked(!settings.value("display/redshiftPaused", true).toBool());
|
||||
ui->TouchFeedbackSwitch->setChecked(settings.value("input/touchFeedbackSound", false).toBool());
|
||||
ui->thewaveWikipediaSwitch->setChecked(settings.value("thewave/wikipediaSearch", true).toBool());
|
||||
|
||||
eventTimer = new QTimer(this);
|
||||
eventTimer->setInterval(1000);
|
||||
|
@ -686,3 +694,19 @@ void InfoPaneDropdown::on_TouchFeedbackSwitch_toggled(bool checked)
|
|||
{
|
||||
settings.setValue("input/touchFeedbackSound", checked);
|
||||
}
|
||||
|
||||
void InfoPaneDropdown::on_thewaveTTSpico2wave_clicked()
|
||||
{
|
||||
settings.setValue("thewave/ttsEngine", "pico2wave");
|
||||
}
|
||||
|
||||
void InfoPaneDropdown::on_thewaveTTSfestival_clicked()
|
||||
{
|
||||
settings.setValue("thewave/ttsEngine", "festival");
|
||||
}
|
||||
|
||||
|
||||
void InfoPaneDropdown::on_thewaveWikipediaSwitch_toggled(bool checked)
|
||||
{
|
||||
settings.setValue("thewave/wikipediaSearch", checked);
|
||||
}
|
||||
|
|
|
@ -116,9 +116,14 @@ private slots:
|
|||
|
||||
void on_resetButton_clicked();
|
||||
|
||||
|
||||
void on_TouchFeedbackSwitch_toggled(bool checked);
|
||||
|
||||
void on_thewaveTTSpico2wave_clicked();
|
||||
|
||||
void on_thewaveTTSfestival_clicked();
|
||||
|
||||
void on_thewaveWikipediaSwitch_toggled(bool checked);
|
||||
|
||||
public slots:
|
||||
void getNetworks();
|
||||
|
||||
|
|
|
@ -323,7 +323,7 @@
|
|||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>4</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab">
|
||||
<attribute name="icon">
|
||||
|
@ -918,6 +918,151 @@
|
|||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_7">
|
||||
<attribute name="icon">
|
||||
<iconset theme="thewave" resource="resources.qrc">
|
||||
<normaloff>:/icons/thewave.svg</normaloff>:/icons/thewave.svg</iconset>
|
||||
</attribute>
|
||||
<attribute name="title">
|
||||
<string>theWave</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_7">
|
||||
<item row="1" column="1">
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="thewaveTTSfestival">
|
||||
<property name="text">
|
||||
<string>Festival (fallbac&k)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="thewaveTTSpico2wave">
|
||||
<property name="text">
|
||||
<string>pico&2wave</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="3">
|
||||
<widget class="QFrame" name="displayHeader_6">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_20">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="displayLabel_6">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>15</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Input</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="displayLine_6">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<spacer name="horizontalSpacer_13">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_27">
|
||||
<property name="text">
|
||||
<string>Text to Speech engine</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_28">
|
||||
<property name="text">
|
||||
<string>Search on Wikipedia</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="Switch" name="thewaveWikipediaSwitch">
|
||||
<property name="text">
|
||||
<string>WikipediaSwitch</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<spacer name="verticalSpacer_14">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_5">
|
||||
<attribute name="icon">
|
||||
<iconset theme="emblem-warning">
|
||||
|
@ -1652,14 +1797,14 @@
|
|||
<second>0</second>
|
||||
<year>1969</year>
|
||||
<month>12</month>
|
||||
<day>13</day>
|
||||
<day>12</day>
|
||||
</datetime>
|
||||
</property>
|
||||
<property name="date">
|
||||
<date>
|
||||
<year>1969</year>
|
||||
<month>12</month>
|
||||
<day>13</day>
|
||||
<day>12</day>
|
||||
</date>
|
||||
</property>
|
||||
<property name="displayFormat">
|
||||
|
|
|
@ -289,13 +289,45 @@ void theWaveWorker::processSpeech(QString speech, bool voiceFeedback) {
|
|||
}
|
||||
|
||||
void theWaveWorker::speak(QString speech, bool restartOnceComplete) {
|
||||
QProcess *s = new QProcess(this);
|
||||
s->start("festival --tts");
|
||||
s->write(speech.toUtf8());
|
||||
s->closeWriteChannel();
|
||||
if (settings.value("thewave/ttsEngine").toString() == "pico2wave" && QFile("/usr/bin/pico2wave").exists()) {
|
||||
/*QProcess *s = new QProcess(this);
|
||||
s->setInputChannelMode(QProcess::);
|
||||
s->start();
|
||||
s->waitForStarted();
|
||||
s->waitForFinished();*/
|
||||
QString command = "pico2wave -w=\"" + QDir::homePath() + "/.thewavevoice.wav\" \"" + speech + "\"";
|
||||
QProcess::execute(command);
|
||||
|
||||
if (restartOnceComplete && !stopEverything) {
|
||||
connect(s, SIGNAL(finished(int)), this, SLOT(begin()));
|
||||
QSoundEffect* sound = new QSoundEffect();
|
||||
sound->setSource(QUrl::fromLocalFile(QDir::homePath() + "/.thewavevoice.wav"));
|
||||
sound->play();
|
||||
connect(sound, &QSoundEffect::playingChanged, [=]() {
|
||||
if (!sound->isPlaying()) {
|
||||
sound->deleteLater();
|
||||
}
|
||||
});
|
||||
connect(sound, &QSoundEffect::destroyed, [=]() {
|
||||
bool success = QFile(QDir::homePath() + "/.thewavevoice.wav").remove();
|
||||
|
||||
if (restartOnceComplete && !stopEverything) {
|
||||
begin();
|
||||
}
|
||||
});
|
||||
//QSound sound();
|
||||
//sound.play();
|
||||
|
||||
//while (!sound.isFinished()) {
|
||||
//QApplication::processEvents();
|
||||
//}
|
||||
} else {
|
||||
QProcess *s = new QProcess(this);
|
||||
s->start("festival --tts");
|
||||
s->write(speech.toUtf8());
|
||||
s->closeWriteChannel();
|
||||
|
||||
if (restartOnceComplete && !stopEverything) {
|
||||
connect(s, SIGNAL(finished(int)), this, SLOT(begin()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
#include <QXmlSimpleReader>
|
||||
#include <QXmlInputSource>
|
||||
#include <QEventLoop>
|
||||
#include <QDir>
|
||||
#include <QApplication>
|
||||
|
||||
class theWaveWorker : public QObject
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue