| 1 | // For license of this file, see <project-root-folder>/LICENSE.md. |
| 2 | |
| 3 | #ifndef BASETOASTNOTIFICATION_H |
| 4 | #define BASETOASTNOTIFICATION_H |
| 5 | |
| 6 | #include <QDialog> |
| 7 | #include <QTimer> |
| 8 | |
| 9 | class QAbstractButton; |
| 10 | class QLabel; |
| 11 | |
| 12 | class BaseToastNotification : public QDialog { |
| 13 | Q_OBJECT |
| 14 | |
| 15 | public: |
| 16 | explicit BaseToastNotification(QWidget* parent = nullptr); |
| 17 | virtual ~BaseToastNotification(); |
| 18 | |
| 19 | public slots: |
| 20 | virtual void reject(); |
| 21 | |
| 22 | protected: |
| 23 | virtual bool eventFilter(QObject* watched, QEvent* event); |
| 24 | virtual void timerEvent(QTimerEvent* event); |
| 25 | virtual void closeEvent(QCloseEvent* event); |
| 26 | |
| 27 | void setupHeading(QLabel* lbl); |
| 28 | void setupTimedClosing(bool want_shorter_timeout); |
| 29 | void setupCloseButton(QAbstractButton* btn); |
| 30 | void stopTimedClosing(); |
| 31 | |
| 32 | signals: |
| 33 | void closeRequested(BaseToastNotification* notif); |
| 34 | |
| 35 | private: |
| 36 | QTimer m_timerClosingClick; |
| 37 | int m_timerId; |
| 38 | }; |
| 39 | |
| 40 | #endif // BASETOASTNOTIFICATION_H |