2020-12-31 05:48:25 -03:00
|
|
|
// Copyright (c) 2011-2020 The Bitcoin Core developers
|
2014-12-13 01:09:33 -03:00
|
|
|
// Distributed under the MIT software license, see the accompanying
|
2013-11-04 12:20:43 -03:00
|
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
|
2014-11-03 12:16:40 -03:00
|
|
|
#ifndef BITCOIN_QT_SPLASHSCREEN_H
|
|
|
|
#define BITCOIN_QT_SPLASHSCREEN_H
|
2013-04-14 06:35:37 -03:00
|
|
|
|
2018-12-01 20:26:28 -03:00
|
|
|
#include <QWidget>
|
2013-04-14 06:35:37 -03:00
|
|
|
|
2017-04-17 16:10:47 -03:00
|
|
|
#include <memory>
|
|
|
|
|
2014-10-09 06:04:49 -03:00
|
|
|
class NetworkStyle;
|
|
|
|
|
2018-04-07 04:42:02 -03:00
|
|
|
namespace interfaces {
|
2017-04-17 16:10:47 -03:00
|
|
|
class Handler;
|
|
|
|
class Node;
|
|
|
|
class Wallet;
|
|
|
|
};
|
|
|
|
|
2014-09-22 05:08:47 -03:00
|
|
|
/** Class for the splashscreen with information of the running client.
|
|
|
|
*
|
|
|
|
* @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 around and minimized has turned out to be frustrating to the user.
|
2013-04-14 06:35:37 -03:00
|
|
|
*/
|
2014-09-18 08:14:38 -03:00
|
|
|
class SplashScreen : public QWidget
|
2013-04-14 06:35:37 -03:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2020-08-09 11:33:54 -04:00
|
|
|
explicit SplashScreen(const NetworkStyle *networkStyle);
|
2014-01-08 04:59:24 -03:00
|
|
|
~SplashScreen();
|
2018-08-23 14:42:31 -03:00
|
|
|
void setNode(interfaces::Node& node);
|
2014-01-08 04:59:24 -03:00
|
|
|
|
2014-09-18 08:14:38 -03:00
|
|
|
protected:
|
2020-03-14 03:49:59 -03:00
|
|
|
void paintEvent(QPaintEvent *event) override;
|
|
|
|
void closeEvent(QCloseEvent *event) override;
|
2014-09-18 08:14:38 -03:00
|
|
|
|
2015-07-14 08:59:05 -03:00
|
|
|
public Q_SLOTS:
|
2018-12-01 20:26:28 -03:00
|
|
|
/** Hide the splash screen window and schedule the splash screen object for deletion */
|
|
|
|
void finish();
|
2014-01-08 04:59:24 -03:00
|
|
|
|
2014-09-18 08:14:38 -03:00
|
|
|
/** Show message and progress */
|
|
|
|
void showMessage(const QString &message, int alignment, const QColor &color);
|
|
|
|
|
2020-05-28 09:48:30 -04:00
|
|
|
/** Handle wallet load notifications. */
|
|
|
|
void handleLoadWallet();
|
|
|
|
|
2017-06-23 03:32:38 -04:00
|
|
|
protected:
|
2020-03-14 03:49:59 -03:00
|
|
|
bool eventFilter(QObject * obj, QEvent * ev) override;
|
2017-06-23 03:32:38 -04:00
|
|
|
|
2014-01-08 04:59:24 -03:00
|
|
|
private:
|
|
|
|
/** Connect core signals to splash screen */
|
|
|
|
void subscribeToCoreSignals();
|
|
|
|
/** Disconnect core signals to splash screen */
|
|
|
|
void unsubscribeFromCoreSignals();
|
2018-08-23 14:42:31 -03:00
|
|
|
/** Initiate shutdown */
|
|
|
|
void shutdown();
|
2014-09-18 08:14:38 -03:00
|
|
|
|
|
|
|
QPixmap pixmap;
|
|
|
|
QString curMessage;
|
|
|
|
QColor curColor;
|
|
|
|
int curAlignment;
|
2016-09-08 16:58:30 -03:00
|
|
|
|
2018-08-23 14:42:31 -03:00
|
|
|
interfaces::Node* m_node = nullptr;
|
2020-07-06 10:36:15 -04:00
|
|
|
bool m_shutdown = false;
|
2018-04-07 04:42:02 -03:00
|
|
|
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;
|
2013-04-14 06:35:37 -03:00
|
|
|
};
|
|
|
|
|
2014-11-03 12:16:40 -03:00
|
|
|
#endif // BITCOIN_QT_SPLASHSCREEN_H
|