JS8Call-Improved master
Loading...
Searching...
No Matches
SelfDestructMessageBox.h
1#ifndef SELFDESTRUCTMESSAGEBOX_H
2#define SELFDESTRUCTMESSAGEBOX_H
3
4#include <QMessageBox>
5#include <QPushButton>
6#include <QString>
7#include <QTimer>
8#include <QWidget>
9
10class SelfDestructMessageBox : public QMessageBox {
11 Q_OBJECT
12
13 public:
14 SelfDestructMessageBox(
15 int timeout, const QString &title, const QString &text,
16 QMessageBox::Icon icon,
17 QMessageBox::StandardButtons buttons = QMessageBox::Ok |
18 QMessageBox::Cancel,
19 QMessageBox::StandardButton defaultButton = QMessageBox::Ok,
20 bool show_countdown = false, QWidget *parent = nullptr,
21 Qt::WindowFlags flags = Qt::WindowFlags());
22
23 void showEvent(QShowEvent *event) override;
24
25 void setShowCountdown(bool countdown) { m_show_countdown = countdown; }
26
27 void stopTimer();
28
29 private slots:
30 void tick();
31
32 private:
33 bool m_show_countdown;
34 int m_timeout;
35 QString m_text;
36 QTimer m_timer;
37};
38
39#endif // SELFDESTRUCTMESSAGEBOX_H