Merge pull request 'Misc code cleanup' (#267) from tobtoht/feather:cleanup_1 into master

Reviewed-on: https://git.wownero.com/feather/feather/pulls/267
This commit is contained in:
tobtoht 2020-12-28 04:43:15 +00:00
commit 9bfce25666
93 changed files with 20 additions and 426 deletions

View file

@ -1,35 +1,19 @@
// SPDX-License-Identifier: BSD-3-Clause
// Copyright (c) 2020-2021, The Monero Project.
#include <stdexcept>
#include <QDir>
#include <QStandardPaths>
#include <QMessageBox>
#include <QClipboard>
#include <QDesktopWidget>
#include "appcontext.h"
#include "globals.h"
#include "utils/tails.h"
#include "utils/whonix.h"
#include "utils/utils.h"
#include "utils/prices.h"
#include "utils/networktype.h"
#include "utils/wsclient.h"
#include "utils/config.h"
// libwalletqt
#include "libwalletqt/WalletManager.h"
#include "libwalletqt/Wallet.h"
#include "libwalletqt/TransactionHistory.h"
#include "libwalletqt/SubaddressAccount.h"
#include "libwalletqt/Subaddress.h"
#include "libwalletqt/Coins.h"
#include "model/TransactionHistoryModel.h"
#include "model/SubaddressAccountModel.h"
#include "model/SubaddressModel.h"
#include "utils/keysfiles.h"
#include "utils/networktype.h"
Prices *AppContext::prices = nullptr;
@ -125,8 +109,8 @@ AppContext::AppContext(QCommandLineParser *cmdargs) {
connect(this->ws, &WSClient::WSMessage, this, &AppContext::onWSMessage);
// timers
m_storeTimer->setSingleShot(true);
connect(this->m_storeTimer, &QTimer::timeout, [this](){
m_storeTimer.setSingleShot(true);
connect(&m_storeTimer, &QTimer::timeout, [this](){
if (!this->currentWallet)
return;
qDebug() << "Storing wallet";
@ -186,7 +170,7 @@ void AppContext::initTor() {
this->tor->start();
if (!(isWhonix)) {
auto networkProxy = new QNetworkProxy(QNetworkProxy::Socks5Proxy, Tor::torHost, Tor::torPort);
this->networkProxy = new QNetworkProxy(QNetworkProxy::Socks5Proxy, Tor::torHost, Tor::torPort);
this->network->setProxy(*networkProxy);
if (m_wsUrl.host().endsWith(".onion"))
this->ws->webSocket.setProxy(*networkProxy);
@ -301,7 +285,6 @@ void AppContext::onPreferredFiatCurrencyChanged(const QString &symbol) {
if(this->currentWallet) {
auto *model = this->currentWallet->transactionHistoryModel();
if(model != nullptr) {
model->preferredFiatSign = AppContext::prices->fiat[symbol];
model->preferredFiatSymbol = symbol;
}
}
@ -344,7 +327,6 @@ void AppContext::onWalletOpened(Wallet *wallet) {
connect(this->currentWallet, &Wallet::transactionCommitted, this, &AppContext::onTransactionCommitted);
connect(this->currentWallet, &Wallet::heightRefreshed, this, &AppContext::onHeightRefreshed);
connect(this->currentWallet, &Wallet::transactionCreated, this, &AppContext::onTransactionCreated);
connect(this->currentWallet, &Wallet::connectionStatusChanged, this, &AppContext::onConnectionStatusChanged);
emit walletOpened();
@ -787,15 +769,11 @@ void AppContext::onTransactionCommitted(bool status, PendingTransaction *tx, con
}
}
void AppContext::onConnectionStatusChanged(int status) {
}
void AppContext::storeWallet() {
if (m_storeTimer->isActive())
if (m_storeTimer.isActive())
return;
m_storeTimer->start(60000);
m_storeTimer.start(60000);
}
void AppContext::updateBalance() {

View file

@ -35,7 +35,7 @@ Q_OBJECT
public:
explicit AppContext(QCommandLineParser *cmdargs);
~AppContext();
~AppContext() override;
bool isTails = false;
bool isWhonix = false;
bool isDebug = false;
@ -75,9 +75,9 @@ public:
QNetworkAccessManager *network;
QNetworkAccessManager *networkClearnet;
QNetworkProxy *networkProxy;
QNetworkProxy *networkProxy{};
Tor *tor;
Tor *tor{};
WSClient *ws;
XmrTo *XMRTo;
XmRig *XMRig;
@ -109,7 +109,7 @@ public:
public slots:
void onOpenWallet(const QString& path, const QString &password);
void onCreateTransaction(const QString &address, const double amount, const QString &description, bool all);
void onCreateTransaction(const QString &address, double amount, const QString &description, bool all);
void onCreateTransaction(XmrToOrder *order);
void onCancelTransaction(PendingTransaction *tx, const QString &address);
void onSweepOutput(const QString &keyImage, QString address, bool churn, int outputs) const;
@ -134,7 +134,6 @@ private slots:
void onHeightRefreshed(quint64 walletHeight, quint64 daemonHeight, quint64 targetHeight);
void onTransactionCreated(PendingTransaction *tx, const QString &address, const QString &paymentId, quint32 mixin);
void onTransactionCommitted(bool status, PendingTransaction *t, const QStringList& txid);
void onConnectionStatusChanged(int status);
signals:
void balanceUpdated(quint64 balance, quint64 spendable);
@ -173,8 +172,8 @@ signals:
private:
const int m_donationBoundary = 15;
UtilsNetworking *m_utilsNetworkingNodes;
QTimer *m_storeTimer = new QTimer(this);
UtilsNetworking *m_utilsNetworkingNodes{};
QTimer m_storeTimer;
QUrl m_wsUrl = QUrl(QStringLiteral("ws://7e6egbawekbkxzkv4244pqeqgoo4axko2imgjbedwnn6s5yb6b7oliqd.onion/ws"));
};

View file

@ -5,7 +5,6 @@
#include "calcwidget.h"
#include "ui_calcwidget.h"
#include "utils/config.h"
#include "mainwindow.h"
CalcWidget::CalcWidget(QWidget *parent) :

View file

@ -17,7 +17,7 @@ Q_OBJECT
public:
explicit CalcWidget(QWidget *parent = nullptr);
~CalcWidget();
~CalcWidget() override;
signals:
void closed();

View file

@ -4,17 +4,9 @@
#include "cli.h"
// libwalletqt
#include "Wallet.h"
#include "libwalletqt/TransactionHistory.h"
#include "libwalletqt/SubaddressAccount.h"
#include "libwalletqt/Subaddress.h"
#include "libwalletqt/AddressBook.h"
#include "libwalletqt/Coins.h"
#include "model/AddressBookModel.h"
#include "model/TransactionHistoryModel.h"
#include "model/SubaddressAccountModel.h"
#include "model/SubaddressModel.h"
#include "model/CoinsModel.h"
CLI::CLI(AppContext *ctx, QObject *parent) :
QObject(parent),

View file

@ -3,17 +3,11 @@
#include "coinswidget.h"
#include "ui_coinswidget.h"
#include "model/ModelUtils.h"
#include "utils/utils.h"
#include "dialog/outputinfodialog.h"
#include "dialog/outputsweepdialog.h"
#include "mainwindow.h"
#include <QClipboard>
#include <QDebug>
#include <QKeyEvent>
#include <QMenu>
#include <QAction>
#include <QMessageBox>
CoinsWidget::CoinsWidget(QWidget *parent)

View file

@ -3,7 +3,6 @@
#include "broadcasttxdialog.h"
#include "ui_broadcasttxdialog.h"
#include "utils/nodes.h"
#include <QMessageBox>

View file

@ -4,10 +4,6 @@
#include "debuginfodialog.h"
#include "ui_debuginfodialog.h"
#include "config-feather.h"
#include "utils/utils.h"
#include <QDateTime>
#include <QSysInfo>
DebugInfoDialog::DebugInfoDialog(AppContext *ctx, QWidget *parent)
: QDialog(parent)

View file

@ -4,11 +4,8 @@
#include "outputinfodialog.h"
#include "ui_outputinfodialog.h"
#include "model/ModelUtils.h"
#include "libwalletqt/CoinsInfo.h"
#include "utils/utils.h"
#include <QFont>
OutputInfoDialog::OutputInfoDialog(CoinsInfo *cInfo, QWidget *parent)
: QDialog(parent)
, ui(new Ui::OutputInfoDialog)

View file

@ -4,7 +4,6 @@
#include "passwordchangedialog.h"
#include "ui_passwordchangedialog.h"
#include <QPushButton>
#include <QMessageBox>
PasswordChangeDialog::PasswordChangeDialog(QWidget *parent, Wallet *wallet)

View file

@ -3,7 +3,6 @@
#include "qrcodedialog.h"
#include "ui_qrcodedialog.h"
#include "qrcode/QrCode.h"
#include <QClipboard>
#include <QFileDialog>

View file

@ -3,8 +3,6 @@
#include "restoredialog.h"
#include "ui_restoredialog.h"
#include "utils/utils.h"
#include "appcontext.h"
RestoreDialog::RestoreDialog(AppContext *ctx, QWidget *parent)
: QDialog(parent)

View file

@ -3,11 +3,8 @@
#include "txconfadvdialog.h"
#include "ui_txconfadvdialog.h"
#include "libwalletqt/WalletManager.h"
#include "qrcode/QrCode.h"
#include "dialog/qrcodedialog.h"
#include "utils/utils.h"
#include "libwalletqt/PendingTransactionInfo.h"
#include "libwalletqt/Transfer.h"
#include "libwalletqt/Input.h"
#include "model/ModelUtils.h"

View file

@ -3,10 +3,7 @@
#include "txconfdialog.h"
#include "ui_txconfdialog.h"
#include "appcontext.h"
#include "utils/config.h"
#include "model/ModelUtils.h"
#include "libwalletqt/WalletManager.h"
#include "txconfadvdialog.h"
#include "globals.h"

View file

@ -25,8 +25,6 @@ public:
private:
void setShowAdvanced();
void saveToFile();
void copyToClipboard();
Ui::TxConfDialog *ui;
AppContext *m_ctx;

View file

@ -4,7 +4,6 @@
#include "verifyproofdialog.h"
#include "ui_verifyproofdialog.h"
#include "utils/utils.h"
#include "libwalletqt/WalletManager.h"
#include <QMessageBox>

View file

@ -4,8 +4,6 @@
#include "xmrtoinfodialog.h"
#include "ui_xmrtoinfodialog.h"
#include <QFont>
XmrToInfoDialog::XmrToInfoDialog(XmrToOrder *oInfo, QWidget *parent)
: QDialog(parent)
, ui(new Ui::XmrToInfoDialog)

View file

@ -4,10 +4,6 @@
#include "historywidget.h"
#include "ui_historywidget.h"
#include "dialog/transactioninfodialog.h"
#include "libwalletqt/TransactionHistory.h"
#include "model/TransactionHistoryProxyModel.h"
#include <QIcon>
HistoryWidget::HistoryWidget(QWidget *parent)
: QWidget(parent)

View file

@ -2,7 +2,6 @@
// Copyright (c) 2014-2021, The Monero Project.
#include "AddressBook.h"
#include "AddressBookInfo.h"
#include <QDebug>
AddressBook::AddressBook(Monero::AddressBook *abImpl,QObject *parent)

View file

@ -5,15 +5,9 @@
#include <QDebug>
#include "Coins.h"
#include "CoinsInfo.h"
#include <wallet/api/wallet2_api.h>
#include <QFile>
#include <QDebug>
#include <QReadLocker>
#include <QWriteLocker>
#include <QtGlobal>
bool Coins::coin(int index, std::function<void (CoinsInfo &)> callback)

View file

@ -3,9 +3,6 @@
#include "CoinsInfo.h"
#include "libwalletqt/WalletManager.h"
#include "Transfer.h"
#include <QDateTime>
#include <QDebug>
quint64 CoinsInfo::blockHeight() const
{

View file

@ -2,7 +2,6 @@
// Copyright (c) 2014-2021, The Monero Project.
#include "PassphraseHelper.h"
#include <QMutexLocker>
#include <QDebug>
Monero::optional<std::string> PassphraseHelper::onDevicePassphraseRequest(bool & on_device)

View file

@ -2,8 +2,6 @@
// Copyright (c) 2014-2021, The Monero Project.
#include "PendingTransactionInfo.h"
#include "Input.h"
#include "Transfer.h"
quint64 PendingTransactionInfo::fee() const {
return m_fee;

View file

@ -5,13 +5,6 @@
#include "TransactionInfo.h"
#include "utils/utils.h"
#include "appcontext.h"
#include <wallet/api/wallet2_api.h>
#include <QFile>
#include <QDebug>
#include <QReadLocker>
#include <QWriteLocker>
#include <QtGlobal>
bool TransactionHistory::transaction(int index, std::function<void (TransactionInfo &)> callback)

View file

@ -5,8 +5,6 @@
#include "libwalletqt/WalletManager.h"
#include "Transfer.h"
#include "Ring.h"
#include <QDateTime>
#include <QDebug>
TransactionInfo::Direction TransactionInfo::direction() const
{

View file

@ -2,7 +2,6 @@
// Copyright (c) 2014-2021, The Monero Project.
#include "UnsignedTransaction.h"
#include <QVector>
#include <QDebug>
UnsignedTransaction::Status UnsignedTransaction::status() const

View file

@ -3,12 +3,6 @@
#include "Wallet.h"
#include <chrono>
#include <stdexcept>
#include <thread>
#include "PendingTransaction.h"
#include "UnsignedTransaction.h"
#include "TransactionHistory.h"
#include "AddressBook.h"
#include "Subaddress.h"
@ -20,17 +14,6 @@
#include "model/SubaddressModel.h"
#include "model/SubaddressAccountModel.h"
#include "model/CoinsModel.h"
#include "wallet/api/wallet2_api.h"
#include <QFile>
#include <QDir>
#include <QDebug>
#include <QUrl>
#include <QTimer>
#include <QtConcurrent/QtConcurrent>
#include <QList>
#include <QVector>
#include <QMutexLocker>
#include "utils/ScopeGuard.h"

View file

@ -3,15 +3,6 @@
#include "libwalletqt/WalletManager.h"
#include "Wallet.h"
#include "wallet/api/wallet2_api.h"
#include <QFile>
#include <QDir>
#include <QDebug>
#include <QUrl>
#include <QtConcurrent/QtConcurrent>
#include <QMutex>
#include <QMutexLocker>
#include <QString>
//#include "qt/updater.h"
#include "utils/ScopeGuard.h"

View file

@ -9,10 +9,6 @@
#include "config-feather.h"
#include "mainwindow.h"
#include "cli.h"
#include "utils/utils.h"
#include "appcontext.h"
#include <QtPlugin>
#if defined(Q_OS_WIN)
#include <windows.h>

View file

@ -7,11 +7,8 @@
#include <QCoreApplication>
#include <QSystemTrayIcon>
#include <QFileDialog>
#include <QInputDialog>
#include "mainwindow.h"
#include "widgets/ccswidget.h"
#include "widgets/redditwidget.h"
#include "dialog/txconfdialog.h"
#include "dialog/txconfadvdialog.h"
#include "dialog/debuginfodialog.h"
@ -22,23 +19,11 @@
#include "dialog/tximportdialog.h"
#include "dialog/passworddialog.h"
#include "dialog/balancedialog.h"
#include "utils/utils.h"
#include "utils/config.h"
#include "utils/daemonrpc.h"
#include "components.h"
#include "calcwindow.h"
#include "ui_mainwindow.h"
#include "globals.h"
// libwalletqt
#include "libwalletqt/WalletManager.h"
#include "Wallet.h"
#include "libwalletqt/TransactionHistory.h"
#include "libwalletqt/SubaddressAccount.h"
#include "libwalletqt/AddressBook.h"
#include "model/SubaddressAccountModel.h"
#include "model/SubaddressModel.h"
#include "utils/networktype.h"
MainWindow * MainWindow::pMainWindow = nullptr;

View file

@ -12,6 +12,7 @@
#include <QSystemTrayIcon>
#include <QScreen>
#include <QtWidgets/QMenu>
#include <utility>
#include <model/SubaddressModel.h>
#include <model/SubaddressProxyModel.h>
#include <model/TransactionHistoryModel.h>
@ -43,8 +44,8 @@ namespace Ui {
}
struct ToggleTab {
ToggleTab(QWidget *tab, const QString &name, const QString &description, QAction *menuAction, Config::ConfigKey configKey) :
tab(tab), key(name), name(description), menuAction(menuAction), configKey(configKey){}
ToggleTab(QWidget *tab, QString name, QString description, QAction *menuAction, Config::ConfigKey configKey) :
tab(tab), key(std::move(name)), name(std::move(description)), menuAction(menuAction), configKey(configKey){}
QWidget *tab;
QString key;
QString name;

View file

@ -5,12 +5,6 @@
#include "AddressBook.h"
#include "ModelUtils.h"
#include "utils/utils.h"
#include <wallet/api/wallet2_api.h>
#include <QDebug>
#include <QFileDialog>
#include <QDir>
#include <QFontDatabase>
AddressBookModel::AddressBookModel(QObject *parent, AddressBook *addressBook)
: QAbstractTableModel(parent),

View file

@ -4,14 +4,10 @@
#include "CoinsModel.h"
#include "CoinsInfo.h"
#include "Coins.h"
#include <wallet/api/wallet2_api.h>
#include "ModelUtils.h"
#include "globals.h"
#include <QDebug>
#include <QHash>
#include <QBrush>
#include <QColor>
#include <QFont>
CoinsModel::CoinsModel(QObject *parent, Coins *coins)

View file

@ -4,7 +4,6 @@
#include "ModelUtils.h"
#include <QDebug>
#include <QStringList>
#include <QClipboard>
#include <QApplication>
#include <QFont>

View file

@ -3,7 +3,6 @@
#include "NodeModel.h"
#include <utils/nodes.h>
#include "appcontext.h"
NodeModel::NodeModel(int nodeSource, QObject *parent)
: QAbstractTableModel(parent)

View file

@ -3,10 +3,8 @@
#include "SubaddressAccountModel.h"
#include "SubaddressAccount.h"
#include <wallet/api/wallet2_api.h>
#include <QDebug>
#include <QHash>
SubaddressAccountModel::SubaddressAccountModel(QObject *parent, SubaddressAccount *subaddressAccount)
: QAbstractListModel(parent), m_subaddressAccount(subaddressAccount)

View file

@ -4,9 +4,7 @@
#include "SubaddressModel.h"
#include "Subaddress.h"
#include "ModelUtils.h"
#include <wallet/api/wallet2_api.h>
#include <QHash>
#include <QPoint>
#include <QColor>
#include <QBrush>

View file

@ -6,10 +6,6 @@
#include "TransactionInfo.h"
#include "globals.h"
#include <QDateTime>
#include <QDebug>
#include <QIcon>
TransactionHistoryModel::TransactionHistoryModel(QObject *parent)
: QAbstractTableModel(parent),
m_transactionHistory(nullptr)

View file

@ -35,7 +35,6 @@ public:
void setTransactionHistory(TransactionHistory * th);
TransactionHistory * transactionHistory() const;
QString preferredFiatSign = "$";
QString preferredFiatSymbol = "USD";
int rowCount(const QModelIndex & parent = QModelIndex()) const override;
int columnCount(const QModelIndex &parent = QModelIndex()) const override;

View file

@ -5,7 +5,6 @@
#include "TransactionHistoryModel.h"
#include "libwalletqt/TransactionInfo.h"
#include <QSet>
TransactionHistoryProxyModel::TransactionHistoryProxyModel(Wallet *wallet, QObject *parent)
: QSortFilterProxyModel(parent),

View file

@ -28,17 +28,13 @@
#include "openpgp.h"
#include <algorithm>
#include <locale>
#include <vector>
#include <string_coding.h>
#include "hash.h"
#include "mpi.h"
#include "packet_stream.h"
#include "s_expression.h"
#include "serialization.h"
namespace openpgp
{

View file

@ -21,15 +21,9 @@
#include "QrCode_p.h"
#include <QBrush>
#include <QByteArray>
#include <QIODevice>
#include <QImage>
#include <QPainter>
#include <QPen>
#include <QString>
#include <QSvgGenerator>
#include <QVariant>
#include <QPixmap>
#include <QDebug>

View file

@ -3,12 +3,10 @@
#include "ui_receivewidget.h"
#include "receivewidget.h"
#include "qrcode/QrCode.h"
#include "model/ModelUtils.h"
#include "dialog/qrcodedialog.h"
#include <QMenu>
#include <QClipboard>
ReceiveWidget::ReceiveWidget(QWidget *parent) :
QWidget(parent),

View file

@ -3,7 +3,6 @@
#include <QMessageBox>
#include "sendwidget.h"
#include "widgets/ccswidget.h"
#include "mainwindow.h"
#include "ui_sendwidget.h"
@ -150,7 +149,7 @@ void SendWidget::updateConversionLabel() {
auto preferredFiatCurrency = config()->get(Config::preferredFiatCurrency).toString();
double conversionAmount = AppContext::prices->convert("XMR", preferredFiatCurrency, this->amount());
return QString("~%1 %2").arg(QString::number(conversionAmount, 'f', 2), preferredFiatCurrency);
};
}
}();
ui->label_conversionAmount->setText(conversionAmountStr);

View file

@ -3,8 +3,6 @@
#include "settings.h"
#include "ui_settings.h"
#include "appcontext.h"
#include "utils/config.h"
#include "mainwindow.h"
#include <QFileDialog>

View file

@ -1,8 +1,6 @@
// SPDX-License-Identifier: BSD-3-Clause
// Copyright (c) 2020-2021, The Monero Project.
#include <QtCore>
#include <QProcess>
#include "utils/childproc.h"
ChildProcess::ChildProcess(QObject* parent) {}

View file

@ -4,7 +4,6 @@
#ifndef FEATHER_FPROCESS_H
#define FEATHER_FPROCESS_H
#include <QtCore>
#include <QProcess>
#if defined(HAVE_SYS_PRCTL_H) && defined(Q_OS_UNIX)

View file

@ -7,10 +7,6 @@
#include "utils/utils.h"
#include "utils/tails.h"
#include <QCoreApplication>
#include <QDir>
#include <QStandardPaths>
#define QS QStringLiteral
struct ConfigDirective

View file

@ -3,8 +3,6 @@
#include "daemonrpc.h"
#include <utility>
DaemonRpc::DaemonRpc(QObject *parent, UtilsNetworking *network, QString daemonAddress)
: QObject(parent)
, m_network(network)

View file

@ -7,14 +7,8 @@
#include <QDebug>
#include <QUrl>
#include <QtConcurrent/QtConcurrent>
#include <QMutex>
#include <QString>
#include "appcontext.h"
#include "utils/config.h"
#include "utils/networktype.h"
#include "utils/utils.h"
#include "keysfiles.h"
using namespace std::chrono;

View file

@ -7,7 +7,6 @@
#include "libwalletqt/WalletManager.h"
#include "utils/networktype.h"
#include "utils/utils.h"
#include <QtCore>
class WalletKeysFiles
{

View file

@ -1,8 +1,6 @@
// SPDX-License-Identifier: BSD-3-Clause
// Copyright (c) 2020-2021, The Monero Project.
#include <QtCore>
#include <QObject>
#include <QNetworkAccessManager>
#include <QNetworkReply>

View file

@ -4,16 +4,13 @@
#ifndef FEATHER_NETWORKING_H
#define FEATHER_NETWORKING_H
#include <QtCore>
#include <QRegExp>
#include <QApplication>
#include <QtNetwork>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include "utils/utils.h"
static QStringList randomHTTPAgents;
class CCSEntry;
class UtilsNetworking : public QObject

View file

@ -1,7 +1,6 @@
// SPDX-License-Identifier: BSD-3-Clause
// Copyright (c) 2020-2021, The Monero Project.
#include <QtCore>
#include <QObject>
#include <QNetworkAccessManager>

View file

@ -4,7 +4,6 @@
#ifndef FEATHER_NODES_H
#define FEATHER_NODES_H
#include <QtCore>
#include <QTimer>
#include <QRegExp>
#include <QApplication>

View file

@ -3,7 +3,6 @@
#include <QStandardPaths>
#include <QScreen>
#include <QObject>
#include <QDesktopWidget>
#include "utils/prices.h"

View file

@ -3,10 +3,6 @@
#include "scheduler.h"
#include <mutex>
#include <QThreadPool>
FutureScheduler::FutureScheduler(QObject *parent)
: QObject(parent), Alive(0), Stopping(false)
{

View file

@ -4,7 +4,6 @@
#ifndef FEATHER_SEEDS_H
#define FEATHER_SEEDS_H
#include <QtCore>
#include <cstdio>
#include <cstdlib>
#include <sstream>
@ -16,7 +15,6 @@
#include "libwalletqt/Wallet.h"
#include "utils/utils.h"
struct RestoreHeightLookup {
NetworkType::Type type;
QMap<int, int> data;

View file

@ -3,9 +3,6 @@
#include <QRegExp>
#include <QMessageBox>
#include <QPixmap>
#include <QTranslator>
#include <QCheckBox>
#include "tails.h"
#include "utils.h"

View file

@ -16,7 +16,6 @@ public:
static QString version();
static void showDataPersistenceDisabledWarning();
static void askPersistence();
static void persistXdgMime(const QString& filePath, const QString& data);
static bool usePersistence;

View file

@ -54,8 +54,6 @@
#include <QAbstractItemView>
#include <QtDebug>
#include <QApplication>
#include <QModelIndex>
#include <QAbstractItemModel>
#include <QScrollBar>

View file

@ -1,10 +1,8 @@
// SPDX-License-Identifier: BSD-3-Clause
// Copyright (c) 2020-2021, The Monero Project.
#include <QtCore>
#include <QScreen>
#include <QDesktopWidget>
#include <QProcess>
#include <QDesktopServices>
#include "utils/utils.h"
#include "utils/tor.h"
@ -217,48 +215,6 @@ bool Tor::unpackBins() {
return true;
}
networkPeer Tor::getPeerFromConfig(const QString &path) {
// parse Tor bind addr from given Tor config
QRegularExpression re("^SocksPort ([\\d|.|:]+)");
networkPeer peer;
peer.host = "127.0.0.1";
peer.port = 9050;
if(!Utils::fileExists(path)) {
peer.active = Utils::portOpen(peer.host, peer.port);
return peer;
}
for(const auto &line: Utils::fileOpen(path).split('\n')) {
QRegularExpressionMatch match = re.match(line);
if(!match.hasMatch())
continue;
QString match_group = match.captured(1);
int host_idx = match_group.indexOf(':');
if(host_idx >= 1){
peer.host = match_group.mid(0, host_idx);
QString port = match_group.mid(host_idx + 1);
if(!Utils::isDigit(port))
continue;
peer.port = (quint16)port.toInt();
qDebug() << "Parsed port from local Tor config";
break;
}
if(Utils::isDigit(match_group)) {
peer.port = (quint16)match_group.toInt();
qDebug() << "Parsed port from local Tor config";
break;
}
}
peer.active = Utils::portOpen(peer.host, peer.port);
return peer;
}
QString Tor::getVersion() {
QProcess process;
process.setProcessChannelMode(QProcess::MergedChannels);

View file

@ -7,11 +7,8 @@
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <QtCore>
#include <QRegExp>
#include <QtNetwork>
#include <QApplication>
#include <QMainWindow>
#include "utils/childproc.h"
class Tor : public QObject
@ -25,7 +22,6 @@ public:
void stop();
bool unpackBins();
QString getVersion();
networkPeer getPeerFromConfig(const QString &path);
bool torConnected = false;
bool localTor = false;

View file

@ -1,10 +1,7 @@
// SPDX-License-Identifier: BSD-3-Clause
// Copyright (c) 2020-2021, The Monero Project.
#include <QtCore>
#include <QObject>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <iomanip>
#include "txfiathistory.h"

View file

@ -4,7 +4,6 @@
#ifndef FEATHER_TXFIATHISTORY_H
#define FEATHER_TXFIATHISTORY_H
class TxFiatHistory : public QObject {
Q_OBJECT

View file

@ -1,23 +1,13 @@
// SPDX-License-Identifier: BSD-3-Clause
// Copyright (c) 2020-2021, The Monero Project.
#include <QtCore>
#include <QtGlobal>
#include <QObject>
#include <QScreen>
#include <QMessageBox>
#include <QtNetwork>
#include <QTcpSocket>
#include <QClipboard>
#include <QDesktopWidget>
#include <QProcess>
#include <QCompleter>
#include <QDesktopServices>
#include <QApplication>
#include <QMainWindow>
#include <QTextStream>
#include <QtWidgets/QStyle>
#include <QVector>
#include "utils.h"
#include "utils/config.h"
@ -214,69 +204,6 @@ QByteArray Utils::readSocket(QTcpSocket &socket, int buffer_size) {
return data;
}
bool Utils::testSocks5(const QString &host, quint16 port){
// synchronous socks5 tester
QByteArray data;
QTcpSocket socket;
socket.connectToHost(host, port);
if (!socket.waitForConnected(1000)) {
qDebug() << QString("could not connect to %1 %2")
.arg(host).arg(port);
socket.close();
return false;
}
// latest & greatest
socket.write(QByteArray("\x05\x02", 2));
socket.flush();
// no auth pl0x
socket.write(QByteArray("\x00\x01", 2));
socket.flush();
// cool story
if(Utils::readSocket(socket, 2).isEmpty()){
qDebug() << "socks response timeout";
socket.close();
return false;
}
// pls sir
socket.write(QByteArray("\x05\x01\x00\x03", 4));
// here we go!!
socket.write(QByteArray("\x16", 1)); // len
socket.write(QByteArray("kebjllr47c2ouoly.onion"));
socket.write(QByteArray("\x00\x50", 2)); // port
socket.flush();
// fingers crossed
auto result = Utils::readSocket(socket, 10);
qDebug() << result;
if(result.length() != 10 || result.at(1) != 0) {
qDebug() << "bad socks response";
socket.close();
return false;
}
// can haz?
QByteArray http("GET /api/v1/ping HTTP/1.1\r\nHost: kebjllr47c2ouoly.onion\r\nConnection: close\r\n\r\n");
socket.write(http);
auto resp = Utils::readSocket(socket, 555);
QRegularExpression re(R"(^HTTP\/\d.\d 200 OK)");
QRegularExpressionMatch match = re.match(resp);
if(match.hasMatch()){
socket.close();
return true;
}
qDebug() << resp;
socket.close();
return false;
}
void Utils::externalLinkWarning(QWidget *parent, const QString &url){
if(!config()->get(Config::warnOnExternalLink).toBool()) {
QDesktopServices::openUrl(QUrl(url));

View file

@ -6,7 +6,6 @@
#include <cstdio>
#include <cstdlib>
#include <QtCore>
#include <QRegExp>
#include <QStandardItemModel>
#include <QtNetwork>
@ -80,7 +79,7 @@ public:
static bool dirExists(const QString &path);
static QString barrayToString(const QByteArray &data);
static QByteArray readSocket(QTcpSocket &socket, int buffer_size);
static bool testSocks5(const QString &host, quint16 port);
static QStandardItem *qStandardItem(const QString &text);
static QStandardItem *qStandardItem(const QString &text, QFont &font);
static void copyToClipboard(const QString &string);

View file

@ -3,14 +3,11 @@
#include <QObject>
#include <QNetworkAccessManager>
#include <QStandardPaths>
#include <QScreen>
#include <QDesktopWidget>
#include <QtCore>
#include "wsclient.h"
#include "appcontext.h"
WSClient::WSClient(AppContext *ctx, const QUrl &url, QObject *parent) :
QObject(parent),
url(url),

View file

@ -4,9 +4,9 @@
#ifndef ECHOCLIENT_H
#define ECHOCLIENT_H
#include <QtCore/QObject>
#include <QObject>
#include <QtWebSockets/QWebSocket>
#include <QtCore/QTimer>
#include <QTimer>
class AppContext;
class WSClient : public QObject

View file

@ -1,10 +1,8 @@
// SPDX-License-Identifier: BSD-3-Clause
// Copyright (c) 2020-2021, The Monero Project.
#include <QtCore>
#include <QScreen>
#include <QDesktopWidget>
#include <QProcess>
#include <QDesktopServices>
#include "utils/utils.h"

View file

@ -7,7 +7,6 @@
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <QtCore>
#include <QRegExp>
#include <QtNetwork>
#include <QApplication>
@ -25,7 +24,6 @@ public:
void start(const QString &path, int threads, const QString &address, const QString &username, const QString &password, bool tor = false, bool tls = true);
void stop();
bool unpackBins();
QString rigDir;
QString rigPath;

View file

@ -3,7 +3,6 @@
#include "xmrto.h"
#include "utils/xmrtoorder.h"
#include "appcontext.h"
QMap<OrderState, QString> XmrTo::stateMap;

View file

@ -3,8 +3,6 @@
#include "xmrtoapi.h"
#include <utility>
XmrToApi::XmrToApi(QObject *parent, UtilsNetworking *network, QString baseUrl)
: QObject(parent)
, m_network(network)

View file

@ -3,12 +3,9 @@
#include "xmrtoorder.h"
#include <utility>
#include "libwalletqt/Wallet.h"
#include "appcontext.h"
#include "globals.h"
#include "utils/xmrto.h"
XmrToOrder::XmrToOrder(AppContext *ctx, UtilsNetworking *network, QString baseUrl, bool clearnet, XmrToRates *rates, QObject *parent) :
QObject(parent),

View file

@ -3,13 +3,10 @@
#include <QStandardItemModel>
#include <QTableWidget>
#include <QProgressBar>
#include <QMessageBox>
#include <QDesktopServices>
#include "ccswidget.h"
#include "ui_ccswidget.h"
#include "utils/utils.h"
#include "ccsprogressdelegate.h"
CCSWidget::CCSWidget(QWidget *parent) :

View file

@ -1,21 +1,14 @@
// SPDX-License-Identifier: BSD-3-Clause
// Copyright (c) 2020-2021, The Monero Project.
#include <QtCore>
#include <QPlainTextEdit>
#include <QInputDialog>
#include <QStandardItemModel>
#include <QTableWidget>
#include <QProgressBar>
#include <QMessageBox>
#include <QDesktopServices>
#include <utils/config.h>
#include "model/NodeModel.h"
#include "nodewidget.h"
#include "ui_nodewidget.h"
#include "utils/utils.h"
#include "utils/nodes.h"
#include "mainwindow.h"
NodeWidget::NodeWidget(QWidget *parent)

View file

@ -3,8 +3,6 @@
#include <QStandardItemModel>
#include <QTableWidget>
#include <QProgressBar>
#include <QMessageBox>
#include <QDesktopServices>
#include "model/RedditModel.h"

View file

@ -1,15 +1,12 @@
// SPDX-License-Identifier: BSD-3-Clause
// Copyright (c) 2020-2021, The Monero Project.
#include <QStandardItemModel>
#include <QTableWidget>
#include <QProgressBar>
#include <QMessageBox>
#include <QDesktopServices>
#include "restoreheightwidget.h"
#include "ui_restoreheightwidget.h"
#include "utils/utils.h"
RestoreHeightWidget::RestoreHeightWidget(QWidget *parent) :
QWidget(parent),

View file

@ -4,8 +4,6 @@
#include "tickerwidget.h"
#include "ui_tickerwidget.h"
#include "appcontext.h"
#include "utils/config.h"
#include "mainwindow.h"
TickerWidget::TickerWidget(QWidget *parent, QString symbol, QString title, bool convertBalance, bool hidePercent) :

View file

@ -5,7 +5,6 @@
#include "ui_txproofwidget.h"
#include <QMessageBox>
#include <utility>
#include "utils/utils.h"

View file

@ -3,17 +3,13 @@
#include <QStandardItemModel>
#include <QTableWidget>
#include <QProgressBar>
#include <QMessageBox>
#include <QDesktopServices>
#include <QSysInfo>
#include <QScrollBar>
#include <QFileDialog>
#include <QStandardPaths>
#include "xmrigwidget.h"
#include "ui_xmrigwidget.h"
#include "utils/utils.h"
XMRigWidget::XMRigWidget(AppContext *ctx, QWidget *parent) :
QWidget(parent),

View file

@ -5,14 +5,9 @@
#include "wizard/createwallet.h"
#include "wizard/walletwizard.h"
#include "ui_createwallet.h"
#include "appcontext.h"
#include <QPushButton>
#include <QFileDialog>
#include <QMessageBox>
#include <QDebug>
#include "libwalletqt/WalletManager.h"
CreateWalletPage::CreateWalletPage(AppContext *ctx, QWidget *parent) :
QWizardPage(parent),

View file

@ -4,11 +4,8 @@
#include "wizard/createwalletseed.h"
#include "wizard/walletwizard.h"
#include "ui_createwalletseed.h"
#include "appcontext.h"
#include <QPushButton>
#include <QFileDialog>
#include <QDebug>
CreateWalletSeedPage::CreateWalletSeedPage(AppContext *ctx, QWidget *parent) :
QWizardPage(parent),

View file

@ -5,11 +5,7 @@
#include "wizard/walletwizard.h"
#include "ui_menu.h"
#include <QPushButton>
#include <QFileDialog>
#include <QDebug>
#include "libwalletqt/WalletManager.h"
MenuPage::MenuPage(AppContext *ctx, WalletKeysFilesModel *wallets, QWidget *parent)
: QWizardPage(parent)

View file

@ -2,14 +2,9 @@
// Copyright (c) 2020-2021, The Monero Project.
#include "wizard/network.h"
#include "wizard/walletwizard.h"
#include "ui_network.h"
#include <QPushButton>
#include <QFileDialog>
#include <QDebug>
#include "libwalletqt/WalletManager.h"
NetworkPage::NetworkPage(AppContext *ctx, QWidget *parent) :
QWizardPage(parent),

View file

@ -3,10 +3,7 @@
#include "wizard/openwallet.h"
#include "ui_openwallet.h"
#include "appcontext.h"
#include "utils/config.h"
#include <QPushButton>
#include <QFileDialog>
#include <QMessageBox>

View file

@ -7,14 +7,9 @@
#include <QLineEdit>
#include <QPlainTextEdit>
#include <QTextCharFormat>
#include <QPushButton>
#include <QButtonGroup>
#include <monero_seed/wordlist.hpp> // tevador 14 word
#include "libwalletqt/WalletManager.h"
RestorePage::RestorePage(AppContext *ctx, QWidget *parent) :
QWizardPage(parent),
ui(new Ui::RestorePage),

View file

@ -4,7 +4,6 @@
#ifndef FEATHER_WIZARDRESTORE_H
#define FEATHER_WIZARDRESTORE_H
#include <QtCore>
#include <QLabel>
#include <QWizardPage>
#include <QWidget>

View file

@ -5,15 +5,7 @@
#include "wizard/walletwizard.h"
#include "ui_viewonlywallet.h"
#include <QLineEdit>
#include <QPlainTextEdit>
#include <QTextCharFormat>
#include <QPushButton>
#include <QButtonGroup>
#include <monero_seed/wordlist.hpp> // tevador 14 word
#include "libwalletqt/WalletManager.h"
ViewOnlyPage::ViewOnlyPage(AppContext *ctx, QWidget *parent) :
QWizardPage(parent),

View file

@ -4,7 +4,6 @@
#ifndef FEATHER_WIZARDVIEWONLY_H
#define FEATHER_WIZARDVIEWONLY_H
#include <QtCore>
#include <QLabel>
#include <QWizardPage>
#include <QWidget>

View file

@ -11,12 +11,9 @@
#include "wizard/restorewallet.h"
#include "wizard/viewonlywallet.h"
#include <QStyle>
#include <QLabel>
#include <QLineEdit>
#include <QVBoxLayout>
#include <QScreen>
#include <QApplication>
WalletWizard::WalletWizard(AppContext *ctx, WalletWizard::Page startPage, QWidget *parent)
: QWizard(parent)

View file

@ -4,11 +4,9 @@
#include "xmrtowidget.h"
#include "ui_xmrtowidget.h"
#include "dialog/xmrtoinfodialog.h"
#include "libwalletqt/WalletManager.h"
#include "mainwindow.h"
#include "globals.h"
#include <QMenu>
#include <QMessageBox>
XMRToWidget::XMRToWidget(QWidget *parent) :

View file

@ -20,7 +20,7 @@ Q_OBJECT
public:
explicit XMRToWidget(QWidget *parent = nullptr);
void setHistoryModel(XmrToModel *model);
~XMRToWidget();
~XMRToWidget() override;
public slots:
void onWalletClosed();