You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

modaloverlay.h 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. // Copyright (c) 2016 The Starwels developers
  2. // Distributed under the MIT software license, see the accompanying
  3. // file COPYING or http://www.opensource.org/licenses/mit-license.php.
  4. #ifndef STARWELS_QT_MODALOVERLAY_H
  5. #define STARWELS_QT_MODALOVERLAY_H
  6. #include <QDateTime>
  7. #include <QWidget>
  8. //! The required delta of headers to the estimated number of available headers until we show the IBD progress
  9. static constexpr int HEADER_HEIGHT_DELTA_SYNC = 24;
  10. namespace Ui {
  11. class ModalOverlay;
  12. }
  13. /** Modal overlay to display information about the chain-sync state */
  14. class ModalOverlay : public QWidget
  15. {
  16. Q_OBJECT
  17. public:
  18. explicit ModalOverlay(QWidget *parent);
  19. ~ModalOverlay();
  20. public Q_SLOTS:
  21. void tipUpdate(int count, const QDateTime& blockDate, double nVerificationProgress);
  22. void setKnownBestHeight(int count, const QDateTime& blockDate);
  23. void toggleVisibility();
  24. // will show or hide the modal layer
  25. void showHide(bool hide = false, bool userRequested = false);
  26. void closeClicked();
  27. bool isLayerVisible() { return layerIsVisible; }
  28. protected:
  29. bool eventFilter(QObject * obj, QEvent * ev);
  30. bool event(QEvent* ev);
  31. private:
  32. Ui::ModalOverlay *ui;
  33. int bestHeaderHeight; //best known height (based on the headers)
  34. QDateTime bestHeaderDate;
  35. QVector<QPair<qint64, double> > blockProcessTime;
  36. bool layerIsVisible;
  37. bool userClosed;
  38. };
  39. #endif // STARWELS_QT_MODALOVERLAY_H