11 #include <QEasingCurve> 12 #include <QPropertyAnimation> 13 #include <QResizeEvent> 19 bestHeaderDate(QDateTime()),
20 layerIsVisible(false),
26 parent->installEventFilter(
this);
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);
95 QDateTime currentDate = QDateTime::currentDateTime();
98 blockProcessTime.push_front(qMakePair(currentDate.toMSecsSinceEpoch(), nVerificationProgress));
102 double progressDelta = 0;
103 double progressPerHour = 0;
104 qint64 timeDelta = 0;
105 qint64 remainingMSecs = 0;
106 double remainingProgress = 1.0 - nVerificationProgress;
111 if (sample.first < (currentDate.toMSecsSinceEpoch() - 500 * 1000) || i ==
blockProcessTime.size() - 1) {
114 progressPerHour = (progressDelta > 0) ? progressDelta / (
double)timeDelta * 1000 * 3600 : 0;
115 remainingMSecs = (progressDelta > 0) ? remainingProgress / progressDelta * timeDelta : -1;
123 if(remainingMSecs >= 0) {
129 static const int MAX_SAMPLES = 5000;
166 ui->
numberOfBlocksLeft->setText(tr(
"Unknown. Pre-syncing Headers (%1, %2%)…").arg(height).arg(QString::number(100.0 / (height + est_headers_left) * height,
'f', 1)));
183 if (!isVisible() && !hide)
186 m_animation.setStartValue(QPoint(0, hide ? 0 : height()));
188 m_animation.setEndValue(QPoint(0, hide ? height() : 0));
189 m_animation.start(QAbstractAnimation::KeepWhenStopped);
QLabel * percentageProgress
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...
void triggered(bool hidden)
void tipUpdate(int count, const QDateTime &blockDate, double nVerificationProgress)
void UpdateHeaderSyncLabel()
Modal overlay to display information about the chain-sync state.
QLabel * expectedTimeLeft
void setupUi(QWidget *ModalOverlay)
int64_t nPowTargetSpacing
ModalOverlay(bool enable_wallet, QWidget *parent)
void setKnownBestHeight(int count, const QDateTime &blockDate, bool presync)
bool event(QEvent *ev) override
Tracks parent widget changes.
QLabel * progressIncreasePerH
QLabel * numberOfBlocksLeft
void showHide(bool hide=false, bool userRequested=false)
bool eventFilter(QObject *obj, QEvent *ev) override
QPropertyAnimation m_animation
QPushButton * closeButton
const CChainParams & Params()
Return the currently selected parameters.
QVector< QPair< qint64, double > > blockProcessTime
QString formatNiceTimeOffset(qint64 secs)
const Consensus::Params & GetConsensus() const
void UpdateHeaderPresyncLabel(int height, const QDateTime &blockDate)