* ./hurricane:

- Cleanup: In Slot.h, comment out print for debug.
    - New: In CellViewer, adds a renameCell() method to "rename" the currently
        loaded Cell "in place". Utility function for SaveCellDialog (see below).
This commit is contained in:
Jean-Paul Chaput 2010-05-14 07:36:42 +00:00
parent ac40b49d13
commit 74e05d19ff
6 changed files with 52 additions and 30 deletions

View File

@ -53,7 +53,7 @@ Library::Library(DataBase* dataBase, Library* library, const Name& name)
}
else {
if (_library->getLibrary(_name))
throw Error("Can't create " + _TName("Library") + " : already exists");
throw Error("Can't create Library " + getString(name) + " : already exists");
}
}

View File

@ -328,7 +328,7 @@ namespace Hurricane {
template<typename Data>
inline Hurricane::Slot* getSlot( std::string& name, Data d )
{
std::cerr << "getSlot<string&,Data>( \"" << name << "\" )" << std::endl;
//std::cerr << "getSlot<string&,Data>( \"" << name << "\" )" << std::endl;
return new Hurricane::SlotTemplate<Data> ( name, d );
}
@ -336,7 +336,7 @@ inline Hurricane::Slot* getSlot( std::string& name, Data d )
template<typename Data>
inline Hurricane::Slot* getSlot( std::string& name, Data* d )
{
std::cerr << "getSlot<string&,Data*>( \"" << name << "\" )" << std::endl;
//std::cerr << "getSlot<string&,Data*>( \"" << name << "\" )" << std::endl;
return new Hurricane::SlotTemplate<Data*> ( name, d );
}
@ -344,7 +344,7 @@ inline Hurricane::Slot* getSlot( std::string& name, Data* d )
template<typename Data>
inline Hurricane::Slot* getSlot( const std::string& name, Data d )
{
std::cerr << "getSlot<const string&,Data>( \"" << name << "\" )" << std::endl;
//std::cerr << "getSlot<const string&,Data>( \"" << name << "\" )" << std::endl;
return new Hurricane::SlotTemplate<Data> ( name, d );
}
@ -352,7 +352,7 @@ inline Hurricane::Slot* getSlot( const std::string& name, Data d )
template<typename Data>
inline Hurricane::Slot* getSlot( const std::string& name, Data* d )
{
std::cerr << "getSlot<const string&,Data*>( \"" << name << "\" )" << std::endl;
//std::cerr << "getSlot<const string&,Data*>( \"" << name << "\" )" << std::endl;
return new Hurricane::SlotTemplate<Data*> ( name, d );
}

View File

@ -149,7 +149,7 @@ namespace Hurricane {
_saveAction = new QAction ( tr("&Save Cell"), this );
_saveAction->setObjectName ( "viewer.menuBar.file.saveCell" );
_saveAction->setIcon ( QIcon(":/images/stock_save.png") );
_saveAction->setStatusTip ( tr("Save the current Cell") );
_saveAction->setStatusTip ( tr("Save (write) the current Cell") );
_saveAction->setVisible ( false );
_closeAction = new QAction ( tr("&Close"), this );
@ -330,7 +330,7 @@ namespace Hurricane {
void CellViewer::refreshHistory ()
{
if ( !getCell() ) return;
if ( getCell() == NULL ) return;
shared_ptr<CellWidget::State> activeState = _cellWidget->getState();
_cellHistory.remove ( activeState );
@ -404,6 +404,18 @@ namespace Hurricane {
}
void CellViewer::renameCell ( const char* name )
{
Cell* cell = getCell();
if ( cell == NULL ) return;
cell->setName ( name );
refreshTitle ();
refreshHistory ();
}
void CellViewer::doGoto ()
{
if ( _goto->exec() == QDialog::Accepted ) {

View File

@ -2,7 +2,7 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved
// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved
//
// ===================================================================
//
@ -38,18 +38,18 @@ namespace Hurricane {
ExceptionWidget::ExceptionWidget ( QWidget* parent )
: QDialog (parent)
, _message (new QLabel())
: QDialog (parent)
, _message(new QLabel())
, _header (new QLabel())
{
setAttribute ( Qt::WA_DeleteOnClose );
setModal ( true );
setWindowTitle ( tr("<An Exception was Caught>") );
setToolTip ( tr("Ben mon cochon, t'es dans le bouillon") );
setAttribute ( Qt::WA_DeleteOnClose );
setModal ( true );
setWindowTitle( tr("<An Exception was Caught>") );
setToolTip ( tr("Ben mon cochon, t'es dans le bouillon") );
QLabel* header = new QLabel ();
header->setMinimumWidth ( 200 );
header->setTextFormat ( Qt::RichText );
header->setText ( "<b>[ERROR]</b>" );
_header->setMinimumWidth ( 200 );
_header->setTextFormat ( Qt::RichText );
_header->setText ( "<b>[ERROR]</b>" );
_message->setTextFormat ( Qt::RichText );
_message->setText ( "<b>Oups! I did it again!</b>" );
@ -78,7 +78,7 @@ namespace Hurricane {
QVBoxLayout* vLayout1 = new QVBoxLayout ();
vLayout1->setContentsMargins ( 10, 10, 10, 10 );
vLayout1->setSpacing ( 0 );
vLayout1->addWidget ( header , Qt::AlignCenter );
vLayout1->addWidget ( _header , Qt::AlignCenter );
vLayout1->addWidget ( _message, Qt::AlignCenter );
vLayout1->addSpacing ( 10 );
vLayout1->addLayout ( hLayout2, Qt::AlignCenter );
@ -104,7 +104,18 @@ namespace Hurricane {
void ExceptionWidget::setMessage ( const QString& message )
{
_message->setText ( message );
QString contents = message;
if ( contents.startsWith("[ERROR]")) {
contents.remove ( 0, 8 );
_header->setText ("<b>[ERROR]</b>");
} else if ( contents.startsWith("[WARNING]")) {
contents.remove ( 0, 10 );
_header->setText ("<b>[WARNING]</b>");
} else
_header->setText ("<b>[UNKNOW]</b>");
_message->setText ( contents );
}

View File

@ -71,9 +71,10 @@ namespace Hurricane {
QMenu* createDebugMenu ();
inline void setEnableRedrawInterrupt ( bool );
inline void setApplicationName ( const QString& );
void setCell ( Cell* );
Cell* getCell ();
virtual Cell* getCellFromDb ( const char* name );
void setCell ( Cell* );
void renameCell ( const char* );
virtual Cell* getCellFromDb ( const char* );
inline CellWidget* getCellWidget ();
inline ControllerWidget* getControllerWidget ();
void select ( Occurrence& );

View File

@ -2,7 +2,7 @@
// -*- C++ -*-
//
// This file is part of the Coriolis Software.
// Copyright (c) UPMC/LIP6 2008-2009, All Rights Reserved
// Copyright (c) UPMC/LIP6 2008-2010, All Rights Reserved
//
// ===================================================================
//
@ -36,16 +36,14 @@ namespace Hurricane {
class ExceptionWidget : public QDialog {
Q_OBJECT;
public:
ExceptionWidget ( QWidget* parent=NULL);
void setMessage ( const QString& );
ExceptionWidget ( QWidget* parent=NULL);
void setMessage ( const QString& );
private:
QLabel* _message;
QLabel* _header;
QLabel* _message;
protected:
virtual void closeEvent ( QCloseEvent* );
virtual void closeEvent ( QCloseEvent* );
};