Changeset View
Changeset View
Standalone View
Standalone View
src/qt/splashscreen.h
// Copyright (c) 2011-2016 The Bitcoin Core developers | // Copyright (c) 2011-2016 The Bitcoin Core developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#ifndef BITCOIN_QT_SPLASHSCREEN_H | #ifndef BITCOIN_QT_SPLASHSCREEN_H | ||||
#define BITCOIN_QT_SPLASHSCREEN_H | #define BITCOIN_QT_SPLASHSCREEN_H | ||||
#include <QSplashScreen> | #include <QSplashScreen> | ||||
#include <functional> | #include <functional> | ||||
class CWallet; | #include <memory> | ||||
class NetworkStyle; | class NetworkStyle; | ||||
namespace interfaces { | |||||
class Handler; | |||||
class Node; | |||||
class Wallet; | |||||
}; | |||||
/** Class for the splashscreen with information of the running client. | /** Class for the splashscreen with information of the running client. | ||||
* | * | ||||
* @note this is intentionally not a QSplashScreen. Bitcoin Core initialization | * @note this is intentionally not a QSplashScreen. Bitcoin Core initialization | ||||
* can take a long time, and in that case a progress window that cannot be moved | * can take a long time, and in that case a progress window that cannot be moved | ||||
* around and minimized has turned out to be frustrating to the user. | * around and minimized has turned out to be frustrating to the user. | ||||
*/ | */ | ||||
class SplashScreen : public QWidget { | class SplashScreen : public QWidget { | ||||
Q_OBJECT | Q_OBJECT | ||||
public: | public: | ||||
explicit SplashScreen(Qt::WindowFlags f, const NetworkStyle *networkStyle); | explicit SplashScreen(interfaces::Node &node, Qt::WindowFlags f, | ||||
const NetworkStyle *networkStyle); | |||||
~SplashScreen(); | ~SplashScreen(); | ||||
protected: | protected: | ||||
void paintEvent(QPaintEvent *event) override; | void paintEvent(QPaintEvent *event) override; | ||||
void closeEvent(QCloseEvent *event) override; | void closeEvent(QCloseEvent *event) override; | ||||
public Q_SLOTS: | public Q_SLOTS: | ||||
/** Slot to call finish() method as it's not defined as slot */ | /** Slot to call finish() method as it's not defined as slot */ | ||||
void slotFinish(QWidget *mainWin); | void slotFinish(QWidget *mainWin); | ||||
/** Show message and progress */ | /** Show message and progress */ | ||||
void showMessage(const QString &message, int alignment, | void showMessage(const QString &message, int alignment, | ||||
const QColor &color); | const QColor &color); | ||||
protected: | protected: | ||||
bool eventFilter(QObject *obj, QEvent *ev) override; | bool eventFilter(QObject *obj, QEvent *ev) override; | ||||
private: | private: | ||||
/** Connect core signals to splash screen */ | /** Connect core signals to splash screen */ | ||||
void subscribeToCoreSignals(); | void subscribeToCoreSignals(); | ||||
/** Disconnect core signals to splash screen */ | /** Disconnect core signals to splash screen */ | ||||
void unsubscribeFromCoreSignals(); | void unsubscribeFromCoreSignals(); | ||||
/** Connect wallet signals to splash screen */ | /** Connect wallet signals to splash screen */ | ||||
void ConnectWallet(CWallet *); | void ConnectWallet(std::unique_ptr<interfaces::Wallet> wallet); | ||||
QPixmap pixmap; | QPixmap pixmap; | ||||
QString curMessage; | QString curMessage; | ||||
QColor curColor; | QColor curColor; | ||||
int curAlignment; | int curAlignment; | ||||
QList<CWallet *> connectedWallets; | interfaces::Node &m_node; | ||||
std::unique_ptr<interfaces::Handler> m_handler_init_message; | |||||
std::unique_ptr<interfaces::Handler> m_handler_show_progress; | |||||
std::unique_ptr<interfaces::Handler> m_handler_load_wallet; | |||||
std::list<std::unique_ptr<interfaces::Wallet>> m_connected_wallets; | |||||
std::list<std::unique_ptr<interfaces::Handler>> m_connected_wallet_handlers; | |||||
}; | }; | ||||
#endif // BITCOIN_QT_SPLASHSCREEN_H | #endif // BITCOIN_QT_SPLASHSCREEN_H |