diff --git a/src/assets.qrc b/src/assets.qrc index 8ee1cd5..50cc4f6 100644 --- a/src/assets.qrc +++ b/src/assets.qrc @@ -36,8 +36,6 @@ assets/images/eye_blind.png assets/images/feather.png assets/images/file.png - assets/images/ghost.png - assets/images/ghost_icon.png assets/images/gnome-calc.png assets/images/history.png assets/images/info.png diff --git a/src/assets/images/ghost.png b/src/assets/images/ghost.png deleted file mode 100644 index d786466..0000000 Binary files a/src/assets/images/ghost.png and /dev/null differ diff --git a/src/assets/images/ghost_icon.png b/src/assets/images/ghost_icon.png deleted file mode 100644 index f8905af..0000000 Binary files a/src/assets/images/ghost_icon.png and /dev/null differ diff --git a/src/coinswidget.cpp b/src/coinswidget.cpp index 64949da..180d93d 100644 --- a/src/coinswidget.cpp +++ b/src/coinswidget.cpp @@ -14,6 +14,7 @@ #include #include #include +#include CoinsWidget::CoinsWidget(QWidget *parent) : QWidget(parent) @@ -197,7 +198,7 @@ void CoinsWidget::onSweepOutput() { qCritical() << "key image: " << keyImage; if (!keyImageKnown) { - Utils::showMessageBox("Unable to sweep output", "Unable to sweep output: key image unknown", true); + QMessageBox::warning(this, "Unable to sweep output", "Unable to sweep output: key image unknown"); return; } diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 3ccc3aa..b4ed38c 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -104,7 +104,7 @@ MainWindow::MainWindow(AppContext *ctx, QWidget *parent) : "Try to explain not only what the bug is, but how it occurs."); }); connect(ui->actionShow_debug_info, &QAction::triggered, this, &MainWindow::showDebugInfo); - connect(ui->actionOfficialWebsite, &QAction::triggered, [=] { Utils::externalLinkWarning("https://featherwallet.org"); }); + connect(ui->actionOfficialWebsite, &QAction::triggered, [=] { Utils::externalLinkWarning(this, "https://featherwallet.org"); }); #if defined(HAS_XMRTO) // xmr.to connects/widget @@ -115,7 +115,7 @@ MainWindow::MainWindow(AppContext *ctx, QWidget *parent) : connect(m_ctx->XMRTo, &XmrTo::connectionError, ui->xmrToWidget, &XMRToWidget::onConnectionError); connect(m_ctx->XMRTo, &XmrTo::connectionSuccess, ui->xmrToWidget, &XMRToWidget::onConnectionSuccess); connect(m_ctx, &AppContext::balanceUpdated, ui->xmrToWidget, &XMRToWidget::onBalanceUpdated); - connect(m_ctx->XMRTo, &XmrTo::openURL, this, [=](const QString &url){ Utils::externalLinkWarning(url); }); + connect(m_ctx->XMRTo, &XmrTo::openURL, this, [=](const QString &url){ Utils::externalLinkWarning(this, url); }); ui->xmrToWidget->setHistoryModel(m_ctx->XMRTo->tableModel); #else ui->tabExchanges->setTabVisible(0, false); @@ -243,13 +243,13 @@ MainWindow::MainWindow(AppContext *ctx, QWidget *parent) : "for developers only. Your coins are WORTHLESS."); if(m_ctx->networkType == NetworkType::STAGENET) { if (config()->get(Config::warnOnStagenet).toBool()) { - Utils::showMessageBox("Warning", worthlessWarning.arg("stagenet"), true); + QMessageBox::warning(this, "Warning", worthlessWarning.arg("stagenet")); config()->set(Config::warnOnStagenet, false); } } else if(m_ctx->networkType == NetworkType::TESTNET){ if (config()->get(Config::warnOnTestnet).toBool()) { - Utils::showMessageBox("Warning", worthlessWarning.arg("testnet"), true); + QMessageBox::warning(this, "Warning", worthlessWarning.arg("testnet")); config()->set(Config::warnOnTestnet, false); } } @@ -463,7 +463,7 @@ void MainWindow::initMenu() { if(fn.isEmpty()) return; if(!fn.endsWith(".csv")) fn += ".csv"; m_ctx->currentWallet->history()->writeCSV(fn); - Utils::showMessageBox("CSV export", QString("Transaction history exported to %1").arg(fn), false); + QMessageBox::information(this, "CSV export", QString("Transaction history exported to %1").arg(fn)); }); // Contact widget @@ -471,7 +471,7 @@ void MainWindow::initMenu() { if(m_ctx->currentWallet == nullptr) return; auto *model = m_ctx->currentWallet->addressBookModel(); if (model->rowCount() <= 0){ - Utils::showMessageBox("Error", "Addressbook empty", true); + QMessageBox::warning(this, "Error", "Addressbook empty"); return; } @@ -481,7 +481,7 @@ void MainWindow::initMenu() { qint64 now = QDateTime::currentDateTime().currentMSecsSinceEpoch(); QString fn = QString("%1/monero-contacts_%2.csv").arg(targetDir, QString::number(now / 1000)); if(model->writeCSV(fn)) - Utils::showMessageBox("Address book exported", QString("Address book exported to %1").arg(fn), false); + QMessageBox::information(this, "Address book exported", QString("Address book exported to %1").arg(fn)); }); connect(ui->actionImportContactsCSV, &QAction::triggered, this, &MainWindow::importContacts); @@ -560,7 +560,7 @@ void MainWindow::touchbarShowWallet() { } void MainWindow::onWalletCreatedError(const QString &err) { - Utils::showMessageBox("Wallet creation error", err, true); + QMessageBox::warning(this, "Wallet creation error", err); this->showWizard(WalletWizard::Page_CreateWallet); } @@ -737,12 +737,12 @@ void MainWindow::onCreateTransactionSuccess(PendingTransaction *tx, const QStrin err = QString("%1 %2").arg(err).arg(tx_err); qDebug() << Q_FUNC_INFO << err; - Utils::showMessageBox("Transaction error", err, true); + QMessageBox::warning(this, "Transactions error", err); m_ctx->currentWallet->disposeTransaction(tx); } else if (tx->txCount() == 0) { err = QString("%1 %2").arg(err).arg("No unmixable outputs to sweep."); qDebug() << Q_FUNC_INFO << err; - Utils::showMessageBox("Transaction error", err, true); + QMessageBox::warning(this, "Transaction error", err); m_ctx->currentWallet->disposeTransaction(tx); } else { const auto &description = m_ctx->tmpTxDescription; @@ -968,12 +968,12 @@ void MainWindow::menuWalletOpenClicked() { QFileInfo infoPath(path); if(!infoPath.isReadable()) { - Utils::showMessageBox("Cannot read wallet file", "Permission error.", true); + QMessageBox::warning(this, "Cannot read wallet file", "Permission error."); return; } if(path == m_ctx->walletPath) { - Utils::showMessageBox("Wallet already opened", "Please open another wallet.", true); + QMessageBox::warning(this, "Wallet already opened", "Please open another wallet."); return; } @@ -1051,7 +1051,7 @@ void MainWindow::showSendScreen(const CCSEntry &entry) { void MainWindow::onViewOnBlockExplorer(const QString &txid) { QString blockExplorerLink = Utils::blockExplorerLink(config()->get(Config::blockExplorer).toString(), m_ctx->networkType, txid); - Utils::externalLinkWarning(blockExplorerLink); + Utils::externalLinkWarning(this, blockExplorerLink); } void MainWindow::onAddContact(const QString &address, const QString &name) { diff --git a/src/utils/utils.cpp b/src/utils/utils.cpp index 1931175..1764aa5 100644 --- a/src/utils/utils.cpp +++ b/src/utils/utils.cpp @@ -276,7 +276,7 @@ bool Utils::testSocks5(const QString &host, quint16 port){ return false; } -void Utils::externalLinkWarning(const QString &url){ +void Utils::externalLinkWarning(QWidget *parent, const QString &url){ if(!config()->get(Config::warnOnExternalLink).toBool()) { QDesktopServices::openUrl(QUrl(url)); return; @@ -286,7 +286,7 @@ void Utils::externalLinkWarning(const QString &url){ body += QString("%1\n\n").arg(url); body += "You will NOT be using Tor."; - switch (Utils::showMessageBox("External link warning", body, true)) { + switch (QMessageBox::warning(parent, "External link warning", body, QMessageBox::Cancel|QMessageBox::Ok)) { case QMessageBox::Cancel: break; default: @@ -327,26 +327,6 @@ bool Utils::walletExists(QString name, const QString &path) { return Utils::fileExists(walletPath); } -int Utils::showMessageBox(const QString &windowTitle, const QString &body, bool warning){ - QMessageBox msgBox(QApplication::activeWindow()); - msgBox.setWindowTitle(windowTitle); - msgBox.setText(body); - msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel); - msgBox.setDefaultButton(QMessageBox::Ok); - - if(warning) { - QPixmap iconWarning = QPixmap(":/assets/images/ghost_icon.png"); - msgBox.setIconPixmap(iconWarning); - } - else { - QPixmap iconInfo = QPixmap(":/assets/images/info.png") - .scaled(QSize(48,48), Qt::KeepAspectRatio, Qt::SmoothTransformation); - msgBox.setIconPixmap(iconInfo); - } - - return msgBox.exec(); -} - void Utils::copyToClipboard(const QString &string){ QClipboard * clipboard = QApplication::clipboard(); if (!clipboard) { diff --git a/src/utils/utils.h b/src/utils/utils.h index a801cab..c6fb832 100644 --- a/src/utils/utils.h +++ b/src/utils/utils.h @@ -75,8 +75,7 @@ public: static QStringList readJsonStringToQStringList(const QString &input); static void applicationLogHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg); static void openWindow(QWidget *w); - static void externalLinkWarning(const QString &url); - static int showMessageBox(const QString &windowTitle, const QString &body, bool warning); + static void externalLinkWarning(QWidget *parent, const QString &url); static QList procList(); static bool dirExists(const QString &path); static QString barrayToString(const QByteArray &data); @@ -98,8 +97,6 @@ public: static QString formatBytes(quint64 bytes); static QString amountToCurrencyString(double amount, const QString ¤cyCode); - static QStringList randomHTTPAgents; - template static QString QtEnumToString (const QEnum value) { diff --git a/src/widgets/ccswidget.cpp b/src/widgets/ccswidget.cpp index 4ba0b0b..f8f1c7b 100644 --- a/src/widgets/ccswidget.cpp +++ b/src/widgets/ccswidget.cpp @@ -42,7 +42,7 @@ void CCSWidget::linkClicked() { auto entry = m_model->entry(index.row()); if (entry) - Utils::externalLinkWarning(entry->url); + Utils::externalLinkWarning(this, entry->url); } void CCSWidget::donateClicked() { diff --git a/src/widgets/nodewidget.cpp b/src/widgets/nodewidget.cpp index ba5f2e5..c990910 100644 --- a/src/widgets/nodewidget.cpp +++ b/src/widgets/nodewidget.cpp @@ -113,14 +113,14 @@ void NodeWidget::onContextWSStatusURL() { QModelIndex index = ui->wsView->currentIndex(); if (!index.isValid()) return; FeatherNode node = m_wsModel->node(index.row()); - Utils::externalLinkWarning(node.as_url()); + Utils::externalLinkWarning(this, node.as_url()); } void NodeWidget::onContextCustomStatusURL() { QModelIndex index = ui->customView->currentIndex(); if (!index.isValid()) return; FeatherNode node = m_customModel->node(index.row()); - Utils::externalLinkWarning(node.as_url()); + Utils::externalLinkWarning(this, node.as_url()); } void NodeWidget::onContextDisconnect() { diff --git a/src/widgets/redditwidget.cpp b/src/widgets/redditwidget.cpp index a8f046f..040ee83 100644 --- a/src/widgets/redditwidget.cpp +++ b/src/widgets/redditwidget.cpp @@ -37,7 +37,7 @@ void RedditWidget::linkClicked() { auto post = m_model->post(index.row()); if (post) { - Utils::externalLinkWarning(post->url); + Utils::externalLinkWarning(this, post->url); } } diff --git a/src/widgets/xmrigwidget.cpp b/src/widgets/xmrigwidget.cpp index 8f0dac4..9484afb 100644 --- a/src/widgets/xmrigwidget.cpp +++ b/src/widgets/xmrigwidget.cpp @@ -155,7 +155,7 @@ void XMRigWidget::onStartClicked() { if(username.isEmpty()) { QString err = "Please specify a receiving address on the Settings screen"; ui->console->appendPlainText(err); - Utils::showMessageBox("Error", err, true); + QMessageBox::warning(this, "Error", err); return; } @@ -286,7 +286,7 @@ void XMRigWidget::onSoloChecked(int state) { void XMRigWidget::linkClicked() { QModelIndex index = ui->tableView->currentIndex(); auto download_link = m_urls.at(index.row()); - Utils::externalLinkWarning(download_link); + Utils::externalLinkWarning(this, download_link); } QStandardItemModel *XMRigWidget::model() { diff --git a/src/wizard/openwallet.cpp b/src/wizard/openwallet.cpp index e013465..397d552 100644 --- a/src/wizard/openwallet.cpp +++ b/src/wizard/openwallet.cpp @@ -8,6 +8,7 @@ #include #include +#include // @TODO: rescan wallet dir on wizard open @@ -27,7 +28,7 @@ OpenWalletPage::OpenWalletPage(AppContext *ctx, QWidget *parent) : QFileInfo infoPath(path); if(!infoPath.isReadable()) { - Utils::showMessageBox("Cannot read wallet file", "Permission error.", true); + QMessageBox::warning(this, "Cannot read wallet file", "Permission error."); return; } @@ -67,7 +68,7 @@ int OpenWalletPage::nextId() const { bool OpenWalletPage::validatePage() { QModelIndex index = ui->walletTable->currentIndex(); if(!index.isValid()) { - Utils::showMessageBox("Wallet not selected", "Please select a wallet from the list.", true); + QMessageBox::warning(this, "Wallet not selected", "Please select a wallet from the list."); return false; } QString walletPath = index.model()->data(index.siblingAtColumn(WalletKeysFilesModel::ModelColumns::Path), Qt::UserRole).toString(); diff --git a/src/xmrtowidget.cpp b/src/xmrtowidget.cpp index 6adad5d..63acb98 100644 --- a/src/xmrtowidget.cpp +++ b/src/xmrtowidget.cpp @@ -86,7 +86,7 @@ void XMRToWidget::onCreateOrder() { auto amount = ui->lineAmount->text(); if(amount.isEmpty()) { - Utils::showMessageBox("Cannot create XMR.To order", "Invalid amount", false); + QMessageBox::warning(this, "Cannot create XMR.To order", "Invalid amount"); return; } @@ -99,7 +99,7 @@ void XMRToWidget::onCreateOrder() { auto available = m_unlockedBalance; if(amount_xmr > available){ - Utils::showMessageBox("Cannot create XMR.To order", "Not enough Monero to create order.", false); + QMessageBox::warning(this, "Cannot create XMR.To order", "Not enough Monero to create order."); return; }