Commit 1f19bf13 authored by Alexander Wiebel's avatar Alexander Wiebel
Browse files

[FIX #348] reset fibers loaded flag after removing fiber data module

parent f00834dc
......@@ -89,6 +89,7 @@ void WMainWindow::setupGUI()
m_iconManager.addIcon( std::string( "config" ), preferences_system_xpm );
m_iconManager.addIcon( std::string( "o" ), o_xpm ); // duumy icon for modules
if( objectName().isEmpty() )
{
setObjectName( QString::fromUtf8( "MainWindow" ) );
......@@ -981,9 +982,9 @@ void WMainWindow::newRoi()
}
}
void WMainWindow::setFibersLoaded()
void WMainWindow::setFibersLoaded( bool flag )
{
m_fibLoaded = true;
m_fibLoaded = flag;
}
void WMainWindow::openConfigDialog()
......
......@@ -282,8 +282,9 @@ public slots:
/**
* Sets that a fiber data set has already been loaded. Thi shelps to prevent multiple fiber data sets to be loaded.
* \param flag Indicates how to set the internal state.
*/
void setFibersLoaded();
void setFibersLoaded( bool flag );
/**
* Gets called when menu option or toolbar button load is activated
......
......@@ -216,8 +216,7 @@ int WQt4Gui::run()
std::vector< std::string > tmpFiles = m_optionsMap["input"].as< std::vector< std::string > >();
for( std::vector< std::string >::iterator it = tmpFiles.begin(); it != tmpFiles.end(); ++it )
{
using wiotools::getSuffix;
std::string suffix = getSuffix( *it );
std::string suffix = wiotools::getSuffix( *it );
bool isFib = ( suffix == ".fib" );
if( fibFound && isFib )
{
......@@ -232,7 +231,7 @@ int WQt4Gui::run()
{
// Found exactly one fiber data set. So signal this to main window.
// If more than one are found we do not load them anyways. Thus we can allow to load a new one.
m_mainWindow->setFibersLoaded();
m_mainWindow->setFibersLoaded( true );
}
}
......@@ -303,6 +302,16 @@ void WQt4Gui::slotActivateDatasetOrModuleInBrowser( boost::shared_ptr< WModule >
void WQt4Gui::slotRemoveDatasetOrModuleInBrowser( boost::shared_ptr< WModule > module )
{
// create a new event for this and insert it into event queue
if( module->getName() == "Data Module" )
{
boost::shared_ptr< WMData > dataModule = boost::shared_dynamic_cast< WMData >( module );
WAssert( dataModule, "Internal failure." );
std::string suffix = wiotools::getSuffix( dataModule->getFilename().file_string() );
if( suffix == ".fib" )
{
m_mainWindow->setFibersLoaded( false );
}
}
QCoreApplication::postEvent( m_mainWindow->getDatasetBrowser(), new WModuleRemovedEvent( module ) );
}
......
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