Commit f7a578f2 authored by Laurent Montel's avatar Laurent Montel 😁

const'ify pointer + port deprecated signal

parent e8a9a0e9
...@@ -35,7 +35,11 @@ void IsgdShortUrlEngineInterface::generateShortUrl() ...@@ -35,7 +35,11 @@ void IsgdShortUrlEngineInterface::generateShortUrl()
request.setHeader(QNetworkRequest::ContentTypeHeader, QStringLiteral("application/json")); request.setHeader(QNetworkRequest::ContentTypeHeader, QStringLiteral("application/json"));
QNetworkReply *reply = mNetworkAccessManager->get(request); QNetworkReply *reply = mNetworkAccessManager->get(request);
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
connect(reply, qOverload<QNetworkReply::NetworkError>(&QNetworkReply::error), this, &IsgdShortUrlEngineInterface::slotErrorFound); connect(reply, qOverload<QNetworkReply::NetworkError>(&QNetworkReply::error), this, &IsgdShortUrlEngineInterface::slotErrorFound);
#else
connect(reply, qOverload<QNetworkReply::NetworkError>(&QNetworkReply::errorOccurred), this, &IsgdShortUrlEngineInterface::slotErrorFound);
#endif
} }
void IsgdShortUrlEngineInterface::slotSslErrors(QNetworkReply *reply, const QList<QSslError> &error) void IsgdShortUrlEngineInterface::slotSslErrors(QNetworkReply *reply, const QList<QSslError> &error)
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
ShortUrlEngineInterface::ShortUrlEngineInterface(ShortUrlEnginePlugin *plugin, QObject *parent) ShortUrlEngineInterface::ShortUrlEngineInterface(ShortUrlEnginePlugin *plugin, QObject *parent)
: QObject(parent) : QObject(parent)
, mErrorFound(false)
, mNetworkAccessManager(new QNetworkAccessManager(this)) , mNetworkAccessManager(new QNetworkAccessManager(this))
, mEnginePlugin(plugin) , mEnginePlugin(plugin)
{ {
......
...@@ -36,7 +36,7 @@ protected: ...@@ -36,7 +36,7 @@ protected:
QString mOriginalUrl; QString mOriginalUrl;
QTextCursor mTextCursor; QTextCursor mTextCursor;
bool mErrorFound = false; bool mErrorFound = false;
QNetworkAccessManager *mNetworkAccessManager = nullptr; QNetworkAccessManager *const mNetworkAccessManager;
ShortUrlEnginePlugin *mEnginePlugin = nullptr; ShortUrlEnginePlugin *const mEnginePlugin;
}; };
#endif // SHORTURLENGINEINTERFACE_H #endif // SHORTURLENGINEINTERFACE_H
...@@ -17,10 +17,6 @@ ...@@ -17,10 +17,6 @@
class ShortUrlEnginePluginInfo class ShortUrlEnginePluginInfo
{ {
public: public:
ShortUrlEnginePluginInfo()
: plugin(nullptr)
{
}
QString metaDataFileNameBaseName; QString metaDataFileNameBaseName;
QString metaDataFileName; QString metaDataFileName;
...@@ -40,7 +36,7 @@ public: ...@@ -40,7 +36,7 @@ public:
void loadPlugin(ShortUrlEnginePluginInfo *item); void loadPlugin(ShortUrlEnginePluginInfo *item);
QVector<ShortUrlEnginePlugin *> pluginsList() const; QVector<ShortUrlEnginePlugin *> pluginsList() const;
QVector<ShortUrlEnginePluginInfo> mPluginList; QVector<ShortUrlEnginePluginInfo> mPluginList;
ShortUrlEnginePluginManager *q; ShortUrlEnginePluginManager *const q;
}; };
void ShortUrlEnginePluginManagerPrivate::initializePlugins() void ShortUrlEnginePluginManagerPrivate::initializePlugins()
......
...@@ -29,7 +29,11 @@ void TinyUrlEngineInterface::generateShortUrl() ...@@ -29,7 +29,11 @@ void TinyUrlEngineInterface::generateShortUrl()
{ {
const QString requestUrl = QStringLiteral("https://tinyurl.com/api-create.php?url=%1").arg(mOriginalUrl); const QString requestUrl = QStringLiteral("https://tinyurl.com/api-create.php?url=%1").arg(mOriginalUrl);
QNetworkReply *reply = mNetworkAccessManager->get(QNetworkRequest(QUrl(requestUrl))); QNetworkReply *reply = mNetworkAccessManager->get(QNetworkRequest(QUrl(requestUrl)));
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
connect(reply, qOverload<QNetworkReply::NetworkError>(&QNetworkReply::error), this, &TinyUrlEngineInterface::slotErrorFound); connect(reply, qOverload<QNetworkReply::NetworkError>(&QNetworkReply::error), this, &TinyUrlEngineInterface::slotErrorFound);
#else
connect(reply, qOverload<QNetworkReply::NetworkError>(&QNetworkReply::errorOccurred), this, &TinyUrlEngineInterface::slotErrorFound);
#endif
} }
void TinyUrlEngineInterface::slotShortUrlFinished(QNetworkReply *reply) void TinyUrlEngineInterface::slotShortUrlFinished(QNetworkReply *reply)
......
...@@ -29,7 +29,11 @@ void TripAbShortUrlEngineInterface::generateShortUrl() ...@@ -29,7 +29,11 @@ void TripAbShortUrlEngineInterface::generateShortUrl()
{ {
const QString requestUrl = QStringLiteral("https://to.ly/api.php?longurl=%1").arg(mOriginalUrl); const QString requestUrl = QStringLiteral("https://to.ly/api.php?longurl=%1").arg(mOriginalUrl);
QNetworkReply *reply = mNetworkAccessManager->get(QNetworkRequest(QUrl(requestUrl))); QNetworkReply *reply = mNetworkAccessManager->get(QNetworkRequest(QUrl(requestUrl)));
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
connect(reply, qOverload<QNetworkReply::NetworkError>(&QNetworkReply::error), this, &TripAbShortUrlEngineInterface::slotErrorFound); connect(reply, qOverload<QNetworkReply::NetworkError>(&QNetworkReply::error), this, &TripAbShortUrlEngineInterface::slotErrorFound);
#else
connect(reply, qOverload<QNetworkReply::NetworkError>(&QNetworkReply::errorOccurred), this, &TripAbShortUrlEngineInterface::slotErrorFound);
#endif
} }
void TripAbShortUrlEngineInterface::slotShortUrlFinished(QNetworkReply *reply) void TripAbShortUrlEngineInterface::slotShortUrlFinished(QNetworkReply *reply)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment