aboutsummaryrefslogtreecommitdiff
path: root/src/qt
diff options
context:
space:
mode:
Diffstat (limited to 'src/qt')
-rw-r--r--src/qt/README.md12
-rw-r--r--src/qt/addressbookpage.h2
-rw-r--r--src/qt/addresstablemodel.cpp40
-rw-r--r--src/qt/addresstablemodel.h17
-rw-r--r--src/qt/bantablemodel.cpp6
-rw-r--r--src/qt/bantablemodel.h6
-rw-r--r--src/qt/bitcoin.cpp34
-rw-r--r--src/qt/bitcoingui.cpp11
-rw-r--r--src/qt/bitcoingui.h10
-rw-r--r--src/qt/clientmodel.cpp6
-rw-r--r--src/qt/clientmodel.h22
-rw-r--r--src/qt/coincontroldialog.cpp6
-rw-r--r--src/qt/editaddressdialog.cpp21
-rw-r--r--src/qt/editaddressdialog.h5
-rw-r--r--src/qt/guiutil.cpp10
-rw-r--r--src/qt/guiutil.h4
-rw-r--r--src/qt/intro.cpp4
-rw-r--r--src/qt/intro.h4
-rw-r--r--src/qt/optionsdialog.cpp2
-rw-r--r--src/qt/optionsmodel.cpp27
-rw-r--r--src/qt/optionsmodel.h8
-rw-r--r--src/qt/overviewpage.cpp10
-rw-r--r--src/qt/overviewpage.h6
-rw-r--r--src/qt/paymentrequestplus.cpp1
-rw-r--r--src/qt/paymentserver.cpp6
-rw-r--r--src/qt/paymentserver.h4
-rw-r--r--src/qt/peertablemodel.cpp8
-rw-r--r--src/qt/peertablemodel.h6
-rw-r--r--src/qt/rpcconsole.cpp19
-rw-r--r--src/qt/rpcconsole.h28
-rw-r--r--src/qt/sendcoinsdialog.cpp22
-rw-r--r--src/qt/sendcoinsdialog.h2
-rw-r--r--src/qt/sendcoinsentry.cpp2
-rw-r--r--src/qt/sendcoinsentry.h2
-rw-r--r--src/qt/splashscreen.cpp12
-rw-r--r--src/qt/splashscreen.h18
-rw-r--r--src/qt/test/addressbooktests.cpp143
-rw-r--r--src/qt/test/addressbooktests.h15
-rw-r--r--src/qt/test/paymentservertests.cpp4
-rw-r--r--src/qt/test/rpcnestedtests.cpp4
-rw-r--r--src/qt/test/test_main.cpp5
-rw-r--r--src/qt/test/util.cpp22
-rw-r--r--src/qt/test/util.h12
-rw-r--r--src/qt/test/wallettests.cpp30
-rw-r--r--src/qt/trafficgraphwidget.cpp2
-rw-r--r--src/qt/transactiondesc.cpp22
-rw-r--r--src/qt/transactiondesc.h6
-rw-r--r--src/qt/transactionrecord.cpp6
-rw-r--r--src/qt/transactionrecord.h6
-rw-r--r--src/qt/transactiontablemodel.cpp18
-rw-r--r--src/qt/transactiontablemodel.h6
-rw-r--r--src/qt/utilitydialog.cpp4
-rw-r--r--src/qt/utilitydialog.h4
-rw-r--r--src/qt/walletmodel.cpp15
-rw-r--r--src/qt/walletmodel.h34
-rw-r--r--src/qt/walletmodeltransaction.cpp4
-rw-r--r--src/qt/walletmodeltransaction.h6
-rw-r--r--src/qt/walletview.cpp13
58 files changed, 515 insertions, 269 deletions
diff --git a/src/qt/README.md b/src/qt/README.md
index 7ffea98170..d8acf96ceb 100644
--- a/src/qt/README.md
+++ b/src/qt/README.md
@@ -1,6 +1,6 @@
-This directory contains the BitcoinQT graphical user interface (GUI). It uses the cross platform framework [QT](https://www1.qt.io/developers/).
+This directory contains the BitcoinQT graphical user interface (GUI). It uses the cross-platform framework [Qt](https://www1.qt.io/developers/).
-The current precise version for QT 5 is specified in [qt.mk](/depends/packages/qt.mk). QT 4 is also supported (see [#8263](https://github.com/bitcoin/bitcoin/issues/8263)).
+The current precise version for Qt 5 is specified in [qt.mk](/depends/packages/qt.mk). Qt 4 is also supported (see [#8263](https://github.com/bitcoin/bitcoin/issues/8263)).
## Compile and run
@@ -16,7 +16,7 @@ To run:
### forms
-Contains [Designer UI](http://doc.qt.io/qt-5.9/designer-using-a-ui-file.html) files. They are created with [Qt Creator](#use-qt-Creator-as IDE), but can be edited using any text editor.
+Contains [Designer UI](http://doc.qt.io/qt-5.9/designer-using-a-ui-file.html) files. They are created with [Qt Creator](#using-qt-creator-as-ide), but can be edited using any text editor.
### locale
@@ -36,7 +36,7 @@ Represents the main window of the Bitcoin UI.
### \*model.(h/cpp)
-The model. When it has a corresponding controller, it generally inherits from [QAbstractTableModel](http://doc.qt.io/qt-5/qabstracttablemodel.html). Models that are used by controllers as helpers inherit from other QT classes like [QValidator](http://doc.qt.io/qt-5/qvalidator.html).
+The model. When it has a corresponding controller, it generally inherits from [QAbstractTableModel](http://doc.qt.io/qt-5/qabstracttablemodel.html). Models that are used by controllers as helpers inherit from other Qt classes like [QValidator](http://doc.qt.io/qt-5/qvalidator.html).
ClientModel is used by the main application `bitcoingui` and several models like `peertablemodel`.
@@ -69,7 +69,7 @@ Represents the view to a single wallet.
## Contribute
-See [CONTRIBUTING.md](/CONTRIBUTING.md) for general guidelines. Specifically for QT:
+See [CONTRIBUTING.md](/CONTRIBUTING.md) for general guidelines. Specifically for Qt:
* don't change `local/bitcoin_en.ts`; this happens [automatically](/doc/translation_process.md#writing-code-with-translations)
@@ -83,7 +83,7 @@ Uncheck everything except Qt Creator during the installation process.
Instructions for OSX:
-1. Make sure you installed everything through Homebrew mentioned in the [OSX build instructions](/docs/build-osx.md)
+1. Make sure you installed everything through Homebrew mentioned in the [OSX build instructions](/doc/build-osx.md)
2. Use `./configure` with the `--enable-debug` flag
3. In Qt Creator do "New Project" -> Import Project -> Import Existing Project
4. Enter "bitcoin-qt" as project name, enter src/qt as location
diff --git a/src/qt/addressbookpage.h b/src/qt/addressbookpage.h
index 8877d07330..ba420c5e15 100644
--- a/src/qt/addressbookpage.h
+++ b/src/qt/addressbookpage.h
@@ -38,7 +38,7 @@ public:
ForEditing /**< Open address book for editing */
};
- explicit AddressBookPage(const PlatformStyle *platformStyle, Mode mode, Tabs tab, QWidget *parent);
+ explicit AddressBookPage(const PlatformStyle *platformStyle, Mode mode, Tabs tab, QWidget *parent = 0);
~AddressBookPage();
void setModel(AddressTableModel *model);
diff --git a/src/qt/addresstablemodel.cpp b/src/qt/addresstablemodel.cpp
index a9408895d9..25b615e6f8 100644
--- a/src/qt/addresstablemodel.cpp
+++ b/src/qt/addresstablemodel.cpp
@@ -7,7 +7,7 @@
#include <qt/guiutil.h>
#include <qt/walletmodel.h>
-#include <interface/node.h>
+#include <interfaces/node.h>
#include <key_io.h>
#include <wallet/wallet.h>
@@ -74,7 +74,7 @@ public:
AddressTablePriv(AddressTableModel *_parent):
parent(_parent) {}
- void refreshAddressTable(interface::Wallet& wallet)
+ void refreshAddressTable(interfaces::Wallet& wallet)
{
cachedAddressTable.clear();
{
@@ -159,7 +159,7 @@ public:
};
AddressTableModel::AddressTableModel(WalletModel *parent) :
- QAbstractTableModel(parent),walletModel(parent),priv(0)
+ QAbstractTableModel(parent), walletModel(parent)
{
columns << tr("Label") << tr("Address");
priv = new AddressTablePriv(this);
@@ -266,7 +266,8 @@ bool AddressTableModel::setData(const QModelIndex &index, const QVariant &value,
}
// Check for duplicate addresses to prevent accidental deletion of addresses, if you try
// to paste an existing address over another address (with a different label)
- if (walletModel->wallet().getAddress(newAddress))
+ if (walletModel->wallet().getAddress(
+ newAddress, /* name= */ nullptr, /* is_mine= */ nullptr, /* purpose= */ nullptr))
{
editStatus = DUPLICATE_ADDRESS;
return false;
@@ -351,7 +352,8 @@ QString AddressTableModel::addRow(const QString &type, const QString &label, con
}
// Check for duplicate addresses
{
- if(walletModel->wallet().getAddress(DecodeDestination(strAddress)))
+ if (walletModel->wallet().getAddress(
+ DecodeDestination(strAddress), /* name= */ nullptr, /* is_mine= */ nullptr, /* purpose= */ nullptr))
{
editStatus = DUPLICATE_ADDRESS;
return QString();
@@ -405,21 +407,31 @@ bool AddressTableModel::removeRows(int row, int count, const QModelIndex &parent
return true;
}
-/* Look up label for address in address book, if not found return empty string.
- */
QString AddressTableModel::labelForAddress(const QString &address) const
{
- {
- CTxDestination destination = DecodeDestination(address.toStdString());
- std::string name;
- if (walletModel->wallet().getAddress(destination, &name))
- {
- return QString::fromStdString(name);
- }
+ std::string name;
+ if (getAddressData(address, &name, /* purpose= */ nullptr)) {
+ return QString::fromStdString(name);
+ }
+ return QString();
+}
+
+QString AddressTableModel::purposeForAddress(const QString &address) const
+{
+ std::string purpose;
+ if (getAddressData(address, /* name= */ nullptr, &purpose)) {
+ return QString::fromStdString(purpose);
}
return QString();
}
+bool AddressTableModel::getAddressData(const QString &address,
+ std::string* name,
+ std::string* purpose) const {
+ CTxDestination destination = DecodeDestination(address.toStdString());
+ return walletModel->wallet().getAddress(destination, name, /* is_mine= */ nullptr, purpose);
+}
+
int AddressTableModel::lookupAddress(const QString &address) const
{
QModelIndexList lst = match(index(0, Address, QModelIndex()),
diff --git a/src/qt/addresstablemodel.h b/src/qt/addresstablemodel.h
index 954f0f593e..6e1b53b049 100644
--- a/src/qt/addresstablemodel.h
+++ b/src/qt/addresstablemodel.h
@@ -13,7 +13,7 @@ enum class OutputType;
class AddressTablePriv;
class WalletModel;
-namespace interface {
+namespace interfaces {
class Wallet;
}
@@ -67,10 +67,12 @@ public:
*/
QString addRow(const QString &type, const QString &label, const QString &address, const OutputType address_type);
- /* Look up label for address in address book, if not found return empty string.
- */
+ /** Look up label for address in address book, if not found return empty string. */
QString labelForAddress(const QString &address) const;
+ /** Look up purpose for address in address book, if not found return empty string. */
+ QString purposeForAddress(const QString &address) const;
+
/* Look up row index of an address in the model.
Return -1 if not found.
*/
@@ -81,10 +83,13 @@ public:
OutputType GetDefaultAddressType() const;
private:
- WalletModel *walletModel;
- AddressTablePriv *priv;
+ WalletModel* const walletModel;
+ AddressTablePriv *priv = nullptr;
QStringList columns;
- EditStatus editStatus;
+ EditStatus editStatus = OK;
+
+ /** Look up address book data given an address string. */
+ bool getAddressData(const QString &address, std::string* name, std::string* purpose) const;
/** Notify listeners that data changed. */
void emitDataChanged(int index);
diff --git a/src/qt/bantablemodel.cpp b/src/qt/bantablemodel.cpp
index cbd67d70ab..26cb03c2c7 100644
--- a/src/qt/bantablemodel.cpp
+++ b/src/qt/bantablemodel.cpp
@@ -8,7 +8,7 @@
#include <qt/guiconstants.h>
#include <qt/guiutil.h>
-#include <interface/node.h>
+#include <interfaces/node.h>
#include <sync.h>
#include <utiltime.h>
@@ -46,7 +46,7 @@ public:
Qt::SortOrder sortOrder;
/** Pull a full list of banned nodes from CNode into our cache */
- void refreshBanlist(interface::Node& node)
+ void refreshBanlist(interfaces::Node& node)
{
banmap_t banMap;
node.getBanned(banMap);
@@ -82,7 +82,7 @@ public:
}
};
-BanTableModel::BanTableModel(interface::Node& node, ClientModel *parent) :
+BanTableModel::BanTableModel(interfaces::Node& node, ClientModel *parent) :
QAbstractTableModel(parent),
m_node(node),
clientModel(parent)
diff --git a/src/qt/bantablemodel.h b/src/qt/bantablemodel.h
index 4c171e6fbe..d6c8dbf6dd 100644
--- a/src/qt/bantablemodel.h
+++ b/src/qt/bantablemodel.h
@@ -15,7 +15,7 @@
class ClientModel;
class BanTablePriv;
-namespace interface {
+namespace interfaces {
class Node;
}
@@ -45,7 +45,7 @@ class BanTableModel : public QAbstractTableModel
Q_OBJECT
public:
- explicit BanTableModel(interface::Node& node, ClientModel *parent = 0);
+ explicit BanTableModel(interfaces::Node& node, ClientModel *parent = 0);
~BanTableModel();
void startAutoRefresh();
void stopAutoRefresh();
@@ -71,7 +71,7 @@ public Q_SLOTS:
void refresh();
private:
- interface::Node& m_node;
+ interfaces::Node& m_node;
ClientModel *clientModel;
QStringList columns;
std::unique_ptr<BanTablePriv> priv;
diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp
index 30d0acb7ef..57fe4552a1 100644
--- a/src/qt/bitcoin.cpp
+++ b/src/qt/bitcoin.cpp
@@ -27,17 +27,14 @@
#endif
#include <init.h>
-#include <interface/handler.h>
-#include <interface/node.h>
+#include <interfaces/handler.h>
+#include <interfaces/node.h>
#include <rpc/server.h>
#include <ui_interface.h>
#include <uint256.h>
#include <util.h>
#include <warnings.h>
-#ifdef ENABLE_WALLET
-#include <wallet/init.h>
-#endif
#include <walletinitinterface.h>
#include <memory>
@@ -182,7 +179,7 @@ class BitcoinCore: public QObject
{
Q_OBJECT
public:
- explicit BitcoinCore(interface::Node& node);
+ explicit BitcoinCore(interfaces::Node& node);
public Q_SLOTS:
void initialize();
@@ -197,7 +194,7 @@ private:
/// Pass fatal exception message to UI thread
void handleRunawayException(const std::exception *e);
- interface::Node& m_node;
+ interfaces::Node& m_node;
};
/** Main Bitcoin application object */
@@ -205,7 +202,7 @@ class BitcoinApplication: public QApplication
{
Q_OBJECT
public:
- explicit BitcoinApplication(interface::Node& node, int &argc, char **argv);
+ explicit BitcoinApplication(interfaces::Node& node, int &argc, char **argv);
~BitcoinApplication();
#ifdef ENABLE_WALLET
@@ -246,7 +243,7 @@ Q_SIGNALS:
private:
QThread *coreThread;
- interface::Node& m_node;
+ interfaces::Node& m_node;
OptionsModel *optionsModel;
ClientModel *clientModel;
BitcoinGUI *window;
@@ -264,7 +261,7 @@ private:
#include <qt/bitcoin.moc>
-BitcoinCore::BitcoinCore(interface::Node& node) :
+BitcoinCore::BitcoinCore(interfaces::Node& node) :
QObject(), m_node(node)
{
}
@@ -304,7 +301,7 @@ void BitcoinCore::shutdown()
}
}
-BitcoinApplication::BitcoinApplication(interface::Node& node, int &argc, char **argv):
+BitcoinApplication::BitcoinApplication(interfaces::Node& node, int &argc, char **argv):
QApplication(argc, argv),
coreThread(0),
m_node(node),
@@ -406,6 +403,10 @@ void BitcoinApplication::startThread()
void BitcoinApplication::parameterSetup()
{
+ // Default printtoconsole to false for the GUI. GUI programs should not
+ // print to the console unnecessarily.
+ gArgs.SoftSetBoolArg("-printtoconsole", false);
+
m_node.initLogging();
m_node.initParameterInteraction();
}
@@ -535,7 +536,7 @@ int main(int argc, char *argv[])
{
SetupEnvironment();
- std::unique_ptr<interface::Node> node = interface::MakeNode();
+ std::unique_ptr<interfaces::Node> node = interfaces::MakeNode();
/// 1. Parse command-line options. These take precedence over anything else.
// Command-line options take precedence:
@@ -630,7 +631,7 @@ int main(int argc, char *argv[])
// Check for -testnet or -regtest parameter (Params() calls are only valid after this clause)
try {
- node->selectParams(ChainNameFromCommandLine());
+ node->selectParams(gArgs.GetChainName());
} catch(std::exception &e) {
QMessageBox::critical(0, QObject::tr(PACKAGE_NAME), QObject::tr("Error: %1").arg(e.what()));
return EXIT_FAILURE;
@@ -660,11 +661,6 @@ int main(int argc, char *argv[])
// Start up the payment server early, too, so impatient users that click on
// bitcoin: links repeatedly have their payment requests routed to this process:
app.createPaymentServer();
-
- // Hook up the wallet init interface
- g_wallet_init_interface.reset(new WalletInit);
-#else
- g_wallet_init_interface.reset(new DummyWalletInit);
#endif
/// 9. Main GUI initialization
@@ -687,7 +683,7 @@ int main(int argc, char *argv[])
app.createOptionsModel(gArgs.GetBoolArg("-resetguisettings", false));
// Subscribe to global signals from core
- std::unique_ptr<interface::Handler> handler = node->handleInitMessage(InitMessage);
+ std::unique_ptr<interfaces::Handler> handler = node->handleInitMessage(InitMessage);
if (gArgs.GetBoolArg("-splash", DEFAULT_SPLASHSCREEN) && !gArgs.GetBoolArg("-min", false))
app.createSplashScreen(networkStyle.data());
diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp
index 63a2a200b2..aed5374a7d 100644
--- a/src/qt/bitcoingui.cpp
+++ b/src/qt/bitcoingui.cpp
@@ -30,8 +30,8 @@
#include <chainparams.h>
#include <init.h>
-#include <interface/handler.h>
-#include <interface/node.h>
+#include <interfaces/handler.h>
+#include <interfaces/node.h>
#include <ui_interface.h>
#include <util.h>
@@ -74,7 +74,7 @@ const std::string BitcoinGUI::DEFAULT_UIPLATFORM =
#endif
;
-BitcoinGUI::BitcoinGUI(interface::Node& node, const PlatformStyle *_platformStyle, const NetworkStyle *networkStyle, QWidget *parent) :
+BitcoinGUI::BitcoinGUI(interfaces::Node& node, const PlatformStyle *_platformStyle, const NetworkStyle *networkStyle, QWidget *parent) :
QMainWindow(parent),
enableWallet(false),
m_node(node),
@@ -968,6 +968,11 @@ void BitcoinGUI::changeEvent(QEvent *e)
QTimer::singleShot(0, this, SLOT(hide()));
e->ignore();
}
+ else if((wsevt->oldState() & Qt::WindowMinimized) && !isMinimized())
+ {
+ QTimer::singleShot(0, this, SLOT(show()));
+ e->ignore();
+ }
}
}
#endif
diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h
index 3a4b25d804..e59c71cd4f 100644
--- a/src/qt/bitcoingui.h
+++ b/src/qt/bitcoingui.h
@@ -33,7 +33,7 @@ class WalletModel;
class HelpMessageDialog;
class ModalOverlay;
-namespace interface {
+namespace interfaces {
class Handler;
class Node;
}
@@ -56,7 +56,7 @@ class BitcoinGUI : public QMainWindow
public:
static const std::string DEFAULT_UIPLATFORM;
- explicit BitcoinGUI(interface::Node& node, const PlatformStyle *platformStyle, const NetworkStyle *networkStyle, QWidget *parent = 0);
+ explicit BitcoinGUI(interfaces::Node& node, const PlatformStyle *platformStyle, const NetworkStyle *networkStyle, QWidget *parent = 0);
~BitcoinGUI();
/** Set the client model.
@@ -83,9 +83,9 @@ protected:
bool eventFilter(QObject *object, QEvent *event);
private:
- interface::Node& m_node;
- std::unique_ptr<interface::Handler> m_handler_message_box;
- std::unique_ptr<interface::Handler> m_handler_question;
+ interfaces::Node& m_node;
+ std::unique_ptr<interfaces::Handler> m_handler_message_box;
+ std::unique_ptr<interfaces::Handler> m_handler_question;
ClientModel *clientModel;
WalletFrame *walletFrame;
diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp
index 1dbfc815b6..37fd06ccc9 100644
--- a/src/qt/clientmodel.cpp
+++ b/src/qt/clientmodel.cpp
@@ -13,8 +13,8 @@
#include <chainparams.h>
#include <checkpoints.h>
#include <clientversion.h>
-#include <interface/handler.h>
-#include <interface/node.h>
+#include <interfaces/handler.h>
+#include <interfaces/node.h>
#include <validation.h>
#include <net.h>
#include <txmempool.h>
@@ -32,7 +32,7 @@ class CBlockIndex;
static int64_t nLastHeaderTipUpdateNotification = 0;
static int64_t nLastBlockTipUpdateNotification = 0;
-ClientModel::ClientModel(interface::Node& node, OptionsModel *_optionsModel, QObject *parent) :
+ClientModel::ClientModel(interfaces::Node& node, OptionsModel *_optionsModel, QObject *parent) :
QObject(parent),
m_node(node),
optionsModel(_optionsModel),
diff --git a/src/qt/clientmodel.h b/src/qt/clientmodel.h
index 9faa10b87e..a609222f7d 100644
--- a/src/qt/clientmodel.h
+++ b/src/qt/clientmodel.h
@@ -17,7 +17,7 @@ class PeerTableModel;
class CBlockIndex;
-namespace interface {
+namespace interfaces {
class Handler;
class Node;
}
@@ -46,10 +46,10 @@ class ClientModel : public QObject
Q_OBJECT
public:
- explicit ClientModel(interface::Node& node, OptionsModel *optionsModel, QObject *parent = 0);
+ explicit ClientModel(interfaces::Node& node, OptionsModel *optionsModel, QObject *parent = 0);
~ClientModel();
- interface::Node& node() const { return m_node; }
+ interfaces::Node& node() const { return m_node; }
OptionsModel *getOptionsModel();
PeerTableModel *getPeerTableModel();
BanTableModel *getBanTableModel();
@@ -75,14 +75,14 @@ public:
mutable std::atomic<int64_t> cachedBestHeaderTime;
private:
- interface::Node& m_node;
- std::unique_ptr<interface::Handler> m_handler_show_progress;
- std::unique_ptr<interface::Handler> m_handler_notify_num_connections_changed;
- std::unique_ptr<interface::Handler> m_handler_notify_network_active_changed;
- std::unique_ptr<interface::Handler> m_handler_notify_alert_changed;
- std::unique_ptr<interface::Handler> m_handler_banned_list_changed;
- std::unique_ptr<interface::Handler> m_handler_notify_block_tip;
- std::unique_ptr<interface::Handler> m_handler_notify_header_tip;
+ interfaces::Node& m_node;
+ std::unique_ptr<interfaces::Handler> m_handler_show_progress;
+ std::unique_ptr<interfaces::Handler> m_handler_notify_num_connections_changed;
+ std::unique_ptr<interfaces::Handler> m_handler_notify_network_active_changed;
+ std::unique_ptr<interfaces::Handler> m_handler_notify_alert_changed;
+ std::unique_ptr<interfaces::Handler> m_handler_banned_list_changed;
+ std::unique_ptr<interfaces::Handler> m_handler_notify_block_tip;
+ std::unique_ptr<interfaces::Handler> m_handler_notify_header_tip;
OptionsModel *optionsModel;
PeerTableModel *peerTableModel;
BanTableModel *banTableModel;
diff --git a/src/qt/coincontroldialog.cpp b/src/qt/coincontroldialog.cpp
index 2081d6ca08..b08de27041 100644
--- a/src/qt/coincontroldialog.cpp
+++ b/src/qt/coincontroldialog.cpp
@@ -14,7 +14,7 @@
#include <qt/walletmodel.h>
#include <wallet/coincontrol.h>
-#include <interface/node.h>
+#include <interfaces/node.h>
#include <key_io.h>
#include <policy/fees.h>
#include <policy/policy.h>
@@ -509,7 +509,7 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
nBytes -= 34;
// Fee
- nPayFee = model->node().getMinimumFee(nBytes, *coinControl(), nullptr /* returned_target */, nullptr /* reason */);
+ nPayFee = model->wallet().getMinimumFee(nBytes, *coinControl(), nullptr /* returned_target */, nullptr /* reason */);
if (nPayAmount > 0)
{
@@ -648,7 +648,7 @@ void CoinControlDialog::updateView()
int nChildren = 0;
for (const auto& outpair : coins.second) {
const COutPoint& output = std::get<0>(outpair);
- const interface::WalletTxOut& out = std::get<1>(outpair);
+ const interfaces::WalletTxOut& out = std::get<1>(outpair);
nSum += out.txout.nValue;
nChildren++;
diff --git a/src/qt/editaddressdialog.cpp b/src/qt/editaddressdialog.cpp
index 38411c499f..f26a31158e 100644
--- a/src/qt/editaddressdialog.cpp
+++ b/src/qt/editaddressdialog.cpp
@@ -109,7 +109,7 @@ void EditAddressDialog::accept()
break;
case AddressTableModel::DUPLICATE_ADDRESS:
QMessageBox::warning(this, windowTitle(),
- tr("The entered address \"%1\" is already in the address book.").arg(ui->addressEdit->text()),
+ getDuplicateAddressWarning(),
QMessageBox::Ok, QMessageBox::Ok);
break;
case AddressTableModel::WALLET_UNLOCK_FAILURE:
@@ -129,6 +129,25 @@ void EditAddressDialog::accept()
QDialog::accept();
}
+QString EditAddressDialog::getDuplicateAddressWarning() const
+{
+ QString dup_address = ui->addressEdit->text();
+ QString existing_label = model->labelForAddress(dup_address);
+ QString existing_purpose = model->purposeForAddress(dup_address);
+
+ if (existing_purpose == "receive" &&
+ (mode == NewSendingAddress || mode == EditSendingAddress)) {
+ return tr(
+ "Address \"%1\" already exists as a receiving address with label "
+ "\"%2\" and so cannot be added as a sending address."
+ ).arg(dup_address).arg(existing_label);
+ }
+ return tr(
+ "The entered address \"%1\" is already in the address book with "
+ "label \"%2\"."
+ ).arg(dup_address).arg(existing_label);
+}
+
QString EditAddressDialog::getAddress() const
{
return address;
diff --git a/src/qt/editaddressdialog.h b/src/qt/editaddressdialog.h
index 41c5d1708a..3aba74bf08 100644
--- a/src/qt/editaddressdialog.h
+++ b/src/qt/editaddressdialog.h
@@ -30,7 +30,7 @@ public:
EditSendingAddress
};
- explicit EditAddressDialog(Mode mode, QWidget *parent);
+ explicit EditAddressDialog(Mode mode, QWidget *parent = 0);
~EditAddressDialog();
void setModel(AddressTableModel *model);
@@ -45,6 +45,9 @@ public Q_SLOTS:
private:
bool saveCurrentRow();
+ /** Return a descriptive string when adding an already-existing address fails. */
+ QString getDuplicateAddressWarning() const;
+
Ui::EditAddressDialog *ui;
QDataWidgetMapper *mapper;
Mode mode;
diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp
index 3501f97908..563f930dec 100644
--- a/src/qt/guiutil.cpp
+++ b/src/qt/guiutil.cpp
@@ -13,7 +13,7 @@
#include <chainparams.h>
#include <primitives/transaction.h>
#include <key_io.h>
-#include <interface/node.h>
+#include <interfaces/node.h>
#include <policy/policy.h>
#include <protocol.h>
#include <script/script.h>
@@ -232,7 +232,7 @@ QString formatBitcoinURI(const SendCoinsRecipient &info)
return ret;
}
-bool isDust(interface::Node& node, const QString& address, const CAmount& amount)
+bool isDust(interfaces::Node& node, const QString& address, const CAmount& amount)
{
CTxDestination dest = DecodeDestination(address.toStdString());
CScript script = GetScriptForDestination(dest);
@@ -599,7 +599,7 @@ TableViewLastColumnResizingFixer::TableViewLastColumnResizingFixer(QTableView* t
#ifdef WIN32
fs::path static StartupShortcutPath()
{
- std::string chain = ChainNameFromCommandLine();
+ std::string chain = gArgs.GetChainName();
if (chain == CBaseChainParams::MAIN)
return GetSpecialFolderPath(CSIDL_STARTUP) / "Bitcoin.lnk";
if (chain == CBaseChainParams::TESTNET) // Remove this special case when CBaseChainParams::TESTNET = "testnet4"
@@ -697,7 +697,7 @@ fs::path static GetAutostartDir()
fs::path static GetAutostartFilePath()
{
- std::string chain = ChainNameFromCommandLine();
+ std::string chain = gArgs.GetChainName();
if (chain == CBaseChainParams::MAIN)
return GetAutostartDir() / "bitcoin.desktop";
return GetAutostartDir() / strprintf("bitcoin-%s.lnk", chain);
@@ -739,7 +739,7 @@ bool SetStartOnSystemStartup(bool fAutoStart)
fs::ofstream optionFile(GetAutostartFilePath(), std::ios_base::out|std::ios_base::trunc);
if (!optionFile.good())
return false;
- std::string chain = ChainNameFromCommandLine();
+ std::string chain = gArgs.GetChainName();
// Write a bitcoin.desktop file to the autostart directory:
optionFile << "[Desktop Entry]\n";
optionFile << "Type=Application\n";
diff --git a/src/qt/guiutil.h b/src/qt/guiutil.h
index 40037edb9d..4a26964098 100644
--- a/src/qt/guiutil.h
+++ b/src/qt/guiutil.h
@@ -20,7 +20,7 @@
class QValidatedLineEdit;
class SendCoinsRecipient;
-namespace interface
+namespace interfaces
{
class Node;
}
@@ -54,7 +54,7 @@ namespace GUIUtil
QString formatBitcoinURI(const SendCoinsRecipient &info);
// Returns true if given address+amount meets "dust" definition
- bool isDust(interface::Node& node, const QString& address, const CAmount& amount);
+ bool isDust(interfaces::Node& node, const QString& address, const CAmount& amount);
// HTML escaping for rich text controls
QString HtmlEscape(const QString& str, bool fMultiLine=false);
diff --git a/src/qt/intro.cpp b/src/qt/intro.cpp
index 4eb7482018..8c00ca0363 100644
--- a/src/qt/intro.cpp
+++ b/src/qt/intro.cpp
@@ -12,7 +12,7 @@
#include <qt/guiutil.h>
-#include <interface/node.h>
+#include <interfaces/node.h>
#include <util.h>
#include <QFileDialog>
@@ -187,7 +187,7 @@ QString Intro::getDefaultDataDirectory()
return GUIUtil::boostPathToQString(GetDefaultDataDir());
}
-bool Intro::pickDataDirectory(interface::Node& node)
+bool Intro::pickDataDirectory(interfaces::Node& node)
{
QSettings settings;
/* If data directory provided on command line, no need to look at settings
diff --git a/src/qt/intro.h b/src/qt/intro.h
index 07d2025bb6..b0937aedcb 100644
--- a/src/qt/intro.h
+++ b/src/qt/intro.h
@@ -13,7 +13,7 @@ static const bool DEFAULT_CHOOSE_DATADIR = false;
class FreespaceChecker;
-namespace interface {
+namespace interfaces {
class Node;
}
@@ -45,7 +45,7 @@ public:
* @note do NOT call global GetDataDir() before calling this function, this
* will cause the wrong path to be cached.
*/
- static bool pickDataDirectory(interface::Node& node);
+ static bool pickDataDirectory(interfaces::Node& node);
/**
* Determine default data directory for operating system.
diff --git a/src/qt/optionsdialog.cpp b/src/qt/optionsdialog.cpp
index 438e9e70f1..c0ddb89b40 100644
--- a/src/qt/optionsdialog.cpp
+++ b/src/qt/optionsdialog.cpp
@@ -13,7 +13,7 @@
#include <qt/guiutil.h>
#include <qt/optionsmodel.h>
-#include <interface/node.h>
+#include <interfaces/node.h>
#include <validation.h> // for DEFAULT_SCRIPTCHECK_THREADS and MAX_SCRIPTCHECK_THREADS
#include <netbase.h>
#include <txdb.h> // for -dbcache defaults
diff --git a/src/qt/optionsmodel.cpp b/src/qt/optionsmodel.cpp
index d8197b6ec6..cae9dace4c 100644
--- a/src/qt/optionsmodel.cpp
+++ b/src/qt/optionsmodel.cpp
@@ -11,7 +11,7 @@
#include <qt/bitcoinunits.h>
#include <qt/guiutil.h>
-#include <interface/node.h>
+#include <interfaces/node.h>
#include <validation.h> // For DEFAULT_SCRIPTCHECK_THREADS
#include <net.h>
#include <netbase.h>
@@ -24,7 +24,9 @@
const char *DEFAULT_GUI_PROXY_HOST = "127.0.0.1";
-OptionsModel::OptionsModel(interface::Node& node, QObject *parent, bool resetSettings) :
+static const QString GetDefaultProxyAddress();
+
+OptionsModel::OptionsModel(interfaces::Node& node, QObject *parent, bool resetSettings) :
QAbstractListModel(parent), m_node(node)
{
Init(resetSettings);
@@ -121,7 +123,7 @@ void OptionsModel::Init(bool resetSettings)
if (!settings.contains("fUseProxy"))
settings.setValue("fUseProxy", false);
if (!settings.contains("addrProxy"))
- settings.setValue("addrProxy", QString("%1:%2").arg(DEFAULT_GUI_PROXY_HOST, DEFAULT_GUI_PROXY_PORT));
+ settings.setValue("addrProxy", GetDefaultProxyAddress());
// Only try to set -proxy, if user has enabled fUseProxy
if (settings.value("fUseProxy").toBool() && !m_node.softSetArg("-proxy", settings.value("addrProxy").toString().toStdString()))
addOverriddenOption("-proxy");
@@ -131,7 +133,7 @@ void OptionsModel::Init(bool resetSettings)
if (!settings.contains("fUseSeparateProxyTor"))
settings.setValue("fUseSeparateProxyTor", false);
if (!settings.contains("addrSeparateProxyTor"))
- settings.setValue("addrSeparateProxyTor", QString("%1:%2").arg(DEFAULT_GUI_PROXY_HOST, DEFAULT_GUI_PROXY_PORT));
+ settings.setValue("addrSeparateProxyTor", GetDefaultProxyAddress());
// Only try to set -onion, if user has enabled fUseSeparateProxyTor
if (settings.value("fUseSeparateProxyTor").toBool() && !m_node.softSetArg("-onion", settings.value("addrSeparateProxyTor").toString().toStdString()))
addOverriddenOption("-onion");
@@ -223,6 +225,11 @@ static void SetProxySetting(QSettings &settings, const QString &name, const Prox
settings.setValue(name, ip_port.ip + ":" + ip_port.port);
}
+static const QString GetDefaultProxyAddress()
+{
+ return QString("%1:%2").arg(DEFAULT_GUI_PROXY_HOST).arg(DEFAULT_GUI_PROXY_PORT);
+}
+
// read QSettings values and return them
QVariant OptionsModel::data(const QModelIndex & index, int role) const
{
@@ -485,4 +492,16 @@ void OptionsModel::checkAndMigrate()
settings.setValue(strSettingsVersionKey, CLIENT_VERSION);
}
+
+ // Overwrite the 'addrProxy' setting in case it has been set to an illegal
+ // default value (see issue #12623; PR #12650).
+ if (settings.contains("addrProxy") && settings.value("addrProxy").toString().endsWith("%2")) {
+ settings.setValue("addrProxy", GetDefaultProxyAddress());
+ }
+
+ // Overwrite the 'addrSeparateProxyTor' setting in case it has been set to an illegal
+ // default value (see issue #12623; PR #12650).
+ if (settings.contains("addrSeparateProxyTor") && settings.value("addrSeparateProxyTor").toString().endsWith("%2")) {
+ settings.setValue("addrSeparateProxyTor", GetDefaultProxyAddress());
+ }
}
diff --git a/src/qt/optionsmodel.h b/src/qt/optionsmodel.h
index 96c6b8fa45..fc1d119a71 100644
--- a/src/qt/optionsmodel.h
+++ b/src/qt/optionsmodel.h
@@ -9,7 +9,7 @@
#include <QAbstractListModel>
-namespace interface {
+namespace interfaces {
class Node;
}
@@ -31,7 +31,7 @@ class OptionsModel : public QAbstractListModel
Q_OBJECT
public:
- explicit OptionsModel(interface::Node& node, QObject *parent = 0, bool resetSettings = false);
+ explicit OptionsModel(interfaces::Node& node, QObject *parent = 0, bool resetSettings = false);
enum OptionID {
StartAtStartup, // bool
@@ -79,10 +79,10 @@ public:
void setRestartRequired(bool fRequired);
bool isRestartRequired() const;
- interface::Node& node() const { return m_node; }
+ interfaces::Node& node() const { return m_node; }
private:
- interface::Node& m_node;
+ interfaces::Node& m_node;
/* Qt-only settings */
bool fHideTrayIcon;
bool fMinimizeToTray;
diff --git a/src/qt/overviewpage.cpp b/src/qt/overviewpage.cpp
index 76d0220648..8e8788dad3 100644
--- a/src/qt/overviewpage.cpp
+++ b/src/qt/overviewpage.cpp
@@ -21,7 +21,7 @@
#define DECORATION_SIZE 54
#define NUM_ITEMS 5
-Q_DECLARE_METATYPE(interface::WalletBalances)
+Q_DECLARE_METATYPE(interfaces::WalletBalances)
class TxViewDelegate : public QAbstractItemDelegate
{
@@ -157,7 +157,7 @@ OverviewPage::~OverviewPage()
delete ui;
}
-void OverviewPage::setBalance(const interface::WalletBalances& balances)
+void OverviewPage::setBalance(const interfaces::WalletBalances& balances)
{
int unit = walletModel->getOptionsModel()->getDisplayUnit();
m_balances = balances;
@@ -224,10 +224,10 @@ void OverviewPage::setWalletModel(WalletModel *model)
ui->listTransactions->setModelColumn(TransactionTableModel::ToAddress);
// Keep up to date with wallet
- interface::Wallet& wallet = model->wallet();
- interface::WalletBalances balances = wallet.getBalances();
+ interfaces::Wallet& wallet = model->wallet();
+ interfaces::WalletBalances balances = wallet.getBalances();
setBalance(balances);
- connect(model, SIGNAL(balanceChanged(interface::WalletBalances)), this, SLOT(setBalance(interface::WalletBalances)));
+ connect(model, SIGNAL(balanceChanged(interfaces::WalletBalances)), this, SLOT(setBalance(interfaces::WalletBalances)));
connect(model->getOptionsModel(), SIGNAL(displayUnitChanged(int)), this, SLOT(updateDisplayUnit()));
diff --git a/src/qt/overviewpage.h b/src/qt/overviewpage.h
index 36333536e5..d519eca43a 100644
--- a/src/qt/overviewpage.h
+++ b/src/qt/overviewpage.h
@@ -5,7 +5,7 @@
#ifndef BITCOIN_QT_OVERVIEWPAGE_H
#define BITCOIN_QT_OVERVIEWPAGE_H
-#include <interface/wallet.h>
+#include <interfaces/wallet.h>
#include <QWidget>
#include <memory>
@@ -38,7 +38,7 @@ public:
void showOutOfSyncWarning(bool fShow);
public Q_SLOTS:
- void setBalance(const interface::WalletBalances& balances);
+ void setBalance(const interfaces::WalletBalances& balances);
Q_SIGNALS:
void transactionClicked(const QModelIndex &index);
@@ -48,7 +48,7 @@ private:
Ui::OverviewPage *ui;
ClientModel *clientModel;
WalletModel *walletModel;
- interface::WalletBalances m_balances;
+ interfaces::WalletBalances m_balances;
TxViewDelegate *txdelegate;
std::unique_ptr<TransactionFilterProxy> filter;
diff --git a/src/qt/paymentrequestplus.cpp b/src/qt/paymentrequestplus.cpp
index 357e98a53c..b0ef475b35 100644
--- a/src/qt/paymentrequestplus.cpp
+++ b/src/qt/paymentrequestplus.cpp
@@ -9,7 +9,6 @@
#include <qt/paymentrequestplus.h>
-#include <script/script.h>
#include <util.h>
#include <stdexcept>
diff --git a/src/qt/paymentserver.cpp b/src/qt/paymentserver.cpp
index 275dba0b15..59bb5d5bb6 100644
--- a/src/qt/paymentserver.cpp
+++ b/src/qt/paymentserver.cpp
@@ -9,7 +9,7 @@
#include <qt/optionsmodel.h>
#include <chainparams.h>
-#include <interface/node.h>
+#include <interfaces/node.h>
#include <policy/policy.h>
#include <key_io.h>
#include <ui_interface.h>
@@ -201,7 +201,7 @@ void PaymentServer::LoadRootCAs(X509_STORE* _store)
// Warning: ipcSendCommandLine() is called early in init,
// so don't use "Q_EMIT message()", but "QMessageBox::"!
//
-void PaymentServer::ipcParseCommandLine(interface::Node& node, int argc, char* argv[])
+void PaymentServer::ipcParseCommandLine(interfaces::Node& node, int argc, char* argv[])
{
for (int i = 1; i < argc; i++)
{
@@ -760,7 +760,7 @@ void PaymentServer::handlePaymentACK(const QString& paymentACKMsg)
Q_EMIT message(tr("Payment acknowledged"), paymentACKMsg, CClientUIInterface::ICON_INFORMATION | CClientUIInterface::MODAL);
}
-bool PaymentServer::verifyNetwork(interface::Node& node, const payments::PaymentDetails& requestDetails)
+bool PaymentServer::verifyNetwork(interfaces::Node& node, const payments::PaymentDetails& requestDetails)
{
bool fVerified = requestDetails.network() == node.getNetwork();
if (!fVerified) {
diff --git a/src/qt/paymentserver.h b/src/qt/paymentserver.h
index e139899e22..511fc5bd6e 100644
--- a/src/qt/paymentserver.h
+++ b/src/qt/paymentserver.h
@@ -60,7 +60,7 @@ class PaymentServer : public QObject
public:
// Parse URIs on command line
// Returns false on error
- static void ipcParseCommandLine(interface::Node& node, int argc, char *argv[]);
+ static void ipcParseCommandLine(interfaces::Node& node, int argc, char *argv[]);
// Returns true if there were URIs on the command line
// which were successfully sent to an already-running
@@ -87,7 +87,7 @@ public:
void setOptionsModel(OptionsModel *optionsModel);
// Verify that the payment request network matches the client network
- static bool verifyNetwork(interface::Node& node, const payments::PaymentDetails& requestDetails);
+ static bool verifyNetwork(interfaces::Node& node, const payments::PaymentDetails& requestDetails);
// Verify if the payment request is expired
static bool verifyExpired(const payments::PaymentDetails& requestDetails);
// Verify the payment request size is valid as per BIP70
diff --git a/src/qt/peertablemodel.cpp b/src/qt/peertablemodel.cpp
index f33db8e761..7e318e3035 100644
--- a/src/qt/peertablemodel.cpp
+++ b/src/qt/peertablemodel.cpp
@@ -8,7 +8,7 @@
#include <qt/guiconstants.h>
#include <qt/guiutil.h>
-#include <interface/node.h>
+#include <interfaces/node.h>
#include <validation.h> // for cs_main
#include <sync.h>
@@ -57,12 +57,12 @@ public:
std::map<NodeId, int> mapNodeRows;
/** Pull a full list of peers from vNodes into our cache */
- void refreshPeers(interface::Node& node)
+ void refreshPeers(interfaces::Node& node)
{
{
cachedNodeStats.clear();
- interface::Node::NodesStats nodes_stats;
+ interfaces::Node::NodesStats nodes_stats;
node.getNodesStats(nodes_stats);
#if QT_VERSION >= 0x040700
cachedNodeStats.reserve(nodes_stats.size());
@@ -102,7 +102,7 @@ public:
}
};
-PeerTableModel::PeerTableModel(interface::Node& node, ClientModel *parent) :
+PeerTableModel::PeerTableModel(interfaces::Node& node, ClientModel *parent) :
QAbstractTableModel(parent),
m_node(node),
clientModel(parent),
diff --git a/src/qt/peertablemodel.h b/src/qt/peertablemodel.h
index c53462c57c..69c9744c8f 100644
--- a/src/qt/peertablemodel.h
+++ b/src/qt/peertablemodel.h
@@ -16,7 +16,7 @@
class ClientModel;
class PeerTablePriv;
-namespace interface {
+namespace interfaces {
class Node;
}
@@ -51,7 +51,7 @@ class PeerTableModel : public QAbstractTableModel
Q_OBJECT
public:
- explicit PeerTableModel(interface::Node& node, ClientModel *parent = 0);
+ explicit PeerTableModel(interfaces::Node& node, ClientModel *parent = 0);
~PeerTableModel();
const CNodeCombinedStats *getNodeStats(int idx);
int getRowByNodeId(NodeId nodeid);
@@ -82,7 +82,7 @@ public Q_SLOTS:
void refresh();
private:
- interface::Node& m_node;
+ interfaces::Node& m_node;
ClientModel *clientModel;
QStringList columns;
std::unique_ptr<PeerTablePriv> priv;
diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp
index 745055b944..7924840d0b 100644
--- a/src/qt/rpcconsole.cpp
+++ b/src/qt/rpcconsole.cpp
@@ -14,7 +14,7 @@
#include <qt/platformstyle.h>
#include <qt/walletmodel.h>
#include <chainparams.h>
-#include <interface/node.h>
+#include <interfaces/node.h>
#include <netbase.h>
#include <rpc/server.h>
#include <rpc/client.h>
@@ -85,7 +85,7 @@ class RPCExecutor : public QObject
{
Q_OBJECT
public:
- RPCExecutor(interface::Node& node) : m_node(node) {}
+ RPCExecutor(interfaces::Node& node) : m_node(node) {}
public Q_SLOTS:
void request(const QString &command, const QString &walletID);
@@ -94,7 +94,7 @@ Q_SIGNALS:
void reply(int category, const QString &command);
private:
- interface::Node& m_node;
+ interfaces::Node& m_node;
};
/** Class for handling RPC timers
@@ -153,7 +153,7 @@ public:
* @param[out] pstrFilteredOut Command line, filtered to remove any sensitive data
*/
-bool RPCConsole::RPCParseCommandLine(interface::Node* node, std::string &strResult, const std::string &strCommand, const bool fExecute, std::string * const pstrFilteredOut, const std::string *walletID)
+bool RPCConsole::RPCParseCommandLine(interfaces::Node* node, std::string &strResult, const std::string &strCommand, const bool fExecute, std::string * const pstrFilteredOut, const std::string *walletID)
{
std::vector< std::vector<std::string> > stack;
stack.push_back(std::vector<std::string>());
@@ -451,16 +451,11 @@ void RPCExecutor::request(const QString &command, const QString &walletID)
}
}
-RPCConsole::RPCConsole(interface::Node& node, const PlatformStyle *_platformStyle, QWidget *parent) :
+RPCConsole::RPCConsole(interfaces::Node& node, const PlatformStyle *_platformStyle, QWidget *parent) :
QWidget(parent),
m_node(node),
ui(new Ui::RPCConsole),
- clientModel(0),
- historyPtr(0),
- platformStyle(_platformStyle),
- peersTableContextMenu(0),
- banTableContextMenu(0),
- consoleFontSize(0)
+ platformStyle(_platformStyle)
{
ui->setupUi(this);
QSettings settings;
@@ -575,7 +570,7 @@ void RPCConsole::setClientModel(ClientModel *model)
setNumConnections(model->getNumConnections());
connect(model, SIGNAL(numConnectionsChanged(int)), this, SLOT(setNumConnections(int)));
- interface::Node& node = clientModel->node();
+ interfaces::Node& node = clientModel->node();
setNumBlocks(node.getNumBlocks(), QDateTime::fromTime_t(node.getLastBlockTime()), node.getVerificationProgress(), false);
connect(model, SIGNAL(numBlocksChanged(int,QDateTime,double,bool)), this, SLOT(setNumBlocks(int,QDateTime,double,bool)));
diff --git a/src/qt/rpcconsole.h b/src/qt/rpcconsole.h
index 8381301759..a53c4c24f9 100644
--- a/src/qt/rpcconsole.h
+++ b/src/qt/rpcconsole.h
@@ -19,7 +19,7 @@ class PlatformStyle;
class RPCTimerInterface;
class WalletModel;
-namespace interface {
+namespace interfaces {
class Node;
}
@@ -38,11 +38,11 @@ class RPCConsole: public QWidget
Q_OBJECT
public:
- explicit RPCConsole(interface::Node& node, const PlatformStyle *platformStyle, QWidget *parent);
+ explicit RPCConsole(interfaces::Node& node, const PlatformStyle *platformStyle, QWidget *parent);
~RPCConsole();
- static bool RPCParseCommandLine(interface::Node* node, std::string &strResult, const std::string &strCommand, bool fExecute, std::string * const pstrFilteredOut = nullptr, const std::string *walletID = nullptr);
- static bool RPCExecuteCommandLine(interface::Node& node, std::string &strResult, const std::string &strCommand, std::string * const pstrFilteredOut = nullptr, const std::string *walletID = nullptr) {
+ static bool RPCParseCommandLine(interfaces::Node* node, std::string &strResult, const std::string &strCommand, bool fExecute, std::string * const pstrFilteredOut = nullptr, const std::string *walletID = nullptr);
+ static bool RPCExecuteCommandLine(interfaces::Node& node, std::string &strResult, const std::string &strCommand, std::string * const pstrFilteredOut = nullptr, const std::string *walletID = nullptr) {
return RPCParseCommandLine(&node, strResult, strCommand, true, pstrFilteredOut, walletID);
}
@@ -144,19 +144,19 @@ private:
};
- interface::Node& m_node;
- Ui::RPCConsole *ui;
- ClientModel *clientModel;
+ interfaces::Node& m_node;
+ Ui::RPCConsole* const ui;
+ ClientModel *clientModel = nullptr;
QStringList history;
- int historyPtr;
+ int historyPtr = 0;
QString cmdBeforeBrowsing;
QList<NodeId> cachedNodeids;
- const PlatformStyle *platformStyle;
- RPCTimerInterface *rpcTimerInterface;
- QMenu *peersTableContextMenu;
- QMenu *banTableContextMenu;
- int consoleFontSize;
- QCompleter *autoCompleter;
+ const PlatformStyle* const platformStyle;
+ RPCTimerInterface *rpcTimerInterface = nullptr;
+ QMenu *peersTableContextMenu = nullptr;
+ QMenu *banTableContextMenu = nullptr;
+ int consoleFontSize = 0;
+ QCompleter *autoCompleter = nullptr;
QThread thread;
QString m_last_wallet_id;
diff --git a/src/qt/sendcoinsdialog.cpp b/src/qt/sendcoinsdialog.cpp
index b4c1471a4f..261ab7a948 100644
--- a/src/qt/sendcoinsdialog.cpp
+++ b/src/qt/sendcoinsdialog.cpp
@@ -15,7 +15,7 @@
#include <qt/sendcoinsentry.h>
#include <chainparams.h>
-#include <interface/node.h>
+#include <interfaces/node.h>
#include <key_io.h>
#include <wallet/coincontrol.h>
#include <ui_interface.h>
@@ -114,7 +114,7 @@ SendCoinsDialog::SendCoinsDialog(const PlatformStyle *_platformStyle, QWidget *p
if (!settings.contains("nSmartFeeSliderPosition"))
settings.setValue("nSmartFeeSliderPosition", 0);
if (!settings.contains("nTransactionFee"))
- settings.setValue("nTransactionFee", (qint64)DEFAULT_TRANSACTION_FEE);
+ settings.setValue("nTransactionFee", (qint64)DEFAULT_PAY_TX_FEE);
if (!settings.contains("fPayOnlyMinFee"))
settings.setValue("fPayOnlyMinFee", false);
ui->groupFee->setId(ui->radioSmartFee, 0);
@@ -149,9 +149,9 @@ void SendCoinsDialog::setModel(WalletModel *_model)
}
}
- interface::WalletBalances balances = _model->wallet().getBalances();
+ interfaces::WalletBalances balances = _model->wallet().getBalances();
setBalance(balances);
- connect(_model, SIGNAL(balanceChanged(interface::WalletBalances)), this, SLOT(setBalance(interface::WalletBalances)));
+ connect(_model, SIGNAL(balanceChanged(interfaces::WalletBalances)), this, SLOT(setBalance(interfaces::WalletBalances)));
connect(_model->getOptionsModel(), SIGNAL(displayUnitChanged(int)), this, SLOT(updateDisplayUnit()));
updateDisplayUnit();
@@ -175,7 +175,7 @@ void SendCoinsDialog::setModel(WalletModel *_model)
connect(ui->checkBoxMinimumFee, SIGNAL(stateChanged(int)), this, SLOT(coinControlUpdateLabels()));
connect(ui->optInRBF, SIGNAL(stateChanged(int)), this, SLOT(updateSmartFeeLabel()));
connect(ui->optInRBF, SIGNAL(stateChanged(int)), this, SLOT(coinControlUpdateLabels()));
- ui->customFee->setSingleStep(model->node().getRequiredFee(1000));
+ ui->customFee->setSingleStep(model->wallet().getRequiredFee(1000));
updateFeeSectionControls();
updateMinFeeLabel();
updateSmartFeeLabel();
@@ -193,7 +193,7 @@ void SendCoinsDialog::setModel(WalletModel *_model)
settings.remove("nSmartFeeSliderPosition");
}
if (settings.value("nConfTarget").toInt() == 0)
- ui->confTargetSelector->setCurrentIndex(getIndexForConfTarget(model->node().getTxConfirmTarget()));
+ ui->confTargetSelector->setCurrentIndex(getIndexForConfTarget(model->wallet().getConfirmTarget()));
else
ui->confTargetSelector->setCurrentIndex(getIndexForConfTarget(settings.value("nConfTarget").toInt()));
}
@@ -515,7 +515,7 @@ bool SendCoinsDialog::handlePaymentRequest(const SendCoinsRecipient &rv)
return true;
}
-void SendCoinsDialog::setBalance(const interface::WalletBalances& balances)
+void SendCoinsDialog::setBalance(const interfaces::WalletBalances& balances)
{
if(model && model->getOptionsModel())
{
@@ -629,7 +629,7 @@ void SendCoinsDialog::useAvailableBalance(SendCoinsEntry* entry)
void SendCoinsDialog::setMinimumFee()
{
- ui->customFee->setValue(model->node().getRequiredFee(1000));
+ ui->customFee->setValue(model->wallet().getRequiredFee(1000));
}
void SendCoinsDialog::updateFeeSectionControls()
@@ -661,7 +661,7 @@ void SendCoinsDialog::updateMinFeeLabel()
{
if (model && model->getOptionsModel())
ui->checkBoxMinimumFee->setText(tr("Pay only the required fee of %1").arg(
- BitcoinUnits::formatWithUnit(model->getOptionsModel()->getDisplayUnit(), model->node().getRequiredFee(1000)) + "/kB")
+ BitcoinUnits::formatWithUnit(model->getOptionsModel()->getDisplayUnit(), model->wallet().getRequiredFee(1000)) + "/kB")
);
}
@@ -675,7 +675,7 @@ void SendCoinsDialog::updateCoinControlState(CCoinControl& ctrl)
// Avoid using global defaults when sending money from the GUI
// Either custom fee will be used or if not selected, the confirmation target from dropdown box
ctrl.m_confirm_target = getConfTargetForIndex(ui->confTargetSelector->currentIndex());
- ctrl.signalRbf = ui->optInRBF->isChecked();
+ ctrl.m_signal_bip125_rbf = ui->optInRBF->isChecked();
}
void SendCoinsDialog::updateSmartFeeLabel()
@@ -687,7 +687,7 @@ void SendCoinsDialog::updateSmartFeeLabel()
coin_control.m_feerate.reset(); // Explicitly use only fee estimation rate for smart fee labels
int returned_target;
FeeReason reason;
- CFeeRate feeRate = CFeeRate(model->node().getMinimumFee(1000, coin_control, &returned_target, &reason));
+ CFeeRate feeRate = CFeeRate(model->wallet().getMinimumFee(1000, coin_control, &returned_target, &reason));
ui->labelSmartFee->setText(BitcoinUnits::formatWithUnit(model->getOptionsModel()->getDisplayUnit(), feeRate.GetFeePerK()) + "/kB");
diff --git a/src/qt/sendcoinsdialog.h b/src/qt/sendcoinsdialog.h
index 43757e3186..40a1d10c2b 100644
--- a/src/qt/sendcoinsdialog.h
+++ b/src/qt/sendcoinsdialog.h
@@ -51,7 +51,7 @@ public Q_SLOTS:
void accept();
SendCoinsEntry *addEntry();
void updateTabsAndLabels();
- void setBalance(const interface::WalletBalances& balances);
+ void setBalance(const interfaces::WalletBalances& balances);
Q_SIGNALS:
void coinsSent(const uint256& txid);
diff --git a/src/qt/sendcoinsentry.cpp b/src/qt/sendcoinsentry.cpp
index 6a961d83ea..977425f7e3 100644
--- a/src/qt/sendcoinsentry.cpp
+++ b/src/qt/sendcoinsentry.cpp
@@ -127,7 +127,7 @@ void SendCoinsEntry::useAvailableBalanceClicked()
Q_EMIT useAvailableBalance(this);
}
-bool SendCoinsEntry::validate(interface::Node& node)
+bool SendCoinsEntry::validate(interfaces::Node& node)
{
if (!model)
return false;
diff --git a/src/qt/sendcoinsentry.h b/src/qt/sendcoinsentry.h
index 715f4cfde5..76f96c61e0 100644
--- a/src/qt/sendcoinsentry.h
+++ b/src/qt/sendcoinsentry.h
@@ -30,7 +30,7 @@ public:
~SendCoinsEntry();
void setModel(WalletModel *model);
- bool validate(interface::Node& node);
+ bool validate(interfaces::Node& node);
SendCoinsRecipient getValue();
/** Return whether the entry is still empty and unedited */
diff --git a/src/qt/splashscreen.cpp b/src/qt/splashscreen.cpp
index 2475a82ef9..4d972b431c 100644
--- a/src/qt/splashscreen.cpp
+++ b/src/qt/splashscreen.cpp
@@ -12,9 +12,9 @@
#include <clientversion.h>
#include <init.h>
-#include <interface/handler.h>
-#include <interface/node.h>
-#include <interface/wallet.h>
+#include <interfaces/handler.h>
+#include <interfaces/node.h>
+#include <interfaces/wallet.h>
#include <util.h>
#include <ui_interface.h>
#include <version.h>
@@ -25,7 +25,7 @@
#include <QPainter>
#include <QRadialGradient>
-SplashScreen::SplashScreen(interface::Node& node, Qt::WindowFlags f, const NetworkStyle *networkStyle) :
+SplashScreen::SplashScreen(interfaces::Node& node, Qt::WindowFlags f, const NetworkStyle *networkStyle) :
QWidget(0, f), curAlignment(0), m_node(node)
{
// set reference point, paddings
@@ -177,7 +177,7 @@ static void ShowProgress(SplashScreen *splash, const std::string &title, int nPr
strprintf("\n%d", nProgress) + "%");
}
#ifdef ENABLE_WALLET
-void SplashScreen::ConnectWallet(std::unique_ptr<interface::Wallet> wallet)
+void SplashScreen::ConnectWallet(std::unique_ptr<interfaces::Wallet> wallet)
{
m_connected_wallet_handlers.emplace_back(wallet->handleShowProgress(boost::bind(ShowProgress, this, _1, _2, false)));
m_connected_wallets.emplace_back(std::move(wallet));
@@ -190,7 +190,7 @@ void SplashScreen::subscribeToCoreSignals()
m_handler_init_message = m_node.handleInitMessage(boost::bind(InitMessage, this, _1));
m_handler_show_progress = m_node.handleShowProgress(boost::bind(ShowProgress, this, _1, _2, _3));
#ifdef ENABLE_WALLET
- m_handler_load_wallet = m_node.handleLoadWallet([this](std::unique_ptr<interface::Wallet> wallet) { ConnectWallet(std::move(wallet)); });
+ m_handler_load_wallet = m_node.handleLoadWallet([this](std::unique_ptr<interfaces::Wallet> wallet) { ConnectWallet(std::move(wallet)); });
#endif
}
diff --git a/src/qt/splashscreen.h b/src/qt/splashscreen.h
index 419f36f641..9ef19675d8 100644
--- a/src/qt/splashscreen.h
+++ b/src/qt/splashscreen.h
@@ -12,7 +12,7 @@
class NetworkStyle;
-namespace interface {
+namespace interfaces {
class Handler;
class Node;
class Wallet;
@@ -29,7 +29,7 @@ class SplashScreen : public QWidget
Q_OBJECT
public:
- explicit SplashScreen(interface::Node& node, Qt::WindowFlags f, const NetworkStyle *networkStyle);
+ explicit SplashScreen(interfaces::Node& node, Qt::WindowFlags f, const NetworkStyle *networkStyle);
~SplashScreen();
protected:
@@ -52,19 +52,19 @@ private:
/** Disconnect core signals to splash screen */
void unsubscribeFromCoreSignals();
/** Connect wallet signals to splash screen */
- void ConnectWallet(std::unique_ptr<interface::Wallet> wallet);
+ void ConnectWallet(std::unique_ptr<interfaces::Wallet> wallet);
QPixmap pixmap;
QString curMessage;
QColor curColor;
int curAlignment;
- interface::Node& m_node;
- std::unique_ptr<interface::Handler> m_handler_init_message;
- std::unique_ptr<interface::Handler> m_handler_show_progress;
- std::unique_ptr<interface::Handler> m_handler_load_wallet;
- std::list<std::unique_ptr<interface::Wallet>> m_connected_wallets;
- std::list<std::unique_ptr<interface::Handler>> m_connected_wallet_handlers;
+ interfaces::Node& m_node;
+ std::unique_ptr<interfaces::Handler> m_handler_init_message;
+ std::unique_ptr<interfaces::Handler> m_handler_show_progress;
+ std::unique_ptr<interfaces::Handler> m_handler_load_wallet;
+ std::list<std::unique_ptr<interfaces::Wallet>> m_connected_wallets;
+ std::list<std::unique_ptr<interfaces::Handler>> m_connected_wallet_handlers;
};
#endif // BITCOIN_QT_SPLASHSCREEN_H
diff --git a/src/qt/test/addressbooktests.cpp b/src/qt/test/addressbooktests.cpp
new file mode 100644
index 0000000000..0c2e7ae71d
--- /dev/null
+++ b/src/qt/test/addressbooktests.cpp
@@ -0,0 +1,143 @@
+#include <qt/test/addressbooktests.h>
+#include <qt/test/util.h>
+#include <test/test_bitcoin.h>
+
+#include <interfaces/node.h>
+#include <qt/addressbookpage.h>
+#include <qt/addresstablemodel.h>
+#include <qt/editaddressdialog.h>
+#include <qt/callback.h>
+#include <qt/optionsmodel.h>
+#include <qt/platformstyle.h>
+#include <qt/qvalidatedlineedit.h>
+#include <qt/walletmodel.h>
+
+#include <key.h>
+#include <pubkey.h>
+#include <key_io.h>
+#include <wallet/wallet.h>
+
+#include <QTimer>
+#include <QMessageBox>
+
+namespace
+{
+
+/**
+ * Fill the edit address dialog box with data, submit it, and ensure that
+ * the resulting message meets expectations.
+ */
+void EditAddressAndSubmit(
+ EditAddressDialog* dialog,
+ const QString& label, const QString& address, QString expected_msg)
+{
+ QString warning_text;
+
+ dialog->findChild<QLineEdit*>("labelEdit")->setText(label);
+ dialog->findChild<QValidatedLineEdit*>("addressEdit")->setText(address);
+
+ ConfirmMessage(&warning_text, 5);
+ dialog->accept();
+ QCOMPARE(warning_text, expected_msg);
+}
+
+/**
+ * Test adding various send addresses to the address book.
+ *
+ * There are three cases tested:
+ *
+ * - new_address: a new address which should add as a send address successfully.
+ * - existing_s_address: an existing sending address which won't add successfully.
+ * - existing_r_address: an existing receiving address which won't add successfully.
+ *
+ * In each case, verify the resulting state of the address book and optionally
+ * the warning message presented to the user.
+ */
+void TestAddAddressesToSendBook()
+{
+ TestChain100Setup test;
+ CWallet wallet("mock", WalletDatabase::CreateMock());
+ bool firstRun;
+ wallet.LoadWallet(firstRun);
+
+ auto build_address = [&wallet]() {
+ CKey key;
+ key.MakeNewKey(true);
+ CTxDestination dest(GetDestinationForKey(
+ key.GetPubKey(), wallet.m_default_address_type));
+
+ return std::make_pair(dest, QString::fromStdString(EncodeDestination(dest)));
+ };
+
+ CTxDestination r_key_dest, s_key_dest;
+
+ // Add a preexisting "receive" entry in the address book.
+ QString preexisting_r_address;
+ QString r_label("already here (r)");
+
+ // Add a preexisting "send" entry in the address book.
+ QString preexisting_s_address;
+ QString s_label("already here (s)");
+
+ // Define a new address (which should add to the address book successfully).
+ QString new_address;
+
+ std::tie(r_key_dest, preexisting_r_address) = build_address();
+ std::tie(s_key_dest, preexisting_s_address) = build_address();
+ std::tie(std::ignore, new_address) = build_address();
+
+ {
+ LOCK(wallet.cs_wallet);
+ wallet.SetAddressBook(r_key_dest, r_label.toStdString(), "receive");
+ wallet.SetAddressBook(s_key_dest, s_label.toStdString(), "send");
+ }
+
+ auto check_addbook_size = [&wallet](int expected_size) {
+ QCOMPARE(static_cast<int>(wallet.mapAddressBook.size()), expected_size);
+ };
+
+ // We should start with the two addresses we added earlier and nothing else.
+ check_addbook_size(2);
+
+ // Initialize relevant QT models.
+ std::unique_ptr<const PlatformStyle> platformStyle(PlatformStyle::instantiate("other"));
+ auto node = interfaces::MakeNode();
+ OptionsModel optionsModel(*node);
+ AddWallet(&wallet);
+ WalletModel walletModel(std::move(node->getWallets()[0]), *node, platformStyle.get(), &optionsModel);
+ RemoveWallet(&wallet);
+ EditAddressDialog editAddressDialog(EditAddressDialog::NewSendingAddress);
+ editAddressDialog.setModel(walletModel.getAddressTableModel());
+
+ EditAddressAndSubmit(
+ &editAddressDialog, QString("uhoh"), preexisting_r_address,
+ QString(
+ "Address \"%1\" already exists as a receiving address with label "
+ "\"%2\" and so cannot be added as a sending address."
+ ).arg(preexisting_r_address).arg(r_label));
+
+ check_addbook_size(2);
+
+ EditAddressAndSubmit(
+ &editAddressDialog, QString("uhoh, different"), preexisting_s_address,
+ QString(
+ "The entered address \"%1\" is already in the address book with "
+ "label \"%2\"."
+ ).arg(preexisting_s_address).arg(s_label));
+
+ check_addbook_size(2);
+
+ // Submit a new address which should add successfully - we expect the
+ // warning message to be blank.
+ EditAddressAndSubmit(
+ &editAddressDialog, QString("new"), new_address, QString(""));
+
+ check_addbook_size(3);
+}
+
+} // namespace
+
+void AddressBookTests::addressBookTests()
+{
+ TestAddAddressesToSendBook();
+}
diff --git a/src/qt/test/addressbooktests.h b/src/qt/test/addressbooktests.h
new file mode 100644
index 0000000000..beeb9e76a9
--- /dev/null
+++ b/src/qt/test/addressbooktests.h
@@ -0,0 +1,15 @@
+#ifndef BITCOIN_QT_TEST_ADDRESSBOOKTESTS_H
+#define BITCOIN_QT_TEST_ADDRESSBOOKTESTS_H
+
+#include <QObject>
+#include <QTest>
+
+class AddressBookTests : public QObject
+{
+ Q_OBJECT
+
+private Q_SLOTS:
+ void addressBookTests();
+};
+
+#endif // BITCOIN_QT_TEST_ADDRESSBOOKTESTS_H
diff --git a/src/qt/test/paymentservertests.cpp b/src/qt/test/paymentservertests.cpp
index 46e9d4d0a4..83484b5ce7 100644
--- a/src/qt/test/paymentservertests.cpp
+++ b/src/qt/test/paymentservertests.cpp
@@ -9,7 +9,7 @@
#include <amount.h>
#include <chainparams.h>
-#include <interface/node.h>
+#include <interfaces/node.h>
#include <random.h>
#include <script/script.h>
#include <script/standard.h>
@@ -67,7 +67,7 @@ static SendCoinsRecipient handleRequest(PaymentServer* server, std::vector<unsig
void PaymentServerTests::paymentServerTests()
{
SelectParams(CBaseChainParams::MAIN);
- auto node = interface::MakeNode();
+ auto node = interfaces::MakeNode();
OptionsModel optionsModel(*node);
PaymentServer* server = new PaymentServer(nullptr, false);
X509_STORE* caStore = X509_STORE_new();
diff --git a/src/qt/test/rpcnestedtests.cpp b/src/qt/test/rpcnestedtests.cpp
index 467107dc4c..974e7831c4 100644
--- a/src/qt/test/rpcnestedtests.cpp
+++ b/src/qt/test/rpcnestedtests.cpp
@@ -7,7 +7,7 @@
#include <chainparams.h>
#include <consensus/validation.h>
#include <fs.h>
-#include <interface/node.h>
+#include <interfaces/node.h>
#include <validation.h>
#include <rpc/register.h>
#include <rpc/server.h>
@@ -46,7 +46,7 @@ void RPCNestedTests::rpcNestedTests()
std::string result;
std::string result2;
std::string filtered;
- auto node = interface::MakeNode();
+ auto node = interfaces::MakeNode();
RPCConsole::RPCExecuteCommandLine(*node, result, "getblockchaininfo()[chain]", &filtered); //simple result filtering with path
QVERIFY(result=="main");
QVERIFY(filtered == "getblockchaininfo()[chain]");
diff --git a/src/qt/test/test_main.cpp b/src/qt/test/test_main.cpp
index 25ee66dc6b..56d4d3e457 100644
--- a/src/qt/test/test_main.cpp
+++ b/src/qt/test/test_main.cpp
@@ -13,6 +13,7 @@
#include <qt/test/compattests.h>
#ifdef ENABLE_WALLET
+#include <qt/test/addressbooktests.h>
#include <qt/test/paymentservertests.h>
#include <qt/test/wallettests.h>
#endif
@@ -99,6 +100,10 @@ int main(int argc, char *argv[])
if (QTest::qExec(&test5) != 0) {
fInvalid = true;
}
+ AddressBookTests test6;
+ if (QTest::qExec(&test6) != 0) {
+ fInvalid = true;
+ }
#endif
fs::remove_all(pathTemp);
diff --git a/src/qt/test/util.cpp b/src/qt/test/util.cpp
new file mode 100644
index 0000000000..261caaaee5
--- /dev/null
+++ b/src/qt/test/util.cpp
@@ -0,0 +1,22 @@
+#include <qt/callback.h>
+
+#include <QApplication>
+#include <QMessageBox>
+#include <QTimer>
+#include <QString>
+#include <QPushButton>
+#include <QWidget>
+
+void ConfirmMessage(QString* text, int msec)
+{
+ QTimer::singleShot(msec, makeCallback([text](Callback* callback) {
+ for (QWidget* widget : QApplication::topLevelWidgets()) {
+ if (widget->inherits("QMessageBox")) {
+ QMessageBox* messageBox = qobject_cast<QMessageBox*>(widget);
+ if (text) *text = messageBox->text();
+ messageBox->defaultButton()->click();
+ }
+ }
+ delete callback;
+ }), SLOT(call()));
+}
diff --git a/src/qt/test/util.h b/src/qt/test/util.h
new file mode 100644
index 0000000000..324386c139
--- /dev/null
+++ b/src/qt/test/util.h
@@ -0,0 +1,12 @@
+#ifndef BITCOIN_QT_TEST_UTIL_H
+#define BITCOIN_QT_TEST_UTIL_H
+
+/**
+ * Press "Ok" button in message box dialog.
+ *
+ * @param text - Optionally store dialog text.
+ * @param msec - Number of miliseconds to pause before triggering the callback.
+ */
+void ConfirmMessage(QString* text = nullptr, int msec = 0);
+
+#endif // BITCOIN_QT_TEST_UTIL_H
diff --git a/src/qt/test/wallettests.cpp b/src/qt/test/wallettests.cpp
index b60c5b979f..a09d98dfe5 100644
--- a/src/qt/test/wallettests.cpp
+++ b/src/qt/test/wallettests.cpp
@@ -1,6 +1,7 @@
#include <qt/test/wallettests.h>
+#include <qt/test/util.h>
-#include <interface/node.h>
+#include <interfaces/node.h>
#include <qt/bitcoinamountfield.h>
#include <qt/callback.h>
#include <qt/optionsmodel.h>
@@ -35,21 +36,6 @@
namespace
{
-//! Press "Ok" button in message box dialog.
-void ConfirmMessage(QString* text = nullptr)
-{
- QTimer::singleShot(0, makeCallback([text](Callback* callback) {
- for (QWidget* widget : QApplication::topLevelWidgets()) {
- if (widget->inherits("QMessageBox")) {
- QMessageBox* messageBox = qobject_cast<QMessageBox*>(widget);
- if (text) *text = messageBox->text();
- messageBox->defaultButton()->click();
- }
- }
- delete callback;
- }), SLOT(call()));
-}
-
//! Press "Yes" or "Cancel" buttons in modal send confirmation dialog.
void ConfirmSend(QString* text = nullptr, bool cancel = false)
{
@@ -158,7 +144,7 @@ void TestGUI()
for (int i = 0; i < 5; ++i) {
test.CreateAndProcessBlock({}, GetScriptForRawPubKey(test.coinbaseKey.GetPubKey()));
}
- CWallet wallet("mock", CWalletDBWrapper::CreateMock());
+ CWallet wallet("mock", WalletDatabase::CreateMock());
bool firstRun;
wallet.LoadWallet(firstRun);
{
@@ -178,11 +164,11 @@ void TestGUI()
std::unique_ptr<const PlatformStyle> platformStyle(PlatformStyle::instantiate("other"));
SendCoinsDialog sendCoinsDialog(platformStyle.get());
TransactionView transactionView(platformStyle.get());
- auto node = interface::MakeNode();
+ auto node = interfaces::MakeNode();
OptionsModel optionsModel(*node);
- vpwallets.insert(vpwallets.begin(), &wallet);
- WalletModel walletModel(std::move(node->getWallets()[0]), *node, platformStyle.get(), &optionsModel);
- vpwallets.erase(vpwallets.begin());
+ AddWallet(&wallet);
+ WalletModel walletModel(std::move(node->getWallets().back()), *node, platformStyle.get(), &optionsModel);
+ RemoveWallet(&wallet);
sendCoinsDialog.setModel(&walletModel);
transactionView.setModel(&walletModel);
@@ -264,7 +250,7 @@ void TestGUI()
QCOMPARE(requestTableModel->rowCount({}), currentRowCount-1);
}
-}
+} // namespace
void WalletTests::walletTests()
{
diff --git a/src/qt/trafficgraphwidget.cpp b/src/qt/trafficgraphwidget.cpp
index ff378ed1bf..5a3b645f65 100644
--- a/src/qt/trafficgraphwidget.cpp
+++ b/src/qt/trafficgraphwidget.cpp
@@ -2,7 +2,7 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
-#include <interface/node.h>
+#include <interfaces/node.h>
#include <qt/trafficgraphwidget.h>
#include <qt/clientmodel.h>
diff --git a/src/qt/transactiondesc.cpp b/src/qt/transactiondesc.cpp
index 409835592f..2cb446c459 100644
--- a/src/qt/transactiondesc.cpp
+++ b/src/qt/transactiondesc.cpp
@@ -10,7 +10,7 @@
#include <qt/transactionrecord.h>
#include <consensus/consensus.h>
-#include <interface/node.h>
+#include <interfaces/node.h>
#include <key_io.h>
#include <validation.h>
#include <script/script.h>
@@ -23,7 +23,7 @@
#include <stdint.h>
#include <string>
-QString TransactionDesc::FormatTxStatus(const interface::WalletTx& wtx, const interface::WalletTxStatus& status, bool inMempool, int numBlocks, int64_t adjustedTime)
+QString TransactionDesc::FormatTxStatus(const interfaces::WalletTx& wtx, const interfaces::WalletTxStatus& status, bool inMempool, int numBlocks, int64_t adjustedTime)
{
if (!status.is_final)
{
@@ -48,14 +48,14 @@ QString TransactionDesc::FormatTxStatus(const interface::WalletTx& wtx, const in
}
}
-QString TransactionDesc::toHTML(interface::Node& node, interface::Wallet& wallet, TransactionRecord *rec, int unit)
+QString TransactionDesc::toHTML(interfaces::Node& node, interfaces::Wallet& wallet, TransactionRecord *rec, int unit)
{
int numBlocks;
int64_t adjustedTime;
- interface::WalletTxStatus status;
- interface::WalletOrderForm orderForm;
+ interfaces::WalletTxStatus status;
+ interfaces::WalletOrderForm orderForm;
bool inMempool;
- interface::WalletTx wtx = wallet.getWalletTxDetails(rec->hash, status, orderForm, inMempool, numBlocks, adjustedTime);
+ interfaces::WalletTx wtx = wallet.getWalletTxDetails(rec->hash, status, orderForm, inMempool, numBlocks, adjustedTime);
QString strHTML;
@@ -102,7 +102,7 @@ QString TransactionDesc::toHTML(interface::Node& node, interface::Wallet& wallet
if (IsValidDestination(address)) {
std::string name;
isminetype ismine;
- if (wallet.getAddress(address, &name, &ismine))
+ if (wallet.getAddress(address, &name, &ismine, /* purpose= */ nullptr))
{
strHTML += "<b>" + tr("From") + ":</b> " + tr("unknown") + "<br>";
strHTML += "<b>" + tr("To") + ":</b> ";
@@ -128,7 +128,8 @@ QString TransactionDesc::toHTML(interface::Node& node, interface::Wallet& wallet
strHTML += "<b>" + tr("To") + ":</b> ";
CTxDestination dest = DecodeDestination(strAddress);
std::string name;
- if (wallet.getAddress(dest, &name) && !name.empty())
+ if (wallet.getAddress(
+ dest, &name, /* is_mine= */ nullptr, /* purpose= */ nullptr) && !name.empty())
strHTML += GUIUtil::HtmlEscape(name) + " ";
strHTML += GUIUtil::HtmlEscape(strAddress) + "<br>";
}
@@ -196,7 +197,8 @@ QString TransactionDesc::toHTML(interface::Node& node, interface::Wallet& wallet
{
strHTML += "<b>" + tr("To") + ":</b> ";
std::string name;
- if (wallet.getAddress(address, &name) && !name.empty())
+ if (wallet.getAddress(
+ address, &name, /* is_mine= */ nullptr, /* purpose= */ nullptr) && !name.empty())
strHTML += GUIUtil::HtmlEscape(name) + " ";
strHTML += GUIUtil::HtmlEscape(EncodeDestination(address));
if(toSelf == ISMINE_SPENDABLE)
@@ -319,7 +321,7 @@ QString TransactionDesc::toHTML(interface::Node& node, interface::Wallet& wallet
if (ExtractDestination(vout.scriptPubKey, address))
{
std::string name;
- if (wallet.getAddress(address, &name) && !name.empty())
+ if (wallet.getAddress(address, &name, /* is_mine= */ nullptr, /* purpose= */ nullptr) && !name.empty())
strHTML += GUIUtil::HtmlEscape(name) + " ";
strHTML += QString::fromStdString(EncodeDestination(address));
}
diff --git a/src/qt/transactiondesc.h b/src/qt/transactiondesc.h
index ea9ab28ee3..cb8453cb81 100644
--- a/src/qt/transactiondesc.h
+++ b/src/qt/transactiondesc.h
@@ -10,7 +10,7 @@
class TransactionRecord;
-namespace interface {
+namespace interfaces {
class Node;
class Wallet;
struct WalletTx;
@@ -24,12 +24,12 @@ class TransactionDesc: public QObject
Q_OBJECT
public:
- static QString toHTML(interface::Node& node, interface::Wallet& wallet, TransactionRecord *rec, int unit);
+ static QString toHTML(interfaces::Node& node, interfaces::Wallet& wallet, TransactionRecord *rec, int unit);
private:
TransactionDesc() {}
- static QString FormatTxStatus(const interface::WalletTx& wtx, const interface::WalletTxStatus& status, bool inMempool, int numBlocks, int64_t adjustedTime);
+ static QString FormatTxStatus(const interfaces::WalletTx& wtx, const interfaces::WalletTxStatus& status, bool inMempool, int numBlocks, int64_t adjustedTime);
};
#endif // BITCOIN_QT_TRANSACTIONDESC_H
diff --git a/src/qt/transactionrecord.cpp b/src/qt/transactionrecord.cpp
index 60ab2d57d7..b6ed66ad96 100644
--- a/src/qt/transactionrecord.cpp
+++ b/src/qt/transactionrecord.cpp
@@ -5,7 +5,7 @@
#include <qt/transactionrecord.h>
#include <consensus/consensus.h>
-#include <interface/wallet.h>
+#include <interfaces/wallet.h>
#include <key_io.h>
#include <timedata.h>
#include <validation.h>
@@ -25,7 +25,7 @@ bool TransactionRecord::showTransaction()
/*
* Decompose CWallet transaction to model transaction records.
*/
-QList<TransactionRecord> TransactionRecord::decomposeTransaction(const interface::WalletTx& wtx)
+QList<TransactionRecord> TransactionRecord::decomposeTransaction(const interfaces::WalletTx& wtx)
{
QList<TransactionRecord> parts;
int64_t nTime = wtx.time;
@@ -158,7 +158,7 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const interface
return parts;
}
-void TransactionRecord::updateStatus(const interface::WalletTxStatus& wtx, int numBlocks, int64_t adjustedTime)
+void TransactionRecord::updateStatus(const interfaces::WalletTxStatus& wtx, int numBlocks, int64_t adjustedTime)
{
// Determine transaction status
diff --git a/src/qt/transactionrecord.h b/src/qt/transactionrecord.h
index c653584b52..62961434ed 100644
--- a/src/qt/transactionrecord.h
+++ b/src/qt/transactionrecord.h
@@ -11,7 +11,7 @@
#include <QList>
#include <QString>
-namespace interface {
+namespace interfaces {
class Node;
class Wallet;
struct WalletTx;
@@ -111,7 +111,7 @@ public:
/** Decompose CWallet transaction to model transaction records.
*/
static bool showTransaction();
- static QList<TransactionRecord> decomposeTransaction(const interface::WalletTx& wtx);
+ static QList<TransactionRecord> decomposeTransaction(const interfaces::WalletTx& wtx);
/** @name Immutable transaction attributes
@{*/
@@ -140,7 +140,7 @@ public:
/** Update status from core wallet tx.
*/
- void updateStatus(const interface::WalletTxStatus& wtx, int numBlocks, int64_t adjustedTime);
+ void updateStatus(const interfaces::WalletTxStatus& wtx, int numBlocks, int64_t adjustedTime);
/** Return whether a status update is needed.
*/
diff --git a/src/qt/transactiontablemodel.cpp b/src/qt/transactiontablemodel.cpp
index 2148ff1728..46169a91d1 100644
--- a/src/qt/transactiontablemodel.cpp
+++ b/src/qt/transactiontablemodel.cpp
@@ -14,8 +14,8 @@
#include <qt/walletmodel.h>
#include <core_io.h>
-#include <interface/handler.h>
-#include <interface/node.h>
+#include <interfaces/handler.h>
+#include <interfaces/node.h>
#include <validation.h>
#include <sync.h>
#include <uint256.h>
@@ -73,7 +73,7 @@ public:
/* Query entire wallet anew from core.
*/
- void refreshWallet(interface::Wallet& wallet)
+ void refreshWallet(interfaces::Wallet& wallet)
{
qDebug() << "TransactionTablePriv::refreshWallet";
cachedWallet.clear();
@@ -91,7 +91,7 @@ public:
Call with transaction that was added, removed or changed.
*/
- void updateWallet(interface::Wallet& wallet, const uint256 &hash, int status, bool showTransaction)
+ void updateWallet(interfaces::Wallet& wallet, const uint256 &hash, int status, bool showTransaction)
{
qDebug() << "TransactionTablePriv::updateWallet: " + QString::fromStdString(hash.ToString()) + " " + QString::number(status);
@@ -127,7 +127,7 @@ public:
if(showTransaction)
{
// Find transaction in wallet
- interface::WalletTx wtx = wallet.getWalletTx(hash);
+ interfaces::WalletTx wtx = wallet.getWalletTx(hash);
if(!wtx.tx)
{
qWarning() << "TransactionTablePriv::updateWallet: Warning: Got CT_NEW, but transaction is not in wallet";
@@ -176,7 +176,7 @@ public:
return cachedWallet.size();
}
- TransactionRecord *index(interface::Wallet& wallet, int idx)
+ TransactionRecord *index(interfaces::Wallet& wallet, int idx)
{
if(idx >= 0 && idx < cachedWallet.size())
{
@@ -189,7 +189,7 @@ public:
// If a status update is needed (blocks came in since last check),
// update the status of this transaction from the wallet. Otherwise,
// simply re-use the cached status.
- interface::WalletTxStatus wtx;
+ interfaces::WalletTxStatus wtx;
int numBlocks;
int64_t adjustedTime;
if (wallet.tryGetTxStatus(rec->hash, wtx, numBlocks, adjustedTime) && rec->statusUpdateNeeded(numBlocks)) {
@@ -200,12 +200,12 @@ public:
return 0;
}
- QString describe(interface::Node& node, interface::Wallet& wallet, TransactionRecord *rec, int unit)
+ QString describe(interfaces::Node& node, interfaces::Wallet& wallet, TransactionRecord *rec, int unit)
{
return TransactionDesc::toHTML(node, wallet, rec, unit);
}
- QString getTxHex(interface::Wallet& wallet, TransactionRecord *rec)
+ QString getTxHex(interfaces::Wallet& wallet, TransactionRecord *rec)
{
auto tx = wallet.getTx(rec->hash);
if (tx) {
diff --git a/src/qt/transactiontablemodel.h b/src/qt/transactiontablemodel.h
index 57566db638..8b029be5f5 100644
--- a/src/qt/transactiontablemodel.h
+++ b/src/qt/transactiontablemodel.h
@@ -12,7 +12,7 @@
#include <memory>
-namespace interface {
+namespace interfaces {
class Handler;
}
@@ -85,8 +85,8 @@ public:
private:
WalletModel *walletModel;
- std::unique_ptr<interface::Handler> m_handler_transaction_changed;
- std::unique_ptr<interface::Handler> m_handler_show_progress;
+ std::unique_ptr<interfaces::Handler> m_handler_transaction_changed;
+ std::unique_ptr<interfaces::Handler> m_handler_show_progress;
QStringList columns;
TransactionTablePriv *priv;
bool fProcessingQueuedTransactions;
diff --git a/src/qt/utilitydialog.cpp b/src/qt/utilitydialog.cpp
index 6114ea0de1..d5b98486ae 100644
--- a/src/qt/utilitydialog.cpp
+++ b/src/qt/utilitydialog.cpp
@@ -19,7 +19,7 @@
#include <clientversion.h>
#include <init.h>
-#include <interface/node.h>
+#include <interfaces/node.h>
#include <util.h>
#include <stdio.h>
@@ -32,7 +32,7 @@
#include <QVBoxLayout>
/** "Help message" or "About" dialog box */
-HelpMessageDialog::HelpMessageDialog(interface::Node& node, QWidget *parent, bool about) :
+HelpMessageDialog::HelpMessageDialog(interfaces::Node& node, QWidget *parent, bool about) :
QDialog(parent),
ui(new Ui::HelpMessageDialog)
{
diff --git a/src/qt/utilitydialog.h b/src/qt/utilitydialog.h
index e6ad7be5d0..f5c8af4362 100644
--- a/src/qt/utilitydialog.h
+++ b/src/qt/utilitydialog.h
@@ -10,7 +10,7 @@
class BitcoinGUI;
-namespace interface {
+namespace interfaces {
class Node;
}
@@ -24,7 +24,7 @@ class HelpMessageDialog : public QDialog
Q_OBJECT
public:
- explicit HelpMessageDialog(interface::Node& node, QWidget *parent, bool about);
+ explicit HelpMessageDialog(interfaces::Node& node, QWidget *parent, bool about);
~HelpMessageDialog();
void printToConsole();
diff --git a/src/qt/walletmodel.cpp b/src/qt/walletmodel.cpp
index d9db437dc5..3418b1f1a9 100644
--- a/src/qt/walletmodel.cpp
+++ b/src/qt/walletmodel.cpp
@@ -12,8 +12,8 @@
#include <qt/sendcoinsdialog.h>
#include <qt/transactiontablemodel.h>
-#include <interface/handler.h>
-#include <interface/node.h>
+#include <interfaces/handler.h>
+#include <interfaces/node.h>
#include <key_io.h>
#include <ui_interface.h>
#include <util.h> // for GetBoolArg
@@ -28,7 +28,7 @@
#include <QTimer>
-WalletModel::WalletModel(std::unique_ptr<interface::Wallet> wallet, interface::Node& node, const PlatformStyle *platformStyle, OptionsModel *_optionsModel, QObject *parent) :
+WalletModel::WalletModel(std::unique_ptr<interfaces::Wallet> wallet, interfaces::Node& node, const PlatformStyle *platformStyle, OptionsModel *_optionsModel, QObject *parent) :
QObject(parent), m_wallet(std::move(wallet)), m_node(node), optionsModel(_optionsModel), addressTableModel(0),
transactionTableModel(0),
recentRequestsTableModel(0),
@@ -70,7 +70,7 @@ void WalletModel::pollBalanceChanged()
// avoids the GUI from getting stuck on periodical polls if the core is
// holding the locks for a longer time - for example, during a wallet
// rescan.
- interface::WalletBalances new_balances;
+ interfaces::WalletBalances new_balances;
int numBlocks = -1;
if (!m_wallet->tryGetBalances(new_balances, numBlocks)) {
return;
@@ -89,7 +89,7 @@ void WalletModel::pollBalanceChanged()
}
}
-void WalletModel::checkBalanceChanged(const interface::WalletBalances& new_balances)
+void WalletModel::checkBalanceChanged(const interfaces::WalletBalances& new_balances)
{
if(new_balances.balanceChanged(m_cached_balances)) {
m_cached_balances = new_balances;
@@ -274,7 +274,8 @@ WalletModel::SendCoinsReturn WalletModel::sendCoins(WalletModelTransaction &tran
{
// Check if we have a new address or an updated label
std::string name;
- if (!m_wallet->getAddress(dest, &name))
+ if (!m_wallet->getAddress(
+ dest, &name, /* is_mine= */ nullptr, /* purpose= */ nullptr))
{
m_wallet->setAddressBook(dest, strLabel, "send");
}
@@ -486,7 +487,7 @@ bool WalletModel::saveReceiveRequest(const std::string &sAddress, const int64_t
bool WalletModel::bumpFee(uint256 hash)
{
CCoinControl coin_control;
- coin_control.signalRbf = true;
+ coin_control.m_signal_bip125_rbf = true;
std::vector<std::string> errors;
CAmount old_fee;
CAmount new_fee;
diff --git a/src/qt/walletmodel.h b/src/qt/walletmodel.h
index bc409b10ee..9173fcae52 100644
--- a/src/qt/walletmodel.h
+++ b/src/qt/walletmodel.h
@@ -13,7 +13,7 @@
#include <qt/paymentrequestplus.h>
#include <qt/walletmodeltransaction.h>
-#include <interface/wallet.h>
+#include <interfaces/wallet.h>
#include <support/allocators/secure.h>
#include <map>
@@ -37,9 +37,9 @@ class COutput;
class CPubKey;
class uint256;
-namespace interface {
+namespace interfaces {
class Node;
-} // namespace interface
+} // namespace interfaces
QT_BEGIN_NAMESPACE
class QTimer;
@@ -111,7 +111,7 @@ class WalletModel : public QObject
Q_OBJECT
public:
- explicit WalletModel(std::unique_ptr<interface::Wallet> wallet, interface::Node& node, const PlatformStyle *platformStyle, OptionsModel *optionsModel, QObject *parent = 0);
+ explicit WalletModel(std::unique_ptr<interfaces::Wallet> wallet, interfaces::Node& node, const PlatformStyle *platformStyle, OptionsModel *optionsModel, QObject *parent = 0);
~WalletModel();
enum StatusCode // Returned by sendCoins
@@ -198,20 +198,22 @@ public:
static bool isWalletEnabled();
- interface::Node& node() const { return m_node; }
- interface::Wallet& wallet() const { return *m_wallet; }
+ interfaces::Node& node() const { return m_node; }
+ interfaces::Wallet& wallet() const { return *m_wallet; }
QString getWalletName() const;
bool isMultiwallet();
+
+ AddressTableModel* getAddressTableModel() const { return addressTableModel; }
private:
- std::unique_ptr<interface::Wallet> m_wallet;
- std::unique_ptr<interface::Handler> m_handler_status_changed;
- std::unique_ptr<interface::Handler> m_handler_address_book_changed;
- std::unique_ptr<interface::Handler> m_handler_transaction_changed;
- std::unique_ptr<interface::Handler> m_handler_show_progress;
- std::unique_ptr<interface::Handler> m_handler_watch_only_changed;
- interface::Node& m_node;
+ std::unique_ptr<interfaces::Wallet> m_wallet;
+ std::unique_ptr<interfaces::Handler> m_handler_status_changed;
+ std::unique_ptr<interfaces::Handler> m_handler_address_book_changed;
+ std::unique_ptr<interfaces::Handler> m_handler_transaction_changed;
+ std::unique_ptr<interfaces::Handler> m_handler_show_progress;
+ std::unique_ptr<interfaces::Handler> m_handler_watch_only_changed;
+ interfaces::Node& m_node;
bool fHaveWatchOnly;
bool fForceCheckBalanceChanged;
@@ -225,7 +227,7 @@ private:
RecentRequestsTableModel *recentRequestsTableModel;
// Cache some values to be able to detect changes
- interface::WalletBalances m_cached_balances;
+ interfaces::WalletBalances m_cached_balances;
EncryptionStatus cachedEncryptionStatus;
int cachedNumBlocks;
@@ -233,11 +235,11 @@ private:
void subscribeToCoreSignals();
void unsubscribeFromCoreSignals();
- void checkBalanceChanged(const interface::WalletBalances& new_balances);
+ void checkBalanceChanged(const interfaces::WalletBalances& new_balances);
Q_SIGNALS:
// Signal that balance in wallet changed
- void balanceChanged(const interface::WalletBalances& balances);
+ void balanceChanged(const interfaces::WalletBalances& balances);
// Encryption status of wallet changed
void encryptionStatusChanged();
diff --git a/src/qt/walletmodeltransaction.cpp b/src/qt/walletmodeltransaction.cpp
index 21bdfe3818..d5187d6634 100644
--- a/src/qt/walletmodeltransaction.cpp
+++ b/src/qt/walletmodeltransaction.cpp
@@ -4,7 +4,7 @@
#include <qt/walletmodeltransaction.h>
-#include <interface/node.h>
+#include <interfaces/node.h>
#include <policy/policy.h>
WalletModelTransaction::WalletModelTransaction(const QList<SendCoinsRecipient> &_recipients) :
@@ -18,7 +18,7 @@ QList<SendCoinsRecipient> WalletModelTransaction::getRecipients() const
return recipients;
}
-std::unique_ptr<interface::PendingWalletTx>& WalletModelTransaction::getWtx()
+std::unique_ptr<interfaces::PendingWalletTx>& WalletModelTransaction::getWtx()
{
return wtx;
}
diff --git a/src/qt/walletmodeltransaction.h b/src/qt/walletmodeltransaction.h
index 32fd0d2110..9f91326109 100644
--- a/src/qt/walletmodeltransaction.h
+++ b/src/qt/walletmodeltransaction.h
@@ -13,7 +13,7 @@
class SendCoinsRecipient;
-namespace interface {
+namespace interfaces {
class Node;
class PendingWalletTx;
}
@@ -26,7 +26,7 @@ public:
QList<SendCoinsRecipient> getRecipients() const;
- std::unique_ptr<interface::PendingWalletTx>& getWtx();
+ std::unique_ptr<interfaces::PendingWalletTx>& getWtx();
unsigned int getTransactionSize();
void setTransactionFee(const CAmount& newFee);
@@ -38,7 +38,7 @@ public:
private:
QList<SendCoinsRecipient> recipients;
- std::unique_ptr<interface::PendingWalletTx> wtx;
+ std::unique_ptr<interfaces::PendingWalletTx> wtx;
CAmount fee;
};
diff --git a/src/qt/walletview.cpp b/src/qt/walletview.cpp
index 1505557244..d529595dec 100644
--- a/src/qt/walletview.cpp
+++ b/src/qt/walletview.cpp
@@ -19,7 +19,7 @@
#include <qt/transactionview.h>
#include <qt/walletmodel.h>
-#include <interface/node.h>
+#include <interfaces/node.h>
#include <ui_interface.h>
#include <QAction>
@@ -315,9 +315,9 @@ void WalletView::showProgress(const QString &title, int nProgress)
progressDialog = new QProgressDialog(title, "", 0, 100);
progressDialog->setWindowModality(Qt::ApplicationModal);
progressDialog->setMinimumDuration(0);
- progressDialog->setCancelButton(0);
progressDialog->setAutoClose(false);
progressDialog->setValue(0);
+ progressDialog->setCancelButtonText(tr("Cancel"));
}
else if (nProgress == 100)
{
@@ -327,8 +327,13 @@ void WalletView::showProgress(const QString &title, int nProgress)
progressDialog->deleteLater();
}
}
- else if (progressDialog)
- progressDialog->setValue(nProgress);
+ else if (progressDialog) {
+ if (progressDialog->wasCanceled()) {
+ getWalletModel()->wallet().abortRescan();
+ } else {
+ progressDialog->setValue(nProgress);
+ }
+ }
}
void WalletView::requestedSyncWarningInfo()