Commit 3ff047a2 authored by schurade's avatar schurade

[ADD] connect the module buttons to a kernel function

parent 830fd6e7
......@@ -111,6 +111,13 @@ public:
*/
virtual std::vector< boost::shared_ptr< WDataSet > > getDataSetList( int subjectId, bool onlyTextures = false ) = 0;
/**
* returns a pointer to the selected module in the dataset browser
*
* \return the module
*/
virtual boost::shared_ptr< WModule > getSelectedModule() = 0;
/**
* getter functions for the signales proved by the gui
*/
......
......@@ -209,6 +209,12 @@ boost::signals2::signal1< void, std::vector< std::string > >* WMainWindow::getLo
return &m_loaderSignal;
}
boost::signals2::signal1< void, std::string >* WMainWindow::getModuleButtonSignal()
{
return &m_moduleButtonSignal;
}
boost::signals2::signal1< void, std::string >* WMainWindow::getPickSignal()
{
return m_mainGLWidget->getPickSignal();
......@@ -253,3 +259,7 @@ void WMainWindow::closeEvent( QCloseEvent* e )
}
}
void WMainWindow::slotActivateModule( QString module )
{
m_moduleButtonSignal( module.toStdString() );
}
......@@ -96,6 +96,12 @@ public:
*/
boost::signals2::signal1< void, std::vector< std::string > >* getLoaderSignal();
/**
*
*/
boost::signals2::signal1< void, std::string >* getModuleButtonSignal();
/**
*
*/
......@@ -116,6 +122,11 @@ public slots:
*/
void openLoadDialog();
/**
* get called when a module button
*/
void slotActivateModule( QString module );
private:
void setupToolBar();
......@@ -134,6 +145,8 @@ private:
boost::shared_ptr< WQtNavGLWidget > m_navSagittal;
boost::signals2::signal1< void, std::vector< std::string > > m_loaderSignal;
boost::signals2::signal1< void, std::string > m_moduleButtonSignal;
};
#endif // WMAINWINDOW_H
......@@ -142,7 +142,9 @@ int WQt4Gui::run()
m_gui->show();
// connect out loader signal with krnel
getLoadButtonSignal()->connect( boost::bind( &WKernel::doLoadDataSets, m_kernel, _1 ) );
getLoadButtonSignal()->connect( boost::bind( &WKernel::slotLoadDataSets, m_kernel, _1 ) );
m_gui->getModuleButtonSignal()->connect( boost::bind( &WKernel::slotActivateModule, m_kernel, _1 ) );
// bind the GUI's slot with the ready signal
t_ModuleGenericSignalHandlerType f = boost::bind( &WGUI::slotAddDatasetToBrowser, this, _1 );
......@@ -154,7 +156,7 @@ int WQt4Gui::run()
// check if we want to load data due to command line and call the respective function
if( m_optionsMap.count("input") )
{
m_kernel->doLoadDataSets( m_optionsMap["input"].as< std::vector< std::string > >() );
m_kernel->slotLoadDataSets( m_optionsMap["input"].as< std::vector< std::string > >() );
}
// run
......@@ -183,6 +185,12 @@ std::vector< boost::shared_ptr< WDataSet > > WQt4Gui::getDataSetList( int subjec
return m_gui->getDatasetBrowser()->getDataSetList( subjectId, onlyTextures );
}
boost::shared_ptr< WModule > WQt4Gui::getSelectedModule()
{
return m_gui->getDatasetBrowser()->getSelectedModule();
}
boost::signals2::signal1< void, std::vector< std::string > >* WQt4Gui::getLoadButtonSignal()
{
return m_gui->getLoaderSignal();
......
......@@ -89,6 +89,15 @@ public:
*/
virtual std::vector< boost::shared_ptr< WDataSet > > getDataSetList( int subjectId, bool onlyTextures = false );
/**
* returns a pointer to the selected module in the dataset browser
*
* \return the module
*/
virtual boost::shared_ptr< WModule > getSelectedModule();
/**
* getter functions for the signales proved by the gui
*/
......
......@@ -162,8 +162,10 @@ void WQtDatasetBrowser::selectTreeItem()
std::set< boost::shared_ptr< WModule > > comps = WModuleFactory::getModuleFactory()->getCompatiblePrototypes( module );
for ( std::set< boost::shared_ptr< WModule > >::iterator iter = comps.begin(); iter != comps.end(); ++iter )
{
m_mainWindow->getToolBar()->addPushButton( QString( ( *iter )->getName().c_str() ), QString( "Compatibles" ),
WQtPushButton* button = m_mainWindow->getToolBar()->addPushButton( QString( ( *iter )->getName().c_str() ), QString( "Compatibles" ),
m_mainWindow->getIconManager()->getIcon( "load" ), QString( ( *iter )->getName().c_str() ) );
connect( button, SIGNAL( pushButtonPressed( QString ) ), m_mainWindow, SLOT( slotActivateModule( QString ) ) );
}
}
else
......
......@@ -49,7 +49,7 @@ QString WQtPushButton::getName()
void WQtPushButton::emitPressed()
{
emit pushButtonPressed( m_name, true );
emit pushButtonPressed( m_name );
emit pushButtonToggled( m_name, this->isChecked() );
}
......@@ -69,7 +69,7 @@ public slots:
void emitPressed();
signals:
void pushButtonPressed( QString name, bool value );
void pushButtonPressed( QString name );
void pushButtonToggled( QString name, bool value );
};
......
......@@ -64,6 +64,7 @@ WQtPushButton* WQtRibbonMenu::addPushButton( QString name, QString tabName, QIco
assert( m_buttonList.count( name ) == 0 );
WQtPushButton* button = new WQtPushButton( icon, label );
button->setName( name );
m_tabList[tabName]->addButton( button );
......
......@@ -221,7 +221,7 @@ const WBoolFlag& WKernel::isFinishRequested() const
return m_shutdownFlag;
}
void WKernel::doLoadDataSets( std::vector< std::string > fileNames )
void WKernel::slotLoadDataSets( std::vector< std::string > fileNames )
{
// add a new data module for each file to load
using boost::shared_ptr;
......@@ -233,6 +233,11 @@ void WKernel::doLoadDataSets( std::vector< std::string > fileNames )
}
}
void WKernel::slotActivateModule( std::string module )
{
std::cout << module << "<->" << m_gui->getSelectedModule()->getName() << std::endl;
}
boost::shared_ptr< WDataHandler > WKernel::getDataHandler() const
{
return m_dataHandler;
......
......@@ -111,7 +111,12 @@ public:
* \param fileNames list of filenames to load. The registered notification handler for the root container will get notified on
* error and success.
*/
void doLoadDataSets( std::vector< std::string > fileNames );
void slotLoadDataSets( std::vector< std::string > fileNames );
/**
*
*/
void slotActivateModule( std::string module );
/**
* Returns the root module container. This is the actual module graph container.
......
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