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

fix(app): fix build with text to speech

parent c0d3632b
...@@ -36,7 +36,7 @@ include(CheckCXXCompilerFlag) ...@@ -36,7 +36,7 @@ include(CheckCXXCompilerFlag)
set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOMOC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_INCLUDE_CURRENT_DIR ON)
if(NOT WIN32) if (NOT WIN32)
check_cxx_compiler_flag("-Wsuggest-override" SUGGEST_OVERRIDE) check_cxx_compiler_flag("-Wsuggest-override" SUGGEST_OVERRIDE)
set(CUSTOM_FLAGS "\ set(CUSTOM_FLAGS "\
-Wall \ -Wall \
...@@ -53,19 +53,19 @@ if(NOT WIN32) ...@@ -53,19 +53,19 @@ if(NOT WIN32)
-Wuninitialized \ -Wuninitialized \
-Wunused \ -Wunused \
") ")
if(NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang") if (NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CUSTOM_FLAGS "${CUSTOM_FLAGS} -Wlogical-op") set(CUSTOM_FLAGS "${CUSTOM_FLAGS} -Wlogical-op")
endif() endif ()
if(SUGGEST_OVERRIDE) if (SUGGEST_OVERRIDE)
set(CUSTOM_FLAGS "${CUSTOM_FLAGS} -Wsuggest-override -Werror=suggest-override") set(CUSTOM_FLAGS "${CUSTOM_FLAGS} -Wsuggest-override -Werror=suggest-override")
endif() endif ()
endif() endif ()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CUSTOM_FLAGS}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CUSTOM_FLAGS}")
# See: http://stackoverflow.com/a/1372836 # See: http://stackoverflow.com/a/1372836
if(WIN32) if (WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_WINSOCKAPI_") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_WINSOCKAPI_")
endif() endif ()
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DNDEBUG -DQT_NO_DEBUG") set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DNDEBUG -DQT_NO_DEBUG")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG -DQT_QML_DEBUG -DQT_DECLARATIVE_DEBUG") set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG -DQT_QML_DEBUG -DQT_DECLARATIVE_DEBUG")
...@@ -74,19 +74,20 @@ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG -DQT_QML_DEBUG -DQT_ ...@@ -74,19 +74,20 @@ 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 TextToSpeech) set(QT5_PACKAGES Core Gui Quick Widgets QuickControls2 Svg LinguistTools Concurrent Network)
set(QT5_PACKAGES_OPTIONAL 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")
include("${EP_linphone_CONFIG_DIR}/wrappers/cpp/LinphoneCxxConfig.cmake") include("${EP_linphone_CONFIG_DIR}/wrappers/cpp/LinphoneCxxConfig.cmake")
include("${EP_bctoolbox_CONFIG_DIR}/BcToolboxConfig.cmake") include("${EP_bctoolbox_CONFIG_DIR}/BcToolboxConfig.cmake")
include("${EP_belcard_CONFIG_DIR}/BelcardConfig.cmake") include("${EP_belcard_CONFIG_DIR}/BelcardConfig.cmake")
else() else ()
find_package(Linphone REQUIRED) find_package(Linphone REQUIRED)
find_package(LinphoneCxx REQUIRED) find_package(LinphoneCxx REQUIRED)
find_package(BcToolbox REQUIRED) find_package(BcToolbox REQUIRED)
find_package(Belcard REQUIRED) find_package(Belcard REQUIRED)
endif() endif ()
set(SOURCES set(SOURCES
src/app/App.cpp src/app/App.cpp
...@@ -127,6 +128,7 @@ set(SOURCES ...@@ -127,6 +128,7 @@ set(SOURCES
src/components/sip-addresses/SipAddressesProxyModel.cpp src/components/sip-addresses/SipAddressesProxyModel.cpp
src/components/sip-addresses/SipAddressObserver.cpp src/components/sip-addresses/SipAddressObserver.cpp
src/components/sound-player/SoundPlayer.cpp src/components/sound-player/SoundPlayer.cpp
src/components/text-to-speech/TextToSpeech.cpp
src/components/timeline/TimelineModel.cpp src/components/timeline/TimelineModel.cpp
src/externals/single-application/SingleApplication.cpp src/externals/single-application/SingleApplication.cpp
src/main.cpp src/main.cpp
...@@ -173,6 +175,7 @@ set(HEADERS ...@@ -173,6 +175,7 @@ set(HEADERS
src/components/sip-addresses/SipAddressesProxyModel.hpp src/components/sip-addresses/SipAddressesProxyModel.hpp
src/components/sip-addresses/SipAddressObserver.hpp src/components/sip-addresses/SipAddressObserver.hpp
src/components/sound-player/SoundPlayer.hpp src/components/sound-player/SoundPlayer.hpp
src/components/text-to-speech/TextToSpeech.hpp
src/components/timeline/TimelineModel.hpp src/components/timeline/TimelineModel.hpp
src/externals/single-application/SingleApplication.hpp src/externals/single-application/SingleApplication.hpp
src/externals/single-application/SingleApplicationPrivate.hpp src/externals/single-application/SingleApplicationPrivate.hpp
...@@ -221,16 +224,16 @@ foreach (line ${QRC_RESOURCES_CONTENT}) ...@@ -221,16 +224,16 @@ foreach (line ${QRC_RESOURCES_CONTENT})
endif () endif ()
endforeach () endforeach ()
if(NOT WIN32) # ------------------------------------------------------------------------------
# Init git hooks.
# ------------------------------------------------------------------------------
if (NOT WIN32)
add_custom_target( add_custom_target(
check_qml DEPENDS ${QML_SOURCES} check_qml DEPENDS ${QML_SOURCES}
COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/tools/check_qml_syntax" COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/tools/check_qml_syntax"
) )
endif() endif ()
# ------------------------------------------------------------------------------
# Init git hooks.
# ------------------------------------------------------------------------------
execute_process(COMMAND ${CMAKE_COMMAND} -E copy execute_process(COMMAND ${CMAKE_COMMAND} -E copy
"${CMAKE_CURRENT_SOURCE_DIR}/tools/private/pre-commit" "${CMAKE_CURRENT_SOURCE_DIR}/tools/private/pre-commit"
...@@ -249,13 +252,14 @@ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake" "${CMAKE_CURRENT_BIN ...@@ -249,13 +252,14 @@ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake" "${CMAKE_CURRENT_BIN
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
find_package(Qt5 COMPONENTS ${QT5_PACKAGES} REQUIRED) find_package(Qt5 COMPONENTS ${QT5_PACKAGES} REQUIRED)
find_package(Qt5 COMPONENTS ${QT5_PACKAGES_OPTIONAL} QUIET)
if(CMAKE_INSTALL_RPATH) if (CMAKE_INSTALL_RPATH)
get_target_property(LUPDATE_PATH Qt5::lupdate LOCATION) get_target_property(LUPDATE_PATH Qt5::lupdate LOCATION)
get_filename_component(LUPDATE_PATH "${LUPDATE_PATH}" DIRECTORY) get_filename_component(LUPDATE_PATH "${LUPDATE_PATH}" DIRECTORY)
get_filename_component(QT_PATH "${LUPDATE_PATH}/../lib" ABSOLUTE) get_filename_component(QT_PATH "${LUPDATE_PATH}/../lib" ABSOLUTE)
list(APPEND CMAKE_INSTALL_RPATH "${QT_PATH}") list(APPEND CMAKE_INSTALL_RPATH "${QT_PATH}")
endif() endif ()
# Add languages support. # Add languages support.
add_subdirectory(${LANGUAGES_DIRECTORY}) add_subdirectory(${LANGUAGES_DIRECTORY})
...@@ -266,26 +270,40 @@ qt5_add_resources(RESOURCES ${QRC_RESOURCES}) ...@@ -266,26 +270,40 @@ qt5_add_resources(RESOURCES ${QRC_RESOURCES})
# Build. # Build.
# Note: `update_translations` is provided by `languages/CMakeLists.txt`. # Note: `update_translations` is provided by `languages/CMakeLists.txt`.
if(WIN32) if (WIN32)
add_executable(${TARGET_NAME} WIN32 ${SOURCES} ${HEADERS} ${RESOURCES} linphone.rc) add_executable(${TARGET_NAME} WIN32 ${SOURCES} ${HEADERS} ${RESOURCES} linphone.rc)
else() else ()
add_executable(${TARGET_NAME} ${SOURCES} ${HEADERS} ${RESOURCES}) add_executable(${TARGET_NAME} ${SOURCES} ${HEADERS} ${RESOURCES})
endif() endif ()
bc_git_version(${TARGET_NAME} ${PROJECT_VERSION}) bc_git_version(${TARGET_NAME} ${PROJECT_VERSION})
add_dependencies(${TARGET_NAME} ${TARGET_NAME}-git-version) add_dependencies(${TARGET_NAME} ${TARGET_NAME}-git-version)
add_dependencies(${TARGET_NAME} update_translations) add_dependencies(${TARGET_NAME} update_translations)
if(NOT WIN32) if (NOT WIN32)
add_dependencies(update_translations check_qml) add_dependencies(update_translations check_qml)
endif() endif ()
set_target_properties(${TARGET_NAME} PROPERTIES OUTPUT_NAME "${EXECUTABLE_NAME}") set_target_properties(${TARGET_NAME} PROPERTIES OUTPUT_NAME "${EXECUTABLE_NAME}")
target_include_directories(${TARGET_NAME} SYSTEM PRIVATE "${LINPHONECXX_INCLUDE_DIRS}" "${LINPHONE_INCLUDE_DIRS}" "${BELCARD_INCLUDE_DIRS}" "${BCTOOLBOX_INCLUDE_DIRS}") target_include_directories(${TARGET_NAME} SYSTEM PRIVATE "${LINPHONECXX_INCLUDE_DIRS}" "${LINPHONE_INCLUDE_DIRS}" "${BELCARD_INCLUDE_DIRS}" "${BCTOOLBOX_INCLUDE_DIRS}")
foreach (package ${QT5_PACKAGES}) foreach (package ${QT5_PACKAGES})
target_include_directories(${TARGET_NAME} SYSTEM PRIVATE "${Qt5${package}_INCLUDE_DIRS}") target_include_directories(${TARGET_NAME} SYSTEM PRIVATE "${Qt5${package}_INCLUDE_DIRS}")
# `qt5_create_translation` is provided from `LinguistTools` package. # `qt5_create_translation` is provided from `LinguistTools` package.
# But the `Qt5::LinguistTools` lib does not exist. Remove it. # But the `Qt5::LinguistTools` lib does not exist. Remove it.
if (NOT (${package} STREQUAL LinguistTools)) if (NOT (${package} STREQUAL LinguistTools))
target_link_libraries(${TARGET_NAME} ${Qt5${package}_LIBRARIES}) target_link_libraries(${TARGET_NAME} ${Qt5${package}_LIBRARIES})
endif() endif ()
endforeach ()
foreach (package ${QT5_PACKAGES_OPTIONAL})
if ("${Qt5${package}_FOUND}")
message("Optional package ${package} found.")
target_include_directories(${TARGET_NAME} SYSTEM PRIVATE "${Qt5${package}_INCLUDE_DIRS}")
target_link_libraries(${TARGET_NAME} ${Qt5${package}_LIBRARIES})
string(TOUPPER "${package}" INCLUDE_NAME)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_${INCLUDE_NAME}_ENABLED")
else ()
message("Optional package ${package} not found.")
endif ()
endforeach () endforeach ()
target_link_libraries(${TARGET_NAME} ${BCTOOLBOX_CORE_LIBRARIES} ${BELCARD_LIBRARIES} ${LINPHONE_LIBRARIES} ${LINPHONECXX_LIBRARIES}) target_link_libraries(${TARGET_NAME} ${BCTOOLBOX_CORE_LIBRARIES} ${BELCARD_LIBRARIES} ${LINPHONE_LIBRARIES} ${LINPHONECXX_LIBRARIES})
......
...@@ -151,9 +151,8 @@ void App::initContentApp () { ...@@ -151,9 +151,8 @@ void App::initContentApp () {
); );
} }
// Init core and clipboard. // Init core.
CoreManager::init(this, mParser.value("config")); CoreManager::init(this, mParser.value("config"));
Clipboard::init(this);
// Init engine content. // Init engine content.
mEngine = new QQmlApplicationEngine(); mEngine = new QQmlApplicationEngine();
...@@ -171,9 +170,6 @@ void App::initContentApp () { ...@@ -171,9 +170,6 @@ 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();
...@@ -359,8 +355,10 @@ void App::registerTypes () { ...@@ -359,8 +355,10 @@ void App::registerTypes () {
registerType<SoundPlayer>("SoundPlayer"); registerType<SoundPlayer>("SoundPlayer");
registerSingletonType<AudioCodecsModel>("AudioCodecsModel"); registerSingletonType<AudioCodecsModel>("AudioCodecsModel");
registerSingletonType<Clipboard>("Clipboard");
registerSingletonType<OwnPresenceModel>("OwnPresenceModel"); registerSingletonType<OwnPresenceModel>("OwnPresenceModel");
registerSingletonType<Presence>("Presence"); registerSingletonType<Presence>("Presence");
registerSingletonType<TextToSpeech>("TextToSpeech");
registerSingletonType<TimelineModel>("TimelineModel"); registerSingletonType<TimelineModel>("TimelineModel");
registerSingletonType<VideoCodecsModel>("VideoCodecsModel"); registerSingletonType<VideoCodecsModel>("VideoCodecsModel");
...@@ -377,7 +375,6 @@ void App::registerSharedTypes () { ...@@ -377,7 +375,6 @@ void App::registerSharedTypes () {
qInfo() << QStringLiteral("Registering shared types..."); qInfo() << QStringLiteral("Registering shared types...");
registerSharedSingletonType(App, "App", App::getInstance); registerSharedSingletonType(App, "App", App::getInstance);
registerSharedSingletonType(Clipboard, "Clipboard", Clipboard::getInstance);
registerSharedSingletonType(CoreManager, "CoreManager", CoreManager::getInstance); registerSharedSingletonType(CoreManager, "CoreManager", CoreManager::getInstance);
registerSharedSingletonType(SettingsModel, "SettingsModel", CoreManager::getInstance()->getSettingsModel); registerSharedSingletonType(SettingsModel, "SettingsModel", CoreManager::getInstance()->getSettingsModel);
registerSharedSingletonType(AccountSettingsModel, "AccountSettingsModel", CoreManager::getInstance()->getAccountSettingsModel); registerSharedSingletonType(AccountSettingsModel, "AccountSettingsModel", CoreManager::getInstance()->getAccountSettingsModel);
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
#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"
...@@ -45,8 +44,6 @@ class App : public SingleApplication { ...@@ -45,8 +44,6 @@ 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 ();
...@@ -89,10 +86,6 @@ signals: ...@@ -89,10 +86,6 @@ 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 ();
...@@ -118,8 +111,6 @@ private: ...@@ -118,8 +111,6 @@ private:
QVariantList mAvailableLocales; QVariantList mAvailableLocales;
QString mLocale; QString mLocale;
QTextToSpeech *mTextToSpeech = nullptr;
QQmlApplicationEngine *mEngine = nullptr; QQmlApplicationEngine *mEngine = nullptr;
DefaultTranslator *mTranslator = nullptr; DefaultTranslator *mTranslator = nullptr;
...@@ -129,6 +120,4 @@ private: ...@@ -129,6 +120,4 @@ private:
QQuickWindow *mSettingsWindow = nullptr; QQuickWindow *mSettingsWindow = nullptr;
}; };
Q_DECLARE_METATYPE(QTextToSpeech *);
#endif // APP_H_ #endif // APP_H_
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include "settings/AccountSettingsModel.hpp" #include "settings/AccountSettingsModel.hpp"
#include "sip-addresses/SipAddressesProxyModel.hpp" #include "sip-addresses/SipAddressesProxyModel.hpp"
#include "sound-player/SoundPlayer.hpp" #include "sound-player/SoundPlayer.hpp"
#include "text-to-speech/TextToSpeech.hpp"
#include "timeline/TimelineModel.hpp" #include "timeline/TimelineModel.hpp"
#endif // COMPONENTS_H_ #endif // COMPONENTS_H_
...@@ -27,19 +27,10 @@ ...@@ -27,19 +27,10 @@
// ============================================================================= // =============================================================================
Clipboard *Clipboard::mInstance = nullptr;
Clipboard::Clipboard (QObject *parent) : QObject(parent) { Clipboard::Clipboard (QObject *parent) : QObject(parent) {
connect(QGuiApplication::clipboard(), &QClipboard::dataChanged, this, &Clipboard::textChanged); connect(QGuiApplication::clipboard(), &QClipboard::dataChanged, this, &Clipboard::textChanged);
} }
// -----------------------------------------------------------------------------
void Clipboard::init (QObject *parent) {
if (!mInstance)
mInstance = new Clipboard(parent);
}
QString Clipboard::getText () const { QString Clipboard::getText () const {
return QGuiApplication::clipboard()->text(QClipboard::Clipboard); return QGuiApplication::clipboard()->text(QClipboard::Clipboard);
} }
......
...@@ -33,25 +33,16 @@ class Clipboard : public QObject { ...@@ -33,25 +33,16 @@ class Clipboard : public QObject {
Q_PROPERTY(QString text READ getText WRITE setText NOTIFY textChanged); Q_PROPERTY(QString text READ getText WRITE setText NOTIFY textChanged);
public: public:
Clipboard (QObject *parent = Q_NULLPTR);
~Clipboard () = default; ~Clipboard () = default;
static void init (QObject *parent);
static Clipboard *getInstance () {
Q_ASSERT(mInstance != nullptr);
return mInstance;
}
signals: signals:
void textChanged (); void textChanged ();
private: private:
Clipboard (QObject *parent);
QString getText () const; QString getText () const;
void setText (const QString &text); void setText (const QString &text);
static Clipboard *mInstance;
}; };
#endif // ifndef CLIPBOARD_H_ #endif // ifndef CLIPBOARD_H_
/*
* TextToSpeech.cpp
* Copyright (C) 2017 Belledonne Communications, Grenoble, France
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Created on: May 31, 2017
* Author: Ronan Abhamon
*/
#ifdef TEXTTOSPEECH_ENABLED
#include <QTextToSpeech>
#endif // ifdef TEXTTOSPEECH_ENABLED
#include "TextToSpeech.hpp"
// =============================================================================
#ifdef TEXTTOSPEECH_ENABLED
TextToSpeech::TextToSpeech (QObject *parent) : QObject(parent) {
mQtTextToSpeech = new QTTextToSpeech(this);
}
void TextToSpeech::say (const QString &text) {
mQtTextToSpeech->say(text);
}
#else
TextToSpeech::TextToSpeech (QObject *parent) : QObject(parent) {}
void TextToSpeech::say (const QString &) {}
#endif // ifdef TEXTTOSPEECH_ENABLED
/*
* TextToSpeech.hpp
* Copyright (C) 2017 Belledonne Communications, Grenoble, France
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Created on: May 31, 2017
* Author: Ronan Abhamon
*/
#ifndef TEXT_TO_SPEECH_H_
#define TEXT_TO_SPEECH_H_
#include <QObject>
// =============================================================================
class QTextToSpeech;
class TextToSpeech : public QObject {
Q_OBJECT;
public:
TextToSpeech (QObject *parent = Q_NULLPTR);
~TextToSpeech () = default;
Q_INVOKABLE void say (const QString &text);
private:
QTextToSpeech *mQtTextToSpeech = nullptr;
};
#endif // ifndef TEXT_TO_SPEECH_H_
...@@ -77,7 +77,7 @@ Item { ...@@ -77,7 +77,7 @@ Item {
MenuItem { MenuItem {
text: qsTr('menuPlayMe') text: qsTr('menuPlayMe')
onTriggered: App.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