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;
public:
Writer( File::Class & );
explicit Writer( File::Class & );
/// Starts new block. Returns its address.
uint32_t startNewBlock();

View file

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

View file

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

2
ex.hh
View file

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

View file

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

View file

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

View file

@ -392,7 +392,7 @@ bool DecoderContext::normalizeAudio( AVFrame * frame, vector<uint8_t > & 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<uint8_t > & 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;
}

View file

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

View file

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

View file

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

View file

@ -126,7 +126,7 @@
<message>
<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>
<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>
<location filename="../article_maker.cc" line="360"/>