1 /**************************************************************************
2 *   Copyright (C) 2015-2020 by Mihai Moldovan <ionic@ionic.de>            *
3 *                                                                         *
4 *   This program is free software; you can redistribute it and/or modify  *
5 *   it under the terms of the GNU General Public License as published by  *
6 *   the Free Software Foundation; either version 2 of the License, or     *
7 *   (at your option) any later version.                                   *
8 *   This program is distributed in the hope that it will be useful,       *
9 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
10 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
11 *   GNU General Public License for more details.                          *
12 *                                                                         *
13 *   You should have received a copy of the GNU General Public License     *
14 *   along with this program.  If not, see <https://www.gnu.org/licenses/>. *
15 ***************************************************************************/
16 
17 #ifndef NON_MODAL_MESSAGEBOX_H
18 #define NON_MODAL_MESSAGEBOX_H
19 
20 #include <QMessageBox>
21 
22 class Non_Modal_MessageBox {
23   public:
24     // Main implementation.
25     static void critical (QWidget *parent, const QString &title,
26                           const QString &text, const QString &informative_text,
27                           bool rich_text,
28                           QMessageBox::StandardButtons buttons = QMessageBox::Ok,
29                           QMessageBox::StandardButton defaultButton = QMessageBox::NoButton);
30 
31     // Wrapper.
32     static void critical (QWidget *parent, const QString &title,
33                           const QString &text, const QString &informative_text,
34                           QMessageBox::StandardButtons buttons = QMessageBox::Ok,
35                           QMessageBox::StandardButton defaultButton = QMessageBox::NoButton);
36 
37     // Wrapper for QMessageBox::critical-like usage.
38     // Use this instead QMessageBox::critical for a non-modal variant.
39     // Caveat: this function does return immediately and will NOT return the clicked button.
40     static void critical (QWidget *parent, const QString &title,
41                           const QString &text,
42                           QMessageBox::StandardButtons buttons = QMessageBox::Ok,
43                           QMessageBox::StandardButton defaultButton = QMessageBox::NoButton);
44 
45 };
46 
47 #endif /* !defined (NON_MODAL_MESSAGEBOX_H) */
48