UniversalIndentGUI 1.2.0
UiGuiErrorMessage.cpp
Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2006-2012 by Thomas Schweitzer                          *
00003  *   thomas-schweitzer(at)arcor.de                                         *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License version 2.0 as   *
00007  *   published by the Free Software Foundation.                            *
00008  *                                                                         *
00009  *   This program is distributed in the hope that it will be useful,       *
00010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00012  *   GNU General Public License for more details.                          *
00013  *                                                                         *
00014  *   You should have received a copy of the GNU General Public License     *
00015  *   along with this program in the file LICENSE.GPL; if not, write to the *
00016  *   Free Software Foundation, Inc.,                                       *
00017  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00018  ***************************************************************************/
00019 
00020 #include "UiGuiErrorMessage.h"
00021 
00022 #include <QCheckBox>
00023 
00039 UiGuiErrorMessage::UiGuiErrorMessage(QWidget *parent) : QErrorMessage(parent) {
00040     _showAgainCheckBox = findChild<QCheckBox *>();
00041     setWindowModality( Qt::ApplicationModal );
00042     _showAgainCheckBox->setText( tr("Show this message again") );
00043 }
00044 
00045 
00049 UiGuiErrorMessage::~UiGuiErrorMessage(void) {
00050 }
00051 
00052 
00060 void UiGuiErrorMessage::showMessage( const QString &title, const QString &message ) {
00061     bool showAgain = true;
00062 
00063     if ( _showAgainCheckBox != 0 ) {
00064         showAgain = _showAgainCheckBox->isChecked();
00065     }
00066 
00067     setWindowTitle(title);
00068 
00069     if ( !_errorMessageList.contains(message) ) {
00070         _errorMessageList << message;
00071         if ( _showAgainCheckBox != 0 ) {
00072             _showAgainCheckBox->setChecked(true);
00073         }
00074         QErrorMessage::showMessage( message );
00075     }
00076     else if ( showAgain ) {
00077         QErrorMessage::showMessage( message );
00078     }
00079 }
00080 
00081 
00085 void UiGuiErrorMessage::showMessage( const QString &message ) {
00086     showMessage( "UniversalIndentGUI", message );
00087 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines