diff options
author | fanquake <fanquake@gmail.com> | 2019-07-04 08:40:12 +0800 |
---|---|---|
committer | fanquake <fanquake@gmail.com> | 2019-07-04 10:18:47 +0800 |
commit | 629c7b029cf934932be3699da592cfbe6e146f8a (patch) | |
tree | e371534349ca64f0791a8854232136980674bb16 /src/qt | |
parent | 9c29bc71dc40de4e6ff94c272d63449a7a87ba0a (diff) | |
parent | bcb27d7b03d1e7a4404c04859f8146d8bc7c360a (diff) | |
download | bitcoin-629c7b029cf934932be3699da592cfbe6e146f8a.tar.xz |
Merge #16035: 0.18.1: Backports
bcb27d7b0 .python-version: Bump to 3.5.6 (MarcoFalke)
af25a757e Add comments to Python ECDSA implementation (John Newbery)
715da91e9 Set AA_EnableHighDpiScaling attribute early (Hennadii Stepanov)
2800b3d5c gui: Fix open wallet menu initialization order (João Barbosa)
e78007fc1 Make and get the multisig redeemscript and destination in one function instead of two (Andrew Chow)
d9fc969e7 Pure python EC (Pieter Wuille)
23ba460c1 test: Add test that addmultisigaddress fails for watchonly addresses (MarcoFalke)
13b3bb564 test: Fixup creatmultisig documentation and whitespace (MarcoFalke)
79745d175 Replace remaining fprintf with tfm::format manually (MarcoFalke)
beb09f09b scripted-diff: Replace fprintf with tfm::format (MarcoFalke)
e29aa6e72 Exceptions should be caught by reference, not by value. (Kristaps Kaupe)
f88959ba7 tinyformat: Add doc to Bitcoin Core specific strprintf (MarcoFalke)
0023c9789 rpc: bugfix: Properly use iswitness in converttopsbt (MarcoFalke)
832eb4ff5 Bugfix: test/functional/rpc_psbt: Correct test description comment (Luke Dashjr)
966d8d084 Bugfix: test/functional/rpc_psbt: Remove check for specific error message that depends on uncertain assumptions (Luke Dashjr)
bb36ac82e rpc: Switch touched RPCs to IsValidNumArgs (MarcoFalke)
d24d0ec05 Add example 2nd arg to signrawtransactionwithkey (Chris Moore)
592016ba1 fixup: Fix prunning test (João Barbosa)
c80a498ae Fix RPC/pruneblockchain returned prune height (Jonas Schnelli)
b2398240f gui: Enable open wallet menu on setWalletController (João Barbosa)
d1f261150 Add test for GCC bug 90348 (Pieter Wuille)
d80c558e0 gui: Set progressDialog to nullptr (João Barbosa)
7ed1a6019 gui: Enable console line edit on setClientModel (João Barbosa)
b55cbe82d qt: fix opening bitcoin.conf via Preferences on macOS; see #15409 (shannon1916)
b6c1f9478 Disallow extended encoding for non-witness transactions (take 3) (MarcoFalke)
86031083c Add test for superfluous witness record in deserialization (Gregory Sanders)
5a58ddb6d Fix missing input template by making minimal tx (Gregory Sanders)
206f5ee87 Disallow extended encoding for non-witness transactions (Pieter Wuille)
3dbc7def0 Show loaded wallets as disabled in open menu instead of nothing (MeshCollider)
a635377b6 Install bitcoin-wallet manpage. (Daniel Kraft)
eb85ee62b Doc: remove text about txes always relayed from -whitelist (David A. Harding)
890a92eba doc: Mention blocksonly in reduce-traffic.md, unhide option (MarcoFalke)
3460555f4 test: Add test for p2p_blocksonly (MarcoFalke)
8f215c7a2 test: Format predicate source as multiline on error (MarcoFalke)
9c1a607a0 net: Rename ::fRelayTxes to ::g_relay_txes (MarcoFalke)
5935f0126 build with -fstack-reuse=none (MarcoFalke)
Pull request description:
Tree-SHA512: 5cd73a4319cb69c92b528239cf97c0ed5fcf2b9e8c7fe154e4679eeec95db433a0223d8dc574e4cdc96c1913cfdf160b10c42dcdbcb5bbc8fb743c07930ef9da
Diffstat (limited to 'src/qt')
-rw-r--r-- | src/qt/bitcoin.cpp | 5 | ||||
-rw-r--r-- | src/qt/bitcoingui.cpp | 28 | ||||
-rw-r--r-- | src/qt/bitcoingui.h | 1 | ||||
-rw-r--r-- | src/qt/forms/debugwindow.ui | 3 | ||||
-rw-r--r-- | src/qt/guiutil.cpp | 11 | ||||
-rw-r--r-- | src/qt/rpcconsole.cpp | 3 | ||||
-rw-r--r-- | src/qt/utilitydialog.cpp | 2 | ||||
-rw-r--r-- | src/qt/walletview.cpp | 1 |
8 files changed, 45 insertions, 9 deletions
diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp index 1b063771ef..d2ac18f5a7 100644 --- a/src/qt/bitcoin.cpp +++ b/src/qt/bitcoin.cpp @@ -437,16 +437,17 @@ int GuiMain(int argc, char* argv[]) Q_INIT_RESOURCE(bitcoin); Q_INIT_RESOURCE(bitcoin_locale); - BitcoinApplication app(*node, argc, argv); // Generate high-dpi pixmaps QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); #if QT_VERSION >= 0x050600 - QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling); + QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); #endif #ifdef Q_OS_MAC QApplication::setAttribute(Qt::AA_DontShowIconsInMenus); #endif + BitcoinApplication app(*node, argc, argv); + // Register meta types used for QMetaObject::invokeMethod qRegisterMetaType< bool* >(); // Need to pass name here as CAmount is a typedef (see http://qt-project.org/doc/qt-5/qmetatype.html#qRegisterMetaType) diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index abf9136eee..8388e8d36e 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -335,8 +335,9 @@ void BitcoinGUI::createActions() openAction->setStatusTip(tr("Open a bitcoin: URI or payment request")); m_open_wallet_action = new QAction(tr("Open Wallet"), this); - m_open_wallet_action->setMenu(new QMenu(this)); + m_open_wallet_action->setEnabled(false); m_open_wallet_action->setStatusTip(tr("Open a wallet")); + m_open_wallet_menu = new QMenu(this); m_close_wallet_action = new QAction(tr("Close Wallet..."), this); m_close_wallet_action->setStatusTip(tr("Close wallet")); @@ -368,11 +369,20 @@ void BitcoinGUI::createActions() connect(usedSendingAddressesAction, &QAction::triggered, walletFrame, &WalletFrame::usedSendingAddresses); connect(usedReceivingAddressesAction, &QAction::triggered, walletFrame, &WalletFrame::usedReceivingAddresses); connect(openAction, &QAction::triggered, this, &BitcoinGUI::openClicked); - connect(m_open_wallet_action->menu(), &QMenu::aboutToShow, [this] { - m_open_wallet_action->menu()->clear(); - for (std::string path : m_wallet_controller->getWalletsAvailableToOpen()) { + 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) { QString name = path.empty() ? QString("["+tr("default wallet")+"]") : QString::fromStdString(path); - QAction* action = m_open_wallet_action->menu()->addAction(name); + QAction* action = m_open_wallet_menu->addAction(name); + + if (std::find(available_wallets.begin(), available_wallets.end(), path) == available_wallets.end()) { + // This wallet is already loaded + action->setEnabled(false); + continue; + } + connect(action, &QAction::triggered, [this, name, path] { OpenWalletActivity* activity = m_wallet_controller->openWallet(path); @@ -400,6 +410,10 @@ void BitcoinGUI::createActions() assert(invoked); }); } + if (wallets.empty()) { + QAction* action = m_open_wallet_menu->addAction(tr("No wallets available")); + action->setEnabled(false); + } }); connect(m_close_wallet_action, &QAction::triggered, [this] { m_wallet_controller->closeWallet(walletFrame->currentWalletModel(), this); @@ -620,6 +634,9 @@ void BitcoinGUI::setWalletController(WalletController* wallet_controller) m_wallet_controller = wallet_controller; + m_open_wallet_action->setEnabled(true); + m_open_wallet_action->setMenu(m_open_wallet_menu); + connect(wallet_controller, &WalletController::walletAdded, this, &BitcoinGUI::addWallet); connect(wallet_controller, &WalletController::walletRemoved, this, &BitcoinGUI::removeWallet); @@ -1328,6 +1345,7 @@ void BitcoinGUI::showProgress(const QString &title, int nProgress) if (progressDialog) { progressDialog->close(); progressDialog->deleteLater(); + progressDialog = nullptr; } } else if (progressDialog) { progressDialog->setValue(nProgress); diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h index b58ccbb455..608f10750a 100644 --- a/src/qt/bitcoingui.h +++ b/src/qt/bitcoingui.h @@ -148,6 +148,7 @@ private: QAction* openAction = nullptr; QAction* showHelpMessageAction = nullptr; QAction* m_open_wallet_action{nullptr}; + QMenu* m_open_wallet_menu{nullptr}; QAction* m_close_wallet_action{nullptr}; QAction* m_wallet_selector_label_action = nullptr; QAction* m_wallet_selector_action = nullptr; diff --git a/src/qt/forms/debugwindow.ui b/src/qt/forms/debugwindow.ui index f0b976001e..70ad32752a 100644 --- a/src/qt/forms/debugwindow.ui +++ b/src/qt/forms/debugwindow.ui @@ -636,6 +636,9 @@ <property name="placeholderText"> <string/> </property> + <property name="enabled"> + <bool>false</bool> + </property> </widget> </item> </layout> diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index ba0a5abdf3..f6dba1006b 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -60,6 +60,7 @@ #include <objc/objc-runtime.h> #include <CoreServices/CoreServices.h> +#include <QProcess> #endif namespace GUIUtil { @@ -392,7 +393,15 @@ bool openBitcoinConf() configFile.close(); /* Open bitcoin.conf with the associated application */ - return QDesktopServices::openUrl(QUrl::fromLocalFile(boostPathToQString(pathConfig))); + bool res = QDesktopServices::openUrl(QUrl::fromLocalFile(boostPathToQString(pathConfig))); +#ifdef Q_OS_MAC + // Workaround for macOS-specific behavior; see #15409. + if (!res) { + res = QProcess::startDetached("/usr/bin/open", QStringList{"-t", boostPathToQString(pathConfig)}); + } +#endif + + return res; } ToolTipToRichTextFilter::ToolTipToRichTextFilter(int _size_threshold, QObject *parent) : diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index fc1e14b031..786e36e617 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -680,6 +680,9 @@ void RPCConsole::setClientModel(ClientModel *model) wordList.sort(); autoCompleter = new QCompleter(wordList, this); autoCompleter->setModelSorting(QCompleter::CaseSensitivelySortedModel); + // ui->lineEdit is initially disabled because running commands is only + // possible from now on. + ui->lineEdit->setEnabled(true); ui->lineEdit->setCompleter(autoCompleter); autoCompleter->popup()->installEventFilter(this); // Start thread to execute RPC commands. diff --git a/src/qt/utilitydialog.cpp b/src/qt/utilitydialog.cpp index b051dd159b..2a13c46013 100644 --- a/src/qt/utilitydialog.cpp +++ b/src/qt/utilitydialog.cpp @@ -129,7 +129,7 @@ HelpMessageDialog::~HelpMessageDialog() void HelpMessageDialog::printToConsole() { // On other operating systems, the expected action is to print the message to the console. - fprintf(stdout, "%s\n", qPrintable(text)); + tfm::format(std::cout, "%s\n", qPrintable(text)); } void HelpMessageDialog::showOrPrint() diff --git a/src/qt/walletview.cpp b/src/qt/walletview.cpp index 5f6f93d948..be47f67f95 100644 --- a/src/qt/walletview.cpp +++ b/src/qt/walletview.cpp @@ -316,6 +316,7 @@ void WalletView::showProgress(const QString &title, int nProgress) if (progressDialog) { progressDialog->close(); progressDialog->deleteLater(); + progressDialog = nullptr; } } else if (progressDialog) { if (progressDialog->wasCanceled()) { |