mirror of
https://github.com/wownero/wowlet.git
synced 2026-12-04 05:54:01 +01:00
refactor: UtilsNetworking -> Networking
This commit is contained in:
@@ -5,18 +5,18 @@
|
||||
#include <QNetworkReply>
|
||||
|
||||
#include "utils/Utils.h"
|
||||
#include "utils/networking.h"
|
||||
#include "utils/Networking.h"
|
||||
#include "utils/NetworkManager.h"
|
||||
#include "config.h"
|
||||
|
||||
UtilsNetworking::UtilsNetworking(QObject *parent)
|
||||
Networking::Networking(QObject *parent)
|
||||
: QObject(parent) {}
|
||||
|
||||
void UtilsNetworking::setUserAgent(const QString &userAgent) {
|
||||
void Networking::setUserAgent(const QString &userAgent) {
|
||||
this->m_userAgent = userAgent;
|
||||
}
|
||||
|
||||
QNetworkReply* UtilsNetworking::get(const QString &url) {
|
||||
QNetworkReply* Networking::get(const QString &url) {
|
||||
if (config()->get(Config::offlineMode).toBool()) {
|
||||
return nullptr;
|
||||
}
|
||||
@@ -30,7 +30,7 @@ QNetworkReply* UtilsNetworking::get(const QString &url) {
|
||||
return this->m_networkAccessManager->get(request);
|
||||
}
|
||||
|
||||
QNetworkReply* UtilsNetworking::getJson(const QString &url) {
|
||||
QNetworkReply* Networking::getJson(const QString &url) {
|
||||
if (config()->get(Config::offlineMode).toBool()) {
|
||||
return nullptr;
|
||||
}
|
||||
@@ -45,7 +45,7 @@ QNetworkReply* UtilsNetworking::getJson(const QString &url) {
|
||||
return this->m_networkAccessManager->get(request);
|
||||
}
|
||||
|
||||
QNetworkReply* UtilsNetworking::postJson(const QString &url, const QJsonObject &data) {
|
||||
QNetworkReply* Networking::postJson(const QString &url, const QJsonObject &data) {
|
||||
if (config()->get(Config::offlineMode).toBool()) {
|
||||
return nullptr;
|
||||
}
|
||||
@@ -4,19 +4,17 @@
|
||||
#ifndef FEATHER_NETWORKING_H
|
||||
#define FEATHER_NETWORKING_H
|
||||
|
||||
#include <QRegularExpression>
|
||||
#include <QtNetwork>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkReply>
|
||||
|
||||
#include "utils/Utils.h"
|
||||
|
||||
class UtilsNetworking : public QObject
|
||||
class Networking : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit UtilsNetworking(QObject *parent = nullptr);
|
||||
explicit Networking(QObject *parent = nullptr);
|
||||
|
||||
QNetworkReply* get(const QString &url);
|
||||
QNetworkReply* getJson(const QString &url);
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "config-feather.h"
|
||||
#include "Utils.h"
|
||||
#include "utils/AsyncTask.h"
|
||||
#include "utils/networking.h"
|
||||
#include "utils/Networking.h"
|
||||
#include "utils/NetworkManager.h"
|
||||
#include "utils/SemanticVersion.h"
|
||||
|
||||
@@ -25,7 +25,7 @@ Updater::Updater(QObject *parent) :
|
||||
}
|
||||
|
||||
void Updater::checkForUpdates() {
|
||||
UtilsNetworking network{this};
|
||||
Networking network{this};
|
||||
QNetworkReply *reply = network.getJson(QString("%1/updates.json").arg(this->getWebsiteUrl()));
|
||||
if (!reply) {
|
||||
emit updateCheckFailed("offline mode enabled");
|
||||
@@ -87,7 +87,7 @@ void Updater::wsUpdatesReceived(const QJsonObject &updates) {
|
||||
QString hashesUrl = QString("%1/files/releases/hashes-%2-plain.txt").arg(this->getWebsiteUrl(), newVersion);
|
||||
qDebug() << hashesUrl;
|
||||
|
||||
UtilsNetworking network{this};
|
||||
Networking network{this};
|
||||
QNetworkReply *reply = network.get(hashesUrl);
|
||||
|
||||
connect(reply, &QNetworkReply::finished, this, std::bind(&Updater::onSignedHashesReceived, this, reply, platformTag, newVersion));
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
DaemonRpc::DaemonRpc(QObject *parent, QString daemonAddress)
|
||||
: QObject(parent)
|
||||
, m_network(new UtilsNetworking(this))
|
||||
, m_network(new Networking(this))
|
||||
, m_daemonAddress(std::move(daemonAddress))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include "utils/networking.h"
|
||||
#include "utils/Networking.h"
|
||||
|
||||
class DaemonRpc : public QObject {
|
||||
Q_OBJECT
|
||||
@@ -42,7 +42,7 @@ private slots:
|
||||
QString onSendRawTransactionFailed(const QJsonObject &obj);
|
||||
|
||||
private:
|
||||
UtilsNetworking *m_network;
|
||||
Networking *m_network;
|
||||
QString m_daemonAddress;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user