Merge remote-tracking branch 'origin/staged'

This commit is contained in:
shenlebantongying 2024-05-05 08:38:37 -04:00
commit 55293f1365
180 changed files with 9335 additions and 4094 deletions

View file

@ -70,6 +70,14 @@ function Main() {
# 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'

View file

@ -8,6 +8,7 @@ on:
branches:
- dev
- master
- experimental
paths-ignore:
- 'docs/**'
@ -21,12 +22,12 @@ jobs:
runs-on: ubuntu-latest
env:
version: 24.01.22
version-suffix: LoongYear
prerelease: false
version: 24.05.05
version-suffix: ${{ !contains(github.ref_name,'master') && 'alpha' || 'LiXia' }}
prerelease: ${{ !contains(github.ref_name,'master') }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: set git short sha
id: vars

View file

@ -46,11 +46,11 @@ jobs:
sudo apt install openjdk-17-jdk openjdk-17-jre
java -version
- uses: actions/checkout@v3
- 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@v3
- uses: actions/setup-node@v4
with:
node-version: 18
- name: Install sonar-scanner and build-wrapper

View file

@ -6,6 +6,7 @@ on:
# - dev
# - master
- staged
- experimental
paths-ignore:
- "docs/**"
# - ".github/**"
@ -18,7 +19,7 @@ jobs:
clang-format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3.5.2
- uses: actions/checkout@v4
with:
fetch-depth: 2
@ -35,10 +36,10 @@ jobs:
css-js-html-format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 2
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 16

View file

@ -8,6 +8,7 @@ on:
branches:
- dev
- master
- experimental
- staged
paths-ignore:
- 'docs/**'
@ -26,7 +27,7 @@ jobs:
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: 6.5.1
version: 6.6.3
arch: gcc_64
#serialport linuxdeploy need serialport to work.
@ -50,7 +51,7 @@ jobs:
sudo make install
cd ..
sudo apt-get install libzim-dev
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
submodules: false
@ -77,7 +78,7 @@ jobs:
modules: qtwebengine qtwebchannel qtpositioning qt5compat qtmultimedia qtimageformats qtspeech qtserialport
setup-python: 'false'
- uses: ilammy/msvc-dev-cmd@v1
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
submodules: true
@ -103,7 +104,7 @@ jobs:
modules: qtwebengine qtwebchannel qtpositioning qt5compat qtmultimedia qtimageformats qtspeech qtserialport
setup-python: 'false'
- uses: ilammy/msvc-dev-cmd@v1
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
submodules: false

View file

@ -14,7 +14,7 @@ jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: 3.x

View file

@ -10,6 +10,7 @@ on:
branches:
- dev
- master
- experimental
- staged
paths-ignore:
- 'docs/**'
@ -25,7 +26,7 @@ jobs:
strategy:
matrix:
os: [macos-12]
qt_ver: [6.5.1]
qt_ver: [6.6.3]
qt_arch: [clang_64]
env:
targetName: GoldenDict
@ -38,7 +39,7 @@ jobs:
arch: ${{ matrix.qt_arch }}
modules: qtwebengine qtwebchannel qtpositioning qt5compat qtmultimedia qtspeech
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 1
submodules: true

View file

@ -26,12 +26,12 @@ jobs:
qt_arch: [clang_64]
env:
targetName: GoldenDict
version: 24.01.22
version-suffix: LoongYear
prerelease: false
version: 24.02.16
version-suffix: alpha
prerelease: true
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
@ -123,12 +123,12 @@ jobs:
- name: changelog
id: changelog
run: |
previousTag=$(git tag --sort=-creatordate | grep "^v" | grep -v "alpha" | sed -n 2p)
previousTag=$(git tag --sort=-creatordate | grep "^v" | sed -n 2p)
echo "previousTag : $previousTag"
echo "prev_tag=$previousTag" >> $GITHUB_OUTPUT
echo "curr_tag=$(git tag --sort=-creatordate | grep "^v" | grep -v "alpha" | sed -n 1p)" >> $GITHUB_OUTPUT
echo "curr_tag=$(git tag --sort=-creatordate | grep "^v" | sed -n 1p)" >> $GITHUB_OUTPUT
- name: Set outputs
id: vars
@ -191,7 +191,6 @@ jobs:
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}}
target_commit: ${{github.ref}}
body: |
#### Install instructions for Windows, macOS and Linux
@ -213,10 +212,10 @@ jobs:
#### Build Details
AppImage: Ubuntu-20.04
Flatpak
macOS: macOS-12 and macOS-13
Windows: Visual studio 2019
based on: ${{github.ref}}
based on: ${{github.ref_name}}

View file

@ -8,6 +8,7 @@ on:
branches:
- dev
- master
- experimental
# - staged
paths-ignore:
- 'docs/**'
@ -21,17 +22,16 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-12,macos-13]
qt_ver: [ 6.6.1 ]
os: [macos-12,macos-14]
qt_ver: [ 6.7.0 ]
qt_arch: [clang_64]
env:
targetName: GoldenDict
version: 24.01.22
version-suffix: LoongYear
prerelease: false
version: 24.02.16
version-suffix: ${{ !contains(github.ref_name,'master') && 'alpha' || 'LiXia' }}
prerelease: ${{ !contains(github.ref_name,'master') }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
@ -43,41 +43,20 @@ jobs:
- name: install deps on macos
run: |
export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=TRUE
brew install cmake ninja
brew install automake
brew install autoconf
brew install libtool
brew install opencc
brew install automake git lame libass libtool shtool texi2html theora wget xvid nasm
brew install libiconv
brew install lzo bzip2
brew install libogg
brew install zstd lzip
brew install libvorbis
brew install hunspell
brew install cmake ninja pkg-config create-dmg \
opencc libzim hunspell xapian \
libiconv libogg libvorbis \
lzo bzip2 zstd lzip
git clone https://github.com/xiaoyifang/eb.git
cd eb && ./configure && make -j 8 && sudo make install && cd ..
# brew install xz
brew install pkg-config
brew install create-dmg
brew install xapian
brew install libzim
# brew install dylibbundler
git clone https://github.com/xiaoyifang/macdylibbundler.git
cd macdylibbundler
cmake -B build -DCMAKE_BUILD_TYPE=release
cmake --build build --config release
sudo make install
# find /usr/local -name libzstd.1.dylib
# find /usr/local -name liblzma.5.dylib
- name: version-file
shell: bash
env:
VAR_SUFFIX: ${{env.version-suffix}}
VAR_VERSION: ${{env.version}}
run: |
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
@ -92,43 +71,22 @@ jobs:
modules: qtwebengine qtwebchannel qtpositioning qt5compat qtmultimedia qtimageformats qtspeech
- name: compile
run: |
qmake CONFIG+=release CONFIG+=no_macos_universal CONFIG+=zim_support CONFIG+=use_xapian CONFIG+=no_ffmpeg_player CONFIG+=no_tts_support
make -j8
run: |
mkdir build_dir
cmake -S . -B build_dir -G Ninja -DWITH_FFMPEG_PLAYER=OFF -DWITH_TTS=OFF -DCMAKE_BUILD_TYPE=Release
cmake --build build_dir
- name: package
run: |
macdeployqt ${targetName}.app -qmldir=. -verbose=1
otool -L GoldenDict.app/Contents/MacOS/GoldenDict
ls -al GoldenDict.app/Contents/Frameworks
find /usr/local/Cellar -name "libicudata.73.dylib" -exec cp {} GoldenDict.app/Contents/Frameworks/ \;
find GoldenDict.app/Contents/Frameworks/ -maxdepth 1 -name "libicu*" -exec ls -al {} \;
find GoldenDict.app/Contents/Frameworks/ -maxdepth 1 -type f -name "libicu*" -exec ls -al {} \;
find GoldenDict.app/Contents/Frameworks/ -maxdepth 1 -type f -name "libzim*" -exec dylibbundler -of -b -x {} -d GoldenDict.app/Contents/Frameworks/ -p @executable_path/../Frameworks -s /usr/local/ -s /opt/ \;
find GoldenDict.app/Contents/Frameworks/ -maxdepth 1 -name "libicu*" -exec dylibbundler -of -b -x {} -d GoldenDict.app/Contents/Frameworks/ -p @executable_path/../Frameworks -s /usr/local/ -s /opt/ \;
otool -L GoldenDict.app/Contents/Frameworks/libicu*
otool -L GoldenDict.app/Contents/Frameworks/libzim*
codesign --force --deep -s - GoldenDict.app
ls -al GoldenDict.app/Contents/Frameworks
mkdir tmp
mv ${targetName}.app ./tmp
# --background "installer_background.png"
create-dmg --hdiutil-verbose --volname "${targetName} Installer" --volicon "icons/macicon.icns" --window-pos 200 120 --window-size 800 400 --icon-size 100 --icon "${targetName}.app" 200 190 --hide-extension "${targetName}.app" --app-drop-link 600 185 --skip-jenkins "${targetName}.dmg" tmp/
cmake --install build_dir/
- name: changelog
id: changelog
run: |
previousTag=$(git tag --sort=-creatordate | grep "^v" | grep -v "alpha" | sed -n 2p)
run: |
previousTag=$(git tag --sort=-creatordate | grep "^v" | sed -n 2p)
echo "previousTag : $previousTag"
echo "prev_tag=$previousTag" >> $GITHUB_OUTPUT
echo "curr_tag=$(git tag --sort=-creatordate | grep "^v" | grep -v "alpha" | sed -n 1p)" >> $GITHUB_OUTPUT
echo "curr_tag=$(git tag --sort=-creatordate | grep "^v" | sed -n 1p)" >> $GITHUB_OUTPUT
- name: Set outputs
id: vars
@ -184,14 +142,12 @@ jobs:
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ env.targetName }}.dmg
asset_name: ${{ matrix.qt_ver }}-${{ env.targetName }}_${{ matrix.os }}_homebrew_${{steps.vars.outputs.release_date}}.dmg
file: "*.dmg"
file_glob: true
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}}
target_commit: ${{github.ref}}
body: |
#### Install instructions for Windows, macOS and Linux
@ -199,8 +155,6 @@ jobs:
#### Filename pattern (文件名模式): **[Qt version]-GoldenDict-ng-[OS]-[release-date].[ext]**
Qt6.X is recommended for various enhancements.
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).
@ -213,13 +167,10 @@ jobs:
#### Build Details
AppImage: Ubuntu-20.04
macOS: macOS-12 and macOS-13
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,205 +0,0 @@
name: Ubuntu-6.2
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
workflow_dispatch:
# push:
# branches:
# - dev
# - master
# paths-ignore:
# - 'docs/**'
# - "howto/**"
# - "*.md"
# - ".clang-format"
jobs:
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04]
qt_ver: [ 6.6.1 ]
qt_arch: [gcc_64]
env:
version: 24.01.22
version-suffix: LoongYear
prerelease: false
steps:
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: ${{ matrix.qt_ver }}
arch: ${{ matrix.qt_arch }}
#serialport linuxdeploy need serialport to work.
modules: qtwebengine qtwebchannel qtpositioning qt5compat qtmultimedia qtimageformats qtspeech qtserialport
- name: ubuntu install thirdparty dependencies
run: |
sudo add-apt-repository --yes --update ppa:kiwixteam/release
sudo apt-get install build-essential \
libvorbis-dev zlib1g-dev libhunspell-dev x11proto-record-dev \
libxtst-dev liblzo2-dev libbz2-dev \
libavutil-dev libavformat-dev libeb16-dev \
libxkbcommon-dev libgstreamer-plugins-base1.0-0 libgstreamer-gl1.0-0 \
libxkbcommon-x11-dev libspeechd-dev \
libfuse2 libxapian-dev libzim-dev ninja-build
pip3 install cmake
sudo ln -sf /usr/bin/x86_64-linux-gnu-ld.gold /usr/bin/ld
# build opencc
git clone https://github.com/BYVoid/OpenCC
cd OpenCC/
cmake -S . -B build_dir -G Ninja\
-DCMAKE_INSTALL_PREFIX=/usr/ \
-DCMAKE_BUILD_TYPE=Release
cmake --build build_dir
sudo cmake --install ./build_dir/
cd ..
# wget https://oligarchy.co.uk/xapian/1.4.22/xapian-core-1.4.22.tar.xz
# tar xvf xapian-core-1.4.22.tar.xz
# cd xapian-core-1.4.22
# ./configure
# make PREFIX=/usr
# sudo make install
# cd ..
- uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: true
- name: build goldendict
run: |
cmake -S . -B build_dir -G Ninja \
-DCMAKE_BUILD_TYPE=Release -DWITH_FFMPEG_PLAYER=OFF
cmake --build build_dir
cmake --install ./build_dir --prefix=appdir/usr
find appdir/
- name: Build AppImage
run: |
# for /usr/lib/qt6/plugins/platforminputcontexts/libfcitx5platforminputcontextplugin.so
sudo apt-get install extra-cmake-modules libxkbcommon-dev libxcb1 libxcb-cursor0
git clone --single-branch --depth 1 https://github.com/fcitx/fcitx5-qt.git
cd fcitx5-qt
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DENABLE_QT4=OFF -DENABLE_QT5=OFF -DENABLE_QT6=ON -DBUILD_ONLY_PLUGIN=ON
cmake --build build
sudo cmake --install ./build
cd ..
wget -c -nv "https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage"
chmod a+x linuxdeploy-plugin-qt-x86_64.AppImage
wget -c -nv "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage"
chmod a+x linuxdeploy-x86_64.AppImage
./linuxdeploy-x86_64.AppImage --appdir appdir --output appimage --plugin qt -i redist/icons/goldendict.png -d redist/io.github.xiaoyifang.goldendict_ng.desktop
- name: changelog
id: changelog
run: |
previousTag=$(git tag --sort=-creatordate | grep "^v" | grep -v "alpha" | sed -n 2p)
echo "previousTag : $previousTag"
echo "prev_tag=$previousTag" >> $GITHUB_OUTPUT
echo "curr_tag=$(git tag --sort=-creatordate | grep "^v" | grep -v "alpha" | sed -n 1p)" >> $GITHUB_OUTPUT
- name: Set outputs
id: vars
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
appname=$(ls *.AppImage* -1|head -n1)
echo "appname=$appname" >> $GITHUB_OUTPUT
- 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"
}
]
}
- name: uploadRelease
# if: startsWith(github.event.ref, 'refs/tags/')
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ steps.vars.outputs.appname }}
asset_name: ${{ matrix.qt_ver }}-${{ steps.vars.outputs.appname }}
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}}
target_commit: ${{github.ref}}
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]**
Qt6.X is recommended for various enhancements.
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
AppImage: Ubuntu-20.04
macOS: macOS-12 and macOS-13
Windows: Visual studio 2019
based on: ${{github.ref_name}}
#### Changes
${{steps.build_changelog.outputs.changelog}}

View file

