diff options
Diffstat (limited to 'connectiondata.cpp')
-rw-r--r-- | connectiondata.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/connectiondata.cpp b/connectiondata.cpp index a6d80d53..6c7eff8c 100644 --- a/connectiondata.cpp +++ b/connectiondata.cpp @@ -17,34 +17,34 @@ */ #include "connectiondata.h" -#include "util.h" -#include <QtCore/QDebug> +#include "logging.h" + #include <QtNetwork/QNetworkAccessManager> using namespace QMatrixClient; -class ConnectionData::Private +QNetworkAccessManager* getNam() +{ + static QNetworkAccessManager* _nam = new QNetworkAccessManager(); + return _nam; +} + +struct ConnectionData::Private { - public: - Private() : nam(nullptr) { } - - QUrl baseUrl; - QString accessToken; - QString lastEvent; - QNetworkAccessManager* nam; + QUrl baseUrl; + QString accessToken; + QString lastEvent; }; ConnectionData::ConnectionData(QUrl baseUrl) : d(new Private) { d->baseUrl = baseUrl; - d->nam = new QNetworkAccessManager(); } ConnectionData::~ConnectionData() { - d->nam->deleteLater(); delete d; } @@ -60,7 +60,7 @@ QUrl ConnectionData::baseUrl() const QNetworkAccessManager* ConnectionData::nam() const { - return d->nam; + return getNam(); } void ConnectionData::setToken(QString token) |