diff --git a/.github/workflows/macos-homebrew.yml b/.github/workflows/macos-homebrew.yml index e712f2a7..f6b44959 100644 --- a/.github/workflows/macos-homebrew.yml +++ b/.github/workflows/macos-homebrew.yml @@ -101,7 +101,7 @@ jobs: - name: compile run: | - qmake CONFIG+=release CONFIG+=no_macos_universal CONFIG+=zim_support CONFIG+=use_xapian CONFIG+=no_ffmpeg_player + qmake CONFIG+=release CONFIG+=no_macos_universal CONFIG+=zim_support CONFIG+=use_xapian CONFIG+=no_ffmpeg_player CONFIG+=no_tts_support make -j8 - name: package diff --git a/.github/workflows/windows-6.x.yml b/.github/workflows/windows-6.x.yml index ac0eb1c3..b2c7e1c9 100644 --- a/.github/workflows/windows-6.x.yml +++ b/.github/workflows/windows-6.x.yml @@ -151,7 +151,7 @@ jobs: id: build shell: cmd run: | - qmake "CONFIG+=zim_support" CONFIG+=release CONFIG+=use_xapian CONFIG+=use_iconv CONFIG+=use_breakpad CONFIG+=no_ffmpeg_player + qmake "CONFIG+=zim_support" CONFIG+=release CONFIG+=use_xapian CONFIG+=use_iconv CONFIG+=use_breakpad CONFIG+=no_ffmpeg_player CONFIG+=no_tts_support nmake echo winSdkDir=%WindowsSdkDir% >> %GITHUB_ENV% diff --git a/CMakeLists.txt b/CMakeLists.txt index 996d1a0d..9d8dfb3c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,6 +6,7 @@ option(WITH_FFMPEG_PLAYER "Enable support for FFMPEG player" ON) option(WITH_EPWING_SUPPORT "Enable epwing support" ON) option(WITH_XAPIAN "enable Xapian support" ON) option(WITH_ZIM "enable zim support" ON) +option(WITH_TTS "enable QTexttoSpeech support" ON) # options for linux packaging option(USE_SYSTEM_FMT "use system fmt instead of bundled one" OFF) @@ -160,6 +161,10 @@ if (WITH_FFMPEG_PLAYER) target_compile_definitions(${GOLDENDICT} PUBLIC MAKE_FFMPEG_PLAYER) endif () +if(NOT WITH_TTS) + target_compile_definitions(${GOLDENDICT} PUBLIC NO_TTS_SUPPORT) +endif() + if (NOT WITH_EPWING_SUPPORT) target_compile_definitions(${GOLDENDICT} PUBLIC NO_EPWING_SUPPORT) diff --git a/goldendict.pro b/goldendict.pro index 030e59c0..7ffb5374 100644 --- a/goldendict.pro +++ b/goldendict.pro @@ -533,9 +533,14 @@ SOURCES += \ #speech to text SOURCES += src/speechclient.cc \ - src/texttospeechsource.cc + src/texttospeechsource.cc HEADERS += src/texttospeechsource.hh \ - src/speechclient.hh + src/speechclient.hh + +CONFIG( no_tts_support ) { + DEFINES += NO_TTS_SUPPORT +} + mac { HEADERS += src/macos/macmouseover.hh \ diff --git a/src/dict/sources.cc b/src/dict/sources.cc index 129bdf28..3acdec4c 100644 --- a/src/dict/sources.cc +++ b/src/dict/sources.cc @@ -124,10 +124,12 @@ Sources::Sources( QWidget * parent, Config::Class const & cfg ): ui.forvoLanguageCodes->setText( forvo.languageCodes ); // Text to speech +#ifndef NO_TTS_SUPPORT if ( !cfg.notts ) { textToSpeechSource = new TextToSpeechSource( this, cfg.voiceEngines ); ui.tabWidget->addTab( textToSpeechSource, QIcon( ":/icons/text2speech.svg" ), tr( "Text to Speech" ) ); } +#endif if ( Config::isPortableVersion() ) { // Paths diff --git a/src/version.hh b/src/version.hh index e077c41d..acd76428 100644 --- a/src/version.hh +++ b/src/version.hh @@ -18,6 +18,12 @@ const QLatin1String flags = QLatin1String( #ifdef MAKE_CHINESE_CONVERSION_SUPPORT " MAKE_CHINESE_CONVERSION_SUPPORT" #endif +#ifdef NO_TTS_SUPPORT + " NO_TTS_SUPPORT" +#endif +#ifndef MAKE_FFMPEG_PLAYER + " no_ffmpeg_player" +#endif ); const QLatin1String compiler = QLatin1String( diff --git a/website/docs/howto/build_from_source.md b/website/docs/howto/build_from_source.md index dfae4bb0..30757111 100644 --- a/website/docs/howto/build_from_source.md +++ b/website/docs/howto/build_from_source.md @@ -192,6 +192,11 @@ Then enable google breakpad like this with qmake: qmake "CONFIG+=use_breakpad" ``` +#### build with tts disabled + +`CONFIG+=no_tts_support` will disable the QTextToSpeech feature. + + ### Build with VS2019 VS2019 support CMake project, open the source directory directly then you go.