From 3d486767eb024b0d9fdc068f362a2ddc411b0db8 Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Sun, 18 Jan 2009 21:21:38 +0000 Subject: [PATCH] Forgotten files. --- hurricane/src/hviewer/ExceptionWidget.cpp | 110 ++++++++++++++++++ .../hurricane/viewer/ExceptionWidget.h | 55 +++++++++ 2 files changed, 165 insertions(+) create mode 100644 hurricane/src/hviewer/ExceptionWidget.cpp create mode 100644 hurricane/src/hviewer/hurricane/viewer/ExceptionWidget.h diff --git a/hurricane/src/hviewer/ExceptionWidget.cpp b/hurricane/src/hviewer/ExceptionWidget.cpp new file mode 100644 index 00000000..7663e3b3 --- /dev/null +++ b/hurricane/src/hviewer/ExceptionWidget.cpp @@ -0,0 +1,110 @@ + +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved +// +// =================================================================== +// +// $Id$ +// +// x-----------------------------------------------------------------x +// | | +// | C O R I O L I S | +// | V L S I B a c k e n d D a t a - B a s e | +// | | +// | Author : Jean-Paul CHAPUT | +// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | +// | =============================================================== | +// | C++ Module : "./ExceptionWidget.cpp" | +// | *************************************************************** | +// | U p d a t e s | +// | | +// x-----------------------------------------------------------------x + + +#include +#include +#include +#include +#include +#include + +#include "hurricane/Exception.h" +#include "hurricane/viewer/ExceptionWidget.h" + + +namespace Hurricane { + + + ExceptionWidget::ExceptionWidget ( QWidget* parent ) + : QDialog (parent) + , _message (new QLabel()) + { + setAttribute ( Qt::WA_DeleteOnClose ); + setModal ( true ); + setWindowTitle ( tr("") ); + setToolTip ( tr("Ben mon cochon, t'es dans le bouillon") ); + + QLabel* header = new QLabel (); + header->setMinimumWidth ( 200 ); + header->setTextFormat ( Qt::RichText ); + header->setText ( "[ERROR]" ); + + _message->setTextFormat ( Qt::RichText ); + _message->setText ( "Oups! I did it again!" ); + + QLabel* ok = new QLabel (); + ok->setSizePolicy ( QSizePolicy::Preferred, QSizePolicy::MinimumExpanding ); + ok->setPixmap ( QPixmap(":/images/gnome-core.png") ); + ok->setStyleSheet ( "QLabel { background-color: #FF9999;" + " padding: 5px }" ); + + QPushButton* abortButton = new QPushButton (); + abortButton->setSizePolicy ( QSizePolicy::Fixed, QSizePolicy::Fixed ); + abortButton->setText ( tr("Abort") ); + + QPushButton* contButton = new QPushButton (); + contButton->setSizePolicy ( QSizePolicy::Fixed, QSizePolicy::Fixed ); + contButton->setText ( tr("Try to Continue") ); + + QHBoxLayout* hLayout2 = new QHBoxLayout (); + hLayout2->addStretch ( 1 ); + hLayout2->addWidget ( contButton, Qt::AlignCenter ); + hLayout2->addStretch ( 4 ); + hLayout2->addWidget ( abortButton, Qt::AlignCenter ); + hLayout2->addStretch ( 1 ); + + QVBoxLayout* vLayout1 = new QVBoxLayout (); + vLayout1->setContentsMargins ( 10, 10, 10, 10 ); + vLayout1->setSpacing ( 0 ); + vLayout1->addWidget ( header , Qt::AlignCenter ); + vLayout1->addWidget ( _message, Qt::AlignCenter ); + vLayout1->addSpacing ( 10 ); + vLayout1->addLayout ( hLayout2, Qt::AlignCenter ); + + QHBoxLayout* hLayout1 = new QHBoxLayout (); + hLayout1->setContentsMargins ( 0, 0, 0, 0 ); + hLayout1->addWidget ( ok ); + hLayout1->addLayout ( vLayout1 ); + + setLayout ( hLayout1 ); + + connect ( contButton , SIGNAL(clicked()), this, SLOT(accept()) ); + connect ( abortButton, SIGNAL(clicked()), this, SLOT(reject()) ); + } + + + void ExceptionWidget::closeEvent ( QCloseEvent* event ) + { + event->ignore (); + } + + + void ExceptionWidget::setMessage ( const QString& message ) + { + _message->setText ( message ); + } + + +} // End of Hurricane Namespace. diff --git a/hurricane/src/hviewer/hurricane/viewer/ExceptionWidget.h b/hurricane/src/hviewer/hurricane/viewer/ExceptionWidget.h new file mode 100644 index 00000000..d5e59248 --- /dev/null +++ b/hurricane/src/hviewer/hurricane/viewer/ExceptionWidget.h @@ -0,0 +1,55 @@ + +// -*- C++ -*- +// +// This file is part of the Coriolis Software. +// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved +// +// =================================================================== +// +// $Id$ +// +// x-----------------------------------------------------------------x +// | | +// | C O R I O L I S | +// | V L S I B a c k e n d D a t a - B a s e | +// | | +// | Author : Jean-Paul CHAPUT | +// | E-mail : Jean-Paul.Chaput@asim.lip6.fr | +// | =============================================================== | +// | C++ Header : "./ExceptionWidget.h" | +// | *************************************************************** | +// | U p d a t e s | +// | | +// x-----------------------------------------------------------------x + + +#ifndef __HURRICANE_EXCEPTION_WIDGET__ +#define __HURRICANE_EXCEPTION_WIDGET__ + + +#include +class QLabel; + + +namespace Hurricane { + + + class ExceptionWidget : public QDialog { + Q_OBJECT; + + public: + ExceptionWidget ( QWidget* parent=NULL); + void setMessage ( const QString& ); + + private: + QLabel* _message; + + protected: + virtual void closeEvent ( QCloseEvent* ); + }; + + +} // End of Hurricane namespace. + + +#endif // __HURRICANE_EXCEPTION_WIDGET__