refactor: misc cleanup

This commit is contained in:
tobtoht 2023-03-29 11:00:41 +02:00
parent 37153356ee
commit 32fa222c8d
No known key found for this signature in database
GPG key ID: E45B10DD027D2472
7 changed files with 17 additions and 34 deletions

View file

@ -10,7 +10,6 @@
#include "utils/AppData.h"
#include "utils/ColorScheme.h"
#include "utils/config.h"
#include "utils/WebsocketClient.h"
#include "utils/WebsocketNotifier.h"
CalcWidget::CalcWidget(QWidget *parent)

View file

@ -8,7 +8,6 @@
#include <QInputDialog>
#include <QMessageBox>
#include "config-feather.h"
#include "constants.h"
#include "dialog/BalanceDialog.h"
#include "dialog/DebugInfoDialog.h"
@ -30,8 +29,6 @@
#include "utils/AsyncTask.h"
#include "utils/ColorScheme.h"
#include "utils/Icons.h"
#include "utils/NetworkManager.h"
#include "utils/os/tails.h"
#include "utils/SemanticVersion.h"
#include "utils/TorManager.h"
#include "utils/Updater.h"
@ -1026,11 +1023,6 @@ void MainWindow::showHistoryTab() {
ui->tabWidget->setCurrentIndex(Tabs::HISTORY);
}
void MainWindow::showSendTab() {
this->raise();
ui->tabWidget->setCurrentIndex(Tabs::SEND);
}
void MainWindow::fillSendTab(const QString &address, const QString &description) {
m_sendWidget->fill(address, description);
ui->tabWidget->setCurrentIndex(Tabs::SEND);
@ -1498,7 +1490,7 @@ void MainWindow::onSelectedInputsChanged(const QStringList &selectedInputs) {
}
}
void MainWindow::onExportHistoryCSV(bool checked) {
void MainWindow::onExportHistoryCSV() {
if (m_wallet == nullptr)
return;
QString fn = QFileDialog::getSaveFileName(this, "Save CSV file", QDir::homePath(), "CSV (*.csv)");
@ -1510,7 +1502,7 @@ void MainWindow::onExportHistoryCSV(bool checked) {
QMessageBox::information(this, "CSV export", QString("Transaction history exported to %1").arg(fn));
}
void MainWindow::onExportContactsCSV(bool checked) {
void MainWindow::onExportContactsCSV() {
if (m_wallet == nullptr) return;
auto *model = m_wallet->addressBookModel();
if (model->rowCount() <= 0){
@ -1521,13 +1513,13 @@ void MainWindow::onExportContactsCSV(bool checked) {
const QString targetDir = QFileDialog::getExistingDirectory(this, "Select CSV output directory ", QDir::homePath(), QFileDialog::ShowDirsOnly);
if(targetDir.isEmpty()) return;
qint64 now = QDateTime::currentDateTime().currentMSecsSinceEpoch();
qint64 now = QDateTime::currentMSecsSinceEpoch();
QString fn = QString("%1/monero-contacts_%2.csv").arg(targetDir, QString::number(now / 1000));
if(model->writeCSV(fn))
QMessageBox::information(this, "Address book exported", QString("Address book exported to %1").arg(fn));
}
void MainWindow::onCreateDesktopEntry(bool checked) {
void MainWindow::onCreateDesktopEntry() {
auto msg = Utils::xdgDesktopEntryRegister() ? "Desktop entry created" : "Desktop entry not created due to an error.";
QMessageBox::information(this, "Desktop entry", msg);
}
@ -1536,7 +1528,7 @@ void MainWindow::onShowDocumentation() {
Utils::externalLinkWarning(this, "https://docs.featherwallet.org");
}
void MainWindow::onReportBug(bool checked) {
void MainWindow::onReportBug() {
Utils::externalLinkWarning(this, "https://docs.featherwallet.org/guides/report-an-issue");
}
@ -1745,4 +1737,4 @@ void MainWindow::toggleSearchbar(bool visible) {
MainWindow::~MainWindow() {
qDebug() << "~MainWindow";
};
}

View file

@ -126,11 +126,11 @@ private slots:
void menuProxySettingsClicked();
void menuToggleTabVisible(const QString &key);
void menuClearHistoryClicked();
void onExportHistoryCSV(bool checked);
void onExportContactsCSV(bool checked);
void onCreateDesktopEntry(bool checked);
void onExportHistoryCSV();
void onExportContactsCSV();
void onCreateDesktopEntry();
void onShowDocumentation();
void onReportBug(bool checked);
void onReportBug();
void onShowSettingsPage(int page);
// offline tx signing
@ -172,7 +172,6 @@ private slots:
void donateButtonClicked();
void showCalcWindow();
void payToMany();
void showSendTab();
void showHistoryTab();
void showSendScreen(const CCSEntry &entry);
void skinChanged(const QString &skinName);

View file

@ -56,10 +56,9 @@ private:
Wallet *m_wallet;
QMenu *m_headerMenu;
QAction *m_showFullAddressesAction;
QAction *m_showUsedAddressesAction;
QAction *m_showTransactionsAction;
SubaddressModel * m_model;
SubaddressProxyModel * m_proxyModel;
SubaddressModel *m_model;
SubaddressProxyModel *m_proxyModel;
void updateQrCode();
void showQrCodeDialog();

View file

@ -67,8 +67,11 @@ SendWidget::SendWidget(Wallet *wallet, QWidget *parent)
}
void SendWidget::currencyComboChanged(int index) {
Q_UNUSED(index)
QString amount = ui->lineAmount->text();
if(amount.isEmpty()) return;
if (amount.isEmpty()) {
return;
}
this->amountEdited(amount);
}
@ -91,6 +94,7 @@ void SendWidget::addressEdited() {
}
void SendWidget::amountEdited(const QString &text) {
Q_UNUSED(text)
this->updateConversionLabel();
}

View file

@ -556,15 +556,6 @@ QString barrayToString(const QByteArray &data) {
return QString::fromUtf8(data);
}
QString getAccountName() {
QString accountName = qgetenv("USER"); // mac/linux
if (accountName.isEmpty())
accountName = qgetenv("USERNAME"); // Windows
if (accountName.isEmpty())
throw std::runtime_error("Could derive system account name from env vars: USER or USERNAME");
return accountName;
}
QFont getMonospaceFont()
{
if (QFontInfo(QApplication::font()).fixedPitch()) {

View file

@ -67,7 +67,6 @@ namespace Utils
void applicationLogHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg);
QString barrayToString(const QByteArray &data);
QString getAccountName();
bool isLocalUrl(const QUrl &url);