1 /* 2 * %kadu copyright begin% 3 * Copyright 2010, 2011 Piotr Galiszewski (piotr.galiszewski@kadu.im) 4 * Copyright 2010, 2012 Wojciech Treter (juzefwt@gmail.com) 5 * Copyright 2009 Michał Podsiadlik (michal@kadu.net) 6 * Copyright 2011, 2014 Bartosz Brachaczek (b.brachaczek@gmail.com) 7 * Copyright 2010, 2011, 2013, 2014 Rafał Przemysław Malinowski (rafal.przemyslaw.malinowski@gmail.com) 8 * %kadu copyright end% 9 * 10 * This program is free software; you can redistribute it and/or 11 * modify it under the terms of the GNU General Public License as 12 * published by the Free Software Foundation; either version 2 of 13 * the License, or (at your option) any later version. 14 * 15 * This program is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU General Public License for more details. 19 * 20 * You should have received a copy of the GNU General Public License 21 * along with this program. If not, see <http://www.gnu.org/licenses/>. 22 */ 23 24 #ifndef MESSAGE_DIALOG_H 25 #define MESSAGE_DIALOG_H 26 27 #include <QtWidgets/QMessageBox> 28 29 #include "icons/kadu-icon.h" 30 31 #include "exports.h" 32 33 class KADUAPI MessageDialog : public QObject 34 { 35 Q_OBJECT 36 37 QMessageBox *Box; 38 39 MessageDialog(const QIcon &icon, const QString &title, const QString &text, QMessageBox::StandardButtons buttons, 40 QWidget *parent = nullptr, Qt::WindowFlags f = Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint); 41 42 protected slots: 43 void messageBoxFinished(int result); 44 45 public: 46 static MessageDialog * create(const QIcon &icon, const QString &title, const QString &text, 47 QWidget *parent = nullptr, Qt::WindowFlags f = Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint); 48 static void show(const QIcon &icon, const QString &title, const QString &text, QMessageBox::StandardButtons buttons = QMessageBox::Ok, 49 QWidget *parent = nullptr, Qt::WindowFlags f = Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint); 50 51 MessageDialog * addButton(QMessageBox::StandardButton button, const QString &text = ""); 52 void setDefaultButton(QMessageBox::StandardButton button); 53 54 int exec(); 55 bool ask(); 56 }; 57 58 #endif // MESSAGE_DIALOG_H 59