Skip to content

Commit bb3de15

Browse files
committed
qt: Move BitcoinGUI initializers to class, fix initializer order warning
- 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),
1 parent 3a45493 commit bb3de15

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
@@ -76,51 +76,7 @@ const std::string BitcoinGUI::DEFAULT_UIPLATFORM =
7676

7777
BitcoinGUI::BitcoinGUI(interfaces::Node& node, const PlatformStyle *_platformStyle, const NetworkStyle *networkStyle, QWidget *parent) :
7878
QMainWindow(parent),
79-
enableWallet(false),
8079
m_node(node),
81-
clientModel(0),
82-
walletFrame(0),
83-
unitDisplayControl(0),
84-
labelWalletEncryptionIcon(0),
85-
labelWalletHDStatusIcon(0),
86-
labelProxyIcon(0),
87-
connectionsControl(0),
88-
labelBlocksIcon(0),
89-
progressBarLabel(0),
90-
progressBar(0),
91-
progressDialog(0),
92-
appMenuBar(0),
93-
appToolBar(0),
94-
overviewAction(0),
95-
historyAction(0),
96-
quitAction(0),
97-
sendCoinsAction(0),
98-
sendCoinsMenuAction(0),
99-
usedSendingAddressesAction(0),
100-
usedReceivingAddressesAction(0),
101-
signMessageAction(0),
102-
verifyMessageAction(0),
103-
aboutAction(0),
104-
receiveCoinsAction(0),
105-
receiveCoinsMenuAction(0),
106-
optionsAction(0),
107-
toggleHideAction(0),
108-
encryptWalletAction(0),
109-
backupWalletAction(0),
110-
changePassphraseAction(0),
111-
aboutQtAction(0),
112-
openRPCConsoleAction(0),
113-
openAction(0),
114-
showHelpMessageAction(0),
115-
trayIcon(0),
116-
trayIconMenu(0),
117-
notificator(0),
118-
rpcConsole(0),
119-
helpMessageDialog(0),
120-
modalOverlay(0),
121-
prevBlocks(0),
122-
spinnerFrame(0),
123-
m_wallet_selector_label(nullptr),
12480
platformStyle(_platformStyle)
12581
{
12682
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)