-
Notifications
You must be signed in to change notification settings - Fork 75
Expand file tree
/
Copy pathMainWindow.h
More file actions
275 lines (233 loc) · 7.97 KB
/
MainWindow.h
File metadata and controls
275 lines (233 loc) · 7.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
// SPDX-License-Identifier: BSD-3-Clause
// SPDX-FileCopyrightText: The Monero Project
#ifndef FEATHER_MAINWINDOW_H
#define FEATHER_MAINWINDOW_H
#include <QMainWindow>
#include <QSystemTrayIcon>
#include "components.h"
#include "SettingsDialog.h"
#include "dialog/AboutDialog.h"
#include "dialog/AccountSwitcherDialog.h"
#include "dialog/SignVerifyDialog.h"
#include "dialog/VerifyProofDialog.h"
#include "dialog/SeedDialog.h"
#include "dialog/PasswordChangeDialog.h"
#include "dialog/KeysDialog.h"
#include "dialog/AboutDialog.h"
#include "dialog/SplashDialog.h"
#include "dialog/TxPoolViewerDialog.h"
#include "libwalletqt/Wallet.h"
#include "model/SubaddressModel.h"
#include "model/SubaddressProxyModel.h"
#include "model/TransactionHistoryModel.h"
#include "model/CoinsModel.h"
#include "model/CoinsProxyModel.h"
#include "utils/Networking.h"
#include "utils/config.h"
#include "utils/daemonrpc.h"
#include "utils/EventFilter.h"
#include "widgets/TickerWidget.h"
#include "widgets/WalletUnlockWidget.h"
#include "wizard/WalletWizard.h"
#include "ContactsWidget.h"
#include "HistoryWidget.h"
#include "SendWidget.h"
#include "ReceiveWidget.h"
#include "CoinsWidget.h"
#include "WindowManager.h"
#include "plugins/Plugin.h"
#ifdef CHECK_UPDATES
#include "utils/updater/Updater.h"
#endif
namespace Ui {
class MainWindow;
}
class ToggleTab : QObject {
Q_OBJECT
public:
ToggleTab(QWidget *tab, QString name, QString description, QAction *menuAction, QObject *parent = nullptr) :
QObject(parent), tab(tab), key(std::move(name)), name(std::move(description)), menuAction(menuAction) {}
QWidget *tab;
QString key;
QString name;
QAction *menuAction;
};
class WindowManager;
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(WindowManager *windowManager, Wallet *wallet, QWidget *parent = nullptr);
~MainWindow() override;
QString walletName();
QString walletCachePath();
QString walletKeysPath();
enum Stack {
WALLET = 0,
LOCKED,
OFFLINE
};
void showOrHide();
void bringToFront();
public slots:
void onPreferredFiatCurrencyChanged();
void onHideUpdateNotifications(bool hidden);
signals:
void updateIcons();
void closed();
void uiSetup();
void aboutToQuit();
protected:
void changeEvent(QEvent* event) override;
private slots:
// TODO: use a consistent naming convention for slots
// Menu
void menuOpenClicked();
void menuNewRestoreClicked();
void menuQuitClicked();
void menuSettingsClicked(bool showProxytab = false);
void menuAboutClicked();
void menuSignVerifyClicked();
void menuVerifyTxProof();
void menuWalletCloseClicked();
void menuProxySettingsClicked();
void menuToggleTabVisible(const QString &key);
void menuClearHistoryClicked();
void onExportHistoryCSV();
void onImportHistoryDescriptionsCSV();
void onCreateDesktopEntry();
void onShowDocumentation();
void onReportBug();
void onShowSettingsPage(int page);
// offline tx signing
void loadSignedTx();
void loadSignedTxFromText();
void onTorConnectionStateChanged(bool connected);
void showUpdateDialog();
void onInitiateTransaction();
void onKeysCorrupted();
void onSelectedInputsChanged(const QStringList &selectedInputs);
void onTxPoolBacklog(const QVector<quint64> &backlog, quint64 originalFeeLevel, quint64 automaticFeeLevel);
// libwalletqt
void updateBalance();
void onBalanceUpdated(quint64 balance, quint64 spendable);
void onSyncStatus(quint64 height, quint64 target, bool daemonSync);
void onWalletOpened();
void onConnectionStatusChanged(int status);
void onTransactionCreated(PendingTransaction *tx, const QVector<QString> &address);
void onTransactionCommitted(bool status, PendingTransaction *tx, const QStringList& txid);
// Dialogs
void showWalletInfoDialog();
void showSeedDialog();
void showPasswordDialog();
void showKeysDialog();
void showViewOnlyDialog();
void showKeyImageSyncWizard();
void showWalletCacheDebugDialog();
void showTxPoolViewerDialog();
void showAccountSwitcherDialog();
void showAddressChecker();
void showURDialog();
void payToMany();
void showHistoryTab();
void skinChanged(const QString &skinName);
void onViewOnBlockExplorer(const QString &txid);
void onResendTransaction(const QString &txid);
void importTransaction();
void onDeviceError(const QString &error, quint64 errorCode);
void onDeviceButtonRequest(quint64 code);
void onDeviceButtonPressed();
void onWalletPassphraseNeeded(bool on_device);
void menuHwDeviceClicked();
void toggleSearchbar(bool enabled);
void tryStoreWallet();
void onWebsocketStatusChanged(bool enabled);
void showUpdateNotification();
void onProxySettingsChangedConnect();
void onProxySettingsChanged();
void onOfflineMode(bool offline);
void onManualFeeSelectionEnabled(bool enabled);
void onSubtractFeeFromAmountEnabled(bool enabled);
void onMultiBroadcast(const QMap<QString, QString> &txHexMap);
private:
friend WindowManager;
void initStatusBar();
void initPlugins();
void initWidgets();
void initMenu();
void initOffline();
void initWalletContext();
void closeEvent(QCloseEvent *event) override;
void saveGeo();
void restoreGeo();
void showDebugInfo();
void updatePasswordIcon();
void updateNetStats();
void rescanSpent();
void setStatusText(const QString &text, bool override = false, int timeout = 1000);
void showBalanceDialog();
QString statusDots();
QString getHardwareDevice();
void updateTitle();
void donationNag();
void addToRecentlyOpened(QString filename);
void updateRecentlyOpenedMenu();
void updateWidgetIcons();
bool verifyPassword(bool sensitive = true);
void fillSendTab(const QString &address, const QString &description);
void userActivity();
void checkUserActivity();
void lockWallet();
void unlockWallet(const QString &password);
void closeQDialogChildren(QObject *object);
int findTab(const QString &title);
QIcon hardwareDevicePairedIcon();
QIcon hardwareDeviceUnpairedIcon();
QScopedPointer<Ui::MainWindow> ui;
WindowManager *m_windowManager;
Wallet *m_wallet = nullptr;
Nodes *m_nodes;
DaemonRpc *m_rpc;
SplashDialog *m_splashDialog = nullptr;
AccountSwitcherDialog *m_accountSwitcherDialog = nullptr;
TxPoolViewerDialog *m_txPoolViewerDialog = nullptr;
WalletUnlockWidget *m_walletUnlockWidget = nullptr;
ContactsWidget *m_contactsWidget = nullptr;
HistoryWidget *m_historyWidget = nullptr;
SendWidget *m_sendWidget = nullptr;
ReceiveWidget *m_receiveWidget = nullptr;
CoinsWidget *m_coinsWidget = nullptr;
QPointer<QAction> m_clearRecentlyOpenAction;
// lower status bar
QPushButton *m_statusUpdateAvailable;
ClickableLabel *m_statusLabelBalance;
QLabel *m_statusLabelStatus;
QLabel *m_statusLabelNetStats;
StatusBarButton *m_statusAccountSwitcher;
StatusBarButton *m_statusBtnConnectionStatusIndicator;
StatusBarButton *m_statusBtnPassword;
StatusBarButton *m_statusBtnPreferences;
StatusBarButton *m_statusBtnSeed;
StatusBarButton *m_statusBtnProxySettings;
StatusBarButton *m_statusBtnHwDevice;
QSignalMapper *m_tabShowHideSignalMapper;
QMap<QString, ToggleTab*> m_tabShowHideMapper;
QTimer m_updateBytes;
QTimer m_checkUserActivity;
QList<Plugin*> m_plugins;
QString m_statusText;
int m_statusDots;
bool m_constructingTransaction = false;
bool m_statusOverrideActive = false;
bool m_showDeviceError = false;
QTimer m_txTimer;
bool cleanedUp = false;
bool m_locked = false;
bool m_criticalWarningShown = false;
EventFilter *m_eventFilter = nullptr;
qint64 m_userLastActive = QDateTime::currentSecsSinceEpoch();
#ifdef CHECK_UPDATES
QSharedPointer<Updater> m_updater = nullptr;
#endif
};
#endif // FEATHER_MAINWINDOW_H