diff --git a/.github/workflows/macos-6.x.yml b/.github/workflows/macos-6.x.yml index db2797a3..8c4bffe5 100644 --- a/.github/workflows/macos-6.x.yml +++ b/.github/workflows/macos-6.x.yml @@ -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 }} diff --git a/.github/workflows/macos-homebrew.yml b/.github/workflows/macos-homebrew.yml index d203cbb4..89014914 100644 --- a/.github/workflows/macos-homebrew.yml +++ b/.github/workflows/macos-homebrew.yml @@ -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 diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 6e1405d3..779d6a38 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -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 }} diff --git a/.github/workflows/ubuntu-6.2.yml b/.github/workflows/ubuntu-6.2.yml index 5ffcd5ba..bee1e66d 100644 --- a/.github/workflows/ubuntu-6.2.yml +++ b/.github/workflows/ubuntu-6.2.yml @@ -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 }} diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 0a01f145..15097a58 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -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 }} diff --git a/.github/workflows/windows-6.x-xapian.yml b/.github/workflows/windows-6.x-xapian.yml index b89d19a1..73ee62d7 100644 --- a/.github/workflows/windows-6.x-xapian.yml +++ b/.github/workflows/windows-6.x-xapian.yml @@ -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/') diff --git a/.github/workflows/windows-6.x.yml b/.github/workflows/windows-6.x.yml index 5ba1b6a9..c5e28085 100644 --- a/.github/workflows/windows-6.x.yml +++ b/.github/workflows/windows-6.x.yml @@ -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/') diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 3d90b924..be54baca 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -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 diff --git a/config.cc b/config.cc index 48ca3103..ee7f1358 100644 --- a/config.cc +++ b/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 ); diff --git a/config.hh b/config.hh index b2ce2d7c..71b39ed4 100644 --- a/config.hh +++ b/config.hh @@ -372,6 +372,7 @@ struct Preferences unsigned short maxDictionaryRefsInContextMenu; bool synonymSearchEnabled; + bool stripClipboard; QString addonStyle; diff --git a/mainwindow.cc b/mainwindow.cc index 6511c672..c6e8a780 100644 --- a/mainwindow.cc +++ b/mainwindow.cc @@ -63,6 +63,7 @@ #include #include +#include #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() ); } diff --git a/preferences.cc b/preferences.cc index f08380b5..4c5cffc3 100644 --- a/preferences.cc +++ b/preferences.cc @@ -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(); diff --git a/preferences.ui b/preferences.ui index f3c0403b..4a670971 100644 --- a/preferences.ui +++ b/preferences.ui @@ -1743,6 +1743,13 @@ from Stardict, Babylon and GLS dictionaries + + + + When using clipboard,strip everything after newline + + +