Commit 588c8a6a authored by Otmane Lahlou's avatar Otmane Lahlou
Browse files

ENH: method to fill the TreeWidget ans slot to receive the tag/appsName map

parent dddd2520
......@@ -76,8 +76,71 @@ ApplicationsToolBox
{
}
/*******************************************************************************/
QTreeWidget *
ApplicationsToolBox
::GetAlgorithmsTree()
{
return m_UI->m_AlgorithmsTree;
}
/*******************************************************************************/
void
ApplicationsToolBox
::FillTreeUsingTags()
{
//
// clear algorithms tree
GetAlgorithmsTree()->clear();
//
// main item (title)
QTreeWidgetItem * mainItem = new QTreeWidgetItem( GetAlgorithmsTree() );
mainItem->setText(0, "Orfeo Toolbox Algorithms");
//
//
ApplicationsTagContainer::const_iterator itTag = m_AppTags.begin();
while( itTag != m_AppTags.end() )
{
// Step # 1 -> Tag as a main item
// set current tag as a main item
QTreeWidgetItem * cmainItem = new QTreeWidgetItem( mainItem );
QString qcurrentMainItem( (*itTag).first.c_str() );
cmainItem->setText(0, qcurrentMainItem );
// step #2 -> Applications name as secondary items
// iterate over the StringVector containing the apps relative to
// this tag
StringVector::const_iterator itApps = (*itTag).second.begin();
while( itApps != (*itTag).second.end() )
{
//
// set current tag as main item
QTreeWidgetItem * secItem = new QTreeWidgetItem( cmainItem );
QString qcurrentSecItem( (*itApps).c_str() );
secItem->setText(0, qcurrentSecItem);
++itApps;
}
++itTag;
}
}
/*******************************************************************************/
/* SLOTS */
/*******************************************************************************/
void
ApplicationsToolBox
::OnAvailableApplicationsTagsChanged(const ApplicationsTagContainer& appsTags )
{
// rememeber the map
m_AppTags = appsTags;
// fill the tree with the application
FillTreeUsingTags();
}
/*******************************************************************************/
} // end namespace 'mvd'
......@@ -44,7 +44,7 @@
//
// Monteverdi includes (sorted by alphabetic order)
#include "mvdTypes.h"
/*****************************************************************************/
/* PRE-DECLARATION SECTION */
......@@ -94,11 +94,15 @@ public:
/** \brief Destructor. */
virtual ~ApplicationsToolBox();
/** Get TreeWidget */
QTreeWidget * GetAlgorithmsTree();
/*-[ PUBLIC SLOTS SECTION ]------------------------------------------------*/
//
// Public SLOTS.
public slots:
void OnAvailableApplicationsTagsChanged(const ApplicationsTagContainer& appsTags );
/*-[ SIGNALS SECTION ]-----------------------------------------------------*/
......@@ -121,6 +125,10 @@ protected:
//
// Private methods.
private:
/**
* \brief fill the widget tree using the tags map
*/
void FillTreeUsingTags();
//
// Private attributes.
......@@ -130,6 +138,12 @@ private:
*/
Ui::ApplicationsToolBox* m_UI;
/**
* \brief map storing applications and its tags
*/
ApplicationsTagContainer m_AppTags;
/*-[ PRIVATE SLOTS SECTION ]-----------------------------------------------*/
//
......
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