Commit e5667ff2 authored by Ronan's avatar Ronan
Browse files

feat(ui/modules/Linphone/Chat/Message): disable `play me` action if text to speech not available

parent 8c674a7f
......@@ -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)
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment