Commit b347ecaa authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum

[CHANGE] - now the applyModule function acutally adds modules to the root container

parent 448d7152
......@@ -204,7 +204,7 @@ boost::signals2::signal1< void, std::vector< std::string > >* WMainWindow::getLo
return &m_loaderSignal;
}
boost::signals2::signal1< void, std::string >* WMainWindow::getModuleButtonSignal()
boost::signals2::signal2< void, boost::shared_ptr< WModule >, boost::shared_ptr< WModule > >* WMainWindow::getModuleButtonSignal()
{
return &m_moduleButtonSignal;
}
......@@ -256,5 +256,7 @@ void WMainWindow::closeEvent( QCloseEvent* e )
void WMainWindow::slotActivateModule( QString module )
{
m_moduleButtonSignal( module.toStdString() );
// TODO(schurade): do we really need the signal? Why can't we use the kernel directly?
m_moduleButtonSignal( getDatasetBrowser()->getSelectedModule(), WModuleFactory::getModuleFactory()->getPrototypeByName( module.toStdString() ) );
}
......@@ -45,6 +45,9 @@
#include "WIconManager.h"
#include "WPropertyManager.h"
#include "datasetbrowser/WQtDatasetBrowser.h"
#include "../../kernel/WModule.h"
// forward declarations
class WQtGLWidget;
......@@ -92,10 +95,11 @@ public:
boost::signals2::signal1< void, std::vector< std::string > >* getLoaderSignal();
/**
* Returns the signal emitted by those module buttons in the compatibility tab.
*
* \return the signal.
*/
boost::signals2::signal1< void, std::string >* getModuleButtonSignal();
boost::signals2::signal2< void, boost::shared_ptr< WModule >, boost::shared_ptr< WModule > >* getModuleButtonSignal();
/**
*
......@@ -141,7 +145,7 @@ private:
boost::signals2::signal1< void, std::vector< std::string > > m_loaderSignal;
boost::signals2::signal1< void, std::string > m_moduleButtonSignal;
boost::signals2::signal2< void, boost::shared_ptr< WModule >, boost::shared_ptr< WModule > > m_moduleButtonSignal;
};
#endif // WMAINWINDOW_H
......@@ -142,9 +142,9 @@ int WQt4Gui::run()
m_gui->show();
// connect out loader signal with krnel
getLoadButtonSignal()->connect( boost::bind( &WKernel::slotLoadDataSets, m_kernel, _1 ) );
getLoadButtonSignal()->connect( boost::bind( &WKernel::loadDataSets, m_kernel, _1 ) );
m_gui->getModuleButtonSignal()->connect( boost::bind( &WKernel::slotActivateModule, m_kernel, _1 ) );
m_gui->getModuleButtonSignal()->connect( boost::bind( &WKernel::applyModule, m_kernel, _1, _2 ) );
// bind the GUI's slot with the ready signal
t_ModuleGenericSignalHandlerType f = boost::bind( &WGUI::slotAddDatasetToBrowser, this, _1 );
......@@ -156,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->slotLoadDataSets( m_optionsMap["input"].as< std::vector< std::string > >() );
m_kernel->loadDataSets( m_optionsMap["input"].as< std::vector< std::string > >() );
}
// run
......
......@@ -221,7 +221,7 @@ const WBoolFlag& WKernel::isFinishRequested() const
return m_shutdownFlag;
}
void WKernel::slotLoadDataSets( std::vector< std::string > fileNames )
void WKernel::loadDataSets( std::vector< std::string > fileNames )
{
// add a new data module for each file to load
using boost::shared_ptr;
......@@ -233,9 +233,9 @@ void WKernel::slotLoadDataSets( std::vector< std::string > fileNames )
}
}
void WKernel::slotActivateModule( std::string module )
boost::shared_ptr< WModule > WKernel::applyModule( boost::shared_ptr< WModule > applyOn, boost::shared_ptr< WModule > prototype )
{
std::cout << module << "<->" << m_gui->getSelectedModule()->getName() << std::endl;
return getRootContainer()->applyModule( applyOn, prototype );
}
boost::shared_ptr< WDataHandler > WKernel::getDataHandler() const
......
......@@ -111,12 +111,17 @@ public:
* \param fileNames list of filenames to load. The registered notification handler for the root container will get notified on
* error and success.
*/
void slotLoadDataSets( std::vector< std::string > fileNames );
void loadDataSets( std::vector< std::string > fileNames );
/**
* Function combines to modules. This is a simple alias for "getRootContainer()->applyModule".
*
* \param applyOn the module which already has to be in the container and to apply the other one on.
* \param prototype the prototype of the module to apply on the other one specified.
*
* \return the newly created module connected with the one specified in applyOn.
*/
void slotActivateModule( std::string module );
boost::shared_ptr< WModule > applyModule( boost::shared_ptr< WModule > applyOn, boost::shared_ptr< WModule > prototype );
/**
* Returns the root module container. This is the actual module graph container.
......
......@@ -125,6 +125,9 @@ protected:
private:
};
/**
* Derived test class used to test data transfer and compatibility checks, especially the inheritance checks.
*/
class WTestTransferableDerived: public WTestTransferableBase
{
friend class WModuleConnectorTest;
......
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