Commit 5dc18d30 authored by Otmane Lahlou's avatar Otmane Lahlou

ENH: connect actions on the widget tree and on the search box to their slots

parent 9941b80c
......@@ -38,6 +38,7 @@
//
// Monteverdi includes (sorted by alphabetic order)
#include "mvdAlgorithm.h"
namespace mvd
{
......@@ -68,6 +69,22 @@ ApplicationsToolBox
m_UI( new mvd::Ui::ApplicationsToolBox() )
{
m_UI->setupUi( this );
//
// connect search box changed
QObject::connect(m_UI->m_SearchLine,
SIGNAL( textChanged(const QString &) ),
this,
SLOT( OnSearchBoxChanged(const QString &) )
);
//
// connect double click on the tree Widget
QObject::connect(GetAlgorithmsTree(),
SIGNAL( itemDoubleClicked(QTreeWidgetItem* ,int) ),
this,
SLOT( OnAlgorithmTreeDoubleClick(QTreeWidgetItem* ,int) )
);
}
/*******************************************************************************/
......@@ -112,7 +129,8 @@ ApplicationsToolBox
cmainItem->setText(0, qcurrentMainItem );
//
// step #2 -> Applications name as secondary items
// TODO : add category icon
// step #2 -> Applications name are secondary items
StringVector::const_iterator itApps = (*itTag).second.begin();
while( itApps != (*itTag).second.end() )
{
......@@ -121,6 +139,10 @@ ApplicationsToolBox
QTreeWidgetItem * secItem = new QTreeWidgetItem( cmainItem );
QString qcurrentSecItem( (*itApps).c_str() );
secItem->setText(0, qcurrentSecItem);
//
// TODO : add algorithm icon
++itApps;
}
......@@ -128,6 +150,14 @@ ApplicationsToolBox
}
}
/*******************************************************************************/
void
ApplicationsToolBox
::ExecuteAlgorithm( const QString& appName )
{
std::cout <<"ApplicationsToolBox::ExecuteAlgorithm - "<< ToStdString( appName )<< "- WIP."<< std::endl;
}
/*******************************************************************************/
/* SLOTS */
/*******************************************************************************/
......@@ -142,6 +172,35 @@ ApplicationsToolBox
FillTreeUsingTags();
}
/*******************************************************************************/
void
ApplicationsToolBox
::OnSearchBoxChanged(const QString & search)
{
//
// get the search text
m_SearchText = search;
// fill the tree with the application
FillTreeUsingTags();
}
/*******************************************************************************/
void
ApplicationsToolBox
::OnAlgorithmTreeDoubleClick( QTreeWidgetItem * item , int column )
{
std::cout <<"Algorithm name "<< ToStdString( item->text( column ) ) << std::endl;
QString appName = item->text( column );
//
// Execute the algorithm
if ( !appName.isEmpty() )
{
ExecuteAlgorithm( appName );
}
}
/*******************************************************************************/
} // end namespace 'mvd'
......@@ -102,7 +102,9 @@ public:
//
// Public SLOTS.
public slots:
void OnAvailableApplicationsTagsChanged(const ApplicationsTagContainer& appsTags );
void OnAvailableApplicationsTagsChanged( const ApplicationsTagContainer& appsTags );
void OnSearchBoxChanged( const QString & search );
void OnAlgorithmTreeDoubleClick( QTreeWidgetItem * item , int column );
/*-[ SIGNALS SECTION ]-----------------------------------------------------*/
......@@ -130,6 +132,11 @@ private:
*/
void FillTreeUsingTags();
/**
* \brief Launch the appName algorithm
*/
void ExecuteAlgorithm( const QString& appName );
//
// Private attributes.
private:
......@@ -141,8 +148,12 @@ private:
/**
* \brief map storing applications and its tags
*/
ApplicationsTagContainer m_AppTags;
ApplicationsTagContainer m_AppTags;
/**
* \brief text to search in the widget tree
*/
QString m_SearchText;
/*-[ 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