diff --git a/src/MainWindow.h b/src/MainWindow.h index e871c64..6bcc536 100644 --- a/src/MainWindow.h +++ b/src/MainWindow.h @@ -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" diff --git a/src/dialog/UpdateDialog.cpp b/src/dialog/UpdateDialog.cpp index e51bbae..e11b5a0 100644 --- a/src/dialog/UpdateDialog.cpp +++ b/src/dialog/UpdateDialog.cpp @@ -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); diff --git a/src/plugins/localmonero/LocalMoneroApi.cpp b/src/plugins/localmonero/LocalMoneroApi.cpp index 2d4cac3..d3c4b6e 100644 --- a/src/plugins/localmonero/LocalMoneroApi.cpp +++ b/src/plugins/localmonero/LocalMoneroApi.cpp @@ -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) { diff --git a/src/plugins/localmonero/LocalMoneroApi.h b/src/plugins/localmonero/LocalMoneroApi.h index 2fe6b98..0de7fe5 100644 --- a/src/plugins/localmonero/LocalMoneroApi.h +++ b/src/plugins/localmonero/LocalMoneroApi.h @@ -5,7 +5,7 @@ #define FEATHER_LOCALMONEROAPI_H #include -#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 ¤cyCode, const QString &countryCode="", const QString &paymentMethod="", const QString &amount = "", int page = 0); QString getBaseUrl(); - UtilsNetworking *m_network; + Networking *m_network; }; diff --git a/src/plugins/localmonero/LocalMoneroWidget.cpp b/src/plugins/localmonero/LocalMoneroWidget.cpp index 7a2c72d..264d56c 100644 --- a/src/plugins/localmonero/LocalMoneroWidget.cpp +++ b/src/plugins/localmonero/LocalMoneroWidget.cpp @@ -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); diff --git a/src/plugins/localmonero/LocalMoneroWidget.h b/src/plugins/localmonero/LocalMoneroWidget.h index edad19b..ebf8b34 100644 --- a/src/plugins/localmonero/LocalMoneroWidget.h +++ b/src/plugins/localmonero/LocalMoneroWidget.h @@ -48,7 +48,7 @@ private: LocalMoneroApi *m_api; LocalMoneroModel *m_model; - UtilsNetworking *m_network; + Networking *m_network; QJsonObject m_paymentMethods; }; diff --git a/src/utils/networking.cpp b/src/utils/Networking.cpp similarity index 80% rename from src/utils/networking.cpp rename to src/utils/Networking.cpp index 4c7293b..a2fcbb4 100644 --- a/src/utils/networking.cpp +++ b/src/utils/Networking.cpp @@ -5,18 +5,18 @@ #include #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; } diff --git a/src/utils/networking.h b/src/utils/Networking.h similarity index 82% rename from src/utils/networking.h rename to src/utils/Networking.h index bc33a0c..88a0e31 100644 --- a/src/utils/networking.h +++ b/src/utils/Networking.h @@ -4,19 +4,17 @@ #ifndef FEATHER_NETWORKING_H #define FEATHER_NETWORKING_H -#include -#include #include #include #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); diff --git a/src/utils/Updater.cpp b/src/utils/Updater.cpp index 4cfa07c..35ea692 100644 --- a/src/utils/Updater.cpp +++ b/src/utils/Updater.cpp @@ -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)); diff --git a/src/utils/daemonrpc.cpp b/src/utils/daemonrpc.cpp index 8414563..a6ff315 100644 --- a/src/utils/daemonrpc.cpp +++ b/src/utils/daemonrpc.cpp @@ -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)) { } diff --git a/src/utils/daemonrpc.h b/src/utils/daemonrpc.h index 496ce68..1a32520 100644 --- a/src/utils/daemonrpc.h +++ b/src/utils/daemonrpc.h @@ -6,7 +6,7 @@ #include -#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; };