Merge branch 'staged' into dev

This commit is contained in:
Xiao Yi Fang 2024-07-11 08:41:37 +08:00
commit 3eab614bd0
22 changed files with 95 additions and 1520 deletions

View file

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

View file

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

View file

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

View file

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

View file

@ -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<details>\n<summary>🔴 Uncategorized</summary>\n\n#{{UNCATEGORIZED}}\n</details>",
"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
<https://xiaoyifang.github.io/goldendict-ng/install/>.
#### 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}}

View file

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

View file

@ -1,22 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
<plist version="0.9">
<dict>
<key>CFBundleIconFile</key>
<string>@ICON@</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleGetInfoString</key>
<string>@SHORT_VERSION@</string>
<key>CFBundleSignature</key>
<string>@TYPEINFO@</string>
<key>CFBundleExecutable</key>
<string>@EXECUTABLE@</string>
<key>CFBundleShortVersionString</key>
<string>@SHORT_VERSION@</string>
<key>CFBundleIdentifier</key>
<string>org.xiaoyifang</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>

View file

@ -707,40 +707,38 @@ void ArticleRequest::bodyFinished()
bodyDone = true;
{
string footer;
string footer;
if ( closePrevSpan ) {
footer += "</div></div>";
closePrevSpan = false;
}
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 );
// 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 );
stemmedWordFinder->stemmedMatch( word, activeDicts );
}
else {
footer += R"(<div class="empty-space"></div>)";
footer += "</body></html>";
}
appendString( footer );
if ( closePrevSpan ) {
footer += "</div></div>";
closePrevSpan = false;
}
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 : word.left( 40 ) + "...", group.name );
// 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 );
stemmedWordFinder->stemmedMatch( word, activeDicts );
}
else {
footer += R"(<div class="empty-space"></div>)";
footer += "</body></html>";
}
appendString( footer );
if ( stemmedWordFinder.get() ) {
update();
qDebug() << "send dicts(stemmed):" << hittedWord;

View file

@ -1098,10 +1098,6 @@ Class load()
if ( !fts.namedItem( "enabled" ).isNull() )
c.preferences.fts.enabled = ( fts.namedItem( "enabled" ).toElement().text() == "1" );
if ( !fts.namedItem( "enablePosition" ).isNull() ) {
c.preferences.fts.enablePosition = ( fts.namedItem( "enablePosition" ).toElement().text() == "1" );
}
if ( !fts.namedItem( "maxDictionarySize" ).isNull() )
c.preferences.fts.maxDictionarySize = fts.namedItem( "maxDictionarySize" ).toElement().text().toUInt();
@ -2088,10 +2084,6 @@ void save( Class const & c )
opt.appendChild( dd.createTextNode( c.preferences.fts.enabled ? "1" : "0" ) );
hd.appendChild( opt );
opt = dd.createElement( "enablePosition" );
opt.appendChild( dd.createTextNode( c.preferences.fts.enablePosition ? "1" : "0" ) );
hd.appendChild( opt );
opt = dd.createElement( "maxDictionarySize" );
opt.appendChild( dd.createTextNode( QString::number( c.preferences.fts.maxDictionarySize ) ) );
hd.appendChild( opt );

View file

@ -196,8 +196,6 @@ struct FullTextSearch
int searchMode;
bool enabled;
bool enablePosition = false;
quint32 maxDictionarySize;
quint32 parallelThreads = QThread::idealThreadCount() / 3 + 1;
QByteArray dialogGeometry;

View file

@ -372,7 +372,7 @@ bool MdictParser::readHeader( QDataStream & in )
// Read metadata
rtl_ = headerAttributes.namedItem( "Left2Right" ).toAttr().value() != "Yes";
QString title = headerAttributes.namedItem( "Title" ).toAttr().value();
if ( title.isEmpty() ) {
if ( title.isEmpty() || title == "Title (No HTML code allowed)" ) {
// Use filename instead
QFileInfo fi( filename_ );
title_ = fi.baseName();

View file

@ -8,15 +8,6 @@
#include <QThreadPool>
#include <QMessageBox>
#include <qalgorithms.h>
#if defined( Q_OS_WIN32 )
#include "initializing.hh"
#include <qt_windows.h>
#include <QOperatingSystemVersion>
#endif
#include "globalregex.hh"
namespace FTS {

View file

@ -165,6 +165,7 @@ MainWindow::MainWindow( Config::Class & cfg_ ):
audioPlayerFactory( cfg.preferences ),
wordFinder( this ),
wordListSelChanged( false ),
wasMaximized( false ),
headwordsDlg( nullptr ),
ftsIndexing( dictionaries ),
ftsDlg( nullptr ),
@ -871,6 +872,8 @@ MainWindow::MainWindow( Config::Class & cfg_ ):
mainStatusBar->showMessage( tr( "Accessibility API is not enabled" ), 10000, QPixmap( ":/icons/error.svg" ) );
#endif
wasMaximized = isMaximized();
history.setSaveInterval( cfg.preferences.historyStoreInterval );
#ifndef Q_OS_MACOS
ui.centralWidget->grabGesture( Gestures::GDPinchGestureType );
@ -2494,6 +2497,11 @@ bool MainWindow::eventFilter( QObject * obj, QEvent * ev )
}
}
if ( obj == this && ev->type() == QEvent::WindowStateChange ) {
auto stev = dynamic_cast< QWindowStateChangeEvent * >( ev );
wasMaximized = ( stev->oldState() == Qt::WindowMaximized && isMinimized() );
}
if ( ev->type() == QEvent::MouseButtonPress ) {
auto event = dynamic_cast< QMouseEvent * >( ev );
@ -2751,6 +2759,15 @@ void MainWindow::toggleMainWindow( bool onlyShow )
raise();
shown = true;
}
else if ( isMinimized() ) {
if ( wasMaximized )
showMaximized();
else
showNormal();
activateWindow();
raise();
shown = true;
}
else if ( !isActiveWindow() ) {
activateWindow();
if ( cfg.preferences.raiseWindowOnSearch ) {
@ -3383,11 +3400,11 @@ void MainWindow::adjustCurrentZoomFactor()
{
if ( cfg.preferences.zoomFactor >= 5 )
cfg.preferences.zoomFactor = 5;
else if ( cfg.preferences.zoomFactor <= 0.1 )
cfg.preferences.zoomFactor = 0.1;
else if ( cfg.preferences.zoomFactor <= 0.25 )
cfg.preferences.zoomFactor = 0.25;
zoomIn->setEnabled( cfg.preferences.zoomFactor < 5 );
zoomOut->setEnabled( cfg.preferences.zoomFactor > 0.1 );
zoomOut->setEnabled( cfg.preferences.zoomFactor > 0.25 );
zoomBase->setEnabled( !qFuzzyCompare( cfg.preferences.zoomFactor, 1.0 ) );
}

View file

@ -158,6 +158,8 @@ private:
bool wordListSelChanged;
bool wasMaximized; // Window state before minimization
QPrinter & getPrinter(); // Creates a printer if it's not there and returns it
DictHeadwords * headwordsDlg;

View file

@ -351,8 +351,6 @@ Preferences::Preferences( QWidget * parent, Config::Class & cfg_ ):
ui.allowEpwing->setChecked( !p.fts.disabledTypes.contains( "EPWING", Qt::CaseInsensitive ) );
ui.allowGls->setChecked( !p.fts.disabledTypes.contains( "GLS", Qt::CaseInsensitive ) );
ui.enablePosition->setChecked( p.fts.enablePosition );
ui.enablePosition->hide();
#ifndef MAKE_ZIM_SUPPORT
ui.allowZim->hide();
#endif
@ -495,7 +493,6 @@ Config::Preferences Preferences::getPreferences()
p.fts.enabled = ui.ftsGroupBox->isChecked();
p.fts.maxDictionarySize = ui.maxDictionarySize->value();
p.fts.parallelThreads = ui.parallelThreads->value();
p.fts.enablePosition = ui.enablePosition->isChecked();
buildDisabledTypes( p.fts.disabledTypes, ui.allowAard->isChecked(), "AARD" );
buildDisabledTypes( p.fts.disabledTypes, ui.allowBGL->isChecked(), "BGL" );

View file

@ -1377,16 +1377,6 @@ download page.</string>
</property>
</widget>
</item>
<item row="7" column="0" colspan="2">
<widget class="QCheckBox" name="enablePosition">
<property name="toolTip">
<string>Positional information is required to use Xapian's phrase searching and NEAR operator, but the database size will be much bigger. Applies only to new incoming dictionaries.</string>
</property>
<property name="text">
<string>Enable index with positional information</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="allowBGL">
<property name="text">

View file

@ -1,146 +0,0 @@
!include "MUI2.nsh"
Name "GoldenDict"
OutFile "GoldenDict-ng-v23-Installer.exe"
InstallDir "$PROGRAMFILES\GoldenDict"
RequestExecutionLevel admin
SetCompressor /final lzma
Var StartMenuFolder
;--------------------------------
;Interface Settings
!define MUI_ABORTWARNING
;--------------------------------
;Pages
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "LICENSE.txt"
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_STARTMENU GDApplication $StartMenuFolder
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_WELCOME
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH
;--------------------------------
;Languages
!insertmacro MUI_LANGUAGE "English" ;first language is the default language
!insertmacro MUI_LANGUAGE "French"
!insertmacro MUI_LANGUAGE "German"
!insertmacro MUI_LANGUAGE "Spanish"
!insertmacro MUI_LANGUAGE "SpanishInternational"
!insertmacro MUI_LANGUAGE "SimpChinese"
!insertmacro MUI_LANGUAGE "TradChinese"
!insertmacro MUI_LANGUAGE "Japanese"
!insertmacro MUI_LANGUAGE "Korean"
!insertmacro MUI_LANGUAGE "Italian"
!insertmacro MUI_LANGUAGE "Dutch"
!insertmacro MUI_LANGUAGE "Danish"
!insertmacro MUI_LANGUAGE "Swedish"
!insertmacro MUI_LANGUAGE "Norwegian"
!insertmacro MUI_LANGUAGE "NorwegianNynorsk"
!insertmacro MUI_LANGUAGE "Finnish"
!insertmacro MUI_LANGUAGE "Greek"
!insertmacro MUI_LANGUAGE "Russian"
!insertmacro MUI_LANGUAGE "Portuguese"
!insertmacro MUI_LANGUAGE "PortugueseBR"
!insertmacro MUI_LANGUAGE "Polish"
!insertmacro MUI_LANGUAGE "Ukrainian"
!insertmacro MUI_LANGUAGE "Czech"
!insertmacro MUI_LANGUAGE "Slovak"
!insertmacro MUI_LANGUAGE "Croatian"
!insertmacro MUI_LANGUAGE "Bulgarian"
!insertmacro MUI_LANGUAGE "Hungarian"
!insertmacro MUI_LANGUAGE "Thai"
!insertmacro MUI_LANGUAGE "Romanian"
!insertmacro MUI_LANGUAGE "Latvian"
!insertmacro MUI_LANGUAGE "Macedonian"
!insertmacro MUI_LANGUAGE "Estonian"
!insertmacro MUI_LANGUAGE "Turkish"
!insertmacro MUI_LANGUAGE "Lithuanian"
!insertmacro MUI_LANGUAGE "Slovenian"
!insertmacro MUI_LANGUAGE "Serbian"
!insertmacro MUI_LANGUAGE "SerbianLatin"
!insertmacro MUI_LANGUAGE "Arabic"
!insertmacro MUI_LANGUAGE "Farsi"
!insertmacro MUI_LANGUAGE "Hebrew"
!insertmacro MUI_LANGUAGE "Indonesian"
!insertmacro MUI_LANGUAGE "Mongolian"
!insertmacro MUI_LANGUAGE "Luxembourgish"
!insertmacro MUI_LANGUAGE "Albanian"
!insertmacro MUI_LANGUAGE "Breton"
!insertmacro MUI_LANGUAGE "Belarusian"
!insertmacro MUI_LANGUAGE "Icelandic"
!insertmacro MUI_LANGUAGE "Malay"
!insertmacro MUI_LANGUAGE "Bosnian"
!insertmacro MUI_LANGUAGE "Kurdish"
!insertmacro MUI_LANGUAGE "Irish"
!insertmacro MUI_LANGUAGE "Uzbek"
!insertmacro MUI_LANGUAGE "Galician"
!insertmacro MUI_LANGUAGE "Afrikaans"
!insertmacro MUI_LANGUAGE "Catalan"
!insertmacro MUI_LANGUAGE "Esperanto"
;--------------------------------
;Installer Sections
Section
SetOutPath "$INSTDIR"
File /r *.*
; Write the installation path into the registry
WriteRegStr HKLM SOFTWARE\GoldenDict "Install_Dir" "$INSTDIR"
; Write the uninstall keys for Windows
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\GoldenDict" "DisplayName" "GoldenDict"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\GoldenDict" "UninstallString" '"$INSTDIR\uninstall.exe"'
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\GoldenDict" "NoModify" 1
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\GoldenDict" "NoRepair" 1
WriteUninstaller "$INSTDIR\uninstall.exe"
CreateDirectory "$SMPROGRAMS\GoldenDict"
CreateShortcut "$SMPROGRAMS\GoldenDict\Uninstall.lnk" "$INSTDIR\uninstall.exe"
CreateShortcut "$SMPROGRAMS\GoldenDict\GoldenDict.lnk" "$INSTDIR\GoldenDict.exe"
SectionEnd
!define PROGRAM_NAME "GoldenDict"
; Uninstaller
Section "Uninstall"
; Remove registry keys
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\GoldenDict"
; Remove registry keys
DeleteRegKey HKLM SOFTWARE\GoldenDict
; Remove files and uninstaller
Delete $INSTDIR\GoldenDict.nsi
Delete $INSTDIR\GoldenDict.exe
Delete $INSTDIR\uninstall.exe
Delete $INSTDIR\*.*
; Remove shortcuts, if any
Delete "$SMPROGRAMS\GoldenDict\*.lnk"
; Remove directories
RMDir "$SMPROGRAMS\GoldenDict"
RMDir "$INSTDIR"
SectionEnd

View file

@ -2,11 +2,26 @@ Developing GoldenDict is not hard.
If you know some C++ and optionally some Qt, you can start to modify GoldenDict right now:
* Install Qt and QtCreator
* (On Linux, install dependencies)
* Load `goldendict.pro` or `CMakeLists.txt`
* Modify some code
* Hit the `Run`.
## Install Qt and QtCreator
(On Linux, install dependencies)
Windows(qtcreator for example)
### Prerequisite
Install visual studio community ,choose C++ component.
QtCreator Packages:
```
[x]qtX.X.X version
[x]MSVC2019 /GCC
[x]Qt5 Compatible Module
[*]Additional
[x]Qt Image formats
[x]Qt MultiMedia
[x]Qt Positioning
[x]Qt speech
[x]Qt webchannel
[x]Qt webengine
```
## Coding Standards
@ -16,4 +31,4 @@ Commit messages should follow [Conventional Commits](https://www.conventionalcom
Reformat changes with `clang-format` [how to use clang-format](https://github.com/xiaoyifang/goldendict/blob/staged/howto/how%20to%20use%20.clang-format%20to%20format%20the%20code.md)
Remember to enable `clang-tidy` support on your editor so that `.clang-tidy` will be respected.
Remember to enable `clang-tidy` support on your editor so that `.clang-tidy` will be respected.

View file

@ -106,125 +106,3 @@ To make the `.app` runnable elsewhere, you can run `cmake --install build_dir/`
To create `.dmg` installer, you have to have [create-dmg](https://github.com/create-dmg/create-dmg) installed on your machine, then also `cmake --install build_dir/`.
## Qmake
### Build Steps
**Notice**: All additional configs for `qmake` that must be combined in one of pass config options to `qmake`:
```shell
qmake6 "CONFIG+=release"
make
```
For ARM macOS, `QMAKE_APPLE_DEVICE_ARCHS="arm64"` should be passed to qmake.
#### Building with Chinese conversion support
To add Chinese conversion support you need at first install libopencc-dev package, then pass `"CONFIG+=chinese_conversion_support"` to `qmake`.
```
sudo apt-get install libopencc-dev
```
#### Building with Zim dictionaries support
To add Zim formats support you need `libzim`, then pass `"CONFIG+=zim_support"` to `qmake`
**Note**: Some linux distros do not support latest zim version, so you need to compile from latest source.
On Windows, you can use vcpkg to compile the libzim
```
vcpkg install libzim:x64-windows
```
and copy the corresponding(debug/release) library to the `winlibs/lib` folder. the zim's `include` directory to the `winlibs/include` directory.
#### Building without Epwing format support
If you have problem building with libeb-dev package, you can pass
`"CONFIG+=no_epwing_support"` to `qmake` in order to disable Epwing format support
#### Building without internal audio players
If you have problem building with FFmpeg (for example, very old linux distro), you can pass
`"CONFIG+=no_ffmpeg_player"` to `qmake` in order to disable FFmpeg internal audio player back end.
If you have problem building with Qt5 Multimedia or experience GStreamer run-time errors (for example, Ubuntu 14.04), you can pass
`"CONFIG+=no_qtmultimedia_player"` to `qmake` in order to disable Qt Multimedia internal audio player back end.
#### Building with xapian
build xapian from source, download and extract the xapian-core source code.
```
./configure
make
make install
```
On Windows, `vcpkg install xapian:x64-windows` and copy the libs/dlls into the `winlibs`
A precompiled version of xapian lib has provided in winlibs.
On Linux, install libxapian-dev package using package manager.
On Mac, use homebrew to install xapian `brew install xapian`
Goldendict-ng has used xapian as the default and the only one fulltext engine.
#### use iconv (recommend to enable)
use `CONFIG+=use_iconv` to enable this feature. when enabled ,iconv will be used to convert encoding other than the QTextCodec(which will be deprecated in future Qt version)
```
qmake "CONFIG+=use_iconv"
```
when enabled ,iconv should be installed on the platform at the same time.
#### use breakpad
use `CONFIG+=use_breakpad` to enable this crash dump. when enabled [breakpad](https://chromium.googlesource.com/breakpad/breakpad/+/master/docs), goldendict will generate a crash dump alongside with Goldendict in the `crash` directory.
on Windows:
`vcpkg install breakpad:x64-windows-release` and copy the installed packages into `thirdparty/breakpad` directory.
with a structure like this:
```
├─breakpad
│ ├─include
│ │ ├─client
│ │ │ └─windows
│ │ │ ├─common
│ │ │ ├─crash_generation
│ │ │ ├─handler
│ │ │ └─sender
│ │ ├─common
│ │ │ └─windows
│ │ └─google_breakpad
│ │ ├─common
│ │ └─processor
│ └─lib
```
on Mac/Linux:
[vcpkg](https://techviewleo.com/install-vcpkg-c-library-manager-on-linux-macos-windows/) can also be used or you can just install breakpad from source or use precompiled packages.
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.
#### build
After successful build, run windeployqt.exe(bundled with Qt installation) in the target folder (where GoldenDict.exe is located), which will copy all necessary files to this folder.
You can click on the exe to verify that the application can be run.
After all this, you can debug the application normally.

View file

@ -1,13 +0,0 @@
the github action use https://github.com/jurplel/install-qt-action to manage qt version
how to find out the latest qt version and modules
there are several commands
```
pip install aqt
aqt list-qt linux desktop
aqt list-qt linux desktop --arch 6.4.3
aqt list-qt linux desktop --modules 6.4.3 gcc_64
```

View file

@ -16,7 +16,7 @@ Because it is open source, you can always [build it for yourself](howto/build_fr
Choose either
* `****-installer.exe ` for traditional installer experience
* `****.zip` for simply unzip and run experience
* `****.7z` for simply unzip and run experience
If Qt's version is not changed, you can also download a single `goldendict.exe` and drop it into previous installation's folder (If uncertain, don't do this).

View file

@ -54,7 +54,6 @@ nav:
- Architecture: architecture.md
- Build from source: howto/build_from_source.md
- Customize the opencc: howto/how to customize the opencc.md
- Qt version and github action: howto/how to find out the latest qt version and module in github qt action.md
- Use .clang-format: howto/how to use .clang-format to format the code.md
- Breadpad crash analysis: howto/how to use breadpad crash analysis.md
- Build ffmpeg on Windows: howto/how to build ffmpeg for visual studio.md