mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-23 20:14:05 +00:00
opt: reply remove unnecessary signal (#1866)
Some checks failed
SonarCloud / Build and analyze (push) Has been cancelled
Some checks failed
SonarCloud / Build and analyze (push) Has been cancelled
* opt: remove unnecessary signal --------- Co-authored-by: shenleban tongying <shenlebantongying@gmail.com>
This commit is contained in:
parent
7229faeec7
commit
15207cf400
|
@ -22,9 +22,11 @@ AllowFrameReply::AllowFrameReply( QNetworkReply * _reply ):
|
||||||
setRequest( baseReply->request() );
|
setRequest( baseReply->request() );
|
||||||
setUrl( baseReply->url() );
|
setUrl( baseReply->url() );
|
||||||
|
|
||||||
// Signals to own slots
|
QList< QByteArray > rawHeaders = baseReply->rawHeaderList();
|
||||||
|
for ( const auto & header : rawHeaders ) {
|
||||||
connect( baseReply, &QNetworkReply::metaDataChanged, this, &AllowFrameReply::applyMetaData );
|
if ( header.toLower() != "x-frame-options" )
|
||||||
|
setRawHeader( header, baseReply->rawHeader( header ) );
|
||||||
|
}
|
||||||
|
|
||||||
connect( baseReply, &QNetworkReply::errorOccurred, this, &AllowFrameReply::applyError );
|
connect( baseReply, &QNetworkReply::errorOccurred, this, &AllowFrameReply::applyError );
|
||||||
|
|
||||||
|
@ -32,45 +34,11 @@ AllowFrameReply::AllowFrameReply( QNetworkReply * _reply ):
|
||||||
|
|
||||||
// Redirect QNetworkReply signals
|
// Redirect QNetworkReply signals
|
||||||
|
|
||||||
connect( baseReply, &QNetworkReply::downloadProgress, this, &QNetworkReply::downloadProgress );
|
|
||||||
|
|
||||||
connect( baseReply, &QNetworkReply::encrypted, this, &QNetworkReply::encrypted );
|
|
||||||
|
|
||||||
connect( baseReply, &QNetworkReply::finished, this, &QNetworkReply::finished );
|
connect( baseReply, &QNetworkReply::finished, this, &QNetworkReply::finished );
|
||||||
|
|
||||||
connect( baseReply,
|
|
||||||
&QNetworkReply::preSharedKeyAuthenticationRequired,
|
|
||||||
this,
|
|
||||||
&QNetworkReply::preSharedKeyAuthenticationRequired );
|
|
||||||
|
|
||||||
connect( baseReply, &QNetworkReply::redirected, this, &QNetworkReply::redirected );
|
|
||||||
|
|
||||||
connect( baseReply, &QNetworkReply::sslErrors, this, &QNetworkReply::sslErrors );
|
|
||||||
|
|
||||||
connect( baseReply, &QNetworkReply::uploadProgress, this, &QNetworkReply::uploadProgress );
|
|
||||||
|
|
||||||
// Redirect QIODevice signals
|
|
||||||
|
|
||||||
connect( baseReply, &QIODevice::aboutToClose, this, &QIODevice::aboutToClose );
|
|
||||||
|
|
||||||
connect( baseReply, &QIODevice::bytesWritten, this, &QIODevice::bytesWritten );
|
|
||||||
|
|
||||||
connect( baseReply, &QIODevice::readChannelFinished, this, &QIODevice::readChannelFinished );
|
|
||||||
|
|
||||||
setOpenMode( QIODevice::ReadOnly );
|
setOpenMode( QIODevice::ReadOnly );
|
||||||
}
|
}
|
||||||
|
|
||||||
void AllowFrameReply::applyMetaData()
|
|
||||||
{
|
|
||||||
// The webengine does not support to customize the headers right now ,maybe until Qt6.7 there should be some api supports
|
|
||||||
}
|
|
||||||
|
|
||||||
void AllowFrameReply::setReadBufferSize( qint64 size )
|
|
||||||
{
|
|
||||||
QNetworkReply::setReadBufferSize( size );
|
|
||||||
baseReply->setReadBufferSize( size );
|
|
||||||
}
|
|
||||||
|
|
||||||
qint64 AllowFrameReply::bytesAvailable() const
|
qint64 AllowFrameReply::bytesAvailable() const
|
||||||
{
|
{
|
||||||
return baseReply->bytesAvailable();
|
return baseReply->bytesAvailable();
|
||||||
|
@ -89,11 +57,6 @@ qint64 AllowFrameReply::readData( char * data, qint64 maxSize )
|
||||||
baseReply->read( data, size );
|
baseReply->read( data, size );
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
void AllowFrameReply::finishedSlot()
|
|
||||||
{
|
|
||||||
setFinished( true );
|
|
||||||
emit finished();
|
|
||||||
}
|
|
||||||
|
|
||||||
QNetworkReply * ArticleNetworkAccessManager::getArticleReply( QNetworkRequest const & req )
|
QNetworkReply * ArticleNetworkAccessManager::getArticleReply( QNetworkRequest const & req )
|
||||||
{
|
{
|
||||||
|
|
|
@ -42,8 +42,6 @@ public:
|
||||||
delete baseReply;
|
delete baseReply;
|
||||||
}
|
}
|
||||||
|
|
||||||
// QNetworkReply virtual functions
|
|
||||||
void setReadBufferSize( qint64 size );
|
|
||||||
void close()
|
void close()
|
||||||
{
|
{
|
||||||
baseReply->close();
|
baseReply->close();
|
||||||
|
@ -51,7 +49,7 @@ public:
|
||||||
|
|
||||||
// QIODevice virtual functions
|
// QIODevice virtual functions
|
||||||
qint64 bytesAvailable() const;
|
qint64 bytesAvailable() const;
|
||||||
bool atEnd() const
|
bool atEnd() const override
|
||||||
{
|
{
|
||||||
return baseReply->atEnd();
|
return baseReply->atEnd();
|
||||||
}
|
}
|
||||||
|
@ -81,11 +79,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
// Own AllowFrameReply slots
|
|
||||||
void applyMetaData();
|
|
||||||
void applyError( QNetworkReply::NetworkError code );
|
void applyError( QNetworkReply::NetworkError code );
|
||||||
// void readDataFromBase();
|
|
||||||
|
|
||||||
// Redirect QNetworkReply slots
|
// Redirect QNetworkReply slots
|
||||||
virtual void abort()
|
virtual void abort()
|
||||||
|
@ -96,7 +90,6 @@ public slots:
|
||||||
{
|
{
|
||||||
baseReply->ignoreSslErrors();
|
baseReply->ignoreSslErrors();
|
||||||
}
|
}
|
||||||
void finishedSlot();
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// QNetworkReply virtual functions
|
// QNetworkReply virtual functions
|
||||||
|
@ -186,7 +179,7 @@ public:
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
virtual qint64 bytesAvailable() const;
|
virtual qint64 bytesAvailable() const;
|
||||||
bool atEnd() const;
|
bool atEnd() const override;
|
||||||
virtual void abort() {}
|
virtual void abort() {}
|
||||||
virtual qint64 readData( char * data, qint64 maxSize );
|
virtual qint64 readData( char * data, qint64 maxSize );
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue