0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-06 10:18:44 -05:00
bitcoin-bitcoin-core/src/qt/modaloverlay.h
Jonas Schnelli beb3844c45
Merge #17968: qt: Ensure that ModalOverlay is resized properly
4fc1df41d5 qt: Track QEvent::Resize during animation (Hennadii Stepanov)

Pull request description:

  In certain circumstances the `ModalOverlay` widget is not sized properly:
  - #17269
  - #17967
  - https://github.com/bitcoin/bitcoin/pull/17968#pullrequestreview-350753107

  On master (f018d0c9cd) this bug looks like this:
  ![DeepinScreenshot_bitcoin-qt_20200120193402](https://user-images.githubusercontent.com/32963518/72748165-298b2a80-3bbf-11ea-810d-2966f08e496a.png)

  With this PR the wallet frame looks ok:
  ![DeepinScreenshot_bitcoin-qt_20200120195241](https://user-images.githubusercontent.com/32963518/72748388-c64dc800-3bbf-11ea-8875-1ba1899b3513.png)

  Fix #17269
  Fix #17967

ACKs for top commit:
  promag:
    Code review ACK 4fc1df41d5.
  jonasschnelli:
    utACK 4fc1df41d5

Tree-SHA512: b5d303fbc139c9383cd22edecba05e51b0d6115631aeb7d4474e973e7250a84019c11c0e41b5200e4d9ab10e17908774b45234317535857dc5314c3c28614ad4
2020-05-29 10:30:36 +02:00

53 lines
1.6 KiB
C++

// Copyright (c) 2016-2019 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_QT_MODALOVERLAY_H
#define BITCOIN_QT_MODALOVERLAY_H
#include <QDateTime>
#include <QPropertyAnimation>
#include <QWidget>
//! The required delta of headers to the estimated number of available headers until we show the IBD progress
static constexpr int HEADER_HEIGHT_DELTA_SYNC = 24;
namespace Ui {
class ModalOverlay;
}
/** Modal overlay to display information about the chain-sync state */
class ModalOverlay : public QWidget
{
Q_OBJECT
public:
explicit ModalOverlay(bool enable_wallet, QWidget *parent);
~ModalOverlay();
public Q_SLOTS:
void tipUpdate(int count, const QDateTime& blockDate, double nVerificationProgress);
void setKnownBestHeight(int count, const QDateTime& blockDate);
void toggleVisibility();
// will show or hide the modal layer
void showHide(bool hide = false, bool userRequested = false);
void closeClicked();
bool isLayerVisible() const { return layerIsVisible; }
protected:
bool eventFilter(QObject * obj, QEvent * ev) override;
bool event(QEvent* ev) override;
private:
Ui::ModalOverlay *ui;
int bestHeaderHeight; //best known height (based on the headers)
QDateTime bestHeaderDate;
QVector<QPair<qint64, double> > blockProcessTime;
bool layerIsVisible;
bool userClosed;
QPropertyAnimation m_animation;
void UpdateHeaderSyncLabel();
};
#endif // BITCOIN_QT_MODALOVERLAY_H