diff --git a/src/WindowManager.cpp b/src/WindowManager.cpp index 107f188c..553afd27 100644 --- a/src/WindowManager.cpp +++ b/src/WindowManager.cpp @@ -35,6 +35,8 @@ WindowManager::WindowManager() { this->onInitialNetworkConfigured(); } + this->startupWarning(); + if (!this->autoOpenWallet()) { this->initWizard(); } @@ -72,6 +74,39 @@ void WindowManager::restartApplication(const QString &binaryFilename) { this->close(); } +void WindowManager::startupWarning() { + // Stagenet / Testnet + auto worthlessWarning = QString("Feather wallet is currently running in %1 mode. This is meant " + "for developers only. Your coins are WORTHLESS."); + if (constants::networkType == NetworkType::STAGENET && config()->get(Config::warnOnStagenet).toBool()) { + this->showWarningMessageBox("Warning", worthlessWarning.arg("stagenet")); + config()->set(Config::warnOnStagenet, false); + } + else if (constants::networkType == NetworkType::TESTNET && config()->get(Config::warnOnTestnet).toBool()){ + this->showWarningMessageBox("Warning", worthlessWarning.arg("testnet")); + config()->set(Config::warnOnTestnet, false); + } + + // Beta + if (config()->get(Config::warnOnAlpha).toBool()) { + QString warning = "Feather Wallet is currently in beta.\n\nPlease report any bugs " + "you encounter on our Git repository, IRC or on /r/FeatherWallet."; + this->showWarningMessageBox("Beta warning", warning); + config()->set(Config::warnOnAlpha, false); + } +} + +void WindowManager::showWarningMessageBox(const QString &title, const QString &message) { + QMessageBox msgBox; + msgBox.setWindowIcon(icons()->icon("appicons/64x64.png")); + msgBox.setIcon(QMessageBox::Warning); + msgBox.setText(message); + msgBox.setWindowTitle(title); + msgBox.setStandardButtons(QMessageBox::Ok); + msgBox.setDefaultButton(QMessageBox::Ok); + msgBox.exec(); +} + // ######################## WALLET OPEN ######################## void WindowManager::tryOpenWallet(const QString &path, const QString &password) { @@ -119,6 +154,8 @@ void WindowManager::onWalletOpened(Wallet *wallet) { return; } + this->onInitialNetworkConfigured(); + // Create new mainwindow with wallet m_splashDialog->hide(); @@ -328,8 +365,11 @@ void WindowManager::buildTrayMenu() { // ######################## NETWORKING ######################## void WindowManager::onInitialNetworkConfigured() { - this->initTor(); - this->initWS(); + if (!m_initialNetworkConfigured) { + m_initialNetworkConfigured = true; + this->initTor(); + this->initWS(); + } } void WindowManager::initTor() { diff --git a/src/WindowManager.h b/src/WindowManager.h index 3d99c6d9..7c9c3d9c 100644 --- a/src/WindowManager.h +++ b/src/WindowManager.h @@ -58,6 +58,8 @@ private: void initSkins(); QString loadStylesheet(const QString &resource); void buildTrayMenu(); + void startupWarning(); + void showWarningMessageBox(const QString &title, const QString &message); void quitAfterLastWindow(); @@ -73,6 +75,7 @@ private: bool m_openWalletTriedOnce = false; bool m_openingWallet = false; + bool m_initialNetworkConfigured = false; }; diff --git a/src/assets/nodes.json b/src/assets/nodes.json index 705068a6..8b4c13ae 100644 --- a/src/assets/nodes.json +++ b/src/assets/nodes.json @@ -8,12 +8,8 @@ "mxcd4577fldb3ppzy7obmmhnu3tf57gbcbd4qhwr2kxyjj2qi3dnbfqd.onion:18081", "moneroxmrxw44lku6qniyarpwgznpcwml4drq7vb24ppatlcg4kmxpqd.onion:18089", "3hvpnd4xejtzcuowvru2wfjum5wjf7synigm44rrizr3k4v5vzam2bad.onion:18081", - "3t7v5zpcfxq2tocdofdcwxgrldco3elotz3iis4jtbbnscy5alezw7yd.onion:18081", - "4mslnrs5sfjxrb35.onion:18081", "aytzr6aoxsegx2y6.onion:18081", - "rbpgdckle3h3vi4wwwrh75usqtoc5r3alohy7yyx57isynvay63nacyd.onion:18089", - "slvb7iuq6rwj4gjbbfwile5piamhnllwk3s5vqccn2hqvz2nmrkvpiid.onion:18089", - "wq7o3snkc65onqc3rjdoynnsve2z22aqs3gixdtaaayx4qhgbz74auqd.onion:18089" + "rbpgdckle3h3vi4wwwrh75usqtoc5r3alohy7yyx57isynvay63nacyd.onion:18089" ], "clearnet": [ "eu-west.node.xmr.pm:18089", @@ -28,9 +24,7 @@ "node.xmr.ru:18081", "selsta1.featherwallet.net:18081", "selsta2.featherwallet.net:18081", - "node-1.sethsimmons.me:18089", - "node-2.sethsimmons.me:18089", - "node-3.sethsimmons.me:18089" + "node-1.sethsimmons.me:18089" ] }, "stagenet": { diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index f81df981..2ec89f1c 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -50,7 +50,6 @@ MainWindow::MainWindow(WindowManager *windowManager, Wallet *wallet, QWidget *pa m_splashDialog = new SplashDialog(this); this->restoreGeo(); - this->startupWarning(); this->initStatusBar(); this->initWidgets(); @@ -88,6 +87,8 @@ MainWindow::MainWindow(WindowManager *windowManager, Wallet *wallet, QWidget *pa m_statusLabelStatus->setText("Constructing transaction" + this->statusDots()); }); + config()->set(Config::firstRun, false); + this->onWalletOpened(); #ifdef DONATE_BEG @@ -368,28 +369,6 @@ void MainWindow::initWalletContext() { connect(m_ctx->wallet.get(), &Wallet::currentSubaddressAccountChanged, this, &MainWindow::updateTitle); } -void MainWindow::startupWarning() { - // Stagenet / Testnet - auto worthlessWarning = QString("Feather wallet is currently running in %1 mode. This is meant " - "for developers only. Your coins are WORTHLESS."); - if (constants::networkType == NetworkType::STAGENET && config()->get(Config::warnOnStagenet).toBool()) { - QMessageBox::warning(this, "Warning", worthlessWarning.arg("stagenet")); - config()->set(Config::warnOnStagenet, false); - } - else if (constants::networkType == NetworkType::TESTNET && config()->get(Config::warnOnTestnet).toBool()){ - QMessageBox::warning(this, "Warning", worthlessWarning.arg("testnet")); - config()->set(Config::warnOnTestnet, false); - } - - // Beta - if (config()->get(Config::warnOnAlpha).toBool()) { - QString warning = "Feather Wallet is currently in beta.\n\nPlease report any bugs " - "you encounter on our Git repository, IRC or on /r/FeatherWallet."; - QMessageBox::warning(this, "Beta Warning", warning); - config()->set(Config::warnOnAlpha, false); - } -} - void MainWindow::menuToggleTabVisible(const QString &key){ const auto toggleTab = m_tabShowHideMapper[key]; bool show = config()->get(toggleTab->configKey).toBool(); @@ -438,6 +417,7 @@ void MainWindow::onWalletOpened() { qDebug() << Q_FUNC_INFO; m_splashDialog->hide(); + m_ctx->updateBalance(); if (m_ctx->wallet->isHwBacked()) { m_statusBtnHwDevice->show(); } diff --git a/src/mainwindow.h b/src/mainwindow.h index 56f2dc09..eaecad9c 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -183,7 +183,6 @@ private: void initMenu(); void initHome(); void initWalletContext(); - void startupWarning(); void closeEvent(QCloseEvent *event) override; diff --git a/src/model/SubaddressAccountModel.cpp b/src/model/SubaddressAccountModel.cpp index a15ba838..aa8fe609 100644 --- a/src/model/SubaddressAccountModel.cpp +++ b/src/model/SubaddressAccountModel.cpp @@ -57,6 +57,11 @@ QVariant SubaddressAccountModel::data(const QModelIndex &index, int role) const result = ModelUtils::getMonospaceFont(); } } + else if (role == Qt::TextAlignmentRole) { + if (index.column() == Column::Balance || index.column() == Column::UnlockedBalance) { + result = Qt::AlignRight; + } + } }); if (!found) { diff --git a/src/utils/nodes.cpp b/src/utils/nodes.cpp index a16f5c06..ae976fb4 100644 --- a/src/utils/nodes.cpp +++ b/src/utils/nodes.cpp @@ -162,7 +162,7 @@ void Nodes::loadConfig() { if (nodes_obj.contains(netKey)) { QJsonArray nodes_list; nodes_list = nodes_json[netKey].toObject()["tor"].toArray(); - nodes_list.append(nodes_list = nodes_json[netKey].toObject()["clearnet"].toArray()); + nodes_list.append(nodes_json[netKey].toObject()["clearnet"].toArray()); for (auto node: nodes_list) { FeatherNode wsNode(node.toString());