]> Nutra Git (v1) - gamesguru/feather.git/commitdiff
refactor: UtilsNetworking -> Networking
authortobtoht <tob@featherwallet.org>
Wed, 29 Mar 2023 07:46:12 +0000 (09:46 +0200)
committertobtoht <tob@featherwallet.org>
Wed, 29 Mar 2023 07:46:12 +0000 (09:46 +0200)
src/MainWindow.h
src/dialog/UpdateDialog.cpp
src/plugins/localmonero/LocalMoneroApi.cpp
src/plugins/localmonero/LocalMoneroApi.h
src/plugins/localmonero/LocalMoneroWidget.cpp
src/plugins/localmonero/LocalMoneroWidget.h
src/utils/Networking.cpp [moved from src/utils/networking.cpp with 80% similarity]
src/utils/Networking.h [moved from src/utils/networking.h with 82% similarity]
src/utils/Updater.cpp
src/utils/daemonrpc.cpp
src/utils/daemonrpc.h

index e871c6453d31b472b657ef3fa5190f33b82b5040..6bcc5364c2102706d61f47f1e3c33e8aecc99ff3 100644 (file)
@@ -27,7 +27,7 @@
 #include "model/TransactionHistoryModel.h"
 #include "model/CoinsModel.h"
 #include "model/CoinsProxyModel.h"
-#include "utils/networking.h"
+#include "utils/Networking.h"
 #include "utils/config.h"
 #include "utils/daemonrpc.h"
 #include "utils/EventFilter.h"
index e51bbaea33f2a18adad11c88e50d1e78ef162e38..e11b5a06750a3d9e21fe387069f7e6501a027c44 100644 (file)
@@ -8,7 +8,7 @@
 
 #include "constants.h"
 #include "utils/AsyncTask.h"
-#include "utils/networking.h"
+#include "utils/Networking.h"
 #include "utils/NetworkManager.h"
 #include "utils/Updater.h"
 #include "utils/Utils.h"
@@ -86,7 +86,7 @@ void UpdateDialog::onDownloadClicked() {
     ui->btn_download->hide();
     ui->progressBar->show();
 
-    UtilsNetworking network{this};
+    Networking network{this};
 
     m_reply = network.get(m_updater->downloadUrl);
     connect(m_reply, &QNetworkReply::downloadProgress, this, &UpdateDialog::onDownloadProgress);
index 2d4cac3c1cca273b672de5a359272e6a3ff1def8..d3c4b6e0944fe36e50c3ad3647848a1afd7d29d4 100644 (file)
@@ -5,7 +5,7 @@
 
 #include "utils/config.h"
 
-LocalMoneroApi::LocalMoneroApi(QObject *parent, UtilsNetworking *network)
+LocalMoneroApi::LocalMoneroApi(QObject *parent, Networking *network)
     : QObject(parent)
     , m_network(network)
 {
index 2fe6b98b0b06debdbc142f5bdfbbd186d9a03fd7..0de7fe5cf8836a533ba6f5a9b097057d35722854 100644 (file)
@@ -5,7 +5,7 @@
 #define FEATHER_LOCALMONEROAPI_H
 
 #include <QObject>
-#include "utils/networking.h"
+#include "utils/Networking.h"
 
 class LocalMoneroApi : public QObject {
     Q_OBJECT
@@ -27,7 +27,7 @@ public:
         QJsonObject obj;
     };
 
-    explicit LocalMoneroApi(QObject *parent, UtilsNetworking *network);
+    explicit LocalMoneroApi(QObject *parent, Networking *network);
 
     void countryCodes();
     void currencies();
@@ -46,7 +46,7 @@ private:
     QString getBuySellUrl(bool buy, const QString &currencyCode, const QString &countryCode="", const QString &paymentMethod="", const QString &amount = "", int page = 0);
     QString getBaseUrl();
 
-    UtilsNetworking *m_network;
+    Networking *m_network;
 };
 
 
index 7a2c72dfcbd726c93f73b1b1dfc9a49685c1e933..264d56c89e8de880831e01e559b0bf38dbfcd20c 100644 (file)
@@ -24,7 +24,7 @@ LocalMoneroWidget::LocalMoneroWidget(QWidget *parent, Wallet *wallet)
 
     ui->combo_currency->addItem(config()->get(Config::preferredFiatCurrency).toString());
 
-    m_network = new UtilsNetworking(this);
+    m_network = new Networking(this);
     m_api = new LocalMoneroApi(this, m_network);
 
     m_model = new LocalMoneroModel(this);
index edad19bacd2a9fdd552bc5f025fdb9bb7d311179..ebf8b3430ca73497ffdc65a6317b6da64cee8fbe 100644 (file)
@@ -48,7 +48,7 @@ private:
 
     LocalMoneroApi *m_api;
     LocalMoneroModel *m_model;
-    UtilsNetworking *m_network;
+    Networking *m_network;
     QJsonObject m_paymentMethods;
 };
 
similarity index 80%
rename from src/utils/networking.cpp
rename to src/utils/Networking.cpp
index 4c7293bf4017478b1d4417f981fa8afe79265f84..a2fcbb4019c041b069def60bef5f7446de320bb1 100644 (file)
@@ -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;
     }
similarity index 82%
rename from src/utils/networking.h
rename to src/utils/Networking.h
index bc33a0cb04d25d01be74f430f0c05fa148e7f406..88a0e318e136eaae7169d3da2079ee172efa821d 100644 (file)
@@ -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);
index 4cfa07c0e6a2057e309039fb0aaf27fd7add4a14..35ea69282da92132caf51d8aeaa488edf50c6955 100644 (file)
@@ -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));
index 8414563499af8f3c496d74899bbbdd0628d5152a..a6ff315b7e07d946bfed83b4f914ad89dc2b64d8 100644 (file)
@@ -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))
 {
 }
index 496ce68a7438313303745285b79bbff37bcb2856..1a325204100a6ba39b8b743d61371c8cbba53636 100644 (file)
@@ -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;
 };