From fc0ad8387965ce70d37928523974ba803905aa7f Mon Sep 17 00:00:00 2001 From: xiaoyifang Date: Mon, 12 Dec 2022 09:47:47 +0800 Subject: [PATCH 1/6] winspecific: revert darkmode regression ,keep windows default style when starting in windows for the first time --- mainwindow.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mainwindow.cc b/mainwindow.cc index 6511c672..1fd596d8 100644 --- a/mainwindow.cc +++ b/mainwindow.cc @@ -1208,9 +1208,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( QStyleFactory::create( "Windows" ) ); + // #endif qApp->setPalette( QPalette() ); } From f0a6bc077ba7785e3b17b4a5a036a163b2091599 Mon Sep 17 00:00:00 2001 From: xiaoyifang Date: Mon, 12 Dec 2022 14:42:09 +0800 Subject: [PATCH 2/6] change version.txt to latest git tag --- .github/workflows/macos-6.x.yml | 6 +++++- .github/workflows/macos-homebrew.yml | 5 +++++ .github/workflows/macos.yml | 7 +++++++ .github/workflows/ubuntu-6.2.yml | 6 ++++++ .github/workflows/ubuntu.yml | 6 ++++++ .github/workflows/windows-6.x-xapian.yml | 6 ++++++ .github/workflows/windows-6.x.yml | 6 ++++++ .github/workflows/windows.yml | 7 +++++++ 8 files changed, 48 insertions(+), 1 deletion(-) diff --git a/.github/workflows/macos-6.x.yml b/.github/workflows/macos-6.x.yml index db2797a3..bf20039d 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 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..f12896c2 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 diff --git a/.github/workflows/ubuntu-6.2.yml b/.github/workflows/ubuntu-6.2.yml index 5ffcd5ba..57e15bf4 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 diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 0a01f145..6dae1f08 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 diff --git a/.github/workflows/windows-6.x-xapian.yml b/.github/workflows/windows-6.x-xapian.yml index b89d19a1..44c876e5 100644 --- a/.github/workflows/windows-6.x-xapian.yml +++ b/.github/workflows/windows-6.x-xapian.yml @@ -84,6 +84,12 @@ jobs: CHANGELOG="${CHANGELOG//"'"/ }" echo "::set-output name=COMMIT_SUMMARY::$(echo "$CHANGELOG")" + - name: version-file + shell: bash + run: | + previousTag=$(git tag --sort=-creatordate | sed -n 1p |cut -c 2-) + echo "$previousTag">version.txt + # # msvc编译 - uses: ilammy/msvc-dev-cmd@v1 # with: diff --git a/.github/workflows/windows-6.x.yml b/.github/workflows/windows-6.x.yml index 5ba1b6a9..921b8d95 100644 --- a/.github/workflows/windows-6.x.yml +++ b/.github/workflows/windows-6.x.yml @@ -84,6 +84,12 @@ jobs: CHANGELOG="${CHANGELOG//"'"/ }" echo "::set-output name=COMMIT_SUMMARY::$(echo "$CHANGELOG")" + - name: version-file + shell: bash + run: | + previousTag=$(git tag --sort=-creatordate | sed -n 1p |cut -c 2-) + echo "$previousTag">version.txt + # # msvc编译 - uses: ilammy/msvc-dev-cmd@v1 # with: diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 3d90b924..7a961b7e 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -86,6 +86,13 @@ jobs: CHANGELOG="${CHANGELOG//'\"'/'%22'}" CHANGELOG="${CHANGELOG//"'"/ }" echo "::set-output name=COMMIT_SUMMARY::$(echo "$CHANGELOG")" + + - name: version-file + shell: bash + run: | + 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 From dc81654257a1077b0f7a31df038d00cea4d2a036 Mon Sep 17 00:00:00 2001 From: xiaoyifang Date: Tue, 13 Dec 2022 17:29:30 +0800 Subject: [PATCH 3/6] action:changelog --- .github/workflows/macos-6.x.yml | 29 ++++++-------------- .github/workflows/macos.yml | 31 +++++++-------------- .github/workflows/ubuntu-6.2.yml | 31 +++++++-------------- .github/workflows/ubuntu.yml | 30 ++++++--------------- .github/workflows/windows-6.x-xapian.yml | 34 +++++++----------------- .github/workflows/windows-6.x.yml | 32 +++++++--------------- .github/workflows/windows.yml | 31 ++++++--------------- 7 files changed, 60 insertions(+), 158 deletions(-) diff --git a/.github/workflows/macos-6.x.yml b/.github/workflows/macos-6.x.yml index bf20039d..8c4bffe5 100644 --- a/.github/workflows/macos-6.x.yml +++ b/.github/workflows/macos-6.x.yml @@ -78,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 @@ -94,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 @@ -137,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.yml b/.github/workflows/macos.yml index f12896c2..779d6a38 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -82,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 @@ -97,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 @@ -141,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 57e15bf4..bee1e66d 100644 --- a/.github/workflows/ubuntu-6.2.yml +++ b/.github/workflows/ubuntu-6.2.yml @@ -87,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 @@ -103,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 @@ -147,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 6dae1f08..15097a58 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -83,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: | @@ -100,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 @@ -143,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 44c876e5..d017a4ad 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,7 @@ 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')" - - - name: changelog - if: $${{env.prerelease}} - id: changelog2 - 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")" + echo "::set-output name=release_hm::$(date +'%y%m%d')" - name: version-file shell: bash @@ -149,8 +134,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 921b8d95..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,21 +62,14 @@ 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 - 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")" + - 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 @@ -149,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 7a961b7e..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,22 +73,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 - 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")" - - name: version-file shell: bash run: | @@ -149,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 From 99bfb1c965f2c7cb8549354396a0cbe8d1a100f6 Mon Sep 17 00:00:00 2001 From: Xiao YiFang Date: Tue, 13 Dec 2022 20:01:18 +0800 Subject: [PATCH 4/6] fix: reset style when changed from darkmode to normal --- mainwindow.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mainwindow.cc b/mainwindow.cc index 1fd596d8..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() ); } From e107350b5136faff0a831ce67716847681ccbac0 Mon Sep 17 00:00:00 2001 From: Xiao YiFang Date: Tue, 13 Dec 2022 20:01:39 +0800 Subject: [PATCH 5/6] action: add log --- .github/workflows/windows-6.x-xapian.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/windows-6.x-xapian.yml b/.github/workflows/windows-6.x-xapian.yml index 44c876e5..7878f7f9 100644 --- a/.github/workflows/windows-6.x-xapian.yml +++ b/.github/workflows/windows-6.x-xapian.yml @@ -89,6 +89,9 @@ jobs: run: | 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 From 41d05cb27a01e176db2aaacdd057588e860c8875 Mon Sep 17 00:00:00 2001 From: Xiao YiFang Date: Tue, 13 Dec 2022 21:42:53 +0800 Subject: [PATCH 6/6] feature: enhance clipboard data processing when copied text from some applications such as Kindle PC, the copied text will have extra informations added by the application . This option used to strip the added text away --- config.cc | 24 +++++++++++++++++++++--- config.hh | 1 + preferences.cc | 3 +++ preferences.ui | 7 +++++++ 4 files changed, 32 insertions(+), 3 deletions(-) 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/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 + + +