Commit 11a2bce9 by Sebastian Eichelbaum

[CHANGE] - added new toolBarStyle and compatiblesToolBarStyle preferences

parent 8a01fe4e
......@@ -9,12 +9,31 @@
#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]
####################################################################
# Views
# hideAxial = yes # hide the axial view widget
# hideCoronal = yes # hide the coronal view widget
# hideSagittal = yes # hide the sagittal view widget
####################################################################
# Toolbars
toolBarIconText = no # show text next to module's icon
# useToolBarBreak = no # put compatibles toolbar in separate row
useAutoDisplay = no # automatically add a standard module after loading a data module.
# The next property controls the style of ALL toolbars in OpenWalnut.
# 0 -> Only display the icon. This also is the default on Qt
# 1 -> Only display the text.
# 2 -> The text appears beside the icon.
# 3 -> The text appears under the icon.
toolBarStyle = 0
compatiblesToolBarStyle = 0 # this pref allows the compatibles toolbar to have a different style
####################################################################
# Dataset Browser
# combineTreeAndRoiAndTextureSorter = yes # should the module tree, ROI tree and the Texture Sorter be combined in ONE Tab widget?
[ge] ## Settings for the graphics engine
......
......@@ -15,12 +15,31 @@ allowOnlyOneFiberDataSet = yes # This will prevent you from accidently loading m
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]
####################################################################
# Views
# hideAxial = yes # hide the axial view widget
# hideCoronal = yes # hide the coronal view widget
# hideSagittal = yes # hide the sagittal view widget
####################################################################
# Toolbars
toolBarIconText = no # show text next to module's icon
# useToolBarBreak = no # put compatibles toolbar in separate row
# useAutoDisplay = no # automatically add a standard module after loading a data module.
# The next property controls the style of ALL toolbars in OpenWalnut.
# 0 -> Only display the icon. This also is the default on Qt
# 1 -> Only display the text.
# 2 -> The text appears beside the icon.
# 3 -> The text appears under the icon.
toolBarStyle = 0
compatiblesToolBarStyle = 0 # this pref allows the compatibles toolbar to have a different style
####################################################################
# Dataset Browser
# combineTreeAndRoiAndTextureSorter = yes # should the module tree, ROI tree and the Texture Sorter be combined in ONE Tab widget?
[ge] ## Settings for the graphics engine
......
......@@ -223,6 +223,10 @@ void WMainWindow::setupPermanentToolBar()
{
m_permanentToolBar = new WQtToolBar( "Permanent Toolbar", this );
// Set the style of the toolbar
// NOTE: this only works if the toolbar is used with QActions instead of buttons and other widgets
m_permanentToolBar->setToolButtonStyle( getToolbarStyle() );
m_iconManager.addIcon( std::string( "ROI" ), box_xpm );
m_iconManager.addIcon( std::string( "axial" ), axial_xpm );
m_iconManager.addIcon( std::string( "coronal" ), cor_xpm );
......@@ -420,12 +424,43 @@ void WMainWindow::moduleSpecificSetup( boost::shared_ptr< WModule > module )
}
}
Qt::ToolButtonStyle WMainWindow::getToolbarStyle() const
{
// this sets the toolbar style
int toolBarStyle = 0;
WPreferences::getPreference( "qt4gui.toolBarStyle", &toolBarStyle );
if ( ( toolBarStyle < 0 ) || ( toolBarStyle > 3 ) ) // ensure a valid value
{
toolBarStyle = 0;
}
// cast and return
return static_cast< Qt::ToolButtonStyle >( toolBarStyle );
}
Qt::ToolButtonStyle WMainWindow::getCompatiblesToolbarStyle() const
{
// this sets the toolbar style
int compToolBarStyle = getToolbarStyle(); // this defaults to the global toolbar style
WPreferences::getPreference( "qt4gui.compatiblesToolBarStyle", &compToolBarStyle );
if ( ( compToolBarStyle < 0 ) || ( compToolBarStyle > 3 ) ) // ensure a valid value
{
compToolBarStyle = 0;
}
// cast and return
return static_cast< Qt::ToolButtonStyle >( compToolBarStyle );
}
void WMainWindow::setupCompatiblesToolBar()
{
m_iconManager.addIcon( std::string( "o" ), o_xpm ); // duumy icon for modules
m_compatiblesToolBar = new WQtToolBar( "Compatible Modules Toolbar", this );
// this sets the toolbar style
m_compatiblesToolBar->setToolButtonStyle( getCompatiblesToolbarStyle() );
// optional toolbar break
{
bool useToolBarBreak = true;
......
......@@ -119,6 +119,21 @@ public:
*/
void closeCustomDockWidget( std::string title );
/**
* This method returns the default style for ALL toolbars.
*
* \return the toolbar style
*/
Qt::ToolButtonStyle getToolbarStyle() const;
/**
* This method returns the default style for the compatibles toolbar. It allows modification of the style for especially for the compatibles
* toolbar.
*
* \return the toolbar style for the compatibles toolbar
*/
Qt::ToolButtonStyle getCompatiblesToolbarStyle() const;
protected:
/**
......
......@@ -262,7 +262,12 @@ 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 );
m_defaultProperties->addProperty( "qt4gui.toolBarIconText", "show toolBarIconText" , true, 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 );
tbs->setMin( 0 );
tbs->setMax( 3 );
ctbs->setMin( 0 );
ctbs->setMax( 3 );
WPropGroup moduleWhiteList = m_defaultProperties->addPropertyGroup( "modules.whiteListGroup", "moduleWhiteList" );
m_skipPropertyWrite.push_back( "modules.whiteListGroup" );
......
......@@ -58,6 +58,11 @@ QAction* WQtToolBar::addWidget( QWidget* widget )
return QToolBar::addWidget( widget );
}
void WQtToolBar::addAction( QAction* action )
{
QToolBar::addAction( action );
}
void WQtToolBar::clearButtons()
{
clear();
......
......@@ -67,6 +67,14 @@ public:
QAction* addWidget( QWidget* widget );
/**
* Allows addition of new actions to the toolbar. See the Qt Doc of QToolBar for details. Actions have the advantage that they build a
* uniform interface for menus, toolbars, buttons and menued toolbuttons.
*
* \param action the action to add.
*/
void addAction( QAction* action );
/**
* Removes all buttons,
*/
void clearButtons();
......
......@@ -132,10 +132,6 @@ WQtDatasetBrowser::WQtDatasetBrowser( WMainWindow* parent )
connectSlots();
// preset for toolbar text.
m_showToolBarText = true;
WPreferences::getPreference( "qt4gui.toolBarIconText", &m_showToolBarText );
// These modules will be allowed to be shown.
std::string moduleWhiteList;
WPreferences::getPreference( "modules.whiteList", &moduleWhiteList );
......@@ -713,10 +709,20 @@ void WQtDatasetBrowser::createCompatibleButtons( boost::shared_ptr< WModule >mod
for ( WModuleFactory::CompatiblesList::const_iterator groups = comps.begin(); groups != comps.end(); ++groups )
{
WQtApplyModulePushButton* currentButton = new WQtApplyModulePushButton( m_mainWindow->getCompatiblesToolBar(), m_mainWindow->getIconManager(),
// create a new action for this group
QAction* group = new QAction( m_mainWindow->getCompatiblesToolBar() );
// set some stuff ( icon, tooltip etc. )
group->setIcon( m_mainWindow->getIconManager()->getIcon( ( *groups ).first->getName().c_str() ) );
group->setIconText( ( *groups ).first->getName().c_str() );
group->setText( ( *groups ).first->getName().c_str() );
/*WQtApplyModulePushButton* currentButton = new WQtApplyModulePushButton( m_mainWindow->getCompatiblesToolBar(), m_mainWindow->getIconManager(),
*( *groups ).second.begin(), m_showToolBarText
);
m_mainWindow->getCompatiblesToolBar()->addWidget( currentButton );
m_mainWindow->getCompatiblesToolBar()->addWidget( currentButton );*/
m_mainWindow->getCompatiblesToolBar()->addAction( group );
}
/*
......
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