Commit 8f886cb9 authored by Ronan's avatar Ronan

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