Commit 8f886cb9 authored by Ronan Abhamon's avatar Ronan Abhamon

feat(ui/modules/Linphone/Chat/Message): supports text to speech

parent 33987a9c
...@@ -74,7 +74,7 @@ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG -DQT_QML_DEBUG -DQT_ ...@@ -74,7 +74,7 @@ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG -DQT_QML_DEBUG -DQT_
# Define packages, libs, sources, headers, resources and languages. # Define packages, libs, sources, headers, resources and languages.
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
set(QT5_PACKAGES Core Gui Quick Widgets QuickControls2 Svg LinguistTools Concurrent Network) set(QT5_PACKAGES Core Gui Quick Widgets QuickControls2 Svg LinguistTools Concurrent Network TextToSpeech)
if(LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS) if(LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS)
include("${EP_linphone_CONFIG_DIR}/LinphoneConfig.cmake") include("${EP_linphone_CONFIG_DIR}/LinphoneConfig.cmake")
......
...@@ -828,12 +828,9 @@ your friend&apos;s SIP address or username.</translation> ...@@ -828,12 +828,9 @@ your friend&apos;s SIP address or username.</translation>
<source>menuCopy</source> <source>menuCopy</source>
<translation>Copy</translation> <translation>Copy</translation>
</message> </message>
</context>
<context>
<name>MessageMenu</name>
<message> <message>
<source>copy</source> <source>menuPlayMe</source>
<translation>Copy</translation> <translation>Play me!</translation>
</message> </message>
</context> </context>
<context> <context>
......
...@@ -827,12 +827,9 @@ un chat ou ajouter un contact.</translation> ...@@ -827,12 +827,9 @@ un chat ou ajouter un contact.</translation>
<source>menuCopy</source> <source>menuCopy</source>
<translation>Copier</translation> <translation>Copier</translation>
</message> </message>
</context>
<context>
<name>MessageMenu</name>
<message> <message>
<source>copy</source> <source>menuPlayMe</source>
<translation type="unfinished"></translation> <translation>Joue-moi !</translation>
</message> </message>
</context> </context>
<context> <context>
......
...@@ -314,7 +314,6 @@ ...@@ -314,7 +314,6 @@
<file>ui/modules/Linphone/Chat/FileMessage.qml</file> <file>ui/modules/Linphone/Chat/FileMessage.qml</file>
<file>ui/modules/Linphone/Chat/IncomingMessage.qml</file> <file>ui/modules/Linphone/Chat/IncomingMessage.qml</file>
<file>ui/modules/Linphone/Chat/Message.js</file> <file>ui/modules/Linphone/Chat/Message.js</file>
<file>ui/modules/Linphone/Chat/MessageMenu.qml</file>
<file>ui/modules/Linphone/Chat/Message.qml</file> <file>ui/modules/Linphone/Chat/Message.qml</file>
<file>ui/modules/Linphone/Chat/OutgoingMessage.qml</file> <file>ui/modules/Linphone/Chat/OutgoingMessage.qml</file>
<file>ui/modules/Linphone/Codecs/CodecAttribute.qml</file> <file>ui/modules/Linphone/Codecs/CodecAttribute.qml</file>
......
...@@ -171,6 +171,9 @@ void App::initContentApp () { ...@@ -171,6 +171,9 @@ void App::initContentApp () {
mEngine->addImageProvider(AvatarProvider::PROVIDER_ID, new AvatarProvider()); mEngine->addImageProvider(AvatarProvider::PROVIDER_ID, new AvatarProvider());
mEngine->addImageProvider(ThumbnailProvider::PROVIDER_ID, new ThumbnailProvider()); mEngine->addImageProvider(ThumbnailProvider::PROVIDER_ID, new ThumbnailProvider());
mTextToSpeech = new QTextToSpeech(this);
QQmlEngine::setObjectOwnership(mTextToSpeech, QQmlEngine::CppOwnership);
registerTypes(); registerTypes();
registerSharedTypes(); registerSharedTypes();
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <QCommandLineParser> #include <QCommandLineParser>
#include <QQmlApplicationEngine> #include <QQmlApplicationEngine>
#include <QQuickWindow> #include <QQuickWindow>
#include <QTextToSpeech>
#include "../components/notifier/Notifier.hpp" #include "../components/notifier/Notifier.hpp"
#include "../externals/single-application/SingleApplication.hpp" #include "../externals/single-application/SingleApplication.hpp"
...@@ -44,6 +45,8 @@ class App : public SingleApplication { ...@@ -44,6 +45,8 @@ class App : public SingleApplication {
Q_PROPERTY(QVariantList availableLocales READ getAvailableLocales CONSTANT); Q_PROPERTY(QVariantList availableLocales READ getAvailableLocales CONSTANT);
Q_PROPERTY(QString qtVersion READ getQtVersion CONSTANT); Q_PROPERTY(QString qtVersion READ getQtVersion CONSTANT);
Q_PROPERTY(QTextToSpeech * textToSpeech READ getTextToSpeech CONSTANT);
public: public:
App (int &argc, char *argv[]); App (int &argc, char *argv[]);
~App (); ~App ();
...@@ -86,6 +89,10 @@ signals: ...@@ -86,6 +89,10 @@ signals:
void configLocaleChanged (const QString &locale); void configLocaleChanged (const QString &locale);
private: private:
QTextToSpeech *getTextToSpeech () const {
return mTextToSpeech;
}
void registerTypes (); void registerTypes ();
void registerSharedTypes (); void registerSharedTypes ();
void setTrayIcon (); void setTrayIcon ();
...@@ -111,6 +118,8 @@ private: ...@@ -111,6 +118,8 @@ private:
QVariantList mAvailableLocales; QVariantList mAvailableLocales;
QString mLocale; QString mLocale;
QTextToSpeech *mTextToSpeech = nullptr;
QQmlApplicationEngine *mEngine = nullptr; QQmlApplicationEngine *mEngine = nullptr;
DefaultTranslator *mTranslator = nullptr; DefaultTranslator *mTranslator = nullptr;
...@@ -120,4 +129,6 @@ private: ...@@ -120,4 +129,6 @@ private:
QQuickWindow *mSettingsWindow = nullptr; QQuickWindow *mSettingsWindow = nullptr;
}; };
Q_DECLARE_METATYPE(QTextToSpeech *);
#endif // APP_H_ #endif // APP_H_
...@@ -74,6 +74,11 @@ Item { ...@@ -74,6 +74,11 @@ Item {
text: qsTr('menuCopy') text: qsTr('menuCopy')
onTriggered: Clipboard.text = $chatEntry.content onTriggered: Clipboard.text = $chatEntry.content
} }
MenuItem {
text: qsTr('menuPlayMe')
onTriggered: App.textToSpeech.say($chatEntry.content)
}
} }
// Handle hovered link. // Handle hovered link.
......
import QtQuick 2.7
import QtQuick.Controls 2.1
// =============================================================================
Menu {
MenuItem {
text: qsTr('copy')
}
}
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