Line data Source code
1 : // Copyright (c) 2016-2019 The Bitcoin Core developers 2 : // Distributed under the MIT software license, see the accompanying 3 : // file COPYING or http://www.opensource.org/licenses/mit-license.php. 4 : 5 : #ifndef BITCOIN_QT_MODALOVERLAY_H 6 : #define BITCOIN_QT_MODALOVERLAY_H 7 : 8 : #include <QDateTime> 9 : #include <QPropertyAnimation> 10 : #include <QWidget> 11 : 12 : //! The required delta of headers to the estimated number of available headers until we show the IBD progress 13 : static constexpr int HEADER_HEIGHT_DELTA_SYNC = 24; 14 : 15 : namespace Ui { 16 : class ModalOverlay; 17 : } 18 : 19 : /** Modal overlay to display information about the chain-sync state */ 20 : class ModalOverlay : public QWidget 21 : { 22 0 : Q_OBJECT 23 : 24 : public: 25 : explicit ModalOverlay(bool enable_wallet, QWidget *parent); 26 : ~ModalOverlay(); 27 : 28 : void tipUpdate(int count, const QDateTime& blockDate, double nVerificationProgress); 29 : void setKnownBestHeight(int count, const QDateTime& blockDate); 30 : 31 : // will show or hide the modal layer 32 : void showHide(bool hide = false, bool userRequested = false); 33 0 : bool isLayerVisible() const { return layerIsVisible; } 34 : 35 : public Q_SLOTS: 36 : void toggleVisibility(); 37 : void closeClicked(); 38 : 39 : Q_SIGNALS: 40 : void triggered(bool hidden); 41 : 42 : protected: 43 : bool eventFilter(QObject * obj, QEvent * ev) override; 44 : bool event(QEvent* ev) override; 45 : 46 : private: 47 : Ui::ModalOverlay *ui; 48 : int bestHeaderHeight; //best known height (based on the headers) 49 : QDateTime bestHeaderDate; 50 : QVector<QPair<qint64, double> > blockProcessTime; 51 : bool layerIsVisible; 52 : bool userClosed; 53 : QPropertyAnimation m_animation; 54 : void UpdateHeaderSyncLabel(); 55 : }; 56 : 57 : #endif // BITCOIN_QT_MODALOVERLAY_H