Commit e5667ff2 authored by Ronan Abhamon's avatar Ronan Abhamon

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

parent 8c674a7f
...@@ -37,9 +37,17 @@ ...@@ -37,9 +37,17 @@
mQtTextToSpeech->say(text); mQtTextToSpeech->say(text);
} }
bool TextToSpeech::available () const {
return true;
}
#else #else
TextToSpeech::TextToSpeech (QObject *parent) : QObject(parent) {} TextToSpeech::TextToSpeech (QObject *parent) : QObject(parent) {}
void TextToSpeech::say (const QString &) {} void TextToSpeech::say (const QString &) {}
bool TextToSpeech::available () const {
return false;
}
#endif // ifdef TEXTTOSPEECH_ENABLED #endif // ifdef TEXTTOSPEECH_ENABLED
...@@ -32,6 +32,8 @@ class QTextToSpeech; ...@@ -32,6 +32,8 @@ class QTextToSpeech;
class TextToSpeech : public QObject { class TextToSpeech : public QObject {
Q_OBJECT; Q_OBJECT;
Q_PROPERTY(bool available READ available CONSTANT);
public: public:
TextToSpeech (QObject *parent = Q_NULLPTR); TextToSpeech (QObject *parent = Q_NULLPTR);
~TextToSpeech () = default; ~TextToSpeech () = default;
...@@ -39,6 +41,8 @@ public: ...@@ -39,6 +41,8 @@ public:
Q_INVOKABLE void say (const QString &text); Q_INVOKABLE void say (const QString &text);
private: private:
bool available () const;
QTextToSpeech *mQtTextToSpeech = nullptr; QTextToSpeech *mQtTextToSpeech = nullptr;
}; };
......
...@@ -18,11 +18,19 @@ MenuItem { ...@@ -18,11 +18,19 @@ MenuItem {
) )
implicitHeight: MenuItemStyle.background.height implicitHeight: MenuItemStyle.background.height
} }
contentItem: Text { contentItem: Text {
color: MenuItemStyle.text.color color: button.enabled
? MenuItemStyle.text.color.enabled
: MenuItemStyle.text.color.disabled
elide: Text.ElideRight elide: Text.ElideRight
font.bold: true
font.pointSize: MenuItemStyle.text.fontSize font {
bold: true
pointSize: MenuItemStyle.text.fontSize
}
text: button.text text: button.text
leftPadding: MenuItemStyle.leftPadding leftPadding: MenuItemStyle.leftPadding
...@@ -30,5 +38,6 @@ MenuItem { ...@@ -30,5 +38,6 @@ MenuItem {
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
} }
hoverEnabled: true hoverEnabled: true
} }
...@@ -20,7 +20,11 @@ QtObject { ...@@ -20,7 +20,11 @@ QtObject {
} }
property QtObject text: QtObject { property QtObject text: QtObject {
property color color: Colors.j
property int fontSize: 10 property int fontSize: 10
property QtObject color: QtObject {
property color enabled: Colors.j
property color disabled: Colors.l50
}
} }
} }
...@@ -76,7 +76,9 @@ Item { ...@@ -76,7 +76,9 @@ Item {
} }
MenuItem { MenuItem {
enabled: TextToSpeech.available
text: qsTr('menuPlayMe') text: qsTr('menuPlayMe')
onTriggered: TextToSpeech.say($chatEntry.content) 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