]>
vaikene.ee Git - evaf/blob - fatalerr.cpp
3c37b0f46119d554230649e85c9536a936566526
2 * @file main/GUI/fatalerr.cpp
3 * @brief Fatal error message dialog box
6 * Copyright (c) 2011 Enar Vaikene
8 * This file is part of the eVaf C++ cross-platform application development framework.
10 * This file can be used under the terms of the GNU General Public License
11 * version 3.0 as published by the Free Software Foundation and appearing in
12 * the file LICENSE included in the packaging of this file. Please review the
13 * the following information to ensure the GNU General Public License version
14 * 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
16 * Alternatively, this file may be used in accordance with the Commercial License
17 * Agreement provided with the Software.
24 using namespace eVaf::GUI::Internal
;
27 //-------------------------------------------------------------------
29 FatalErr::FatalErr(QString
const & title
, QString
const & text
, QWidget
* parent
)
30 : QDialog(parent
, Qt::WindowTitleHint
)
33 setWindowTitle(title
);
35 QVBoxLayout
* layout
= new QVBoxLayout
;
36 layout
->setSpacing(10);
39 QHBoxLayout
* messageBox
= new QHBoxLayout
;
40 messageBox
->setSpacing(20);
41 layout
->addLayout(messageBox
);
44 QLabel
* l
= new QLabel
;
45 l
->setPixmap(QMessageBox::standardIcon(QMessageBox::Critical
));
46 l
->setSizePolicy(QSizePolicy::Fixed
, QSizePolicy::Fixed
);
47 messageBox
->addWidget(l
);
52 l
->setSizePolicy(QSizePolicy::Expanding
, QSizePolicy::Expanding
);
53 messageBox
->addWidget(l
);
55 // Warning about the Ignore button
57 l
->setTextFormat(Qt::RichText
);
59 "<p><small><i>Clicking on the 'Abort' button aborts the application.<br>"
60 "Clicking on the 'Ignore' button keeps the application running for diagnostics.</i></small></p>"
61 "<p><small><font color=\"red\">The application might be unstable if fatal errors are ignored!</font></small></p>"
66 QHBoxLayout
* buttonBox
= new QHBoxLayout
;
67 layout
->addLayout(buttonBox
);
69 buttonBox
->addStretch();
71 wAbort
= new QPushButton(tr("%Abort (%1 sec)").arg(mTimer
));
72 connect(wAbort
, SIGNAL(clicked()), this, SLOT(abortClicked()));
73 buttonBox
->addWidget(wAbort
);
74 setFocusProxy(wAbort
);
76 QPushButton
* b
= new QPushButton(tr("&Ignore"));
77 connect(b
, SIGNAL(clicked()), this, SLOT(ignoreClicked()));
78 buttonBox
->addWidget(b
);
82 // Start the count-down timer
86 void FatalErr::timerEvent(QTimerEvent
*)
89 wAbort
->setText(tr("&Abort (%1 sec)").arg(mTimer
));
95 void FatalErr::abortClicked()
100 void FatalErr::ignoreClicked()
105 int FatalErr::message(QString
const & title
, QString
const & text
, QWidget
* parent
)
107 FatalErr
msg(title
, text
, parent
);