aboutsummaryrefslogtreecommitdiff
path: root/src/qt
diff options
context:
space:
mode:
Diffstat (limited to 'src/qt')
-rw-r--r--src/qt/bitcoin.cpp2
-rw-r--r--src/qt/bitcoingui.cpp11
-rwxr-xr-xsrc/qt/res/movies/makespinner.sh2
-rw-r--r--src/qt/test/addressbooktests.cpp1
-rw-r--r--src/qt/test/apptests.cpp6
-rw-r--r--src/qt/test/paymentservertests.cpp4
-rw-r--r--src/qt/test/rpcnestedtests.cpp2
-rw-r--r--src/qt/test/rpcnestedtests.h3
-rw-r--r--src/qt/test/test_main.cpp13
-rw-r--r--src/qt/trafficgraphwidget.cpp1
-rw-r--r--src/qt/walletcontroller.cpp13
-rw-r--r--src/qt/walletcontroller.h10
-rw-r--r--src/qt/walletmodel.cpp4
13 files changed, 37 insertions, 35 deletions
diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp
index de5c1cab98..cf0b48b545 100644
--- a/src/qt/bitcoin.cpp
+++ b/src/qt/bitcoin.cpp
@@ -413,7 +413,6 @@ static void SetupUIArgs()
gArgs.AddArg("-uiplatform", strprintf("Select platform to customize UI for (one of windows, macosx, other; default: %s)", BitcoinGUI::DEFAULT_UIPLATFORM), true, OptionsCategory::GUI);
}
-#ifndef BITCOIN_QT_TEST
int GuiMain(int argc, char* argv[])
{
#ifdef WIN32
@@ -593,4 +592,3 @@ int GuiMain(int argc, char* argv[])
}
return rv;
}
-#endif // BITCOIN_QT_TEST
diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp
index e483172796..266e16ebeb 100644
--- a/src/qt/bitcoingui.cpp
+++ b/src/qt/bitcoingui.cpp
@@ -371,13 +371,12 @@ void BitcoinGUI::createActions()
connect(openAction, &QAction::triggered, this, &BitcoinGUI::openClicked);
connect(m_open_wallet_menu, &QMenu::aboutToShow, [this] {
m_open_wallet_menu->clear();
- std::vector<std::string> available_wallets = m_wallet_controller->getWalletsAvailableToOpen();
- std::vector<std::string> wallets = m_node.listWalletDir();
- for (const auto& path : wallets) {
+ for (const std::pair<const std::string, bool>& i : m_wallet_controller->listWalletDir()) {
+ const std::string& path = i.first;
QString name = path.empty() ? QString("["+tr("default wallet")+"]") : QString::fromStdString(path);
QAction* action = m_open_wallet_menu->addAction(name);
- if (std::find(available_wallets.begin(), available_wallets.end(), path) == available_wallets.end()) {
+ if (i.second) {
// This wallet is already loaded
action->setEnabled(false);
continue;
@@ -410,7 +409,7 @@ void BitcoinGUI::createActions()
assert(invoked);
});
}
- if (wallets.empty()) {
+ if (m_open_wallet_menu->isEmpty()) {
QAction* action = m_open_wallet_menu->addAction(tr("No wallets available"));
action->setEnabled(false);
}
@@ -640,7 +639,7 @@ void BitcoinGUI::setWalletController(WalletController* wallet_controller)
connect(wallet_controller, &WalletController::walletAdded, this, &BitcoinGUI::addWallet);
connect(wallet_controller, &WalletController::walletRemoved, this, &BitcoinGUI::removeWallet);
- for (WalletModel* wallet_model : m_wallet_controller->getWallets()) {
+ for (WalletModel* wallet_model : m_wallet_controller->getOpenWallets()) {
addWallet(wallet_model);
}
}
diff --git a/src/qt/res/movies/makespinner.sh b/src/qt/res/movies/makespinner.sh
index f47c66e02c..3507837da9 100755
--- a/src/qt/res/movies/makespinner.sh
+++ b/src/qt/res/movies/makespinner.sh
@@ -9,6 +9,6 @@ FRAMEDIR=$(dirname $0)
for i in {0..35}
do
frame=$(printf "%03d" $i)
- angle=$(($i * 10))
+ angle=$((i * 10))
convert $FRAMEDIR/../src/spinner.png -background "rgba(0,0,0,0.0)" -distort SRT $angle $FRAMEDIR/spinner-$frame.png
done
diff --git a/src/qt/test/addressbooktests.cpp b/src/qt/test/addressbooktests.cpp
index ea1019ad1d..11a518ebd2 100644
--- a/src/qt/test/addressbooktests.cpp
+++ b/src/qt/test/addressbooktests.cpp
@@ -12,7 +12,6 @@
#include <key.h>
#include <key_io.h>
-#include <pubkey.h>
#include <wallet/wallet.h>
#include <QApplication>
diff --git a/src/qt/test/apptests.cpp b/src/qt/test/apptests.cpp
index 22e49b06cb..49e9e072a8 100644
--- a/src/qt/test/apptests.cpp
+++ b/src/qt/test/apptests.cpp
@@ -11,6 +11,8 @@
#include <qt/networkstyle.h>
#include <qt/rpcconsole.h>
#include <shutdown.h>
+#include <test/setup_common.h>
+#include <univalue.h>
#include <validation.h>
#if defined(HAVE_CONFIG_H)
@@ -26,9 +28,6 @@
#include <QtGlobal>
#include <QtTest/QtTestWidgets>
#include <QtTest/QtTestGui>
-#include <new>
-#include <string>
-#include <univalue.h>
namespace {
//! Call getblockchaininfo RPC and check first field of JSON output.
@@ -63,6 +62,7 @@ void AppTests::appTests()
}
#endif
+ BasicTestingSetup test{CBaseChainParams::REGTEST}; // Create a temp data directory to backup the gui settings to
ECC_Stop(); // Already started by the common test setup, so stop it to avoid interference
LogInstance().DisconnectTestLogger();
diff --git a/src/qt/test/paymentservertests.cpp b/src/qt/test/paymentservertests.cpp
index f0eca899fc..6cafe05461 100644
--- a/src/qt/test/paymentservertests.cpp
+++ b/src/qt/test/paymentservertests.cpp
@@ -13,7 +13,7 @@
#include <random.h>
#include <script/script.h>
#include <script/standard.h>
-#include <util/system.h>
+#include <test/setup_common.h>
#include <util/strencodings.h>
#include <openssl/x509.h>
@@ -66,7 +66,7 @@ static SendCoinsRecipient handleRequest(PaymentServer* server, std::vector<unsig
void PaymentServerTests::paymentServerTests()
{
- SelectParams(CBaseChainParams::MAIN);
+ BasicTestingSetup testing_setup(CBaseChainParams::MAIN);
auto node = interfaces::MakeNode();
OptionsModel optionsModel(*node);
PaymentServer* server = new PaymentServer(nullptr, false);
diff --git a/src/qt/test/rpcnestedtests.cpp b/src/qt/test/rpcnestedtests.cpp
index 86e5632e2c..3c2ffa6c00 100644
--- a/src/qt/test/rpcnestedtests.cpp
+++ b/src/qt/test/rpcnestedtests.cpp
@@ -4,7 +4,6 @@
#include <qt/test/rpcnestedtests.h>
-#include <fs.h>
#include <interfaces/node.h>
#include <rpc/server.h>
#include <qt/rpcconsole.h>
@@ -35,7 +34,6 @@ void RPCNestedTests::rpcNestedTests()
tableRPC.appendCommand("rpcNestedTest", &vRPCCommands[0]);
//mempool.setSanityCheck(1.0);
- LogInstance().DisconnectTestLogger(); // Already started by the common test setup, so stop it to avoid interference
TestingSetup test;
if (RPCIsInWarmup(nullptr)) SetRPCWarmupFinished();
diff --git a/src/qt/test/rpcnestedtests.h b/src/qt/test/rpcnestedtests.h
index e33f4e3da1..97143ff78a 100644
--- a/src/qt/test/rpcnestedtests.h
+++ b/src/qt/test/rpcnestedtests.h
@@ -8,9 +8,6 @@
#include <QObject>
#include <QTest>
-#include <txdb.h>
-#include <txmempool.h>
-
class RPCNestedTests : public QObject
{
Q_OBJECT
diff --git a/src/qt/test/test_main.cpp b/src/qt/test/test_main.cpp
index 9f66c3d3a9..6bda8dc6eb 100644
--- a/src/qt/test/test_main.cpp
+++ b/src/qt/test/test_main.cpp
@@ -6,7 +6,6 @@
#include <config/bitcoin-config.h>
#endif
-#include <chainparams.h>
#include <interfaces/node.h>
#include <qt/bitcoin.h>
#include <qt/test/apptests.h>
@@ -43,12 +42,18 @@ Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin);
#endif
#endif
-extern void noui_connect();
-
// This is all you need to run all the tests
int main(int argc, char *argv[])
{
- BasicTestingSetup test{CBaseChainParams::REGTEST};
+ // Initialize persistent globals with the testing setup state for sanity.
+ // E.g. -datadir in gArgs is set to a temp directory dummy value (instead
+ // of defaulting to the default datadir), or globalChainParams is set to
+ // regtest params.
+ //
+ // All tests must use their own testing setup (if needed).
+ {
+ BasicTestingSetup dummy{CBaseChainParams::REGTEST};
+ }
auto node = interfaces::MakeNode();
diff --git a/src/qt/trafficgraphwidget.cpp b/src/qt/trafficgraphwidget.cpp
index 1588be8da3..006007be63 100644
--- a/src/qt/trafficgraphwidget.cpp
+++ b/src/qt/trafficgraphwidget.cpp
@@ -104,6 +104,7 @@ void TrafficGraphWidget::paintEvent(QPaintEvent *)
}
}
+ painter.setRenderHint(QPainter::Antialiasing);
if(!vSamplesIn.empty()) {
QPainterPath p;
paintPath(p, vSamplesIn);
diff --git a/src/qt/walletcontroller.cpp b/src/qt/walletcontroller.cpp
index 019bd65823..4d489d7f44 100644
--- a/src/qt/walletcontroller.cpp
+++ b/src/qt/walletcontroller.cpp
@@ -40,19 +40,22 @@ WalletController::~WalletController()
m_activity_thread.wait();
}
-std::vector<WalletModel*> WalletController::getWallets() const
+std::vector<WalletModel*> WalletController::getOpenWallets() const
{
QMutexLocker locker(&m_mutex);
return m_wallets;
}
-std::vector<std::string> WalletController::getWalletsAvailableToOpen() const
+std::map<std::string, bool> WalletController::listWalletDir() const
{
QMutexLocker locker(&m_mutex);
- std::vector<std::string> wallets = m_node.listWalletDir();
+ std::map<std::string, bool> wallets;
+ for (const std::string& name : m_node.listWalletDir()) {
+ wallets[name] = false;
+ }
for (WalletModel* wallet_model : m_wallets) {
- auto it = std::remove(wallets.begin(), wallets.end(), wallet_model->wallet().getWalletName());
- if (it != wallets.end()) wallets.erase(it);
+ auto it = wallets.find(wallet_model->wallet().getWalletName());
+ if (it != wallets.end()) it->second = true;
}
return wallets;
}
diff --git a/src/qt/walletcontroller.h b/src/qt/walletcontroller.h
index 19b3a82253..03039dd795 100644
--- a/src/qt/walletcontroller.h
+++ b/src/qt/walletcontroller.h
@@ -8,7 +8,7 @@
#include <qt/walletmodel.h>
#include <sync.h>
-#include <list>
+#include <map>
#include <memory>
#include <vector>
@@ -40,8 +40,12 @@ public:
WalletController(interfaces::Node& node, const PlatformStyle* platform_style, OptionsModel* options_model, QObject* parent);
~WalletController();
- std::vector<WalletModel*> getWallets() const;
- std::vector<std::string> getWalletsAvailableToOpen() const;
+ //! Returns wallet models currently open.
+ std::vector<WalletModel*> getOpenWallets() const;
+
+ //! Returns all wallet names in the wallet dir mapped to whether the wallet
+ //! is loaded.
+ std::map<std::string, bool> listWalletDir() const;
OpenWalletActivity* openWallet(const std::string& name, QWidget* parent = nullptr);
void closeWallet(WalletModel* wallet_model, QWidget* parent = nullptr);
diff --git a/src/qt/walletmodel.cpp b/src/qt/walletmodel.cpp
index a2b295df21..c1eba61749 100644
--- a/src/qt/walletmodel.cpp
+++ b/src/qt/walletmodel.cpp
@@ -221,9 +221,7 @@ WalletModel::SendCoinsReturn WalletModel::prepareTransaction(WalletModelTransact
return TransactionCreationFailed;
}
- // reject absurdly high fee. (This can never happen because the
- // wallet caps the fee at m_default_max_tx_fee. This merely serves as a
- // belt-and-suspenders check)
+ // Reject absurdly high fee
if (nFeeRequired > m_wallet->getDefaultMaxTxFee())
return AbsurdFee;
}