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
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 }}

View file

@ -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

View file

@ -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
@ -91,20 +100,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
@ -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 }}

View file

@ -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
@ -98,20 +106,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
@ -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 }}

View file

@ -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 }}

View file

@ -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
@ -68,21 +69,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
- 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/')

View file

@ -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,20 @@ 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"
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
# # msvc编译
- uses: ilammy/msvc-dev-cmd@v1
@ -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/')

View file

@ -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"
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")"
- 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

View file

@ -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 );

View file

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

View file

@ -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() );
}

View file

@ -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();

View file

@ -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">