Use static-global macro.
This commit is contained in:
parent
768c430bd2
commit
c01ea84e7b
@ -22,8 +22,8 @@
|
|||||||
#include <QNetworkReply>
|
#include <QNetworkReply>
|
||||||
#include <QAuthenticator>
|
#include <QAuthenticator>
|
||||||
|
|
||||||
|
Q_GLOBAL_STATIC(SilentNetworkAccessManager, qz_silent_acmanager)
|
||||||
|
|
||||||
QPointer<SilentNetworkAccessManager> SilentNetworkAccessManager::s_instance;
|
|
||||||
|
|
||||||
SilentNetworkAccessManager::SilentNetworkAccessManager(QObject* parent)
|
SilentNetworkAccessManager::SilentNetworkAccessManager(QObject* parent)
|
||||||
: BaseNetworkAccessManager(parent) {
|
: BaseNetworkAccessManager(parent) {
|
||||||
@ -36,11 +36,7 @@ SilentNetworkAccessManager::~SilentNetworkAccessManager() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SilentNetworkAccessManager* SilentNetworkAccessManager::instance() {
|
SilentNetworkAccessManager* SilentNetworkAccessManager::instance() {
|
||||||
if (s_instance.isNull()) {
|
return qz_silent_acmanager();
|
||||||
s_instance = new SilentNetworkAccessManager(qApp);
|
|
||||||
}
|
|
||||||
|
|
||||||
return s_instance;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SilentNetworkAccessManager::onAuthenticationRequired(QNetworkReply* reply, QAuthenticator* authenticator) {
|
void SilentNetworkAccessManager::onAuthenticationRequired(QNetworkReply* reply, QAuthenticator* authenticator) {
|
||||||
|
@ -39,9 +39,6 @@ class SilentNetworkAccessManager : public BaseNetworkAccessManager {
|
|||||||
public slots:
|
public slots:
|
||||||
// This cannot do any GUI stuff.
|
// This cannot do any GUI stuff.
|
||||||
void onAuthenticationRequired(QNetworkReply* reply, QAuthenticator* authenticator);
|
void onAuthenticationRequired(QNetworkReply* reply, QAuthenticator* authenticator);
|
||||||
|
|
||||||
private:
|
|
||||||
static QPointer<SilentNetworkAccessManager> s_instance;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SILENTNETWORKACCESSMANAGER_H
|
#endif // SILENTNETWORKACCESSMANAGER_H
|
||||||
|
Loading…
x
Reference in New Issue
Block a user