Skip to content

Commit c2f672f

Browse files
ryanofskyjnewbery
authored andcommitted
Remove direct bitcoin calls from qt/utilitydialog.cpp
1 parent 3d619e9 commit c2f672f

File tree

6 files changed

+16
-6
lines changed

6 files changed

+16
-6
lines changed

src/interface/node.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ class NodeImpl : public Node
5555
StopMapPort();
5656
}
5757
}
58+
std::string helpMessage(HelpMessageMode mode) override { return HelpMessage(mode); }
5859
bool getProxy(Network net, proxyType& proxy_info) override { return GetProxy(net, proxy_info); }
5960
std::unique_ptr<Handler> handleInitMessage(InitMessageFn fn) override
6061
{

src/interface/node.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#ifndef BITCOIN_INTERFACE_NODE_H
66
#define BITCOIN_INTERFACE_NODE_H
77

8+
#include <init.h> // For HelpMessageMode
89
#include <netaddress.h> // For Network
910

1011
#include <functional>
@@ -62,6 +63,9 @@ class Node
6263
//! Return whether shutdown was requested.
6364
virtual bool shutdownRequested() = 0;
6465

66+
//! Get help message string.
67+
virtual std::string helpMessage(HelpMessageMode mode) = 0;
68+
6569
//! Map port.
6670
virtual void mapPort(bool use_upnp) = 0;
6771

src/qt/bitcoin.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ int main(int argc, char *argv[])
595595
// Show help message immediately after parsing command-line options (for "-lang") and setting locale,
596596
// but before showing splash screen.
597597
if (HelpRequested(gArgs) || gArgs.IsArgSet("-version")) {
598-
HelpMessageDialog help(nullptr, gArgs.IsArgSet("-version"));
598+
HelpMessageDialog help(*node, nullptr, gArgs.IsArgSet("-version"));
599599
help.showOrPrint();
600600
return EXIT_SUCCESS;
601601
}

src/qt/bitcoingui.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ BitcoinGUI::BitcoinGUI(interface::Node& node, const PlatformStyle *_platformStyl
153153
#endif
154154

155155
rpcConsole = new RPCConsole(_platformStyle, 0);
156-
helpMessageDialog = new HelpMessageDialog(this, false);
156+
helpMessageDialog = new HelpMessageDialog(node, this, false);
157157
#ifdef ENABLE_WALLET
158158
if(enableWallet)
159159
{
@@ -668,7 +668,7 @@ void BitcoinGUI::aboutClicked()
668668
if(!clientModel)
669669
return;
670670

671-
HelpMessageDialog dlg(this, true);
671+
HelpMessageDialog dlg(m_node, this, true);
672672
dlg.exec();
673673
}
674674

src/qt/utilitydialog.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
#include <clientversion.h>
2121
#include <init.h>
22+
#include <interface/node.h>
2223
#include <util.h>
2324

2425
#include <stdio.h>
@@ -31,7 +32,7 @@
3132
#include <QVBoxLayout>
3233

3334
/** "Help message" or "About" dialog box */
34-
HelpMessageDialog::HelpMessageDialog(QWidget *parent, bool about) :
35+
HelpMessageDialog::HelpMessageDialog(interface::Node& node, QWidget *parent, bool about) :
3536
QDialog(parent),
3637
ui(new Ui::HelpMessageDialog)
3738
{
@@ -77,7 +78,7 @@ HelpMessageDialog::HelpMessageDialog(QWidget *parent, bool about) :
7778
cursor.insertText(header);
7879
cursor.insertBlock();
7980

80-
std::string strUsage = HelpMessage(HelpMessageMode::BITCOIN_QT);
81+
std::string strUsage = node.helpMessage(HelpMessageMode::BITCOIN_QT);
8182
const bool showDebug = gArgs.GetBoolArg("-help-debug", false);
8283
strUsage += HelpMessageGroup(tr("UI Options:").toStdString());
8384
if (showDebug) {

src/qt/utilitydialog.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010

1111
class BitcoinGUI;
1212

13+
namespace interface {
14+
class Node;
15+
}
16+
1317
namespace Ui {
1418
class HelpMessageDialog;
1519
}
@@ -20,7 +24,7 @@ class HelpMessageDialog : public QDialog
2024
Q_OBJECT
2125

2226
public:
23-
explicit HelpMessageDialog(QWidget *parent, bool about);
27+
explicit HelpMessageDialog(interface::Node& node, QWidget *parent, bool about);
2428
~HelpMessageDialog();
2529

2630
void printToConsole();

0 commit comments

Comments
 (0)