@ -1,83 +1,84 @@
name: Ubuntu-PR-check
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
workflow_dispatch:
pull_request:
branches:
- dev
- master
- staged
paths-ignore:
- 'docs/**'
# - ".github/**"
- "howto/**"
- "*.md"
- "locale/**"
- "website/**"
jobs:
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
qt_ver: [5.15.2,6.6.0]
qt_arch: [gcc_64]
steps:
- name: Install Qt
if: ${{ matrix.qt_ver == '5.15.2' }}
uses: jurplel/install-qt-action@v3
with:
version: ${{ matrix.qt_ver }}
modules: qtwebengine
- 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 qtwebchannel qtpositioning qt5compat qtmultimedia qtimageformats qtspeech
- name: ubuntu install thirdparty dependencies
run: |
sudo apt-get install git pkg-config build-essential qt5-qmake
sudo apt-get install libvorbis-dev zlib1g-dev libhunspell-dev x11proto-record-dev
sudo apt-get install qtdeclarative5-dev libxtst-dev liblzo2-dev libbz2-dev
sudo apt-get install libavutil-dev libavformat-dev libeb16-dev
sudo apt-get install libqt5webkit5-dev libqt5svg5-dev libqt5x11extras5-dev qttools5-dev
sudo apt-get install qttools5-dev-tools qtmultimedia5-dev libqt5multimedia5-plugins doxygen libzstd-dev #libopencc-dev
sudo apt-get install libxkbcommon-dev libc6-dev
sudo ln -sf /usr/bin/x86_64-linux-gnu-ld.gold /usr/bin/ld
git clone https://github.com/BYVoid/OpenCC
pwd
cd OpenCC/
make PREFIX=/usr -j$(nproc)
sudo make install
cd ..
sudo apt install libxapian-dev
sudo apt-get install libzim-dev
- uses: actions/checkout@v3
with:
fetch-depth: 1
submodules: true
- name: build goldendict
run: |
qmake CONFIG+=release PREFIX=/usr CONFIG+=zim_support CONFIG+=chinese_conversion_support CONFIG+=use_iconv CONFIG+=use_xapian
make INSTALL_ROOT=appdir -j`nproc` install; find appdir/
#copy missing shared dll to appdir.
mkdir -p appdir/usr/lib
cp $(ldd appdir/usr/bin/goldendict | grep -o '\W/[^ ]*' |grep gobject ) appdir/usr/lib
cp $(ldd appdir/usr/bin/goldendict | grep -o '\W/[^ ]*' |grep libpango ) appdir/usr/lib
name: Ubuntu-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
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
qt_ver: [5.15.2,6.6.0]
qt_arch: [gcc_64]
steps:
- name: Install Qt
if: ${{ matrix.qt_ver == '5.15.2' }}
uses: jurplel/install-qt-action@v3
with:
version: ${{ matrix.qt_ver }}
modules: qtwebengine
- 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 qtwebchannel qtpositioning qt5compat qtmultimedia qtimageformats qtspeech
- name: ubuntu install thirdparty dependencies
run: |
sudo apt-get install git pkg-config build-essential qt5-qmake
sudo apt-get install libvorbis-dev zlib1g-dev libhunspell-dev x11proto-record-dev
sudo apt-get install qtdeclarative5-dev libxtst-dev liblzo2-dev libbz2-dev
sudo apt-get install libavutil-dev libavformat-dev libeb16-dev
sudo apt-get install libqt5webkit5-dev libqt5svg5-dev libqt5x11extras5-dev qttools5-dev
sudo apt-get install qttools5-dev-tools qtmultimedia5-dev libqt5multimedia5-plugins doxygen libzstd-dev #libopencc-dev
sudo apt-get install libxkbcommon-dev libc6-dev
sudo ln -sf /usr/bin/x86_64-linux-gnu-ld.gold /usr/bin/ld
git clone https://github.com/BYVoid/OpenCC
pwd
cd OpenCC/
make PREFIX=/usr -j$(nproc)
sudo make install
cd ..
sudo apt install libxapian-dev
sudo apt-get install libzim-dev
- uses: actions/checkout@v4
with:
fetch-depth: 1
submodules: true
- name: build goldendict
run: |
qmake CONFIG+=release PREFIX=/usr CONFIG+=zim_support CONFIG+=chinese_conversion_support CONFIG+=use_iconv CONFIG+=use_xapian
make INSTALL_ROOT=appdir -j`nproc` install; find appdir/
#copy missing shared dll to appdir.
mkdir -p appdir/usr/lib
cp $(ldd appdir/usr/bin/goldendict | grep -o '\W/[^ ]*' |grep gobject ) appdir/usr/lib
cp $(ldd appdir/usr/bin/goldendict | grep -o '\W/[^ ]*' |grep libpango ) appdir/usr/lib

View file

@ -1,193 +0,0 @@
name: Ubuntu
# Qt官方没有linux平台的x86包
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
workflow_dispatch:
# push:
# branches:
# - dev
# - master
# paths-ignore:
# - 'docs/**'
# - "howto/**"
# - "*.md"
# - ".clang-format"
jobs:
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04]
qt_ver: [5.15.2]
qt_arch: [gcc_64]
env:
version: 24.01.22
version-suffix: LoongYear
prerelease: false
steps:
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: ${{ matrix.qt_ver }}
modules: qtwebengine
- name: ubuntu install thirdparty dependencies
run: |
sudo apt-get install git pkg-config build-essential qt5-qmake
sudo apt-get install libvorbis-dev zlib1g-dev libhunspell-dev x11proto-record-dev
sudo apt-get install qtdeclarative5-dev libxtst-dev liblzo2-dev libbz2-dev
sudo apt-get install libavutil-dev libavformat-dev libeb16-dev
sudo apt-get install libqt5webkit5-dev libqt5svg5-dev libqt5x11extras5-dev qttools5-dev
sudo apt-get install qttools5-dev-tools qtmultimedia5-dev libqt5multimedia5-plugins doxygen libzstd-dev libspeechd-dev #libopencc-dev
sudo ln -sf /usr/bin/x86_64-linux-gnu-ld.gold /usr/bin/ld
sudo apt install libxapian-dev
sudo apt install libfuse2
git clone https://github.com/BYVoid/OpenCC
pwd
cd OpenCC/
make PREFIX=/usr -j$(nproc)
sudo make install
cd ..
sudo add-apt-repository --yes --update ppa:kiwixteam/release
sudo apt install libzim-dev
- uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: true
- 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"
- name: build goldendict
run: |
qmake CONFIG+=release PREFIX=/usr CONFIG+=zim_support CONFIG+=chinese_conversion_support CONFIG+=use_iconv CONFIG+=use_xapian
make INSTALL_ROOT=appdir -j`nproc` install; find appdir/
#copy missing shared dll to appdir.
mkdir -p appdir/usr/lib
cp $(ldd appdir/usr/bin/goldendict | grep -o '\W/[^ ]*' |grep gobject ) appdir/usr/lib
cp $(ldd appdir/usr/bin/goldendict | grep -o '\W/[^ ]*' |grep libpango ) appdir/usr/lib
- name: Build AppImage
run: |
sudo apt install fcitx5-frontend-qt5
wget -c -nv "https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage"
chmod a+x linuxdeploy-plugin-qt-x86_64.AppImage
wget -c -nv "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage"
chmod a+x linuxdeploy-x86_64.AppImage
./linuxdeploy-x86_64.AppImage --appdir appdir --output appimage --plugin qt -i redist/icons/goldendict.png -d redist/io.github.xiaoyifang.goldendict_ng.desktop
- name: changelog
id: changelog
run: |
previousTag=$(git tag --sort=-creatordate | grep "^v" | grep -v "alpha" | sed -n 2p)
echo "previousTag : $previousTag"
echo "prev_tag=$previousTag" >> $GITHUB_OUTPUT
echo "curr_tag=$(git tag --sort=-creatordate | grep "^v" | grep -v "alpha" | sed -n 1p)" >> $GITHUB_OUTPUT
- name: Set outputs
id: vars
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
appname=$(ls *.AppImage* -1|head -n1)
echo "appname=$appname" >> $GITHUB_OUTPUT
- 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"
}
]
}
- name: uploadRelease
# if: startsWith(github.event.ref, 'refs/tags/')
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ steps.vars.outputs.appname }}
asset_name: ${{ matrix.qt_ver }}-${{ steps.vars.outputs.appname }}
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}}
target_commit: ${{github.ref}}
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]**
Qt6.X is recommended for various enhancements.
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
AppImage: Ubuntu-20.04
macOS: macOS-12 and macOS-13
Windows: Visual studio 2019
based on: ${{github.ref_name}}
#### Changes
${{steps.build_changelog.outputs.changelog}}

View file

@ -11,6 +11,7 @@ on:
branches:
- dev
- master
- experimental
# - staged
paths-ignore:
- 'docs/**'
@ -27,13 +28,13 @@ jobs:
strategy:
matrix:
os: [windows-2019]
qt_ver: [ 6.6.1 ]
qt_ver: [ 6.6.3,6.7.0 ]
qt_arch: [win64_msvc2019_64]
env:
targetName: GoldenDict.exe
version: 24.01.22
version-suffix: LoongYear
prerelease: false
version: 24.05.05
version-suffix: ${{ !contains(github.ref_name,'master') && 'alpha' || 'LiXia' }}
prerelease: ${{ !contains(github.ref_name,'master') }}
steps:
- uses: actions/setup-python@v3
with:
@ -47,7 +48,7 @@ jobs:
modules: qtwebengine qtwebchannel qtpositioning qt5compat qtmultimedia qtimageformats qtspeech
setup-python: 'false'
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
@ -56,11 +57,11 @@ jobs:
id: changelog
shell: bash
run: |
previousTag=$(git tag --sort=-creatordate | grep "^v" | grep -v "alpha" | sed -n 2p)
previousTag=$(git tag --sort=-creatordate | grep "^v" | sed -n 2p)
echo "previousTag : $previousTag"
echo "prev_tag=$previousTag" >> $GITHUB_OUTPUT
echo "curr_tag=$(git tag --sort=-creatordate | grep "^v" | grep -v "alpha" | sed -n 1p)" >> $GITHUB_OUTPUT
echo "curr_tag=$(git tag --sort=-creatordate | grep "^v" | sed -n 1p)" >> $GITHUB_OUTPUT
- name: "Build Changelog"
id: build_changelog
@ -188,7 +189,6 @@ jobs:
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}}
target_commit: ${{github.ref}}
- name: upload pdb
uses: svenstaro/upload-release-action@v2
@ -200,8 +200,7 @@ jobs:
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}}
target_commit: ${{github.ref}}
prerelease: ${{env.prerelease}}
- name: copy nsis
shell: bash
@ -227,7 +226,6 @@ jobs:
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}}
target_commit: ${{github.ref}}
- name: uploadRelease
# if: startsWith(github.event.ref, 'refs/tags/')
@ -241,7 +239,6 @@ jobs:
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}}
target_commit: ${{github.ref}}
body: |
#### Install instructions for Windows, macOS and Linux
@ -249,8 +246,6 @@ jobs:
#### Filename pattern (文件名模式): **[Qt version]-GoldenDict-ng-[OS]-[release-date].[ext]**
Qt6.X is recommended for various enhancements.
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).
@ -263,8 +258,7 @@ jobs:
#### Build Details
AppImage: Ubuntu-20.04
macOS: macOS-12 and macOS-13
macOS: macOS-12 (x86_64) and macOS-14 (Arm)
Windows: Visual studio 2019
based on: ${{github.ref_name}}

View file

@ -1,68 +1,69 @@
name: Windows-PR-check
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
workflow_dispatch:
pull_request:
branches:
- dev
- master
- 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: [5.15.2,6.6.0]
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@v3
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
name: Windows-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: [5.15.2,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

@ -27,9 +27,9 @@ jobs:
qt_arch: [win64_msvc2019_64]
env:
targetName: GoldenDict.exe
version: 24.01.22
version-suffix: LoongYear
prerelease: false
version: 24.02.16
version-suffix: alpha
prerelease: true
# 步骤
steps:
# 安装Qt
@ -45,7 +45,7 @@ jobs:
modules: qtwebengine
# 拉取代码
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
@ -54,12 +54,12 @@ jobs:
id: changelog
shell: bash
run: |
previousTag=$(git tag --sort=-creatordate | grep "^v" | grep -v "alpha" | sed -n 2p)
previousTag=$(git tag --sort=-creatordate | grep "^v" | sed -n 2p)
echo "previousTag : $previousTag"
echo "prev_tag=$previousTag" >> $GITHUB_OUTPUT
echo "curr_tag=$(git tag --sort=-creatordate | grep "^v" | grep -v "alpha" | sed -n 1p)" >> $GITHUB_OUTPUT
echo "curr_tag=$(git tag --sort=-creatordate | grep "^v" | sed -n 1p)" >> $GITHUB_OUTPUT
- name: Set outputs
id: vars
@ -168,7 +168,6 @@ jobs:
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}}
target_commit: ${{github.ref}}
- name: copy nsis
@ -198,7 +197,6 @@ jobs:
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}}
target_commit: ${{github.ref}}
- name: uploadRelease
uses: svenstaro/upload-release-action@v2
with:
@ -210,7 +208,6 @@ jobs:
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}}
target_commit: ${{github.ref}}
body: |
#### Install instructions for Windows, macOS and Linux
@ -232,7 +229,7 @@ jobs:
#### Build Details
AppImage: Ubuntu-20.04
Flatpak
macOS: macOS-12 and macOS-13
Windows: Visual studio 2019
based on: ${{github.ref_name}}

View file

@ -4,7 +4,6 @@ cmake_minimum_required(VERSION 3.25) # ubuntu 23.04 Fedora 36
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)
@ -22,31 +21,29 @@ option(USE_ALTERNATIVE_NAME "Force the name goldendict-ng " OFF)
include(FeatureSummary)
project(goldendict-ng
VERSION 24.01.22
VERSION 24.05.05
LANGUAGES CXX C)
if (NOT USE_ALTERNATIVE_NAME)
set(GOLDENDICT "goldendict") # binary/executable name
else ()
set(GOLDENDICT "goldendict") # binary/executable name
if (USE_ALTERNATIVE_NAME )
set(GOLDENDICT "goldendict-ng")
endif ()
if (APPLE)
set(GOLDENDICT "GoldenDict-ng")
endif()
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
#### Qt
find_package(Qt6 REQUIRED COMPONENTS
Concurrent
Core5Compat
LinguistTools
Multimedia
WebEngineWidgets
Widgets
Svg
Xml
TextToSpeech
)
set(GD_QT_COMPONENTS Concurrent Core5Compat LinguistTools Multimedia PrintSupport WebEngineWidgets Widgets Svg Xml)
if (WITH_TTS)
list(APPEND GD_QT_COMPONENTS TextToSpeech)
endif ()
find_package(Qt6 REQUIRED COMPONENTS ${GD_QT_COMPONENTS})
qt_standard_project_setup() # availiable after find_package(Qt6 .... Core
set(CMAKE_AUTORCC ON) # not included in the qt_standard_project_setup
@ -54,7 +51,7 @@ set(CMAKE_AUTORCC ON) # not included in the qt_standard_project_setup
#### Things required during configuration
block() # generate version.txt
string(TIMESTAMP build_time)
string(TIMESTAMP build_time UTC)
find_package(Git)
if (EXISTS "${CMAKE_SOURCE_DIR}/.git" AND GIT_FOUND)
execute_process(
@ -85,6 +82,9 @@ file(GLOB_RECURSE ALL_SOURCE_FILES CONFIGURE_DEPENDS src/*.cc src/*.hh src/*.c)
if (APPLE)
file(GLOB_RECURSE MACOS_SOURCE_FILES CONFIGURE_DEPENDS src/macos/*.mm)
set(MACOS_APP_ICON ${CMAKE_SOURCE_DIR}/icons/macicon.icns)
set_source_files_properties(${MACOS_APP_ICON} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
endif ()
if (WIN32)
@ -107,6 +107,7 @@ target_sources(${GOLDENDICT} PRIVATE
src/stylesheets/css.qrc
${ALL_SOURCE_FILES}
${MACOS_SOURCE_FILES}
${MACOS_APP_ICON}
${QSINGLEAPP_SOURCE_FILES}
${WINDOWS_ICON_RC}
)
@ -125,12 +126,15 @@ target_link_libraries(${GOLDENDICT} PRIVATE
Qt6::Concurrent
Qt6::Core5Compat
Qt6::Multimedia
Qt6::PrintSupport
Qt6::WebEngineWidgets
Qt6::Widgets
Qt6::Svg
Qt6::TextToSpeech
)
if (WITH_TTS)
target_link_libraries(${GOLDENDICT} PRIVATE Qt6::TextToSpeech)
endif ()
target_include_directories(${GOLDENDICT} PRIVATE
${PROJECT_SOURCE_DIR}/thirdparty/qtsingleapplication/src
@ -170,11 +174,6 @@ if (NOT WITH_EPWING_SUPPORT)
target_compile_definitions(${GOLDENDICT} PUBLIC NO_EPWING_SUPPORT)
endif ()
if (WITH_XAPIAN)
target_compile_definitions(${GOLDENDICT} PUBLIC USE_XAPIAN)
endif ()
if (WITH_ZIM)
target_compile_definitions(${GOLDENDICT} PUBLIC MAKE_ZIM_SUPPORT)
endif ()
@ -205,12 +204,53 @@ qt_add_translations(${GOLDENDICT} TS_FILES ${TRANS_FILES}
#### installation or assemble redistribution
if (APPLE)
set(PLIST_FILE "${CMAKE_BINARY_DIR}/info_generated.plist")
configure_file("${CMAKE_SOURCE_DIR}/redist/mac_info_plist_template_cmake.plist" "${PLIST_FILE}" @ONLY)
set_target_properties(${GOLDENDICT} PROPERTIES
MACOSX_BUNDLE_GUI_IDENTIFIER my.example.com
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
MACOSX_BUNDLE TRUE
)
MACOSX_BUNDLE_INFO_PLIST "${PLIST_FILE}"
)
set(Assembling_Dir "${CMAKE_BINARY_DIR}/redist")
set(App_Name "${GOLDENDICT}.app")
set(Redistributable_APP "${Assembling_Dir}/${App_Name}")
qt_generate_deploy_script(
TARGET ${GOLDENDICT}
OUTPUT_SCRIPT deploy_script
CONTENT "qt_deploy_runtime_dependencies(
EXECUTABLE \"${Redistributable_APP}\"
GENERATE_QT_CONF
NO_APP_STORE_COMPLIANCE
)"
)
install(TARGETS ${GOLDENDICT} BUNDLE DESTINATION "${Assembling_Dir}")
install(FILES ${qm_files} DESTINATION "${Redistributable_APP}/Contents/MacOS/locale")
install(DIRECTORY "${CMAKE_SOURCE_DIR}/opencc" DESTINATION "${Redistributable_APP}/Contents/MacOS")
install(SCRIPT ${deploy_script})
install(CODE "execute_process(COMMAND codesign --force --deep -s - ${Redistributable_APP})")
find_program(CREATE-DMG "create-dmg")
if (CREATE-DMG)
install(CODE "
execute_process(COMMAND ${CREATE-DMG} \
--skip-jenkins \
--format \"ULMO\"
--volname ${CMAKE_PROJECT_NAME}-${CMAKE_PROJECT_VERSION}-${CMAKE_SYSTEM_PROCESSOR} \
--volicon ${CMAKE_SOURCE_DIR}/icons/macicon.icns \
--icon \"${App_Name}\" 100 100
--app-drop-link 300 100 \
\"GoldenDict-${CMAKE_PROJECT_VERSION}-Qt${Qt6_VERSION}-${CMAKE_SYSTEM_PROCESSOR}.dmg\" \
\"${Assembling_Dir}\")"
)
else ()
message(WARNING "create-dmg not found. No .dmg will be created")
endif ()
endif ()
if (LINUX OR BSD)
@ -239,7 +279,6 @@ if (LINUX OR BSD)
endif ()
if (WIN32)
find_program(TOOL_WINDEPLOYQT NAMES windeployqt PATHS "${Qt6_ROOT}/bin")
set_target_properties(${GOLDENDICT}
PROPERTIES
WIN32_EXECUTABLE TRUE
@ -250,14 +289,24 @@ if (WIN32)
add_custom_target(windeploy
COMMENT "Deploy everything to the output dir"
DEPENDS ${GOLDENDICT} # build this target will check if Goldendict.exe is already built
COMMAND ${TOOL_WINDEPLOYQT} --no-quick-import "${GD_WIN_OUTPUT_DIR}/${GOLDENDICT}.exe" --plugindir "${GD_WIN_OUTPUT_DIR}/plugins"
COMMAND ${WINDEPLOYQT_EXECUTABLE} --no-quick-import "${GD_WIN_OUTPUT_DIR}/${GOLDENDICT}.exe" --plugindir "${GD_WIN_OUTPUT_DIR}/plugins"
COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_SOURCE_DIR}/opencc" "${GD_WIN_OUTPUT_DIR}/opencc"
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_SOURCE_DIR}/LICENSE.txt" "${GD_WIN_OUTPUT_DIR}/LICENSE.txt"
COMMAND ${CMAKE_COMMAND} -E rm -f "${GD_WIN_OUTPUT_DIR}/goldendict.exe.manifest" "${GD_WIN_OUTPUT_DIR}/eb.dll.manifest"
WORKING_DIRECTORY ${GD_WIN_OUTPUT_DIR}
)
#TODO: use CPack to make the output folder as NSIS installer
# use CPack to make the output folder as NSIS installer
install(
DIRECTORY "${GD_WIN_OUTPUT_DIR}/"
DESTINATION .
)
set(CPACK_PACKAGE_FILE_NAME "${Qt6Widgets_VERSION}-${PROJECT_NAME}-${PROJECT_VERSION}-${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}")
set(CPACK_GENERATOR "7Z;NSIS")
set(CPACK_NSIS_MANIFEST_DPI_AWARE ON)
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.txt")
include(CPack)
endif ()
feature_summary(WHAT ALL DESCRIPTION "Build configuration:")

View file

@ -1,8 +1,12 @@
#### Include Paths
#### Various workarounds
if (APPLE)
# old & new homebrew's include paths
target_include_directories(${GOLDENDICT} PRIVATE /usr/local/include /opt/homebrew/include)
# libzim depends on ICU, but the ICU from homebrew is "key-only", we need to manually prioritize it
# See `brew info icu4c` if this no longer works
set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:/usr/local/opt/icu4c/lib/pkgconfig:/opt/homebrew/opt/icu4c/lib/pkgconfig")
endif ()
target_include_directories(${GOLDENDICT} PRIVATE
@ -12,9 +16,13 @@ target_include_directories(${GOLDENDICT} PRIVATE
if (LINUX OR BSD)
find_package(X11 REQUIRED)
pkg_check_modules(LIBXTST IMPORTED_TARGET xtst)
target_compile_definitions(${GOLDENDICT} PUBLIC HAVE_X11)
target_link_libraries(${GOLDENDICT} PRIVATE X11 PkgConfig::LIBXTST)
if (X11_FOUND AND X11_Xtst_FOUND)
target_compile_definitions(${GOLDENDICT} PUBLIC HAVE_X11)
target_link_libraries(${GOLDENDICT} PRIVATE ${X11_LIBRARIES} ${X11_Xtst_LIB})
target_include_directories(${GOLDENDICT} PRIVATE ${X11_INCLUDE_DIR} ${X11_Xtst_INCLUDE_PATH})
else ()
message(FATAL_ERROR "Cannot find X11 and libXtst!")
endif ()
endif ()
if (APPLE)
@ -24,13 +32,9 @@ endif ()
##### Finding packages from package manager
find_package(PkgConfig REQUIRED)
# Provided by Cmake
find_package(ZLIB REQUIRED)
find_package(BZip2 REQUIRED)
find_package(Iconv REQUIRED)
# Consider all PkgConfig dependencies as one
pkg_check_modules(PKGCONFIG_DEPS IMPORTED_TARGET
@ -40,14 +44,26 @@ pkg_check_modules(PKGCONFIG_DEPS IMPORTED_TARGET
vorbis # .ogg
vorbisfile
liblzma
)
xapian-core
)
target_link_libraries(${GOLDENDICT} PRIVATE
PkgConfig::PKGCONFIG_DEPS
BZip2::BZip2
ZLIB::ZLIB
Iconv::Iconv
)
)
# On FreeBSD, there are two iconv, libc iconv & GNU libiconv.
# The system one is good enough, the following is a workaround to use libc iconv on freeBSD.
if (BSD STREQUAL "FreeBSD")
# Simply do nothing. libc includes iconv on freeBSD.
# LIBICONV_PLUG is a magic word to turn /usr/include/local/inconv.h, which belong to GNU libiconv, into normal iconv.h
# Same hack used by SDL https://github.com/libsdl-org/SDL/blob/d6ebbc2fa4abdbe0bd53d0ce8804a492ecb042b9/src/stdlib/SDL_iconv.c#L27-L28
target_compile_definitions(${GOLDENDICT} PUBLIC LIBICONV_PLUG)
else ()
find_package(Iconv REQUIRED)
target_link_libraries(${GOLDENDICT} PRIVATE Iconv::Iconv)
endif ()
if (WITH_FFMPEG_PLAYER)
pkg_check_modules(FFMPEG REQUIRED IMPORTED_TARGET
@ -55,15 +71,10 @@ if (WITH_FFMPEG_PLAYER)
libavformat
libavutil
libswresample
)
)
target_link_libraries(${GOLDENDICT} PRIVATE PkgConfig::FFMPEG)
endif ()
if (WITH_XAPIAN)
find_package(Xapian REQUIRED) # https://github.com/xapian/xapian/tree/master/xapian-core/cmake
target_link_libraries(${GOLDENDICT} PRIVATE ${XAPIAN_LIBRARIES})
endif ()
if (WITH_EPWING_SUPPORT)
find_library(EB_LIBRARY eb REQUIRED)
target_link_libraries(${GOLDENDICT} PRIVATE ${EB_LIBRARY})

View file

@ -28,7 +28,7 @@ target_link_libraries(${GOLDENDICT} PRIVATE ${THIRD_PARTY_LIBARY})
# Copy .dlls to output dir
file(GLOB DLL_FILES LIST_DIRECTORIES false "${CMAKE_SOURCE_DIR}/winlibs/lib/msvc/*.dll")
file(GLOB DLL_FILES LIST_DIRECTORIES false "${CMAKE_SOURCE_DIR}/winlibs/lib/msvc/*.dll" "${Qt6_ROOT}/bin/av*.dll" "${Qt6_ROOT}/bin/sw*.dll")
foreach (A_DLL_FILE ${DLL_FILES})
get_filename_component(TEMP_VAR_HOLDING_DLL_FILENAME ${A_DLL_FILE} NAME)
configure_file("${A_DLL_FILE}" "${GD_WIN_OUTPUT_DIR}/${TEMP_VAR_HOLDING_DLL_FILENAME}" COPYONLY)

View file

@ -1,6 +1,6 @@
TEMPLATE = app
TARGET = goldendict
VERSION = 24.01.22
VERSION = 24.05.05
# 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
@ -133,7 +133,7 @@ win32 {
win32-msvc* {
# VS does not recognize 22.number.alpha,cause errors during compilation under MSVC++
VERSION = 24.01.22
VERSION = 25.05.05
DEFINES += __WIN32 _CRT_SECURE_NO_WARNINGS
contains(QMAKE_TARGET.arch, x86_64) {
DEFINES += NOMINMAX __WIN64
@ -290,7 +290,6 @@ HEADERS += \
src/audioplayerinterface.hh \
src/btreeidx.hh \
src/chunkedstorage.hh \
src/common/atomic_rename.hh \
src/common/base_type.hh \
src/common/ex.hh \
src/common/file.hh \
@ -419,7 +418,6 @@ SOURCES += \
src/audioplayerfactory.cc \
src/btreeidx.cc \
src/chunkedstorage.cc \
src/common/atomic_rename.cc \
src/common/file.cc \
src/common/filetype.cc \
src/common/folding.cc \
@ -533,9 +531,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

@ -2754,6 +2754,10 @@ To find &apos;*&apos;, &apos;?&apos;, &apos;[&apos;, &apos;]&apos; symbols use &
<source>Icon</source>
<translation>الرّمز</translation>
</message>
<message>
<source>Language Variant</source>
<translation type="unfinished">Language Variant</translation>
</message>
</context>
<context>
<name>MultimediaAudioPlayer</name>

View file

@ -2823,6 +2823,10 @@ Añadir la pestaña actual a favoritos</translation>
<source>Icon</source>
<translation>Salta</translation>
</message>
<message>
<source>Language Variant</source>
<translation>Aru mayjtayaña</translation>
</message>
</context>
<context>
<name>MultimediaAudioPlayer</name>

View file

@ -2755,6 +2755,10 @@ To find &apos;*&apos;, &apos;?&apos;, &apos;[&apos;, &apos;]&apos; symbols use &
<source>Icon</source>
<translation>Значок</translation>
</message>
<message>
<source>Language Variant</source>
<translation>Варыянт мовы</translation>
</message>
</context>
<context>
<name>MultimediaAudioPlayer</name>

View file

@ -2756,6 +2756,10 @@ To find &apos;*&apos;, &apos;?&apos;, &apos;[&apos;, &apos;]&apos; symbols use &
<source>Icon</source>
<translation>Иконка</translation>
</message>
<message>
<source>Language Variant</source>
<translation>Езиков вариант</translation>
</message>
</context>
<context>
<name>MultimediaAudioPlayer</name>

View file

@ -2755,6 +2755,10 @@ To find &apos;*&apos;, &apos;?&apos;, &apos;[&apos;, &apos;]&apos; symbols use &
<source>Icon</source>
<translation></translation>
</message>
<message>
<source>Language Variant</source>
<translation></translation>
</message>
</context>
<context>
<name>MultimediaAudioPlayer</name>

View file

@ -2756,6 +2756,10 @@ Pro zjištění &apos;*&apos;, &apos;?&apos;, &apos;[&apos;, &apos;]&apos; symbo
<source>Icon</source>
<translation>Ikona</translation>
</message>
<message>
<source>Language Variant</source>
<translation>Jazyková varianta</translation>
</message>
</context>
<context>
<name>MultimediaAudioPlayer</name>

View file

@ -91,7 +91,7 @@
</message>
<message>
<source>&lt;h3 align=&quot;center&quot;&gt;Welcome to &lt;b&gt;GoldenDict&lt;/b&gt;!&lt;/h3&gt;&lt;p&gt;To start working with the program, first visit &lt;em&gt;Edit | Dictionaries&lt;/em&gt; to add some directory paths where to search for the dictionary files, set up various Wikipedia sites or other sources, adjust dictionary order or create dictionary groups.&lt;p&gt;And then you&apos;re ready to look up your words! You can do that in this window by using a pane to the left, or you can &lt;a href=&quot;https://xiaoyifang.github.io/goldendict-ng/ui_popup/&quot;&gt;look up words from other active applications&lt;/a&gt;. &lt;p&gt;To customize program, check out the available preferences at &lt;em&gt;Edit | Preferences&lt;/em&gt;. All settings there have tooltips, be sure to read them if you are in doubt about anything.&lt;p&gt;Should you need further help, have any questions, suggestions or just wonder what the others think, you are welcome at the program&apos;s &lt;a href=&quot;https://github.com/xiaoyifang/goldendict/discussions&quot;&gt;forum&lt;/a&gt;.&lt;p&gt;Check program&apos;s &lt;a href=&quot;https://github.com/xiaoyifang/goldendict&quot;&gt;website&lt;/a&gt; for the updates. &lt;p&gt;(c) 2008-2013 Konstantin Isakov. Licensed under GPLv3 or later.</source>
<translation type="unfinished">&lt;h3 align=&quot;center&quot;&gt;Welcome to &lt;b&gt;GoldenDict&lt;/b&gt;!&lt;/h3&gt;&lt;p&gt;To start working with the program, first visit &lt;em&gt;Edit | Dictionaries&lt;/em&gt; to add some directory paths where to search for the dictionary files, set up various Wikipedia sites or other sources, adjust dictionary order or create dictionary groups.&lt;p&gt;And then you&apos;re ready to look up your words! You can do that in this window by using a pane to the left, or you can &lt;a href=&quot;https://xiaoyifang.github.io/goldendict-ng/ui_popup/&quot;&gt;look up words from other active applications&lt;/a&gt;. &lt;p&gt;To customize program, check out the available preferences at &lt;em&gt;Edit | Preferences&lt;/em&gt;. All settings there have tooltips, be sure to read them if you are in doubt about anything.&lt;p&gt;Should you need further help, have any questions, suggestions or just wonder what the others think, you are welcome at the program&apos;s &lt;a href=&quot;https://github.com/xiaoyifang/goldendict/discussions&quot;&gt;forum&lt;/a&gt;.&lt;p&gt;Check program&apos;s &lt;a href=&quot;https://github.com/xiaoyifang/goldendict&quot;&gt;website&lt;/a&gt; for the updates. &lt;p&gt;(c) 2008-2013 Konstantin Isakov. Licensed under GPLv3 or later.</translation>
<translation>&lt;h3 align=&quot;center&quot;&gt;Willkommen bei &lt;b&gt;GoldenDict&lt;/b&gt;!&lt;/h3&gt;&lt;p&gt;Um mit der Arbeit mit dem Programm zu beginnen, besuchen Sie zunächst &lt;em&gt;Bearbeiten | Wörterbücher&lt;/em&gt;, um einige Verzeichnispfade hinzuzufügen, in denen Sie nach Wörterbuchdateien suchen, verschiedene Wikipedia-Sites oder andere Quellen einrichten, die Wörterbuchreihenfolge anpassen oder Wörterbuchgruppen erstellen können.&lt;p&gt;Und dann sind Sie bereit, Ihre Wörter nachzuschlagen! Sie können dies in diesem Fenster tun, indem Sie einen Bereich auf der linken Seite verwenden, oder Sie können &lt;a href=&quot;https://xiaoyifang.github.io/goldendict-ng/ui_popup/&quot;&gt;Wörter aus anderen aktiven Anwendungen nachschlagen&lt;/a&gt;. &lt;p&gt;Um das Programm anzupassen, sehen Sie sich die verfügbaren Einstellungen unter &lt;em&gt;Bearbeiten | an Einstellungen&lt;/em&gt;. Alle Einstellungen dort verfügen über Tooltips. Lesen Sie diese unbedingt durch, wenn Sie Zweifel haben.&lt;p&gt;Sollten Sie weitere Hilfe benötigen, Fragen oder Vorschläge haben oder sich einfach nur fragen, was die anderen denken, sind Sie im Programm willkommen &lt;a href=&quot;https://github.com/xiaoyifang/goldendict/discussions&quot;&gt;Forum&lt;/a&gt;.&lt;p&gt;Suchen Sie auf der &lt;a href=&quot;https://github.com/xiaoyifang/goldendict&quot;&gt;Website&lt;/a&gt; des Programms nach Aktualisierungen. &lt;p&gt;(c) 2008-2013 Konstantin Isakov. Lizenziert unter GPLv3 oder höher.</translation>
</message>
</context>
<context>
@ -274,7 +274,7 @@
</message>
<message>
<source>Sound files (*.wav *.opus *.ogg *.oga *.mp3 *.mp4 *.aac *.flac *.mid *.wv *.ape *.spx);;All files (*.*)</source>
<translation>Audio Dateien (*.wav *.ogg *.oga *.mp3 *.mp4 *.aac *.flac *.mid *.wv *.ape);;All files (*.*)</translation>
<translation>Audio Dateien (*.wav *.opus *.ogg *.oga *.mp3 *.mp4 *.aac *.flac *.mid *.wv *.ape *.spx);;Alle Dateien (*.*)</translation>
</message>
<message>
<source>Failed to play sound file: %1</source>
@ -2753,6 +2753,10 @@ Um folgende Symbole zu finden &apos;*&apos;, &apos;?&apos;, &apos;[&apos;, &apos
<source>Icon</source>
<translation>Symbol</translation>
</message>
<message>
<source>Language Variant</source>
<translation type="unfinished">Language Variant</translation>
</message>
</context>
<context>
<name>MultimediaAudioPlayer</name>
@ -3528,7 +3532,7 @@ Stardict, Babylon und GLS Wörterbüchern wünschen.</translation>
</message>
<message>
<source>Lingoes</source>
<translation>Lingos</translation>
<translation>Lingoes</translation>
</message>
<message>
<source>Lingoes-Blue</source>
@ -3736,11 +3740,11 @@ Stardict, Babylon und GLS Wörterbüchern wünschen.</translation>
</message>
<message>
<source>Change the group of popup.</source>
<translation>Wechsle Gruppen im Popup.</translation>
<translation>Wechsle Gruppen im PopUp.</translation>
</message>
<message>
<source>Toggle scan popup.</source>
<translation>Wechsle Scan Popup.</translation>
<translation>Wechsle ScanPopUp.</translation>
</message>
<message>
<source>Print version and diagnosis info.</source>
@ -3968,7 +3972,7 @@ Standardisiert als ISO 3602.
</message>
<message>
<source>Any external programs. A string %GDWORD% will be replaced with the query word. A string %GDSEARCH% will be replaced with the text in the search bar. If both of the parameters are not provided, the headword will be fed into standard input.</source>
<translation>Für externe Programme. Der String %GDWORD% wird mit dem Suchwort ersetzt. Falls eine solche Zeichenkette nicht vorhanden ist, wird das Wort an die Standardeingabe geschickt..</translation>
<translation>Für externe Programme. Der String %GDWORD% wird mit dem Suchwort ersetzt. Der String %GDSEARCH% wird mit dem Text im Suchfeld ersetzt. Falls keine der beiden Zeichenketten vorhanden sind, wird das Hauptwort an die Standardeingabe geschickt.</translation>
</message>
<message>
<source>Lingua Libre</source>
@ -4260,7 +4264,7 @@ Fügen Sie entsprechende Wörterbücher am besten am Ende der passenden Gruppe e
</message>
<message>
<source>Rate:</source>
<translation>Preis:</translation>
<translation>Tempo:</translation>
</message>
</context>
<context>

View file

@ -2755,6 +2755,10 @@ Um &apos;*&apos;, &apos;zu finden?&apos;, &apos;[&apos;, &apos;]&apos; Symbole v
<source>Icon</source>
<translation>Symbol</translation>
</message>
<message>
<source>Language Variant</source>
<translation>Sprachvariante</translation>
</message>
</context>
<context>
<name>MultimediaAudioPlayer</name>

View file

@ -2757,6 +2757,10 @@ To find &apos;*&apos;, &apos;?&apos;, &apos;[&apos;, &apos;]&apos; symbols use &
<source>Icon</source>
<translation>Εικονίδιο</translation>
</message>
<message>
<source>Language Variant</source>
<translation>Παραλλαγή γλώσσας</translation>
</message>
</context>
<context>
<name>MultimediaAudioPlayer</name>

View file

@ -2756,6 +2756,10 @@ Por trovi &apos;*&apos;, &apos;?&apos;, &apos;[&apos;, &apos;]&apos; simboloj uz
<source>Icon</source>
<translation>Bildsimbolo</translation>
</message>
<message>
<source>Language Variant</source>
<translation>Lingva Variaĵo</translation>
</message>
</context>
<context>
<name>MultimediaAudioPlayer</name>

View file

@ -2756,6 +2756,10 @@ To find &apos;*&apos;, &apos;?&apos;, &apos;[&apos;, &apos;]&apos; symbols use &
<source>Icon</source>
<translation>Ícono</translation>
</message>
<message>
<source>Language Variant</source>
<translation type="unfinished">Language Variant</translation>
</message>
</context>
<context>
<name>MultimediaAudioPlayer</name>

View file

@ -2756,6 +2756,10 @@ To find &apos;*&apos;, &apos;?&apos;, &apos;[&apos;, &apos;]&apos; symbols use &
<source>Icon</source>
<translation type="unfinished">Icon</translation>
</message>
<message>
<source>Language Variant</source>
<translation type="unfinished">Language Variant</translation>
</message>
</context>
<context>
<name>MultimediaAudioPlayer</name>

View file

@ -91,7 +91,7 @@
</message>
<message>
<source>&lt;h3 align=&quot;center&quot;&gt;Welcome to &lt;b&gt;GoldenDict&lt;/b&gt;!&lt;/h3&gt;&lt;p&gt;To start working with the program, first visit &lt;em&gt;Edit | Dictionaries&lt;/em&gt; to add some directory paths where to search for the dictionary files, set up various Wikipedia sites or other sources, adjust dictionary order or create dictionary groups.&lt;p&gt;And then you&apos;re ready to look up your words! You can do that in this window by using a pane to the left, or you can &lt;a href=&quot;https://xiaoyifang.github.io/goldendict-ng/ui_popup/&quot;&gt;look up words from other active applications&lt;/a&gt;. &lt;p&gt;To customize program, check out the available preferences at &lt;em&gt;Edit | Preferences&lt;/em&gt;. All settings there have tooltips, be sure to read them if you are in doubt about anything.&lt;p&gt;Should you need further help, have any questions, suggestions or just wonder what the others think, you are welcome at the program&apos;s &lt;a href=&quot;https://github.com/xiaoyifang/goldendict/discussions&quot;&gt;forum&lt;/a&gt;.&lt;p&gt;Check program&apos;s &lt;a href=&quot;https://github.com/xiaoyifang/goldendict&quot;&gt;website&lt;/a&gt; for the updates. &lt;p&gt;(c) 2008-2013 Konstantin Isakov. Licensed under GPLv3 or later.</source>
<translation>&lt;h3 align=&quot;center&quot;&gt;¡Bienvenido a &lt;b&gt;GoldenDict&lt;/b&gt;!&lt;/h3&gt;&lt;p&gt;Para comenzar a trabajar con el programa, primero visite &lt;em&gt;Editar | Diccionarios&lt;/em&gt; para agregar algunas rutas de directorio donde buscar archivos de diccionario, configurar varios sitios de Wikipedia u otras fuentes, ajustar el orden del diccionario o crear grupos de diccionario.&lt;p&gt;Y entonces estarás&apos;listo para buscar tus palabras! Puede hacerlo en esta ventana usando un panel a la izquierda, o puede &lt;a href=&quot;https://xiaoyifang.github.io/goldendict-ng/ui_popup/&quot;&gt;buscar palabras de otras aplicaciones activas&lt;/a&gt;. &lt;p&gt;Para personalizar el programa, consulte las preferencias disponibles en &lt;em&gt;Editar | Preferencias&lt;/em&gt;. Todas las configuraciones tienen información sobre herramientas, asegúrese de leerlas si tiene dudas sobre algo.&lt;p&gt;Si necesita más ayuda, tiene alguna pregunta, sugerencia o simplemente se pregunta qué piensan los demás, es bienvenido al programa&apos;s &lt;a href=&quot;https://github.com/xiaoyifang/goldendict/discussions&quot;&gt;foro&lt;/a&gt;.&lt;p&gt;Consulte el programa&apos;s &lt;a href=&quot;https://github.com/xiaoyifang/goldendict&quot;&gt;sitio web&lt;/a&gt; para ver las actualizaciones. &lt;p&gt;(c) 2008-2013 Konstantin Isakov. Licenciado bajo GPLv3 o posterior.</translation>
<translation>&lt;h3 align=&quot;center&quot;&gt;¡Bienvenido a &lt;b&gt;GoldenDict&lt;/b&gt;!&lt;/h3&gt;&lt;p&gt;Para comenzar a trabajar con el programa, primero visite &lt;em&gt;Editar | Diccionarios&lt;/em&gt; para agregar algunas rutas de directorio donde buscar archivos de diccionario, configurar varios sitios de Wikipedia u otras fuentes, ajustar el orden de los diccionarios o crear grupos de diccionarios.&lt;p&gt;¡Entonces estará&apos;listo para buscar palabras! Puede hacerlo en esta ventana usando un panel a la izquierda, o puede &lt;a href=&quot;https://xiaoyifang.github.io/goldendict-ng/ui_popup/&quot;&gt;buscar palabras en otras aplicaciones activas&lt;/a&gt;. &lt;p&gt;Para personalizar el programa, consulte las preferencias disponibles en &lt;em&gt;Editar | Preferencias&lt;/em&gt;. Todas las configuraciones tienen descripciones, asegúrese de leerlas si tiene dudas sobre algo.&lt;p&gt;Si necesita más ayuda, tiene alguna pregunta, sugerencia o simplemente se pregunta qué piensan los demás, puede visitar el &lt;a href=&quot;https://github.com/xiaoyifang/goldendict/discussions&quot;&gt;foro&lt;/a&gt; del programa.&lt;p&gt;Consulte el &lt;a href=&quot;https://github.com/xiaoyifang/goldendict&quot;&gt;sitio web&lt;/a&gt; del programa para ver las actualizaciones disponibles. &lt;p&gt;(c) 2008-2013 Konstantin Isakov. Licenciado bajo GPLv3 o posterior.</translation>
</message>
</context>
<context>
@ -1177,7 +1177,7 @@ entre ortografía clásica y escolar en cirílico)</translation>
</message>
<message>
<source>Indexing...</source>
<translation>Indexación...</translation>
<translation>Indexando...</translation>
</message>
<message>
<source>Loading...</source>
@ -2099,7 +2099,7 @@ entre ortografía clásica y escolar en cirílico)</translation>
</message>
<message>
<source>Portuguese, Brazilian</source>
<translation>Portugués de Brasil</translation>
<translation>Portugués brasileño</translation>
</message>
<message>
<source>Persian</source>
@ -2756,6 +2756,10 @@ Para encontrar &apos;*&apos;, &apos;?&apos;, &apos;[&apos;, &apos;]&apos; símbo
<source>Icon</source>
<translation>Icono</translation>
</message>
<message>
<source>Language Variant</source>
<translation>Variante de idioma</translation>
</message>
</context>
<context>
<name>MultimediaAudioPlayer</name>
@ -3375,7 +3379,7 @@ borra su caché de red del disco durante la salida.</translation>
</message>
<message>
<source>Don&apos;t search in dictionaries containing more than</source>
<translation>No busque en diccionarios que contengan más de</translation>
<translation>No buscar en diccionarios que contengan más de</translation>
</message>
<message>
<source>articles (0 - unlimited)</source>
@ -3603,15 +3607,15 @@ de diccionarios Stardict, Babylon y GLS</translation>
</message>
<message>
<source>When using clipboard, strip everything after newline</source>
<translation>Al usar el portapapeles, elimine todo después de la nueva línea</translation>
<translation>Al usar el portapapeles, eliminar todo después de una nueva línea</translation>
</message>
<message>
<source>Remove invalid index on exit</source>
<translation>Eliminar índice no válido al salir</translation>
<translation>Eliminar índices no válidos al salir</translation>
</message>
<message>
<source>Miscellaneous</source>
<translation>Misceláneas</translation>
<translation>Misceláneo</translation>
</message>
<message>
<source>Interface Font</source>
@ -3739,7 +3743,7 @@ de diccionarios Stardict, Babylon y GLS</translation>
</message>
<message>
<source>Disable tts.</source>
<translation>Deshabilitar tts.</translation>
<translation>Deshabilitar el texto-a-voz.</translation>
</message>
<message>
<source>Change the group of main window.</source>
@ -3755,11 +3759,11 @@ de diccionarios Stardict, Babylon y GLS</translation>
</message>
<message>
<source>Print version and diagnosis info.</source>
<translation>Versión impresa e información de diagnóstico.</translation>
<translation>Imprimir versión e información de diagnóstico.</translation>
</message>
<message>
<source>Force the word to be translated in scanpopup</source>
<translation>Forzar la traducción de la palabra en scanpopup</translation>
<translation>Forzar la traducción de la palabra en el popup de escaneado</translation>
</message>
<message>
<source>Force the word to be translated in the mainwindow</source>
@ -4017,11 +4021,11 @@ basado en la fonología del inglés</translation>
</message>
<message>
<source>This only applied in search phrase, with each line represent a transliteration,semicolon seperated. For example, ae;æ,users can input ae to represent æ in the target word.</source>
<translation>Esto solo se aplica en la frase de búsqueda, con cada línea representando una transliteración, separada por punto y coma. Por ejemplo, ae;æ,los usuarios pueden ingresar ae para representar æ en la palabra objetivo.</translation>
<translation>Esto solo se aplica en la frase de búsqueda, con cada línea representando una transliteración, separada por punto y coma. Por ejemplo, ae;æ,los usuarios pueden escribir ae para representar æ en la palabra objetivo.</translation>
</message>
<message>
<source>ae;æ #this is an example</source>
<translation>ae;æ #este es un ejemplo</translation>
<translation>ae;æ #esto es un ejemplo</translation>
</message>
<message>
<source>Transliteration</source>

View file

@ -2755,6 +2755,10 @@ To find &apos;*&apos;, &apos;?&apos;, &apos;[&apos;, &apos;]&apos; symbols use &
<source>Icon</source>
<translation>نشانه</translation>
</message>
<message>
<source>Language Variant</source>
<translation>نوع زبان</translation>
</message>
</context>
<context>
<name>MultimediaAudioPlayer</name>

View file

@ -2756,6 +2756,10 @@ Löytääksesi &apos;*&apos;, &apos;?&apos;, &apos;[&apos;, &apos;]&apos; tunnus
<source>Icon</source>
<translation>Ikoni</translation>
</message>
<message>
<source>Language Variant</source>
<translation>Kielivariantti</translation>
</message>
</context>
<context>
<name>MultimediaAudioPlayer</name>

View file

@ -2755,6 +2755,10 @@ Pour rechercher les symboles &apos;*&apos;, &apos;?&apos;, &apos;[&apos;, &apos;
<source>Icon</source>
<translation>Icône</translation>
</message>
<message>
<source>Language Variant</source>
<translation>Variante de langue</translation>
</message>
</context>
<context>
<name>MultimediaAudioPlayer</name>

View file

@ -2755,6 +2755,10 @@ Pour rechercher les symboles &apos;*&apos;, &apos;?&apos;, &apos;[&apos;, &apos;
<source>Icon</source>
<translation>ि</translation>
</message>
<message>
<source>Language Variant</source>
<translation> </translation>
</message>
</context>
<context>
<name>MultimediaAudioPlayer</name>

View file

@ -2756,6 +2756,10 @@ To find &apos;*&apos;, &apos;?&apos;, &apos;[&apos;, &apos;]&apos; symbols use &
<source>Icon</source>
<translation>Icone</translation>
</message>
<message>
<source>Language Variant</source>
<translation type="unfinished">Language Variant</translation>
</message>
</context>
<context>
<name>MultimediaAudioPlayer</name>

View file

@ -2757,6 +2757,10 @@ Per utilizzare nelle ricerche i caratteri &apos;*&apos;, &apos;?&apos;, &apos;[&
<source>Icon</source>
<translation>Icona</translation>
</message>
<message>
<source>Language Variant</source>
<translation>Variante linguistica</translation>
</message>
</context>
<context>
<name>MultimediaAudioPlayer</name>

View file

@ -2756,6 +2756,10 @@ To find &apos;*&apos;, &apos;?&apos;, &apos;[&apos;, &apos;]&apos; symbols use &
<source>Icon</source>
<translation></translation>
</message>
<message>
<source>Language Variant</source>
<translation></translation>
</message>
</context>
<context>
<name>MultimediaAudioPlayer</name>

View file

@ -2756,6 +2756,10 @@ To find &apos;*&apos;, &apos;?&apos;, &apos;[&apos;, &apos;]&apos; symbols use &
<source>Icon</source>
<translation>pixra</translation>
</message>
<message>
<source>Language Variant</source>
<translation type="unfinished">Language Variant</translation>
</message>
</context>
<context>
<name>MultimediaAudioPlayer</name>

View file

@ -2756,6 +2756,10 @@ To find &apos;*&apos;, &apos;?&apos;, &apos;[&apos;, &apos;]&apos; symbols use &
<source>Icon</source>
<translation></translation>
</message>
<message>
<source>Language Variant</source>
<translation> </translation>
</message>
</context>
<context>
<name>MultimediaAudioPlayer</name>

View file

@ -2756,6 +2756,10 @@ Norėdami rasti „*“, „?“, „[“, „]“ simbolius, atitinkamai įvesk
<source>Icon</source>
<translation>Ženkliukas</translation>
</message>
<message>
<source>Language Variant</source>
<translation>Kalbos variantas</translation>
</message>
</context>
<context>
<name>MultimediaAudioPlayer</name>

View file

@ -2757,6 +2757,10 @@ To find &apos;*&apos;, &apos;?&apos;, &apos;[&apos;, &apos;]&apos; symbols use &
<source>Icon</source>
<translation>Икона</translation>
</message>
<message>
<source>Language Variant</source>
<translation>Јазична варијанта</translation>
</message>
</context>
<context>
<name>MultimediaAudioPlayer</name>

View file

@ -2756,6 +2756,10 @@ Om &apos;*&apos;te vinden, &apos;?&apos;, &apos;[&apos;, &apos;]&apos; symbolen
<source>Icon</source>
<translation>Pictogram</translation>
</message>
<message>
<source>Language Variant</source>
<translation>Taalvariant</translation>
</message>
</context>
<context>
<name>MultimediaAudioPlayer</name>

View file

@ -2756,6 +2756,10 @@ Aby odnaleźć symbole „*”, „?”, „[” i „]”, należy użyć odpow
<source>Icon</source>
<translation>Ikona</translation>
</message>
<message>
<source>Language Variant</source>
<translation>Wariant językowy</translation>
</message>
</context>
<context>
<name>MultimediaAudioPlayer</name>

View file

@ -2756,6 +2756,10 @@ Para encontrar os símbolos &apos;*&apos;, &apos;?&apos;, &apos;[&apos;, &apos;]
<source>Icon</source>
<translation>Ícone</translation>
</message>
<message>
<source>Language Variant</source>
<translation>Variante de idioma</translation>
</message>
</context>
<context>
<name>MultimediaAudioPlayer</name>

View file

@ -2756,6 +2756,10 @@ Para encontrar &apos;*&apos;, &apos;?&apos;, &apos;[&apos;, &apos;]&apos; símbo
<source>Icon</source>
<translation>Ícone</translation>
</message>
<message>
<source>Language Variant</source>
<translation>Variante de idioma</translation>
</message>
</context>
<context>
<name>MultimediaAudioPlayer</name>

View file

@ -2756,6 +2756,10 @@ To find &apos;*&apos;, &apos;?&apos;, &apos;[&apos;, &apos;]&apos; symbols use &
<source>Icon</source>
<translation>Icon</translation>
</message>
<message>
<source>Language Variant</source>
<translation>Lengua Variante</translation>
</message>
</context>
<context>
<name>MultimediaAudioPlayer</name>

View file

@ -91,7 +91,7 @@
</message>
<message>
<source>&lt;h3 align=&quot;center&quot;&gt;Welcome to &lt;b&gt;GoldenDict&lt;/b&gt;!&lt;/h3&gt;&lt;p&gt;To start working with the program, first visit &lt;em&gt;Edit | Dictionaries&lt;/em&gt; to add some directory paths where to search for the dictionary files, set up various Wikipedia sites or other sources, adjust dictionary order or create dictionary groups.&lt;p&gt;And then you&apos;re ready to look up your words! You can do that in this window by using a pane to the left, or you can &lt;a href=&quot;https://xiaoyifang.github.io/goldendict-ng/ui_popup/&quot;&gt;look up words from other active applications&lt;/a&gt;. &lt;p&gt;To customize program, check out the available preferences at &lt;em&gt;Edit | Preferences&lt;/em&gt;. All settings there have tooltips, be sure to read them if you are in doubt about anything.&lt;p&gt;Should you need further help, have any questions, suggestions or just wonder what the others think, you are welcome at the program&apos;s &lt;a href=&quot;https://github.com/xiaoyifang/goldendict/discussions&quot;&gt;forum&lt;/a&gt;.&lt;p&gt;Check program&apos;s &lt;a href=&quot;https://github.com/xiaoyifang/goldendict&quot;&gt;website&lt;/a&gt; for the updates. &lt;p&gt;(c) 2008-2013 Konstantin Isakov. Licensed under GPLv3 or later.</source>
<translation>&lt;h3 align=&quot;center&quot;&gt;Добро пожаловать в &lt;b&gt;GoldenDict&lt;/b&gt;!&lt;/h3&gt;&lt;p&gt;Чтобы начать работу с программой, сначала зайдите на сайт &lt;em&gt;Редактировать | Словари&lt;/em&gt; , чтобы добавить пути к каталогам для поиска файлов словарей, настроить различные сайты Википедии или другие источники, настроить порядок словарей или создать группы словарей.&lt;p&gt;И тогда вы&apos;готовы искать свои слова! Вы можете сделать это в этом окне, используя панель слева, или вы можете &lt;a href=&quot;https://xiaoyifang.github.io/goldendict-ng/ui_popup/&quot;&gt;искать слова из других активных приложений&lt;/a&gt;. &lt;p&gt;Чтобы настроить программу, проверьте доступные настройки на &lt;em&gt;Редактировать | Предпочтения&lt;/em&gt;. Все настройки там имеют подсказки, обязательно прочтите их, если у вас есть в чем-то сомнения.&lt;p&gt;Если вам нужна дополнительная помощь, у вас есть какие-либо вопросы, предложения или просто интересно, что думают другие, добро пожаловать на форум программы&apos;s &lt;a href=&quot;https://github.com/xiaoyifang/goldendict/discussions&quot;&gt;&lt;/a&gt;.&lt;p&gt;Проверьте наличие обновлений на веб-сайте программы&apos;s &lt;a href=&quot;https://github.com/xiaoyifang/goldendict&quot;&gt;&lt;/a&gt; . &lt;p&gt;(c) 2008-2013 Константин Исаков. Лицензия GPLv3 или более поздняя.</translation>
<translation>&lt;h3 align=&quot;center&quot;&gt;Добро пожаловать в &lt;b&gt;GoldenDict&lt;/b&gt;!&lt;/h3&gt;&lt;p&gt;Чтобы начать работу с программой, сначала откройте меню &lt;em&gt;Правка | Словари&lt;/em&gt;, чтобы добавить пути к каталогам со словарями, к Википедии и другим сайтам, упорядочить и сгруппировать словари.&lt;p&gt;И тогда вы сможете искать слова! Это можно делать непосредственно в этом окне, используя панель поиска слева, или &lt;a href=&quot;https://xiaoyifang.github.io/goldendict-ng/ui_popup/&quot;&gt;отправляя слова из других программ&lt;/a&gt;. &lt;p&gt;Чтобы настроить GoldenDict, перейдите в настройки на &lt;em&gt;Правка | Настройки&lt;/em&gt;. Все опции имеют подсказки: обязательно прочтите их, если у вас есть сомнения.&lt;p&gt;Если вам нужна помощь, или у вас есть какие-либо вопросы, предложения или просто интересно, что думают другие, заходите на форум GoldenDict&apos;s &lt;a href=&quot;https://github.com/xiaoyifang/goldendict/discussions&quot;&gt;&lt;/a&gt;.&lt;p&gt; Проверить обновления можно на сайте &lt;a href=&quot;https://github.com/xiaoyifang/goldendict&quot;&gt;&lt;/a&gt; . &lt;p&gt;(c) 2008-2013 Константин Исаков. Лицензия GPLv3 или более поздняя.</translation>
</message>
</context>
<context>
@ -2758,6 +2758,10 @@ To find &apos;*&apos;, &apos;?&apos;, &apos;[&apos;, &apos;]&apos; symbols use &
<source>Icon</source>
<translation>Значок</translation>
</message>
<message>
<source>Language Variant</source>
<translation>Языковой вариант</translation>
</message>
</context>
<context>
<name>MultimediaAudioPlayer</name>

View file

@ -2757,6 +2757,10 @@ Pre vyhľadanie znakov &apos;*&apos;, &apos;?&apos;, &apos;[&apos;, &apos;]&apos
<source>Icon</source>
<translation>Ikona</translation>
</message>
<message>
<source>Language Variant</source>
<translation>Jazykový variant</translation>
</message>
</context>
<context>
<name>MultimediaAudioPlayer</name>

View file

@ -2755,6 +2755,10 @@ Për të gjetur &apos;*&apos;, &apos;?&apos;, &apos;[&apos;, &apos;]&apos; simbo
<source>Icon</source>
<translation>Ikona</translation>
</message>
<message>
<source>Language Variant</source>
<translation>Varianti i gjuhës</translation>
</message>
</context>
<context>
<name>MultimediaAudioPlayer</name>

View file

@ -2757,6 +2757,10 @@ To find &apos;*&apos;, &apos;?&apos;, &apos;[&apos;, &apos;]&apos; symbols use &
<source>Icon</source>
<translation>Икона</translation>
</message>
<message>
<source>Language Variant</source>
<translation>Лангуаге Вариант</translation>
</message>
</context>
<context>
<name>MultimediaAudioPlayer</name>

View file

@ -2756,6 +2756,10 @@ För att hitta &apos;*&apos;, &apos;?&apos;, &apos;[&apos;, &apos;]&apos; symbol
<source>Icon</source>
<translation>Ikon</translation>
</message>
<message>
<source>Language Variant</source>
<translation>Språkvariant</translation>
</message>
</context>
<context>
<name>MultimediaAudioPlayer</name>

View file

@ -2756,6 +2756,10 @@ To find &apos;*&apos;, &apos;?&apos;, &apos;[&apos;, &apos;]&apos; symbols use &
<source>Icon</source>
<translation>Аломат</translation>
</message>
<message>
<source>Language Variant</source>
<translation>Варианти забон</translation>
</message>
</context>
<context>
<name>MultimediaAudioPlayer</name>

View file

@ -2755,6 +2755,10 @@ To find &apos;*&apos;, &apos;?&apos;, &apos;[&apos;, &apos;]&apos; symbols use &
<source>Icon</source>
<translation>Nyşan</translation>
</message>
<message>
<source>Language Variant</source>
<translation>Dil görnüşi</translation>
</message>
</context>
<context>
<name>MultimediaAudioPlayer</name>

View file

@ -2756,6 +2756,10 @@ To find &apos;*&apos;, &apos;?&apos;, &apos;[&apos;, &apos;]&apos; symbols use &
<source>Icon</source>
<translation>Simge</translation>
</message>
<message>
<source>Language Variant</source>
<translation>Dil Varyantı</translation>
</message>
</context>
<context>
<name>MultimediaAudioPlayer</name>

View file

@ -2757,6 +2757,10 @@ To find &apos;*&apos;, &apos;?&apos;, &apos;[&apos;, &apos;]&apos; symbols use &
<source>Icon</source>
<translation>Наличка</translation>
</message>
<message>
<source>Language Variant</source>
<translation>Варіант мови</translation>
</message>
</context>
<context>
<name>MultimediaAudioPlayer</name>

View file

@ -2755,6 +2755,10 @@ To find &apos;*&apos;, &apos;?&apos;, &apos;[&apos;, &apos;]&apos; symbols use &
<source>Icon</source>
<translation>Biểu tượng</translation>
</message>
<message>
<source>Language Variant</source>
<translation>Biến thể ngôn ngữ</translation>
</message>
</context>
<context>
<name>MultimediaAudioPlayer</name>

View file

@ -274,7 +274,7 @@
</message>
<message>
<source>Sound files (*.wav *.opus *.ogg *.oga *.mp3 *.mp4 *.aac *.flac *.mid *.wv *.ape *.spx);;All files (*.*)</source>
<translation> (*.wav *.opus *.ogg *.oga *.mp3 *.mp4 *.aac *.flac *.mid *.wv *.ape *.spx);; (*.*)</translation>
<translation> (*.wav *.opus *.ogg *.oga *.mp3 *.mp4 *.aac *.flac *.mid *.wv *.ape *.spx);; (*.*)</translation>
</message>
<message>
<source>Failed to play sound file: %1</source>
@ -286,7 +286,7 @@
</message>
<message>
<source>Open image in system viewer...</source>
<translation>...</translation>
<translation>...</translation>
</message>
</context>
<context>
@ -631,7 +631,7 @@ between classic and school orthography in cyrillic)</source>
</message>
<message>
<source>Full-text search enabled</source>
<translation></translation>
<translation></translation>
</message>
<message>
<source>Full-text search disabled</source>
@ -2755,6 +2755,10 @@ To find &apos;*&apos;, &apos;?&apos;, &apos;[&apos;, &apos;]&apos; symbols use &
<source>Icon</source>
<translation></translation>
</message>
<message>
<source>Language Variant</source>
<translation></translation>
</message>
</context>
<context>
<name>MultimediaAudioPlayer</name>
@ -3573,7 +3577,7 @@ from Stardict, Babylon and GLS dictionaries</source>
</message>
<message>
<source>These fonts will be applied when the fonts specified by a dictionary are not found.</source>
<translation></translation>
<translation></translation>
</message>
<message>
<source>Fallback Fonts</source>
@ -3589,7 +3593,7 @@ from Stardict, Babylon and GLS dictionaries</source>
</message>
<message>
<source>When using clipboard, strip everything after newline</source>
<translation>使</translation>
<translation></translation>
</message>
<message>
<source>Remove invalid index on exit</source>
@ -3745,7 +3749,7 @@ from Stardict, Babylon and GLS dictionaries</source>
</message>
<message>
<source>Force the word to be translated in scanpopup</source>
<translation> scanpopup </translation>
<translation></translation>
</message>
<message>
<source>Force the word to be translated in the mainwindow</source>
@ -4001,7 +4005,7 @@ based on English phonology</source>
</message>
<message>
<source>This only applied in search phrase, with each line represent a transliteration,semicolon seperated. For example, ae;æ,users can input ae to represent æ in the target word.</source>
<translation> ae;æ ae æ</translation>
<translation>使 ae;æ ae æ</translation>
</message>
<message>
<source>ae;æ #this is an example</source>

View file

@ -2758,6 +2758,10 @@ To find &apos;*&apos;, &apos;?&apos;, &apos;[&apos;, &apos;]&apos; symbols use &
<source>Icon</source>
<translation></translation>
</message>
<message>
<source>Language Variant</source>
<translation></translation>
</message>
</context>
<context>
<name>MultimediaAudioPlayer</name>

View file

@ -7,8 +7,9 @@ GenericName=Multiformat Dictionary
GenericName[zh_CN]=
Comment=A feature-rich dictionary lookup program
Comment[zh_CN]=
Keywords=dict;dictioanry;
Keywords[zh_CN]=dict;dictioanry;;
Keywords=dict;dictionary;
Keywords[zh_CN]=dict;dictionary;;
Icon=goldendict
Exec=goldendict %u
MimeType=x-scheme-handler/goldendict;x-scheme-handler/dict;
StartupWMClass=goldendict

View file

@ -5,6 +5,7 @@
<metadata_license>CC0-1.0</metadata_license>
<project_license>GPL-3.0-or-later</project_license>
<name>GoldenDict-ng</name>
<developer_name>The GoldenDict-ng Community</developer_name>
<summary>Advanced dictionary lookup program</summary>
<categories>
<category>Education</category>
@ -41,4 +42,8 @@
<provides>
<id>org.goldendict_ng.desktop</id>
</provides>
<releases>
<release version="24.05.05" date="2024-05-05" />
<release version="1.0.0" date="2010-12-03" />
</releases>
</component>

View file

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
<plist version="0.9">
<dict>
<key>CFBundleExecutable</key>
<string>@GOLDENDICT@</string>
<key>CFBundleIconFile</key>
<string>macicon.icns</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>@CMAKE_PROJECT_VERSION@</string>
<key>CFBundleIdentifier</key>
<string>org.xiaoyifang</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>

View file

@ -486,9 +486,6 @@ void ArticleRequest::altSearchFinished()
}
if ( altSearches.empty() ) {
#ifdef QT_DEBUG
qDebug( "alts finished" );
#endif
// They all've finished! Now we can look up bodies
@ -496,12 +493,6 @@ void ArticleRequest::altSearchFinished()
vector< wstring > altsVector( alts.begin(), alts.end() );
#ifdef QT_DEBUG
for ( const auto & x : altsVector ) {
qDebug() << "Alt:" << QString::fromStdU32String( x );
}
#endif
wstring wordStd = gd::toWString( word );
if ( activeDicts.size() <= 1 )

View file

@ -65,9 +65,9 @@ void AudioPlayerFactory::reset()
#endif
}
QScopedPointer< ExternalAudioPlayer > externalPlayer( new ExternalAudioPlayer );
std::unique_ptr< ExternalAudioPlayer > externalPlayer( new ExternalAudioPlayer );
setAudioPlaybackProgram( *externalPlayer );
playerPtr.reset( externalPlayer.take() );
playerPtr.reset( externalPlayer.release() );
}
void AudioPlayerFactory::setAudioPlaybackProgram( ExternalAudioPlayer & externalPlayer )

View file

@ -50,7 +50,7 @@ string const & BtreeDictionary::ensureInitDone()
return empty;
}
void BtreeIndex::openIndex( IndexInfo const & indexInfo, File::Class & file, QMutex & mutex )
void BtreeIndex::openIndex( IndexInfo const & indexInfo, File::Index & file, QMutex & mutex )
{
indexNodeSize = indexInfo.btreeMaxElements;
rootOffset = indexInfo.rootOffset;
@ -754,7 +754,7 @@ void BtreeIndex::antialias( wstring const & str, vector< WordArticleLink > & cha
/// leaf nodes.
static uint32_t buildBtreeNode( IndexedWords::const_iterator & nextIndex,
size_t indexSize,
File::Class & file,
File::Index & file,
size_t maxElements,
uint32_t & lastLeafLinkOffset )
{
@ -984,7 +984,7 @@ void IndexedWords::addSingleWord( wstring const & index_word, uint32_t articleOf
operator[]( Utf8::encode( folded ) ).emplace_back( Utf8::encode( word ), articleOffset );
}
IndexInfo buildIndex( IndexedWords const & indexedWords, File::Class & file )
IndexInfo buildIndex( IndexedWords const & indexedWords, File::Index & file )
{
size_t indexSize = indexedWords.size();
auto nextIndex = indexedWords.begin();

View file

@ -82,7 +82,7 @@ public:
/// Opens the index. The file reference is saved to be used for
/// subsequent lookups.
/// The mutex is the one to be locked when working with the file.
void openIndex( IndexInfo const &, File::Class &, QMutex & );
void openIndex( IndexInfo const &, File::Index &, QMutex & );
/// Finds articles that match the given string. A case-insensitive search
/// is performed.
@ -140,7 +140,7 @@ protected:
protected:
QMutex * idxFileMutex;
File::Class * idxFile;
File::Index * idxFile;
private:
@ -276,7 +276,7 @@ struct IndexedWords: public map< string, vector< WordArticleLink > >
/// Builds the index, as a compressed btree. Returns IndexInfo.
/// All the data is stored to the given file, beginning from its current
/// position.
IndexInfo buildIndex( IndexedWords const &, File::Class & file );
IndexInfo buildIndex( IndexedWords const &, File::Index & file );
} // namespace BtreeIndexing

View file

@ -14,7 +14,7 @@ enum {
ChunkMaxSize = 65536 // Can't be more since it would overflow the address
};
Writer::Writer( File::Class & f ):
Writer::Writer( File::Index & f ):
file( f ),
chunkStarted( false ),
bufferUsed( 0 )
@ -115,7 +115,7 @@ uint32_t Writer::finish()
return offset;
}
Reader::Reader( File::Class & f, uint32_t offset ):
Reader::Reader( File::Index & f, uint32_t offset ):
file( f )
{
file.seek( offset );

View file

@ -31,11 +31,11 @@ DEF_EX( mapFailed, "Failed to map/unmap the file", Ex )
class Writer
{
vector< uint32_t > offsets;
File::Class & file;
File::Index & file;
size_t scratchPadOffset, scratchPadSize;
public:
explicit Writer( File::Class & );
explicit Writer( File::Index & );
/// Starts new block. Returns its address.
uint32_t startNewBlock();
@ -72,12 +72,12 @@ private:
class Reader
{
vector< uint32_t > offsets;
File::Class & file;
File::Index & file;
public:
/// Creates reader by giving it a file to read from and the offset returned
/// by Writer::finish().
Reader( File::Class &, uint32_t );
Reader( File::Index &, uint32_t );
/// Reads the block previously written by Writer, identified by its address.
/// Uses the user-provided storage to load the entire chunk, and then to

View file

@ -1,42 +0,0 @@
/* This file is (c) 2008-2012 Konstantin Isakov <ikm@goldendict.org>
* Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */
#include "atomic_rename.hh"
#include <QtGlobal>
#include <QVector>
#include <string> // for wchar_t
#include <QFile>
#include <QDir>
#ifdef Q_OS_WIN32
#include <windows.h>
#endif
#include <stdio.h>
bool renameAtomically( QString const & oldName, QString const & newName )
{
#ifdef Q_OS_WIN32
QString srcFile( QDir::toNativeSeparators( oldName ) );
QVector< wchar_t > srcFileW( srcFile.size() + 1 );
srcFileW[ srcFile.toWCharArray( srcFileW.data() ) ] = 0;
QString destFile( QDir::toNativeSeparators( newName ) );
QVector< wchar_t > destFileW( destFile.size() + 1 );
destFileW[ destFile.toWCharArray( destFileW.data() ) ] = 0;
if ( !MoveFileExW( srcFileW.data(), destFileW.data(), MOVEFILE_REPLACE_EXISTING ) )
return false;
#else
if ( rename( QFile::encodeName( QDir::toNativeSeparators( oldName ) ).data(),
QFile::encodeName( QDir::toNativeSeparators( newName ) ).data() ) )
return false;
#endif
return true;
}

View file

@ -1,14 +0,0 @@
/* This file is (c) 2008-2012 Konstantin Isakov <ikm@goldendict.org>
* Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */
#ifndef __ATOMIC_RENAME_HH_INCLUDED__
#define __ATOMIC_RENAME_HH_INCLUDED__
#include <QString>
/// Performs an atomic rename of file, from oldBame to newName. If newName
/// exists, it gets overwritten. Names should feature Qt-style separators
/// (straight slashes). Returns true on success, false on failure.
bool renameAtomically( QString const & oldName, QString const & newName );
#endif

View file

@ -35,13 +35,13 @@ bool tryPossibleZipName( std::string const & name, std::string & copyTo )
void loadFromFile( std::string const & filename, std::vector< char > & data )
{
File::Class f( filename, "rb" );
File::Index f( filename, "rb" );
auto size = f.file().size(); // QFile::size() obtains size via statx on Linux
data.resize( size );
f.read( data.data(), size );
}
void Class::open( char const * mode )
void Index::open( char const * mode )
{
QFile::OpenMode openMode = QIODevice::Text;
@ -74,26 +74,26 @@ void Class::open( char const * mode )
throw exCantOpen( f.fileName().toStdString() + ": " + f.errorString().toUtf8().data() );
}
Class::Class( std::string_view filename, char const * mode )
Index::Index( std::string_view filename, char const * mode )
{
f.setFileName( QString::fromUtf8( filename.data(), filename.size() ) );
open( mode );
}
void Class::read( void * buf, qint64 size )
void Index::read( void * buf, qint64 size )
{
if ( f.read( static_cast< char * >( buf ), size ) != size ) {
throw exReadError();
}
}
size_t Class::readRecords( void * buf, qint64 size, qint64 count )
size_t Index::readRecords( void * buf, qint64 size, qint64 count )
{
qint64 result = f.read( static_cast< char * >( buf ), size * count );
return result < 0 ? result : result / size;
}
void Class::write( void const * buf, qint64 size )
void Index::write( void const * buf, qint64 size )
{
if ( 0 == size ) {
return;
@ -106,13 +106,13 @@ void Class::write( void const * buf, qint64 size )
f.write( static_cast< char const * >( buf ), size );
}
size_t Class::writeRecords( void const * buf, qint64 size, qint64 count )
size_t Index::writeRecords( void const * buf, qint64 size, qint64 count )
{
qint64 result = f.write( static_cast< const char * >( buf ), size * count );
return result < 0 ? result : result / size;
}
char * Class::gets( char * s, int size, bool stripNl )
char * Index::gets( char * s, int size, bool stripNl )
{
qint64 len = f.readLine( s, size );
char * result = len > 0 ? s : nullptr;
@ -134,7 +134,7 @@ char * Class::gets( char * s, int size, bool stripNl )
return result;
}
std::string Class::gets( bool stripNl )
std::string Index::gets( bool stripNl )
{
char buf[ 1024 ];
@ -144,61 +144,61 @@ std::string Class::gets( bool stripNl )
return { buf };
}
QByteArray Class::readall()
QByteArray Index::readall()
{
return f.readAll();
};
void Class::seek( qint64 offset )
void Index::seek( qint64 offset )
{
if ( !f.seek( offset ) )
throw exSeekError();
}
uchar * Class::map( qint64 offset, qint64 size )
uchar * Index::map( qint64 offset, qint64 size )
{
return f.map( offset, size );
}
bool Class::unmap( uchar * address )
bool Index::unmap( uchar * address )
{
return f.unmap( address );
}
void Class::seekEnd()
void Index::seekEnd()
{
if ( !f.seek( f.size() ) )
throw exSeekError();
}
void Class::rewind()
void Index::rewind()
{
seek( 0 );
}
qint64 Class::tell()
qint64 Index::tell()
{
return f.pos();
}
bool Class::eof() const
bool Index::eof() const
{
return f.atEnd();
}
QFile & Class::file()
QFile & Index::file()
{
return f;
}
void Class::close()
void Index::close()
{
f.close();
}
Class::~Class() noexcept
Index::~Index() noexcept
{
f.close();
}

View file

@ -13,12 +13,7 @@
#include <vector>
#include <QMutex>
/// A wrapper over QFile with some GD specific functions
/// and exception throwing which are required for older coded to work correctly
/// Consider the wrapped QFile as private implementation in the `Pimpl Idiom`
///
/// Note: this is used *only* in code related to `Dictionary::CLass` to manage dict files.
/// In other places, just use QFile directly.
/// File utilities
namespace File {
DEF_EX( Ex, "File exception", std::exception )
@ -40,7 +35,8 @@ inline bool exists( std::string_view filename ) noexcept
return QFileInfo::exists( QString::fromUtf8( filename.data(), filename.size() ) );
};
class Class
/// Exclusivly used for processing GD's index files
class Index
{
QFile f;
@ -48,7 +44,7 @@ public:
QMutex lock;
// Create QFile Object and open() it.
Class( std::string_view filename, char const * mode );
Index( std::string_view filename, char const * mode );
/// QFile::read & QFile::write , but with exception throwing
void read( void * buf, qint64 size );
@ -115,7 +111,7 @@ public:
/// Closes the file. No further operations are valid.
void close();
~Class() noexcept;
~Index() noexcept;
private:
// QFile::open but with fopen-like mode settings.

View file

@ -3,7 +3,7 @@
#include "config.hh"
#include "folding.hh"
#include <QDir>
#include <QSaveFile>
#include <QFile>
#include <QtXml>
#include <QApplication>
@ -17,8 +17,6 @@
#include <stdint.h>
#include "atomic_rename.hh"
#include <QStandardPaths>
#if defined( HAVE_X11 )
@ -354,6 +352,30 @@ MediaWikis makeDefaultMediaWikis( bool enable )
MediaWiki( "f3b4ec8531e52ddf5b10d21e4577a7a2", "Greek Wikipedia", "https://el.wikipedia.org/w", false, "" ) );
mw.push_back(
MediaWiki( "5d45232075d06e002dea72fe3e137da1", "Greek Wiktionary", "https://el.wiktionary.org/w", false, "" ) );
mw.push_back( MediaWiki( "c015d60c4949ad75b5b7069c2ff6dc2c",
"Traditional Chinese Wikipedia",
"https://zh.wikipedia.org/w",
false,
"",
"zh-hant" ) );
mw.push_back( MediaWiki( "d50828ad6e115bc9d3421b6821543108",
"Traditional Chinese Wiktionary",
"https://zh.wiktionary.org/w",
false,
"",
"zh-hant" ) );
mw.push_back( MediaWiki( "438b17b48cbda1a22d317fea37ec3110",
"Simplified Chinese Wikipedia",
"https://zh.wikipedia.org/w",
false,
"",
"zh-hans" ) );
mw.push_back( MediaWiki( "b68b9fb71b5a8c766cc7a5ea8237fc6b",
"Simplified Chinese Wiktionary",
"https://zh.wiktionary.org/w",
false,
"",
"zh-hans" ) );
return mw;
}
@ -608,6 +630,11 @@ Class load()
Path( nl.item( x ).toElement().text(), nl.item( x ).toElement().attribute( "recursive" ) == "1" ) );
}
if ( Config::isPortableVersion() && c.paths.empty() ) {
// For portable version, hardcode some settings
c.paths.push_back( Config::Path( Config::getPortableVersionDictionaryDir(), true ) );
}
QDomNode soundDirs = root.namedItem( "sounddirs" );
if ( !soundDirs.isNull() ) {
@ -760,6 +787,7 @@ Class load()
w.url = mw.attribute( "url" );
w.enabled = ( mw.attribute( "enabled" ) == "1" );
w.icon = mw.attribute( "icon" );
w.lang = mw.attribute( "lang" );
c.mediawikis.push_back( w );
}
@ -820,7 +848,7 @@ Class load()
// Upgrading
c.dictServers = makeDefaultDictServers();
}
#ifndef NO_TTS_SUPPORT
QDomNode ves = root.namedItem( "voiceEngines" );
if ( !ves.isNull() ) {
@ -847,6 +875,7 @@ Class load()
c.voiceEngines.push_back( v );
}
}
#endif
c.mutedDictionaries = loadMutedDictionaries( root.namedItem( "mutedDictionaries" ) );
c.popupMutedDictionaries = loadMutedDictionaries( root.namedItem( "popupMutedDictionaries" ) );
@ -1279,7 +1308,7 @@ void saveGroup( Group const & data, QDomElement & group )
void save( Class const & c )
{
QFile configFile( getConfigFileName() + ".tmp" );
QSaveFile configFile( getConfigFileName() );
if ( !configFile.open( QFile::WriteOnly ) )
throw exCantWriteConfigFile();
@ -1527,6 +1556,10 @@ void save( Class const & c )
QDomAttr icon = dd.createAttribute( "icon" );
icon.setValue( mediawiki.icon );
mw.setAttributeNode( icon );
QDomAttr lang = dd.createAttribute( "lang" );
lang.setValue( mediawiki.lang );
mw.setAttributeNode( lang );
}
}
@ -1635,7 +1668,7 @@ void save( Class const & c )
p.setAttributeNode( icon );
}
}
#ifndef NO_TTS_SUPPORT
{
QDomNode ves = dd.createElement( "voiceEngines" );
root.appendChild( ves );
@ -1677,6 +1710,7 @@ void save( Class const & c )
v.setAttributeNode( rate );
}
}
#endif
{
QDomElement muted = dd.createElement( "mutedDictionaries" );
@ -2197,14 +2231,9 @@ void save( Class const & c )
hd.appendChild( opt );
}
QByteArray result( dd.toByteArray() );
if ( configFile.write( result ) != result.size() )
configFile.write( dd.toByteArray() );
if ( !configFile.commit() )
throw exCantWriteConfigFile();
configFile.close();
renameAtomically( configFile.fileName(), getConfigFileName() );
}
QString getConfigFileName()

View file

@ -455,24 +455,32 @@ struct MediaWiki
QString id, name, url;
bool enabled;
QString icon;
QString lang;
MediaWiki():
enabled( false )
{
}
MediaWiki( QString const & id_, QString const & name_, QString const & url_, bool enabled_, QString const & icon_ ):
MediaWiki( QString const & id_,
QString const & name_,
QString const & url_,
bool enabled_,
QString const & icon_,
QString const & lang_ = "" ):
id( id_ ),
name( name_ ),
url( url_ ),
enabled( enabled_ ),
icon( icon_ )
icon( icon_ ),
lang( lang_ )
{
}
bool operator==( MediaWiki const & other ) const
{
return id == other.id && name == other.name && url == other.url && enabled == other.enabled && icon == other.icon;
return id == other.id && name == other.name && url == other.url && enabled == other.enabled && icon == other.icon
&& lang == other.lang;
}
};
@ -771,6 +779,7 @@ struct Program
typedef QVector< Program > Programs;
#ifndef NO_TTS_SUPPORT
struct VoiceEngine
{
bool enabled;
@ -815,6 +824,7 @@ struct VoiceEngine
};
typedef QVector< VoiceEngine > VoiceEngines;
#endif
struct HeadwordsDialog
{
@ -848,7 +858,9 @@ struct Class
Lingua lingua;
Forvo forvo;
Programs programs;
#ifndef NO_TTS_SUPPORT
VoiceEngines voiceEngines;
#endif
unsigned lastMainGroupId; // Last used group in main window
unsigned lastPopupGroupId; // Last used group in popup window

View file

@ -119,7 +119,7 @@ __attribute__( ( packed ) )
bool indexIsOldOrBad( string const & indexFile )
{
File::Class idx( indexFile, "rb" );
File::Index idx( indexFile, "rb" );
IdxHeader header;
@ -214,10 +214,10 @@ class AardDictionary: public BtreeIndexing::BtreeDictionary
{
QMutex idxMutex;
QMutex aardMutex;
File::Class idx;
File::Index idx;
IdxHeader idxHeader;
ChunkedStorage::Reader chunks;
File::Class df;
File::Index df;
public:
@ -774,7 +774,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries( vector< string > const & f
}
}
File::Class df( fileName, "rb" );
File::Index df( fileName, "rb" );
AAR_header dictHeader;
@ -839,7 +839,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries( vector< string > const & f
initializing.indexingDictionary( dictName );
File::Class idx( indexFile, "wb" );
File::Index idx( indexFile, "wb" );
IdxHeader idxHeader;
memset( &idxHeader, 0, sizeof( idxHeader ) );

View file

@ -91,7 +91,7 @@ __attribute__( ( packed ) )
bool indexIsOldOrBad( string const & indexFile )
{
File::Class idx( indexFile, "rb" );
File::Index idx( indexFile, "rb" );
IdxHeader header;
@ -175,7 +175,7 @@ DEF_EX( exChunkIndexOutOfRange, "Chunk index is out of range", Dictionary::Ex )
class BglDictionary: public BtreeIndexing::BtreeDictionary
{
QMutex idxMutex;
File::Class idx;
File::Index idx;
IdxHeader idxHeader;
ChunkedStorage::Reader chunks;
@ -809,7 +809,7 @@ class BglResourceRequest: public Dictionary::DataRequest
{
QMutex & idxMutex;
File::Class & idx;
File::Index & idx;
uint32_t resourceListOffset, resourcesCount;
string name;
@ -819,7 +819,7 @@ class BglResourceRequest: public Dictionary::DataRequest
public:
BglResourceRequest( QMutex & idxMutex_,
File::Class & idx_,
File::Index & idx_,
uint32_t resourceListOffset_,
uint32_t resourcesCount_,
string const & name_ ):
@ -953,12 +953,12 @@ void BglDictionary::replaceCharsetEntities( string & text )
class ResourceHandler: public Babylon::ResourceHandler
{
File::Class & idxFile;
File::Index & idxFile;
list< pair< string, uint32_t > > resources;
public:
ResourceHandler( File::Class & idxFile_ ):
ResourceHandler( File::Index & idxFile_ ):
idxFile( idxFile_ )
{
}
@ -1048,7 +1048,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries( vector< string > const & f
initializing.indexingDictionary( b.title() );
File::Class idx( indexFile, "wb" );
File::Index idx( indexFile, "wb" );
IdxHeader idxHeader;

View file

@ -73,7 +73,7 @@ __attribute__( ( packed ) )
bool indexIsOldOrBad( string const & indexFile )
{
File::Class idx( indexFile, "rb" );
File::Index idx( indexFile, "rb" );
IdxHeader header;
@ -84,7 +84,7 @@ bool indexIsOldOrBad( string const & indexFile )
class DictdDictionary: public BtreeIndexing::BtreeDictionary
{
QMutex idxMutex;
File::Class idx, indexFile; // The later is .index file
File::Index idx, indexFile; // The later is .index file
IdxHeader idxHeader;
dictData * dz;
QMutex indexFileMutex, dzMutex;
@ -579,7 +579,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries( vector< string > const & f
initializing.indexingDictionary( dictionaryName );
File::Class idx( indexFile, "wb" );
File::Index idx( indexFile, "wb" );
IdxHeader idxHeader;
@ -592,7 +592,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries( vector< string > const & f
IndexedWords indexedWords;
File::Class indexFile( dictFiles[ 0 ], "rb" );
File::Index indexFile( dictFiles[ 0 ], "rb" );
// Read words from index until none's left.

View file

@ -131,7 +131,7 @@ struct InsidedCard
bool indexIsOldOrBad( string const & indexFile, bool hasZipFile )
{
File::Class idx( indexFile, "rb" );
File::Index idx( indexFile, "rb" );
IdxHeader header;
@ -143,7 +143,7 @@ bool indexIsOldOrBad( string const & indexFile, bool hasZipFile )
class DslDictionary: public BtreeIndexing::BtreeDictionary
{
QMutex idxMutex;
File::Class idx;
File::Index idx;
IdxHeader idxHeader;
sptr< ChunkedStorage::Reader > chunks;
string preferredSoundDictionary;
@ -1718,7 +1718,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries( vector< string > const & f
gdDebug( "Dsl: Building the index for dictionary: %s\n",
QString::fromStdU32String( scanner.getDictionaryName() ).toUtf8().data() );
File::Class idx( indexFile, "wb" );
File::Index idx( indexFile, "wb" );
IdxHeader idxHeader;
@ -1887,9 +1887,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries( vector< string > const & f
if ( isDslWs( curString[ 0 ] ) )
break; // No more headwords
#ifdef QT_DEBUG
qDebug() << "Alt headword" << QString::fromStdU32String( curString );
#endif
qDebug() << "dsl Alt headword" << QString::fromStdU32String( curString );
processUnsortedParts( curString, true );
expandTildes( curString, allEntryWords.front() );

View file

@ -70,7 +70,7 @@ __attribute__( ( packed ) )
bool indexIsOldOrBad( string const & indexFile )
{
File::Class idx( indexFile, "rb" );
File::Index idx( indexFile, "rb" );
IdxHeader header;
@ -84,7 +84,7 @@ class EpwingDictionary: public BtreeIndexing::BtreeDictionary
Q_DECLARE_TR_FUNCTIONS( Epwing::EpwingDictionary )
QMutex idxMutex;
File::Class idx;
File::Index idx;
IdxHeader idxHeader;
string bookName;
ChunkedStorage::Reader chunks;
@ -1201,7 +1201,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries( vector< string > const & f
QByteArray nameData = str.toUtf8();
initializing.indexingDictionary( nameData.data() );
File::Class idx( indexFile, "wb" );
File::Index idx( indexFile, "wb" );
IdxHeader idxHeader{};

View file

@ -332,7 +332,7 @@ __attribute__( ( packed ) )
bool indexIsOldOrBad( string const & indexFile, bool hasZipFile )
{
File::Class idx( indexFile, "rb" );
File::Index idx( indexFile, "rb" );
IdxHeader header;
@ -344,7 +344,7 @@ bool indexIsOldOrBad( string const & indexFile, bool hasZipFile )
class GlsDictionary: public BtreeIndexing::BtreeDictionary
{
QMutex idxMutex;
File::Class idx;
File::Index idx;
IdxHeader idxHeader;
dictData * dz;
ChunkedStorage::Reader chunks;
@ -1233,7 +1233,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries( vector< string > const & f
gdDebug( "Gls: Building the index for dictionary: %s\n",
QString::fromStdU32String( scanner.getDictionaryName() ).toUtf8().data() );
File::Class idx( indexFile, "wb" );
File::Index idx( indexFile, "wb" );
IdxHeader idxHeader;

View file

@ -411,9 +411,6 @@ QVector< wstring > suggest( wstring & word, QMutex & hunspellMutex, Hunspell & h
if ( Folding::applySimpleCaseOnly( alt ) != lowercasedWord ) // No point in providing same word
{
#ifdef QT_DEBUG
qDebug() << ">>>>>Alt:" << QString::fromStdU32String( alt );
#endif
result.append( alt );
}
}

View file

@ -269,7 +269,9 @@ void loadDictionaries( QWidget * parent,
addDicts( Forvo::makeDictionaries( loadDicts, cfg.forvo, dictNetMgr ) );
addDicts( Lingua::makeDictionaries( loadDicts, cfg.lingua, dictNetMgr ) );
addDicts( Programs::makeDictionaries( cfg.programs ) );
#ifndef NO_TTS_SUPPORT
addDicts( VoiceEngines::makeDictionaries( cfg.voiceEngines ) );
#endif
addDicts( DictServer::makeDictionaries( cfg.dictServers ) );

View file

@ -65,7 +65,7 @@ __attribute__( ( packed ) )
bool indexIsOldOrBad( string const & indexFile )
{
File::Class idx( indexFile, "rb" );
File::Index idx( indexFile, "rb" );
IdxHeader header;
@ -91,10 +91,10 @@ struct Entry
public:
// Reads an entry from the file's current position
Entry( File::Class & f );
Entry( File::Index & f );
};
Entry::Entry( File::Class & f )
Entry::Entry( File::Index & f )
{
bool firstEntry = ( f.tell() == 13 );
// Read the entry's filename
@ -147,7 +147,7 @@ Entry::Entry( File::Class & f )
class LsaDictionary: public BtreeIndexing::BtreeDictionary
{
QMutex idxMutex;
File::Class idx;
File::Index idx;
IdxHeader idxHeader;
public:
@ -390,7 +390,7 @@ sptr< Dictionary::DataRequest > LsaDictionary::getResource( string const & name
if ( chain.empty() )
return std::make_shared< Dictionary::DataRequestInstant >( false ); // No such resource
File::Class f( getDictionaryFilenames()[ 0 ], "rb" );
File::Index f( getDictionaryFilenames()[ 0 ], "rb" );
f.seek( chain[ 0 ].articleOffset );
Entry e( f );
@ -503,7 +503,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries( vector< string > const & f
continue;
try {
File::Class f( *i, "rb" );
File::Index f( *i, "rb" );
/// Check the signature
@ -528,7 +528,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries( vector< string > const & f
initializing.indexingDictionary( Utils::Fs::basename( *i ) );
File::Class idx( indexFile, "wb" );
File::Index idx( indexFile, "wb" );
IdxHeader idxHeader;

View file

@ -154,7 +154,7 @@ public:
if ( links.empty() )
return false;
MdictParser::RecordInfo indexEntry;
MdictParser::RecordInfo indexEntry{};
vector< char > chunk;
// QMutexLocker _( &idxMutex );
const char * indexEntryPtr = chunks.getBlock( links[ 0 ].articleOffset, chunk );
@ -191,7 +191,7 @@ public:
class MdxDictionary: public BtreeIndexing::BtreeDictionary
{
QMutex idxMutex;
File::Class idx;
File::Index idx;
string idxFileName;
IdxHeader idxHeader;
string encoding;
@ -1152,7 +1152,7 @@ void MdxDictionary::loadResourceFile( const wstring & resourceName, vector< char
File::loadFromFile( fn, data );
return;
}
for ( auto mddResource : mddResources ) {
for ( const auto& mddResource : mddResources ) {
if ( mddResource->loadFile( newResourceName, data ) )
break;
}
@ -1220,7 +1220,7 @@ private:
static bool indexIsOldOrBad( vector< string > const & dictFiles, string const & indexFile )
{
File::Class idx( indexFile, "rb" );
File::Index idx( indexFile, "rb" );
IdxHeader header;
return idx.readRecords( &header, sizeof( header ), 1 ) != 1 || header.signature != kSignature
@ -1296,7 +1296,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries( vector< string > const & f
}
}
File::Class idx( indexFile, "wb" );
File::Index idx( indexFile, "wb" );
IdxHeader idxHeader;
memset( &idxHeader, 0, sizeof( idxHeader ) );
// We write a dummy header first. At the end of the process the header

View file

@ -26,7 +26,7 @@ namespace {
class MediaWikiDictionary: public Dictionary::Class
{
string name;
QString url, icon;
QString url, icon, lang;
QNetworkAccessManager & netMgr;
quint32 langId;
@ -36,11 +36,13 @@ public:
string const & name_,
QString const & url_,
QString const & icon_,
QString const & lang_,
QNetworkAccessManager & netMgr_ ):
Dictionary::Class( id, vector< string >() ),
name( name_ ),
url( url_ ),
icon( icon_ ),
lang( lang_ ),
netMgr( netMgr_ ),
langId( 0 )
{
@ -132,7 +134,7 @@ class MediaWikiWordSearchRequest: public MediaWikiWordSearchRequestSlots
public:
MediaWikiWordSearchRequest( wstring const &, QString const & url, QNetworkAccessManager & mgr );
MediaWikiWordSearchRequest( wstring const &, QString const & url, QString const & lang, QNetworkAccessManager & mgr );
~MediaWikiWordSearchRequest();
@ -145,6 +147,7 @@ private:
MediaWikiWordSearchRequest::MediaWikiWordSearchRequest( wstring const & str,
QString const & url,
QString const & lang,
QNetworkAccessManager & mgr ):
isCancelling( false )
{
@ -154,6 +157,7 @@ MediaWikiWordSearchRequest::MediaWikiWordSearchRequest( wstring const & str,
GlobalBroadcaster::instance()->addWhitelist( reqUrl.host() );
Utils::Url::addQueryItem( reqUrl, "apprefix", QString::fromStdU32String( str ).replace( '+', "%2B" ) );
Utils::Url::addQueryItem( reqUrl, "lang", lang );
QNetworkRequest req( reqUrl );
//millseconds.
@ -376,12 +380,14 @@ class MediaWikiArticleRequest: public MediaWikiDataRequestSlots
typedef std::list< std::pair< QNetworkReply *, bool > > NetReplies;
NetReplies netReplies;
QString url;
QString lang;
public:
MediaWikiArticleRequest( wstring const & word,
vector< wstring > const & alts,
QString const & url,
QString const & lang,
QNetworkAccessManager & mgr,
Class * dictPtr_ );
@ -425,9 +431,11 @@ void MediaWikiArticleRequest::cancel()
MediaWikiArticleRequest::MediaWikiArticleRequest( wstring const & str,
vector< wstring > const & alts,
QString const & url_,
QString const & lang_,
QNetworkAccessManager & mgr,
Class * dictPtr_ ):
url( url_ ),
lang( lang_ ),
dictPtr( dictPtr_ )
{
connect( &mgr,
@ -449,6 +457,7 @@ void MediaWikiArticleRequest::addQuery( QNetworkAccessManager & mgr, wstring con
QUrl reqUrl( url + "/api.php?action=parse&prop=text|revid|sections&format=xml&redirects" );
Utils::Url::addQueryItem( reqUrl, "page", QString::fromStdU32String( str ).replace( '+', "%2B" ) );
Utils::Url::addQueryItem( reqUrl, "variant", lang );
QNetworkRequest req( reqUrl );
//millseconds.
req.setTransferTimeout( 3000 );
@ -690,7 +699,7 @@ sptr< WordSearchRequest > MediaWikiDictionary::prefixMatch( wstring const & word
return std::make_shared< WordSearchRequestInstant >();
}
else
return std::make_shared< MediaWikiWordSearchRequest >( word, url, netMgr );
return std::make_shared< MediaWikiWordSearchRequest >( word, url, lang, netMgr );
}
sptr< DataRequest >
@ -703,7 +712,7 @@ MediaWikiDictionary::getArticle( wstring const & word, vector< wstring > const &
return std::make_shared< DataRequestInstant >( false );
}
else
return std::make_shared< MediaWikiArticleRequest >( word, alts, url, netMgr, this );
return std::make_shared< MediaWikiArticleRequest >( word, alts, url, lang, netMgr, this );
}
} // namespace
@ -720,6 +729,7 @@ makeDictionaries( Dictionary::Initializing &, Config::MediaWikis const & wikis,
wiki.name.toUtf8().data(),
wiki.url,
wiki.icon,
wiki.lang,
mgr ) );
}

View file

@ -112,7 +112,7 @@ __attribute__( ( packed ) )
bool indexIsOldOrBad( string const & indexFile )
{
File::Class idx( indexFile, "rb" );
File::Index idx( indexFile, "rb" );
IdxHeader header;
@ -123,10 +123,10 @@ bool indexIsOldOrBad( string const & indexFile )
class SdictDictionary: public BtreeIndexing::BtreeDictionary
{
QMutex idxMutex, sdictMutex;
File::Class idx;
File::Index idx;
IdxHeader idxHeader;
ChunkedStorage::Reader chunks;
File::Class df;
File::Index df; // Not an index, uses this type for legacy reasons.
public:
@ -676,7 +676,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries( vector< string > const & f
try {
gdDebug( "SDict: Building the index for dictionary: %s\n", fileName.c_str() );
File::Class df( fileName, "rb" );
File::Index df( fileName, "rb" );
DCT_header dictHeader;
@ -706,7 +706,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries( vector< string > const & f
initializing.indexingDictionary( dictName );
File::Class idx( indexFile, "wb" );
File::Index idx( indexFile, "wb" );
IdxHeader idxHeader;
memset( &idxHeader, 0, sizeof( idxHeader ) );

View file

@ -103,7 +103,7 @@ struct RefEntry
bool indexIsOldOrBad( string const & indexFile )
{
File::Class idx( indexFile, "rb" );
File::Index idx( indexFile, "rb" );
IdxHeader header;
@ -575,7 +575,7 @@ class SlobDictionary: public BtreeIndexing::BtreeDictionary
{
QMutex idxMutex;
QMutex slobMutex, idxResourceMutex;
File::Class idx;
File::Index idx;
BtreeIndex resourceIndex;
IdxHeader idxHeader;
SlobFile sf;
@ -1387,7 +1387,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries( vector< string > const & f
initializing.indexingDictionary( sf.getDictionaryName().toUtf8().constData() );
File::Class idx( indexFile, "wb" );
File::Index idx( indexFile, "wb" );
IdxHeader idxHeader;
memset( &idxHeader, 0, sizeof( idxHeader ) );

View file

@ -17,6 +17,7 @@
#include <set>
#include <QDir>
#include <QFileInfo>
#include <QDirIterator>
namespace SoundDir {
@ -52,7 +53,7 @@ __attribute__( ( packed ) )
bool indexIsOldOrBad( string const & indexFile )
{
File::Class idx( indexFile, "rb" );
File::Index idx( indexFile, "rb" );
IdxHeader header;
@ -64,7 +65,7 @@ class SoundDirDictionary: public BtreeIndexing::BtreeDictionary
{
string name;
QMutex idxMutex;
File::Class idx;
File::Index idx;
IdxHeader idxHeader;
ChunkedStorage::Reader chunks;
QString iconFilename;
@ -361,7 +362,7 @@ sptr< Dictionary::DataRequest > SoundDirDictionary::getResource( string const &
// Now try loading that file
try {
File::Class f( fileName.toStdString(), "rb" );
File::Index f( fileName.toStdString(), "rb" );
sptr< Dictionary::DataRequestInstant > dr = std::make_shared< Dictionary::DataRequestInstant >( true );
@ -438,14 +439,31 @@ vector< sptr< Dictionary::Class > > makeDictionaries( Config::SoundDirs const &
string indexFile = indicesDir + dictId;
if ( Dictionary::needToRebuildIndex( dictFiles, indexFile ) || indexIsOldOrBad( indexFile ) ) {
// Check if the soundDir and its subdirs' modification date changed, that means the user modified the sound files inside
bool soundDirModified = false;
{
QDateTime indexFileModifyTime = QFileInfo( QString::fromStdString( indexFile ) ).lastModified();
QDirIterator it( dir.path(),
QDir::AllDirs | QDir::NoDotAndDotDot | QDir::NoSymLinks,
QDirIterator::Subdirectories );
while ( it.hasNext() ) {
it.next();
if ( it.fileInfo().lastModified() > indexFileModifyTime ) {
soundDirModified = true;
break;
}
}
}
if ( Dictionary::needToRebuildIndex( dictFiles, indexFile ) || indexIsOldOrBad( indexFile ) || soundDirModified ) {
// Building the index
qDebug() << "Sounds: Building the index for directory: " << soundDir.path;
initializing.indexingDictionary( soundDir.name.toUtf8().data() );
File::Class idx( indexFile, "wb" );
File::Index idx( indexFile, "wb" );
IdxHeader idxHeader;

View file

@ -16,7 +16,9 @@ Sources::Sources( QWidget * parent, Config::Class const & cfg ):
#ifdef MAKE_CHINESE_CONVERSION_SUPPORT
chineseConversion( new ChineseConversion( this, cfg.transliteration.chinese ) ),
#endif
#ifndef NO_TTS_SUPPORT
textToSpeechSource( nullptr ),
#endif
itemDelegate( new QItemDelegate( this ) ),
itemEditorFactory( new QItemEditorFactory() ),
mediawikisModel( this, cfg.mediawikis ),
@ -39,7 +41,7 @@ Sources::Sources( QWidget * parent, Config::Class const & cfg ):
// anyone?
QItemEditorCreatorBase * programTypeEditorCreator = new QStandardItemEditorCreator< ProgramTypeEditor >();
itemEditorFactory->registerEditor( QVariant::Int, programTypeEditorCreator );
itemEditorFactory->registerEditor( QMetaType::Int, programTypeEditorCreator );
itemDelegate->setItemEditorFactory( itemEditorFactory.get() );
@ -49,6 +51,7 @@ Sources::Sources( QWidget * parent, Config::Class const & cfg ):
ui.mediaWikis->resizeColumnToContents( 1 );
ui.mediaWikis->resizeColumnToContents( 2 );
ui.mediaWikis->resizeColumnToContents( 3 );
ui.mediaWikis->resizeColumnToContents( 4 );
ui.webSites->setTabKeyNavigation( true );
ui.webSites->setModel( &webSitesModel );
@ -130,32 +133,6 @@ Sources::Sources( QWidget * parent, Config::Class const & cfg ):
ui.tabWidget->addTab( textToSpeechSource, QIcon( ":/icons/text2speech.svg" ), tr( "Text to Speech" ) );
}
#endif
if ( Config::isPortableVersion() ) {
// Paths
ui.paths->setEnabled( false );
ui.addPath->setEnabled( false );
ui.removePath->setEnabled( false );
// Sound dirs
{
QStandardItemModel * model = new QStandardItemModel( this );
model->setHorizontalHeaderLabels( QStringList() << " " );
model->invisibleRootItem()->appendRow( new QStandardItem( tr( "(not available in portable version)" ) ) );
ui.soundDirs->setModel( model );
ui.soundDirs->setEnabled( false );
ui.addSoundDir->setEnabled( false );
ui.removeSoundDir->setEnabled( false );
}
// Morpho
ui.hunspellPath->setEnabled( false );
ui.changeHunspellPath->setEnabled( false );
}
}
void Sources::fitPathsColumns()
@ -342,12 +319,14 @@ void Sources::on_removeProgram_clicked()
programsModel.removeProgram( current.row() );
}
#ifndef NO_TTS_SUPPORT
Config::VoiceEngines Sources::getVoiceEngines() const
{
if ( !textToSpeechSource )
return Config::VoiceEngines();
return textToSpeechSource->getVoiceEnginesModel().getCurrentVoiceEngines();
}
#endif
Config::Hunspell Sources::getHunspell() const
{
@ -429,6 +408,8 @@ void MediaWikisModel::addNewWiki()
w.url = "http://";
w.lang = "";
beginInsertRows( QModelIndex(), mediawikis.size(), mediawikis.size() );
mediawikis.push_back( w );
endInsertRows();
@ -471,7 +452,7 @@ int MediaWikisModel::columnCount( QModelIndex const & parent ) const
if ( parent.isValid() )
return 0;
else
return 4;
return 5;
}
QVariant MediaWikisModel::headerData( int section, Qt::Orientation /*orientation*/, int role ) const
@ -486,6 +467,8 @@ QVariant MediaWikisModel::headerData( int section, Qt::Orientation /*orientation
return tr( "Address" );
case 3:
return tr( "Icon" );
case 4:
return tr( "Language Variant" );
default:
return QVariant();
}
@ -506,6 +489,8 @@ QVariant MediaWikisModel::data( QModelIndex const & index, int role ) const
return mediawikis[ index.row() ].url;
case 3:
return mediawikis[ index.row() ].icon;
case 4:
return mediawikis[ index.row() ].lang;
default:
return QVariant();
}
@ -547,6 +532,10 @@ bool MediaWikisModel::setData( QModelIndex const & index, const QVariant & value
mediawikis[ index.row() ].icon = value.toString();
dataChanged( index, index );
return true;
case 4:
mediawikis[ index.row() ].lang = value.toString();
dataChanged( index, index );
return true;
default:
return false;
}

View file

@ -296,9 +296,9 @@ public:
{
return programsModel.getCurrentPrograms();
}
#ifndef NO_TTS_SUPPORT
Config::VoiceEngines getVoiceEngines() const;
#endif
Config::Hunspell getHunspell() const;
Config::Transliteration getTransliteration() const;
@ -318,9 +318,9 @@ private:
#ifdef MAKE_CHINESE_CONVERSION_SUPPORT
ChineseConversion * chineseConversion;
#endif
#ifndef NO_TTS_SUPPORT
TextToSpeechSource * textToSpeechSource;
#endif
QItemDelegate * itemDelegate;
QScopedPointer< QItemEditorFactory > itemEditorFactory;

View file

@ -90,7 +90,7 @@ struct Ifo
string sametypesequence, dicttype, description;
string copyright, author, email, website, date;
explicit Ifo( File::Class & );
explicit Ifo( File::Index & );
};
enum {
@ -123,7 +123,7 @@ __attribute__( ( packed ) )
bool indexIsOldOrBad( string const & indexFile )
{
File::Class idx( indexFile, "rb" );
File::Index idx( indexFile, "rb" );
IdxHeader header;
@ -134,7 +134,7 @@ bool indexIsOldOrBad( string const & indexFile )
class StardictDictionary: public BtreeIndexing::BtreeDictionary
{
QMutex idxMutex;
File::Class idx;
File::Index idx;
IdxHeader idxHeader;
string bookName;
string sameTypeSequence;
@ -1039,7 +1039,7 @@ QString const & StardictDictionary::getDescription()
if ( !dictionaryDescription.isEmpty() )
return dictionaryDescription;
File::Class ifoFile( getDictionaryFilenames()[ 0 ], "r" );
File::Index ifoFile( getDictionaryFilenames()[ 0 ], "r" );
Ifo ifo( ifoFile );
if ( !ifo.copyright.empty() ) {
@ -1402,7 +1402,7 @@ static char const * beginsWith( char const * substr, char const * str )
return strncmp( str, substr, len ) == 0 ? str + len : 0;
}
Ifo::Ifo( File::Class & f ):
Ifo::Ifo( File::Index & f ):
wordcount( 0 ),
synwordcount( 0 ),
idxfilesize( 0 ),
@ -1809,7 +1809,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries( vector< string > const & f
if ( Dictionary::needToRebuildIndex( dictFiles, indexFile ) || indexIsOldOrBad( indexFile ) ) {
// Building the index
File::Class ifoFile( fileName, "r" );
File::Index ifoFile( fileName, "r" );
Ifo ifo( ifoFile );
@ -1840,7 +1840,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries( vector< string > const & f
initializing.indexingDictionary( ifo.bookname );
File::Class idx( indexFile, "wb" );
File::Index idx( indexFile, "wb" );
IdxHeader idxHeader;

View file

@ -1,20 +1,21 @@
/* This file is (c) 2013 Timon Wong <timon86.wang@gmail.com>
* Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */
#ifndef NO_TTS_SUPPORT
#include "voiceengines.hh"
#include "audiolink.hh"
#include "htmlescape.hh"
#include "utf8.hh"
#include "wstring_qt.hh"
#include "voiceengines.hh"
#include "audiolink.hh"
#include "htmlescape.hh"
#include "utf8.hh"
#include "wstring_qt.hh"
#include <string>
#include <map>
#include <string>
#include <map>
#include <QDir>
#include <QFileInfo>
#include <QCryptographicHash>
#include <QDir>
#include <QFileInfo>
#include <QCryptographicHash>
#include "utils.hh"
#include "utils.hh"
namespace VoiceEngines {
@ -137,3 +138,5 @@ vector< sptr< Dictionary::Class > > makeDictionaries( Config::VoiceEngines const
}
} // namespace VoiceEngines
#endif

View file

@ -1,14 +1,13 @@
/* This file is (c) 2013 Timon Wong <timon86.wang@gmail.com>
* Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */
#pragma once
#ifndef NO_TTS_SUPPORT
#ifndef __VOICEENGINES_HH_INCLUDED__
#define __VOICEENGINES_HH_INCLUDED__
#include "dictionary.hh"
#include "config.hh"
#include "wstring.hh"
#include "dictionary.hh"
#include "config.hh"
#include "wstring.hh"
#include <QCryptographicHash>
#include <QCryptographicHash>
namespace VoiceEngines {

View file

@ -129,7 +129,7 @@ __attribute__( ( packed ) )
bool indexIsOldOrBad( string const & indexFile )
{
File::Class idx( indexFile, "rb" );
File::Index idx( indexFile, "rb" );
IdxHeader header;
@ -141,7 +141,7 @@ bool indexIsOldOrBad( string const & indexFile )
class XdxfDictionary: public BtreeIndexing::BtreeDictionary
{
QMutex idxMutex;
File::Class idx;
File::Index idx;
IdxHeader idxHeader;
sptr< ChunkedStorage::Reader > chunks;
QMutex dzMutex;
@ -1040,7 +1040,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries( vector< string > const & f
//initializing.indexingDictionary( nameFromFileName( dictFiles[ 0 ] ) );
File::Class idx( indexFile, "wb" );
File::Index idx( indexFile, "wb" );
IdxHeader idxHeader;
map< string, string > abrv;

View file

@ -98,7 +98,7 @@ __attribute__( ( packed ) )
// Some supporting functions
bool indexIsOldOrBad( string const & indexFile )
{
File::Class idx( indexFile, "rb" );
File::Index idx( indexFile, "rb" );
IdxHeader header;
@ -162,7 +162,7 @@ class ZimDictionary: public BtreeIndexing::BtreeDictionary
{
QMutex idxMutex;
QMutex zimMutex;
File::Class idx;
File::Index idx;
IdxHeader idxHeader;
ZimFile df;
set< quint32 > articlesIndexedForFTS;
@ -842,7 +842,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries( vector< string > const & f
initializing.indexingDictionary( firstName.mid( n + 1 ).toUtf8().constData() );
}
File::Class idx( indexFile, "wb" );
File::Index idx( indexFile, "wb" );
IdxHeader idxHeader;
memset( &idxHeader, 0, sizeof( idxHeader ) );
idxHeader.namePtr = 0xFFFFFFFF;

View file

@ -61,7 +61,7 @@ __attribute__( ( packed ) )
bool indexIsOldOrBad( string const & indexFile )
{
File::Class idx( indexFile, "rb" );
File::Index idx( indexFile, "rb" );
IdxHeader header;
@ -98,7 +98,7 @@ wstring stripExtension( string const & str )
class ZipSoundsDictionary: public BtreeIndexing::BtreeDictionary
{
QMutex idxMutex;
File::Class idx;
File::Index idx;
IdxHeader idxHeader;
sptr< ChunkedStorage::Reader > chunks;
IndexedZip zipsFile;
@ -394,7 +394,7 @@ vector< sptr< Dictionary::Class > > makeDictionaries( vector< string > const & f
if ( Dictionary::needToRebuildIndex( dictFiles, indexFile ) || indexIsOldOrBad( indexFile ) ) {
gdDebug( "Zips: Building the index for dictionary: %s\n", fileName.c_str() );
File::Class idx( indexFile, "wb" );
File::Index idx( indexFile, "wb" );
IdxHeader idxHeader;
memset( &idxHeader, 0, sizeof( idxHeader ) );

View file

@ -16,7 +16,7 @@ ExternalAudioPlayer::~ExternalAudioPlayer()
// Set viewer to null first and foremost to make sure that onViewerDestroyed()
// doesn't attempt to start viewer or mess the smart pointer up.
stopAndDestroySynchronously( viewer.take() );
stopAndDestroySynchronously( viewer.release() );
stopAndDestroySynchronously( exitingViewer );
}
@ -56,7 +56,7 @@ void ExternalAudioPlayer::stop()
// 1) the process gets a chance to clean up and save its state;
// 2) there is no event loop blocking and consequently no (short) UI freeze
// while synchronously waiting for the external process to exit.
exitingViewer = viewer.take();
exitingViewer = viewer.release();
}
else // viewer is either not started or already stopped -> simply destroy it.
viewer.reset();
@ -72,14 +72,14 @@ void ExternalAudioPlayer::onViewerDestroyed( QObject * destroyedViewer )
emit error( errorMessage );
}
}
else if ( viewer.data() == destroyedViewer )
viewer.take(); // viewer finished and died -> release ownership.
else if ( viewer.get() == destroyedViewer )
viewer.reset( nullptr ); // viewer finished and died -> reset
}
QString ExternalAudioPlayer::startViewer()
{
Q_ASSERT( !exitingViewer && viewer );
connect( viewer.data(), &QObject::destroyed, this, &ExternalAudioPlayer::onViewerDestroyed );
connect( viewer.get(), &QObject::destroyed, this, &ExternalAudioPlayer::onViewerDestroyed );
try {
viewer->start();
}

View file

@ -4,9 +4,8 @@
#ifndef EXTERNALAUDIOPLAYER_HH_INCLUDED
#define EXTERNALAUDIOPLAYER_HH_INCLUDED
#include <QScopedPointer>
#include <QString>
#include "audioplayerinterface.hh"
#include <memory>
class ExternalViewer;
@ -34,16 +33,16 @@ private:
///< the current viewer (if any) is not started yet
///< and waits for exitingViewer to be destroyed first.
struct ScopedPointerDeleteLater
struct QObjectDeleteLater
{
static void cleanup( QObject * p )
void operator()( QObject * p )
{
if ( p )
p->deleteLater();
}
};
// deleteLater() is safer because viewer actively participates in the QEventLoop.
QScopedPointer< ExternalViewer, ScopedPointerDeleteLater > viewer;
std::unique_ptr< ExternalViewer, QObjectDeleteLater > viewer;
};
#endif // EXTERNALAUDIOPLAYER_HH_INCLUDED

View file

@ -52,11 +52,12 @@ AudioService::~AudioService()
void AudioService::playMemory( const char * ptr, int size )
{
emit cancelPlaying( false );
if ( !thread.isNull() ) {
thread->wait();
}
QByteArray audioData( ptr, size );
thread = std::make_shared< DecoderThread >( audioData, this );
connect( this, &AudioService::cancelPlaying, thread.get(), [ this ]( bool waitFinished ) {
thread->cancel( waitFinished );
} );
thread.reset( new DecoderThread( audioData, this ) );
connect( this, &AudioService::cancelPlaying, thread.get(), &DecoderThread::cancel );
thread->start();
}
@ -263,6 +264,11 @@ bool DecoderContext::openOutputDevice( QString & errorString )
}
#endif
if ( audioOutput == nullptr ) {
errorString += QStringLiteral( "Failed to create audioOutput." );
return false;
}
audioOutput->setAudioFormat( 44100, codecContext_->channels );
return true;
}

Some files were not shown because too many files have changed in this diff Show more