6 #include <qt/forms/ui_modaloverlay.h>
11 #include <QEasingCurve>
12 #include <QPropertyAnimation>
13 #include <QResizeEvent>
19 bestHeaderDate(QDateTime()),
20 layerIsVisible(false),
26 parent->installEventFilter(
this);
33 ui->infoText->setVisible(
false);
34 ui->infoTextStrong->setText(tr(
"%1 is currently syncing. It will download headers and blocks from peers and validate them until reaching the tip of the block chain.").arg(
PACKAGE_NAME));
49 if (obj == parent()) {
50 if (ev->type() == QEvent::Resize) {
51 QResizeEvent * rev =
static_cast<QResizeEvent*
>(ev);
54 setGeometry(0, height(), width(), height());
60 else if (ev->type() == QEvent::ChildAdded) {
64 return QWidget::eventFilter(obj, ev);
69 if (ev->type() == QEvent::ParentAboutToChange) {
70 if (parent()) parent()->removeEventFilter(
this);
72 else if (ev->type() == QEvent::ParentChange) {
74 parent()->installEventFilter(
this);
78 return QWidget::event(ev);
92 QDateTime currentDate = QDateTime::currentDateTime();
95 blockProcessTime.push_front(qMakePair(currentDate.toMSecsSinceEpoch(), nVerificationProgress));
99 double progressDelta = 0;
100 double progressPerHour = 0;
101 qint64 timeDelta = 0;
102 qint64 remainingMSecs = 0;
103 double remainingProgress = 1.0 - nVerificationProgress;
108 if (sample.first < (currentDate.toMSecsSinceEpoch() - 500 * 1000) || i ==
blockProcessTime.size() - 1) {
111 progressPerHour = progressDelta / (double) timeDelta * 1000 * 3600;
112 remainingMSecs = (progressDelta > 0) ? remainingProgress / progressDelta * timeDelta : -1;
117 ui->progressIncreasePerH->setText(QString::number(progressPerHour * 100,
'f', 2)+
"%");
120 if(remainingMSecs >= 0) {
123 ui->expectedTimeLeft->setText(QObject::tr(
"unknown"));
126 static const int MAX_SAMPLES = 5000;
133 ui->newestBlockDate->setText(blockDate.toString());
136 ui->percentageProgress->setText(QString::number(nVerificationProgress*100,
'f', 2)+
"%");
137 ui->progressBar->setValue(nVerificationProgress*100);
153 ui->expectedTimeLeft->setText(tr(
"Unknown..."));
176 if (!isVisible() && !hide)
179 m_animation.setStartValue(QPoint(0, hide ? 0 : height()));
181 m_animation.setEndValue(QPoint(0, hide ? height() : 0));
182 m_animation.start(QAbstractAnimation::KeepWhenStopped);