13 #include <QResizeEvent> 14 #include <QPropertyAnimation> 20 bestHeaderDate(QDateTime()),
21 layerIsVisible(false),
34 parent->installEventFilter(
this);
50 if (obj == parent()) {
51 if (ev->type() == QEvent::Resize) {
52 QResizeEvent * rev =
static_cast<QResizeEvent*
>(ev);
55 setGeometry(0, height(), width(), height());
58 else if (ev->type() == QEvent::ChildAdded) {
62 return QWidget::eventFilter(obj, ev);
67 if (ev->type() == QEvent::ParentAboutToChange) {
68 if (parent()) parent()->removeEventFilter(
this);
70 else if (ev->type() == QEvent::ParentChange) {
72 parent()->installEventFilter(
this);
76 return QWidget::event(ev);
89 QDateTime currentDate = QDateTime::currentDateTime();
92 blockProcessTime.push_front(qMakePair(currentDate.toMSecsSinceEpoch(), nVerificationProgress));
98 double progressDelta = 0;
99 double progressPerHour = 0;
100 qint64 timeDelta = 0;
101 qint64 remainingMSecs = 0;
102 double remainingProgress = 1.0 - nVerificationProgress;
108 if (sample.first < (currentDate.toMSecsSinceEpoch() - 500 * 1000) || i ==
blockProcessTime.size() - 1) {
109 progressDelta = progressStart-sample.second;
111 progressPerHour = progressDelta/(double)timeDelta*1000*3600;
112 remainingMSecs = (progressDelta > 0) ? remainingProgress / progressDelta * timeDelta : -1;
119 if(remainingMSecs >= 0) {
125 static const int MAX_SAMPLES = 5000;
147 if (estimateNumHeadersLeft < HEADER_HEIGHT_DELTA_SYNC && hasBestHeader) {
167 if (!isVisible() && !hide)
170 setGeometry(0, hide ? 0 : height(), width(), height());
172 QPropertyAnimation* animation =
new QPropertyAnimation(
this,
"pos");
173 animation->setDuration(300);
174 animation->setStartValue(QPoint(0, hide ? 0 : this->height()));
175 animation->setEndValue(QPoint(0, hide ? this->height() : 0));
176 animation->setEasingCurve(QEasingCurve::OutQuad);
177 animation->start(QAbstractAnimation::DeleteWhenStopped);
QLabel * percentageProgress
#define SetObjectStyleSheet(object, name)
QPushButton * warningIcon
QProgressBar * progressBar
bool event(QEvent *ev)
Tracks parent widget changes.
bool eventFilter(QObject *obj, QEvent *ev)
void tipUpdate(int count, const QDateTime &blockDate, double nVerificationProgress)
Modal overlay to display information about the chain-sync state.
ModalOverlay(QWidget *parent, OverlayType _type=OverlayType::Sync)
QLabel * expectedTimeLeft
int64_t GetnPowTargetSpacing(uint32_t nHeight=0) const
void backupWalletClicked()
void setKnownBestHeight(int count, const QDateTime &blockDate)
void setupUi(ModalOverlay *ModalOverlay)
QLabel * progressIncreasePerH
QStackedWidget * stackedWidget
QPushButton * warningIconBackup
QLabel * numberOfBlocksLeft
void showHide(bool hide=false, bool userRequested=false)
PlatformStyle::TableColorType type
QPushButton * closeButton
const CChainParams & Params()
Return the currently selected parameters.
QVector< QPair< qint64, double > > blockProcessTime
QString formatNiceTimeOffset(qint64 secs)
QPushButton * walletBackupButton