17 bestHeaderDate(QDateTime()), layerIsVisible(false), userClosed(false) {
19 connect(
ui->closeButton, &QPushButton::clicked,
this,
22 parent->installEventFilter(
this);
29 ui->infoText->setVisible(
false);
30 ui->infoTextStrong->setText(
31 tr(
"%1 is currently syncing. It will download headers "
32 "and blocks from peers and validate them until reaching the tip "
33 "of the block chain.")
48 if (obj == parent()) {
49 if (ev->type() == QEvent::Resize) {
50 QResizeEvent *rev =
static_cast<QResizeEvent *
>(ev);
53 setGeometry(0, height(), width(), height());
59 }
else if (ev->type() == QEvent::ChildAdded) {
63 return QWidget::eventFilter(obj, ev);
94 double nVerificationProgress) {
95 QDateTime currentDate = QDateTime::currentDateTime();
99 qMakePair(currentDate.toMSecsSinceEpoch(), nVerificationProgress));
103 double progressDelta = 0;
104 double progressPerHour = 0;
105 qint64 timeDelta = 0;
106 qint64 remainingMSecs = 0;
107 double remainingProgress = 1.0 - nVerificationProgress;
112 if (sample.first < (currentDate.toMSecsSinceEpoch() - 500 * 1000) ||
117 progressDelta / (double)timeDelta * 1000 * 3600;
120 ? remainingProgress / progressDelta * timeDelta
126 ui->progressIncreasePerH->setText(
127 QString::number(progressPerHour * 100,
'f', 2) +
"%");
130 if (remainingMSecs >= 0) {
131 ui->expectedTimeLeft->setText(
134 ui->expectedTimeLeft->setText(QObject::tr(
"unknown"));
137 static const int MAX_SAMPLES = 5000;
145 ui->newestBlockDate->setText(blockDate.toString());
148 ui->percentageProgress->setText(
149 QString::number(nVerificationProgress * 100,
'f', 2) +
"%");
150 ui->progressBar->setValue(nVerificationProgress * 100);
165 ui->numberOfBlocksLeft->setText(
169 ui->expectedTimeLeft->setText(tr(
"Unknown..."));