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