opt: add option to disable tts component (#1169)

* opt: add tts config option

* opt:[macos] disable tts by default

* [autofix.ci] apply automated fixes

* opt: add build flags to about dialog

---------

Co-authored-by: YiFang Xiao <yifang.xiao@noreply.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
xiaoyifang 2023-09-26 11:09:05 +08:00 committed by GitHub
parent 248252a698
commit ec2856336c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 27 additions and 4 deletions

View file

@ -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

View file

@ -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%

View file

@ -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)

View file

@ -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 \

View file

@ -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

View file

@ -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(

View file

@ -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.