mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-22 14:18:09 +00:00
feat(ui/modules/Linphone/Chat/Message): disable play me action if text to speech not available
This commit is contained in:
parent
8c674a7f8c
commit
e5667ff2c9
5 changed files with 31 additions and 4 deletions
|
|
@ -37,9 +37,17 @@
|
|||
mQtTextToSpeech->say(text);
|
||||
}
|
||||
|
||||
bool TextToSpeech::available () const {
|
||||
return true;
|
||||
}
|
||||
|
||||
#else
|
||||
TextToSpeech::TextToSpeech (QObject *parent) : QObject(parent) {}
|
||||
|
||||
void TextToSpeech::say (const QString &) {}
|
||||
|
||||
bool TextToSpeech::available () const {
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif // ifdef TEXTTOSPEECH_ENABLED
|
||||
|
|
|
|||
|
|
@ -32,6 +32,8 @@ class QTextToSpeech;
|
|||
class TextToSpeech : public QObject {
|
||||
Q_OBJECT;
|
||||
|
||||
Q_PROPERTY(bool available READ available CONSTANT);
|
||||
|
||||
public:
|
||||
TextToSpeech (QObject *parent = Q_NULLPTR);
|
||||
~TextToSpeech () = default;
|
||||
|
|
@ -39,6 +41,8 @@ public:
|
|||
Q_INVOKABLE void say (const QString &text);
|
||||
|
||||
private:
|
||||
bool available () const;
|
||||
|
||||
QTextToSpeech *mQtTextToSpeech = nullptr;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -18,11 +18,19 @@ MenuItem {
|
|||
)
|
||||
implicitHeight: MenuItemStyle.background.height
|
||||
}
|
||||
|
||||
contentItem: Text {
|
||||
color: MenuItemStyle.text.color
|
||||
color: button.enabled
|
||||
? MenuItemStyle.text.color.enabled
|
||||
: MenuItemStyle.text.color.disabled
|
||||
|
||||
elide: Text.ElideRight
|
||||
font.bold: true
|
||||
font.pointSize: MenuItemStyle.text.fontSize
|
||||
|
||||
font {
|
||||
bold: true
|
||||
pointSize: MenuItemStyle.text.fontSize
|
||||
}
|
||||
|
||||
text: button.text
|
||||
|
||||
leftPadding: MenuItemStyle.leftPadding
|
||||
|
|
@ -30,5 +38,6 @@ MenuItem {
|
|||
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
}
|
||||
|
||||
hoverEnabled: true
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,11 @@ QtObject {
|
|||
}
|
||||
|
||||
property QtObject text: QtObject {
|
||||
property color color: Colors.j
|
||||
property int fontSize: 10
|
||||
|
||||
property QtObject color: QtObject {
|
||||
property color enabled: Colors.j
|
||||
property color disabled: Colors.l50
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -76,7 +76,9 @@ Item {
|
|||
}
|
||||
|
||||
MenuItem {
|
||||
enabled: TextToSpeech.available
|
||||
text: qsTr('menuPlayMe')
|
||||
|
||||
onTriggered: TextToSpeech.say($chatEntry.content)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue