2021-05-18 15:59:18 +00:00
|
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
2024-01-01 17:07:58 +00:00
|
|
|
// SPDX-FileCopyrightText: 2020-2024 The Monero Project
|
2021-05-18 15:59:18 +00:00
|
|
|
|
|
|
|
#ifndef FEATHER_WINDOWMANAGER_H
|
|
|
|
#define FEATHER_WINDOWMANAGER_H
|
|
|
|
|
|
|
|
#include <QObject>
|
2021-06-28 17:48:23 +00:00
|
|
|
|
2023-09-12 14:15:40 +00:00
|
|
|
#include "dialog/DocsDialog.h"
|
2021-06-28 17:48:23 +00:00
|
|
|
#include "dialog/TorInfoDialog.h"
|
2021-05-18 15:59:18 +00:00
|
|
|
#include "libwalletqt/WalletManager.h"
|
|
|
|
#include "libwalletqt/Wallet.h"
|
2021-06-28 17:48:23 +00:00
|
|
|
#include "MainWindow.h"
|
2023-03-01 02:05:56 +00:00
|
|
|
#include "utils/nodes.h"
|
2021-05-18 15:59:18 +00:00
|
|
|
#include "wizard/WalletWizard.h"
|
2023-09-12 14:15:40 +00:00
|
|
|
#include "Utils.h"
|
2021-05-18 15:59:18 +00:00
|
|
|
|
|
|
|
class MainWindow;
|
|
|
|
class WindowManager : public QObject {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2023-09-12 14:15:40 +00:00
|
|
|
explicit WindowManager(QObject *parent);
|
2021-07-11 15:55:42 +00:00
|
|
|
~WindowManager() override;
|
2021-05-18 15:59:18 +00:00
|
|
|
|
2023-09-12 14:15:40 +00:00
|
|
|
void setEventFilter(EventFilter *eventFilter);
|
|
|
|
|
2021-05-18 15:59:18 +00:00
|
|
|
void wizardOpenWallet();
|
|
|
|
void close();
|
|
|
|
void closeWindow(MainWindow *window);
|
|
|
|
void showWizard(WalletWizard::Page startPage);
|
|
|
|
void restartApplication(const QString &binaryFilename);
|
2022-03-03 22:27:54 +00:00
|
|
|
void raise();
|
2021-05-18 15:59:18 +00:00
|
|
|
|
2023-03-01 02:05:56 +00:00
|
|
|
void showSettings(Nodes *nodes, QWidget *parent, bool showProxyTab = false);
|
2023-02-11 17:11:21 +00:00
|
|
|
|
2023-09-12 14:15:40 +00:00
|
|
|
void showDocs(QObject *parent, const QString &doc = "", bool modal = false);
|
|
|
|
void setDocsHighlight(const QString &highlight);
|
|
|
|
|
2023-03-29 08:46:53 +00:00
|
|
|
void notify(const QString &title, const QString &message, int duration);
|
|
|
|
|
2022-03-04 16:20:17 +00:00
|
|
|
EventFilter *eventFilter;
|
|
|
|
|
2023-09-12 14:15:40 +00:00
|
|
|
static WindowManager* instance();
|
|
|
|
|
2021-05-18 15:59:18 +00:00
|
|
|
signals:
|
2023-02-11 17:11:21 +00:00
|
|
|
void proxySettingsChanged();
|
2022-03-15 12:36:20 +00:00
|
|
|
void websocketStatusChanged(bool enabled);
|
2023-02-11 17:11:21 +00:00
|
|
|
void updateBalance();
|
2023-11-30 14:01:39 +00:00
|
|
|
void preferredFiatCurrencyChanged();
|
2023-02-11 17:11:21 +00:00
|
|
|
void offlineMode(bool offline);
|
2023-11-30 14:01:39 +00:00
|
|
|
void pluginConfigured(const QString &id);
|
2024-04-28 19:26:54 +00:00
|
|
|
void manualFeeSelectionEnabled(bool enabled);
|
|
|
|
void subtractFeeFromAmountEnabled(bool enabled);
|
2021-05-18 15:59:18 +00:00
|
|
|
|
|
|
|
public slots:
|
2023-02-11 17:11:21 +00:00
|
|
|
void onProxySettingsChanged();
|
2022-03-15 12:36:20 +00:00
|
|
|
void onWebsocketStatusChanged(bool enabled);
|
2021-05-18 15:59:18 +00:00
|
|
|
void tryOpenWallet(const QString &path, const QString &password);
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void onWalletOpened(Wallet *wallet);
|
|
|
|
void onWalletCreated(Wallet *wallet);
|
|
|
|
void onWalletOpenPasswordRequired(bool invalidPassword, const QString &path);
|
|
|
|
void onInitialNetworkConfigured();
|
|
|
|
void onDeviceButtonRequest(quint64 code);
|
2021-07-07 02:38:15 +00:00
|
|
|
void onDeviceButtonPressed();
|
2021-05-18 15:59:18 +00:00
|
|
|
void onDeviceError(const QString &errorMessage);
|
2021-07-08 00:34:27 +00:00
|
|
|
void onWalletPassphraseNeeded(bool on_device);
|
2023-02-11 17:11:21 +00:00
|
|
|
void onChangeTheme(const QString &themeName);
|
2021-05-18 15:59:18 +00:00
|
|
|
|
|
|
|
private:
|
2023-03-03 22:15:06 +00:00
|
|
|
void tryCreateWallet(Seed seed, const QString &path, const QString &password, const QString &seedLanguage, const QString &seedOffset, const QString &subaddressLookahead, bool newWallet);
|
2023-01-24 21:35:47 +00:00
|
|
|
void tryCreateWalletFromDevice(const QString &path, const QString &password, const QString &deviceName, int restoreHeight, const QString &subaddressLookahead);
|
|
|
|
void tryCreateWalletFromKeys(const QString &path, const QString &password, const QString &address, const QString &viewkey, const QString &spendkey, quint64 restoreHeight, const QString &subaddressLookahead);
|
2021-05-18 15:59:18 +00:00
|
|
|
|
|
|
|
bool autoOpenWallet();
|
|
|
|
|
|
|
|
void initWizard();
|
2023-02-11 17:11:21 +00:00
|
|
|
WalletWizard* createWizard(WalletWizard::Page startPage);
|
2021-05-18 15:59:18 +00:00
|
|
|
|
2023-09-12 14:15:40 +00:00
|
|
|
void handleWalletError(const Utils::Message &message);
|
2024-04-19 11:14:29 +00:00
|
|
|
void handleDeviceError(const QString &error, Utils::Message &msg);
|
2021-05-18 15:59:18 +00:00
|
|
|
void displayWalletErrorMessage(const QString &message);
|
|
|
|
|
|
|
|
void initSkins();
|
|
|
|
QString loadStylesheet(const QString &resource);
|
2023-02-11 17:11:21 +00:00
|
|
|
void patchMacStylesheet();
|
|
|
|
|
2021-05-18 15:59:18 +00:00
|
|
|
void buildTrayMenu();
|
2021-05-26 23:20:37 +00:00
|
|
|
void startupWarning();
|
|
|
|
void showWarningMessageBox(const QString &title, const QString &message);
|
2023-01-26 12:12:33 +00:00
|
|
|
void showCrashLogs();
|
2021-05-18 15:59:18 +00:00
|
|
|
|
|
|
|
void quitAfterLastWindow();
|
|
|
|
|
2023-09-12 14:15:40 +00:00
|
|
|
static QPointer<WindowManager> m_instance;
|
|
|
|
|
2021-05-18 15:59:18 +00:00
|
|
|
QVector<MainWindow*> m_windows;
|
|
|
|
|
|
|
|
WalletManager *m_walletManager;
|
|
|
|
WalletWizard *m_wizard = nullptr;
|
|
|
|
SplashDialog *m_splashDialog = nullptr;
|
2023-09-12 14:15:40 +00:00
|
|
|
DocsDialog *m_docsDialog = nullptr;
|
2021-05-18 15:59:18 +00:00
|
|
|
|
2024-04-02 23:28:19 +00:00
|
|
|
QSystemTrayIcon *m_tray = nullptr;
|
2021-05-18 15:59:18 +00:00
|
|
|
|
|
|
|
QMap<QString, QString> m_skins;
|
|
|
|
|
|
|
|
bool m_openWalletTriedOnce = false;
|
|
|
|
bool m_openingWallet = false;
|
2021-05-26 22:24:35 +00:00
|
|
|
bool m_initialNetworkConfigured = false;
|
2021-07-03 01:29:13 +00:00
|
|
|
|
|
|
|
QThread *m_cleanupThread;
|
2021-05-18 15:59:18 +00:00
|
|
|
};
|
|
|
|
|
2023-09-12 14:15:40 +00:00
|
|
|
inline WindowManager* windowManager()
|
|
|
|
{
|
|
|
|
return WindowManager::instance();
|
|
|
|
}
|
2021-05-18 15:59:18 +00:00
|
|
|
|
|
|
|
#endif //FEATHER_WINDOWMANAGER_H
|