* ./hurricane/src/hviewer :
- Bug: redraw the palette layer samples whenever the style changes. Uses a new, more clear model to transmit signals. A star model where the CellWidget is the center, signals propagate a void pointer which tells the emitter to avoid looping. First a slave emit the signal to the CellWidget. When the CellWidget receive the signal it's transmitted to all slave widgets. - New feature: ExceptionWidget (derived from QDialog) to display properly catched exceptions. The Abort button of the Dialog forces the program to core-dump with a SIGSEGV. The "Try to Continue" resumes the program, which is higtly to crash anyway... - New feature: a HApplication in replacement of the QApplication to catch exceptions in the notify() function, that is exceptions that could be throwed inside event handlers.
This commit is contained in:
parent
a042ed5f86
commit
8a2d46e21e
|
@ -94,7 +94,6 @@ namespace Hurricane {
|
|||
|
||||
void Breakpoint::setStopCb ( Breakpoint::StopCb_t* cb )
|
||||
{
|
||||
cerr << "Breakpoint::setStopCb() - " << (void*)cb << endl;
|
||||
_stopCb = cb;
|
||||
}
|
||||
|
||||
|
|
|
@ -61,11 +61,11 @@ namespace Hurricane {
|
|||
vLine->setFrameShadow ( QFrame::Sunken );
|
||||
|
||||
QGridLayout* layout = new QGridLayout ();
|
||||
layout->addWidget ( ok , 0, 0, 2, 1, Qt::AlignVCenter );
|
||||
layout->addWidget ( vLine , 0, 1, 2, 1 );
|
||||
layout->addWidget ( _message , 0, 2 );
|
||||
layout->addWidget ( stopLabel , 1, 2 );
|
||||
layout->addWidget ( _stopLevel, 1, 3 );
|
||||
layout->addWidget ( _message , 0, 0 );
|
||||
layout->addWidget ( stopLabel , 1, 0 );
|
||||
layout->addWidget ( _stopLevel, 1, 1 );
|
||||
layout->addWidget ( vLine , 0, 2, 2, 1 );
|
||||
layout->addWidget ( ok , 0, 3, 2, 1, Qt::AlignVCenter );
|
||||
setLayout ( layout );
|
||||
|
||||
connect ( ok , SIGNAL(clicked()) , this, SLOT(accept()) );
|
||||
|
|
|
@ -4,12 +4,14 @@
|
|||
include_directories ( ${HURRICANE_SOURCE_DIR}/src/hurricane
|
||||
${HURRICANE_SOURCE_DIR}/src/hviewer )
|
||||
|
||||
set ( mocincludes hurricane/viewer/PaletteItem.h
|
||||
set ( mocincludes hurricane/viewer/HApplication.h
|
||||
hurricane/viewer/PaletteItem.h
|
||||
hurricane/viewer/PaletteNamedItem.h
|
||||
hurricane/viewer/PaletteLayerItem.h
|
||||
hurricane/viewer/PaletteExtensionGoItem.h
|
||||
hurricane/viewer/PaletteWidget.h
|
||||
hurricane/viewer/GraphicsWidget.h
|
||||
hurricane/viewer/ExceptionWidget.h
|
||||
hurricane/viewer/BreakpointWidget.h
|
||||
hurricane/viewer/DynamicLabel.h
|
||||
hurricane/viewer/MousePositionWidget.h
|
||||
|
@ -27,11 +29,13 @@
|
|||
hurricane/viewer/DisplayFilterWidget.h
|
||||
hurricane/viewer/ControllerWidget.h
|
||||
)
|
||||
set ( exports hurricane/viewer/ScreenUtilities.h
|
||||
set ( exports hurricane/viewer/HApplication.h
|
||||
hurricane/viewer/ScreenUtilities.h
|
||||
hurricane/viewer/DisplayStyle.h
|
||||
hurricane/viewer/ColorScale.h
|
||||
hurricane/viewer/Graphics.h
|
||||
hurricane/viewer/GraphicsWidget.h
|
||||
hurricane/viewer/ExceptionWidget.h
|
||||
hurricane/viewer/BreakpointWidget.h
|
||||
hurricane/viewer/Selector.h
|
||||
hurricane/viewer/Command.h
|
||||
|
@ -53,11 +57,13 @@
|
|||
hurricane/viewer/DisplayFilterWidget.h
|
||||
hurricane/viewer/ControllerWidget.h
|
||||
)
|
||||
set ( cpps ScreenUtilities.cpp
|
||||
set ( cpps HApplication.cpp
|
||||
ScreenUtilities.cpp
|
||||
DisplayStyle.cpp
|
||||
ColorScale.cpp
|
||||
Graphics.cpp
|
||||
GraphicsWidget.cpp
|
||||
ExceptionWidget.cpp
|
||||
BreakpointWidget.cpp
|
||||
PaletteItem.cpp
|
||||
PaletteNamedItem.cpp
|
||||
|
|
|
@ -10,5 +10,7 @@
|
|||
<file>images/gtk-go-forward-ltr.png</file>
|
||||
<file>images/swiss-knife.png</file>
|
||||
<file>images/gnome-gmush.png</file>
|
||||
<file>images/gnome-core.png</file>
|
||||
<file>images/i-core.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
|
@ -890,6 +890,13 @@ namespace Hurricane {
|
|||
}
|
||||
|
||||
|
||||
void CellWidget::styleChange ( void* emitter )
|
||||
{
|
||||
refresh ();
|
||||
emit styleChanged(emitter);
|
||||
}
|
||||
|
||||
|
||||
void CellWidget::updatePalette ()
|
||||
{
|
||||
emit updatePalette(getCell());
|
||||
|
@ -904,6 +911,7 @@ namespace Hurricane {
|
|||
connect ( _palette, SIGNAL(paletteChanged()) , this , SLOT(refresh()) );
|
||||
connect ( this , SIGNAL(cellChanged(Cell*)) , _palette, SLOT(updateExtensions(Cell*)) );
|
||||
connect ( this , SIGNAL(updatePalette(Cell*)), _palette, SLOT(updateExtensions(Cell*)) );
|
||||
connect ( this , SIGNAL(styleChanged(void*)) , _palette, SLOT(styleChange(void*)) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -913,6 +921,7 @@ namespace Hurricane {
|
|||
disconnect ( _palette, SIGNAL(paletteChanged()) , this , SLOT(refresh()) );
|
||||
disconnect ( this , SIGNAL(cellChanged(Cell*)) , _palette, SLOT(updateExtensions(Cell*)) );
|
||||
disconnect ( this , SIGNAL(updatePalette(Cell*)), _palette, SLOT(updateExtensions(Cell*)) );
|
||||
disconnect ( this , SIGNAL(styleChanged(void*)) , _palette, SLOT(styleChange(void*)) );
|
||||
_palette = NULL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -98,7 +98,7 @@ namespace Hurricane {
|
|||
if ( getCellWidget() != cellWidget ) {
|
||||
ControllerTab::setCellWidget ( cellWidget );
|
||||
if ( getCellWidget() ) {
|
||||
connect ( _graphics, SIGNAL(styleChanged()), getCellWidget(), SLOT(refresh()) );
|
||||
connect ( _graphics, SIGNAL(styleChanged(void*)), getCellWidget(), SLOT(styleChange(void*)) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -79,15 +79,15 @@ namespace Hurricane {
|
|||
wLayout->addStretch ();
|
||||
setLayout ( wLayout );
|
||||
|
||||
connect ( group, SIGNAL(buttonClicked(int)), this, SLOT(styleChanged(int)) );
|
||||
connect ( group, SIGNAL(buttonClicked(int)), this, SLOT(styleChange(int)) );
|
||||
}
|
||||
|
||||
|
||||
void GraphicsWidget::styleChanged ( int id )
|
||||
void GraphicsWidget::styleChange ( int id )
|
||||
{
|
||||
Graphics::setStyle ( (size_t)id );
|
||||
//cerr << "GraphicsWidget::setStyle() - " << getString(Graphics::getStyle()->getName()) << endl;
|
||||
emit styleChanged ();
|
||||
emit styleChanged ( (void*)this );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,102 @@
|
|||
|
||||
// -*- 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 |
|
||||
// | U n i c o r n - M a i n G U I |
|
||||
// | |
|
||||
// | Author : Jean-Paul CHAPUT |
|
||||
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Module : "./HApplication.cpp" |
|
||||
// | *************************************************************** |
|
||||
// | U p d a t e s |
|
||||
// | |
|
||||
// x-----------------------------------------------------------------x
|
||||
|
||||
|
||||
#include <csignal>
|
||||
#include <iostream>
|
||||
|
||||
#include "hurricane/Error.h"
|
||||
#include "hurricane/viewer/ExceptionWidget.h"
|
||||
#include "hurricane/viewer/HApplication.h"
|
||||
|
||||
|
||||
namespace Hurricane {
|
||||
|
||||
|
||||
using std::cerr;
|
||||
using std::endl;
|
||||
using std::exception;
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Class : "HApplication".
|
||||
|
||||
|
||||
HApplication::HApplication ( int& argc, char** argv )
|
||||
: QApplication ( argc, argv )
|
||||
{ }
|
||||
|
||||
|
||||
HApplication::HApplication ( int& argc, char** argv, bool GUIenabled )
|
||||
: QApplication ( argc, argv, GUIenabled )
|
||||
{ }
|
||||
|
||||
|
||||
HApplication::HApplication ( int& argc, char** argv, Type type )
|
||||
: QApplication ( argc, argv, type )
|
||||
{ }
|
||||
|
||||
|
||||
HApplication::HApplication ( Display* display, Qt::HANDLE visual, Qt::HANDLE colormap )
|
||||
: QApplication ( display, visual, colormap )
|
||||
{ }
|
||||
|
||||
|
||||
HApplication::HApplication ( Display* display, int& argc, char** argv, Qt::HANDLE visual, Qt::HANDLE colormap )
|
||||
: QApplication ( display, argc, argv, visual, colormap )
|
||||
{ }
|
||||
|
||||
|
||||
bool HApplication::notify ( QObject* object, QEvent* event )
|
||||
{
|
||||
try {
|
||||
return QApplication::notify ( object, event );
|
||||
}
|
||||
catch ( Error& e ) {
|
||||
ExceptionWidget* ew = new ExceptionWidget ();
|
||||
ew->setMessage ( e.getReason().c_str() );
|
||||
if ( ew->exec() == QDialog::Rejected )
|
||||
kill ( getpid(), SIGSEGV );
|
||||
}
|
||||
catch ( exception& e ) {
|
||||
ExceptionWidget* ew = new ExceptionWidget ();
|
||||
ew->setMessage ( e.what() );
|
||||
if ( ew->exec() == QDialog::Rejected )
|
||||
kill ( getpid(), SIGSEGV );
|
||||
}
|
||||
catch ( ... ) {
|
||||
static const char* message =
|
||||
" Unmanaged exception, neither a <b>Hurricane::Error</b><br>"
|
||||
"nor a <b>std::exception</b>.";
|
||||
|
||||
ExceptionWidget* ew = new ExceptionWidget ();
|
||||
ew->setMessage ( message );
|
||||
if ( ew->exec() == QDialog::Rejected )
|
||||
kill ( getpid(), SIGSEGV );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
} // End of Hurricane namespace.
|
|
@ -2,7 +2,7 @@
|
|||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved
|
||||
// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved
|
||||
//
|
||||
// ===================================================================
|
||||
//
|
||||
|
@ -59,6 +59,8 @@ namespace Hurricane {
|
|||
painter.setPen ( Graphics::getPen (_entry->getName()) );
|
||||
painter.setBrush ( Graphics::getBrush(_entry->getName()) );
|
||||
painter.drawRect ( 2, 2, 16, 16 );
|
||||
|
||||
update ();
|
||||
}
|
||||
|
||||
|
||||
|
@ -88,4 +90,10 @@ namespace Hurricane {
|
|||
{ }
|
||||
|
||||
|
||||
void PaletteItem::styleChange ()
|
||||
{
|
||||
emit styleChanged ();
|
||||
}
|
||||
|
||||
|
||||
} // End of Hurricane namespace.
|
||||
|
|
|
@ -43,7 +43,9 @@ namespace Hurricane {
|
|||
{
|
||||
QHBoxLayout* layout = new QHBoxLayout ();
|
||||
layout->setContentsMargins ( 0, 0, 0, 0 );
|
||||
layout->addWidget ( new DrawingStyleSample(this) );
|
||||
|
||||
DrawingStyleSample* sample = new DrawingStyleSample(this);
|
||||
layout->addWidget ( sample );
|
||||
|
||||
_visible->setChecked ( visible );
|
||||
_visible->setText ( getString(getName()).c_str() );
|
||||
|
@ -61,8 +63,9 @@ namespace Hurricane {
|
|||
|
||||
setLayout ( layout );
|
||||
|
||||
connect ( _visible , SIGNAL(clicked()), this, SIGNAL(visibleToggled ()) );
|
||||
connect ( _selectable, SIGNAL(clicked()), this, SIGNAL(selectableToggled()) );
|
||||
connect ( this , SIGNAL(styleChanged()), sample, SLOT (redraw ()) );
|
||||
connect ( _visible , SIGNAL(clicked ()), this , SIGNAL(visibleToggled ()) );
|
||||
connect ( _selectable, SIGNAL(clicked ()), this , SIGNAL(selectableToggled()) );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -377,4 +377,18 @@ namespace Hurricane {
|
|||
}
|
||||
|
||||
|
||||
void PaletteWidget::styleChange ( void* emitter )
|
||||
{
|
||||
if ( emitter == this ) return;
|
||||
|
||||
PaletteItems::iterator iitem = _layerItems.begin();
|
||||
for ( ; iitem != _layerItems.end() ; iitem++ )
|
||||
iitem->second->styleChange ();
|
||||
|
||||
iitem = _extensionGoItems.begin();
|
||||
for ( ; iitem != _extensionGoItems.end() ; iitem++ )
|
||||
iitem->second->styleChange ();
|
||||
}
|
||||
|
||||
|
||||
} // End of Hurricane namespace.
|
||||
|
|
|
@ -187,6 +187,7 @@ namespace Hurricane {
|
|||
void cellPreModificated ();
|
||||
void cellPostModificated ();
|
||||
void settingsChanged ();
|
||||
void styleChanged ( void* emitter );
|
||||
void updatePalette ( Cell* );
|
||||
void mousePositionChanged ( const Point& position );
|
||||
void selectionChanged ( const SelectorSet&, Cell* );
|
||||
|
@ -211,6 +212,7 @@ namespace Hurricane {
|
|||
void _selectOccurrencesUnder ( Box selectArea );
|
||||
void _unselectAll ( bool delayRedraw );
|
||||
void rubberChange ();
|
||||
void styleChange ( void* emitter );
|
||||
void updatePalette ();
|
||||
void cellPreModificate ();
|
||||
void cellPostModificate ();
|
||||
|
|
|
@ -39,9 +39,9 @@ namespace Hurricane {
|
|||
public:
|
||||
GraphicsWidget ( QWidget* parent=NULL );
|
||||
signals:
|
||||
void styleChanged ();
|
||||
void styleChanged ( void* emitter );
|
||||
public slots:
|
||||
void styleChanged ( int id );
|
||||
void styleChange ( int id );
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
|
||||
// -*- 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 |
|
||||
// | U n i c o r n - M a i n G U I |
|
||||
// | |
|
||||
// | Author : Jean-Paul CHAPUT |
|
||||
// | E-mail : Jean-Paul.Chaput@asim.lip6.fr |
|
||||
// | =============================================================== |
|
||||
// | C++ Header : "./HApplication.h" |
|
||||
// | *************************************************************** |
|
||||
// | U p d a t e s |
|
||||
// | |
|
||||
// x-----------------------------------------------------------------x
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef __HURRICANE_HAPPLICATION__
|
||||
#define __HURRICANE_HAPPLICATION__
|
||||
|
||||
#include <QApplication>
|
||||
|
||||
|
||||
namespace Hurricane {
|
||||
|
||||
|
||||
class HApplication : public QApplication {
|
||||
Q_OBJECT;
|
||||
|
||||
public:
|
||||
HApplication ( int& argc, char** argv );
|
||||
HApplication ( int& argc, char** argv, bool GUIenabled );
|
||||
HApplication ( int& argc, char** argv, Type type );
|
||||
HApplication ( Display*, Qt::HANDLE visual=0, Qt::HANDLE colormap=0 );
|
||||
HApplication ( Display*, int& argc, char** argv, Qt::HANDLE visual=0, Qt::HANDLE colormap=0 );
|
||||
virtual bool notify ( QObject*, QEvent* );
|
||||
};
|
||||
|
||||
|
||||
} // End of Hurricane namespace.
|
||||
|
||||
|
||||
#endif // __HURRICANE_HAPPLICATION__
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved
|
||||
// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved
|
||||
//
|
||||
// ===================================================================
|
||||
//
|
||||
|
@ -55,7 +55,7 @@ namespace Hurricane {
|
|||
protected:
|
||||
QPixmap _sample;
|
||||
PaletteItem* _entry;
|
||||
protected:
|
||||
protected slots:
|
||||
void redraw ();
|
||||
void paintEvent ( QPaintEvent* );
|
||||
};
|
||||
|
@ -74,10 +74,12 @@ namespace Hurricane {
|
|||
virtual bool isItemSelectable () const;
|
||||
virtual void setItemVisible ( bool ) = 0;
|
||||
virtual void setItemSelectable ( bool );
|
||||
public slots:
|
||||
virtual void styleChange ();
|
||||
signals:
|
||||
void styleChanged ();
|
||||
void visibleToggled ();
|
||||
void selectableToggled ();
|
||||
|
||||
protected:
|
||||
PaletteItem ();
|
||||
PaletteItem ( const PaletteItem& );
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// -*- C++ -*-
|
||||
//
|
||||
// This file is part of the Coriolis Software.
|
||||
// Copyright (c) UPMC/LIP6 2008-2008, All Rights Reserved
|
||||
// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved
|
||||
//
|
||||
// ===================================================================
|
||||
//
|
||||
|
@ -68,6 +68,7 @@ namespace Hurricane {
|
|||
void updateExtensions ( Cell* cell );
|
||||
void showAll ();
|
||||
void hideAll ();
|
||||
void styleChange ( void* emitter );
|
||||
|
||||
protected:
|
||||
PaletteItems _layerItems;
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 3.2 KiB |
Binary file not shown.
After Width: | Height: | Size: 3.1 KiB |
Loading…
Reference in New Issue