12 #include <QResizeEvent> 13 #include <QPropertyAnimation> 19 bestHeaderDate(QDateTime()),
20 layerIsVisible(false),
27 parent->installEventFilter(
this);
41 if (obj == parent()) {
42 if (ev->type() == QEvent::Resize) {
43 QResizeEvent * rev =
static_cast<QResizeEvent*
>(ev);
46 setGeometry(0, height(), width(), height());
49 else if (ev->type() == QEvent::ChildAdded) {
53 return QWidget::eventFilter(obj, ev);
58 if (ev->type() == QEvent::ParentAboutToChange) {
59 if (parent()) parent()->removeEventFilter(
this);
61 else if (ev->type() == QEvent::ParentChange) {
63 parent()->installEventFilter(
this);
67 return QWidget::event(ev);
80 QDateTime currentDate = QDateTime::currentDateTime();
83 blockProcessTime.push_front(qMakePair(currentDate.toMSecsSinceEpoch(), nVerificationProgress));
87 double progressDelta = 0;
88 double progressPerHour = 0;
90 qint64 remainingMSecs = 0;
91 double remainingProgress = 1.0 - nVerificationProgress;
96 if (sample.first < (currentDate.toMSecsSinceEpoch() - 500 * 1000) || i ==
blockProcessTime.size() - 1) {
99 progressPerHour = progressDelta / (double) timeDelta * 1000 * 3600;
100 remainingMSecs = (progressDelta > 0) ? remainingProgress / progressDelta * timeDelta : -1;
108 if(remainingMSecs >= 0) {
114 static const int MAX_SAMPLES = 5000;
160 if (!isVisible() && !hide)
163 setGeometry(0, hide ? 0 : height(), width(), height());
165 QPropertyAnimation* animation =
new QPropertyAnimation(
this,
"pos");
166 animation->setDuration(300);
167 animation->setStartValue(QPoint(0, hide ? 0 : this->height()));
168 animation->setEndValue(QPoint(0, hide ? this->height() : 0));
169 animation->setEasingCurve(QEasingCurve::OutQuad);
170 animation->start(QAbstractAnimation::DeleteWhenStopped);
bool eventFilter(QObject *obj, QEvent *ev)
void setKnownBestHeight(int count, const QDateTime &blockDate)
void setupUi(ModalOverlay *ModalOverlay)
const Consensus::Params & GetConsensus() const
QVector< QPair< qint64, double > > blockProcessTime
QLabel * expectedTimeLeft
static constexpr int HEADER_HEIGHT_DELTA_SYNC
The required delta of headers to the estimated number of available headers until we show the IBD prog...
QLabel * progressIncreasePerH
void showHide(bool hide=false, bool userRequested=false)
int64_t nPowTargetSpacing
QLabel * numberOfBlocksLeft
QString formatNiceTimeOffset(qint64 secs)
QPushButton * closeButton
bool event(QEvent *ev)
Tracks parent widget changes.
const CChainParams & Params()
QProgressBar * progressBar
void tipUpdate(int count, const QDateTime &blockDate, double nVerificationProgress)
QLabel * percentageProgress
ModalOverlay(QWidget *parent)