1 /********* 2 * 3 * In the name of the Father, and of the Son, and of the Holy Spirit. 4 * 5 * This file is part of BibleTime's source code, http://www.bibletime.info/. 6 * 7 * Copyright 1999-2016 by the BibleTime developers. 8 * The BibleTime source code is licensed under the GNU General Public License version 2.0. 9 * 10 **********/ 11 12 #ifndef UTIL_DIALOG_UTIL_H 13 #define UTIL_DIALOG_UTIL_H 14 15 #include <QMessageBox> 16 17 class QAction; 18 class QDialogButtonBox; 19 20 namespace message { 21 22 /** 23 Change the state of a QAction without triggering their signals. 24 \param action The QAction instance to set the state for. 25 \param[in] checked The new state. 26 */ 27 void setQActionCheckedNoTrigger(QAction * const action, const bool checked = true); 28 29 /** 30 Translates standard buttons in a QDialogButtonBox. 31 */ 32 void prepareDialogBox(QDialogButtonBox *box); 33 34 /* 35 Use util::showWarning() etc. instead of QMessageBox static functions. 36 QMessageBox button texts are not translated trustworthily. 37 */ 38 39 QMessageBox::StandardButton showWarning(QWidget * parent, const QString & title, const QString & text, QMessageBox::StandardButtons buttons = QMessageBox::Ok, QMessageBox::StandardButton defaultButton = QMessageBox::NoButton); 40 41 QMessageBox::StandardButton showCritical(QWidget * parent, const QString & title, const QString & text, QMessageBox::StandardButtons buttons = QMessageBox::Ok, QMessageBox::StandardButton defaultButton = QMessageBox::NoButton); 42 43 QMessageBox::StandardButton showInformation(QWidget * parent, const QString & title, const QString & text, QMessageBox::StandardButtons buttons = QMessageBox::Ok, QMessageBox::StandardButton defaultButton = QMessageBox::NoButton); 44 45 QMessageBox::StandardButton showQuestion(QWidget * parent, const QString & title, const QString & text, QMessageBox::StandardButtons buttons = QMessageBox::Ok, QMessageBox::StandardButton defaultButton = QMessageBox::NoButton); 46 47 } // namespace message 48 49 #endif 50