diff --git a/kontact-kpimtextedit-revert-qttextspeech-dep.patch b/kontact-kpimtextedit-revert-qttextspeech-dep.patch deleted file mode 100644 index 0851e60..0000000 --- a/kontact-kpimtextedit-revert-qttextspeech-dep.patch +++ /dev/null @@ -1,344 +0,0 @@ -commit 82890a4c1b86a31d69aa5fd96e01b1fab0da31aa -Author: Daniel Vrátil -Date: Tue Sep 25 19:16:10 2018 +0200 - - Revert "Make it required" - - This reverts commit 35e5d87c7a4a76be5e754e3a0faa53b4f9f1224e. - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 7343ad183..02c92bdf0 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -71,7 +71,10 @@ add_definitions(-DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT) - add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x060000) - add_definitions(-DQT_NO_URL_CAST_FROM_STRING) - --find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED COMPONENTS TextToSpeech) -+find_package(Qt5 OPTIONAL_COMPONENTS TextToSpeech) -+if (${Qt5TextToSpeech_FOUND}) -+ set(KPIMTEXTEDIT_HAVE_TEXTTOSPEECH TRUE) -+endif() - - if(BUILD_TESTING) - find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED COMPONENTS Test) -diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index bdb167cbc..58d610e48 100644 ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -87,9 +87,12 @@ target_link_libraries(KF5PimTextEdit - KF5::XmlGui - KF5::I18n - KF5::SyntaxHighlighting -- Qt5::TextToSpeech - ) - -+if(KPIMTEXTEDIT_HAVE_TEXTTOSPEECH) -+ target_link_libraries(KF5PimTextEdit PRIVATE Qt5::TextToSpeech) -+endif() -+ - set_target_properties(KF5PimTextEdit PROPERTIES - VERSION ${KPIMTEXTEDIT_VERSION_STRING} - SOVERSION ${KPIMTEXTEDIT_SOVERSION} -diff --git a/src/config-kpimtextedit.h.cmake b/src/config-kpimtextedit.h.cmake -index b739c948a..fadbc68dc 100644 ---- a/src/config-kpimtextedit.h.cmake -+++ b/src/config-kpimtextedit.h.cmake -@@ -1 +1,3 @@ - /* config-kpimtextedit.h. Generated by cmake from config-kpimtextedit.h.cmake */ -+ -+#cmakedefine01 KPIMTEXTEDIT_HAVE_TEXTTOSPEECH -diff --git a/src/texttospeech/texttospeech.cpp b/src/texttospeech/texttospeech.cpp -index b2c812b49..bc86ec27b 100644 ---- a/src/texttospeech/texttospeech.cpp -+++ b/src/texttospeech/texttospeech.cpp -@@ -23,12 +23,16 @@ - #include - #include - #include -+#if KPIMTEXTEDIT_HAVE_TEXTTOSPEECH - #include -+#endif - - namespace KPIMTextEdit { - TextToSpeech::TextToSpeech(QObject *parent) - : QObject(parent) -+#if KPIMTEXTEDIT_HAVE_TEXTTOSPEECH - , mTextToSpeech(nullptr) -+#endif - { - reloadSettings(); - } -@@ -39,6 +43,7 @@ TextToSpeech::~TextToSpeech() - - void TextToSpeech::reloadSettings() - { -+#if KPIMTEXTEDIT_HAVE_TEXTTOSPEECH - KConfig config(QStringLiteral("texttospeechrc")); - KConfigGroup grp = config.group("Settings"); - const QString engineName = grp.readEntry("engine"); -@@ -57,6 +62,7 @@ void TextToSpeech::reloadSettings() - mTextToSpeech->setVolume(grp.readEntry("volume", 0)); - mTextToSpeech->setLocale(QLocale(grp.readEntry("localeName"))); - //It doesn't have api for it mTextToSpeech->setVoice(grp.readEntry("voice")); -+#endif - } - - TextToSpeech *TextToSpeech::self() -@@ -67,6 +73,7 @@ TextToSpeech *TextToSpeech::self() - - void TextToSpeech::slotStateChanged() - { -+#if KPIMTEXTEDIT_HAVE_TEXTTOSPEECH - TextToSpeech::State state; - switch (mTextToSpeech->state()) { - case QTextToSpeech::Ready: -@@ -83,81 +90,130 @@ void TextToSpeech::slotStateChanged() - break; - } - Q_EMIT stateChanged(state); -+#endif - } - - bool TextToSpeech::isReady() const - { -+#if KPIMTEXTEDIT_HAVE_TEXTTOSPEECH - return mTextToSpeech->state() != QTextToSpeech::BackendError; -+#else -+ return false; -+#endif - } - - void TextToSpeech::say(const QString &text) - { -+#if KPIMTEXTEDIT_HAVE_TEXTTOSPEECH - mTextToSpeech->say(text); -+#else -+ Q_UNUSED(text); -+#endif - } - - void TextToSpeech::stop() - { -+#if KPIMTEXTEDIT_HAVE_TEXTTOSPEECH - mTextToSpeech->stop(); -+#endif - } - - void TextToSpeech::pause() - { -+#if KPIMTEXTEDIT_HAVE_TEXTTOSPEECH - mTextToSpeech->pause(); -+#endif - } - - void TextToSpeech::resume() - { -+#if KPIMTEXTEDIT_HAVE_TEXTTOSPEECH - mTextToSpeech->resume(); -+#endif - } - - void TextToSpeech::setRate(double rate) - { -+#if KPIMTEXTEDIT_HAVE_TEXTTOSPEECH - mTextToSpeech->setRate(rate); -+#else -+ Q_UNUSED(rate); -+#endif - } - - void TextToSpeech::setPitch(double pitch) - { -+#if KPIMTEXTEDIT_HAVE_TEXTTOSPEECH - mTextToSpeech->setPitch(pitch); -+#else -+ Q_UNUSED(pitch); -+#endif - } - - void TextToSpeech::setVolume(int volume) - { -+#if KPIMTEXTEDIT_HAVE_TEXTTOSPEECH - mTextToSpeech->setVolume(volume); -+#else -+ Q_UNUSED(volume); -+#endif - } - - int TextToSpeech::volume() const - { -+#if KPIMTEXTEDIT_HAVE_TEXTTOSPEECH - return mTextToSpeech->volume(); -+#else -+ return 0; -+#endif - } - - QVector TextToSpeech::availableLocales() const - { -+#if KPIMTEXTEDIT_HAVE_TEXTTOSPEECH - return mTextToSpeech->availableLocales(); -+#else -+ return QVector(); -+#endif - } - - QStringList TextToSpeech::availableVoices() const - { - QStringList lst; -+#if KPIMTEXTEDIT_HAVE_TEXTTOSPEECH - const QVector voices = mTextToSpeech->availableVoices(); - lst.reserve(voices.count()); - for (const QVoice &voice : voices) { - lst << voice.name(); - } -+#endif - return lst; - } - - QStringList TextToSpeech::availableEngines() const - { -+#if KPIMTEXTEDIT_HAVE_TEXTTOSPEECH - return QTextToSpeech::availableEngines(); -+#else -+ return QStringList(); -+#endif - } - - void TextToSpeech::setLocale(const QLocale &locale) const - { -+#if KPIMTEXTEDIT_HAVE_TEXTTOSPEECH - mTextToSpeech->setLocale(locale); -+#else -+ Q_UNUSED(locale); -+#endif - } - - QLocale TextToSpeech::locale() const - { -+#if KPIMTEXTEDIT_HAVE_TEXTTOSPEECH - return mTextToSpeech->locale(); -+#else -+ return QLocale(); -+#endif - } - } -diff --git a/src/texttospeech/texttospeech.h b/src/texttospeech/texttospeech.h -index 98686bca3..dd094e305 100644 ---- a/src/texttospeech/texttospeech.h -+++ b/src/texttospeech/texttospeech.h -@@ -24,7 +24,9 @@ - #include "config-kpimtextedit.h" - #include - -+#if KPIMTEXTEDIT_HAVE_TEXTTOSPEECH - class QTextToSpeech; -+#endif - - namespace KPIMTextEdit { - class KPIMTEXTEDIT_EXPORT TextToSpeech : public QObject -@@ -71,8 +73,10 @@ private: - explicit TextToSpeech(QObject *parent = nullptr); - friend class TextToSpeechPrivate; - -+#if KPIMTEXTEDIT_HAVE_TEXTTOSPEECH - QString mDefaultEngine; - QTextToSpeech *mTextToSpeech = nullptr; -+#endif - }; - } - -diff --git a/src/texttospeech/texttospeechconfiginterface.cpp b/src/texttospeech/texttospeechconfiginterface.cpp -index 3e717d7eb..074c0857a 100644 ---- a/src/texttospeech/texttospeechconfiginterface.cpp -+++ b/src/texttospeech/texttospeechconfiginterface.cpp -@@ -18,12 +18,16 @@ - */ - - #include "texttospeechconfiginterface.h" -+#if KPIMTEXTEDIT_HAVE_TEXTTOSPEECH - #include -+#endif - using namespace KPIMTextEdit; - - TextToSpeechConfigInterface::TextToSpeechConfigInterface(QObject *parent) - : AbstractTextToSpeechConfigInterface(parent) -+#if KPIMTEXTEDIT_HAVE_TEXTTOSPEECH - , mTextToSpeech(new QTextToSpeech(this)) -+#endif - { - } - -@@ -34,31 +38,47 @@ TextToSpeechConfigInterface::~TextToSpeechConfigInterface() - QStringList TextToSpeechConfigInterface::availableVoices() const - { - QStringList lst; -+#if KPIMTEXTEDIT_HAVE_TEXTTOSPEECH - const QVector voices = mTextToSpeech->availableVoices(); - lst.reserve(voices.count()); - for (const QVoice &voice : voices) { - lst << voice.name(); - } -+#endif - return lst; - } - - QStringList TextToSpeechConfigInterface::availableEngines() const - { -+#if KPIMTEXTEDIT_HAVE_TEXTTOSPEECH - return mTextToSpeech->availableEngines(); -+#else -+ return QStringList(); -+#endif - } - - QVector TextToSpeechConfigInterface::availableLocales() const - { -+#if KPIMTEXTEDIT_HAVE_TEXTTOSPEECH - return mTextToSpeech->availableLocales(); -+#else -+ return QVector(); -+#endif - } - - QLocale TextToSpeechConfigInterface::locale() const - { -+#if KPIMTEXTEDIT_HAVE_TEXTTOSPEECH - return mTextToSpeech->locale(); -+#else -+ return QLocale(); -+#endif - } - - void TextToSpeechConfigInterface::setEngine(const QString &engineName) - { -+#if KPIMTEXTEDIT_HAVE_TEXTTOSPEECH - delete mTextToSpeech; - mTextToSpeech = new QTextToSpeech(engineName, this); -+#endif - } -diff --git a/src/texttospeech/texttospeechconfiginterface.h b/src/texttospeech/texttospeechconfiginterface.h -index 95d142c0c..71a7496a0 100644 ---- a/src/texttospeech/texttospeechconfiginterface.h -+++ b/src/texttospeech/texttospeechconfiginterface.h -@@ -23,7 +23,9 @@ - #include "kpimtextedit_export.h" - #include "config-kpimtextedit.h" - -+#if KPIMTEXTEDIT_HAVE_TEXTTOSPEECH - class QTextToSpeech; -+#endif - namespace KPIMTextEdit { - class KPIMTEXTEDIT_EXPORT TextToSpeechConfigInterface : public AbstractTextToSpeechConfigInterface - { -@@ -38,7 +40,9 @@ public: - QStringList availableEngines() const override; - QStringList availableVoices() const override; - void setEngine(const QString &engineName) override; -+#if KPIMTEXTEDIT_HAVE_TEXTTOSPEECH - QTextToSpeech *mTextToSpeech = nullptr; -+#endif - }; - } -