diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
new file mode 100644
index 00000000..3de5a35d
--- /dev/null
+++ b/.github/workflows/build.yml
@@ -0,0 +1,58 @@
+name: SonarCloud
+on:
+ push:
+ branches:
+ - dev
+ pull_request:
+ types: [opened, synchronize, reopened]
+jobs:
+ build:
+ name: Build and analyze
+ runs-on: ubuntu-latest
+ env:
+ BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory # Directory where build-wrapper output will be placed
+ steps:
+ - uses: actions/setup-python@v3
+ with:
+ python-version: '3.9'
+ - name: Install Qt
+ uses: jurplel/install-qt-action@v3
+ with:
+ version: 6.3.2
+ arch: gcc_64
+ cached: 'false'
+ #serialport linuxdeploy need serialport to work.
+ modules: qtwebengine qtwebchannel qtpositioning qt5compat qtmultimedia qtimageformats qtserialport
+ setup-python: 'false'
+
+ - name: ubuntu install thirdparty dependencies
+ run: |
+ sudo apt-get install git pkg-config build-essential
+ sudo apt-get install libvorbis-dev zlib1g-dev libhunspell-dev x11proto-record-dev
+ sudo apt-get install libxtst-dev liblzo2-dev libbz2-dev
+ sudo apt-get install libao-dev libavutil-dev libavformat-dev libtiff5-dev libeb16-dev
+ sudo apt-get install doxygen libzstd-dev libxkbcommon-dev libgstreamer-plugins-base1.0-0 libgstreamer-gl1.0-0
+ sudo ln -sf /usr/bin/x86_64-linux-gnu-ld.gold /usr/bin/ld
+
+ #build opencc
+ git clone https://github.com/BYVoid/OpenCC
+ cd OpenCC/
+ make PREFIX=/usr -j$(nproc)
+ sudo make install
+ cd ..
+ - uses: actions/checkout@v3
+ with:
+ fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
+ submodules: true
+ - name: Install sonar-scanner and build-wrapper
+ uses: SonarSource/sonarcloud-github-c-cpp@v1
+ - name: Run build-wrapper
+ run: |
+ cmake .
+ build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} cmake --build .
+ - name: Run sonar-scanner
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
+ run: |
+ sonar-scanner --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}"
diff --git a/editdictionaries.cc b/editdictionaries.cc
index 70b19663..a62d100d 100644
--- a/editdictionaries.cc
+++ b/editdictionaries.cc
@@ -43,7 +43,7 @@ EditDictionaries::EditDictionaries( QWidget * parent, Config::Class & cfg_,
ui.tabs->clear();
- ui.tabs->addTab( &sources, QIcon(":/icons/reload.svg"), tr( "&Sources" ) );
+ ui.tabs->addTab( &sources, QIcon(":/icons/sources.png"), tr( "&Sources" ) );
ui.tabs->addTab( orderAndProps, QIcon(":/icons/book.svg"), tr( "&Dictionaries" ) );
ui.tabs->addTab( groups.get(), QIcon(":/icons/bookcase.svg"), tr( "&Groups" ) );
diff --git a/epwing_book.cc b/epwing_book.cc
index 8477916d..5a95a807 100644
--- a/epwing_book.cc
+++ b/epwing_book.cc
@@ -853,7 +853,7 @@ void EpwingBook::getFirstHeadword( EpwingHeadword & head )
fixHeadword( head.headword );
EWPos epos( pos.page, pos.offset );
- allHeadwordPositions[ ((uint64_t)pos.page)<<32|(pos.offset>>2) ] =true;
+ allHeadwordPositions[ ((uint64_t)pos.page)<<32|(pos.offset) ] =true;
}
bool EpwingBook::getNextHeadword( EpwingHeadword & head )
@@ -911,9 +911,9 @@ bool EpwingBook::getNextHeadword( EpwingHeadword & head )
{
}
- if( !allHeadwordPositions.contains( ((uint64_t)pos.page) << 32 | ( pos.offset / 4 ) ) )
+ if( !allHeadwordPositions.contains( ((uint64_t)pos.page) << 32 | ( pos.offset ) ) )
{
- allHeadwordPositions[ ((uint64_t)pos.page) << 32 | ( pos.offset / 4 ) ] = true;
+ allHeadwordPositions[ ((uint64_t)pos.page) << 32 | ( pos.offset ) ] = true;
return true;
}
}
@@ -943,7 +943,7 @@ bool EpwingBook::processRef( EpwingHeadword & head)
head.page = pos.page;
head.offset = pos.offset;
- auto key = ( (uint64_t)pos.page ) << 32 | ( pos.offset >> 2 );
+ auto key = ( (uint64_t)pos.page ) << 32 | ( pos.offset );
if( !allRefPositions.contains( key ) )
{
// fixed the reference headword ,to avoid the headword collision with other entry .
@@ -951,6 +951,14 @@ bool EpwingBook::processRef( EpwingHeadword & head)
head.headword = QString( "r%1At%2" ).arg( pos.page ).arg( pos.offset );
allRefPositions[ key ] = true;
+
+ try
+ {
+ getReferencesFromText( pos.page, pos.offset);
+ }
+ catch( std::exception & )
+ {
+ }
return true;
}
}
diff --git a/ffmpegaudio.cc b/ffmpegaudio.cc
index bb83407a..60e21213 100644
--- a/ffmpegaudio.cc
+++ b/ffmpegaudio.cc
@@ -240,14 +240,13 @@ bool DecoderContext::openCodec( QString & errorString )
codecContext_->channels, codecContext_->sample_rate, av_get_sample_fmt_name( codecContext_->sample_fmt ) );
auto layout = codecContext_->channel_layout;
- if(!layout)
+ if( !layout )
{
- layout=av_get_default_channel_layout( codecContext_->channels );
+ layout = av_get_default_channel_layout( codecContext_->channels );
codecContext_->channel_layout = layout;
}
- swr_ = swr_alloc_set_opts(
- NULL,
+ swr_ = swr_alloc_set_opts( NULL,
layout,
AV_SAMPLE_FMT_S16,
44100,
diff --git a/helpwindow.cc b/helpwindow.cc
index 040e766d..ba6dce3e 100644
--- a/helpwindow.cc
+++ b/helpwindow.cc
@@ -80,11 +80,11 @@ HelpWindow::HelpWindow( QWidget * parent, Config::Class & cfg_ ) :
navToolBar->addSeparator();
- zoomInAction = navToolBar->addAction( QIcon( ":/icons/icon32_zoomin.svg" ), tr( "Zoom In" ) );
+ zoomInAction = navToolBar->addAction( QIcon( ":/icons/icon32_zoomin.png" ), tr( "Zoom In" ) );
navToolBar->widgetForAction( zoomInAction )->setObjectName( "zoomInButton" );
- zoomOutAction = navToolBar->addAction( QIcon( ":/icons/icon32_zoomout.svg" ), tr( "Zoom Out" ) );
+ zoomOutAction = navToolBar->addAction( QIcon( ":/icons/icon32_zoomout.png" ), tr( "Zoom Out" ) );
navToolBar->widgetForAction( zoomInAction )->setObjectName( "zoomOutButton" );
- zoomBaseAction = navToolBar->addAction( QIcon( ":/icons/icon32_zoombase.svg" ), tr( "Normal Size" ) );
+ zoomBaseAction = navToolBar->addAction( QIcon( ":/icons/icon32_zoombase.png" ), tr( "Normal Size" ) );
navToolBar->widgetForAction( zoomBaseAction )->setObjectName( "zoomBaseButton" );
navForward->setEnabled( false );
diff --git a/icons/advanced.png b/icons/advanced.png
new file mode 100644
index 00000000..c143c1dd
Binary files /dev/null and b/icons/advanced.png differ
diff --git a/icons/advanced.svg b/icons/advanced.svg
deleted file mode 100644
index 4fd4e67c..00000000
--- a/icons/advanced.svg
+++ /dev/null
@@ -1,1029 +0,0 @@
-
-
-
diff --git a/icons/icon32_zoombase.png b/icons/icon32_zoombase.png
new file mode 100644
index 00000000..5f3b66e2
Binary files /dev/null and b/icons/icon32_zoombase.png differ
diff --git a/icons/icon32_zoombase.svg b/icons/icon32_zoombase.svg
deleted file mode 100644
index 8783ba9d..00000000
--- a/icons/icon32_zoombase.svg
+++ /dev/null
@@ -1,298 +0,0 @@
-
-
-
-
diff --git a/icons/icon32_zoomin.png b/icons/icon32_zoomin.png
new file mode 100644
index 00000000..d2705956
Binary files /dev/null and b/icons/icon32_zoomin.png differ
diff --git a/icons/icon32_zoomin.svg b/icons/icon32_zoomin.svg
deleted file mode 100644
index 3baa9766..00000000
--- a/icons/icon32_zoomin.svg
+++ /dev/null
@@ -1,1186 +0,0 @@
-
-
-
-
diff --git a/icons/icon32_zoomout.png b/icons/icon32_zoomout.png
new file mode 100644
index 00000000..c3d7ef18
Binary files /dev/null and b/icons/icon32_zoomout.png differ
diff --git a/icons/icon32_zoomout.svg b/icons/icon32_zoomout.svg
deleted file mode 100644
index 469a4ab6..00000000
--- a/icons/icon32_zoomout.svg
+++ /dev/null
@@ -1,1188 +0,0 @@
-
-
-
-
diff --git a/icons/readme.txt b/icons/readme.txt
index 6ac0d7b9..873d578e 100644
--- a/icons/readme.txt
+++ b/icons/readme.txt
@@ -18,9 +18,6 @@ error
star.svg
star_blue.svg
network.svg
-icon32_zoomin
-icon32_zoomout
-icon32_zoombase
hotkeys
previous
next
@@ -57,4 +54,15 @@ lists:
these two icons from sertoli @ https://forum.freemdict.com/u/sertoli/summary
playsound.png
-playsound_full.png
\ No newline at end of file
+playsound_full.png
+
+
+LGPL
+icon32_zoombase.png https://icons.iconarchive.com/icons/oxygen-icons.org/oxygen/128/Actions-page-zoom-icon.png
+icon32_zoomout.png https://icons.iconarchive.com/icons/oxygen-icons.org/oxygen/128/Actions-zoom-out-icon.png
+icon32_zoomin.png https://icons.iconarchive.com/icons/oxygen-icons.org/oxygen/128/Actions-zoom-in-icon.png
+reload.png https://iconarchive.com/show/oxygen-icons-by-oxygen-icons.org/Actions-edit-redo-icon.html
+advanced.png https://icons.iconarchive.com/icons/oxygen-icons.org/oxygen/128/Actions-system-run-icon.png
+sources.png https://icons.iconarchive.com/icons/oxygen-icons.org/oxygen/128/Apps-plasma-icon.png
+
+
diff --git a/icons/reload.png b/icons/reload.png
index f9f388f2..b38aa154 100644
Binary files a/icons/reload.png and b/icons/reload.png differ
diff --git a/icons/reload.svg b/icons/reload.svg
deleted file mode 100644
index 69e59776..00000000
--- a/icons/reload.svg
+++ /dev/null
@@ -1,402 +0,0 @@
-
-
-
diff --git a/icons/sources.png b/icons/sources.png
new file mode 100644
index 00000000..b5ca00fd
Binary files /dev/null and b/icons/sources.png differ
diff --git a/mainwindow.cc b/mainwindow.cc
index 6307fc78..743af1a0 100644
--- a/mainwindow.cc
+++ b/mainwindow.cc
@@ -260,17 +260,17 @@ MainWindow::MainWindow( Config::Class & cfg_ ):
// named separator (to be able to hide it via CSS)
navToolbar->widgetForAction( navToolbar->addSeparator() )->setObjectName( "separatorBeforeZoom" );
- zoomIn = navToolbar->addAction( QIcon( ":/icons/icon32_zoomin.svg" ), tr( "Zoom In" ) );
+ zoomIn = navToolbar->addAction( QIcon( ":/icons/icon32_zoomin.png" ), tr( "Zoom In" ) );
zoomIn->setShortcuts( QList< QKeySequence >() <<
QKeySequence::ZoomIn <<
QKeySequence( "Ctrl+=" ) );
navToolbar->widgetForAction( zoomIn )->setObjectName( "zoomInButton" );
- zoomOut = navToolbar->addAction( QIcon( ":/icons/icon32_zoomout.svg" ), tr( "Zoom Out" ) );
+ zoomOut = navToolbar->addAction( QIcon( ":/icons/icon32_zoomout.png" ), tr( "Zoom Out" ) );
zoomOut->setShortcut( QKeySequence::ZoomOut );
navToolbar->widgetForAction( zoomOut )->setObjectName( "zoomOutButton" );
- zoomBase = navToolbar->addAction( QIcon( ":/icons/icon32_zoombase.svg" ), tr( "Normal Size" ) );
+ zoomBase = navToolbar->addAction( QIcon( ":/icons/icon32_zoombase.png" ), tr( "Normal Size" ) );
zoomBase->setShortcut( QKeySequence( "Ctrl+0" ) );
navToolbar->widgetForAction( zoomBase )->setObjectName( "zoomBaseButton" );
@@ -391,13 +391,13 @@ MainWindow::MainWindow( Config::Class & cfg_ ):
ui.menuZoom->addSeparator();
- wordsZoomIn = ui.menuZoom->addAction( QIcon( ":/icons/icon32_zoomin.svg" ), tr( "Words Zoom In" ) );
+ wordsZoomIn = ui.menuZoom->addAction( QIcon( ":/icons/icon32_zoomin.png" ), tr( "Words Zoom In" ) );
wordsZoomIn->setShortcuts( QList< QKeySequence >() <<
QKeySequence( "Alt++" ) <<
QKeySequence( "Alt+=" ) );
- wordsZoomOut = ui.menuZoom->addAction( QIcon( ":/icons/icon32_zoomout.svg" ), tr( "Words Zoom Out" ) );
+ wordsZoomOut = ui.menuZoom->addAction( QIcon( ":/icons/icon32_zoomout.png" ), tr( "Words Zoom Out" ) );
wordsZoomOut->setShortcut( QKeySequence( "Alt+-" ) );
- wordsZoomBase = ui.menuZoom->addAction( QIcon( ":/icons/icon32_zoombase.svg" ), tr( "Words Normal Size" ) );
+ wordsZoomBase = ui.menuZoom->addAction( QIcon( ":/icons/icon32_zoombase.png" ), tr( "Words Normal Size" ) );
wordsZoomBase->setShortcut( QKeySequence( "Alt+0" ) );
connect( wordsZoomIn, SIGNAL(triggered()), this, SLOT(doWordsZoomIn()) );
diff --git a/preferences.ui b/preferences.ui
index 7a43c656..a9e9c159 100644
--- a/preferences.ui
+++ b/preferences.ui
@@ -1411,7 +1411,7 @@ download page.
- :/icons/advanced.svg:/icons/advanced.svg
+ :/icons/advanced.png:/icons/advanced.png
Ad&vanced
diff --git a/resources.qrc b/resources.qrc
index 5c7160d6..936d9d91 100644
--- a/resources.qrc
+++ b/resources.qrc
@@ -4,7 +4,6 @@
icons/arrow.png
icons/prefix.png
icons/playsound.png
- icons/reload.png
icons/programicon.png
icons/programicon_scan.png
icons/warning.png
@@ -71,9 +70,9 @@
icons/home.svg
icons/hotkeys.svg
icons/icon.svg
- icons/icon32_zoombase.svg
- icons/icon32_zoomin.svg
- icons/icon32_zoomout.svg
+ icons/icon32_zoombase.png
+ icons/icon32_zoomin.png
+ icons/icon32_zoomout.png
icons/interface.svg
icons/internet.svg
icons/network.svg
@@ -82,14 +81,14 @@
icons/previous.svg
icons/print.svg
icons/programs.svg
- icons/reload.svg
+ icons/sources.png
icons/star.svg
icons/star_blue.svg
icons/system-search.svg
icons/windows-list.svg
icons/wizard.svg
icons/dictionary.svg
- icons/advanced.svg
+ icons/advanced.png
icons/webdict.svg
icons/transliteration.png
icons/pushpin.svg
diff --git a/sonar-project.properties b/sonar-project.properties
new file mode 100644
index 00000000..4bf63e55
--- /dev/null
+++ b/sonar-project.properties
@@ -0,0 +1,12 @@
+sonar.projectKey=xiaoyifang_goldendict
+sonar.organization=xiaoyifang
+
+# This is the name and version displayed in the SonarCloud UI.
+sonar.projectName=goldendict
+#sonar.projectVersion=1.0
+
+# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
+sonar.sources=.
+
+# Encoding of the source code. Default is default system encoding
+sonar.sourceEncoding=UTF-8