| 1 | // For license of this file, see <project-root-folder>/LICENSE.md. |
| 2 | |
| 3 | #ifndef MESSAGEBOX_H |
| 4 | #define MESSAGEBOX_H |
| 5 | |
| 6 | #include <functional> |
| 7 | |
| 8 | #include <QDialogButtonBox> |
| 9 | #include <QMessageBox> |
| 10 | |
| 11 | class RSSGUARD_DLLSPEC MsgBox : public QMessageBox { |
| 12 | Q_OBJECT |
| 13 | |
| 14 | public: |
| 15 | // Constructors and destructors. |
| 16 | explicit MsgBox(QWidget* parent = nullptr); |
| 17 | |
| 18 | // Custom icon setting. |
| 19 | void setIcon(Icon icon); |
| 20 | |
| 21 | static void setCheckBox(QMessageBox* msg_box, const QString& text, bool* data); |
| 22 | |
| 23 | // Displays custom message box. |
| 24 | static QMessageBox::StandardButton show(QWidget* parent, |
| 25 | QMessageBox::Icon icon, |
| 26 | const QString& title, |
| 27 | const QString& text, |
| 28 | const QString& informative_text = QString(), |
| 29 | const QString& detailed_text = QString(), |
| 30 | QMessageBox::StandardButtons buttons = QMessageBox::Ok, |
| 31 | QMessageBox::StandardButton default_button = QMessageBox::Ok, |
| 32 | bool* dont_show_again = nullptr, |
| 33 | const QString& functor_heading = {}, |
| 34 | const std::function<void()>& functor = nullptr); |
| 35 | static QIcon iconForStatus(QMessageBox::Icon status); |
| 36 | }; |
| 37 | |
| 38 | #endif // MESSAGEBOX_H |