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⚠️ field 'spinnerFrame' will be initialized after field 'm_wallet_selector_label' [-Wreorder]
        spinnerFrame(0),
This commit is contained in:
Wladimir J. van der Laan 2018-06-24 15:15:17 +02:00
parent 3a4549301a
commit bb3de15ad8
2 changed files with 46 additions and 90 deletions

View file

@ -76,51 +76,7 @@ const std::string BitcoinGUI::DEFAULT_UIPLATFORM =
BitcoinGUI::BitcoinGUI(interfaces::Node& node, const PlatformStyle *_platformStyle, const NetworkStyle *networkStyle, QWidget *parent) : BitcoinGUI::BitcoinGUI(interfaces::Node& node, const PlatformStyle *_platformStyle, const NetworkStyle *networkStyle, QWidget *parent) :
QMainWindow(parent), QMainWindow(parent),
enableWallet(false),
m_node(node), m_node(node),
clientModel(0),
walletFrame(0),
unitDisplayControl(0),
labelWalletEncryptionIcon(0),
labelWalletHDStatusIcon(0),
labelProxyIcon(0),
connectionsControl(0),
labelBlocksIcon(0),
progressBarLabel(0),
progressBar(0),
progressDialog(0),
appMenuBar(0),
appToolBar(0),
overviewAction(0),
historyAction(0),
quitAction(0),
sendCoinsAction(0),
sendCoinsMenuAction(0),
usedSendingAddressesAction(0),
usedReceivingAddressesAction(0),
signMessageAction(0),
verifyMessageAction(0),
aboutAction(0),
receiveCoinsAction(0),
receiveCoinsMenuAction(0),
optionsAction(0),
toggleHideAction(0),
encryptWalletAction(0),
backupWalletAction(0),
changePassphraseAction(0),
aboutQtAction(0),
openRPCConsoleAction(0),
openAction(0),
showHelpMessageAction(0),
trayIcon(0),
trayIconMenu(0),
notificator(0),
rpcConsole(0),
helpMessageDialog(0),
modalOverlay(0),
prevBlocks(0),
spinnerFrame(0),
m_wallet_selector_label(nullptr),
platformStyle(_platformStyle) platformStyle(_platformStyle)
{ {
QSettings settings; QSettings settings;

View file

@ -73,7 +73,7 @@ public:
bool removeWallet(WalletModel* walletModel); bool removeWallet(WalletModel* walletModel);
void removeAllWallets(); void removeAllWallets();
#endif // ENABLE_WALLET #endif // ENABLE_WALLET
bool enableWallet; bool enableWallet = false;
protected: protected:
void changeEvent(QEvent *e); void changeEvent(QEvent *e);
@ -87,58 +87,58 @@ private:
interfaces::Node& m_node; interfaces::Node& m_node;
std::unique_ptr<interfaces::Handler> m_handler_message_box; std::unique_ptr<interfaces::Handler> m_handler_message_box;
std::unique_ptr<interfaces::Handler> m_handler_question; std::unique_ptr<interfaces::Handler> m_handler_question;
ClientModel *clientModel; ClientModel* clientModel = nullptr;
WalletFrame *walletFrame; WalletFrame* walletFrame = nullptr;
UnitDisplayStatusBarControl *unitDisplayControl; UnitDisplayStatusBarControl* unitDisplayControl = nullptr;
QLabel *labelWalletEncryptionIcon; QLabel* labelWalletEncryptionIcon = nullptr;
QLabel *labelWalletHDStatusIcon; QLabel* labelWalletHDStatusIcon = nullptr;
QLabel *labelProxyIcon; QLabel* labelProxyIcon = nullptr;
QLabel *connectionsControl; QLabel* connectionsControl = nullptr;
QLabel *labelBlocksIcon; QLabel* labelBlocksIcon = nullptr;
QLabel *progressBarLabel; QLabel* progressBarLabel = nullptr;
QProgressBar *progressBar; QProgressBar* progressBar = nullptr;
QProgressDialog *progressDialog; QProgressDialog* progressDialog = nullptr;
QMenuBar *appMenuBar; QMenuBar* appMenuBar = nullptr;
QToolBar *appToolBar; QToolBar* appToolBar = nullptr;
QAction *overviewAction; QAction* overviewAction = nullptr;
QAction *historyAction; QAction* historyAction = nullptr;
QAction *quitAction; QAction* quitAction = nullptr;
QAction *sendCoinsAction; QAction* sendCoinsAction = nullptr;
QAction *sendCoinsMenuAction; QAction* sendCoinsMenuAction = nullptr;
QAction *usedSendingAddressesAction; QAction* usedSendingAddressesAction = nullptr;
QAction *usedReceivingAddressesAction; QAction* usedReceivingAddressesAction = nullptr;
QAction *signMessageAction; QAction* signMessageAction = nullptr;
QAction *verifyMessageAction; QAction* verifyMessageAction = nullptr;
QAction *aboutAction; QAction* aboutAction = nullptr;
QAction *receiveCoinsAction; QAction* receiveCoinsAction = nullptr;
QAction *receiveCoinsMenuAction; QAction* receiveCoinsMenuAction = nullptr;
QAction *optionsAction; QAction* optionsAction = nullptr;
QAction *toggleHideAction; QAction* toggleHideAction = nullptr;
QAction *encryptWalletAction; QAction* encryptWalletAction = nullptr;
QAction *backupWalletAction; QAction* backupWalletAction = nullptr;
QAction *changePassphraseAction; QAction* changePassphraseAction = nullptr;
QAction *aboutQtAction; QAction* aboutQtAction = nullptr;
QAction *openRPCConsoleAction; QAction* openRPCConsoleAction = nullptr;
QAction *openAction; QAction* openAction = nullptr;
QAction *showHelpMessageAction; QAction* showHelpMessageAction = nullptr;
QAction *m_wallet_selector_label_action = nullptr; QAction* m_wallet_selector_label_action = nullptr;
QAction *m_wallet_selector_action = nullptr; QAction* m_wallet_selector_action = nullptr;
QLabel *m_wallet_selector_label = nullptr; QLabel *m_wallet_selector_label = nullptr;
QComboBox *m_wallet_selector; QComboBox* m_wallet_selector = nullptr;
QSystemTrayIcon *trayIcon; QSystemTrayIcon* trayIcon = nullptr;
QMenu *trayIconMenu; QMenu* trayIconMenu = nullptr;
Notificator *notificator; Notificator* notificator = nullptr;
RPCConsole *rpcConsole; RPCConsole* rpcConsole = nullptr;
HelpMessageDialog *helpMessageDialog; HelpMessageDialog* helpMessageDialog = nullptr;
ModalOverlay *modalOverlay; ModalOverlay* modalOverlay = nullptr;
/** Keep track of previous number of blocks, to detect progress */ /** Keep track of previous number of blocks, to detect progress */
int prevBlocks; int prevBlocks = 0;
int spinnerFrame; int spinnerFrame = 0;
const PlatformStyle *platformStyle; const PlatformStyle *platformStyle;