diff options
author | Russell Yanofsky <russ@yanofsky.org> | 2017-04-17 14:40:41 -0400 |
---|---|---|
committer | John Newbery <john@johnnewbery.com> | 2018-04-04 16:52:40 -0400 |
commit | c2f672fb1960399389dea9cdd8f76d7156c2c88b (patch) | |
tree | df6d5a27cc5cbc4281614991c138b33921e6fe1b /src | |
parent | 3d619e9d3658e36cba4a19a5bed33e5538317b27 (diff) |
Remove direct bitcoin calls from qt/utilitydialog.cpp
Diffstat (limited to 'src')
-rw-r--r-- | src/interface/node.cpp | 1 | ||||
-rw-r--r-- | src/interface/node.h | 4 | ||||
-rw-r--r-- | src/qt/bitcoin.cpp | 2 | ||||
-rw-r--r-- | src/qt/bitcoingui.cpp | 4 | ||||
-rw-r--r-- | src/qt/utilitydialog.cpp | 5 | ||||
-rw-r--r-- | src/qt/utilitydialog.h | 6 |
6 files changed, 16 insertions, 6 deletions
diff --git a/src/interface/node.cpp b/src/interface/node.cpp index 7bfe79ed50..43bdfbaebc 100644 --- a/src/interface/node.cpp +++ b/src/interface/node.cpp @@ -55,6 +55,7 @@ class NodeImpl : public Node StopMapPort(); } } + std::string helpMessage(HelpMessageMode mode) override { return HelpMessage(mode); } bool getProxy(Network net, proxyType& proxy_info) override { return GetProxy(net, proxy_info); } std::unique_ptr<Handler> handleInitMessage(InitMessageFn fn) override { diff --git a/src/interface/node.h b/src/interface/node.h index 00304cce24..60ef9cce1b 100644 --- a/src/interface/node.h +++ b/src/interface/node.h @@ -5,6 +5,7 @@ #ifndef BITCOIN_INTERFACE_NODE_H #define BITCOIN_INTERFACE_NODE_H +#include <init.h> // For HelpMessageMode #include <netaddress.h> // For Network #include <functional> @@ -62,6 +63,9 @@ public: //! Return whether shutdown was requested. virtual bool shutdownRequested() = 0; + //! Get help message string. + virtual std::string helpMessage(HelpMessageMode mode) = 0; + //! Map port. virtual void mapPort(bool use_upnp) = 0; diff --git a/src/qt/bitcoin.cpp b/src/qt/bitcoin.cpp index aad276fd1d..8ccdaff651 100644 --- a/src/qt/bitcoin.cpp +++ b/src/qt/bitcoin.cpp @@ -595,7 +595,7 @@ int main(int argc, char *argv[]) // Show help message immediately after parsing command-line options (for "-lang") and setting locale, // but before showing splash screen. if (HelpRequested(gArgs) || gArgs.IsArgSet("-version")) { - HelpMessageDialog help(nullptr, gArgs.IsArgSet("-version")); + HelpMessageDialog help(*node, nullptr, gArgs.IsArgSet("-version")); help.showOrPrint(); return EXIT_SUCCESS; } diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 5e590ec7d2..b07ff230fd 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -153,7 +153,7 @@ BitcoinGUI::BitcoinGUI(interface::Node& node, const PlatformStyle *_platformStyl #endif rpcConsole = new RPCConsole(_platformStyle, 0); - helpMessageDialog = new HelpMessageDialog(this, false); + helpMessageDialog = new HelpMessageDialog(node, this, false); #ifdef ENABLE_WALLET if(enableWallet) { @@ -668,7 +668,7 @@ void BitcoinGUI::aboutClicked() if(!clientModel) return; - HelpMessageDialog dlg(this, true); + HelpMessageDialog dlg(m_node, this, true); dlg.exec(); } diff --git a/src/qt/utilitydialog.cpp b/src/qt/utilitydialog.cpp index c19e6aae78..6114ea0de1 100644 --- a/src/qt/utilitydialog.cpp +++ b/src/qt/utilitydialog.cpp @@ -19,6 +19,7 @@ #include <clientversion.h> #include <init.h> +#include <interface/node.h> #include <util.h> #include <stdio.h> @@ -31,7 +32,7 @@ #include <QVBoxLayout> /** "Help message" or "About" dialog box */ -HelpMessageDialog::HelpMessageDialog(QWidget *parent, bool about) : +HelpMessageDialog::HelpMessageDialog(interface::Node& node, QWidget *parent, bool about) : QDialog(parent), ui(new Ui::HelpMessageDialog) { @@ -77,7 +78,7 @@ HelpMessageDialog::HelpMessageDialog(QWidget *parent, bool about) : cursor.insertText(header); cursor.insertBlock(); - std::string strUsage = HelpMessage(HelpMessageMode::BITCOIN_QT); + std::string strUsage = node.helpMessage(HelpMessageMode::BITCOIN_QT); const bool showDebug = gArgs.GetBoolArg("-help-debug", false); strUsage += HelpMessageGroup(tr("UI Options:").toStdString()); if (showDebug) { diff --git a/src/qt/utilitydialog.h b/src/qt/utilitydialog.h index d43d9a82c0..e6ad7be5d0 100644 --- a/src/qt/utilitydialog.h +++ b/src/qt/utilitydialog.h @@ -10,6 +10,10 @@ class BitcoinGUI; +namespace interface { + class Node; +} + namespace Ui { class HelpMessageDialog; } @@ -20,7 +24,7 @@ class HelpMessageDialog : public QDialog Q_OBJECT public: - explicit HelpMessageDialog(QWidget *parent, bool about); + explicit HelpMessageDialog(interface::Node& node, QWidget *parent, bool about); ~HelpMessageDialog(); void printToConsole(); |