5 #if defined(HAVE_CONFIG_H)
10 #include <qt/forms/ui_modaloverlay.h>
12 #include <chainparams.h>
15 #include <QEasingCurve>
16 #include <QPropertyAnimation>
17 #include <QResizeEvent>
22 bestHeaderDate(QDateTime())
27 parent->installEventFilter(
this);
34 ui->infoText->setVisible(
false);
35 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));
50 if (obj == parent()) {
51 if (ev->type() == QEvent::Resize) {
52 QResizeEvent * rev =
static_cast<QResizeEvent*
>(ev);
55 setGeometry(0, height(), width(), height());
61 else if (ev->type() == QEvent::ChildAdded) {
65 return QWidget::eventFilter(obj, ev);
70 if (ev->type() == QEvent::ParentAboutToChange) {
71 if (parent()) parent()->removeEventFilter(
this);
73 else if (ev->type() == QEvent::ParentChange) {
75 parent()->installEventFilter(
this);
79 return QWidget::event(ev);
96 QDateTime currentDate = QDateTime::currentDateTime();
99 blockProcessTime.push_front(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) || i ==
blockProcessTime.size() - 1) {
115 progressPerHour = (progressDelta > 0) ? progressDelta / (
double)timeDelta * 1000 * 3600 : 0;
116 remainingMSecs = (progressDelta > 0) ? remainingProgress / progressDelta * timeDelta : -1;
121 ui->progressIncreasePerH->setText(QString::number(progressPerHour * 100,
'f', 2)+
"%");
124 if(remainingMSecs >= 0) {
127 ui->expectedTimeLeft->setText(QObject::tr(
"unknown"));
130 static const int MAX_SAMPLES = 5000;
137 ui->newestBlockDate->setText(blockDate.toString());
140 ui->percentageProgress->setText(QString::number(nVerificationProgress*100,
'f', 2)+
"%");
156 ui->expectedTimeLeft->setText(tr(
"Unknown…"));
167 ui->numberOfBlocksLeft->setText(tr(
"Unknown. Pre-syncing Headers (%1, %2%)…").arg(height).arg(QString::number(100.0 / (height + est_headers_left) * height,
'f', 1)));
184 if (!isVisible() && !hide)
187 m_animation.setStartValue(QPoint(0, hide ? 0 : height()));
189 m_animation.setEndValue(QPoint(0, hide ? height() : 0));
190 m_animation.start(QAbstractAnimation::KeepWhenStopped);
const CChainParams & Params()
Return the currently selected parameters.
const Consensus::Params & GetConsensus() const
Modal overlay to display information about the chain-sync state.
void showHide(bool hide=false, bool userRequested=false)
bool event(QEvent *ev) override
Tracks parent widget changes.
void tipUpdate(int count, const QDateTime &blockDate, double nVerificationProgress)
void UpdateHeaderSyncLabel()
ModalOverlay(bool enable_wallet, QWidget *parent)
void triggered(bool hidden)
void setKnownBestHeight(int count, const QDateTime &blockDate, bool presync)
QVector< QPair< qint64, double > > blockProcessTime
bool eventFilter(QObject *obj, QEvent *ev) override
void UpdateHeaderPresyncLabel(int height, const QDateTime &blockDate)
QPropertyAnimation m_animation
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...
QString formatNiceTimeOffset(qint64 secs)
int64_t nPowTargetSpacing