Merge pull request #236 from xiaoyifang/staged

merge staged to dev
This commit is contained in:
xiaoyifang 2022-12-02 08:11:19 +08:00 committed by GitHub
commit 1bd13a2630
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 14 additions and 17 deletions

View file

@ -35,8 +35,7 @@ class Writer
size_t scratchPadOffset, scratchPadSize; size_t scratchPadOffset, scratchPadSize;
public: public:
explicit Writer( File::Class & );
Writer( File::Class & );
/// Starts new block. Returns its address. /// Starts new block. Returns its address.
uint32_t startNewBlock(); uint32_t startNewBlock();

View file

@ -7,7 +7,7 @@
class WordListItemDelegate : public QStyledItemDelegate class WordListItemDelegate : public QStyledItemDelegate
{ {
public: public:
WordListItemDelegate( QAbstractItemDelegate * delegate ); explicit WordListItemDelegate( QAbstractItemDelegate * delegate );
virtual void paint( QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index ) const; virtual void paint( QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index ) const;
private: private:

View file

@ -71,7 +71,7 @@ struct ArticleDom
/// Does the parse at construction. Refer to the 'root' member variable /// Does the parse at construction. Refer to the 'root' member variable
/// afterwards. /// afterwards.
ArticleDom( wstring const &, string const & dictName = string(), explicit ArticleDom( wstring const &, string const & dictName = string(),
wstring const & headword_ = wstring() ); wstring const & headword_ = wstring() );
/// Root of DOM's tree /// Root of DOM's tree
@ -128,7 +128,7 @@ public:
DEF_EX( exUnknownCodePage, "The .dsl file specified an unknown code page", Ex ) DEF_EX( exUnknownCodePage, "The .dsl file specified an unknown code page", Ex )
DEF_EX( exEncodingError, "Encoding error", Ex ) // Should never happen really DEF_EX( exEncodingError, "Encoding error", Ex ) // Should never happen really
DslScanner( string const & fileName ) ; explicit DslScanner( string const & fileName ) ;
~DslScanner() noexcept; ~DslScanner() noexcept;
/// Returns the detected encoding of this file. /// Returns the detected encoding of this file.

2
ex.hh
View file

@ -30,7 +30,7 @@ virtual ~exName() noexcept {} };
class exName: public exParent { \ class exName: public exParent { \
std::string value; \ std::string value; \
public: \ 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 const char * what() const noexcept { return value.c_str(); } \
virtual ~exName() noexcept {} }; virtual ~exName() noexcept {} };

View file

@ -208,12 +208,12 @@ void FavoritesPaneWidget::onSelectionChanged( QItemSelection const & selection )
return; return;
itemSelectionChanged = true; itemSelectionChanged = true;
// emitFavoritesItemRequested( selection.indexes().front() ); emitFavoritesItemRequested( selection.indexes().front() );
} }
void FavoritesPaneWidget::onItemClicked( QModelIndex const & idx ) void FavoritesPaneWidget::onItemClicked( QModelIndex const & idx )
{ {
// if ( !itemSelectionChanged && m_favoritesTree->selectionModel()->selectedIndexes().size() == 1 ) if ( !itemSelectionChanged && m_favoritesTree->selectionModel()->selectedIndexes().size() == 1 )
{ {
emitFavoritesItemRequested( idx ); emitFavoritesItemRequested( idx );
} }

View file

@ -105,7 +105,7 @@ class TreeItem
public: public:
enum Type { Word, Folder, Root }; 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(); ~TreeItem();
void appendChild( TreeItem * child ); void appendChild( TreeItem * child );

View file

@ -392,7 +392,7 @@ bool DecoderContext::normalizeAudio( AVFrame * frame, vector<uint8_t > & samples
auto dst_freq = 44100; auto dst_freq = 44100;
auto dst_channels = codecContext_->channels; auto dst_channels = codecContext_->channels;
int out_count = (int64_t) frame->nb_samples * dst_freq / frame->sample_rate + 256; 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 ); samples.resize( out_size );
uint8_t * data[ 2 ] = { 0 }; uint8_t * data[ 2 ] = { 0 };
data[ 0 ] = &samples.front(); data[ 0 ] = &samples.front();
@ -409,7 +409,7 @@ bool DecoderContext::normalizeAudio( AVFrame * frame, vector<uint8_t > & samples
// qDebug( "out_count:%d, out_nb_samples:%d, frame->nb_samples:%d \n", out_count, out_nb_samples, frame->nb_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); samples.resize(actual_size);
return true; return true;
} }

View file

@ -47,7 +47,7 @@ public:
/// Loads history from its file. If load fails, the result would be an empty /// 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. 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. /// 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 /// If there was such an item already somewhere on the list, it gets removed

View file

@ -202,14 +202,14 @@ void HistoryPaneWidget::onSelectionChanged( QItemSelection const & selection )
return; return;
itemSelectionChanged = true; itemSelectionChanged = true;
// emitHistoryItemRequested( selection.front().topLeft() ); emitHistoryItemRequested( selection.front().topLeft() );
} }
void HistoryPaneWidget::onItemClicked( QModelIndex const & idx ) void HistoryPaneWidget::onItemClicked( QModelIndex const & idx )
{ {
// qDebug() << "clicked"; // qDebug() << "clicked";
// if ( !itemSelectionChanged ) if ( !itemSelectionChanged )
{ {
emitHistoryItemRequested( idx ); emitHistoryItemRequested( idx );
} }

View file

@ -79,8 +79,6 @@ bool IndexedZip::loadFile( uint32_t offset, vector< char > & data )
case ZipFile::Deflated: case ZipFile::Deflated:
{ {
GD_DPRINTF( "Deflated" );
// Now do the deflation // Now do the deflation
QByteArray compressedData = zip.read( header.compressedSize ); QByteArray compressedData = zip.read( header.compressedSize );

View file

@ -126,7 +126,7 @@
<message> <message>
<location filename="../article_maker.cc" line="236"/> <location filename="../article_maker.cc" line="236"/>
<source>&lt;h3 align=&quot;center&quot;&gt;Welcome to &lt;b&gt;GoldenDict&lt;/b&gt;!&lt;/h3&gt;&lt;p&gt;To start working with the program, first visit &lt;b&gt;Edit|Dictionaries&lt;/b&gt; 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.&lt;p&gt;And then you&apos;re ready to look up your words! You can do that in this window by using a pane to the left, or you can &lt;a href=&quot;Working with popup&quot;&gt;look up words from other active applications&lt;/a&gt;. &lt;p&gt;To customize program, check out the available preferences at &lt;b&gt;Edit|Preferences&lt;/b&gt;. All settings there have tooltips, be sure to read them if you are in doubt about anything.&lt;p&gt;Should you need further help, have any questions, suggestions or just wonder what the others think, you are welcome at the program&apos;s &lt;a href=&quot;http://goldendict.org/forum/&quot;&gt;forum&lt;/a&gt;.&lt;p&gt;Check program&apos;s &lt;a href=&quot;http://goldendict.org/&quot;&gt;website&lt;/a&gt; for the updates. &lt;p&gt;(c) 2008-2013 Konstantin Isakov. Licensed under GPLv3 or later.</source> <source>&lt;h3 align=&quot;center&quot;&gt;Welcome to &lt;b&gt;GoldenDict&lt;/b&gt;!&lt;/h3&gt;&lt;p&gt;To start working with the program, first visit &lt;b&gt;Edit|Dictionaries&lt;/b&gt; 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.&lt;p&gt;And then you&apos;re ready to look up your words! You can do that in this window by using a pane to the left, or you can &lt;a href=&quot;Working with popup&quot;&gt;look up words from other active applications&lt;/a&gt;. &lt;p&gt;To customize program, check out the available preferences at &lt;b&gt;Edit|Preferences&lt;/b&gt;. All settings there have tooltips, be sure to read them if you are in doubt about anything.&lt;p&gt;Should you need further help, have any questions, suggestions or just wonder what the others think, you are welcome at the program&apos;s &lt;a href=&quot;http://goldendict.org/forum/&quot;&gt;forum&lt;/a&gt;.&lt;p&gt;Check program&apos;s &lt;a href=&quot;http://goldendict.org/&quot;&gt;website&lt;/a&gt; for the updates. &lt;p&gt;(c) 2008-2013 Konstantin Isakov. Licensed under GPLv3 or later.</source>
<translation>&lt;h3 align=&quot;center&quot;&gt;使 &lt;b&gt;GoldenDict&lt;/b&gt; &lt;/h3&gt;&lt;p style=&quot;text-indent:2em&quot;&gt;使&lt;b&gt; | &lt;/b&gt;&lt;p style=&quot;text-indent:2em&quot;&gt;使使&lt;a href=&quot;使&quot;&gt;&lt;/a&gt;&lt;p style=&quot;text-indent:2em&quot;&gt;&lt;b&gt; | &lt;/b&gt;&lt;p style=&quot;text-indent:2em&quot;&gt;访&lt;a href=&quot;http://goldendict.org/forum/&quot;&gt;&lt;/a&gt;&lt;p style=&quot;text-indent:2em&quot;&gt;访&lt;a href=&quot;http://goldendict.org/&quot;&gt;&lt;/a&gt;&lt;p style=&quot;text-indent:2em&quot;&gt;(c) 2008-2013 Konstantin Isakov. GPLv3 </translation> <translation>&lt;h3 align=&quot;center&quot;&gt;使 &lt;b&gt;GoldenDict&lt;/b&gt; &lt;/h3&gt;&lt;p style=&quot;text-indent:2em&quot;&gt;使&lt;b&gt; | &lt;/b&gt;使使&lt;a href=&quot;使&quot;&gt;&lt;/a&gt;&lt;p style=&quot;text-indent:2em&quot;&gt;&lt;b&gt; | &lt;/b&gt;访&lt;a href=&quot;http://goldendict.org/forum/&quot;&gt;&lt;/a&gt;访&lt;a href=&quot;http://goldendict.org/&quot;&gt;&lt;/a&gt;&lt;p style=&quot;text-indent:2em&quot;&gt;(c) 2008-2013 Konstantin Isakov. GPLv3 </translation>
</message> </message>
<message> <message>
<location filename="../article_maker.cc" line="360"/> <location filename="../article_maker.cc" line="360"/>