From c8014b482a895e3678adb629bf9e57e9ad71918b Mon Sep 17 00:00:00 2001 From: Xiao YiFang Date: Tue, 29 Nov 2022 21:19:31 +0800 Subject: [PATCH 1/5] ffmpeg decode audio to pcm, remove noise . --- ffmpegaudio.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ffmpegaudio.cc b/ffmpegaudio.cc index d3fe8f89..bb83407a 100644 --- a/ffmpegaudio.cc +++ b/ffmpegaudio.cc @@ -392,7 +392,7 @@ bool DecoderContext::normalizeAudio( AVFrame * frame, vector & samples auto dst_freq = 44100; auto dst_channels = codecContext_->channels; int out_count = (int64_t) frame->nb_samples * dst_freq / frame->sample_rate + 256; - int out_size = av_samples_get_buffer_size( NULL, dst_channels, out_count, AV_SAMPLE_FMT_S16, 0 ); + int out_size = av_samples_get_buffer_size( NULL, dst_channels, out_count, AV_SAMPLE_FMT_S16, 1 ); samples.resize( out_size ); uint8_t * data[ 2 ] = { 0 }; data[ 0 ] = &samples.front(); @@ -409,7 +409,7 @@ bool DecoderContext::normalizeAudio( AVFrame * frame, vector & samples // qDebug( "out_count:%d, out_nb_samples:%d, frame->nb_samples:%d \n", out_count, out_nb_samples, frame->nb_samples ); } - int actual_size = av_samples_get_buffer_size( NULL, dst_channels, out_nb_samples, AV_SAMPLE_FMT_S16, 0 ); + int actual_size = av_samples_get_buffer_size( NULL, dst_channels, out_nb_samples, AV_SAMPLE_FMT_S16, 1 ); samples.resize(actual_size); return true; } From b285749a359fb807a10db14ad89438b14d36f4e2 Mon Sep 17 00:00:00 2001 From: xiaoyifang Date: Thu, 1 Dec 2022 10:19:48 +0800 Subject: [PATCH 2/5] Revert "fix: right mouse on the history panel and favorite panel should not trigger the click event." This reverts commit 80fdb8cb822652d0ab948be1c88b55793967d120. --- favoritespanewidget.cc | 4 ++-- historypanewidget.cc | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/favoritespanewidget.cc b/favoritespanewidget.cc index 5facb8e3..4b8d1c41 100644 --- a/favoritespanewidget.cc +++ b/favoritespanewidget.cc @@ -208,12 +208,12 @@ void FavoritesPaneWidget::onSelectionChanged( QItemSelection const & selection ) return; itemSelectionChanged = true; -// emitFavoritesItemRequested( selection.indexes().front() ); + emitFavoritesItemRequested( selection.indexes().front() ); } void FavoritesPaneWidget::onItemClicked( QModelIndex const & idx ) { -// if ( !itemSelectionChanged && m_favoritesTree->selectionModel()->selectedIndexes().size() == 1 ) + if ( !itemSelectionChanged && m_favoritesTree->selectionModel()->selectedIndexes().size() == 1 ) { emitFavoritesItemRequested( idx ); } diff --git a/historypanewidget.cc b/historypanewidget.cc index 2a47fdd9..81216b94 100644 --- a/historypanewidget.cc +++ b/historypanewidget.cc @@ -202,14 +202,14 @@ void HistoryPaneWidget::onSelectionChanged( QItemSelection const & selection ) return; itemSelectionChanged = true; -// emitHistoryItemRequested( selection.front().topLeft() ); + emitHistoryItemRequested( selection.front().topLeft() ); } void HistoryPaneWidget::onItemClicked( QModelIndex const & idx ) { // qDebug() << "clicked"; -// if ( !itemSelectionChanged ) + if ( !itemSelectionChanged ) { emitHistoryItemRequested( idx ); } From 4e0219adeac5005af38093ad08f452ee3e05647b Mon Sep 17 00:00:00 2001 From: Xiao YiFang Date: Thu, 1 Dec 2022 19:41:56 +0800 Subject: [PATCH 3/5] clean:remove meaningless log --- indexedzip.cc | 2 -- 1 file changed, 2 deletions(-) diff --git a/indexedzip.cc b/indexedzip.cc index 438700eb..e2fb32a4 100644 --- a/indexedzip.cc +++ b/indexedzip.cc @@ -79,8 +79,6 @@ bool IndexedZip::loadFile( uint32_t offset, vector< char > & data ) case ZipFile::Deflated: { - GD_DPRINTF( "Deflated" ); - // Now do the deflation QByteArray compressedData = zip.read( header.compressedSize ); From e99431fa149b9916e58adb47fc6a132773e7748d Mon Sep 17 00:00:00 2001 From: Xiao YiFang Date: Thu, 1 Dec 2022 19:55:00 +0800 Subject: [PATCH 4/5] style:fix style warning --- chunkedstorage.hh | 3 +-- delegate.hh | 2 +- dsl_details.hh | 4 ++-- ex.hh | 2 +- favoritespanewidget.hh | 2 +- history.hh | 2 +- 6 files changed, 7 insertions(+), 8 deletions(-) diff --git a/chunkedstorage.hh b/chunkedstorage.hh index 4132e30b..22864695 100644 --- a/chunkedstorage.hh +++ b/chunkedstorage.hh @@ -35,8 +35,7 @@ class Writer size_t scratchPadOffset, scratchPadSize; public: - - Writer( File::Class & ); + explicit Writer( File::Class & ); /// Starts new block. Returns its address. uint32_t startNewBlock(); diff --git a/delegate.hh b/delegate.hh index 28331096..080bdfbb 100644 --- a/delegate.hh +++ b/delegate.hh @@ -7,7 +7,7 @@ class WordListItemDelegate : public QStyledItemDelegate { public: - WordListItemDelegate( QAbstractItemDelegate * delegate ); + explicit WordListItemDelegate( QAbstractItemDelegate * delegate ); virtual void paint( QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index ) const; private: diff --git a/dsl_details.hh b/dsl_details.hh index 34eea56d..bbd56c1f 100644 --- a/dsl_details.hh +++ b/dsl_details.hh @@ -71,7 +71,7 @@ struct ArticleDom /// Does the parse at construction. Refer to the 'root' member variable /// afterwards. - ArticleDom( wstring const &, string const & dictName = string(), + explicit ArticleDom( wstring const &, string const & dictName = string(), wstring const & headword_ = wstring() ); /// Root of DOM's tree @@ -128,7 +128,7 @@ public: DEF_EX( exUnknownCodePage, "The .dsl file specified an unknown code page", Ex ) DEF_EX( exEncodingError, "Encoding error", Ex ) // Should never happen really - DslScanner( string const & fileName ) ; + explicit DslScanner( string const & fileName ) ; ~DslScanner() noexcept; /// Returns the detected encoding of this file. diff --git a/ex.hh b/ex.hh index 13dd5fff..59e00306 100644 --- a/ex.hh +++ b/ex.hh @@ -30,7 +30,7 @@ virtual ~exName() noexcept {} }; class exName: public exParent { \ std::string value; \ public: \ - exName( std::string const & value_ ): value( std::string( exDescription ) + " " + value_ ) {} \ + explicit exName( std::string const & value_ ): value( std::string( exDescription ) + " " + value_ ) {} \ virtual const char * what() const noexcept { return value.c_str(); } \ virtual ~exName() noexcept {} }; diff --git a/favoritespanewidget.hh b/favoritespanewidget.hh index a0dae00a..d9848767 100644 --- a/favoritespanewidget.hh +++ b/favoritespanewidget.hh @@ -105,7 +105,7 @@ class TreeItem public: enum Type { Word, Folder, Root }; - TreeItem( const QVariant &data, TreeItem *parent = 0, Type type_ = Word ); + explicit TreeItem( const QVariant &data, TreeItem *parent = 0, Type type_ = Word ); ~TreeItem(); void appendChild( TreeItem * child ); diff --git a/history.hh b/history.hh index c81bec66..1fc143c7 100644 --- a/history.hh +++ b/history.hh @@ -47,7 +47,7 @@ public: /// Loads history from its file. If load fails, the result would be an empty /// history. The size parameter is same as in other constructor. - History( Load, unsigned size = 20, unsigned maxItemLength = DEFAULT_MAX_HISTORY_ITEM_LENGTH ); + explicit History( Load, unsigned size = 20, unsigned maxItemLength = DEFAULT_MAX_HISTORY_ITEM_LENGTH ); /// Adds new item. The item is always added at the beginning of the list. /// If there was such an item already somewhere on the list, it gets removed From 21451c3ed1614c420b1fd2ee59f0b6905cf2a528 Mon Sep 17 00:00:00 2001 From: Xiao YiFang Date: Thu, 1 Dec 2022 21:04:09 +0800 Subject: [PATCH 5/5] translation: make some format modification in the zh_CN welcome page. --- locale/zh_CN.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/locale/zh_CN.ts b/locale/zh_CN.ts index 4cd55592..5e8db242 100644 --- a/locale/zh_CN.ts +++ b/locale/zh_CN.ts @@ -126,7 +126,7 @@ <h3 align="center">Welcome to <b>GoldenDict</b>!</h3><p>To start working with the program, first visit <b>Edit|Dictionaries</b> to add some directory paths where to search for the dictionary files, set up various Wikipedia sites or other sources, adjust dictionary order or create dictionary groups.<p>And then you're ready to look up your words! You can do that in this window by using a pane to the left, or you can <a href="Working with popup">look up words from other active applications</a>. <p>To customize program, check out the available preferences at <b>Edit|Preferences</b>. All settings there have tooltips, be sure to read them if you are in doubt about anything.<p>Should you need further help, have any questions, suggestions or just wonder what the others think, you are welcome at the program's <a href="http://goldendict.org/forum/">forum</a>.<p>Check program's <a href="http://goldendict.org/">website</a> for the updates. <p>(c) 2008-2013 Konstantin Isakov. Licensed under GPLv3 or later. - <h3 align="center">欢迎使用 <b>GoldenDict</b> 词典程序!</h3><p style="text-indent:2em">使用时请首先打开<b>编辑 | 词典</b>菜单以添加并扫描含有词典文件的目录,添加维基百科网站查询或其它资源,调整词典排序或创建新的词典群组。<p style="text-indent:2em">这些设置都完成以后,就可以开始使用了。你可以使用左侧的查询面板,或者<a href="使用屏幕取词功能">直接从其它程序中抓词查询</a>。<p style="text-indent:2em">如需要改变设置,可以在<b>编辑 | 首选项</b>菜单中查看一下可用的系统设置。所有的设置都有鼠标指针提示信息,如果有不明之处,请仔细阅读提示信息。<p style="text-indent:2em">如果你需要更多帮助,有任何疑问、建议,或者仅仅想了解其他人的想法,欢迎访问此程序的<a href="http://goldendict.org/forum/">官方论坛</a>。<p style="text-indent:2em">访问此程序的<a href="http://goldendict.org/">官方网站</a>以获取更新。<p style="text-indent:2em">(c) 2008-2013 Konstantin Isakov. 授权基于 GPLv3 或更高版本。 + <h3 align="center">欢迎使用 <b>GoldenDict</b> 词典程序!</h3><p style="text-indent:2em">使用时请首先打开<b>编辑 | 词典</b>菜单以添加并扫描含有词典文件的目录,添加维基百科网站查询或其它资源,调整词典排序或创建新的词典群组。这些设置都完成以后,就可以开始使用了。你可以使用左侧的查询面板,或者<a href="使用屏幕取词功能">直接从其它程序中抓词查询</a>。<p style="text-indent:2em">如需要改变设置,可以在<b>编辑 | 首选项</b>菜单中查看一下可用的系统设置。所有的设置都有鼠标指针提示信息,如果有不明之处,请仔细阅读提示信息。如果你需要更多帮助,有任何疑问、建议,或者仅仅想了解其他人的想法,欢迎访问此程序的<a href="http://goldendict.org/forum/">官方论坛</a>。访问此程序的<a href="http://goldendict.org/">官方网站</a>以获取更新。<p style="text-indent:2em">(c) 2008-2013 Konstantin Isakov. 授权基于 GPLv3 或更高版本。