Dash Core Source Documentation (0.16.0.1)

Find detailed information regarding the Dash Core source code.

bitcoingui.h
Go to the documentation of this file.
1 // Copyright (c) 2011-2015 The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
5 #ifndef BITCOIN_QT_BITCOINGUI_H
6 #define BITCOIN_QT_BITCOINGUI_H
7 
8 #if defined(HAVE_CONFIG_H)
9 #include <config/dash-config.h>
10 #endif
11 
12 #include <amount.h>
13 
14 #include <QLabel>
15 #include <QMainWindow>
16 #include <QMap>
17 #include <QMenu>
18 #include <QPoint>
19 #include <QPushButton>
20 #include <QSystemTrayIcon>
21 
22 #ifdef Q_OS_MAC
23 #include <qt/macos_appnap.h>
24 #endif
25 
26 class ClientModel;
27 class NetworkStyle;
28 class Notificator;
29 class OptionsModel;
30 class RPCConsole;
31 class SendCoinsRecipient;
33 class WalletFrame;
34 class WalletModel;
35 class HelpMessageDialog;
36 class ModalOverlay;
37 
38 QT_BEGIN_NAMESPACE
39 class QAction;
40 class QProgressBar;
41 class QProgressDialog;
42 class QToolButton;
43 QT_END_NAMESPACE
44 
49 class BitcoinGUI : public QMainWindow
50 {
51  Q_OBJECT
52 
53 public:
54  static const QString DEFAULT_WALLET;
55  static const std::string DEFAULT_UIPLATFORM;
56 
57  explicit BitcoinGUI(const NetworkStyle* networkStyle, QWidget* parent = 0);
58  ~BitcoinGUI();
59 
64 
65 #ifdef ENABLE_WALLET
66 
70  bool addWallet(const QString& name, WalletModel *walletModel);
71  bool setCurrentWallet(const QString& name);
74  void updateWalletStatus();
75  void removeAllWallets();
76 #endif // ENABLE_WALLET
78 
79 protected:
80  void changeEvent(QEvent *e);
81  void closeEvent(QCloseEvent *event);
82  void showEvent(QShowEvent *event);
83  void dragEnterEvent(QDragEnterEvent *event);
84  void dropEvent(QDropEvent *event);
85  bool eventFilter(QObject *object, QEvent *event);
86 
87 private:
90 
95  QLabel *labelBlocksIcon;
97  QProgressBar *progressBar;
98  QProgressDialog *progressDialog;
99 
100  QMenuBar *appMenuBar;
101  QToolButton *overviewAction;
102  QToolButton *historyAction;
103  QToolButton *masternodeAction;
104  QAction *quitAction;
105  QToolButton *sendCoinsAction;
113  QAction *aboutAction;
114  QToolButton *receiveCoinsAction;
116  QAction *optionsAction;
123  QAction *aboutQtAction;
124  QAction *openInfoAction;
126  QAction *openGraphAction;
127  QAction *openPeersAction;
131  QAction *openAction;
134 
135  QSystemTrayIcon *trayIcon;
136  QMenu *trayIconMenu;
137  QMenu *dockIconMenu;
142  QButtonGroup *tabGroup;
143 
144 #ifdef Q_OS_MAC
145  CAppNapInhibitor* m_app_nap_inhibitor = nullptr;
146 #endif
147 
149  QTimer* timerSpinner;
151  void startSpinner();
153  void stopSpinner();
154 
161 
163  QString date;
164  int unit;
166  QString type;
167  QString address;
168  QString label;
169  };
170  std::list<IncomingTransactionMessage> incomingTransactions;
172 
174  void createActions();
176  void createMenuBar();
178  void createToolBars();
180  void createTrayIcon(const NetworkStyle *networkStyle);
182  void createIconMenu(QMenu *pmenu);
183 
185  void setWalletActionsEnabled(bool enabled);
186 
188  void subscribeToCoreSignals();
191 
193  void updateNetworkState();
194 
196 
198 
199  void updateToolBarShortcuts();
200 
201 Q_SIGNALS:
203  void receivedURI(const QString &uri);
205  void requestedRestart(QStringList args);
206 
207 public Q_SLOTS:
209  void setNumConnections(int count);
211  void setNetworkActive(bool networkActive);
213  void handleRestart(QStringList args);
215  void setNumBlocks(int count, const QDateTime& blockDate, const QString& blockHash, double nVerificationProgress, bool headers);
217  void setAdditionalDataSyncProgress(double nSyncProgress);
218 
226  void message(const QString &title, const QString &message, unsigned int style, bool *ret = nullptr);
227 
228 #ifdef ENABLE_WALLET
229 
233  void setHDStatus(int hdEnabled);
234 
239  void setEncryptionStatus(int status);
240 
241  bool handlePaymentRequest(const SendCoinsRecipient& recipient);
242 
244  void incomingTransaction(const QString& date, int unit, const CAmount& amount, const QString& type, const QString& address, const QString& label);
245  void showIncomingTransactions();
246 #endif // ENABLE_WALLET
247 
248 private Q_SLOTS:
249 #ifdef ENABLE_WALLET
250 
251  void gotoOverviewPage();
253  void gotoHistoryPage();
255  void gotoMasternodePage();
257  void gotoReceiveCoinsPage();
259  void gotoSendCoinsPage(QString addr = "");
261  void gotoPrivateSendCoinsPage(QString addr = "");
262 
264  void gotoSignMessageTab(QString addr = "");
266  void gotoVerifyMessageTab(QString addr = "");
267 
269  void openClicked();
270 
272  void highlightTabButton(QAbstractButton *button, bool checked);
273 #endif // ENABLE_WALLET
274 
275  void optionsClicked();
277  void aboutClicked();
279  void showDebugWindow();
280 
282  void showInfo();
283  void showConsole();
284  void showGraph();
285  void showPeers();
286  void showRepair();
287 
289  void showConfEditor();
291  void showBackups();
292 
294  void showHelpMessageClicked();
297 #ifndef Q_OS_MAC
298 
299  void trayIconActivated(QSystemTrayIcon::ActivationReason reason);
300 #else
301 
302  void macosDockIconActivated();
303 #endif
304 
306  void showNormalIfMinimized(bool fToggleHidden = false);
308  void toggleHidden();
309 
311  void detectShutdown();
312 
314  void showProgress(const QString &title, int nProgress);
315 
317  void setTrayIconVisible(bool);
318 
320  void toggleNetworkActive();
321 
322  void showModalOverlay();
323 
325 
326  void updateWidth();
327 };
328 
329 class UnitDisplayStatusBarControl : public QLabel
330 {
331  Q_OBJECT
332 
333 public:
334  explicit UnitDisplayStatusBarControl();
337 
338 protected:
340  void mousePressEvent(QMouseEvent *event);
341 
342 private:
344  QMenu* menu;
345 
347  void onDisplayUnitsClicked(const QPoint& point);
349  void createContextMenu();
350 
351 private Q_SLOTS:
353  void updateDisplayUnit(int newUnits);
355  void onMenuSelection(QAction* action);
356 };
357 
358 #endif // BITCOIN_QT_BITCOINGUI_H
void showConfEditor()
Open external (default) editor with dash.conf.
Definition: bitcoingui.cpp:971
void subscribeToCoreSignals()
Connect core signals to GUI client.
void unsubscribeFromCoreSignals()
Disconnect core signals from GUI client.
void setNetworkActive(bool networkActive)
Set network state shown in the UI.
UnitDisplayStatusBarControl * unitDisplayControl
Definition: bitcoingui.h:91
Local Bitcoin RPC console.
Definition: rpcconsole.h:32
QMenuBar * appMenuBar
Definition: bitcoingui.h:100
static const QString DEFAULT_WALLET
Display name for default wallet name.
Definition: bitcoingui.h:54
void message(const QString &title, const QString &message, unsigned int style, bool *ret=nullptr)
Notify the user of an event from the core network or transaction handling code.
void showPeers()
Definition: bitcoingui.cpp:959
QAction * signMessageAction
Definition: bitcoingui.h:111
void receivedURI(const QString &uri)
Signal raised when a URI was entered or dragged to the GUI.
QAction * aboutAction
Definition: bitcoingui.h:113
void updateNetworkState()
Update UI with latest network info from model.
void updateToolBarShortcuts()
QLabel * labelWalletHDStatusIcon
Definition: bitcoingui.h:93
void showNormalIfMinimized(bool fToggleHidden=false)
Show window if hidden, unminimize when minimized, rise when obscured or show if hidden and fToggleHid...
void mousePressEvent(QMouseEvent *event)
So that it responds to left-button clicks.
QProgressDialog * progressDialog
Definition: bitcoingui.h:98
void setAdditionalDataSyncProgress(double nSyncProgress)
Set additional data sync status shown in the UI.
QMenu * trayIconMenu
Definition: bitcoingui.h:136
void showDebugWindow()
Show debug window.
Definition: bitcoingui.cpp:936
ClientModel * clientModel
Definition: bitcoingui.h:88
void createToolBars()
Create the toolbars.
Definition: bitcoingui.cpp:654
ModalOverlay * modalOverlay
Definition: bitcoingui.h:141
QButtonGroup * tabGroup
Definition: bitcoingui.h:142
RPCConsole * rpcConsole
Definition: bitcoingui.h:139
QAction * verifyMessageAction
Definition: bitcoingui.h:112
QAction * quitAction
Definition: bitcoingui.h:104
QAction * openRepairAction
Definition: bitcoingui.h:128
void dropEvent(QDropEvent *event)
QAction * openGraphAction
Definition: bitcoingui.h:126
QToolButton * historyAction
Definition: bitcoingui.h:102
QToolButton * sendCoinsAction
Definition: bitcoingui.h:105
void setWalletActionsEnabled(bool enabled)
Enable or disable all wallet-related actions.
Definition: bitcoingui.cpp:829
QAction * aboutQtAction
Definition: bitcoingui.h:123
QAction * openPeersAction
Definition: bitcoingui.h:127
void startConnectingAnimation()
Start the connecting animation.
Definition: bitcoingui.cpp:340
QToolButton * masternodeAction
Definition: bitcoingui.h:103
Bitcoin GUI main class.
Definition: bitcoingui.h:49
HelpMessageDialog * helpMessageDialog
Definition: bitcoingui.h:140
QLabel * progressBarLabel
Definition: bitcoingui.h:96
QSystemTrayIcon * trayIcon
Definition: bitcoingui.h:135
QAction * showHelpMessageAction
Definition: bitcoingui.h:132
Modal overlay to display information about the chain-sync state.
Definition: modaloverlay.h:19
QAction * backupWalletAction
Definition: bitcoingui.h:119
void setOptionsModel(OptionsModel *optionsModel)
Lets the control know about the Options Model (and its signals)
QLabel * labelConnectionsIcon
Definition: bitcoingui.h:94
void handleRestart(QStringList args)
Get restart command-line parameters and request restart.
QToolButton * receiveCoinsAction
Definition: bitcoingui.h:114
QAction * unlockWalletAction
Definition: bitcoingui.h:121
QAction * usedReceivingAddressesAction
Definition: bitcoingui.h:110
int64_t CAmount
Amount in satoshis (Can be negative)
Definition: amount.h:12
void setClientModel(ClientModel *clientModel)
Set the client model.
Definition: bitcoingui.cpp:705
void showModalOverlay()
void showInfo()
Show debug window and set focus to the appropriate tab.
Definition: bitcoingui.cpp:941
QTimer * timerConnecting
Timer to update the connection icon during connecting phase.
Definition: bitcoingui.h:156
void startSpinner()
Start the spinner animation in the status bar if it&#39;s not running and if labelBlocksIcon is visible...
Definition: bitcoingui.cpp:301
QAction * toggleHideAction
Definition: bitcoingui.h:117
void showProgress(const QString &title, int nProgress)
Show progress dialog e.g.
OptionsModel * optionsModel
Definition: bitcoingui.h:343
QTimer * incomingTransactionsTimer
Definition: bitcoingui.h:171
void optionsClicked()
Show configuration dialog.
Definition: bitcoingui.cpp:912
QToolButton * privateSendCoinsAction
Definition: bitcoingui.h:107
void stopSpinner()
Stop the spinner animation in the status bar.
Definition: bitcoingui.cpp:331
bool eventFilter(QObject *object, QEvent *event)
const char * name
Definition: rest.cpp:36
QLabel * labelBlocksIcon
Definition: bitcoingui.h:95
WalletFrame * walletFrame
Definition: bitcoingui.h:89
void updateDisplayUnit(int newUnits)
When Display Units are changed on OptionsModel it will refresh the display text of the control on the...
void showConsole()
Definition: bitcoingui.cpp:947
void showRepair()
Definition: bitcoingui.cpp:965
QAction * usedSendingAddressesAction
Definition: bitcoingui.h:109
void createIconMenu(QMenu *pmenu)
Create system tray menu (or setup the dock menu)
Definition: bitcoingui.cpp:868
void setTrayIconVisible(bool)
When hideTrayIcon setting is changed in OptionsModel hide or show the icon accordingly.
bool enableWallet
Definition: bitcoingui.h:77
QAction * openRPCConsoleAction
Definition: bitcoingui.h:125
QAction * openConfEditorAction
Definition: bitcoingui.h:129
void detectShutdown()
called by a timer to check if fRequestShutdown has been set
Cross-platform desktop notification client.
Definition: notificator.h:24
QLabel * labelWalletEncryptionIcon
Definition: bitcoingui.h:92
void showGraph()
Definition: bitcoingui.cpp:953
void requestedRestart(QStringList args)
Restart handling.
void showHelpMessageClicked()
Show help message dialog.
Definition: bitcoingui.cpp:981
void dragEnterEvent(QDragEnterEvent *event)
Notificator * notificator
Definition: bitcoingui.h:138
Model for Dash network client.
Definition: clientmodel.h:42
void updateProgressBarVisibility()
BitcoinGUI(const NetworkStyle *networkStyle, QWidget *parent=0)
Definition: bitcoingui.cpp:83
QAction * receiveCoinsMenuAction
Definition: bitcoingui.h:115
void toggleNetworkActive()
Toggle networking.
QAction * openAction
Definition: bitcoingui.h:131
void showPrivateSendHelpClicked()
Show PrivateSend help message dialog.
Definition: bitcoingui.cpp:986
void trayIconActivated(QSystemTrayIcon::ActivationReason reason)
Handle tray icon clicked.
Definition: bitcoingui.cpp:896
QAction * changePassphraseAction
Definition: bitcoingui.h:120
void showBackups()
Show folder with wallet backups in default file browser.
Definition: bitcoingui.cpp:976
QAction * lockWalletAction
Definition: bitcoingui.h:122
void closeEvent(QCloseEvent *event)
Interface from Qt to configuration data structure for Bitcoin client.
Definition: optionsmodel.h:25
void setNumBlocks(int count, const QDateTime &blockDate, const QString &blockHash, double nVerificationProgress, bool headers)
Set number of blocks and last block date shown in the UI.
Interface to Bitcoin wallet from Qt view code.
Definition: walletmodel.h:100
void stopConnectingAnimation()
Stop the connecting animation.
Definition: bitcoingui.cpp:374
QAction * sendCoinsMenuAction
Definition: bitcoingui.h:106
void changeEvent(QEvent *e)
void toggleHidden()
Simply calls showNormalIfMinimized(true) for use in SLOT() macro.
QAction * openInfoAction
Definition: bitcoingui.h:124
void showEvent(QShowEvent *event)
QAction * showBackupsAction
Definition: bitcoingui.h:130
QProgressBar * progressBar
Definition: bitcoingui.h:97
static int count
Definition: tests.c:45
void setNumConnections(int count)
Set number of connections shown in the UI.
"Help message" dialog box
Definition: utilitydialog.h:18
void createContextMenu()
Creates context menu, its actions, and wires up all the relevant signals for mouse events...
QAction * showPrivateSendHelpAction
Definition: bitcoingui.h:133
void createActions()
Create the main UI actions.
Definition: bitcoingui.cpp:383
QAction * optionsAction
Definition: bitcoingui.h:116
QAction * encryptWalletAction
Definition: bitcoingui.h:118
void aboutClicked()
Show about dialog.
Definition: bitcoingui.cpp:927
void updateHeadersSyncProgressLabel()
static const std::string DEFAULT_UIPLATFORM
Definition: bitcoingui.h:55
void updateWidth()
A container for embedding all wallet-related controls into BitcoinGUI.
Definition: walletframe.h:28
QToolButton * overviewAction
Definition: bitcoingui.h:101
void onDisplayUnitsClicked(const QPoint &point)
Shows context menu with Display Unit options by the mouse coordinates.
QAction * privateSendCoinsMenuAction
Definition: bitcoingui.h:108
void updatePrivateSendVisibility()
QTimer * timerSpinner
Timer to update the spinner animation in the status bar periodically.
Definition: bitcoingui.h:149
void createTrayIcon(const NetworkStyle *networkStyle)
Create system tray icon and notification.
Definition: bitcoingui.cpp:858
void createMenuBar()
Create the menu bar and sub-menus.
Definition: bitcoingui.cpp:597
void onMenuSelection(QAction *action)
Tells underlying optionsModel to update its current display unit.
QMenu * dockIconMenu
Definition: bitcoingui.h:137
std::list< IncomingTransactionMessage > incomingTransactions
Definition: bitcoingui.h:170
Released under the MIT license