Handling of Cell destruction in CellViewer.
* Change: In bootstrap, in socInstaler.sh, use the current version of rapidjson. * Change: In Hurricane, in FileWriteGzStream, complie to the latest rapidjson headers organization. * New: In Hurricane, in Cell, emit a new signal CellDestroyed toward the observers (i.e. the CellViewer(s)), from _preDestroy(). * Change: In Hurricane, in CellViewer, in CellObserver::notify(), manage the CellDestroyed case. Do not forget to remove the deleted Cell from the viewer's history.
This commit is contained in:
parent
4f709c8cae
commit
f28daec401
|
@ -155,8 +155,8 @@ class Command ( object ):
|
||||||
class GitRepository ( object ):
|
class GitRepository ( object ):
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def getLocalRepository ( gitRepository ):
|
def getLocalRepository ( url ):
|
||||||
localRepo = gitRepository.split( '/' )[-1]
|
localRepo = url.split( '/' )[-1]
|
||||||
if localRepo.endswith('.git'):
|
if localRepo.endswith('.git'):
|
||||||
localRepo = localRepo[:-4]
|
localRepo = localRepo[:-4]
|
||||||
return localRepo
|
return localRepo
|
||||||
|
@ -421,8 +421,8 @@ try:
|
||||||
for gitSupport in gitSupports:
|
for gitSupport in gitSupports:
|
||||||
if conf.rmSource: gitSupport.removeLocalRepo()
|
if conf.rmSource: gitSupport.removeLocalRepo()
|
||||||
gitSupport.clone()
|
gitSupport.clone()
|
||||||
if gitSupport.url.endswith('rapidjson'):
|
#if gitSupport.url.endswith('rapidjson'):
|
||||||
gitSupport.checkout( 'a1c4f32' )
|
# gitSupport.checkout( 'a1c4f32' )
|
||||||
|
|
||||||
if conf.rmSource: gitCoriolis.removeLocalRepo()
|
if conf.rmSource: gitCoriolis.removeLocalRepo()
|
||||||
gitCoriolis.clone ()
|
gitCoriolis.clone ()
|
||||||
|
|
|
@ -930,6 +930,8 @@ void Cell::_postCreate()
|
||||||
void Cell::_preDestroy()
|
void Cell::_preDestroy()
|
||||||
// ********************
|
// ********************
|
||||||
{
|
{
|
||||||
|
notify( Flags::CellDestroyed );
|
||||||
|
|
||||||
while ( _slaveEntityMap.size() ) {
|
while ( _slaveEntityMap.size() ) {
|
||||||
_slaveEntityMap.begin()->second->destroy();
|
_slaveEntityMap.begin()->second->destroy();
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,6 +84,7 @@ class Cell : public Entity {
|
||||||
// Flags set for Observers.
|
// Flags set for Observers.
|
||||||
, CellAboutToChange = 0x00000100
|
, CellAboutToChange = 0x00000100
|
||||||
, CellChanged = 0x00000200
|
, CellChanged = 0x00000200
|
||||||
|
, CellDestroyed = 0x00000400
|
||||||
// Cell states
|
// Cell states
|
||||||
, Terminal = 0x00001000
|
, Terminal = 0x00001000
|
||||||
, FlattenLeaf = 0x00002000
|
, FlattenLeaf = 0x00002000
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#define HURRICANE_FILEWRITEGZSTREAM_H
|
#define HURRICANE_FILEWRITEGZSTREAM_H
|
||||||
|
|
||||||
#include "rapidjson/rapidjson.h"
|
#include "rapidjson/rapidjson.h"
|
||||||
|
#include "rapidjson/filewritestream.h"
|
||||||
|
|
||||||
|
|
||||||
namespace Hurricane {
|
namespace Hurricane {
|
||||||
|
|
|
@ -65,13 +65,21 @@ namespace Hurricane {
|
||||||
void CellObserver::notify ( unsigned int flags )
|
void CellObserver::notify ( unsigned int flags )
|
||||||
{
|
{
|
||||||
CellViewer* viewer = getOwner();
|
CellViewer* viewer = getOwner();
|
||||||
switch ( flags & (Cell::Flags::CellAboutToChange|Cell::Flags::CellChanged) ) {
|
switch ( flags & (Cell::Flags::CellAboutToChange
|
||||||
|
|Cell::Flags::CellChanged
|
||||||
|
|Cell::Flags::CellDestroyed) ) {
|
||||||
case Cell::Flags::CellAboutToChange:
|
case Cell::Flags::CellAboutToChange:
|
||||||
viewer->emitCellAboutToChange();
|
viewer->emitCellAboutToChange();
|
||||||
break;
|
break;
|
||||||
case Cell::Flags::CellChanged:
|
case Cell::Flags::CellChanged:
|
||||||
viewer->emitCellChanged();
|
viewer->emitCellChanged();
|
||||||
break;
|
break;
|
||||||
|
case Cell::Flags::CellDestroyed:
|
||||||
|
viewer->emitCellAboutToChange();
|
||||||
|
viewer->removeHistory( viewer->getCell() );
|
||||||
|
viewer->setCell( NULL );
|
||||||
|
viewer->emitCellChanged();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -567,6 +575,12 @@ namespace Hurricane {
|
||||||
_cellHistory.pop_front ();
|
_cellHistory.pop_front ();
|
||||||
_cellHistory.push_back ( activeState );
|
_cellHistory.push_back ( activeState );
|
||||||
|
|
||||||
|
rebuildHistory ();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CellViewer::rebuildHistory ()
|
||||||
|
{
|
||||||
list< shared_ptr<CellWidget::State> >::iterator istate = _cellHistory.begin();
|
list< shared_ptr<CellWidget::State> >::iterator istate = _cellHistory.begin();
|
||||||
for ( size_t i=0 ; i<CellHistorySize ; i++ ) {
|
for ( size_t i=0 ; i<CellHistorySize ; i++ ) {
|
||||||
if ( istate != _cellHistory.end() ) {
|
if ( istate != _cellHistory.end() ) {
|
||||||
|
@ -584,6 +598,20 @@ namespace Hurricane {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CellViewer::removeHistory ( Cell* cell )
|
||||||
|
{
|
||||||
|
Name cellName = (cell) ? cell->getName() : "empty";
|
||||||
|
|
||||||
|
list< shared_ptr<CellWidget::State> >::iterator istate
|
||||||
|
= find_if( _cellHistory.begin(), _cellHistory.end(), CellWidget::FindStateName(cellName) );
|
||||||
|
|
||||||
|
if (istate != _cellHistory.end()) {
|
||||||
|
_cellHistory.remove ( *istate );
|
||||||
|
rebuildHistory ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void CellViewer::setState ( shared_ptr<CellWidget::State>& state )
|
void CellViewer::setState ( shared_ptr<CellWidget::State>& state )
|
||||||
{
|
{
|
||||||
static bool isEmitter = false;
|
static bool isEmitter = false;
|
||||||
|
@ -616,12 +644,14 @@ namespace Hurricane {
|
||||||
= find_if( _cellHistory.begin(), _cellHistory.end(), CellWidget::FindStateName(cellName) );
|
= find_if( _cellHistory.begin(), _cellHistory.end(), CellWidget::FindStateName(cellName) );
|
||||||
|
|
||||||
if (istate != _cellHistory.end()) {
|
if (istate != _cellHistory.end()) {
|
||||||
|
cerr << "CellViewer::setCell() " << (*istate)->getCell() << endl;
|
||||||
|
|
||||||
(*istate)->getCell()->addObserver( getCellObserver() );
|
(*istate)->getCell()->addObserver( getCellObserver() );
|
||||||
emit stateChanged ( *istate );
|
emit stateChanged ( *istate );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
cell->addObserver( getCellObserver() );
|
if (cell) cell->addObserver( getCellObserver() );
|
||||||
_cellWidget->setCell( cell );
|
_cellWidget->setCell( cell );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -135,6 +135,7 @@ namespace Hurricane {
|
||||||
void changeSelectionMode ();
|
void changeSelectionMode ();
|
||||||
void setShowSelection ( bool );
|
void setShowSelection ( bool );
|
||||||
void setState ( shared_ptr<CellWidget::State>& );
|
void setState ( shared_ptr<CellWidget::State>& );
|
||||||
|
void removeHistory ( Cell* );
|
||||||
void openHistoryCell ();
|
void openHistoryCell ();
|
||||||
void openDesignBlob ();
|
void openDesignBlob ();
|
||||||
void saveDesignBlob ();
|
void saveDesignBlob ();
|
||||||
|
@ -160,6 +161,7 @@ namespace Hurricane {
|
||||||
void createMenus ();
|
void createMenus ();
|
||||||
void refreshTitle ();
|
void refreshTitle ();
|
||||||
void refreshHistory ();
|
void refreshHistory ();
|
||||||
|
void rebuildHistory ();
|
||||||
private:
|
private:
|
||||||
QString _getAbsWidgetPath ( const QString& relPath ) const;
|
QString _getAbsWidgetPath ( const QString& relPath ) const;
|
||||||
QMenu* _getParentMenu ( const QString& ) const;
|
QMenu* _getParentMenu ( const QString& ) const;
|
||||||
|
|
Loading…
Reference in New Issue