Commit 54426376 authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum
Browse files

[MERGE]

[FIX] - do NOT and NEVER use the "" to enclose your whitelist in your configfile as the WPreference parser does not understand it. Example: whiteList="HUD,A,B,C" causes the whitelist to be
* "HUD
* A
* B
* C" <-- note the "
parents 6f8f4088 9786280b
......@@ -3,10 +3,10 @@
[modules]
## use this to specify the default module to add during load.
## It is a comma seperated list. If this is not specified the default empty is assumed.
## It is a comma seperated list. If this is not specified the default empty is assumed. Be sure to NOT add "" around the list.
## An example could be
# default="HUD"
#whiteList ="Isosurface,Bounding Box, Direct Volume Rendering,Distance Map Isosurface,Gauss Filtering,HUD,Vector Plot,Write NIfTI" # A list of modules that will be provided through the GUI. If the list is empty all available modules are provided.
# default=HUD
#whiteList =Isosurface,Bounding Box, Direct Volume Rendering,Distance Map Isosurface,Gauss Filtering,HUD,Vector Plot,Write NIfTI # A list of modules that will be provided through the GUI. If the list is empty all available modules are provided.
[qt4gui]
####################################################################
......
......@@ -7,12 +7,12 @@ allowOnlyOneFiberDataSet = yes # This will prevent you from accidently loading m
[modules]
## use this to specify the default module to add during load.
## It is a comma seperated list. If this is not specified the
## default empty is assumed.
## default empty is assumed. Be sure to NOT add "" around the list.
## An example could be
# default="HUD"
# default=HUD
## A list of modules that will be provided through the GUI.
## If the list is empty all available modules are provided.
whiteList ="Isosurface,Bounding Box,Isosurface Raytracer,Distance Map Isosurface,Gauss Filtering,HUD,Vector Plot,Write NIfTI,Mesh Reader,Triangle Mesh Renderer,Arbitrary Rois,LIC,Voxelizer,Superquadric Glyphs"
whiteList = Isosurface,Bounding Box,Isosurface Raytracer,Distance Map Isosurface,Gauss Filtering,HUD,Vector Plot,Write NIfTI,Mesh Reader,Triangle Mesh Renderer,Arbitrary Rois,LIC,Voxelizer,Superquadric Glyphs
[qt4gui]
####################################################################
......
//---------------------------------------------------------------------------
//
// Project: OpenWalnut ( http://www.openwalnut.org )
//
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
// For more information see http://www.openwalnut.org/copying
//
// This file is part of OpenWalnut.
//
// OpenWalnut is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenWalnut is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------
#include <iostream>
#include <string>
#include <vector>
#include "QtGui/QMenu"
#include "../../common/WPreferences.h"
#include "guiElements/WQtApplyModuleAction.h"
#include "WMainWindow.h"
#include "WQtCombinerActionList.h"
WQtCombinerActionList::WQtCombinerActionList( QWidget* parent, WIconManager* icons, WModuleFactory::CompatiblesList compatibles ):
QList< QAction* >()
{
// These modules will be allowed to be shown.
std::string moduleWhiteListString;
WPreferences::getPreference( "modules.whiteList", &moduleWhiteListString );
std::vector< std::string > moduleWhiteList = string_utils::tokenize( moduleWhiteListString, "," );
// create an action for each group:
for ( WModuleFactory::CompatiblesList::const_iterator groups = compatibles.begin(); groups != compatibles.end(); ++groups )
{
// check current prototype against whitelist
if( moduleWhiteList.size()
&& std::find( moduleWhiteList.begin(), moduleWhiteList.end(), groups->first->getName() ) == moduleWhiteList.end() )
{
continue;
}
// create a new action for this group
WQtApplyModuleAction* group = new WQtApplyModuleAction( parent, icons, *( *groups ).second.begin() );
push_back( group );
// only add a sub menu if there are more than 1 items in the group
if ( ( *groups ).second.size() > 1 )
{
QMenu* groupMenu = new QMenu( parent );
// iterate all the children
for ( WModuleFactory::CompatibleCombiners::const_iterator combiner = ( *groups ).second.begin();
combiner != ( *groups ).second.end(); ++combiner )
{
WQtApplyModuleAction* a = new WQtApplyModuleAction( parent, icons, ( *combiner ), true );
a->setIconVisibleInMenu( true );
groupMenu->addAction( a );
}
group->setMenu( groupMenu );
}
}
}
WQtCombinerActionList::~WQtCombinerActionList()
{
// cleanup
clear();
}
//---------------------------------------------------------------------------
//
// Project: OpenWalnut ( http://www.openwalnut.org )
//
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
// For more information see http://www.openwalnut.org/copying
//
// This file is part of OpenWalnut.
//
// OpenWalnut is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenWalnut is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------
#ifndef WQTCOMBINERACTIONLIST_H
#define WQTCOMBINERACTIONLIST_H
#include <QtCore/QList>
#include <QtGui/QAction>
#include <QtGui/QWidget>
#include "../../kernel/WModuleFactory.h"
#include "WIconManager.h"
/**
* This class represents a list of actions to apply a bunch of modules to others. It basically interprets the WModuleFactory::CompatiblesList and
* builds a list of appropriate actions. It can be used to build menus, toolbars and so on.
*/
class WQtCombinerActionList: public QList< QAction* >
{
public:
/**
* This constructor creates a list of actions recursively from the specified compatibles list.
* \param parent the parent widget of this widget, i.e. the widget that manages it.
* \param icons the icon manager holding the right icons for all the prototypes
* \param compatibles the list of combiners
*/
WQtCombinerActionList( QWidget* parent, WIconManager* icons, WModuleFactory::CompatiblesList compatibles );
/**
* Destructor.
*/
virtual ~WQtCombinerActionList();
protected:
private:
};
#endif // WQTCOMBINERACTIONLIST_H
......@@ -23,18 +23,17 @@
//---------------------------------------------------------------------------
#include <list>
#include <string>
#include <vector>
#include <QtGui/QAction>
#include <QtGui/QMenu>
#include <QtGui/QPushButton>
#include <QtGui/QMenu>
#include "../../common/WPreferences.h"
#include "WMainWindow.h"
#include "WQtToolBar.h"
#include "guiElements/WQtApplyModuleAction.h"
#include "WQtCombinerActionList.h"
#include "WQtCombinerToolbar.h"
......@@ -51,47 +50,12 @@ WQtCombinerToolbar::WQtCombinerToolbar( WMainWindow* parent, WModuleFactory::Com
{
compToolBarStyle = 0;
}
// These modules will be allowed to be shown.
std::string moduleWhiteListString;
WPreferences::getPreference( "modules.whiteList", &moduleWhiteListString );
std::vector< std::string > moduleWhiteList = string_utils::tokenize( moduleWhiteListString, "," );
// cast and set
setToolButtonStyle( static_cast< Qt::ToolButtonStyle >( compToolBarStyle ) );
// create an action for each group:
for ( WModuleFactory::CompatiblesList::const_iterator groups = compatibles.begin(); groups != compatibles.end(); ++groups )
{
if( moduleWhiteList.size()
&& std::find( moduleWhiteList.begin(), moduleWhiteList.end(), groups->first->getName() ) == moduleWhiteList.end() )
{
continue;
}
// create a new action for this group
WQtApplyModuleAction* group = new WQtApplyModuleAction( this,
parent->getIconManager(),
*( *groups ).second.begin() );
addAction( group );
// only add a sub menu if there are more than 1 items in the group
if ( ( *groups ).second.size() > 1 )
{
QMenu* groupMenu = new QMenu( this );
// iterate all the children
for ( WModuleFactory::CompatibleCombiners::const_iterator combiner = ( *groups ).second.begin();
combiner != ( *groups ).second.end(); ++combiner )
{
WQtApplyModuleAction* a = new WQtApplyModuleAction( this,
parent->getIconManager(),
( *combiner ),
true );
a->setIconVisibleInMenu( true );
groupMenu->addAction( a );
}
group->setMenu( groupMenu );
}
}
// create the list of actions possible
addActions( WQtCombinerActionList( this, parent->getIconManager(), compatibles ) );
// The following makes the bar having button size from the beginning.
QPushButton* dummyButton = new QPushButton;
......
......@@ -49,6 +49,7 @@
#include "../guiElements/WQtApplyModuleAction.h"
#include "../WMainWindow.h"
#include "../WQt4Gui.h"
#include "../WQtCombinerActionList.h"
#include "WQtBranchTreeItem.h"
#include "WQtNumberEdit.h"
#include "WQtNumberEditDouble.h"
......@@ -78,6 +79,13 @@ WQtDatasetBrowser::WQtDatasetBrowser( WMainWindow* parent )
connect( m_deleteModuleAction, SIGNAL( triggered() ), this, SLOT( deleteModuleTreeItem() ) );
m_moduleTreeWidget->addAction( m_deleteModuleAction );
m_connectWithPrototypeAction = new QAction( "Connect with Prototype", m_moduleTreeWidget );
m_moduleTreeWidget->addAction( m_connectWithPrototypeAction );
m_connectWithModuleAction = new QAction( "Connect with Module", m_moduleTreeWidget );
m_moduleTreeWidget->addAction( m_connectWithModuleAction );
m_disconnectAction = new QAction( "Disconnect", m_moduleTreeWidget );
m_moduleTreeWidget->addAction( m_disconnectAction );
m_textureSorter = new WQtTextureSorter( this );
m_textureSorter->setToolTip( "Reorder the textures." );
......@@ -704,6 +712,19 @@ WQtCombinerToolbar* WQtDatasetBrowser::createCompatibleButtons( boost::shared_pt
// every module may have compatibles: create ribbon menu entry
// NOTE: if module is NULL, getCompatiblePrototypes returns the list of modules without input connector (nav slices and so on)
WModuleFactory::CompatiblesList comps = WModuleFactory::getModuleFactory()->getCompatiblePrototypes( module );
// build the prototype menu
QMenu* m = new QMenu( m_moduleTreeWidget );
m->addActions( WQtCombinerActionList( m, m_mainWindow->getIconManager(), comps ) );
delete( m_connectWithPrototypeAction->menu() ); // ensure that combiners get free'd
m_connectWithPrototypeAction->setMenu( m );
// build the module menu
// TODO(ebaum): do
// build the disconnect menu
// TODO(ebaum): do
return new WQtCombinerToolbar( m_mainWindow, comps );
}
......
......@@ -212,6 +212,21 @@ private:
*/
QAction* m_deleteModuleAction;
/**
* Action which uses a compatibles list (submenu) to connect a selected item with other existing modules.
*/
QAction* m_connectWithModuleAction;
/**
* Action which uses a compatibles list (submenu) to connect a selected item with other prototypes.
*/
QAction* m_connectWithPrototypeAction;
/**
* Action which disconnects a connector from the module.
*/
QAction* m_disconnectAction;
private slots:
/**
* function that gets called when a tree item is selected, on a new select that tab widget
......
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