Skip to content

Commit b877c39

Browse files
author
MarcoFalke
committed
Merge #13528: qt: Move BitcoinGUI initializers to class, fix initializer order warning
bb3de15 qt: Move BitcoinGUI initializers to class, fix initializer order warning (Wladimir J. van der Laan) Pull request description: - C++11-ize the code (move initializers to class, change `0` to `nullptr` where appropriate) - Make sure `m_wallet_selector` is initialized - And fix the following warning: bitcoin/src/qt/bitcoingui.cpp:122:5: warning: field 'spinnerFrame' will be initialized after field 'm_wallet_selector_label' [-Wreorder] spinnerFrame(0), Tree-SHA512: b81c8d4ac31b712c8dfaf941ba43b235eb466eb5528535d69d68c26d8706d2a658581513a413050e5dee08b72a4e7fc08bd8936ef5beb052059d2467eaeff84b
2 parents b1dc39d + bb3de15 commit b877c39

File tree

2 files changed

+48
-92
lines changed

2 files changed

+48
-92
lines changed

src/qt/bitcoingui.cpp

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -70,51 +70,7 @@ const std::string BitcoinGUI::DEFAULT_UIPLATFORM =
7070

7171
BitcoinGUI::BitcoinGUI(interfaces::Node& node, const PlatformStyle *_platformStyle, const NetworkStyle *networkStyle, QWidget *parent) :
7272
QMainWindow(parent),
73-
enableWallet(false),
7473
m_node(node),
75-
clientModel(0),
76-
walletFrame(0),
77-
unitDisplayControl(0),
78-
labelWalletEncryptionIcon(0),
79-
labelWalletHDStatusIcon(0),
80-
labelProxyIcon(0),
81-
connectionsControl(0),
82-
labelBlocksIcon(0),
83-
progressBarLabel(0),
84-
progressBar(0),
85-
progressDialog(0),
86-
appMenuBar(0),
87-
appToolBar(0),
88-
overviewAction(0),
89-
historyAction(0),
90-
quitAction(0),
91-
sendCoinsAction(0),
92-
sendCoinsMenuAction(0),
93-
usedSendingAddressesAction(0),
94-
usedReceivingAddressesAction(0),
95-
signMessageAction(0),
96-
verifyMessageAction(0),
97-
aboutAction(0),
98-
receiveCoinsAction(0),
99-
receiveCoinsMenuAction(0),
100-
optionsAction(0),
101-
toggleHideAction(0),
102-
encryptWalletAction(0),
103-
backupWalletAction(0),
104-
changePassphraseAction(0),
105-
aboutQtAction(0),
106-
openRPCConsoleAction(0),
107-
openAction(0),
108-
showHelpMessageAction(0),
109-
trayIcon(0),
110-
trayIconMenu(0),
111-
notificator(0),
112-
rpcConsole(0),
113-
helpMessageDialog(0),
114-
modalOverlay(0),
115-
prevBlocks(0),
116-
spinnerFrame(0),
117-
m_wallet_selector_label(nullptr),
11874
platformStyle(_platformStyle)
11975
{
12076
QSettings settings;

src/qt/bitcoingui.h

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class BitcoinGUI : public QMainWindow
7373
bool removeWallet(WalletModel* walletModel);
7474
void removeAllWallets();
7575
#endif // ENABLE_WALLET
76-
bool enableWallet;
76+
bool enableWallet = false;
7777

7878
protected:
7979
void changeEvent(QEvent *e);
@@ -87,58 +87,58 @@ class BitcoinGUI : public QMainWindow
8787
interfaces::Node& m_node;
8888
std::unique_ptr<interfaces::Handler> m_handler_message_box;
8989
std::unique_ptr<interfaces::Handler> m_handler_question;
90-
ClientModel *clientModel;
91-
WalletFrame *walletFrame;
92-
93-
UnitDisplayStatusBarControl *unitDisplayControl;
94-
QLabel *labelWalletEncryptionIcon;
95-
QLabel *labelWalletHDStatusIcon;
96-
QLabel *labelProxyIcon;
97-
QLabel *connectionsControl;
98-
QLabel *labelBlocksIcon;
99-
QLabel *progressBarLabel;
100-
QProgressBar *progressBar;
101-
QProgressDialog *progressDialog;
102-
103-
QMenuBar *appMenuBar;
104-
QToolBar *appToolBar;
105-
QAction *overviewAction;
106-
QAction *historyAction;
107-
QAction *quitAction;
108-
QAction *sendCoinsAction;
109-
QAction *sendCoinsMenuAction;
110-
QAction *usedSendingAddressesAction;
111-
QAction *usedReceivingAddressesAction;
112-
QAction *signMessageAction;
113-
QAction *verifyMessageAction;
114-
QAction *aboutAction;
115-
QAction *receiveCoinsAction;
116-
QAction *receiveCoinsMenuAction;
117-
QAction *optionsAction;
118-
QAction *toggleHideAction;
119-
QAction *encryptWalletAction;
120-
QAction *backupWalletAction;
121-
QAction *changePassphraseAction;
122-
QAction *aboutQtAction;
123-
QAction *openRPCConsoleAction;
124-
QAction *openAction;
125-
QAction *showHelpMessageAction;
126-
QAction *m_wallet_selector_label_action = nullptr;
127-
QAction *m_wallet_selector_action = nullptr;
90+
ClientModel* clientModel = nullptr;
91+
WalletFrame* walletFrame = nullptr;
92+
93+
UnitDisplayStatusBarControl* unitDisplayControl = nullptr;
94+
QLabel* labelWalletEncryptionIcon = nullptr;
95+
QLabel* labelWalletHDStatusIcon = nullptr;
96+
QLabel* labelProxyIcon = nullptr;
97+
QLabel* connectionsControl = nullptr;
98+
QLabel* labelBlocksIcon = nullptr;
99+
QLabel* progressBarLabel = nullptr;
100+
QProgressBar* progressBar = nullptr;
101+
QProgressDialog* progressDialog = nullptr;
102+
103+
QMenuBar* appMenuBar = nullptr;
104+
QToolBar* appToolBar = nullptr;
105+
QAction* overviewAction = nullptr;
106+
QAction* historyAction = nullptr;
107+
QAction* quitAction = nullptr;
108+
QAction* sendCoinsAction = nullptr;
109+
QAction* sendCoinsMenuAction = nullptr;
110+
QAction* usedSendingAddressesAction = nullptr;
111+
QAction* usedReceivingAddressesAction = nullptr;
112+
QAction* signMessageAction = nullptr;
113+
QAction* verifyMessageAction = nullptr;
114+
QAction* aboutAction = nullptr;
115+
QAction* receiveCoinsAction = nullptr;
116+
QAction* receiveCoinsMenuAction = nullptr;
117+
QAction* optionsAction = nullptr;
118+
QAction* toggleHideAction = nullptr;
119+
QAction* encryptWalletAction = nullptr;
120+
QAction* backupWalletAction = nullptr;
121+
QAction* changePassphraseAction = nullptr;
122+
QAction* aboutQtAction = nullptr;
123+
QAction* openRPCConsoleAction = nullptr;
124+
QAction* openAction = nullptr;
125+
QAction* showHelpMessageAction = nullptr;
126+
QAction* m_wallet_selector_label_action = nullptr;
127+
QAction* m_wallet_selector_action = nullptr;
128128

129129
QLabel *m_wallet_selector_label = nullptr;
130-
QComboBox *m_wallet_selector;
130+
QComboBox* m_wallet_selector = nullptr;
131131

132-
QSystemTrayIcon *trayIcon;
133-
QMenu *trayIconMenu;
134-
Notificator *notificator;
135-
RPCConsole *rpcConsole;
136-
HelpMessageDialog *helpMessageDialog;
137-
ModalOverlay *modalOverlay;
132+
QSystemTrayIcon* trayIcon = nullptr;
133+
QMenu* trayIconMenu = nullptr;
134+
Notificator* notificator = nullptr;
135+
RPCConsole* rpcConsole = nullptr;
136+
HelpMessageDialog* helpMessageDialog = nullptr;
137+
ModalOverlay* modalOverlay = nullptr;
138138

139139
/** Keep track of previous number of blocks, to detect progress */
140-
int prevBlocks;
141-
int spinnerFrame;
140+
int prevBlocks = 0;
141+
int spinnerFrame = 0;
142142

143143
const PlatformStyle *platformStyle;
144144

0 commit comments

Comments
 (0)