From 6437d064c4e680ea2fb4c2bc7532703dae5c5f2c Mon Sep 17 00:00:00 2001 From: tobtoht Date: Sat, 11 Feb 2023 18:15:56 +0100 Subject: [PATCH] settings: delete old settings dialog --- src/MainWindow.h | 1 - src/SettingsDialog.cpp | 282 --------------- src/SettingsDialog.h | 66 ---- src/SettingsDialog.ui | 796 ----------------------------------------- 4 files changed, 1145 deletions(-) delete mode 100644 src/SettingsDialog.cpp delete mode 100644 src/SettingsDialog.h delete mode 100644 src/SettingsDialog.ui diff --git a/src/MainWindow.h b/src/MainWindow.h index 709152a..5c43d9d 100644 --- a/src/MainWindow.h +++ b/src/MainWindow.h @@ -11,7 +11,6 @@ #include "appcontext.h" #include "components.h" #include "CalcWindow.h" -#include "SettingsDialog.h" #include "SettingsNewDialog.h" #include "dialog/AboutDialog.h" diff --git a/src/SettingsDialog.cpp b/src/SettingsDialog.cpp deleted file mode 100644 index ccd8695..0000000 --- a/src/SettingsDialog.cpp +++ /dev/null @@ -1,282 +0,0 @@ -// SPDX-License-Identifier: BSD-3-Clause -// SPDX-FileCopyrightText: 2020-2023 The Monero Project - -#include "SettingsDialog.h" -#include "ui_SettingsDialog.h" - -#include -#include -#include - -#include "Icons.h" -#include "utils/WebsocketNotifier.h" -#include "utils/NetworkManager.h" - -Settings::Settings(QSharedPointer ctx, QWidget *parent) - : QDialog(parent) - , ui(new Ui::Settings) - , m_ctx(std::move(ctx)) -{ - ui->setupUi(this); - - this->setWindowIcon(QIcon("://assets/images/appicons/64x64.png")); - - ui->tabWidget->setTabVisible(5, false); - ui->tabWidget->setCurrentIndex(config()->get(Config::lastSettingsPage).toInt()); - - this->setupGeneralTab(); - this->setupPrivacyTab(); - this->setupNodeTab(); - this->setupPathsTab(); - this->setupLinksTab(); - - connect(ui->closeButton, &QDialogButtonBox::accepted, this, &Settings::close); - - this->adjustSize(); -} - -void Settings::setupGeneralTab() { - // [Preferred fiat currency] - QStringList fiatCurrencies; - for (int index = 0; index < ui->comboBox_fiatCurrency->count(); index++) { - fiatCurrencies << ui->comboBox_fiatCurrency->itemText(index); - } - - auto preferredFiatCurrency = config()->get(Config::preferredFiatCurrency).toString(); - if (!preferredFiatCurrency.isEmpty() && fiatCurrencies.contains(preferredFiatCurrency)) { - ui->comboBox_fiatCurrency->setCurrentText(preferredFiatCurrency); - } - - connect(ui->comboBox_fiatCurrency, QOverload::of(&QComboBox::currentIndexChanged), this, &Settings::fiatCurrencySelected); - - // [Appearance] - this->setupSkinCombobox(); - auto settingsSkin = config()->get(Config::skin).toString(); - if (m_skins.contains(settingsSkin)) { - ui->comboBox_skin->setCurrentIndex(m_skins.indexOf(settingsSkin)); - } - - connect(ui->comboBox_skin, QOverload::of(&QComboBox::currentIndexChanged), this, &Settings::comboBox_skinChanged); - - // [Amount precision] - for (int i = 0; i <= 12; i++) { - ui->comboBox_amountPrecision->addItem(QString::number(i)); - } - ui->comboBox_amountPrecision->setCurrentIndex(config()->get(Config::amountPrecision).toInt()); - - connect(ui->comboBox_amountPrecision, QOverload::of(&QComboBox::currentIndexChanged), this, &Settings::comboBox_amountPrecisionChanged); - - // [Date format] - QDateTime now = QDateTime::currentDateTime(); - for (const auto & format : m_dateFormats) { - ui->comboBox_dateFormat->addItem(now.toString(format)); - } - QString dateFormatSetting = config()->get(Config::dateFormat).toString(); - if (m_dateFormats.contains(dateFormatSetting)) { - ui->comboBox_dateFormat->setCurrentIndex(m_dateFormats.indexOf(dateFormatSetting)); - } - - connect(ui->comboBox_dateFormat, QOverload::of(&QComboBox::currentIndexChanged), this, &Settings::comboBox_dateFormatChanged); - - // [Time format] - for (const auto & format : m_timeFormats) { - ui->comboBox_timeFormat->addItem(now.toString(format)); - } - QString timeFormatSetting = config()->get(Config::timeFormat).toString(); - if (m_timeFormats.contains(timeFormatSetting)) { - ui->comboBox_timeFormat->setCurrentIndex(m_timeFormats.indexOf(timeFormatSetting)); - } - - connect(ui->comboBox_timeFormat, QOverload::of(&QComboBox::currentIndexChanged), this, &Settings::comboBox_timeFormatChanged); - - // [Balance display] - ui->comboBox_balanceDisplay->setCurrentIndex(config()->get(Config::balanceDisplay).toInt()); - connect(ui->comboBox_balanceDisplay, QOverload::of(&QComboBox::currentIndexChanged), this, &Settings::comboBox_balanceDisplayChanged); -} - -void Settings::setupPrivacyTab() { - // [Multibroadcast outgoing transactions] - ui->checkBox_multiBroadcast->setChecked(config()->get(Config::multiBroadcast).toBool()); - connect(ui->checkBox_multiBroadcast, &QCheckBox::toggled, [](bool toggled){ - config()->set(Config::multiBroadcast, toggled); - }); - connect(ui->btn_multiBroadcast, &QPushButton::clicked, [this]{ - QMessageBox::information(this, "Multibroadcasting", "Multibroadcasting relays outgoing transactions to all nodes in your selected node list. This may improve transaction relay speed and reduces the chance of your transaction failing."); - }); - - // [Warn before opening external link] - ui->checkBox_externalLink->setChecked(config()->get(Config::warnOnExternalLink).toBool()); - connect(ui->checkBox_externalLink, &QCheckBox::clicked, this, &Settings::checkboxExternalLinkWarn); - - // [Hide balance] - ui->checkBox_hideBalance->setChecked(config()->get(Config::hideBalance).toBool()); - connect(ui->checkBox_hideBalance, &QCheckBox::toggled, [this](bool toggled){ - config()->set(Config::hideBalance, toggled); - m_ctx->updateBalance(); - }); - - // [Hide notifications] - ui->checkBox_hideNotifications->setChecked(config()->get(Config::hideNotifications).toBool()); - connect(ui->checkBox_hideNotifications, &QCheckBox::toggled, [this](bool toggled){ - config()->set(Config::hideNotifications, toggled); - }); - - // [Disable websocket] - ui->checkBox_enableWebsocket->setChecked(!config()->get(Config::disableWebsocket).toBool()); - connect(ui->checkBox_enableWebsocket, &QCheckBox::toggled, [this](bool checked){ - config()->set(Config::disableWebsocket, !checked); - this->enableWebsocket(checked); - }); - connect(ui->btn_enableWebsocket, &QPushButton::clicked, [this]{ - QMessageBox::information(this, "Obtain third-party information", "Feather can connect to an onion service hosted by the Feather developers to obtain pricing information, a curated list of remote nodes, Home feeds, the latest version of Feather Wallet and more.\n\n" - "This service is only used to fetch information and can only be reached over Tor. The wallet does not send information about its state or your transactions to the server. It is not used for any telemetry or crash reports.\n\n" - "If you opt to disable this connection some wallet functionality will be disabled. You can re-enable it at any time."); - }); - - // [Do not write log files to disk] - ui->checkBox_disableLogging->setChecked(config()->get(Config::disableLogging).toBool()); - connect(ui->checkBox_disableLogging, &QCheckBox::toggled, [this](bool toggled){ - config()->set(Config::disableLogging, toggled); - WalletManager::instance()->setLogLevel(toggled ? -1 : config()->get(Config::logLevel).toInt()); - }); - - // [Lock wallet on inactivity] - ui->checkBox_inactivityLockTimeout->setChecked(config()->get(Config::inactivityLockEnabled).toBool()); - ui->spinBox_inactivityLockTimeout->setValue(config()->get(Config::inactivityLockTimeout).toInt()); - connect(ui->checkBox_inactivityLockTimeout, &QCheckBox::toggled, [](bool toggled){ - config()->set(Config::inactivityLockEnabled, toggled); - }); - connect(ui->spinBox_inactivityLockTimeout, QOverload::of(&QSpinBox::valueChanged), [](int value){ - config()->set(Config::inactivityLockTimeout, value); - }); - - // [Offline mode] - ui->checkBox_offlineMode->setChecked(config()->get(Config::offlineMode).toBool()); - connect(ui->checkBox_offlineMode, &QCheckBox::toggled, [this](bool checked){ - config()->set(Config::offlineMode, checked); - m_ctx->wallet->setOffline(checked); - this->enableWebsocket(!checked); - }); -} - -void Settings::setupNodeTab() { -// ui->nodeWidget->setupUI(m_ctx); - connect(ui->nodeWidget, &NodeWidget::nodeSourceChanged, m_ctx->nodes, &Nodes::onNodeSourceChanged); - connect(ui->nodeWidget, &NodeWidget::connectToNode, m_ctx->nodes, QOverload::of(&Nodes::connectToNode)); -} - -void Settings::setupPathsTab() { - ui->lineEdit_defaultWalletDir->setText(config()->get(Config::walletDirectory).toString()); - ui->lineEdit_configDir->setText(Config::defaultConfigDir().path()); - ui->lineEdit_applicationDir->setText(Utils::applicationPath()); - - connect(ui->btn_browseDefaultWalletDir, &QPushButton::clicked, [this]{ - QString walletDirOld = config()->get(Config::walletDirectory).toString(); - QString walletDir = QFileDialog::getExistingDirectory(this, "Select wallet directory ", walletDirOld, QFileDialog::ShowDirsOnly); - if (walletDir.isEmpty()) - return; - config()->set(Config::walletDirectory, walletDir); - ui->lineEdit_defaultWalletDir->setText(walletDir); - }); -} - -void Settings::setupLinksTab() { - // [Block explorer] - ui->combo_blockExplorer->setCurrentIndex(ui->combo_blockExplorer->findText(config()->get(Config::blockExplorer).toString())); - connect(ui->combo_blockExplorer, QOverload::of(&QComboBox::currentIndexChanged), this, &Settings::comboBox_blockExplorerChanged); - - // [Reddit frontend] - ui->combo_redditFrontend->setCurrentIndex(ui->combo_redditFrontend->findText(config()->get(Config::redditFrontend).toString())); - connect(ui->combo_redditFrontend, QOverload::of(&QComboBox::currentIndexChanged), this, &Settings::comboBox_redditFrontendChanged); - - // [LocalMonero frontend] - this->setupLocalMoneroFrontendCombobox(); - connect(ui->combo_localMoneroFrontend, QOverload::of(&QComboBox::currentIndexChanged), this, &Settings::comboBox_localMoneroFrontendChanged); -} - -void Settings::fiatCurrencySelected(int index) { - QString selection = ui->comboBox_fiatCurrency->itemText(index); - config()->set(Config::preferredFiatCurrency, selection); - emit preferredFiatCurrencyChanged(selection); -} - -void Settings::comboBox_skinChanged(int pos) { - emit skinChanged(m_skins.at(pos)); -} - -void Settings::comboBox_blockExplorerChanged(int pos) { - QString blockExplorer = ui->combo_blockExplorer->currentText(); - config()->set(Config::blockExplorer, blockExplorer); - emit blockExplorerChanged(blockExplorer); -} - -void Settings::comboBox_redditFrontendChanged(int pos) { - QString redditFrontend = ui->combo_redditFrontend->currentText(); - config()->set(Config::redditFrontend, redditFrontend); -} - -void Settings::comboBox_localMoneroFrontendChanged(int pos) { - QString localMoneroFrontend = ui->combo_localMoneroFrontend->currentData().toString(); - config()->set(Config::localMoneroFrontend, localMoneroFrontend); -} - -void Settings::comboBox_amountPrecisionChanged(int pos) { - config()->set(Config::amountPrecision, pos); - m_ctx->updateBalance(); - emit amountPrecisionChanged(pos); -} - -void Settings::comboBox_dateFormatChanged(int pos) { - config()->set(Config::dateFormat, m_dateFormats.at(pos)); -} - -void Settings::comboBox_timeFormatChanged(int pos) { - config()->set(Config::timeFormat, m_timeFormats.at(pos)); -} - -void Settings::comboBox_balanceDisplayChanged(int pos) { - config()->set(Config::balanceDisplay, pos); - m_ctx->updateBalance(); -} - -void Settings::checkboxExternalLinkWarn() { - bool state = ui->checkBox_externalLink->isChecked(); - config()->set(Config::warnOnExternalLink, state); -} - -void Settings::setupSkinCombobox() { -#if defined(Q_OS_WIN) - m_skins.removeOne("Breeze/Dark"); - m_skins.removeOne("Breeze/Light"); -#elif defined(Q_OS_MAC) - m_skins.removeOne("QDarkStyle"); -#endif - - ui->comboBox_skin->insertItems(0, m_skins); -} - -void Settings::setupLocalMoneroFrontendCombobox() { - ui->combo_localMoneroFrontend->addItem("localmonero.co", "https://localmonero.co"); - ui->combo_localMoneroFrontend->addItem("localmonero.co/nojs", "https://localmonero.co/nojs"); - ui->combo_localMoneroFrontend->addItem("nehdddktmhvqklsnkjqcbpmb63htee2iznpcbs5tgzctipxykpj6yrid.onion", - "http://nehdddktmhvqklsnkjqcbpmb63htee2iznpcbs5tgzctipxykpj6yrid.onion"); - - ui->combo_localMoneroFrontend->setCurrentIndex(ui->combo_localMoneroFrontend->findData(config()->get(Config::localMoneroFrontend).toString())); -} - -void Settings::enableWebsocket(bool enabled) { - if (enabled && !config()->get(Config::offlineMode).toBool() && !config()->get(Config::disableWebsocket).toBool()) { - websocketNotifier()->websocketClient.restart(); - } else { - websocketNotifier()->websocketClient.stop(); - } - ui->nodeWidget->onWebsocketStatusChanged(); - emit websocketStatusChanged(enabled); -} - -void Settings::closeEvent(QCloseEvent *event) { - config()->set(Config::lastSettingsPage, ui->tabWidget->currentIndex()); - event->accept(); -} - -Settings::~Settings() = default; diff --git a/src/SettingsDialog.h b/src/SettingsDialog.h deleted file mode 100644 index 9bae5d9..0000000 --- a/src/SettingsDialog.h +++ /dev/null @@ -1,66 +0,0 @@ -// SPDX-License-Identifier: BSD-3-Clause -// SPDX-FileCopyrightText: 2020-2023 The Monero Project - -#ifndef FEATHER_SETTINGS_H -#define FEATHER_SETTINGS_H - -#include -#include -#include - -#include "appcontext.h" -#include "widgets/NodeWidget.h" - -namespace Ui { - class Settings; -} - -class Settings : public QDialog -{ -Q_OBJECT - -public: - explicit Settings(QSharedPointer ctx, QWidget *parent = nullptr); - ~Settings() override; - -signals: - void preferredFiatCurrencyChanged(QString currency); - void skinChanged(QString skinName); - void blockExplorerChanged(QString blockExplorer); - void amountPrecisionChanged(int precision); - void websocketStatusChanged(bool enabled); - -public slots: - void checkboxExternalLinkWarn(); - void fiatCurrencySelected(int index); - void comboBox_skinChanged(int pos); - void comboBox_amountPrecisionChanged(int pos); - void comboBox_dateFormatChanged(int pos); - void comboBox_timeFormatChanged(int pos); - void comboBox_balanceDisplayChanged(int pos); - void comboBox_blockExplorerChanged(int pos); - void comboBox_redditFrontendChanged(int pos); - void comboBox_localMoneroFrontendChanged(int pos); - -private: - void setupGeneralTab(); - void setupPrivacyTab(); - void setupNodeTab(); - void setupPathsTab(); - void setupLinksTab(); - - void setupSkinCombobox(); - void setupLocalMoneroFrontendCombobox(); - void enableWebsocket(bool enabled); - - void closeEvent(QCloseEvent *event) override; - - QScopedPointer ui; - QSharedPointer m_ctx; - - QStringList m_skins{"Native", "QDarkStyle", "Breeze/Dark", "Breeze/Light"}; - QStringList m_dateFormats{"yyyy-MM-dd", "MM-dd-yyyy", "dd-MM-yyyy"}; - QStringList m_timeFormats{"hh:mm", "hh:mm ap"}; -}; - -#endif // FEATHER_SETTINGS_H diff --git a/src/SettingsDialog.ui b/src/SettingsDialog.ui deleted file mode 100644 index ff2131b..0000000 --- a/src/SettingsDialog.ui +++ /dev/null @@ -1,796 +0,0 @@ - - - Settings - - - - 0 - 0 - 915 - 553 - - - - Settings - - - - - - 0 - - - - General - - - - - - - - Preferred fiat currency: - - - - - - - - USD - - - - - EUR - - - - - RUB - - - - - GBP - - - - - AUD - - - - - CAD - - - - - CHF - - - - - CNY - - - - - CZK - - - - - JPY - - - - - KRW - - - - - MXN - - - - - NZD - - - - - SEK - - - - - THB - - - - - TRY - - - - - ZAR - - - - - - - - Appearance: - - - - - - - - - - Amount precision: - - - - - - - - - - Date format: - - - - - - - - - - Time format: - - - - - - - - - - Balance display: - - - - - - - - Total balance - - - - - Spendable balance (+ unconfirmed balance) - - - - - Spendable balance - - - - - - - - - - Qt::Vertical - - - - 20 - 0 - - - - - - - - - Privacy - - - - - - - - Multibroadcast outgoing transactions - - - - - - - - 0 - 0 - - - - ? - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - Warn before opening external link - - - - - - - Hide balance - - - - - - - - - Obtain third-party data - - - - - - - - 0 - 0 - - - - ? - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - Do not write log files to disk - - - - - - - - - Lock wallet on inactivity after - - - - - - - 1 - - - 120 - - - - - - - minutes - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - Hide notifications - - - - - - - Offline mode - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - Node - - - - - - - - - - Paths - - - - 6 - - - - - This application uses the following paths: - - - - - - - - - - - true - - - - - - - Browse - - - - - - - - - Wallet directory: - - - - - - - Config directory: - - - - - - - true - - - - - - - Application directory: - - - - - - - true - - - - - - - - - Qt::Vertical - - - - 20 - 0 - - - - - - - - - Links - - - - - - Block explorer: - - - - - - - - exploremonero.com - - - - - xmrchain.net - - - - - melo.tools - - - - - moneroblocks.info - - - - - blockchair.com - - - - - blkchairbknpn73cfjhevhla7rkp4ed5gg2knctvv7it4lioy22defid.onion - - - - - 127.0.0.1:31312 - - - - - - - - - Reddit frontend: - - - - - - - - old.reddit.com - - - - - old.reddittorjg6rue252oqsxryoxengawnmo46qy4kyii5wtqnwfj4ooad.onion - - - - - reddit.com - - - - - reddittorjg6rue252oqsxryoxengawnmo46qy4kyii5wtqnwfj4ooad.onion - - - - - teddit.net - - - - - - - - LocalMonero frontend: - - - - - - - - - - - - .. - - - Console - - - - - - - 0 - 0 - - - - - 16777215 - 70 - - - - Log source - - - - - - Qt Application - - - - - - - RPC daemon - - - - - - - Tor daemon - - - - - - - - - - - 0 - 0 - - - - QFrame::NoFrame - - - QFrame::Raised - - - 1 - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Copy to clipboard - - - - - - - Open log directory - - - - - - - Clear - - - - - - - - - - - 0 - 0 - - - - - 16777215 - 70 - - - - Log level - - - - - - Critical - - - true - - - - - - - Warning - - - true - - - - - - - Info - - - false - - - - - - - Debug - - - - - - - - - - true - - - true - - - - - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - QDialogButtonBox::Ok - - - - - - - - - - NodeWidget - QWidget -
widgets/NodeWidget.h
- 1 -
-
- - - - copyToClipboard() - checkboxExternalLinkWarn() - closeClicked(QAbstractButton*) - checkboxCheckForAppUpdates() - fiatCurrencySelected(QString) - homeWidgetChanged(int) - -