diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2017-05-17 11:13:56 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-17 11:13:56 +0900 |
commit | eabb31a04889a8c8e9825f3d0024c1e8aa2cea54 (patch) | |
tree | b9b46139d636d3599662842ee613476543953e81 /connectiondata.cpp | |
parent | b459f1b3e5355b30a51e9d12a35d8aee6a842886 (diff) | |
parent | c25de4e19801c7931ce857c29a7a48be7f5c4dbe (diff) | |
download | libquotient-eabb31a04889a8c8e9825f3d0024c1e8aa2cea54.tar.gz libquotient-eabb31a04889a8c8e9825f3d0024c1e8aa2cea54.zip |
Merge pull request #62 from Fxrh/kitsune-refactoring
Code tweaks and cleanup
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) |