Skip to content

Commit

Permalink
Merge f6cf152 into e376675
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoyifang authored Apr 24, 2022
2 parents e376675 + f6cf152 commit 644bb70
Show file tree
Hide file tree
Showing 18 changed files with 153 additions and 102 deletions.
3 changes: 2 additions & 1 deletion .github/scripts/windows-publish.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ function Main() {
# 拷贝依赖
windeployqt --qmldir . --plugindir $archiveName\plugins --compiler-runtime $archiveName\$targetName
# 删除不必要的文件
$excludeList = @("*.qmlc", "*.ilk", "*.exp", "*.lib", "*.pdb")
# $excludeList = @("*.qmlc", "*.ilk", "*.exp", "*.lib", "*.pdb")
$excludeList = @("*.qmlc", "*.ilk", "*.exp", "*.lib")
Remove-Item -Path $archiveName -Include $excludeList -Recurse -Force
Write-Host "remove item finished..."
# 拷贝vcRedist dll
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/AutoTag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
runs-on: ubuntu-latest

env:
version: 22.4.19-alpha
version: 22.4.24-alpha
# 步骤
steps:
- uses: actions/checkout@v3
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/macos-6.2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
qt_arch: [clang_64]
env:
targetName: GoldenDict
version: 22.4.19-alpha
version: 22.4.24-alpha

steps:
# macos 11.0 默认环境变了,要指定
Expand Down Expand Up @@ -107,15 +107,15 @@ jobs:
asset_name: ${{ matrix.qt_ver }}-${{ env.targetName }}_${{ matrix.os }}_${{ steps.vars.outputs.sha_short }}.dmg
tag: v${{env.version}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
overwrite: true
release_name: win-linux-macos-${{steps.vars.outputs.release_date}}
release_name: GoldenDict-v${{env.version}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
prerelease: true
body: |
release on date: ${{steps.vars.outputs.release_date}} time: ${{steps.vars.outputs.release_time_clock}}
branch: ${{ github.ref_name }}
commit: ${{ steps.vars.outputs.sha_short }}
Qt version: ${{ matrix.qt_ver }} ${{ matrix.qt_arch }}
Windows built with: msvc64 Visual studio 2019
# goldendict.exe can not used alone
## goldendict.exe can not be used alone
if you have a previous version. replace this maybe ok. if not ,download the whole bundle.
AppImage built with: Ubuntu-20.04 ,latest gcc
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
qt_arch: [clang_64]
env:
targetName: GoldenDict
version: 22.4.19-alpha
version: 22.4.24-alpha

steps:
# macos 11.0 默认环境变了,要指定
Expand Down Expand Up @@ -109,15 +109,15 @@ jobs:
asset_name: ${{ matrix.qt_ver }}-${{ env.targetName }}_${{ matrix.os }}_${{ steps.vars.outputs.sha_short }}.dmg
tag: v${{env.version}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
overwrite: true
release_name: win-linux-macos-${{steps.vars.outputs.release_date}}
release_name: GoldenDict-v${{env.version}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
prerelease: true
body: |
release on date: ${{steps.vars.outputs.release_date}} time: ${{steps.vars.outputs.release_time_clock}}
branch: ${{ github.ref_name }}
commit: ${{ steps.vars.outputs.sha_short }}
Qt version: ${{ matrix.qt_ver }} ${{ matrix.qt_arch }}
Windows built with: msvc64 Visual studio 2019
## goldendict.exe can not used alone
## goldendict.exe can not be used alone
if you have a previous version. replace this maybe ok. if not ,download the whole bundle.
AppImage built with: Ubuntu-20.04 ,latest gcc
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ubuntu-6.2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
qt_ver: [6.2.4,6.3.0]
qt_arch: [gcc_64]
env:
version: 22.4.19-alpha
version: 22.4.24-alpha
steps:
- name: Install Qt
uses: jurplel/install-qt-action@v3
Expand Down Expand Up @@ -113,15 +113,15 @@ jobs:
asset_name: ${{ matrix.qt_ver }}-${{ steps.vars.outputs.appname }}
tag: v${{env.version}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
overwrite: true
release_name: win-linux-macos-${{steps.vars.outputs.release_date}}
release_name: GoldenDict-v${{env.version}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
prerelease: true
body: |
release on date: ${{steps.vars.outputs.release_date}} time: ${{steps.vars.outputs.release_time_clock}}
branch: ${{ github.ref_name }}
commit: ${{ steps.vars.outputs.sha_short }}
Qt version: ${{ matrix.qt_ver }} ${{ matrix.qt_arch }}
Windows built with: msvc64 Visual studio 2019
# goldendict.exe can not used alone
## goldendict.exe can not be used alone
if you have a previous version. replace this maybe ok. if not ,download the whole bundle.
AppImage built with: Ubuntu-20.04 ,latest gcc
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
qt_ver: [5.15.2]
qt_arch: [gcc_64]
env:
version: 22.4.19-alpha
version: 22.4.24-alpha
steps:
- name: Install Qt
uses: jurplel/install-qt-action@v3
Expand Down Expand Up @@ -110,15 +110,15 @@ jobs:
asset_name: ${{ matrix.qt_ver }}-${{ steps.vars.outputs.appname }}
tag: v${{env.version}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
overwrite: true
release_name: win-linux-macos-${{steps.vars.outputs.release_date}}
release_name: GoldenDict-v${{env.version}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
prerelease: true
body: |
release on date: ${{steps.vars.outputs.release_date}} time: ${{steps.vars.outputs.release_time_clock}}
branch: ${{ github.ref_name }}
commit: ${{ steps.vars.outputs.sha_short }}
Qt version: ${{ matrix.qt_ver }} ${{ matrix.qt_arch }}
Windows built with: msvc64 Visual studio 2019
## goldendict.exe can not used alone
## goldendict.exe can not be used alone
if you have a previous version. replace this maybe ok. if not ,download the whole bundle.
AppImage built with: Ubuntu-20.04 ,latest gcc
Expand Down
20 changes: 9 additions & 11 deletions .github/workflows/windows-6.2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,21 @@ jobs:
qt_arch_install: msvc2019_64
env:
targetName: GoldenDict.exe
version: 22.4.19-alpha
# 步骤
version: 22.4.24-alpha
steps:
# 安装Qt
- uses: actions/setup-python@v3
with:
python-version: '3.9'
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
# Version of Qt to install
version: ${{ matrix.qt_ver }}
# Target platform for build
# target: ${{ matrix.qt_target }}
arch: ${{ matrix.qt_arch }}
cached: 'false'
modules: qtwebengine qtwebchannel qtpositioning qt5compat qtmultimedia qtimageformats
# 拉取代码
setup-python: 'false'
py7zrversion: '==0.18.1'
- uses: actions/checkout@v3
with:
fetch-depth: 0
Expand Down Expand Up @@ -115,13 +115,11 @@ jobs:
& .github\scripts\windows-publish.ps1 ${env:archiveName} ${env:targetName}
$name = ${env:archiveName}
echo "::set-output name=packageName::$name"
# tag 查询github-Release
# 上传artifacts
# - uses: actions/upload-artifact@v2
# with:
# name: ${{ steps.package.outputs.packageName }}
# path: ${{ steps.package.outputs.packageName }}.zip
# tag 上传Release
- name: uploadRelease
# if: startsWith(github.event.ref, 'refs/tags/')
uses: svenstaro/upload-release-action@v2
Expand All @@ -131,7 +129,7 @@ jobs:
asset_name: ${{ matrix.qt_ver }}-${{ steps.package.outputs.packageName }}.zip
tag: v${{env.version}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
overwrite: true
release_name: win-linux-macos-${{steps.vars.outputs.release_date}}
release_name: GoldenDict-v${{env.version}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
prerelease: true
body: |
release on date: ${{steps.vars.outputs.release_date}} time: ${{steps.vars.outputs.release_time_clock}}
Expand All @@ -151,7 +149,7 @@ jobs:
asset_name: ${{ matrix.qt_ver }}-${{ env.targetName }}
tag: v${{env.version}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
overwrite: true
release_name: win-linux-macos-${{steps.vars.outputs.release_date}}
release_name: GoldenDict-v${{env.version}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
prerelease: true
body: |
release on date: ${{steps.vars.outputs.release_date}} time: ${{steps.vars.outputs.release_time_clock}}
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
qt_arch_install: msvc2019_64
env:
targetName: GoldenDict.exe
version: 22.4.19-alpha
version: 22.4.24-alpha
# 步骤
steps:
# 安装Qt
Expand Down Expand Up @@ -125,15 +125,15 @@ jobs:
asset_name: ${{ matrix.qt_ver }}-${{ steps.package.outputs.packageName }}.zip
tag: v${{env.version}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
overwrite: true
release_name: win-linux-macos-${{steps.vars.outputs.release_date}}
release_name: GoldenDict-v${{env.version}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
prerelease: true
body: |
release on date: ${{steps.vars.outputs.release_date}} time: ${{steps.vars.outputs.release_time_clock}}
branch: ${{ github.ref_name }}
commit: ${{ steps.vars.outputs.sha_short }}
Qt version: ${{ matrix.qt_ver }} ${{ matrix.qt_arch }}
Windows built with: msvc64 Visual studio 2019
## goldendict.exe can not used alone
## goldendict.exe can not be used alone
if you have a previous version. replace this maybe ok. if not ,download the whole bundle.
AppImage built with: Ubuntu-20.04 ,latest gcc
Expand All @@ -150,15 +150,15 @@ jobs:
asset_name: ${{ matrix.qt_ver }}-${{ env.targetName }}
tag: v${{env.version}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
overwrite: true
release_name: win-linux-macos-${{steps.vars.outputs.release_date}}
release_name: GoldenDict-v${{env.version}}.${{ steps.vars.outputs.release_hm }}.${{ steps.vars.outputs.sha_short }}
prerelease: true
body: |
release on date: ${{steps.vars.outputs.release_date}} time: ${{steps.vars.outputs.release_time_clock}}
branch: ${{ github.ref_name }}
commit: ${{ steps.vars.outputs.sha_short }}
Qt version: ${{ matrix.qt_ver }} ${{ matrix.qt_arch }}
Windows built with: msvc64 Visual studio 2019
## goldendict.exe can not used alone
## goldendict.exe can not be used alone
if you have a previous version. replace this maybe ok. if not ,download the whole bundle.
AppImage built with: Ubuntu-20.04 ,latest gcc
Expand Down
7 changes: 7 additions & 0 deletions btreeidx.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

#include <QRegularExpression>
#include "wildcard.hh"
#include "globalbroadcaster.h"

//#define __BTREE_USE_LZO
// LZO mode is experimental and unsupported. Tests didn't show any substantial
Expand Down Expand Up @@ -853,6 +854,9 @@ void BtreeIndex::antialias( wstring const & str,
if( ignoreDiacritics )
caseFolded = Folding::applyDiacriticsOnly( caseFolded );

if(GlobalBroadcaster::instance()->getPreference()->ignorePunctuation)
caseFolded = Folding::trimWhitespaceOrPunct( caseFolded );

for( unsigned x = chain.size(); x--; )
{
// If after applying case folding to each word they wouldn't match, we
Expand All @@ -861,6 +865,9 @@ void BtreeIndex::antialias( wstring const & str,
if( ignoreDiacritics )
entry = Folding::applyDiacriticsOnly( entry );

if( GlobalBroadcaster::instance()->getPreference()->ignorePunctuation )
entry = Folding::trimWhitespaceOrPunct( entry );

if ( entry != caseFolded )
chain.erase( chain.begin() + x );
else
Expand Down
7 changes: 7 additions & 0 deletions config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ Preferences::Preferences():
scanPopupUnpinnedBypassWMHint( false ),
scanToMainWindow( false ),
ignoreDiacritics( false ),
ignorePunctuation( false ),
#ifdef HAVE_X11
showScanFlag( false ),
#endif
Expand Down Expand Up @@ -891,6 +892,8 @@ Class load()
c.preferences.ignoreOwnClipboardChanges = ( preferences.namedItem( "ignoreOwnClipboardChanges" ).toElement().text() == "1" );
c.preferences.scanToMainWindow = ( preferences.namedItem( "scanToMainWindow" ).toElement().text() == "1" );
c.preferences.ignoreDiacritics = ( preferences.namedItem( "ignoreDiacritics" ).toElement().text() == "1" );
if( !preferences.namedItem( "ignorePunctuation" ).isNull() )
c.preferences.ignorePunctuation = ( preferences.namedItem( "ignorePunctuation" ).toElement().text() == "1" );
#ifdef HAVE_X11
c.preferences.showScanFlag= ( preferences.namedItem( "showScanFlag" ).toElement().text() == "1" );
#endif
Expand Down Expand Up @@ -1763,6 +1766,10 @@ void save( Class const & c )
opt.appendChild( dd.createTextNode( c.preferences.ignoreDiacritics ? "1":"0" ) );
preferences.appendChild( opt );

opt = dd.createElement( "ignorePunctuation" );
opt.appendChild( dd.createTextNode( c.preferences.ignorePunctuation ? "1":"0" ) );
preferences.appendChild( opt );

#ifdef HAVE_X11
opt = dd.createElement( "showScanFlag" );
opt.appendChild( dd.createTextNode( c.preferences.showScanFlag? "1":"0" ) );
Expand Down
1 change: 1 addition & 0 deletions config.hh
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ struct Preferences
bool scanPopupUnpinnedBypassWMHint;
bool scanToMainWindow;
bool ignoreDiacritics;
bool ignorePunctuation;
#ifdef HAVE_X11
bool showScanFlag;
#endif
Expand Down
20 changes: 14 additions & 6 deletions globalbroadcaster.cpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
#include "globalbroadcaster.h"
#include <QGlobalStatic>


Q_GLOBAL_STATIC(GlobalBroadcaster, bdcaster)
GlobalBroadcaster::GlobalBroadcaster(QObject *parent) : QObject(parent)
Q_GLOBAL_STATIC( GlobalBroadcaster, bdcaster )
GlobalBroadcaster::GlobalBroadcaster( QObject * parent ) : QObject( parent )
{

}


GlobalBroadcaster* GlobalBroadcaster::instance() { return bdcaster; }
GlobalBroadcaster * GlobalBroadcaster::instance()
{
return bdcaster;
}
void GlobalBroadcaster::setPreference( Config::Preferences * p )
{
preference = p;
}
Config::Preferences * GlobalBroadcaster::getPreference()
{
return preference;
}

// namespace global
20 changes: 12 additions & 8 deletions globalbroadcaster.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,27 @@
#define GLOBAL_GLOBALBROADCASTER_H

#include <QObject>
#include "config.hh"

struct ActiveDictIds {
struct ActiveDictIds
{
QString word;
QStringList dictIds;
}
;
};

class GlobalBroadcaster : public QObject
{
Q_OBJECT
private:
Config::Preferences * preference;

public:
GlobalBroadcaster(QObject *parent = nullptr);
static GlobalBroadcaster *instance();
void setPreference( Config::Preferences * _pre );
Config::Preferences * getPreference();
GlobalBroadcaster( QObject * parent = nullptr );
static GlobalBroadcaster * instance();
signals:
void emitDictIds(ActiveDictIds ad);

void emitDictIds( ActiveDictIds ad );
};


#endif // GLOBAL_GLOBALBROADCASTER_H
11 changes: 7 additions & 4 deletions goldendict.pro
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
TEMPLATE = app
TARGET = goldendict
VERSION = 22.4.19-alpha
VERSION = 22.4.24-alpha

# Generate version file. We do this here and in a build rule described later.
# The build rule is required since qmake isn't run each time the project is
Expand Down Expand Up @@ -42,7 +42,7 @@ DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x050F00
DEFINES += MAKE_FFMPEG_PLAYER
}

QT += sql
#QT += sql
CONFIG += exceptions \
rtti \
stl \
Expand Down Expand Up @@ -70,14 +70,17 @@ win32 {
TARGET = GoldenDict

win32-msvc* {
VERSION = 22.4.19 # VS does not recognize 22.number.alpha,cause errors during compilation under MSVC++
VERSION = 22.4.24 # VS does not recognize 22.number.alpha,cause errors during compilation under MSVC++
DEFINES += __WIN32 _CRT_SECURE_NO_WARNINGS
contains(QMAKE_TARGET.arch, x86_64) {
DEFINES += NOMINMAX __WIN64
}
LIBS += -L$${PWD}/winlibs/lib/msvc
QMAKE_CXXFLAGS += /wd4290 # silence the warning C4290: C++ exception specification ignored
QMAKE_LFLAGS_RELEASE += /OPT:REF /OPT:ICF
# QMAKE_LFLAGS_RELEASE += /OPT:REF /OPT:ICF
# QMAKE_LFLAGS_RELEASE = /INCREMENTAL:NO /DEBUG
QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO
QMAKE_LFLAGS_RELEASE = $$QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO
DEFINES += GD_NO_MANIFEST
# QMAKE_CXXFLAGS_RELEASE += /GL # slows down the linking significantly
LIBS += -lshell32 -luser32 -lsapi -lole32
Expand Down
Loading

0 comments on commit 644bb70

Please sign in to comment.