Fabcoin Core  0.16.2
P2P Digital Currency
fabcoingui.h
Go to the documentation of this file.
1 // Copyright (c) 2011-2017 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 FABCOIN_QT_FABCOINGUI_H
6 #define FABCOIN_QT_FABCOINGUI_H
7 
8 #if defined(HAVE_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 <QSystemTrayIcon>
20 
21 class ClientModel;
22 class NetworkStyle;
23 class Notificator;
24 class OptionsModel;
25 class PlatformStyle;
26 class RPCConsole;
27 class SendCoinsRecipient;
29 class WalletFrame;
30 class WalletModel;
31 class HelpMessageDialog;
32 class ModalOverlay;
33 class TitleBar;
34 class NavigationBar;
36 class CWallet;
37 
38 QT_BEGIN_NAMESPACE
39 class QAction;
40 class QProgressBar;
41 class QProgressDialog;
42 class QDockWidget;
43 QT_END_NAMESPACE
44 
45 typedef CWallet* CWalletRef;
46 
51 class FabcoinGUI : public QMainWindow
52 {
53  Q_OBJECT
54 
55 public:
56  static const QString DEFAULT_WALLET;
57  static const std::string DEFAULT_UIPLATFORM;
58 
59  explicit FabcoinGUI(const PlatformStyle *platformStyle, const NetworkStyle *networkStyle, QWidget *parent = 0);
60  ~FabcoinGUI();
61 
66 
67 #ifdef ENABLE_WALLET
68 
72  bool addWallet(const QString& name, WalletModel *walletModel);
73  bool setCurrentWallet(const QString& name);
74  void removeAllWallets();
75 #endif // ENABLE_WALLET
77 
78 protected:
79  void changeEvent(QEvent *e);
80  void closeEvent(QCloseEvent *event);
81  void showEvent(QShowEvent *event);
82  void dragEnterEvent(QDragEnterEvent *event);
83  void dropEvent(QDropEvent *event);
84  bool eventFilter(QObject *object, QEvent *event);
85 
86 private:
89 
94  QLabel *labelBlocksIcon;
97  QProgressBar *progressBar;
98  QProgressDialog *progressDialog;
99 
100  QMenuBar *appMenuBar;
103  QAction *overviewAction;
104  QAction *historyAction;
105  QAction *quitAction;
106  QAction *sendCoinsAction;
112  QAction *aboutAction;
115  QAction *optionsAction;
123  QAction *aboutQtAction;
125  QAction *openAction;
131  QAction* QRCTokenAction;
132  QAction* sendTokenAction;
134  QAction* addTokenAction;
135 
136  QSystemTrayIcon *trayIcon;
137  QMenu *trayIconMenu;
144 
148 
150 
152  uint64_t nWeight;
153 
155  void createActions();
157  void createMenuBar();
159  void createToolBars();
161  void createTitleBars();
163  void createTrayIcon(const NetworkStyle *networkStyle);
165  void createTrayIconMenu();
166 
168  void setWalletActionsEnabled(bool enabled);
169 
171  void subscribeToCoreSignals();
174 
176  void updateNetworkState();
177 
179 
181  void addDockWindows(Qt::DockWidgetArea area, QWidget* widget);
182 
183 Q_SIGNALS:
185  void receivedURI(const QString &uri);
186 
187 public Q_SLOTS:
189  void setNumConnections(int count);
191  void setNetworkActive(bool networkActive);
193  void setNumBlocks(int count, const QDateTime& blockDate, double nVerificationProgress, bool headers);
194 
202  void message(const QString &title, const QString &message, unsigned int style, bool *ret = nullptr);
203 
204 #ifdef ENABLE_WALLET
205 
209  void setEncryptionStatus(int status);
210 
215  void setHDStatus(int hdEnabled);
216 
217  bool handlePaymentRequest(const SendCoinsRecipient& recipient);
218 
220  void incomingTransaction(const QString& date, int unit, const CAmount& amount, const QString& type, const QString& address, const QString& label);
221 
223  void incomingTokenTransaction(const QString& date, const QString& amount, const QString& type, const QString& address, const QString& label, const QString& title);
224 #endif // ENABLE_WALLET
225 
226  void setTabBarInfo(QObject* into);
227 
228 private Q_SLOTS:
229 #ifdef ENABLE_WALLET
230 
231  void gotoOverviewPage();
233  void gotoHistoryPage();
235  void gotoReceiveCoinsPage();
237  void gotoSendCoinsPage(QString addr = "");
239  void gotoCreateContractPage();
241  void gotoSendToContractPage();
243  void gotoCallContractPage();
245  void gotoSendTokenPage();
247  void gotoReceiveTokenPage();
249  void gotoAddTokenPage();
250 
252  void gotoSignMessageTab(QString addr = "");
254  void gotoVerifyMessageTab(QString addr = "");
255 
257  void openClicked();
258 #endif // ENABLE_WALLET
259 
260  void optionsClicked();
262  void aboutClicked();
264  void showDebugWindow();
268  void showHelpMessageClicked();
269 #ifndef Q_OS_MAC
270 
271  void trayIconActivated(QSystemTrayIcon::ActivationReason reason);
272 #endif
273 
275  void showNormalIfMinimized(bool fToggleHidden = false);
277  void toggleHidden();
279  void updateStakingIcon();
280 
282  void detectShutdown();
283 
285  void showProgress(const QString &title, int nProgress);
286 
288  void setTrayIconVisible(bool);
289 
291  void toggleNetworkActive();
292 
293  void showModalOverlay();
294 
295  void showModalBackupOverlay();
296 
297 private:
300 };
301 
302 class UnitDisplayStatusBarControl : public QLabel
303 {
304  Q_OBJECT
305 
306 public:
309  void setOptionsModel(OptionsModel *optionsModel);
310 
311 protected:
313  void mousePressEvent(QMouseEvent *event);
314 
315 private:
317  QMenu* menu;
318 
320  void onDisplayUnitsClicked(const QPoint& point);
322  void createContextMenu();
323 
324 private Q_SLOTS:
326  void updateDisplayUnit(int newUnits);
328  void onMenuSelection(QAction* action);
329 };
330 
331 #endif // FABCOIN_QT_FABCOINGUI_H
TitleBar * appTitleBar
Definition: fabcoingui.h:101
void unsubscribeFromCoreSignals()
Disconnect core signals from GUI client.
void toggleNetworkActive()
Toggle networking.
void createTitleBars()
Create title bar.
Definition: fabcoingui.cpp:588
Local Fabcoin RPC console.
Definition: rpcconsole.h:31
void showProgress(const QString &title, int nProgress)
Show progress dialog e.g.
void dropEvent(QDropEvent *event)
void trayIconActivated(QSystemTrayIcon::ActivationReason reason)
Handle tray icon clicked.
Definition: fabcoingui.cpp:762
QAction * sendToContractAction
Definition: fabcoingui.h:129
bool eventFilter(QObject *object, QEvent *event)
UnitDisplayStatusBarControl * unitDisplayControl
Definition: fabcoingui.h:90
void updateNetworkState()
Update UI with latest network info from model.
Definition: fabcoingui.cpp:891
void closeEvent(QCloseEvent *event)
QAction * lockWalletAction
Definition: fabcoingui.h:122
void setClientModel(ClientModel *clientModel)
Set the client model.
Definition: fabcoingui.cpp:599
QMenuBar * appMenuBar
Definition: fabcoingui.h:100
static const std::string DEFAULT_UIPLATFORM
Definition: fabcoingui.h:57
void createTrayIcon(const NetworkStyle *networkStyle)
Create system tray icon and notification.
Definition: fabcoingui.cpp:712
ClientModel * clientModel
Definition: fabcoingui.h:87
FabcoinVersionChecker * fabcoinVersionChecker
Definition: fabcoingui.h:142
QAction * createContractAction
Definition: fabcoingui.h:128
void createToolBars()
Create the toolbars.
Definition: fabcoingui.cpp:560
QAction * aboutAction
Definition: fabcoingui.h:112
ModalOverlay * modalOverlay
Definition: fabcoingui.h:141
size_t count
Definition: ExecStats.cpp:37
int prevBlocks
Keep track of previous number of blocks, to detect progress.
Definition: fabcoingui.h:146
QAction * optionsAction
Definition: fabcoingui.h:115
QAction * changePassphraseAction
Definition: fabcoingui.h:120
void setNumConnections(int count)
Set number of connections shown in the UI.
Definition: fabcoingui.cpp:920
void toggleHidden()
Simply calls showNormalIfMinimized(true) for use in SLOT() macro.
Fabcoin GUI main class.
Definition: fabcoingui.h:51
ModalOverlay * modalBackupOverlay
Definition: fabcoingui.h:143
QAction * quitAction
Definition: fabcoingui.h:105
QAction * encryptWalletAction
Definition: fabcoingui.h:117
void changeEvent(QEvent *e)
void aboutClicked()
Show about dialog.
Definition: fabcoingui.cpp:782
void showHelpMessageClicked()
Show help message dialog.
Definition: fabcoingui.cpp:805
QAction * smartContractAction
Definition: fabcoingui.h:127
void updateHeadersSyncProgressLabel()
Definition: fabcoingui.cpp:930
NavigationBar * appNavigationBar
Definition: fabcoingui.h:102
void showDebugWindowActivateConsole()
Show debug window and set focus to the console.
Definition: fabcoingui.cpp:799
Modal overlay to display information about the chain-sync state.
Definition: modaloverlay.h:19
void showModalOverlay()
QAction * receiveCoinsMenuAction
Definition: fabcoingui.h:114
FabcoinGUI(const PlatformStyle *platformStyle, const NetworkStyle *networkStyle, QWidget *parent=0)
Definition: fabcoingui.cpp:92
void showDebugWindow()
Show debug window.
Definition: fabcoingui.cpp:791
void addDockWindows(Qt::DockWidgetArea area, QWidget *widget)
Add docking windows to the main windows.
void receivedURI(const QString &uri)
Signal raised when a URI was entered or dragged to the GUI.
QAction * sendTokenAction
Definition: fabcoingui.h:132
void setWalletActionsEnabled(bool enabled)
Enable or disable all wallet-related actions.
Definition: fabcoingui.cpp:693
QAction * addTokenAction
Definition: fabcoingui.h:134
int64_t CAmount
Amount in lius (Can be negative)
Definition: amount.h:15
QLabel * labelWalletEncryptionIcon
Definition: fabcoingui.h:91
QT_END_NAMESPACE typedef CWallet * CWalletRef
Definition: fabcoingui.h:42
QAction * aboutQtAction
Definition: fabcoingui.h:123
QLabel * labelBlocksIcon
Definition: fabcoingui.h:94
Notificator * notificator
Definition: fabcoingui.h:138
QAction * toggleHideAction
Definition: fabcoingui.h:116
OptionsModel * optionsModel
Definition: fabcoingui.h:316
uint64_t nWeight
Current weight of the wallet.
Definition: fabcoingui.h:152
The TitleBar class Title bar widget.
Definition: titlebar.h:20
const char * name
Definition: rest.cpp:36
CWallet * pwalletMain
void createTrayIconMenu()
Create system tray menu (or setup the dock menu)
Definition: fabcoingui.cpp:725
QAction * receiveTokenAction
Definition: fabcoingui.h:133
QAction * showHelpMessageAction
Definition: fabcoingui.h:126
void optionsClicked()
Show configuration dialog.
Definition: fabcoingui.cpp:772
void subscribeToCoreSignals()
Connect core signals to GUI client.
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 setNetworkActive(bool networkActive)
Set network state shown in the UI.
Definition: fabcoingui.cpp:925
void updateStakingIcon()
Update staking icon.
Cross-platform desktop notification client.
Definition: notificator.h:24
static const QString DEFAULT_WALLET
Display name for default wallet name.
Definition: fabcoingui.h:56
QAction * unlockWalletAction
Definition: fabcoingui.h:121
void createMenuBar()
Create the menu bar and sub-menus.
Definition: fabcoingui.cpp:512
QProgressBar * progressBar
Definition: fabcoingui.h:97
QAction * openRPCConsoleAction
Definition: fabcoingui.h:124
QSystemTrayIcon * trayIcon
Definition: fabcoingui.h:136
The NavigationBar class Custom control for navigation bar.
Definition: navigationbar.h:13
QAction * verifyMessageAction
Definition: fabcoingui.h:111
Model for Fabcoin network client.
Definition: clientmodel.h:38
QAction * sendCoinsAction
Definition: fabcoingui.h:106
int spinnerFrame
Definition: fabcoingui.h:147
QLabel * connectionsControl
Definition: fabcoingui.h:93
QAction * usedReceivingAddressesAction
Definition: fabcoingui.h:109
QLabel * progressBarLabel
Definition: fabcoingui.h:95
const PlatformStyle * platformStyle
Definition: fabcoingui.h:149
void createActions()
Create the main UI actions.
Definition: fabcoingui.cpp:336
QAction * openAction
Definition: fabcoingui.h:125
void updateWeight(CWalletRef pwalletMain)
Update the current weight of the wallet.
QAction * overviewAction
Definition: fabcoingui.h:103
QAction * signMessageAction
Definition: fabcoingui.h:110
void setTabBarInfo(QObject *into)
PlatformStyle::TableColorType type
Definition: rpcconsole.cpp:61
Interface from Qt to configuration data structure for Fabcoin client.
Definition: optionsmodel.h:22
void setTrayIconVisible(bool)
When hideTrayIcon setting is changed in OptionsModel hide or show the icon accordingly.
QMenu * trayIconMenu
Definition: fabcoingui.h:137
Interface to Fabcoin wallet from Qt view code.
Definition: walletmodel.h:103
QAction * historyAction
Definition: fabcoingui.h:104
WalletFrame * walletFrame
Definition: fabcoingui.h:88
QAction * receiveCoinsAction
Definition: fabcoingui.h:113
QLabel * labelWalletHDStatusIcon
Definition: fabcoingui.h:92
QLabel * labelStakingIcon
Definition: fabcoingui.h:96
A CWallet is an extension of a keystore, which also maintains a set of transactions and balances...
Definition: wallet.h:672
#define e(i)
Definition: sha.cpp:733
"Help message" dialog box
Definition: utilitydialog.h:18
RPCConsole * rpcConsole
Definition: fabcoingui.h:139
QAction * QRCTokenAction
Definition: fabcoingui.h:131
QAction * callContractAction
Definition: fabcoingui.h:130
QAction * sendCoinsMenuAction
Definition: fabcoingui.h:107
HelpMessageDialog * helpMessageDialog
Definition: fabcoingui.h:140
QProgressDialog * progressDialog
Definition: fabcoingui.h:98
struct evm_uint160be address(struct evm_env *env)
Definition: capi.c:13
void showEvent(QShowEvent *event)
QAction * restoreWalletAction
Definition: fabcoingui.h:119
bool enableWallet
Definition: fabcoingui.h:76
void setNumBlocks(int count, const QDateTime &blockDate, double nVerificationProgress, bool headers)
Set number of blocks and last block date shown in the UI.
Definition: fabcoingui.cpp:939
void showNormalIfMinimized(bool fToggleHidden=false)
Show window if hidden, unminimize when minimized, rise when obscured or show if hidden and fToggleHid...
QAction * usedSendingAddressesAction
Definition: fabcoingui.h:108
A container for embedding all wallet-related controls into FabcoinGUI.
Definition: walletframe.h:29
void detectShutdown()
called by a timer to check if fRequestShutdown has been set
void dragEnterEvent(QDragEnterEvent *event)
QAction * backupWalletAction
Definition: fabcoingui.h:118
void showModalBackupOverlay()