| 
									
										
										
										
											2018-08-16 15:19:43 -04:00
										 |  |  | #ifndef SELFDESTRUCTMESSAGEBOX_H
 | 
					
						
							|  |  |  | #define SELFDESTRUCTMESSAGEBOX_H
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <QWidget>
 | 
					
						
							|  |  |  | #include <QMessageBox>
 | 
					
						
							|  |  |  | #include <QPushButton>
 | 
					
						
							|  |  |  | #include <QString>
 | 
					
						
							|  |  |  | #include <QTimer>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class SelfDestructMessageBox : public QMessageBox | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     Q_OBJECT | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  |     SelfDestructMessageBox(int timeout, | 
					
						
							|  |  |  |                            const QString& title, | 
					
						
							|  |  |  |                            const QString& text, | 
					
						
							|  |  |  |                            QMessageBox::Icon icon, | 
					
						
							|  |  |  |                            QMessageBox::StandardButtons buttons = QMessageBox::Ok | QMessageBox::Cancel, | 
					
						
							|  |  |  |                            QMessageBox::StandardButton defaultButton = QMessageBox::Ok, | 
					
						
							| 
									
										
										
										
											2019-02-07 14:31:11 -05:00
										 |  |  |                            bool show_countdown = false, | 
					
						
							| 
									
										
										
										
											2018-08-16 15:19:43 -04:00
										 |  |  |                            QWidget* parent = nullptr, | 
					
						
							|  |  |  |                            Qt::WindowFlags flags = 0); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     void showEvent(QShowEvent* event) override; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-07 14:31:11 -05:00
										 |  |  |     void setShowCountdown(bool countdown){ m_show_countdown = countdown; } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-16 15:19:43 -04:00
										 |  |  | private slots: | 
					
						
							|  |  |  |     void tick(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							| 
									
										
										
										
											2019-02-07 14:31:11 -05:00
										 |  |  |     bool m_show_countdown; | 
					
						
							| 
									
										
										
										
											2018-08-16 15:19:43 -04:00
										 |  |  |     int m_timeout; | 
					
						
							|  |  |  |     QString m_text; | 
					
						
							|  |  |  |     QTimer m_timer; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #endif // SELFDESTRUCTMESSAGEBOX_H
 |