Commit 1dee6eb8 authored by Antoine Regimbeau's avatar Antoine Regimbeau

BUG: clean debug trace

parent 59692c86
......@@ -212,7 +212,7 @@ public:
// Public SLOTS.
public slots:
void Clear();
void Deleting( int index );
void Deleting( unsigned int index );
inline void Delete( const KeyType & );
inline void DeleteCurrent();
inline void LowerCurrent();
......
......@@ -220,7 +220,7 @@ StackedLayerModel
/*****************************************************************************/
void
StackedLayerModel
::Deleting( int index )
::Deleting( unsigned int index )
{
// qDebug() << this << "::Delete(" << index << ")";
......@@ -315,95 +315,8 @@ void
StackedLayerModel
::Delete( SizeType index )
{
/*// qDebug() << this << "::Delete(" << index << ")";
//
// Check content.
if( IsEmpty() )
return;
if( index>=GetCount() )
return;
assert( !m_Keys[ index ].empty() );
//
// Find item.
LayerModelMap::iterator it(
m_LayerModels.find( m_Keys[ index ] )
);
assert( it!=m_LayerModels.end() );
//
// Check if signals have to be emitted.
bool emitCurrentChanged = m_Current<GetCount() && index<=m_Current;
bool emitReferenceChanged = m_Reference<GetCount() && index<=m_Reference;
//
// Remember new current index.
SizeType current =
index>m_Current
? m_Current
: ( m_Current>0
? m_Current - 1
: GetCount()>1 ? 0 : StackedLayerModel::NIL_INDEX );
//
// Emit signals.
emit ContentAboutToBeChanged();
emit LayerAboutToBeDeleted( index );
//
// Clear satellite date.
ClearPixelInfos();
//
// Remove layer-model.
AbstractLayerModel * layer = it->second;
// Disconnect the renaming signals
QObject::disconnect(
layer,
SIGNAL( NameChanged() ),
// from:
this,
SIGNAL( LayerRenamed() )
);
m_LayerModels.erase( it );
m_Keys.erase( m_Keys.begin() + index );
it = m_LayerModels.end();
//
// Update pointer to current.
if( emitCurrentChanged )
SetCurrent( current, true );
//
// Update reference pointer.
if( emitReferenceChanged )
SetReference(
index>m_Reference
? m_Reference
: ( m_Reference > 0
? m_Reference - 1
: GetCount() > 0 ? 0 : StackedLayerModel::NIL_INDEX ),
true
);
//
// Eventually delete layer.
if( layer->parent()==this )
{
delete layer;
layer = NULL;
}
//*/
// the work of deleting model is now done in the above function
// Deleting(unsigned int index)
// Emit signals.
emit LayerDeleted( index );
emit ContentChanged();
......
......@@ -255,7 +255,9 @@ public slots:
//
// Signals.
signals:
void LayerDeletingModel( int index);
//Bugfix for layer deletion
void LayerDeletingModel( unsigned int index);
/*-[ PROTECTED SECTION ]---------------------------------------------------*/
......
......@@ -154,16 +154,15 @@ public:
// Public SLOTS.
public slots:
//bugfix
void OnLayerDeletingWidget( int index );
/*-[ SIGNALS SECTION ]-----------------------------------------------------*/
//
// Signals.
signals:
//bugFix
void LayerDeletingWidget( int index );
/**
*/
//bugFix for layer deletion
void LayerDeletingWidget( unsigned int index );
/**
*/
void CurrentChanged( int );
......
......@@ -150,17 +150,14 @@ LayerStackController
SLOT( OnProjectionButtonClicked() )
);
//bugfix
bool conSuc =
//bugfix for layer deletion
QObject::connect(
widget,
SIGNAL( LayerDeletingWidget( int ) ),
SIGNAL( LayerDeletingWidget( unsigned int ) ),
// to:
model,
SLOT( Deleting( int ) )
SLOT( Deleting( unsigned int ) )
);
std::cout<<"LayerDeletingWidget connect with Deleting : "
<<conSuc<<std::endl;
QObject::connect(
widget,
......@@ -300,6 +297,14 @@ LayerStackController
SLOT( OnProjectionButtonClicked() )
);
//Bugfix for layer deletion
QObject::disconnect(
widget,
SIGNAL( LayerDeletingWidget( unsigned int ) ),
// to:
model,
SLOT( Deleting( unsigned int ) )
);
QObject::disconnect(
widget,
......
......@@ -108,7 +108,6 @@ LayerStackItemModel
QAbstractItemModel( p ),
m_StackedLayerModel( NULL )
{
std::cout<<"Construction of ItemModel : "<<this<<std::endl;
// QObject::connect(
// this,
// SIGNAL( modelAboutToBeReset() ),
......@@ -792,7 +791,7 @@ LayerStackItemModel
beginRemoveRows( p, row, row + count - 1 );
{
// StackedLayerModel has already been shortened.
// StackedLayerModel need to be shortened now
emit LayerDeletingModel(row);
// TODO: Release additional row data here.
}
......
......@@ -113,7 +113,6 @@ LayerStackWidget
SLOT( OnCurrentRowChanged( const QModelIndex &, const QModelIndex & ) )
);
bool test =
QObject::connect(
m_UI->treeView->selectionModel(),
SIGNAL( selectionChanged( const QItemSelection &, const QItemSelection & ) ),
......@@ -121,7 +120,6 @@ bool test =
this,
SLOT( OnSelectionChanged( const QItemSelection &, const QItemSelection & ) )
);
std::cout<<"An other conncetion worked : "<<test<<std::endl;
QObject::connect(
m_UI->topButton,
......@@ -195,27 +193,17 @@ bool test =
SIGNAL( ResetEffectsButtonClicked() )
);
/////// Bugfix
bool connectionBugFix = QObject::connect(
/////// Bugfix for layer deletion
QObject::connect(
this->GetItemModel(),
SIGNAL( LayerDeletingModel(int) ),
SIGNAL( LayerDeletingModel( unsigned int ) ),
// to:
this,
SLOT( OnLayerDeletingWidget(int) )
SIGNAL( LayerDeletingWidget( unsigned int) )
);
std::cout<<"LayerDeletingModel connected with OnLayerDeletingWidget : "
<<connectionBugFix<<std::endl;
std::cout<<"Model adress : "<<m_UI->treeView->selectionModel()<<std::endl;
///////////////
}
void
LayerStackWidget
::OnLayerDeletingWidget(int index)
{
std::cout<<"In widget, sending LayerDeletingSignal"<<std::endl;
emit LayerDeletingWidget(index);
}
/*******************************************************************************/
LayerStackWidget
::~LayerStackWidget()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment