mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-24 12:44:07 +00:00
Merge pull request #255 from xiaoyifang/staged
merge staged branch to dev
This commit is contained in:
commit
2d750d92ed
35
.github/workflows/macos-6.x.yml
vendored
35
.github/workflows/macos-6.x.yml
vendored
|
@ -56,7 +56,11 @@ jobs:
|
|||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: version-file
|
||||
shell: bash
|
||||
run: |
|
||||
previousTag=$(git tag --sort=-creatordate | sed -n 1p |cut -c 2-)
|
||||
echo "$previousTag">version.txt
|
||||
- name: build macos
|
||||
run: |
|
||||
brew uninstall opencc hunspell ffmpeg@5 ffmpeg@4 libtiff xz lzo libogg libvorbis zstd || true
|
||||
|
@ -74,12 +78,14 @@ jobs:
|
|||
mv ${targetName}.app ./tmp
|
||||
# --background "installer_background.png"
|
||||
create-dmg --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/
|
||||
- name: Generate changelog
|
||||
if: ${{!env.prerelease}}
|
||||
id: changelog1
|
||||
uses: metcalfc/changelog-generator@v3.0.0
|
||||
- name: Release Changelog Builder
|
||||
id: changelog
|
||||
uses: mikepenz/release-changelog-builder-action@v3.5.0
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
myToken: ${{ secrets.GITHUB_TOKEN }}
|
||||
# ignorePreReleases: true
|
||||
commitMode: true
|
||||
|
||||
- name: Set outputs
|
||||
id: vars
|
||||
|
@ -90,20 +96,6 @@ jobs:
|
|||
echo "::set-output name=release_time_clock::$(date +'%H:%M:%S')"
|
||||
echo "::set-output name=release_hm::$(date +'%y%m%d')"
|
||||
|
||||
- name: changelog
|
||||
if: $${{env.prerelease}}
|
||||
id: changelog2
|
||||
run: |
|
||||
previousTag=$(git tag --sort=-creatordate | sed -n 2p)
|
||||
echo "previousTag : $previousTag"
|
||||
|
||||
CHANGELOG="$(git log --oneline --no-decorate $previousTag..HEAD)"
|
||||
CHANGELOG="${CHANGELOG//'%'/'%25'}"
|
||||
CHANGELOG="${CHANGELOG//$'\n'/'%0A'}"
|
||||
CHANGELOG="${CHANGELOG//$'\r'/'%0D'}"
|
||||
CHANGELOG="${CHANGELOG//'\"'/'%22'}"
|
||||
CHANGELOG="${CHANGELOG//"'"/ }"
|
||||
echo "::set-output name=COMMIT_SUMMARY::$(echo "$CHANGELOG")"
|
||||
# tag 上传Release
|
||||
- name: uploadRelease
|
||||
uses: svenstaro/upload-release-action@v2
|
||||
|
@ -133,5 +125,4 @@ jobs:
|
|||
|
||||
Filename pattern: **[Qt version]-GoldenDict-[OS]-[release-date].[ext]**
|
||||
CHANGES:
|
||||
${{ steps.changelog1.outputs.changelog }}
|
||||
${{ steps.changelog2.outputs.COMMIT_SUMMARY }}
|
||||
${{ steps.changelog.outputs.changelog }}
|
||||
|
|
5
.github/workflows/macos-homebrew.yml
vendored
5
.github/workflows/macos-homebrew.yml
vendored
|
@ -271,6 +271,11 @@ jobs:
|
|||
brew install xz lzo
|
||||
brew install pkg-config
|
||||
brew install create-dmg
|
||||
- name: version-file
|
||||
shell: bash
|
||||
run: |
|
||||
previousTag=$(git tag --sort=-creatordate | sed -n 1p |cut -c 2-)
|
||||
echo "$previousTag">version.txt
|
||||
- name: compile
|
||||
run: |
|
||||
qmake CONFIG+=release CONFIG+=no_macos_universal CONFIG+=zim_support CONFIG+=no_extra_tiff_handler #CONFIG+=no_epwing_support # CONFIG+=no_ffmpeg_player #CONFIG+=no_qtmultimedia_player
|
||||
|
|
38
.github/workflows/macos.yml
vendored
38
.github/workflows/macos.yml
vendored
|
@ -58,6 +58,13 @@ jobs:
|
|||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: version-file
|
||||
shell: bash
|
||||
run: |
|
||||
previousTag=$(git tag --sort=-creatordate | sed -n 1p |cut -c 2-)
|
||||
echo "$previousTag">version.txt
|
||||
|
||||
- name: build macos
|
||||
run: |
|
||||
brew uninstall opencc hunspell ffmpeg@5 ffmpeg@4 libtiff xz lzo libogg libvorbis zstd || true
|
||||
|
@ -75,12 +82,14 @@ jobs:
|
|||
mv ${targetName}.app ./tmp
|
||||
# --background "installer_background.png"
|
||||
create-dmg --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/
|
||||
- name: Generate changelog
|
||||
if: ${{!env.prerelease}}
|
||||
id: changelog1
|
||||
uses: metcalfc/changelog-generator@v3.0.0
|
||||
- name: Release Changelog Builder
|
||||
id: changelog
|
||||
uses: mikepenz/release-changelog-builder-action@v3.5.0
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
myToken: ${{ secrets.GITHUB_TOKEN }}
|
||||
# ignorePreReleases: true
|
||||
commitMode: true
|
||||
|
||||
- name: Set outputs
|
||||
id: vars
|
||||
|
@ -90,21 +99,7 @@ jobs:
|
|||
echo "::set-output name=release_time::$(date +'%H%M%S')"
|
||||
echo "::set-output name=release_time_clock::$(date +'%H:%M:%S')"
|
||||
echo "::set-output name=release_hm::$(date +'%y%m%d')"
|
||||
|
||||
- name: changelog
|
||||
if: $${{env.prerelease}}
|
||||
id: changelog2
|
||||
run: |
|
||||
previousTag=$(git tag --sort=-creatordate | sed -n 2p)
|
||||
echo "previousTag : $previousTag"
|
||||
|
||||
CHANGELOG="$(git log --oneline --no-decorate $previousTag..HEAD)"
|
||||
CHANGELOG="${CHANGELOG//'%'/'%25'}"
|
||||
CHANGELOG="${CHANGELOG//$'\n'/'%0A'}"
|
||||
CHANGELOG="${CHANGELOG//$'\r'/'%0D'}"
|
||||
CHANGELOG="${CHANGELOG//'\"'/'%22'}"
|
||||
CHANGELOG="${CHANGELOG//"'"/ }"
|
||||
echo "::set-output name=COMMIT_SUMMARY::$(echo "$CHANGELOG")"
|
||||
|
||||
# tag 上传Release
|
||||
- name: uploadRelease
|
||||
uses: svenstaro/upload-release-action@v2
|
||||
|
@ -134,5 +129,4 @@ jobs:
|
|||
|
||||
Filename pattern: **[Qt version]-GoldenDict-[OS]-[release-date].[ext]**
|
||||
CHANGES:
|
||||
${{ steps.changelog1.outputs.changelog }}
|
||||
${{ steps.changelog2.outputs.COMMIT_SUMMARY }}
|
||||
${{ steps.changelog.outputs.changelog }}
|
||||
|
|
37
.github/workflows/ubuntu-6.2.yml
vendored
37
.github/workflows/ubuntu-6.2.yml
vendored
|
@ -67,6 +67,12 @@ jobs:
|
|||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: version-file
|
||||
shell: bash
|
||||
run: |
|
||||
previousTag=$(git tag --sort=-creatordate | sed -n 1p |cut -c 2-)
|
||||
echo "$previousTag">version.txt
|
||||
|
||||
- name: build goldendict
|
||||
run: |
|
||||
qmake CONFIG+=release CONFIG+=no_extra_tiff_handler PREFIX=/usr CONFIG+=zim_support CONFIG+=chinese_conversion_support
|
||||
|
@ -81,12 +87,14 @@ jobs:
|
|||
chmod a+x linuxdeploy-x86_64.AppImage
|
||||
./linuxdeploy-x86_64.AppImage --appdir appdir --output appimage --plugin qt -i redist/icons/goldendict.png -d redist/org.goldendict.GoldenDict.desktop
|
||||
|
||||
- name: Generate changelog
|
||||
if: ${{!env.prerelease}}
|
||||
id: changelog1
|
||||
uses: metcalfc/changelog-generator@v3.0.0
|
||||
- name: Release Changelog Builder
|
||||
id: changelog
|
||||
uses: mikepenz/release-changelog-builder-action@v3.5.0
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
myToken: ${{ secrets.GITHUB_TOKEN }}
|
||||
# ignorePreReleases: true
|
||||
commitMode: true
|
||||
|
||||
- name: Set outputs
|
||||
id: vars
|
||||
|
@ -97,21 +105,7 @@ jobs:
|
|||
echo "::set-output name=release_time_clock::$(date +'%H:%M:%S')"
|
||||
echo "::set-output name=release_hm::$(date +'%y%m%d')"
|
||||
echo "::set-output name=appname::$(ls *.AppImage*)"
|
||||
|
||||
- name: changelog
|
||||
if: $${{env.prerelease}}
|
||||
id: changelog2
|
||||
run: |
|
||||
previousTag=$(git tag --sort=-creatordate | sed -n 2p)
|
||||
echo "previousTag : $previousTag"
|
||||
|
||||
CHANGELOG="$(git log --oneline --no-decorate $previousTag..HEAD)"
|
||||
CHANGELOG="${CHANGELOG//'%'/'%25'}"
|
||||
CHANGELOG="${CHANGELOG//$'\n'/'%0A'}"
|
||||
CHANGELOG="${CHANGELOG//$'\r'/'%0D'}"
|
||||
CHANGELOG="${CHANGELOG//'\"'/'%22'}"
|
||||
CHANGELOG="${CHANGELOG//"'"/ }"
|
||||
echo "::set-output name=COMMIT_SUMMARY::$(echo "$CHANGELOG")"
|
||||
|
||||
- name: uploadRelease
|
||||
# if: startsWith(github.event.ref, 'refs/tags/')
|
||||
uses: svenstaro/upload-release-action@v2
|
||||
|
@ -141,5 +135,4 @@ jobs:
|
|||
|
||||
Filename pattern: **[Qt version]-GoldenDict-[OS]-[release-date].[ext]**
|
||||
CHANGES:
|
||||
${{ steps.changelog1.outputs.changelog }}
|
||||
${{ steps.changelog2.outputs.COMMIT_SUMMARY }}
|
||||
${{ steps.changelog.outputs.changelog }}
|
||||
|
|
36
.github/workflows/ubuntu.yml
vendored
36
.github/workflows/ubuntu.yml
vendored
|
@ -59,6 +59,12 @@ jobs:
|
|||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: version-file
|
||||
shell: bash
|
||||
run: |
|
||||
previousTag=$(git tag --sort=-creatordate | sed -n 1p |cut -c 2-)
|
||||
echo "$previousTag">version.txt
|
||||
|
||||
- name: build goldendict
|
||||
run: |
|
||||
qmake CONFIG+=release CONFIG+=no_extra_tiff_handler PREFIX=/usr CONFIG+=zim_support CONFIG+=chinese_conversion_support
|
||||
|
@ -77,13 +83,14 @@ jobs:
|
|||
chmod a+x linuxdeploy-x86_64.AppImage
|
||||
./linuxdeploy-x86_64.AppImage --appdir appdir --output appimage --plugin qt -i redist/icons/goldendict.png -d redist/org.goldendict.GoldenDict.desktop
|
||||
|
||||
- name: Generate changelog
|
||||
if: ${{!env.prerelease}}
|
||||
id: changelog1
|
||||
uses: metcalfc/changelog-generator@v3.0.0
|
||||
- name: Release Changelog Builder
|
||||
id: changelog
|
||||
uses: mikepenz/release-changelog-builder-action@v3.5.0
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
myToken: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
# ignorePreReleases: true
|
||||
commitMode: true
|
||||
- name: Set outputs
|
||||
id: vars
|
||||
run: |
|
||||
|
@ -94,20 +101,6 @@ jobs:
|
|||
echo "::set-output name=release_hm::$(date +'%y%m%d')"
|
||||
echo "::set-output name=appname::$(ls *.AppImage*)"
|
||||
|
||||
- name: changelog
|
||||
if: $${{env.prerelease}}
|
||||
id: changelog2
|
||||
run: |
|
||||
previousTag=$(git tag --sort=-creatordate | sed -n 2p)
|
||||
echo "previousTag : $previousTag"
|
||||
|
||||
CHANGELOG="$(git log --oneline --no-decorate $previousTag..HEAD)"
|
||||
CHANGELOG="${CHANGELOG//'%'/'%25'}"
|
||||
CHANGELOG="${CHANGELOG//$'\n'/'%0A'}"
|
||||
CHANGELOG="${CHANGELOG//$'\r'/'%0D'}"
|
||||
CHANGELOG="${CHANGELOG//'\"'/'%22'}"
|
||||
CHANGELOG="${CHANGELOG//"'"/ }"
|
||||
echo "::set-output name=COMMIT_SUMMARY::$(echo "$CHANGELOG")"
|
||||
- name: uploadRelease
|
||||
# if: startsWith(github.event.ref, 'refs/tags/')
|
||||
uses: svenstaro/upload-release-action@v2
|
||||
|
@ -137,5 +130,4 @@ jobs:
|
|||
|
||||
Filename pattern: **[Qt version]-GoldenDict-[OS]-[release-date].[ext]**
|
||||
CHANGES:
|
||||
${{ steps.changelog1.outputs.changelog }}
|
||||
${{ steps.changelog2.outputs.COMMIT_SUMMARY }}
|
||||
${{ steps.changelog.outputs.changelog }}
|
||||
|
|
37
.github/workflows/windows-6.x-xapian.yml
vendored
37
.github/workflows/windows-6.x-xapian.yml
vendored
|
@ -51,13 +51,14 @@ jobs:
|
|||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Generate changelog
|
||||
if: ${{!env.prerelease}}
|
||||
id: changelog1
|
||||
uses: metcalfc/changelog-generator@v3.0.0
|
||||
- name: Release Changelog Builder
|
||||
id: changelog
|
||||
uses: mikepenz/release-changelog-builder-action@v3.5.0
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
myToken: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
# ignorePreReleases: true
|
||||
commitMode: true
|
||||
- name: Set outputs
|
||||
id: vars
|
||||
shell: bash
|
||||
|
@ -66,23 +67,16 @@ jobs:
|
|||
echo "::set-output name=release_date::$(date +'%Y%m%d')"
|
||||
echo "::set-output name=release_time::$(date +'%H%M%S')"
|
||||
echo "::set-output name=release_time_clock::$(date +'%H:%M:%S')"
|
||||
echo "::set-output name=release_hm::$(date +'%y%m%d')"
|
||||
echo "::set-output name=release_hm::$(date +'%y%m%d')"
|
||||
|
||||
- name: changelog
|
||||
if: $${{env.prerelease}}
|
||||
id: changelog2
|
||||
- name: version-file
|
||||
shell: bash
|
||||
run: |
|
||||
previousTag=$(git tag --sort=-creatordate | sed -n 2p)
|
||||
echo "previousTag : $previousTag"
|
||||
|
||||
CHANGELOG="$(git log --oneline --no-decorate $previousTag..HEAD)"
|
||||
CHANGELOG="${CHANGELOG//'%'/'%25'}"
|
||||
CHANGELOG="${CHANGELOG//$'\n'/'%0A'}"
|
||||
CHANGELOG="${CHANGELOG//$'\r'/'%0D'}"
|
||||
CHANGELOG="${CHANGELOG//'\"'/'%22'}"
|
||||
CHANGELOG="${CHANGELOG//"'"/ }"
|
||||
echo "::set-output name=COMMIT_SUMMARY::$(echo "$CHANGELOG")"
|
||||
previousTag=$(git tag --sort=-creatordate | sed -n 1p |cut -c 2-)
|
||||
echo "$previousTag">version.txt
|
||||
cat version.txt
|
||||
pwd
|
||||
ls
|
||||
|
||||
# # msvc编译
|
||||
- uses: ilammy/msvc-dev-cmd@v1
|
||||
|
@ -143,8 +137,7 @@ jobs:
|
|||
|
||||
Filename pattern: **[Qt version]-GoldenDict-[OS]-[release-date].[ext]**
|
||||
CHANGES:
|
||||
${{ steps.changelog1.outputs.changelog }}
|
||||
${{ steps.changelog2.outputs.COMMIT_SUMMARY }}
|
||||
${{ steps.changelog.outputs.changelog }}
|
||||
|
||||
- name: upload goldendict.exe only
|
||||
# if: startsWith(github.event.ref, 'refs/tags/')
|
||||
|
|
34
.github/workflows/windows-6.x.yml
vendored
34
.github/workflows/windows-6.x.yml
vendored
|
@ -51,12 +51,6 @@ jobs:
|
|||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Generate changelog
|
||||
if: ${{!env.prerelease}}
|
||||
id: changelog1
|
||||
uses: metcalfc/changelog-generator@v3.0.0
|
||||
with:
|
||||
myToken: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Set outputs
|
||||
id: vars
|
||||
|
@ -68,22 +62,21 @@ jobs:
|
|||
echo "::set-output name=release_time_clock::$(date +'%H:%M:%S')"
|
||||
echo "::set-output name=release_hm::$(date +'%y%m%d')"
|
||||
|
||||
- name: changelog
|
||||
if: $${{env.prerelease}}
|
||||
id: changelog2
|
||||
- name: Release Changelog Builder
|
||||
id: changelog
|
||||
uses: mikepenz/release-changelog-builder-action@v3.5.0
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
# ignorePreReleases: true
|
||||
commitMode: true
|
||||
|
||||
- name: version-file
|
||||
shell: bash
|
||||
run: |
|
||||
previousTag=$(git tag --sort=-creatordate | sed -n 2p)
|
||||
echo "previousTag : $previousTag"
|
||||
previousTag=$(git tag --sort=-creatordate | sed -n 1p |cut -c 2-)
|
||||
echo "$previousTag">version.txt
|
||||
|
||||
CHANGELOG="$(git log --oneline --no-decorate $previousTag..HEAD)"
|
||||
CHANGELOG="${CHANGELOG//'%'/'%25'}"
|
||||
CHANGELOG="${CHANGELOG//$'\n'/'%0A'}"
|
||||
CHANGELOG="${CHANGELOG//$'\r'/'%0D'}"
|
||||
CHANGELOG="${CHANGELOG//'\"'/'%22'}"
|
||||
CHANGELOG="${CHANGELOG//"'"/ }"
|
||||
echo "::set-output name=COMMIT_SUMMARY::$(echo "$CHANGELOG")"
|
||||
|
||||
# # msvc编译
|
||||
- uses: ilammy/msvc-dev-cmd@v1
|
||||
# with:
|
||||
|
@ -143,8 +136,7 @@ jobs:
|
|||
|
||||
Filename pattern: **[Qt version]-GoldenDict-[OS]-[release-date].[ext]**
|
||||
CHANGES:
|
||||
${{ steps.changelog1.outputs.changelog }}
|
||||
${{ steps.changelog2.outputs.COMMIT_SUMMARY }}
|
||||
${{ steps.changelog.outputs.changelog }}
|
||||
|
||||
- name: upload goldendict.exe only
|
||||
# if: startsWith(github.event.ref, 'refs/tags/')
|
||||
|
|
32
.github/workflows/windows.yml
vendored
32
.github/workflows/windows.yml
vendored
|
@ -54,12 +54,14 @@ jobs:
|
|||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Generate changelog
|
||||
if: ${{!env.prerelease}}
|
||||
id: changelog1
|
||||
uses: metcalfc/changelog-generator@v3.0.0
|
||||
- name: Release Changelog Builder
|
||||
id: changelog
|
||||
uses: mikepenz/release-changelog-builder-action@v3.5.0
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
myToken: ${{ secrets.GITHUB_TOKEN }}
|
||||
# ignorePreReleases: true
|
||||
commitMode: true
|
||||
|
||||
- name: Set outputs
|
||||
id: vars
|
||||
|
@ -71,21 +73,12 @@ jobs:
|
|||
echo "::set-output name=release_time_clock::$(date +'%H:%M:%S')"
|
||||
echo "::set-output name=release_hm::$(date +'%y%m%d')"
|
||||
|
||||
- name: changelog
|
||||
if: $${{env.prerelease}}
|
||||
id: changelog2
|
||||
- name: version-file
|
||||
shell: bash
|
||||
run: |
|
||||
previousTag=$(git tag --sort=-creatordate | sed -n 2p)
|
||||
echo "previousTag : $previousTag"
|
||||
|
||||
CHANGELOG="$(git log --oneline --no-decorate $previousTag..HEAD)"
|
||||
CHANGELOG="${CHANGELOG//'%'/'%25'}"
|
||||
CHANGELOG="${CHANGELOG//$'\n'/'%0A'}"
|
||||
CHANGELOG="${CHANGELOG//$'\r'/'%0D'}"
|
||||
CHANGELOG="${CHANGELOG//'\"'/'%22'}"
|
||||
CHANGELOG="${CHANGELOG//"'"/ }"
|
||||
echo "::set-output name=COMMIT_SUMMARY::$(echo "$CHANGELOG")"
|
||||
previousTag=$(git tag --sort=-creatordate | sed -n 1p |cut -c 2-)
|
||||
echo "$previousTag">version.txt
|
||||
|
||||
- uses: ilammy/msvc-dev-cmd@v1
|
||||
# msvc编译
|
||||
- name: msvc-build goldendict
|
||||
|
@ -142,8 +135,7 @@ jobs:
|
|||
|
||||
Filename pattern: **[Qt version]-GoldenDict-[OS]-[release-date].[ext]**
|
||||
CHANGES:
|
||||
${{ steps.changelog1.outputs.changelog }}
|
||||
${{ steps.changelog2.outputs.COMMIT_SUMMARY }}
|
||||
${{ steps.changelog.outputs.changelog }}
|
||||
- name: upload goldendict.exe only
|
||||
# if: startsWith(github.event.ref, 'refs/tags/')
|
||||
uses: svenstaro/upload-release-action@v2
|
||||
|
|
24
config.cc
24
config.cc
|
@ -182,14 +182,24 @@ InputPhrase Preferences::sanitizeInputPhrase( QString const & inputPhrase ) cons
|
|||
{
|
||||
InputPhrase result;
|
||||
|
||||
if( limitInputPhraseLength && inputPhrase.size() > inputPhraseLengthLimit )
|
||||
QString _phase = inputPhrase;
|
||||
if( stripClipboard )
|
||||
{
|
||||
auto parts = inputPhrase.split( QChar::LineFeed, Qt::SkipEmptyParts );
|
||||
if( !parts.empty() )
|
||||
{
|
||||
_phase = parts[ 0 ];
|
||||
}
|
||||
}
|
||||
|
||||
if( limitInputPhraseLength && _phase.size() > inputPhraseLengthLimit )
|
||||
{
|
||||
gdDebug( "Ignoring an input phrase %d symbols long. The configured maximum input phrase length is %d symbols.",
|
||||
inputPhrase.size(), inputPhraseLengthLimit );
|
||||
_phase.size(), inputPhraseLengthLimit );
|
||||
return result;
|
||||
}
|
||||
|
||||
const QString withPunct = inputPhrase.simplified();
|
||||
const QString withPunct = _phase.simplified();
|
||||
result.phrase = gd::toQString( Folding::trimWhitespaceOrPunct( gd::toWString( withPunct ) ) );
|
||||
if ( !result.isValid() )
|
||||
return result; // The suffix of an invalid input phrase must be empty.
|
||||
|
@ -267,6 +277,7 @@ Preferences::Preferences():
|
|||
, inputPhraseLengthLimit( 1000 )
|
||||
, maxDictionaryRefsInContextMenu ( 20 )
|
||||
, synonymSearchEnabled( true )
|
||||
, stripClipboard( false )
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1005,6 +1016,9 @@ Class load()
|
|||
if ( !preferences.namedItem( "synonymSearchEnabled" ).isNull() )
|
||||
c.preferences.synonymSearchEnabled = ( preferences.namedItem( "synonymSearchEnabled" ).toElement().text() == "1" );
|
||||
|
||||
if ( !preferences.namedItem( "stripClipboard" ).isNull() )
|
||||
c.preferences.stripClipboard = ( preferences.namedItem( "stripClipboard" ).toElement().text() == "1" );
|
||||
|
||||
QDomNode fts = preferences.namedItem( "fullTextSearch" );
|
||||
|
||||
if ( !fts.isNull() )
|
||||
|
@ -1960,6 +1974,10 @@ void save( Class const & c )
|
|||
opt.appendChild( dd.createTextNode( c.preferences.synonymSearchEnabled ? "1" : "0" ) );
|
||||
preferences.appendChild( opt );
|
||||
|
||||
opt = dd.createElement( "stripClipboard" );
|
||||
opt.appendChild( dd.createTextNode( c.preferences.stripClipboard ? "1" : "0" ) );
|
||||
preferences.appendChild( opt );
|
||||
|
||||
{
|
||||
QDomNode hd = dd.createElement( "fullTextSearch" );
|
||||
preferences.appendChild( hd );
|
||||
|
|
|
@ -372,6 +372,7 @@ struct Preferences
|
|||
unsigned short maxDictionaryRefsInContextMenu;
|
||||
|
||||
bool synonymSearchEnabled;
|
||||
bool stripClipboard;
|
||||
|
||||
QString addonStyle;
|
||||
|
||||
|
|
|
@ -63,6 +63,7 @@
|
|||
|
||||
#include <QWebEngineSettings>
|
||||
#include <QWebEngineProfile>
|
||||
#include <QProxyStyle>
|
||||
|
||||
#ifdef HAVE_X11
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6,0,0))
|
||||
|
@ -1208,9 +1209,9 @@ void MainWindow::applyQtStyleSheet( QString const & displayStyle, QString const
|
|||
}
|
||||
else
|
||||
{
|
||||
#ifdef Q_OS_WIN32
|
||||
qApp->setStyle( QStyleFactory::create( "Windows" ) );
|
||||
#endif
|
||||
#ifdef Q_OS_WIN32
|
||||
qApp->setStyle( new QProxyStyle() );
|
||||
#endif
|
||||
qApp->setPalette( QPalette() );
|
||||
}
|
||||
|
||||
|
|
|
@ -227,6 +227,8 @@ Preferences::Preferences( QWidget * parent, Config::Class & cfg_ ):
|
|||
|
||||
ui.synonymSearchEnabled->setChecked( p.synonymSearchEnabled );
|
||||
|
||||
ui.stripClipboard->setChecked( p.stripClipboard );
|
||||
|
||||
ui.maxDictsInContextMenu->setValue( p.maxDictionaryRefsInContextMenu );
|
||||
|
||||
// Different platforms have different keys available
|
||||
|
@ -443,6 +445,7 @@ Config::Preferences Preferences::getPreferences()
|
|||
p.inputPhraseLengthLimit = ui.inputPhraseLengthLimit->value();
|
||||
p.ignoreDiacritics = ui.ignoreDiacritics->isChecked();
|
||||
p.ignorePunctuation = ui.ignorePunctuation->isChecked();
|
||||
p.stripClipboard = ui.stripClipboard->isChecked();
|
||||
|
||||
p.synonymSearchEnabled = ui.synonymSearchEnabled->isChecked();
|
||||
|
||||
|
|
|
@ -1743,6 +1743,13 @@ from Stardict, Babylon and GLS dictionaries</string>
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="stripClipboard">
|
||||
<property name="text">
|
||||
<string>When using clipboard,strip everything after newline</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_17">
|
||||
<property name="orientation">
|
||||
|
|
Loading…
Reference in a new issue