FEAT(client): Add option to toggle TTS in settings menu

Previously TTS could only be toggled from the Configure dropdown menu,
but not from within the settings. This was confusing, especially since
other TTS related settings were editable from within the settings UI.

This commit introduces a new checkbox into the settings UI that allows
users to toggle TTS right then and there, which should take care of the
created confusion.

Fixes #5561
This commit is contained in:
BombJovi 2022-02-10 23:16:43 -06:00 committed by Robert Adam
parent ef79268165
commit cd0de275cc
3 changed files with 62 additions and 46 deletions

View File

@ -238,6 +238,7 @@ void LogConfig::load(const Settings &r) {
qcbReadBackOwn->setChecked(r.bTTSMessageReadBack);
qcbNoScope->setChecked(r.bTTSNoScope);
qcbNoAuthor->setChecked(r.bTTSNoAuthor);
qcbEnableTTS->setChecked(r.bTTS);
#endif
qcbWhisperFriends->setChecked(r.bWhisperFriends);
@ -281,6 +282,7 @@ void LogConfig::save() const {
s.bTTSMessageReadBack = qcbReadBackOwn->isChecked();
s.bTTSNoScope = qcbNoScope->isChecked();
s.bTTSNoAuthor = qcbNoAuthor->isChecked();
s.bTTS = qcbEnableTTS->isChecked();
#endif
s.bWhisperFriends = qcbWhisperFriends->isChecked();
s.iMessageLimitUserThreshold = qsbMessageLimitUsers->value();

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>580</width>
<height>496</height>
<width>650</width>
<height>500</height>
</rect>
</property>
<property name="windowTitle">
@ -79,17 +79,62 @@
<string>Text To Speech</string>
</property>
<layout class="QGridLayout">
<item row="0" column="0">
<widget class="QLabel" name="qlVolume">
<property name="text">
<string>Volume</string>
<item row="2" column="3">
<widget class="QCheckBox" name="qcbReadBackOwn">
<property name="toolTip">
<string>If enabled text messages you send will be read back to you with TTS</string>
</property>
<property name="buddy">
<cstring>qsVolume</cstring>
<property name="text">
<string>Read back own messages</string>
</property>
</widget>
</item>
<item row="0" column="1" colspan="3">
<item row="2" column="0">
<widget class="QLabel" name="qlThreshold">
<property name="text">
<string>Length threshold</string>
</property>
<property name="buddy">
<cstring>qsbThreshold</cstring>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="qcbEnableTTS">
<property name="enabled">
<bool>true</bool>
</property>
<property name="toolTip">
<string>Click to enable Text-to-Speech</string>
</property>
<property name="text">
<string>Enable Text-to-Speech</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QSpinBox" name="qsbThreshold">
<property name="toolTip">
<string>Message length threshold for Text-To-Speech Engine</string>
</property>
<property name="whatsThis">
<string>&lt;b&gt;This is the length threshold used for the Text-To-Speech Engine.&lt;/b&gt;&lt;br /&gt;Messages longer than this limit will not be read aloud in their full length.</string>
</property>
<property name="buttonSymbols">
<enum>QAbstractSpinBox::PlusMinus</enum>
</property>
<property name="suffix">
<string> Characters</string>
</property>
<property name="maximum">
<number>5000</number>
</property>
<property name="singleStep">
<number>10</number>
</property>
</widget>
</item>
<item row="1" column="1" colspan="3">
<widget class="QSlider" name="qsVolume">
<property name="toolTip">
<string>Volume of Text-To-Speech Engine</string>
@ -118,48 +163,16 @@
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="qlThreshold">
<widget class="QLabel" name="qlVolume">
<property name="text">
<string>Length threshold</string>
<string>Volume</string>
</property>
<property name="buddy">
<cstring>qsbThreshold</cstring>
<cstring>qsVolume</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="qsbThreshold">
<property name="toolTip">
<string>Message length threshold for Text-To-Speech Engine</string>
</property>
<property name="whatsThis">
<string>&lt;b&gt;This is the length threshold used for the Text-To-Speech Engine.&lt;/b&gt;&lt;br /&gt;Messages longer than this limit will not be read aloud in their full length.</string>
</property>
<property name="buttonSymbols">
<enum>QAbstractSpinBox::PlusMinus</enum>
</property>
<property name="suffix">
<string> Characters</string>
</property>
<property name="maximum">
<number>5000</number>
</property>
<property name="singleStep">
<number>10</number>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QCheckBox" name="qcbReadBackOwn">
<property name="toolTip">
<string>If enabled text messages you send will be read back to you with TTS</string>
</property>
<property name="text">
<string>Read back own messages</string>
</property>
</widget>
</item>
<item row="2" column="0">
<item row="0" column="1">
<widget class="QCheckBox" name="qcbNoScope">
<property name="toolTip">
<string>If enabled, TTS will not dictate the message scope.</string>
@ -169,7 +182,7 @@
</property>
</widget>
</item>
<item row="2" column="1">
<item row="0" column="3">
<widget class="QCheckBox" name="qcbNoAuthor">
<property name="toolTip">
<string>If enabled, TTS will not dictate the message author.</string>

View File

@ -2130,6 +2130,7 @@ void MainWindow::on_qmConfig_aboutToShow() {
qmConfig->addAction(qaAudioWizard);
qmConfig->addAction(qaConfigCert);
qmConfig->addSeparator();
qaAudioTTS->setChecked(Global::get().s.bTTS);
qmConfig->addAction(qaAudioTTS);
qmConfig->addSeparator();
qmConfig->addAction(qaConfigMinimal);