Commit b2fea774 authored by Alexander Wiebel's avatar Alexander Wiebel
Browse files

[CHANGE #273] multiple fiber files seem to be OK now. Thus I removed the

functionality to load multiple fiber files. Hopefully I did not forget
anaything.
parent 5ff97ca0
## This is a sample configuration file for OpenWalnut.
## Uncomment the options you are interested in.
[general]
allowOnlyOneFiberDataSet = yes # This will prevent you from accidently loading multiple fiber data sets.
[modules]
## use this to specify the default module to add during load.
## It is a comma seperated list. If this is not specified the
......
......@@ -70,8 +70,7 @@
WMainWindow::WMainWindow() :
QMainWindow(),
m_currentCompatiblesToolbar( NULL ),
m_iconManager(),
m_fibLoaded( false )
m_iconManager()
{
}
......@@ -712,33 +711,7 @@ void WMainWindow::openLoadDialog()
stdFileNames.push_back( ( *constIterator ).toLocal8Bit().constData() );
}
//
// WE KNOW THAT THIS IS KIND OF A HACK. It is only provided to prevent naive users from having trouble.
//
bool allowOnlyOneFiberDataSet = false;
bool doubleFibersFound = false; // have we detected the multiple loading of fibers?
if( WPreferences::getPreference( "general.allowOnlyOneFiberDataSet", &allowOnlyOneFiberDataSet ) && allowOnlyOneFiberDataSet )
{
for( std::vector< std::string >::iterator it = stdFileNames.begin(); it != stdFileNames.end(); ++it )
{
using wiotools::getSuffix;
std::string suffix = getSuffix( *it );
bool isFib = ( suffix == ".fib" );
if( m_fibLoaded && isFib )
{
QCoreApplication::postEvent( this, new WModuleCrashEvent(
WModuleFactory::getModuleFactory()->getPrototypeByName( "Data Module" ),
std::string( "Tried to load two fiber data sets. This is not allowed by your preferences." ) ) );
doubleFibersFound = true;
}
m_fibLoaded |= isFib;
}
}
if( !doubleFibersFound )
{
m_loaderSignal( stdFileNames );
}
m_loaderSignal( stdFileNames );
// walkaround that a button keeps his down state after invoking a dialog
m_loadButton->setDown( false );
......@@ -991,11 +964,6 @@ void WMainWindow::newRoi()
}
}
void WMainWindow::setFibersLoaded( bool flag )
{
m_fibLoaded = flag;
}
void WMainWindow::openConfigDialog()
{
if( m_configWidget.get() )
......
......@@ -280,12 +280,6 @@ public slots:
*/
void projectSaveModuleOnly();
/**
* 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( bool flag );
/**
* Gets called when menu option or toolbar button load is activated
*/
......@@ -323,12 +317,6 @@ private:
*/
boost::shared_ptr< WQtConfigWidget > m_configWidget;
/**
* Used to ensure that only one fiber dataset can be loaded since the
* ROIManager is not known to work with more than one fiber dataset
*/
bool m_fibLoaded; // TODO(all): remove this when its possible to display more than one fiber dataset
/**
* All registered WQtCustomDockWidgets.
*/
......
......@@ -206,40 +206,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") )
{
//
// WE KNOW THAT THIS IS KIND OF A HACK. Iis is only provided to prevent naive users from having trouble.
//
bool allowOnlyOneFiberDataSet = false;
bool doubleFibersFound = false; // have we detected the multiple loading of fibers?
if( WPreferences::getPreference( "general.allowOnlyOneFiberDataSet", &allowOnlyOneFiberDataSet ) && allowOnlyOneFiberDataSet )
{
bool fibFound = false;
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 )
{
std::string suffix = wiotools::getSuffix( *it );
bool isFib = ( suffix == ".fib" );
if( fibFound && isFib )
{
QCoreApplication::postEvent( m_mainWindow, new WModuleCrashEvent(
WModuleFactory::getModuleFactory()->getPrototypeByName( "Data Module" ),
std::string( "Tried to load two fiber data sets. This is not allowed by your preferences." ) ) );
doubleFibersFound = true;
}
fibFound |= isFib;
}
if( fibFound && !doubleFibersFound )
{
// 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( true );
}
}
if( !doubleFibersFound )
{
m_kernel->loadDataSets( m_optionsMap["input"].as< std::vector< std::string > >() );
}
m_kernel->loadDataSets( m_optionsMap["input"].as< std::vector< std::string > >() );
}
// Load project file
......@@ -314,11 +281,6 @@ void WQt4Gui::slotRemoveDatasetOrModuleInTree( boost::shared_ptr< WModule > modu
{
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->getControlPanel(), new WModuleRemovedEvent( module ) );
}
......
......@@ -262,7 +262,6 @@ void WQtConfigWidget::registerComponents()
m_defaultProperties->addProperty( "qt4gui.useAutoDisplay", "use Auto Display", true, m_propCondition );
m_defaultProperties->addProperty( "qt4gui.useToolBarBreak", "use ToolBarBreak", true, m_propCondition );
m_defaultProperties->addProperty( "general.allowOnlyOneFiberDataSet", "allow only one FiberDataSet", false, m_propCondition );
WPropInt tbs = m_defaultProperties->addProperty( "qt4gui.toolBarStyle", "The style of all toolbars in OpenWalnut", 0, m_propCondition );
WPropInt ctbs = m_defaultProperties->addProperty( "qt4gui.compatiblesToolBarStyle", "The style of all compatibles toolbar in OpenWalnut", 0,
m_propCondition );
......
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