diff --git a/.github/scripts/windows-publish.ps1 b/.github/scripts/windows-publish.ps1
deleted file mode 100644
index 9aedcbf33..000000000
--- a/.github/scripts/windows-publish.ps1
+++ /dev/null
@@ -1,92 +0,0 @@
-[CmdletBinding()]
-param (
- [string] $archiveName, [string] $targetName
-)
-# 外部环境变量包括:
-# archiveName: ${{ matrix.qt_ver }}-${{ matrix.qt_arch }}
-# winSdkDir: ${{ steps.build.outputs.winSdkDir }}
-# winSdkVer: ${{ steps.build.outputs.winSdkVer }}
-# vcToolsInstallDir: ${{ steps.build.outputs.vcToolsInstallDir }}
-# vcToolsRedistDir: ${{ steps.build.outputs.vcToolsRedistDir }}
-# msvcArch: ${{ matrix.msvc_arch }}
-
-
-# winSdkDir: C:\Program Files (x86)\Windows Kits\10\
-# winSdkVer: 10.0.19041.0\
-# vcToolsInstallDir: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.28.29333\
-# vcToolsRedistDir: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Redist\MSVC\14.28.29325\
-# archiveName: 5.9.9-win32_msvc2015
-# msvcArch: x86
-
-$scriptDir = $PSScriptRoot
-$currentDir = Get-Location
-Write-Host "currentDir" $currentDir
-Write-Host "scriptDir" $scriptDir
-
-function Main() {
-
- New-Item -ItemType Directory $archiveName
- New-Item -ItemType Directory $archiveName\locale
- New-Item -ItemType Directory $archiveName\opencc
- # 拷贝exe
- Copy-Item release\$targetName $archiveName\
- Write-Host "copy item finished..."
-
- # #拷贝pdb
- # Copy-Item release\*.pdb $archiveName\
- # Write-Host "copy pdb finished..."
- # 拷贝依赖
- windeployqt --qmldir . --plugindir $archiveName\plugins --compiler-runtime $archiveName\$targetName
- # 删除不必要的文件
-# $excludeList = @("*.qmlc", "*.ilk", "*.exp", "*.lib", "*.pdb")
- $excludeList = @("*.qmlc", "*.ilk", "*.exp", "*.lib")
- Remove-Item -Path $archiveName -Include $excludeList -Recurse -Force
- Write-Host "remove item finished..."
- # 拷贝vcRedist dll
- $redistDll="{0}{1}\*.CRT\*.dll" -f $env:vcToolsRedistDir.Trim(),$env:msvcArch
- Write-Host "redist dll $($redistDll)"
- Copy-Item $redistDll $archiveName\
- Write-Host "copy redist dll..."
- Copy-Item "LICENSE.txt" $archiveName\
- Write-Host "copy license.."
- Copy-Item "opencc\*" $archiveName\opencc\
- Write-Host "opencc config files.."
-
- # 拷贝WinSDK dll
- $sdkDll="{0}Redist\{1}ucrt\DLLs\{2}\*.dll" -f $env:winSdkDir.Trim(),$env:winSdkVer.Trim(),$env:msvcArch
- Write-Host "copy sdk dll$($sdkDll)"
- Copy-Item $sdkDll $archiveName\
- Copy-Item winlibs\lib\msvc\*.dll $archiveName\
- Copy-Item winlibs\lib\*.dll $archiveName\
- Copy-Item locale\*.qm $archiveName\locale\
-
- $webengineqm="{0}\translations\qtwebengine_*.qm" -f $env:QTDIR.Trim()
- Write-Host "copy qtwebengine qm from $($webengineqm)"
- Copy-Item $webengineqm $archiveName\locale\
-
- # $multimedia="{0}\plugins\multimedia" -f $env:QTDIR.Trim()
- # if(Test-Path $multimedia){
- # Write-Host "copy multimedia $($multimedia) to plugins"
- # Copy-Item -Path $multimedia -Destination $archiveName\plugins -Recurse
- # }
-
- $multimedia_ffmpeg_av_dll="{0}\bin\av*.dll" -f $env:QTDIR.Trim()
- $multimedia_ffmpeg_sw_dll="{0}\bin\sw*.dll" -f $env:QTDIR.Trim()
- if (Test-Path $multimedia_ffmpeg_av_dll && Test-Path $multimedia_ffmpeg_sw_dll) {
- Write-Host "copy multimedia_ffmpeg_dlls $($multimedia_ffmpeg_av_dll) $($multimedia_ffmpeg_sw_dll) from qt"
- Copy-Item -Path $multimedia_ffmpeg_av_dll -Destination $archiveName\
- Copy-Item -Path $multimedia_ffmpeg_sw_dll -Destination $archiveName\
- }
-
- Write-Host "compress zip..."
- # 打包zip
- Compress-Archive -Path $archiveName -DestinationPath $archiveName'.zip'
-}
-
-if ($null -eq $archiveName || $null -eq $targetName) {
- Write-Host "args missing, archiveName is" $archiveName ", targetName is" $targetName
- return
-}
-Main
-
-
diff --git a/.github/workflows/PR-check-cmake.yml b/.github/workflows/PR-check-cmake.yml
index 131a6b816..e7b40d123 100644
--- a/.github/workflows/PR-check-cmake.yml
+++ b/.github/workflows/PR-check-cmake.yml
@@ -99,16 +99,7 @@ jobs:
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
submodules: true
- - name: Setup vcpkg github caches variables
- uses: actions/github-script@v7
- with:
- script: |
- core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
- core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: Run build
- id: build
- env:
- VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
run: |
# Launch-VsDevShell also provides Ninja
& 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\Launch-VsDevShell.ps1' `
@@ -118,8 +109,5 @@ jobs:
cmake -S . -B "./build_dir" `
-G Ninja `
-DCMAKE_C_COMPILER="cl.exe" -DCMAKE_CXX_COMPILER="cl.exe" `
- -DWITH_FFMPEG_PLAYER=OFF `
- -DUSE_VCPKG=ON `
- -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_INSTALLATION_ROOT\scripts\buildsystems\vcpkg.cmake" `
- -DWITH_VCPKG_BREAKPAD=ON
+ -DWITH_FFMPEG_PLAYER=OFF
cmake --build "./build_dir"
diff --git a/.github/workflows/Sonar Cloud.yml b/.github/workflows/Sonar Cloud.yml
index a036a4fdb..50b6031c1 100644
--- a/.github/workflows/Sonar Cloud.yml
+++ b/.github/workflows/Sonar Cloud.yml
@@ -6,7 +6,6 @@ on:
workflow_dispatch:
push:
branches:
- - dev
- staged
pull_request:
@@ -14,54 +13,40 @@ on:
jobs:
build:
name: Build and analyze
- runs-on: ubuntu-latest
+ runs-on: ubuntu-24.04
env:
BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory # Directory where build-wrapper output will be placed
steps:
- - name: Install Qt
- uses: jurplel/install-qt-action@v3
- with:
- version: 6.5.1
- arch: gcc_64
-
- #serialport linuxdeploy need serialport to work.
- modules: qtwebengine qtwebchannel qtpositioning qt5compat qtmultimedia qtimageformats qtspeech qtserialport
-
- name: ubuntu install thirdparty dependencies
run: |
- sudo apt-get install git pkg-config build-essential
- sudo apt-get install libvorbis-dev zlib1g-dev libhunspell-dev x11proto-record-dev
- sudo apt-get install libxtst-dev liblzo2-dev libbz2-dev
- sudo apt-get install libavutil-dev libavformat-dev libeb16-dev
- sudo apt-get install doxygen libzstd-dev libxkbcommon-dev libgstreamer-plugins-base1.0-0 libgstreamer-gl1.0-0
- sudo ln -sf /usr/bin/x86_64-linux-gnu-ld.gold /usr/bin/ld
- sudo apt install libxapian-dev
- #build opencc
- git clone https://github.com/BYVoid/OpenCC
- cd OpenCC/
- make PREFIX=/usr -j$(nproc)
- sudo make install
- cd ..
- sudo apt-get install libzim-dev
-
- sudo apt install openjdk-17-jdk openjdk-17-jre
- java -version
+ sudo apt-get install build-essential ninja-build \
+ libvorbis-dev zlib1g-dev libhunspell-dev x11proto-record-dev \
+ libxtst-dev liblzo2-dev libbz2-dev \
+ libavutil-dev libavformat-dev libeb16-dev \
+ libzstd-dev libxkbcommon-dev \
+ libxapian-dev libzim-dev libopencc-dev \
+ qt6-5compat-dev \
+ qt6-base-dev \
+ qt6-multimedia-dev \
+ qt6-speech-dev \
+ qt6-svg-dev \
+ qt6-tools-dev \
+ qt6-tools-dev-tools \
+ qt6-webchannel-dev \
+ qt6-webengine-dev
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- submodules: true
- - uses: actions/setup-node@v4
- with:
- node-version: 18
+ submodules: true
- name: Install sonar-scanner and build-wrapper
uses: SonarSource/sonarcloud-github-c-cpp@v2
- name: Run build-wrapper
run: |
- qmake CONFIG+=release CONFIG+=zim_support CONFIG+=chinese_conversion_support
- build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} make -j8
+ mkdir build_dir
+ cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -S . -B ./build_dir -G Ninja
- name: Run sonar-scanner
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
- sonar-scanner --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}"
+ sonar-scanner --define sonar.cfamily.compile-commands=./build_dir/compile_commands.json
diff --git a/.github/workflows/unused-PR-check-windows.yml b/.github/workflows/unused-PR-check-windows.yml
deleted file mode 100644
index 986ed32f0..000000000
--- a/.github/workflows/unused-PR-check-windows.yml
+++ /dev/null
@@ -1,69 +0,0 @@
-name: Windows-qmake-PR-check
-concurrency:
- group: ${{ github.workflow }}-${{ github.ref }}
- cancel-in-progress: true
-on:
-
- workflow_dispatch:
-
- # pull_request:
- # branches:
- # - dev
- # - master
- # - experimental
- # - staged
- # paths-ignore:
- # - 'docs/**'
- # # - ".github/**"
- # - "howto/**"
- # - "*.md"
- # - "locale/**"
- # - "website/**"
-
-jobs:
- build:
- name: Build
- # see https://github.com/actions/virtual-environments/blob/main/images/win/Windows2019-Readme.md
- runs-on: ${{ matrix.os }}
- strategy:
- matrix:
- os: [windows-2019]
- qt_ver: [6.6.3]
- qt_arch: [win64_msvc2019_64]
- steps:
- - uses: actions/setup-python@v3
- with:
- python-version: '3.9'
- - name: Install Qt
- if: ${{ matrix.qt_ver == '5.15.2' }}
- uses: jurplel/install-qt-action@v3
- with:
- version: ${{ matrix.qt_ver }}
- arch: ${{ matrix.qt_arch }}
-
- modules: qtwebengine
- - name: Install Qt
- if: ${{ matrix.qt_ver != '5.15.2' }}
- uses: jurplel/install-qt-action@v3
- with:
- version: ${{ matrix.qt_ver }}
- # target: ${{ matrix.qt_target }}
- arch: ${{ matrix.qt_arch }}
-
- modules: qtwebengine qtwebchannel qtpositioning qt5compat qtmultimedia qtimageformats qtspeech
- setup-python: 'false'
-
- - uses: actions/checkout@v4
- with:
- fetch-depth: 1
- submodules: true
-
- - uses: ilammy/msvc-dev-cmd@v1
- # with:
- # arch: ${{ matrix.msvc_arch }}
- - name: msvc-build goldendict
- id: build
- shell: cmd
- run: |
- qmake "CONFIG+=zim_support" CONFIG+=release CONFIG+=use_iconv CONFIG+=use_xapian CONFIG+=no_ffmpeg_player
- nmake
diff --git a/.github/workflows/unused-release-windows.yml b/.github/workflows/unused-release-windows.yml
deleted file mode 100644
index cae496ba5..000000000
--- a/.github/workflows/unused-release-windows.yml
+++ /dev/null
@@ -1,283 +0,0 @@
-name: Release Windows
-concurrency:
- group: ${{ github.workflow }}-${{ github.ref }}
- cancel-in-progress: true
-on:
- # workflow_run:
- # workflows: [AutoTag]
- # types: [completed]
- workflow_dispatch:
-# push:
-# branches:
-# - dev
-# - master
-# - experimental
-# # - staged
-# paths-ignore:
-# - 'docs/**'
-# # - ".github/**"
-# - "howto/**"
-# - "*.md"
-# - ".clang-format"
-
-jobs:
- build:
- name: Build
- # see https://github.com/actions/virtual-environments/blob/main/images/win/Windows2019-Readme.md
- runs-on: ${{ matrix.os }}
- strategy:
- matrix:
- os: [windows-2019]
- qt_ver: [ 6.6.3,6.7.2 ]
- qt_arch: [win64_msvc2019_64]
- env:
- targetName: GoldenDict.exe
- version: 24.05.13
- version-suffix: ${{ !contains(github.ref_name,'master') && 'alpha' || 'NextNameHere' }}
- prerelease: ${{ !contains(github.ref_name,'master') }}
- steps:
- - uses: actions/setup-python@v3
- with:
- python-version: '3.9'
- - name: Install Qt
- uses: jurplel/install-qt-action@v3
- with:
- version: ${{ matrix.qt_ver }}
- # target: ${{ matrix.qt_target }}
- arch: ${{ matrix.qt_arch }}
- modules: qtwebengine qtwebchannel qtpositioning qt5compat qtmultimedia qtimageformats qtspeech
- setup-python: 'false'
-
- - uses: actions/checkout@v4
- with:
- fetch-depth: 0
- submodules: true
-
- - name: changelog
- id: changelog
- shell: bash
- env:
- prerelease: ${{env.prerelease}}
- run: |
- if [[ "$prerelease" == 'true' ]]
- then
- echo "This is a pre-release"
- previousTag=$(git tag --sort=-creatordate | grep "^v" | sed -n 2p)
- currentTag=$(git tag --sort=-creatordate | grep "^v" | sed -n 1p)
- else
- echo "This is not a pre-release"
- previousTag=$(git tag --sort=-creatordate | grep "^v" | grep -v "alpha" | sed -n 2p)
- currentTag=$(git tag --sort=-creatordate | grep "^v" | grep -v "alpha" | sed -n 1p)
- fi
- echo "prev_tag=$previousTag" >> $GITHUB_OUTPUT
- echo "curr_tag=$currentTag" >> $GITHUB_OUTPUT
- echo "previousTag : $previousTag"
- echo "currentTag : $currentTag"
-
- - name: "Build Changelog"
- id: build_changelog
- uses: mikepenz/release-changelog-builder-action@v3
- with:
- commitMode: false
- fromTag: "${{ steps.changelog.outputs.prev_tag }}"
- toTag: "${{ steps.changelog.outputs.curr_tag }}"
- configurationJson: |
- {
- "template": "#{{CHANGELOG}}\n\n\n🔴 Uncategorized
\n\n#{{UNCATEGORIZED}}\n ",
- "categories": [
- {
- "title": "## 🚀 Features",
- "labels": ["feature","feat","opt"]
- },
- {
- "title": "## 🐛 Fixes",
- "labels": ["fix","bug"]
- }
- ,
- {
- "title": "## 🤖 Github action",
- "labels": ["action"]
- }
- ,
- {
- "title": "## 🧼 Clean Code",
- "labels": ["clean"]
- }
-
-
- ],
- "label_extractor": [
- {
- "pattern": "([^:]*):.*",
- "target": "$1",
- "on_property": "title",
- "flags": "gu"
- }
- ]
- }
-
-
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- - name: Set outputs
- id: vars
- shell: bash
- run: |
- echo "sha_short=$(git rev-parse --short=8 HEAD)" >> $GITHUB_OUTPUT
- echo "release_date=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT
- echo "release_time=$(date +'%H%M%S')" >> $GITHUB_OUTPUT
- echo "release_time_clock=$(date +'%H:%M:%S')" >> $GITHUB_OUTPUT
- echo "release_hm=$(date +'%y%m%d')" >> $GITHUB_OUTPUT
-
- - name: version-file
- shell: bash
- env:
- VAR_SUFFIX: ${{env.version-suffix}}
- VAR_VERSION: ${{env.version}}
- run: |
- current_tag=$(git rev-parse --short=8 HEAD)
- release_date=$(date +'%Y%m%d')
- echo "$VAR_VERSION-$VAR_SUFFIX.$release_date.$current_tag">version.txt
- cat version.txt
- echo "$version"
- # rename the vcpkg.json. with this file existed,the vcpkg action will fall to manifest mode
- - name: remove vcpkg.json
- shell: bash
- run: |
- mv vcpkg.json vcpkg.json.bak
- - name: vcpkg build
- uses: johnwason/vcpkg-action@v6
- id: vcpkg
- with:
- #manifest-dir: ${{ github.workspace }}
- pkgs: breakpad
- triplet: x64-windows-release
- token: ${{ github.token }}
- github-binarycache: true
- - name: copy vcpkg packages into winlibs
- shell: bash
- run: |
- cp -R vcpkg/packages/breakpad_x64-windows-release/* thirdparty/breakpad
- ls -al thirdparty/breakpad
-
- # # msvc编译
- - uses: ilammy/msvc-dev-cmd@v1
- # with:
- # arch: ${{ matrix.msvc_arch }}
- - name: msvc-build goldendict
- id: build
- shell: cmd
- run: |
- 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%
- echo winSdkVer=%WindowsSdkVersion% >> %GITHUB_ENV%
- echo vcToolsInstallDir=%VCToolsInstallDir% >> %GITHUB_ENV%
- echo vcToolsRedistDir=%VCToolsRedistDir% >> %GITHUB_ENV%
- echo QTDIR=%Qt6_DIR% >> %GITHUB_ENV%
-
- # 打包
- - name: windows ps package
- id: package-windows
- env:
- archiveName: GoldenDict-Windows.${{ steps.vars.outputs.sha_short }}-${{ steps.vars.outputs.release_time }}
- shell: pwsh
- run: |
- & .github\scripts\windows-publish.ps1 ${env:archiveName} ${env:targetName}
-
- - name: package
- id: package
- shell: bash
- run: |
- packageName=GoldenDict-Windows.${{ steps.vars.outputs.sha_short }}-${{ steps.vars.outputs.release_time }}
- echo $packageName
- echo "packageName=$packageName" >> $GITHUB_OUTPUT
-
- - name: upload goldendict.exe only
- uses: svenstaro/upload-release-action@v2
- with:
- repo_token: ${{ secrets.GITHUB_TOKEN }}
- file: release/${{ env.targetName }}
- asset_name: ${{ matrix.qt_ver }}.${{ matrix.os }}-${{ env.targetName }}
-
- tag: v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.sha_short }}
- overwrite: true
- release_name: GoldenDict-ng-v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
- prerelease: ${{env.prerelease}}
-
- - name: upload pdb
- uses: svenstaro/upload-release-action@v2
- with:
- repo_token: ${{ secrets.GITHUB_TOKEN }}
- file: release/GoldenDict.pdb
- asset_name: ${{ matrix.qt_ver }}.${{ matrix.os }}-GoldenDict.pdb
-
- tag: v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.sha_short }}
- overwrite: true
- release_name: GoldenDict-ng-v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
- prerelease: ${{env.prerelease}}
-
- - name: copy nsis
- shell: bash
- run: |
- cp tools/nsis/GoldenDict.nsi ${{ steps.package.outputs.packageName }}/
- - name: Create installer
- uses: joncloud/makensis-action@v4
- with:
- arguments: "/V3"
- script-file: ${{ steps.package.outputs.packageName }}/GoldenDict.nsi
- - name: make installer
- run: |
- cd ${{ steps.package.outputs.packageName }}
- ls *.exe
- - name: upload goldendict installer
- uses: svenstaro/upload-release-action@v2
- with:
- repo_token: ${{ secrets.GITHUB_TOKEN }}
- file: ${{ steps.package.outputs.packageName }}/GoldenDict-ng-v23-Installer.exe
- asset_name: ${{ matrix.qt_ver }}-GoldenDict-ng-Installer.exe
-
- tag: v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.sha_short }}
- overwrite: true
- release_name: GoldenDict-ng-v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
- prerelease: ${{env.prerelease}}
-
- - name: uploadRelease
- # if: startsWith(github.event.ref, 'refs/tags/')
- uses: svenstaro/upload-release-action@v2
- with:
- repo_token: ${{ secrets.GITHUB_TOKEN }}
- file: ${{ steps.package.outputs.packageName }}.zip
- asset_name: ${{ matrix.qt_ver }}-${{ env.targetName }}_${{ matrix.os }}_${{steps.vars.outputs.release_date}}.zip
-
- tag: v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.sha_short }}
- overwrite: true
- release_name: GoldenDict-ng-v${{env.version}}-${{env.version-suffix}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
- prerelease: ${{env.prerelease}}
- body: |
- #### Install instructions for Windows, macOS and Linux
-
- .
-
- #### Filename pattern (文件名模式): **[Qt version]-GoldenDict-ng-[OS]-[release-date].[ext]**
-
- Windows users can use either `****-installer.exe` (for installer) or `****.zip` (unzip and run).
- The `goldendict.exe` can be dropped into previous installation's folder (if dependencies aren't changed).
-
- Linux users can use Flatpak or build from source.
- https://flathub.org/apps/io.github.xiaoyifang.goldendict_ng
-
- macOS users can use `.dmg` installer.
-
- `6.5.1-GoldenDict.exe_windows-2019_20230701.zip` means built with Qt6.5.1, windows/msvc-2019 at 20230701 as a zip archive.
-
- #### Build Details
-
- macOS: macOS-12 (x86_64) and macOS-14 (Arm)
- Windows: Visual studio 2019
- based on: ${{github.ref_name}}
-
- #### Changes
-
- ${{steps.build_changelog.outputs.changelog}}
diff --git a/goldendict.pro b/goldendict.pro
deleted file mode 100644
index 75a2d571b..000000000
--- a/goldendict.pro
+++ /dev/null
@@ -1,650 +0,0 @@
-TEMPLATE = app
-TARGET = goldendict
-VERSION = 24.05.13
-
-# Generate version file. We do this here and in a build rule described later.
-# The build rule is required since qmake isn't run each time the project is
-# rebuilt; and doing it here is required too since any other way the RCC
-# compiler would complain if version.txt wouldn't exist (fresh checkouts).
-
-system(git describe --tags --always --dirty): hasGit=1
-
-!isEmpty(hasGit){
- GIT_HASH=$$system(git rev-parse --short=8 HEAD )
-}
-
-!exists( version.txt ) {
- message( "generate version.txt...." )
- system(echo $${VERSION}.$${GIT_HASH} on $${_DATE_} > version.txt)
-}
-
-
-# users can suppress verbose console compile output by add `CONFIG += silent` to qmake.
-
-CONFIG( release, debug|release ) {
- DEFINES += NDEBUG
-}
-
-# DEPENDPATH += . generators
-INCLUDEPATH += ./src/
-INCLUDEPATH += ./src/ui # for compiled .ui files to find headers
-INCLUDEPATH += ./src/common
-INCLUDEPATH += ./thirdparty/tomlplusplus
-INCLUDEPATH += ./thirdparty/fmt/include
-
-QT += core \
- gui \
- xml \
- network \
- svg \
- widgets \
- webenginewidgets\
- webchannel\
- printsupport \
- concurrent \
- texttospeech
-
-greaterThan(QT_MAJOR_VERSION, 5): QT += webenginecore core5compat
-
-DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x050F00
-
-!CONFIG( no_qtmultimedia_player ) {
- QT += multimedia
- DEFINES += MAKE_QTMULTIMEDIA_PLAYER
-}
-
-!CONFIG( no_ffmpeg_player ) {
- # ffmpeg depended on multimedia now.
- QT += multimedia
- DEFINES += MAKE_FFMPEG_PLAYER
-}
-
-contains(DEFINES, MAKE_QTMULTIMEDIA_PLAYER|MAKE_FFMPEG_PLAYER) {
- HEADERS += \
- src/audiooutput.hh
- SOURCES += \
- src/audiooutput.cc
-}
-
-#xapian is the must option now.
-win32{
- Debug: LIBS+= -L$$PWD/winlibs/lib/dbg/ -lxapian
- Release: LIBS+= -L$$PWD/winlibs/lib -lxapian
-}else{
- LIBS += -lxapian
-}
-
-CONFIG( use_breakpad ) {
- DEFINES += USE_BREAKPAD
-
-#the lib ,include files are copied from vcpkg install package.
- LIBS += -L$$PWD/thirdparty/breakpad/lib/ -llibbreakpad -llibbreakpad_client
-
-
- INCLUDEPATH += $$PWD/thirdparty/breakpad/include
- DEPENDPATH += $$PWD/thirdparty/breakpad/include
-
- CONFIG( release, debug|release ) {
- # create debug symbols for release builds
- CONFIG*=force_debug_info
- QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO -= -O2
- }
-}
-
-CONFIG( use_iconv ) {
- DEFINES += USE_ICONV
- unix:!mac{
- #ignore
- }
- else {
- LIBS+= -liconv
- }
-}
-
-CONFIG += exceptions \
- rtti \
- stl \
- c++17 \
- lrelease \
- utf8_source
-
-mac {
- CONFIG += app_bundle
-}
-
-OBJECTS_DIR = build
-UI_DIR = build
-MOC_DIR = build
-RCC_DIR = build
-LIBS += -lbz2 \
- -llzo2
-
-win32{
- Debug: LIBS+= -L$$PWD/winlibs/lib/dbg/ -lzlibd
- Release: LIBS+= -L$$PWD/winlibs/lib/ -lzlib
-}else{
- LIBS += -lz
-}
-
-
-win32 {
- QM_FILES_INSTALL_PATH = /locale/
- TARGET = GoldenDict
-
- win32-msvc* {
- # VS does not recognize 22.number.alpha,cause errors during compilation under MSVC++
- VERSION = 24.05.13
- DEFINES += __WIN32 _CRT_SECURE_NO_WARNINGS
- contains(QMAKE_TARGET.arch, x86_64) {
- DEFINES += NOMINMAX __WIN64
- }
- LIBS += -L$${PWD}/winlibs/lib/msvc
- # silence the warning C4290: C++ exception specification ignored,C4267 size_t to const T , lost data.
- QMAKE_CXXFLAGS += /wd4290 /wd4267 /Zc:__cplusplus /std:c++17 /permissive-
- # QMAKE_LFLAGS_RELEASE += /OPT:REF /OPT:ICF
-
- # QMAKE_CXXFLAGS_RELEASE += /GL # slows down the linking significantly
- LIBS += -lshell32 -luser32 -lsapi -lole32
- Debug: LIBS+= -L$$PWD/winlibs/lib/dbg/ -lhunspell-1.7
- Release: LIBS+= -L$$PWD/winlibs/lib/ -lhunspell-1.7
- }
-
- LIBS += -lwsock32 \
- -lpsapi \
- -lole32 \
- -loleaut32 \
- -ladvapi32 \
- -lcomdlg32
- LIBS += -lvorbisfile \
- -lvorbis \
- -logg
- !CONFIG( no_ffmpeg_player ) {
- LIBS += -lswresample \
- -lavutil \
- -lavformat \
- -lavcodec
- }
-
- RC_ICONS += icons/programicon.ico icons/programicon_old.ico
- INCLUDEPATH += winlibs/include src/windows
-
- # Enable console in Debug mode on Windows, with useful logging messages
- Debug:CONFIG += console
-
- Release:DEFINES += NO_CONSOLE
-
- gcc48:QMAKE_CXXFLAGS += -Wno-unused-local-typedefs
-
- !CONFIG( no_chinese_conversion_support ) {
- CONFIG += chinese_conversion_support
- }
-}
-
-!mac {
- DEFINES += INCLUDE_LIBRARY_PATH
-}
-
-unix:!mac {
- DEFINES += HAVE_X11
-
- lessThan(QT_MAJOR_VERSION, 6): QT += x11extras
-
- CONFIG += link_pkgconfig
-
- PKGCONFIG += vorbisfile \
- vorbis \
- ogg \
- hunspell
- !CONFIG( no_ffmpeg_player ) {
- PKGCONFIG += libavutil \
- libavformat \
- libavcodec \
- libswresample \
- }
- !arm {
- LIBS += -lX11 -lXtst
- }
-
- # Install prefix: first try to use qmake's PREFIX variable,
- # then $PREFIX from system environment, and if both fails,
- # use the hardcoded /usr/local.
- PREFIX = $${PREFIX}
- isEmpty( PREFIX ):PREFIX = $$(PREFIX)
- isEmpty( PREFIX ):PREFIX = /usr/local
- message(Install Prefix is: $$PREFIX)
-
- DEFINES += PROGRAM_DATA_DIR=\\\"$$PREFIX/share/goldendict/\\\"
- target.path = $$PREFIX/bin/
- locale.path = $$PREFIX/share/goldendict/locale/
- locale.files = locale/*.qm
- INSTALLS += target \
- locale
- icons.path = $$PREFIX/share/pixmaps
- icons.files = redist/icons/*.*
- INSTALLS += icons
- desktops.path = $$PREFIX/share/applications
- desktops.files = redist/*.desktop
- INSTALLS += desktops
- metainfo.path = $$PREFIX/share/metainfo
- metainfo.files = redist/*.metainfo.xml
- INSTALLS += metainfo
-}
-freebsd {
- LIBS += -lexecinfo
-}
-mac {
- QM_FILES_INSTALL_PATH = /locale/
- TARGET = GoldenDict
- # Uncomment this line to make a universal binary.
- # You will need to use Xcode 3 and Qt Carbon SDK
- # if you want the support for PowerPC and/or Mac OS X 10.4
- # CONFIG += x86 x86_64 ppc
- LIBS += -lz \
- -lbz2 \
- -lvorbisfile \
- -lvorbis \
- -logg \
- -llzo2
-
- !CONFIG( no_ffmpeg_player ) {
- LIBS += -lswresample \
- -lavutil \
- -lavformat \
- -lavcodec
- }
- QT_CONFIG -= no-pkg-config
- CONFIG += link_pkgconfig
-
- PKGCONFIG += hunspell
- INCLUDEPATH += /opt/homebrew/include /usr/local/include
- LIBS += -L/opt/homebrew/lib -L/usr/local/lib -framework AppKit -framework Carbon
-
-
- OBJECTIVE_SOURCES += src/macos/machotkeywrapper.mm \
- src/macos/macmouseover.mm
- ICON = icons/macicon.icns
- QMAKE_INFO_PLIST = redist/myInfo.plist
-
-
- QMAKE_POST_LINK = mkdir -p GoldenDict.app/Contents/Frameworks && \
- mkdir -p GoldenDict.app/Contents/MacOS/locale && \
- cp -R locale/*.qm GoldenDict.app/Contents/MacOS/locale/
-
-
- !CONFIG( no_chinese_conversion_support ) {
- CONFIG += chinese_conversion_support
- QMAKE_POST_LINK += && mkdir -p GoldenDict.app/Contents/MacOS/opencc && \
- cp -R $${PWD}/opencc/*.* GoldenDict.app/Contents/MacOS/opencc/
- }
-
-}
-DEFINES += PROGRAM_VERSION=\\\"$$VERSION\\\"
-
-# Input
-HEADERS += \
- src/ankiconnector.hh \
- src/article_maker.hh \
- src/article_netmgr.hh \
- src/audiolink.hh \
- src/audioplayerfactory.hh \
- src/audioplayerinterface.hh \
- src/btreeidx.hh \
- src/chunkedstorage.hh \
- src/common/base_type.hh \
- src/common/ex.hh \
- src/common/file.hh \
- src/common/filetype.hh \
- src/common/folding.hh \
- src/common/gddebug.hh \
- src/common/globalbroadcaster.hh \
- src/common/globalregex.hh \
- src/common/help.hh \
- src/common/htmlescape.hh \
- src/common/iconv.hh \
- src/common/inc_case_folding.hh \
- src/common/sptr.hh \
- src/common/ufile.hh \
- src/common/utf8.hh \
- src/common/utils.hh \
- src/common/wstring.hh \
- src/common/wstring_qt.hh \
- src/config.hh \
- src/decompress.hh \
- src/delegate.hh \
- src/dict/aard.hh \
- src/dict/belarusiantranslit.hh \
- src/dict/bgl.hh \
- src/dict/bgl_babylon.hh \
- src/dict/customtransliteration.hh \
- src/dict/dictdfiles.hh \
- src/dict/dictionary.hh \
- src/dict/dictserver.hh \
- src/dict/dsl.hh \
- src/dict/dsl_details.hh \
- src/dict/forvo.hh \
- src/dict/german.hh \
- src/dict/gls.hh \
- src/dict/greektranslit.hh \
- src/dict/hunspell.hh \
- src/dict/lingualibre.hh \
- src/dict/loaddictionaries.hh \
- src/dict/lsa.hh \
- src/dict/mdictparser.hh \
- src/dict/mdx.hh \
- src/dict/mediawiki.hh \
- src/dict/programs.hh \
- src/dict/ripemd.hh \
- src/dict/romaji.hh \
- src/dict/russiantranslit.hh \
- src/dict/sdict.hh \
- src/dict/slob.hh \
- src/dict/sounddir.hh \
- src/dict/sources.hh \
- src/dict/stardict.hh \
- src/dict/transliteration.hh \
- src/dict/voiceengines.hh \
- src/dict/website.hh \
- src/dict/xdxf.hh \
- src/dict/xdxf2html.hh \
- src/dict/zim.hh \
- src/dict/zipsounds.hh \
- src/dictzip.hh \
- src/externalaudioplayer.hh \
- src/externalviewer.hh \
- src/ffmpegaudio.hh \
- src/ffmpegaudioplayer.hh \
- src/ftshelpers.hh \
- src/fulltextsearch.hh \
- src/gestures.hh \
- src/headwordsmodel.hh \
- src/history.hh \
- src/hotkeywrapper.hh \
- src/iframeschemehandler.hh \
- src/indexedzip.hh \
- src/initializing.hh \
- src/dictionary_group.hh \
- src/instances.hh \
- src/keyboardstate.hh \
- src/langcoder.hh \
- src/language.hh \
- src/metadata.hh \
- src/multimediaaudioplayer.hh \
- src/parsecmdline.hh \
- src/pronounceengine.hh \
- src/resourceschemehandler.hh \
- src/splitfile.hh \
- src/termination.hh \
- src/tiff.hh \
- src/ui/about.hh \
- src/ui/article_inspect.hh \
- src/ui/articleview.hh \
- src/ui/articlewebpage.hh \
- src/ui/articlewebview.hh \
- src/ui/dictheadwords.hh \
- src/ui/dictinfo.hh \
- src/ui/dictionarybar.hh \
- src/ui/dictspanewidget.hh \
- src/ui/editdictionaries.hh \
- src/ui/favoritespanewidget.hh \
- src/ui/ftssearchpanel.hh \
- src/ui/groupcombobox.hh \
- src/ui/groups.hh \
- src/ui/groups_widgets.hh \
- src/ui/historypanewidget.hh \
- src/ui/mainstatusbar.hh \
- src/ui/maintabwidget.hh \
- src/ui/mainwindow.hh \
- src/ui/mruqmenu.hh \
- src/ui/orderandprops.hh \
- src/ui/preferences.hh \
- src/ui/scanpopup.hh \
- src/ui/searchpanel.hh \
- src/ui/searchpanewidget.hh \
- src/ui/stylescombobox.hh \
- src/ui/translatebox.hh \
- src/version.hh \
- src/webmultimediadownload.hh \
- src/weburlrequestinterceptor.hh \
- src/wordfinder.hh \
- src/zipfile.hh \
- thirdparty/tomlplusplus/toml++/toml.h
-
-FORMS += $$files(src/ui/*.ui)
-
-SOURCES += \
- src/ankiconnector.cc \
- src/article_maker.cc \
- src/article_netmgr.cc \
- src/audiolink.cc \
- src/audioplayerfactory.cc \
- src/btreeidx.cc \
- src/chunkedstorage.cc \
- src/common/file.cc \
- src/common/filetype.cc \
- src/common/folding.cc \
- src/common/gddebug.cc \
- src/common/globalbroadcaster.cc \
- src/common/globalregex.cc \
- src/common/help.cc \
- src/common/htmlescape.cc \
- src/common/iconv.cc \
- src/common/ufile.cc \
- src/common/utf8.cc \
- src/common/utils.cc \
- src/common/wstring_qt.cc \
- src/config.cc \
- src/decompress.cc \
- src/delegate.cc \
- src/dict/aard.cc \
- src/dict/belarusiantranslit.cc \
- src/dict/bgl.cc \
- src/dict/bgl_babylon.cc \
- src/dict/customtransliteration.cc \
- src/dict/dictdfiles.cc \
- src/dict/dictionary.cc \
- src/dict/dictserver.cc \
- src/dict/dsl.cc \
- src/dict/dsl_details.cc \
- src/dict/forvo.cc \
- src/dict/german.cc \
- src/dict/gls.cc \
- src/dict/greektranslit.cc \
- src/dict/hunspell.cc \
- src/dict/lingualibre.cc \
- src/dict/loaddictionaries.cc \
- src/dict/lsa.cc \
- src/dict/mdictparser.cc \
- src/dict/mdx.cc \
- src/dict/mediawiki.cc \
- src/dict/programs.cc \
- src/dict/ripemd.cc \
- src/dict/romaji.cc \
- src/dict/russiantranslit.cc \
- src/dict/sdict.cc \
- src/dict/slob.cc \
- src/dict/sounddir.cc \
- src/dict/sources.cc \
- src/dict/stardict.cc \
- src/dict/transliteration.cc \
- src/dict/voiceengines.cc \
- src/dict/website.cc \
- src/dict/xdxf.cc \
- src/dict/xdxf2html.cc \
- src/dict/zim.cc \
- src/dict/zipsounds.cc \
- src/dictzip.c \
- src/externalaudioplayer.cc \
- src/externalviewer.cc \
- src/ffmpegaudio.cc \
- src/ftshelpers.cc \
- src/fulltextsearch.cc \
- src/gestures.cc \
- src/headwordsmodel.cc \
- src/history.cc \
- src/hotkeywrapper.cc \
- src/iframeschemehandler.cc \
- src/indexedzip.cc \
- src/initializing.cc \
- src/dictionary_group.cc \
- src/instances.cc \
- src/keyboardstate.cc \
- src/langcoder.cc \
- src/language.cc \
- src/main.cc \
- src/metadata.cc \
- src/multimediaaudioplayer.cc \
- src/parsecmdline.cc \
- src/pronounceengine.cc \
- src/resourceschemehandler.cc \
- src/splitfile.cc \
- src/termination.cc \
- src/tiff.cc \
- src/ui/about.cc \
- src/ui/article_inspect.cc \
- src/ui/articleview.cc \
- src/ui/articlewebpage.cc \
- src/ui/articlewebview.cc \
- src/ui/dictheadwords.cc \
- src/ui/dictinfo.cc \
- src/ui/dictionarybar.cc \
- src/ui/editdictionaries.cc \
- src/ui/favoritespanewidget.cc \
- src/ui/ftssearchpanel.cc \
- src/ui/groupcombobox.cc \
- src/ui/groups.cc \
- src/ui/groups_widgets.cc \
- src/ui/historypanewidget.cc \
- src/ui/mainstatusbar.cc \
- src/ui/maintabwidget.cc \
- src/ui/mainwindow.cc \
- src/ui/mruqmenu.cc \
- src/ui/orderandprops.cc \
- src/ui/preferences.cc \
- src/ui/scanpopup.cc \
- src/ui/searchpanel.cc \
- src/ui/stylescombobox.cc \
- src/ui/translatebox.cc \
- src/version.cc \
- src/webmultimediadownload.cc \
- src/weburlrequestinterceptor.cc \
- src/wordfinder.cc \
- src/zipfile.cc \
- thirdparty/fmt/format.cc
-
-#speech to text
-SOURCES += src/speechclient.cc \
- src/texttospeechsource.cc
-HEADERS += src/texttospeechsource.hh \
- src/speechclient.hh
-
-CONFIG( no_tts_support ) {
- DEFINES += NO_TTS_SUPPORT
-}
-
-
-mac {
- HEADERS += src/macos/macmouseover.hh \
- src/macos/gd_clipboard.hh
- SOURCES += src/macos/gd_clipboard.cc
-}
-
-unix:!mac {
- HEADERS += src/ui/scanflag.hh
- SOURCES += src/ui/scanflag.cc
-}
-
-
-HEADERS += src/common/wildcard.hh
-SOURCES += src/common/wildcard.cc
-
-
-LIBS += -llzma
-
-CONFIG( zim_support ) {
- DEFINES += MAKE_ZIM_SUPPORT
- LIBS += -lzim
-}
-
-CONFIG( no_epwing_support ) {
- DEFINES += NO_EPWING_SUPPORT
-}
-
-!CONFIG( no_epwing_support ) {
- HEADERS += src/dict/epwing.hh \
- src/dict/epwing_book.hh \
- src/dict/epwing_charmap.hh
- SOURCES += src/dict/epwing.cc \
- src/dict/epwing_book.cc \
- src/dict/epwing_charmap.cc
- if(win32){
- INCLUDEPATH += thirdparty
- HEADERS += $$files(thirdparty/eb/*.h)
- SOURCES += $$files(thirdparty/eb/*.c)
- }
- else{
- LIBS += -leb
- }
-}
-
-CONFIG( chinese_conversion_support ) {
- DEFINES += MAKE_CHINESE_CONVERSION_SUPPORT
- FORMS += src/ui/chineseconversion.ui
- HEADERS += src/dict/chinese.hh \
- src/ui/chineseconversion.hh
- SOURCES += src/dict/chinese.cc \
- src/ui/chineseconversion.cc
-
-win32{
- Debug: LIBS+= -L$$PWD/winlibs/lib/dbg/ -lopencc
- Release: LIBS+= -L$$PWD/winlibs/lib -lopencc
-}else{
- LIBS += -lopencc
-}
-
-}
-
-RESOURCES += resources.qrc \
- src/scripts/scripts.qrc \
- icons/flags.qrc \
- src/stylesheets/css.qrc
-#EXTRA_TRANSLATIONS += thirdparty/qwebengine_ts/qtwebengine_zh_CN.ts
-TRANSLATIONS += $$files(locale/*.ts)
-
-# Build version file
-!isEmpty( hasGit ) {
- PRE_TARGETDEPS += $$PWD/version.txt
-}
-
-# This makes qmake generate translations
-
-
-isEmpty(QMAKE_LRELEASE):QMAKE_LRELEASE = $$[QT_INSTALL_BINS]/lrelease
-
-
-# The *.qm files might not exist when qmake is run for the first time,
-# causing the standard install rule to be ignored, and no translations
-# will be installed. With this, we create the qm files during qmake run.
-!win32 {
- system($${QMAKE_LRELEASE} -silent $${_PRO_FILE_} 2> /dev/null)
-}
-else{
- system($${QMAKE_LRELEASE} -silent $${_PRO_FILE_})
-}
-
-updateqm.input = TRANSLATIONS
-updateqm.output = locale/${QMAKE_FILE_BASE}.qm
-updateqm.commands = $$QMAKE_LRELEASE \
- ${QMAKE_FILE_IN} \
- -qm \
- ${QMAKE_FILE_OUT}
-updateqm.CONFIG += no_link
-QMAKE_EXTRA_COMPILERS += updateqm
-TS_OUT = $$TRANSLATIONS
-TS_OUT ~= s/.ts/.qm/g
-PRE_TARGETDEPS += $$TS_OUT
-
-#QTBUG-105984
-# avoid qt6.4.0-6.4.2 . the qtmultimedia module is buggy in all these versions
-
-include( thirdparty/qtsingleapplication/src/qtsingleapplication.pri )
-
diff --git a/redist/myInfo.plist b/redist/myInfo.plist
deleted file mode 100644
index 25c715832..000000000
--- a/redist/myInfo.plist
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
-
- CFBundleIconFile
- @ICON@
- CFBundlePackageType
- APPL
- CFBundleGetInfoString
- @SHORT_VERSION@
- CFBundleSignature
- @TYPEINFO@
- CFBundleExecutable
- @EXECUTABLE@
- CFBundleShortVersionString
- @SHORT_VERSION@
- CFBundleIdentifier
- org.xiaoyifang
- NSPrincipalClass
- NSApplication
-
-
diff --git a/src/article_maker.cc b/src/article_maker.cc
index 2f019adb7..6508bcbac 100644
--- a/src/article_maker.cc
+++ b/src/article_maker.cc
@@ -707,40 +707,38 @@ void ArticleRequest::bodyFinished()
bodyDone = true;
- {
- string footer;
+ string footer;
- if ( closePrevSpan ) {
- footer += "";
- closePrevSpan = false;
- }
+ if ( closePrevSpan ) {
+ footer += "";
+ closePrevSpan = false;
+ }
- if ( !foundAnyDefinitions ) {
- // No definitions were ever found, say so to the user.
+ if ( !foundAnyDefinitions ) {
+ // No definitions were ever found, say so to the user.
- // Larger words are usually whole sentences - don't clutter the output
- // with their full bodies.
- footer += ArticleMaker::makeNotFoundBody( word.size() < 40 ? word : "", group.name );
+ // Larger words are usually whole sentences - don't clutter the output
+ // with their full bodies.
+ footer += ArticleMaker::makeNotFoundBody( word.size() < 40 ? word : word.left( 40 ) + "...", group.name );
- // When there were no definitions, we run stemmed search.
- stemmedWordFinder = std::make_shared< WordFinder >( this );
+ // When there were no definitions, we run stemmed search.
+ stemmedWordFinder = std::make_shared< WordFinder >( this );
- connect( stemmedWordFinder.get(),
- &WordFinder::finished,
- this,
- &ArticleRequest::stemmedSearchFinished,
- Qt::QueuedConnection );
+ connect( stemmedWordFinder.get(),
+ &WordFinder::finished,
+ this,
+ &ArticleRequest::stemmedSearchFinished,
+ Qt::QueuedConnection );
- stemmedWordFinder->stemmedMatch( word, activeDicts );
- }
- else {
- footer += R"(
)";
- footer += "