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()
request.setHeader(QNetworkRequest::ContentTypeHeader, QStringLiteral("application/json"));
QNetworkReply *reply = mNetworkAccessManager->get(request);
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
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)
......
......@@ -13,7 +13,6 @@
ShortUrlEngineInterface::ShortUrlEngineInterface(ShortUrlEnginePlugin *plugin, QObject *parent)
: QObject(parent)
, mErrorFound(false)
, mNetworkAccessManager(new QNetworkAccessManager(this))
, mEnginePlugin(plugin)
{
......
......@@ -36,7 +36,7 @@ protected:
QString mOriginalUrl;
QTextCursor mTextCursor;
bool mErrorFound = false;
QNetworkAccessManager *mNetworkAccessManager = nullptr;
ShortUrlEnginePlugin *mEnginePlugin = nullptr;
QNetworkAccessManager *const mNetworkAccessManager;
ShortUrlEnginePlugin *const mEnginePlugin;
};
#endif // SHORTURLENGINEINTERFACE_H
......@@ -17,10 +17,6 @@
class ShortUrlEnginePluginInfo
{
public:
ShortUrlEnginePluginInfo()
: plugin(nullptr)
{
}
QString metaDataFileNameBaseName;
QString metaDataFileName;
......@@ -40,7 +36,7 @@ public:
void loadPlugin(ShortUrlEnginePluginInfo *item);
QVector<ShortUrlEnginePlugin *> pluginsList() const;
QVector<ShortUrlEnginePluginInfo> mPluginList;
ShortUrlEnginePluginManager *q;
ShortUrlEnginePluginManager *const q;
};
void ShortUrlEnginePluginManagerPrivate::initializePlugins()
......
......@@ -29,7 +29,11 @@ void TinyUrlEngineInterface::generateShortUrl()
{
const QString requestUrl = QStringLiteral("https://tinyurl.com/api-create.php?url=%1").arg(mOriginalUrl);
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);
#else
connect(reply, qOverload<QNetworkReply::NetworkError>(&QNetworkReply::errorOccurred), this, &TinyUrlEngineInterface::slotErrorFound);
#endif
}
void TinyUrlEngineInterface::slotShortUrlFinished(QNetworkReply *reply)
......
......@@ -29,7 +29,11 @@ void TripAbShortUrlEngineInterface::generateShortUrl()
{
const QString requestUrl = QStringLiteral("https://to.ly/api.php?longurl=%1").arg(mOriginalUrl);
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);
#else
connect(reply, qOverload<QNetworkReply::NetworkError>(&QNetworkReply::errorOccurred), this, &TripAbShortUrlEngineInterface::slotErrorFound);
#endif
}
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