/** * @file main/GUI/fatalerr.h * @brief Fatal error message dialog box * @author Enar Vaikene * * Copyright (c) 2011-2019 Enar Vaikene * * This file is part of the eVaf C++ cross-platform application development framework. * * This file can be used under the terms of the GNU General Public License * version 3.0 as published by the Free Software Foundation and appearing in * the file LICENSE included in the packaging of this file. Please review the * the following information to ensure the GNU General Public License version * 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html. * * Alternatively, this file may be used in accordance with the Commercial License * Agreement provided with the Software. */ #ifndef __GUI_FATALERR_H # define __GUI_FATALERR_H #include class QTimerEvent; namespace eVaf { namespace GUI { namespace Internal { /** * Fatal error message dialog box * * The fatal error message dialog box shows a fatal error message and starts a count-down * to close the dialog box and abort the application. Users can click on the Ignore button * to keep the application running for diagnostics. */ class FatalErr : public QDialog { Q_OBJECT public: /// Returns values enum Result { Abort = 0, ///< User clicked on the Abort button or the dialog box timed out Ignore = 1 ///< User clicked on the Ignore button }; /** * Creates the fatal error message dialog box * @param title Title of the dialog box * @param text Text shown on the dialog box * @param parent Optional parent widget */ FatalErr(QString const & title, QString const & text, QWidget * parent = nullptr); /** * Shows a fatal error message dialog box * @param title Title of the dialog box * @param text Text shown on the dialog box * @param parent Optional parent widget * @return The result code */ static int message(QString const & title, QString const & text, QWidget * parent = nullptr); protected: /// Timer event handler virtual void timerEvent(QTimerEvent *); private slots: /// Ignore button clicked void ignoreClicked(); /// Abort button clicked void abortClicked(); private: /// Count-down time in secons static int const Timer = 60; /// Count-down timer int mTimer; /// The Abort button QPushButton * wAbort; }; } // namespace eVaf::GUI::Internal } // namespace eVaf::GUI } // namespace eVaf #endif // fatalerr.h