mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-05-07 14:44:01 +00:00
fix(app): fix build with text to speech
This commit is contained in:
parent
c0d3632b80
commit
8fc9b5b96c
9 changed files with 140 additions and 63 deletions
|
|
@ -36,7 +36,7 @@ include(CheckCXXCompilerFlag)
|
|||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
|
||||
if(NOT WIN32)
|
||||
if (NOT WIN32)
|
||||
check_cxx_compiler_flag("-Wsuggest-override" SUGGEST_OVERRIDE)
|
||||
set(CUSTOM_FLAGS "\
|
||||
-Wall \
|
||||
|
|
@ -53,19 +53,19 @@ if(NOT WIN32)
|
|||
-Wuninitialized \
|
||||
-Wunused \
|
||||
")
|
||||
if(NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
if (NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
set(CUSTOM_FLAGS "${CUSTOM_FLAGS} -Wlogical-op")
|
||||
endif()
|
||||
if(SUGGEST_OVERRIDE)
|
||||
endif ()
|
||||
if (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}")
|
||||
# See: http://stackoverflow.com/a/1372836
|
||||
if(WIN32)
|
||||
if (WIN32)
|
||||
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_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_
|
|||
# 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}/wrappers/cpp/LinphoneCxxConfig.cmake")
|
||||
include("${EP_bctoolbox_CONFIG_DIR}/BcToolboxConfig.cmake")
|
||||
include("${EP_belcard_CONFIG_DIR}/BelcardConfig.cmake")
|
||||
else()
|
||||
else ()
|
||||
find_package(Linphone REQUIRED)
|
||||
find_package(LinphoneCxx REQUIRED)
|
||||
find_package(BcToolbox REQUIRED)
|
||||
find_package(Belcard REQUIRED)
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
set(SOURCES
|
||||
src/app/App.cpp
|
||||
|
|
@ -127,6 +128,7 @@ set(SOURCES
|
|||
src/components/sip-addresses/SipAddressesProxyModel.cpp
|
||||
src/components/sip-addresses/SipAddressObserver.cpp
|
||||
src/components/sound-player/SoundPlayer.cpp
|
||||
src/components/text-to-speech/TextToSpeech.cpp
|
||||
src/components/timeline/TimelineModel.cpp
|
||||
src/externals/single-application/SingleApplication.cpp
|
||||
src/main.cpp
|
||||
|
|
@ -173,6 +175,7 @@ set(HEADERS
|
|||
src/components/sip-addresses/SipAddressesProxyModel.hpp
|
||||
src/components/sip-addresses/SipAddressObserver.hpp
|
||||
src/components/sound-player/SoundPlayer.hpp
|
||||
src/components/text-to-speech/TextToSpeech.hpp
|
||||
src/components/timeline/TimelineModel.hpp
|
||||
src/externals/single-application/SingleApplication.hpp
|
||||
src/externals/single-application/SingleApplicationPrivate.hpp
|
||||
|
|
@ -221,16 +224,16 @@ foreach (line ${QRC_RESOURCES_CONTENT})
|
|||
endif ()
|
||||
endforeach ()
|
||||
|
||||
if(NOT WIN32)
|
||||
# ------------------------------------------------------------------------------
|
||||
# Init git hooks.
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
if (NOT WIN32)
|
||||
add_custom_target(
|
||||
check_qml DEPENDS ${QML_SOURCES}
|
||||
COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/tools/check_qml_syntax"
|
||||
)
|
||||
endif()
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Init git hooks.
|
||||
# ------------------------------------------------------------------------------
|
||||
endif ()
|
||||
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E copy
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/tools/private/pre-commit"
|
||||
|
|
@ -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_OPTIONAL} QUIET)
|
||||
|
||||
if(CMAKE_INSTALL_RPATH)
|
||||
if (CMAKE_INSTALL_RPATH)
|
||||
get_target_property(LUPDATE_PATH Qt5::lupdate LOCATION)
|
||||
get_filename_component(LUPDATE_PATH "${LUPDATE_PATH}" DIRECTORY)
|
||||
get_filename_component(QT_PATH "${LUPDATE_PATH}/../lib" ABSOLUTE)
|
||||
list(APPEND CMAKE_INSTALL_RPATH "${QT_PATH}")
|
||||
endif()
|
||||
endif ()
|
||||
|
||||
# Add languages support.
|
||||
add_subdirectory(${LANGUAGES_DIRECTORY})
|
||||
|
|
@ -266,26 +270,40 @@ qt5_add_resources(RESOURCES ${QRC_RESOURCES})
|
|||
|
||||
# Build.
|
||||
# Note: `update_translations` is provided by `languages/CMakeLists.txt`.
|
||||
if(WIN32)
|
||||
if (WIN32)
|
||||
add_executable(${TARGET_NAME} WIN32 ${SOURCES} ${HEADERS} ${RESOURCES} linphone.rc)
|
||||
else()
|
||||
else ()
|
||||
add_executable(${TARGET_NAME} ${SOURCES} ${HEADERS} ${RESOURCES})
|
||||
endif()
|
||||
endif ()
|
||||
bc_git_version(${TARGET_NAME} ${PROJECT_VERSION})
|
||||
add_dependencies(${TARGET_NAME} ${TARGET_NAME}-git-version)
|
||||
add_dependencies(${TARGET_NAME} update_translations)
|
||||
if(NOT WIN32)
|
||||
if (NOT WIN32)
|
||||
add_dependencies(update_translations check_qml)
|
||||
endif()
|
||||
endif ()
|
||||
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}")
|
||||
|
||||
foreach (package ${QT5_PACKAGES})
|
||||
target_include_directories(${TARGET_NAME} SYSTEM PRIVATE "${Qt5${package}_INCLUDE_DIRS}")
|
||||
# `qt5_create_translation` is provided from `LinguistTools` package.
|
||||
# But the `Qt5::LinguistTools` lib does not exist. Remove it.
|
||||
if (NOT (${package} STREQUAL LinguistTools))
|
||||
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 ()
|
||||
|
||||
target_link_libraries(${TARGET_NAME} ${BCTOOLBOX_CORE_LIBRARIES} ${BELCARD_LIBRARIES} ${LINPHONE_LIBRARIES} ${LINPHONECXX_LIBRARIES})
|
||||
|
|
|
|||
|
|
@ -151,9 +151,8 @@ void App::initContentApp () {
|
|||
);
|
||||
}
|
||||
|
||||
// Init core and clipboard.
|
||||
// Init core.
|
||||
CoreManager::init(this, mParser.value("config"));
|
||||
Clipboard::init(this);
|
||||
|
||||
// Init engine content.
|
||||
mEngine = new QQmlApplicationEngine();
|
||||
|
|
@ -171,9 +170,6 @@ 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();
|
||||
|
||||
|
|
@ -359,8 +355,10 @@ void App::registerTypes () {
|
|||
registerType<SoundPlayer>("SoundPlayer");
|
||||
|
||||
registerSingletonType<AudioCodecsModel>("AudioCodecsModel");
|
||||
registerSingletonType<Clipboard>("Clipboard");
|
||||
registerSingletonType<OwnPresenceModel>("OwnPresenceModel");
|
||||
registerSingletonType<Presence>("Presence");
|
||||
registerSingletonType<TextToSpeech>("TextToSpeech");
|
||||
registerSingletonType<TimelineModel>("TimelineModel");
|
||||
registerSingletonType<VideoCodecsModel>("VideoCodecsModel");
|
||||
|
||||
|
|
@ -377,7 +375,6 @@ void App::registerSharedTypes () {
|
|||
qInfo() << QStringLiteral("Registering shared types...");
|
||||
|
||||
registerSharedSingletonType(App, "App", App::getInstance);
|
||||
registerSharedSingletonType(Clipboard, "Clipboard", Clipboard::getInstance);
|
||||
registerSharedSingletonType(CoreManager, "CoreManager", CoreManager::getInstance);
|
||||
registerSharedSingletonType(SettingsModel, "SettingsModel", CoreManager::getInstance()->getSettingsModel);
|
||||
registerSharedSingletonType(AccountSettingsModel, "AccountSettingsModel", CoreManager::getInstance()->getAccountSettingsModel);
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@
|
|||
#include <QCommandLineParser>
|
||||
#include <QQmlApplicationEngine>
|
||||
#include <QQuickWindow>
|
||||
#include <QTextToSpeech>
|
||||
|
||||
#include "../components/notifier/Notifier.hpp"
|
||||
#include "../externals/single-application/SingleApplication.hpp"
|
||||
|
|
@ -45,8 +44,6 @@ 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 ();
|
||||
|
|
@ -89,10 +86,6 @@ signals:
|
|||
void configLocaleChanged (const QString &locale);
|
||||
|
||||
private:
|
||||
QTextToSpeech *getTextToSpeech () const {
|
||||
return mTextToSpeech;
|
||||
}
|
||||
|
||||
void registerTypes ();
|
||||
void registerSharedTypes ();
|
||||
void setTrayIcon ();
|
||||
|
|
@ -118,8 +111,6 @@ private:
|
|||
QVariantList mAvailableLocales;
|
||||
QString mLocale;
|
||||
|
||||
QTextToSpeech *mTextToSpeech = nullptr;
|
||||
|
||||
QQmlApplicationEngine *mEngine = nullptr;
|
||||
|
||||
DefaultTranslator *mTranslator = nullptr;
|
||||
|
|
@ -129,6 +120,4 @@ private:
|
|||
QQuickWindow *mSettingsWindow = nullptr;
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(QTextToSpeech *);
|
||||
|
||||
#endif // APP_H_
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@
|
|||
#include "settings/AccountSettingsModel.hpp"
|
||||
#include "sip-addresses/SipAddressesProxyModel.hpp"
|
||||
#include "sound-player/SoundPlayer.hpp"
|
||||
#include "text-to-speech/TextToSpeech.hpp"
|
||||
#include "timeline/TimelineModel.hpp"
|
||||
|
||||
#endif // COMPONENTS_H_
|
||||
|
|
|
|||
|
|
@ -27,19 +27,10 @@
|
|||
|
||||
// =============================================================================
|
||||
|
||||
Clipboard *Clipboard::mInstance = nullptr;
|
||||
|
||||
Clipboard::Clipboard (QObject *parent) : QObject(parent) {
|
||||
connect(QGuiApplication::clipboard(), &QClipboard::dataChanged, this, &Clipboard::textChanged);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void Clipboard::init (QObject *parent) {
|
||||
if (!mInstance)
|
||||
mInstance = new Clipboard(parent);
|
||||
}
|
||||
|
||||
QString Clipboard::getText () const {
|
||||
return QGuiApplication::clipboard()->text(QClipboard::Clipboard);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,25 +33,16 @@ class Clipboard : public QObject {
|
|||
Q_PROPERTY(QString text READ getText WRITE setText NOTIFY textChanged);
|
||||
|
||||
public:
|
||||
Clipboard (QObject *parent = Q_NULLPTR);
|
||||
~Clipboard () = default;
|
||||
|
||||
static void init (QObject *parent);
|
||||
|
||||
static Clipboard *getInstance () {
|
||||
Q_ASSERT(mInstance != nullptr);
|
||||
return mInstance;
|
||||
}
|
||||
|
||||
signals:
|
||||
void textChanged ();
|
||||
|
||||
private:
|
||||
Clipboard (QObject *parent);
|
||||
|
||||
QString getText () const;
|
||||
void setText (const QString &text);
|
||||
|
||||
static Clipboard *mInstance;
|
||||
};
|
||||
|
||||
#endif // ifndef CLIPBOARD_H_
|
||||
|
|
|
|||
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* 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
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* 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 {
|
|||
|
||||
MenuItem {
|
||||
text: qsTr('menuPlayMe')
|
||||
onTriggered: App.textToSpeech.say($chatEntry.content)
|
||||
onTriggered: TextToSpeech.say($chatEntry.content)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue