Merge pull request #255 from xiaoyifang/staged

merge staged branch to dev
This commit is contained in:
xiaoyifang 2022-12-13 22:04:34 +08:00 committed by GitHub
commit 2d750d92ed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 139 additions and 157 deletions

View file

@ -56,7 +56,11 @@ jobs:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
with: with:
fetch-depth: 0 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 - name: build macos
run: | run: |
brew uninstall opencc hunspell ffmpeg@5 ffmpeg@4 libtiff xz lzo libogg libvorbis zstd || true brew uninstall opencc hunspell ffmpeg@5 ffmpeg@4 libtiff xz lzo libogg libvorbis zstd || true
@ -74,12 +78,14 @@ jobs:
mv ${targetName}.app ./tmp mv ${targetName}.app ./tmp
# --background "installer_background.png" # --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/ 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 - name: Release Changelog Builder
if: ${{!env.prerelease}} id: changelog
id: changelog1 uses: mikepenz/release-changelog-builder-action@v3.5.0
uses: metcalfc/changelog-generator@v3.0.0 env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with: with:
myToken: ${{ secrets.GITHUB_TOKEN }} # ignorePreReleases: true
commitMode: true
- name: Set outputs - name: Set outputs
id: vars id: vars
@ -90,20 +96,6 @@ jobs:
echo "::set-output name=release_time_clock::$(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
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 # tag 上传Release
- name: uploadRelease - name: uploadRelease
uses: svenstaro/upload-release-action@v2 uses: svenstaro/upload-release-action@v2
@ -133,5 +125,4 @@ jobs:
Filename pattern: **[Qt version]-GoldenDict-[OS]-[release-date].[ext]** Filename pattern: **[Qt version]-GoldenDict-[OS]-[release-date].[ext]**
CHANGES: CHANGES:
${{ steps.changelog1.outputs.changelog }} ${{ steps.changelog.outputs.changelog }}
${{ steps.changelog2.outputs.COMMIT_SUMMARY }}

View file

@ -271,6 +271,11 @@ jobs:
brew install xz lzo brew install xz lzo
brew install pkg-config brew install pkg-config
brew install create-dmg 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 - name: compile
run: | 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 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

View file

@ -58,6 +58,13 @@ jobs:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
with: with:
fetch-depth: 0 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 - name: build macos
run: | run: |
brew uninstall opencc hunspell ffmpeg@5 ffmpeg@4 libtiff xz lzo libogg libvorbis zstd || true brew uninstall opencc hunspell ffmpeg@5 ffmpeg@4 libtiff xz lzo libogg libvorbis zstd || true
@ -75,12 +82,14 @@ jobs:
mv ${targetName}.app ./tmp mv ${targetName}.app ./tmp
# --background "installer_background.png" # --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/ 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 - name: Release Changelog Builder
if: ${{!env.prerelease}} id: changelog
id: changelog1 uses: mikepenz/release-changelog-builder-action@v3.5.0
uses: metcalfc/changelog-generator@v3.0.0 env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with: with:
myToken: ${{ secrets.GITHUB_TOKEN }} # ignorePreReleases: true
commitMode: true
- name: Set outputs - name: Set outputs
id: vars id: vars
@ -91,20 +100,6 @@ jobs:
echo "::set-output name=release_time_clock::$(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
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 # tag 上传Release
- name: uploadRelease - name: uploadRelease
uses: svenstaro/upload-release-action@v2 uses: svenstaro/upload-release-action@v2
@ -134,5 +129,4 @@ jobs:
Filename pattern: **[Qt version]-GoldenDict-[OS]-[release-date].[ext]** Filename pattern: **[Qt version]-GoldenDict-[OS]-[release-date].[ext]**
CHANGES: CHANGES:
${{ steps.changelog1.outputs.changelog }} ${{ steps.changelog.outputs.changelog }}
${{ steps.changelog2.outputs.COMMIT_SUMMARY }}

View file

@ -67,6 +67,12 @@ jobs:
with: with:
fetch-depth: 0 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 - name: build goldendict
run: | run: |
qmake CONFIG+=release CONFIG+=no_extra_tiff_handler PREFIX=/usr CONFIG+=zim_support CONFIG+=chinese_conversion_support 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 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 ./linuxdeploy-x86_64.AppImage --appdir appdir --output appimage --plugin qt -i redist/icons/goldendict.png -d redist/org.goldendict.GoldenDict.desktop
- name: Generate changelog - name: Release Changelog Builder
if: ${{!env.prerelease}} id: changelog
id: changelog1 uses: mikepenz/release-changelog-builder-action@v3.5.0
uses: metcalfc/changelog-generator@v3.0.0 env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with: with:
myToken: ${{ secrets.GITHUB_TOKEN }} # ignorePreReleases: true
commitMode: true
- name: Set outputs - name: Set outputs
id: vars id: vars
@ -98,20 +106,6 @@ jobs:
echo "::set-output name=release_hm::$(date +'%y%m%d')" echo "::set-output name=release_hm::$(date +'%y%m%d')"
echo "::set-output name=appname::$(ls *.AppImage*)" 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 - name: uploadRelease
# if: startsWith(github.event.ref, 'refs/tags/') # if: startsWith(github.event.ref, 'refs/tags/')
uses: svenstaro/upload-release-action@v2 uses: svenstaro/upload-release-action@v2
@ -141,5 +135,4 @@ jobs:
Filename pattern: **[Qt version]-GoldenDict-[OS]-[release-date].[ext]** Filename pattern: **[Qt version]-GoldenDict-[OS]-[release-date].[ext]**
CHANGES: CHANGES:
${{ steps.changelog1.outputs.changelog }} ${{ steps.changelog.outputs.changelog }}
${{ steps.changelog2.outputs.COMMIT_SUMMARY }}

View file

@ -59,6 +59,12 @@ jobs:
with: with:
fetch-depth: 0 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 - name: build goldendict
run: | run: |
qmake CONFIG+=release CONFIG+=no_extra_tiff_handler PREFIX=/usr CONFIG+=zim_support CONFIG+=chinese_conversion_support 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 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 ./linuxdeploy-x86_64.AppImage --appdir appdir --output appimage --plugin qt -i redist/icons/goldendict.png -d redist/org.goldendict.GoldenDict.desktop
- name: Generate changelog - name: Release Changelog Builder
if: ${{!env.prerelease}} id: changelog
id: changelog1 uses: mikepenz/release-changelog-builder-action@v3.5.0
uses: metcalfc/changelog-generator@v3.0.0 env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with: with:
myToken: ${{ secrets.GITHUB_TOKEN }} # ignorePreReleases: true
commitMode: true
- name: Set outputs - name: Set outputs
id: vars id: vars
run: | run: |
@ -94,20 +101,6 @@ jobs:
echo "::set-output name=release_hm::$(date +'%y%m%d')" echo "::set-output name=release_hm::$(date +'%y%m%d')"
echo "::set-output name=appname::$(ls *.AppImage*)" 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 - name: uploadRelease
# if: startsWith(github.event.ref, 'refs/tags/') # if: startsWith(github.event.ref, 'refs/tags/')
uses: svenstaro/upload-release-action@v2 uses: svenstaro/upload-release-action@v2
@ -137,5 +130,4 @@ jobs:
Filename pattern: **[Qt version]-GoldenDict-[OS]-[release-date].[ext]** Filename pattern: **[Qt version]-GoldenDict-[OS]-[release-date].[ext]**
CHANGES: CHANGES:
${{ steps.changelog1.outputs.changelog }} ${{ steps.changelog.outputs.changelog }}
${{ steps.changelog2.outputs.COMMIT_SUMMARY }}

View file

@ -51,13 +51,14 @@ jobs:
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Generate changelog - name: Release Changelog Builder
if: ${{!env.prerelease}} id: changelog
id: changelog1 uses: mikepenz/release-changelog-builder-action@v3.5.0
uses: metcalfc/changelog-generator@v3.0.0 env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with: with:
myToken: ${{ secrets.GITHUB_TOKEN }} # ignorePreReleases: true
commitMode: true
- name: Set outputs - name: Set outputs
id: vars id: vars
shell: bash shell: bash
@ -68,21 +69,14 @@ jobs:
echo "::set-output name=release_time_clock::$(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 - name: version-file
if: $${{env.prerelease}}
id: changelog2
shell: bash shell: bash
run: | run: |
previousTag=$(git tag --sort=-creatordate | sed -n 2p) previousTag=$(git tag --sort=-creatordate | sed -n 1p |cut -c 2-)
echo "previousTag : $previousTag" echo "$previousTag">version.txt
cat version.txt
CHANGELOG="$(git log --oneline --no-decorate $previousTag..HEAD)" pwd
CHANGELOG="${CHANGELOG//'%'/'%25'}" ls
CHANGELOG="${CHANGELOG//$'\n'/'%0A'}"
CHANGELOG="${CHANGELOG//$'\r'/'%0D'}"
CHANGELOG="${CHANGELOG//'\"'/'%22'}"
CHANGELOG="${CHANGELOG//"'"/ }"
echo "::set-output name=COMMIT_SUMMARY::$(echo "$CHANGELOG")"
# # msvc编译 # # msvc编译
- uses: ilammy/msvc-dev-cmd@v1 - uses: ilammy/msvc-dev-cmd@v1
@ -143,8 +137,7 @@ jobs:
Filename pattern: **[Qt version]-GoldenDict-[OS]-[release-date].[ext]** Filename pattern: **[Qt version]-GoldenDict-[OS]-[release-date].[ext]**
CHANGES: CHANGES:
${{ steps.changelog1.outputs.changelog }} ${{ steps.changelog.outputs.changelog }}
${{ steps.changelog2.outputs.COMMIT_SUMMARY }}
- name: upload goldendict.exe only - name: upload goldendict.exe only
# if: startsWith(github.event.ref, 'refs/tags/') # if: startsWith(github.event.ref, 'refs/tags/')

View file

@ -51,12 +51,6 @@ jobs:
with: with:
fetch-depth: 0 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 - name: Set outputs
id: vars id: vars
@ -68,21 +62,20 @@ jobs:
echo "::set-output name=release_time_clock::$(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 - name: Release Changelog Builder
if: $${{env.prerelease}} id: changelog
id: changelog2 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 shell: bash
run: | run: |
previousTag=$(git tag --sort=-creatordate | sed -n 2p) previousTag=$(git tag --sort=-creatordate | sed -n 1p |cut -c 2-)
echo "previousTag : $previousTag" 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编译 # # msvc编译
- uses: ilammy/msvc-dev-cmd@v1 - uses: ilammy/msvc-dev-cmd@v1
@ -143,8 +136,7 @@ jobs:
Filename pattern: **[Qt version]-GoldenDict-[OS]-[release-date].[ext]** Filename pattern: **[Qt version]-GoldenDict-[OS]-[release-date].[ext]**
CHANGES: CHANGES:
${{ steps.changelog1.outputs.changelog }} ${{ steps.changelog.outputs.changelog }}
${{ steps.changelog2.outputs.COMMIT_SUMMARY }}
- name: upload goldendict.exe only - name: upload goldendict.exe only
# if: startsWith(github.event.ref, 'refs/tags/') # if: startsWith(github.event.ref, 'refs/tags/')

View file

@ -54,12 +54,14 @@ jobs:
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Generate changelog - name: Release Changelog Builder
if: ${{!env.prerelease}} id: changelog
id: changelog1 uses: mikepenz/release-changelog-builder-action@v3.5.0
uses: metcalfc/changelog-generator@v3.0.0 env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with: with:
myToken: ${{ secrets.GITHUB_TOKEN }} # ignorePreReleases: true
commitMode: true
- name: Set outputs - name: Set outputs
id: vars id: vars
@ -71,21 +73,12 @@ jobs:
echo "::set-output name=release_time_clock::$(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 - name: version-file
if: $${{env.prerelease}}
id: changelog2
shell: bash shell: bash
run: | run: |
previousTag=$(git tag --sort=-creatordate | sed -n 2p) previousTag=$(git tag --sort=-creatordate | sed -n 1p |cut -c 2-)
echo "previousTag : $previousTag" 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")"
- uses: ilammy/msvc-dev-cmd@v1 - uses: ilammy/msvc-dev-cmd@v1
# msvc编译 # msvc编译
- name: msvc-build goldendict - name: msvc-build goldendict
@ -142,8 +135,7 @@ jobs:
Filename pattern: **[Qt version]-GoldenDict-[OS]-[release-date].[ext]** Filename pattern: **[Qt version]-GoldenDict-[OS]-[release-date].[ext]**
CHANGES: CHANGES:
${{ steps.changelog1.outputs.changelog }} ${{ steps.changelog.outputs.changelog }}
${{ steps.changelog2.outputs.COMMIT_SUMMARY }}
- name: upload goldendict.exe only - name: upload goldendict.exe only
# if: startsWith(github.event.ref, 'refs/tags/') # if: startsWith(github.event.ref, 'refs/tags/')
uses: svenstaro/upload-release-action@v2 uses: svenstaro/upload-release-action@v2

View file

@ -182,14 +182,24 @@ InputPhrase Preferences::sanitizeInputPhrase( QString const & inputPhrase ) cons
{ {
InputPhrase result; 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.", 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; return result;
} }
const QString withPunct = inputPhrase.simplified(); const QString withPunct = _phase.simplified();
result.phrase = gd::toQString( Folding::trimWhitespaceOrPunct( gd::toWString( withPunct ) ) ); result.phrase = gd::toQString( Folding::trimWhitespaceOrPunct( gd::toWString( withPunct ) ) );
if ( !result.isValid() ) if ( !result.isValid() )
return result; // The suffix of an invalid input phrase must be empty. return result; // The suffix of an invalid input phrase must be empty.
@ -267,6 +277,7 @@ Preferences::Preferences():
, inputPhraseLengthLimit( 1000 ) , inputPhraseLengthLimit( 1000 )
, maxDictionaryRefsInContextMenu ( 20 ) , maxDictionaryRefsInContextMenu ( 20 )
, synonymSearchEnabled( true ) , synonymSearchEnabled( true )
, stripClipboard( false )
{ {
} }
@ -1005,6 +1016,9 @@ Class load()
if ( !preferences.namedItem( "synonymSearchEnabled" ).isNull() ) if ( !preferences.namedItem( "synonymSearchEnabled" ).isNull() )
c.preferences.synonymSearchEnabled = ( preferences.namedItem( "synonymSearchEnabled" ).toElement().text() == "1" ); 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" ); QDomNode fts = preferences.namedItem( "fullTextSearch" );
if ( !fts.isNull() ) if ( !fts.isNull() )
@ -1960,6 +1974,10 @@ void save( Class const & c )
opt.appendChild( dd.createTextNode( c.preferences.synonymSearchEnabled ? "1" : "0" ) ); opt.appendChild( dd.createTextNode( c.preferences.synonymSearchEnabled ? "1" : "0" ) );
preferences.appendChild( opt ); preferences.appendChild( opt );
opt = dd.createElement( "stripClipboard" );
opt.appendChild( dd.createTextNode( c.preferences.stripClipboard ? "1" : "0" ) );
preferences.appendChild( opt );
{ {
QDomNode hd = dd.createElement( "fullTextSearch" ); QDomNode hd = dd.createElement( "fullTextSearch" );
preferences.appendChild( hd ); preferences.appendChild( hd );

View file

@ -372,6 +372,7 @@ struct Preferences
unsigned short maxDictionaryRefsInContextMenu; unsigned short maxDictionaryRefsInContextMenu;
bool synonymSearchEnabled; bool synonymSearchEnabled;
bool stripClipboard;
QString addonStyle; QString addonStyle;

View file

@ -63,6 +63,7 @@
#include <QWebEngineSettings> #include <QWebEngineSettings>
#include <QWebEngineProfile> #include <QWebEngineProfile>
#include <QProxyStyle>
#ifdef HAVE_X11 #ifdef HAVE_X11
#if (QT_VERSION >= QT_VERSION_CHECK(6,0,0)) #if (QT_VERSION >= QT_VERSION_CHECK(6,0,0))
@ -1209,7 +1210,7 @@ void MainWindow::applyQtStyleSheet( QString const & displayStyle, QString const
else else
{ {
#ifdef Q_OS_WIN32 #ifdef Q_OS_WIN32
qApp->setStyle( QStyleFactory::create( "Windows" ) ); qApp->setStyle( new QProxyStyle() );
#endif #endif
qApp->setPalette( QPalette() ); qApp->setPalette( QPalette() );
} }

View file

@ -227,6 +227,8 @@ Preferences::Preferences( QWidget * parent, Config::Class & cfg_ ):
ui.synonymSearchEnabled->setChecked( p.synonymSearchEnabled ); ui.synonymSearchEnabled->setChecked( p.synonymSearchEnabled );
ui.stripClipboard->setChecked( p.stripClipboard );
ui.maxDictsInContextMenu->setValue( p.maxDictionaryRefsInContextMenu ); ui.maxDictsInContextMenu->setValue( p.maxDictionaryRefsInContextMenu );
// Different platforms have different keys available // Different platforms have different keys available
@ -443,6 +445,7 @@ Config::Preferences Preferences::getPreferences()
p.inputPhraseLengthLimit = ui.inputPhraseLengthLimit->value(); p.inputPhraseLengthLimit = ui.inputPhraseLengthLimit->value();
p.ignoreDiacritics = ui.ignoreDiacritics->isChecked(); p.ignoreDiacritics = ui.ignoreDiacritics->isChecked();
p.ignorePunctuation = ui.ignorePunctuation->isChecked(); p.ignorePunctuation = ui.ignorePunctuation->isChecked();
p.stripClipboard = ui.stripClipboard->isChecked();
p.synonymSearchEnabled = ui.synonymSearchEnabled->isChecked(); p.synonymSearchEnabled = ui.synonymSearchEnabled->isChecked();

View file

@ -1743,6 +1743,13 @@ from Stardict, Babylon and GLS dictionaries</string>
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QCheckBox" name="stripClipboard">
<property name="text">
<string>When using clipboard,strip everything after newline</string>
</property>
</widget>
</item>
<item> <item>
<spacer name="verticalSpacer_17"> <spacer name="verticalSpacer_17">
<property name="orientation"> <property name="orientation">