2020-10-07 10:36:04 +00:00
|
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
2023-01-02 19:30:11 +00:00
|
|
|
// SPDX-FileCopyrightText: 2020-2023 The Monero Project
|
2020-10-07 10:36:04 +00:00
|
|
|
|
2021-06-27 12:51:15 +00:00
|
|
|
#ifndef FEATHER_MAINWINDOW_H
|
|
|
|
#define FEATHER_MAINWINDOW_H
|
2020-10-07 10:36:04 +00:00
|
|
|
|
|
|
|
#include <QMainWindow>
|
|
|
|
#include <QSystemTrayIcon>
|
2021-05-02 18:22:38 +00:00
|
|
|
#include <QMenu>
|
2020-10-07 10:36:04 +00:00
|
|
|
|
|
|
|
#include "components.h"
|
2021-06-28 17:48:23 +00:00
|
|
|
#include "CalcWindow.h"
|
2023-02-11 17:24:18 +00:00
|
|
|
#include "SettingsDialog.h"
|
2021-05-02 18:22:38 +00:00
|
|
|
|
2021-06-27 11:46:32 +00:00
|
|
|
#include "dialog/AboutDialog.h"
|
2023-01-17 21:06:08 +00:00
|
|
|
#include "dialog/AccountSwitcherDialog.h"
|
2021-06-27 11:46:32 +00:00
|
|
|
#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"
|
2021-03-24 01:37:54 +00:00
|
|
|
#include "libwalletqt/Wallet.h"
|
2021-05-02 18:22:38 +00:00
|
|
|
#include "model/SubaddressModel.h"
|
|
|
|
#include "model/SubaddressProxyModel.h"
|
|
|
|
#include "model/TransactionHistoryModel.h"
|
|
|
|
#include "model/CoinsModel.h"
|
|
|
|
#include "model/CoinsProxyModel.h"
|
2023-03-29 07:46:12 +00:00
|
|
|
#include "utils/Networking.h"
|
2021-05-02 18:22:38 +00:00
|
|
|
#include "utils/config.h"
|
2023-03-01 02:05:56 +00:00
|
|
|
#include "utils/daemonrpc.h"
|
2022-03-04 16:20:17 +00:00
|
|
|
#include "utils/EventFilter.h"
|
2023-03-28 20:26:53 +00:00
|
|
|
#include "plugins/ccs/CCSWidget.h"
|
|
|
|
#include "plugins/reddit/RedditWidget.h"
|
2021-05-24 23:10:45 +00:00
|
|
|
#include "widgets/TickerWidget.h"
|
2023-01-19 14:12:16 +00:00
|
|
|
#include "widgets/WalletUnlockWidget.h"
|
2021-05-02 18:22:38 +00:00
|
|
|
#include "wizard/WalletWizard.h"
|
|
|
|
|
2021-06-28 17:48:23 +00:00
|
|
|
#include "ContactsWidget.h"
|
|
|
|
#include "HistoryWidget.h"
|
|
|
|
#include "SendWidget.h"
|
|
|
|
#include "ReceiveWidget.h"
|
|
|
|
#include "CoinsWidget.h"
|
2021-05-10 15:05:10 +00:00
|
|
|
|
2021-05-18 15:59:18 +00:00
|
|
|
#include "WindowManager.h"
|
|
|
|
|
2023-04-19 15:41:46 +00:00
|
|
|
#ifdef CHECK_UPDATES
|
|
|
|
#include "utils/updater/Updater.h"
|
|
|
|
#endif
|
|
|
|
|
2021-05-02 18:22:38 +00:00
|
|
|
#ifdef HAS_LOCALMONERO
|
2023-03-28 20:26:53 +00:00
|
|
|
#include "plugins/localmonero/LocalMoneroWidget.h"
|
2021-05-02 18:22:38 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAS_XMRIG
|
2023-03-28 20:26:53 +00:00
|
|
|
#include "plugins/xmrig/XMRigWidget.h"
|
2021-05-02 18:22:38 +00:00
|
|
|
#endif
|
|
|
|
|
2020-10-07 10:36:04 +00:00
|
|
|
namespace Ui {
|
|
|
|
class MainWindow;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct ToggleTab {
|
2020-12-28 04:39:20 +00:00
|
|
|
ToggleTab(QWidget *tab, QString name, QString description, QAction *menuAction, Config::ConfigKey configKey) :
|
|
|
|
tab(tab), key(std::move(name)), name(std::move(description)), menuAction(menuAction), configKey(configKey){}
|
2020-10-07 10:36:04 +00:00
|
|
|
QWidget *tab;
|
|
|
|
QString key;
|
|
|
|
QString name;
|
|
|
|
QAction *menuAction;
|
|
|
|
Config::ConfigKey configKey;
|
|
|
|
};
|
|
|
|
|
2021-05-18 15:59:18 +00:00
|
|
|
class WindowManager;
|
2020-10-07 10:36:04 +00:00
|
|
|
class MainWindow : public QMainWindow
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2021-05-18 15:59:18 +00:00
|
|
|
explicit MainWindow(WindowManager *windowManager, Wallet *wallet, QWidget *parent = nullptr);
|
2020-10-07 10:36:04 +00:00
|
|
|
~MainWindow() override;
|
|
|
|
|
2021-05-18 15:59:18 +00:00
|
|
|
QString walletName();
|
|
|
|
QString walletCachePath();
|
|
|
|
QString walletKeysPath();
|
|
|
|
|
2020-10-21 11:24:16 +00:00
|
|
|
enum Tabs {
|
|
|
|
HOME = 0,
|
|
|
|
HISTORY,
|
|
|
|
SEND,
|
|
|
|
RECEIVE,
|
|
|
|
COINS,
|
|
|
|
CALC,
|
2020-12-12 01:49:33 +00:00
|
|
|
EXCHANGES,
|
2020-10-21 11:24:16 +00:00
|
|
|
XMRIG
|
|
|
|
};
|
|
|
|
|
2020-12-11 13:32:14 +00:00
|
|
|
enum TabsHome {
|
2022-07-02 20:41:46 +00:00
|
|
|
CCS = 0,
|
|
|
|
BOUNTIES,
|
|
|
|
REDDIT,
|
|
|
|
REVUO
|
2020-12-11 13:32:14 +00:00
|
|
|
};
|
|
|
|
|
2023-12-02 18:28:31 +00:00
|
|
|
enum Stack {
|
|
|
|
WALLET = 0,
|
|
|
|
LOCKED,
|
|
|
|
OFFLINE
|
|
|
|
};
|
|
|
|
|
2021-05-18 15:59:18 +00:00
|
|
|
void showOrHide();
|
|
|
|
void bringToFront();
|
|
|
|
|
2023-02-11 17:11:21 +00:00
|
|
|
public slots:
|
|
|
|
void onPreferredFiatCurrencyChanged();
|
|
|
|
void onHideUpdateNotifications(bool hidden);
|
|
|
|
|
2021-05-18 15:59:18 +00:00
|
|
|
signals:
|
|
|
|
void closed();
|
|
|
|
|
2023-02-11 17:11:21 +00:00
|
|
|
protected:
|
|
|
|
void changeEvent(QEvent* event) override;
|
|
|
|
|
2021-05-18 15:59:18 +00:00
|
|
|
private slots:
|
|
|
|
// TODO: use a consistent naming convention for slots
|
|
|
|
// Menu
|
|
|
|
void menuOpenClicked();
|
2020-10-07 10:36:04 +00:00
|
|
|
void menuNewRestoreClicked();
|
|
|
|
void menuQuitClicked();
|
2023-02-11 17:11:21 +00:00
|
|
|
void menuSettingsClicked(bool showProxytab = false);
|
2020-10-07 10:36:04 +00:00
|
|
|
void menuAboutClicked();
|
|
|
|
void menuSignVerifyClicked();
|
|
|
|
void menuVerifyTxProof();
|
2021-05-18 15:59:18 +00:00
|
|
|
void menuWalletCloseClicked();
|
2023-02-11 17:11:21 +00:00
|
|
|
void menuProxySettingsClicked();
|
2021-05-18 15:59:18 +00:00
|
|
|
void menuToggleTabVisible(const QString &key);
|
2021-07-08 12:03:54 +00:00
|
|
|
void menuClearHistoryClicked();
|
2023-03-29 09:00:41 +00:00
|
|
|
void onExportHistoryCSV();
|
|
|
|
void onExportContactsCSV();
|
|
|
|
void onCreateDesktopEntry();
|
2023-01-09 02:17:25 +00:00
|
|
|
void onShowDocumentation();
|
2023-03-29 09:00:41 +00:00
|
|
|
void onReportBug();
|
2022-03-11 13:56:07 +00:00
|
|
|
void onShowSettingsPage(int page);
|
2021-05-18 15:59:18 +00:00
|
|
|
|
|
|
|
// offline tx signing
|
|
|
|
void loadSignedTx();
|
|
|
|
void loadSignedTxFromText();
|
|
|
|
|
|
|
|
void onTorConnectionStateChanged(bool connected);
|
2023-02-01 14:40:12 +00:00
|
|
|
void showUpdateDialog();
|
2021-05-18 15:59:18 +00:00
|
|
|
void onInitiateTransaction();
|
2022-03-12 12:53:46 +00:00
|
|
|
void onKeysCorrupted();
|
2022-03-20 22:30:48 +00:00
|
|
|
void onSelectedInputsChanged(const QStringList &selectedInputs);
|
2021-05-18 15:59:18 +00:00
|
|
|
|
|
|
|
// libwalletqt
|
|
|
|
void onBalanceUpdated(quint64 balance, quint64 spendable);
|
|
|
|
void onSynchronized();
|
|
|
|
void onWalletOpened();
|
|
|
|
void onConnectionStatusChanged(int status);
|
2023-09-12 14:15:40 +00:00
|
|
|
void onTransactionCreated(PendingTransaction *tx, const QVector<QString> &address);
|
2021-05-18 15:59:18 +00:00
|
|
|
void onTransactionCommitted(bool status, PendingTransaction *tx, const QStringList& txid);
|
|
|
|
|
|
|
|
// Dialogs
|
2020-10-07 10:36:04 +00:00
|
|
|
void showWalletInfoDialog();
|
|
|
|
void showSeedDialog();
|
|
|
|
void showPasswordDialog();
|
|
|
|
void showKeysDialog();
|
2020-10-12 22:01:06 +00:00
|
|
|
void showViewOnlyDialog();
|
2023-12-02 18:28:31 +00:00
|
|
|
void showKeyImageSyncWizard();
|
2021-05-18 15:59:18 +00:00
|
|
|
void showWalletCacheDebugDialog();
|
2021-05-22 13:42:26 +00:00
|
|
|
void showAccountSwitcherDialog();
|
2021-07-06 14:10:24 +00:00
|
|
|
void showAddressChecker();
|
2023-12-02 18:28:31 +00:00
|
|
|
void showURDialog();
|
|
|
|
|
2020-10-07 10:36:04 +00:00
|
|
|
void donateButtonClicked();
|
|
|
|
void showCalcWindow();
|
2021-01-26 23:55:27 +00:00
|
|
|
void payToMany();
|
2020-10-07 10:36:04 +00:00
|
|
|
void showHistoryTab();
|
|
|
|
void showSendScreen(const CCSEntry &entry);
|
|
|
|
void skinChanged(const QString &skinName);
|
|
|
|
void onBlockchainSync(int height, int target);
|
|
|
|
void onRefreshSync(int height, int target);
|
|
|
|
void onViewOnBlockExplorer(const QString &txid);
|
2020-12-14 22:07:23 +00:00
|
|
|
void onResendTransaction(const QString &txid);
|
2020-10-21 06:25:02 +00:00
|
|
|
void importContacts();
|
2020-11-10 11:38:37 +00:00
|
|
|
void importTransaction();
|
2021-05-02 18:22:38 +00:00
|
|
|
void onDeviceError(const QString &error);
|
2021-07-01 21:00:47 +00:00
|
|
|
void onDeviceButtonRequest(quint64 code);
|
|
|
|
void onDeviceButtonPressed();
|
2021-07-08 00:34:27 +00:00
|
|
|
void onWalletPassphraseNeeded(bool on_device);
|
2021-05-02 18:22:38 +00:00
|
|
|
void menuHwDeviceClicked();
|
2021-05-23 14:58:18 +00:00
|
|
|
void toggleSearchbar(bool enabled);
|
2021-08-14 14:53:22 +00:00
|
|
|
void tryStoreWallet();
|
2022-03-15 12:36:20 +00:00
|
|
|
void onWebsocketStatusChanged(bool enabled);
|
2023-02-01 14:40:12 +00:00
|
|
|
void showUpdateNotification();
|
2023-02-11 17:11:21 +00:00
|
|
|
void onProxySettingsChanged();
|
2023-03-01 02:05:56 +00:00
|
|
|
void onOfflineMode(bool offline);
|
2023-03-02 12:41:33 +00:00
|
|
|
void onMultiBroadcast(const QMap<QString, QString> &txHexMap);
|
2020-10-07 10:36:04 +00:00
|
|
|
|
|
|
|
private:
|
2021-07-03 01:29:13 +00:00
|
|
|
friend WindowManager;
|
|
|
|
|
2021-05-02 18:22:38 +00:00
|
|
|
void initStatusBar();
|
|
|
|
void initWidgets();
|
|
|
|
void initMenu();
|
|
|
|
void initHome();
|
2023-12-02 18:28:31 +00:00
|
|
|
void initOffline();
|
2021-05-02 18:22:38 +00:00
|
|
|
void initWalletContext();
|
|
|
|
|
2020-10-07 10:36:04 +00:00
|
|
|
void closeEvent(QCloseEvent *event) override;
|
2021-05-18 15:59:18 +00:00
|
|
|
|
2020-10-07 10:36:04 +00:00
|
|
|
void saveGeo();
|
|
|
|
void restoreGeo();
|
|
|
|
void showDebugInfo();
|
2020-11-14 09:57:06 +00:00
|
|
|
void updatePasswordIcon();
|
2020-11-23 16:57:38 +00:00
|
|
|
void updateNetStats();
|
2020-12-14 19:44:37 +00:00
|
|
|
void rescanSpent();
|
2020-12-31 00:00:37 +00:00
|
|
|
void setStatusText(const QString &text, bool override = false, int timeout = 1000);
|
2020-12-25 14:20:39 +00:00
|
|
|
void showBalanceDialog();
|
2020-12-24 14:46:56 +00:00
|
|
|
QString statusDots();
|
2021-05-02 18:22:38 +00:00
|
|
|
QString getHardwareDevice();
|
2021-05-23 13:58:28 +00:00
|
|
|
void updateTitle();
|
2021-05-18 15:59:18 +00:00
|
|
|
void donationNag();
|
2023-01-26 15:05:54 +00:00
|
|
|
void addToRecentlyOpened(QString filename);
|
2021-07-08 12:03:54 +00:00
|
|
|
void updateRecentlyOpenedMenu();
|
2021-06-25 14:14:49 +00:00
|
|
|
void updateWidgetIcons();
|
2023-01-09 02:17:25 +00:00
|
|
|
bool verifyPassword(bool sensitive = true);
|
2022-06-23 17:48:30 +00:00
|
|
|
void fillSendTab(const QString &address, const QString &description);
|
2022-03-04 16:20:17 +00:00
|
|
|
void userActivity();
|
|
|
|
void checkUserActivity();
|
2023-01-19 14:12:16 +00:00
|
|
|
void lockWallet();
|
|
|
|
void unlockWallet(const QString &password);
|
|
|
|
void closeQDialogChildren(QObject *object);
|
2020-10-07 10:36:04 +00:00
|
|
|
|
2021-07-01 21:00:47 +00:00
|
|
|
QIcon hardwareDevicePairedIcon();
|
|
|
|
QIcon hardwareDeviceUnpairedIcon();
|
|
|
|
|
2021-06-27 12:13:05 +00:00
|
|
|
QScopedPointer<Ui::MainWindow> ui;
|
2021-05-18 15:59:18 +00:00
|
|
|
WindowManager *m_windowManager;
|
2023-03-01 02:05:56 +00:00
|
|
|
Wallet *m_wallet = nullptr;
|
|
|
|
Nodes *m_nodes;
|
|
|
|
DaemonRpc *m_rpc;
|
2021-05-10 13:20:33 +00:00
|
|
|
|
2020-10-07 10:36:04 +00:00
|
|
|
CalcWindow *m_windowCalc = nullptr;
|
2021-05-02 18:22:38 +00:00
|
|
|
SplashDialog *m_splashDialog = nullptr;
|
2023-01-17 21:06:08 +00:00
|
|
|
AccountSwitcherDialog *m_accountSwitcherDialog = nullptr;
|
2021-05-02 18:22:38 +00:00
|
|
|
|
2023-01-19 14:12:16 +00:00
|
|
|
WalletUnlockWidget *m_walletUnlockWidget = nullptr;
|
2021-06-14 18:01:40 +00:00
|
|
|
#ifdef HAS_XMRIG
|
2021-05-18 15:59:18 +00:00
|
|
|
XMRigWidget *m_xmrig = nullptr;
|
2021-06-14 18:01:40 +00:00
|
|
|
#endif
|
2021-05-18 15:59:18 +00:00
|
|
|
ContactsWidget *m_contactsWidget = nullptr;
|
|
|
|
HistoryWidget *m_historyWidget = nullptr;
|
2021-05-10 15:05:10 +00:00
|
|
|
SendWidget *m_sendWidget = nullptr;
|
2021-05-18 15:59:18 +00:00
|
|
|
ReceiveWidget *m_receiveWidget = nullptr;
|
2021-05-10 15:05:10 +00:00
|
|
|
CoinsWidget *m_coinsWidget = nullptr;
|
2021-05-02 18:22:38 +00:00
|
|
|
#ifdef HAS_LOCALMONERO
|
|
|
|
LocalMoneroWidget *m_localMoneroWidget = nullptr;
|
|
|
|
#endif
|
2020-10-07 10:36:04 +00:00
|
|
|
|
2022-06-10 11:42:55 +00:00
|
|
|
QList<TickerWidgetBase*> m_tickerWidgets;
|
2021-05-24 23:10:45 +00:00
|
|
|
BalanceTickerWidget *m_balanceTickerWidget;
|
2020-10-07 10:36:04 +00:00
|
|
|
|
2021-07-08 12:03:54 +00:00
|
|
|
QPointer<QAction> m_clearRecentlyOpenAction;
|
|
|
|
|
2020-10-07 10:36:04 +00:00
|
|
|
// lower status bar
|
2021-05-02 18:22:38 +00:00
|
|
|
QPushButton *m_statusUpdateAvailable;
|
2020-12-25 14:20:39 +00:00
|
|
|
ClickableLabel *m_statusLabelBalance;
|
2020-10-07 10:36:04 +00:00
|
|
|
QLabel *m_statusLabelStatus;
|
2020-11-23 16:57:38 +00:00
|
|
|
QLabel *m_statusLabelNetStats;
|
2021-05-22 13:42:26 +00:00
|
|
|
StatusBarButton *m_statusAccountSwitcher;
|
2020-10-07 10:36:04 +00:00
|
|
|
StatusBarButton *m_statusBtnConnectionStatusIndicator;
|
|
|
|
StatusBarButton *m_statusBtnPassword;
|
|
|
|
StatusBarButton *m_statusBtnPreferences;
|
|
|
|
StatusBarButton *m_statusBtnSeed;
|
2023-02-11 17:11:21 +00:00
|
|
|
StatusBarButton *m_statusBtnProxySettings;
|
2021-05-02 18:22:38 +00:00
|
|
|
StatusBarButton *m_statusBtnHwDevice;
|
2020-10-07 10:36:04 +00:00
|
|
|
|
|
|
|
QSignalMapper *m_tabShowHideSignalMapper;
|
|
|
|
QMap<QString, ToggleTab*> m_tabShowHideMapper;
|
|
|
|
|
2020-11-23 16:57:38 +00:00
|
|
|
QTimer m_updateBytes;
|
2022-03-04 16:20:17 +00:00
|
|
|
QTimer m_checkUserActivity;
|
2020-11-23 16:57:38 +00:00
|
|
|
|
2020-12-24 14:46:56 +00:00
|
|
|
QString m_statusText;
|
|
|
|
int m_statusDots;
|
|
|
|
bool m_constructingTransaction = false;
|
2020-12-31 00:00:37 +00:00
|
|
|
bool m_statusOverrideActive = false;
|
2021-05-02 18:22:38 +00:00
|
|
|
bool m_showDeviceError = false;
|
2020-12-24 14:46:56 +00:00
|
|
|
QTimer m_txTimer;
|
|
|
|
|
2021-05-18 15:59:18 +00:00
|
|
|
bool cleanedUp = false;
|
2023-01-19 14:12:16 +00:00
|
|
|
bool m_locked = false;
|
2022-03-12 12:53:46 +00:00
|
|
|
bool m_criticalWarningShown = false;
|
2022-03-04 16:20:17 +00:00
|
|
|
|
|
|
|
EventFilter *m_eventFilter = nullptr;
|
|
|
|
qint64 m_userLastActive = QDateTime::currentSecsSinceEpoch();
|
2023-02-01 14:40:12 +00:00
|
|
|
|
2023-04-19 15:41:46 +00:00
|
|
|
#ifdef CHECK_UPDATES
|
2023-02-01 14:40:12 +00:00
|
|
|
QSharedPointer<Updater> m_updater = nullptr;
|
2023-04-19 15:41:46 +00:00
|
|
|
#endif
|
2020-10-07 10:36:04 +00:00
|
|
|
};
|
|
|
|
|
2021-06-27 12:51:15 +00:00
|
|
|
#endif // FEATHER_MAINWINDOW_H
|