Skip to content

Commit

Permalink
get the lastselected one from the tracemanager to be selected each ti…
Browse files Browse the repository at this point in the history
…me all the collectionids are loaded from the database
  • Loading branch information
lsouhait committed Dec 22, 2010
1 parent 921de08 commit 10c2789
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 14 deletions.
4 changes: 3 additions & 1 deletion Code/GUI/lib/QGoDBTraceManager.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -365,8 +365,10 @@ double * QGoDBTraceManager::GetVectorFromQColor(QColor iColor)
//------------------------------------------------------------------------
std::list< QGoDBTraceManager::NameWithColorData >
QGoDBTraceManager::GetAllTraceIDsWithColor(
vtkMySQLDatabase *iDatabaseConnector, int iTimePoint)
vtkMySQLDatabase *iDatabaseConnector, std::string & ioIDToSelect,
int iTimePoint)
{
ioIDToSelect = this->m_LastSelectedTraceAsCollection;
if ( iTimePoint == -1 )
{
return this->m_CollectionOfTraces->GetAllTracesIDsWithColor(
Expand Down
3 changes: 2 additions & 1 deletion Code/GUI/lib/QGoDBTraceManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class QGOGUILIB_EXPORT QGoDBTraceManager:public QObject
corresponding QColor
*/
std::list< NameWithColorData > GetAllTraceIDsWithColor(
vtkMySQLDatabase *iDatabaseConnector, int iTimePoint = -1);
vtkMySQLDatabase *iDatabaseConnector, std::string & ioIDToSelect, int iTimePoint = -1);

/**
\brief delete the corresponding traces in the table widget and in the
Expand Down Expand Up @@ -273,6 +273,7 @@ class QGOGUILIB_EXPORT QGoDBTraceManager:public QObject
NameWithColorData* m_SelectedCollectionData;
NameWithColorData* m_SelectedColorData;
int* m_CurrentTimePoint;
std::string m_LastSelectedTraceAsCollection;

int m_ImgSessionID;
QGoTableWidget * m_Table;
Expand Down
37 changes: 28 additions & 9 deletions Code/GUI/lib/QGoPrintDatabase.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -422,17 +422,18 @@ bool QGoPrintDatabase::IsDatabaseUsed()

//-------------------------------------------------------------------------
std::list< QGoPrintDatabase::ItemColorComboboxData >
QGoPrintDatabase::GetListCollectionIDFromDB(vtkMySQLDatabase *iDatabaseConnector)
QGoPrintDatabase::GetListCollectionIDFromDB(vtkMySQLDatabase *iDatabaseConnector,
std::string & ioIDToSelect)
{
std::list< ItemColorComboboxData > EmptyList = std::list< ItemColorComboboxData >();
std::string TraceName = this->m_TraceWidget->GetTraceName();
if ( TraceName == "contour" )
{
return this->m_MeshesManager->GetAllTraceIDsWithColor(iDatabaseConnector);
return this->m_MeshesManager->GetAllTraceIDsWithColor(iDatabaseConnector, ioIDToSelect);
}
if ( TraceName == "mesh" )
{
return this->m_TracksManager->GetAllTraceIDsWithColor(iDatabaseConnector);
return this->m_TracksManager->GetAllTraceIDsWithColor(iDatabaseConnector, ioIDToSelect);
}
return EmptyList;
}
Expand Down Expand Up @@ -542,9 +543,9 @@ void QGoPrintDatabase::UpdateSelectedTimePoint(int iTimePoint)
this->m_ContoursManager->CheckShowRows();
}
if (this->m_TraceWidget->GetTraceName() == "mesh")
{
{
this->m_MeshesManager->CheckShowRows();
}
}
}
}

Expand Down Expand Up @@ -794,12 +795,13 @@ void QGoPrintDatabase::CreateConnectionsForTraceManualEditingWidget()
void QGoPrintDatabase::UpdateWidgetsForCorrespondingTrace(std::string iTraceName,
std::string iCollectionName, bool UpdateTableWidget)
{
if ( UpdateTableWidget )
/*if ( UpdateTableWidget )
{
std::string test = this->InWhichTableAreWe();
if (this->InWhichTableAreWe() != iTraceName)
{
this->m_TraceWidget->UpdateTraceAndCollection(iTraceName, iCollectionName);
this->SetTMListCollectionID();
// show the updated widget
this->m_TraceManualEditingDockWidget->show();
Expand All @@ -815,7 +817,22 @@ void QGoPrintDatabase::UpdateWidgetsForCorrespondingTrace(std::string iTraceName
this->m_TraceWidget->UpdateTraceAndCollection(iTraceName, iCollectionName);
this->SetTMListCollectionID();
// show the updated widget
this->m_TraceManualEditingDockWidget->show();
this->m_TraceManualEditingDockWidget->show();*/
std::string test = this->InWhichTableAreWe();
if (this->InWhichTableAreWe() != iTraceName)
{
this->m_TraceWidget->UpdateTraceAndCollection(iTraceName, iCollectionName);

this->SetTMListCollectionID();
// show the updated widget
this->m_TraceManualEditingDockWidget->show();
}
if ( UpdateTableWidget )
{
this->blockSignals(true);
this->SetTable(iTraceName);
this->blockSignals(false);
}
}

//-------------------------------------------------------------------------
Expand Down Expand Up @@ -853,11 +870,13 @@ void QGoPrintDatabase::SetTMListColorsWithPreviousSelectedOne()
//-------------------------------------------------------------------------

//-------------------------------------------------------------------------
void QGoPrintDatabase::SetTMListCollectionID(std::string iIDToSelect)
void QGoPrintDatabase::SetTMListCollectionID()
{
this->OpenDBConnection();
std::string IDToSelect;
this->m_TraceWidget->SetListCollectionID(
this->GetListCollectionIDFromDB(this->m_DatabaseConnector), iIDToSelect);
this->GetListCollectionIDFromDB(this->m_DatabaseConnector, IDToSelect),
IDToSelect);
this->CloseDBConnection();
}

Expand Down
5 changes: 2 additions & 3 deletions Code/GUI/lib/QGoPrintDatabase.h
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ public slots:
\param[in] iDatabaseConnector connection to the database
*/
std::list< ItemColorComboboxData > GetListCollectionIDFromDB(
vtkMySQLDatabase *iDatabaseConnector);
vtkMySQLDatabase *iDatabaseConnector, std::string & ioIDToSelect);

void closeEvent(QCloseEvent *event);

Expand Down Expand Up @@ -542,9 +542,8 @@ protected slots:
collection is a mesh or for all timepoints for tracks and lineages,
update the Trace Manual colorcombobox and select the corresponding ID in the combobox
if the string is not empty
\param[in] iIDToSelect ID to select in the combobox
*/
void SetTMListCollectionID(std::string iIDToSelect = "");
void SetTMListCollectionID();

/**
\brief open the connection to the database and pass it to the ContoursManager
Expand Down

0 comments on commit 10c2789

Please sign in to comment.