Commit bfca3f49 authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum

[CHANGE] - added some more prefs to control the behaviour of the gui

parent 6db23ea6
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
#################################################################### ####################################################################
# Toolbars # Toolbars
toolBarIconText = no # show text next to module's icon
# useToolBarBreak = no # put compatibles toolbar in separate row # useToolBarBreak = no # put compatibles toolbar in separate row
useAutoDisplay = no # automatically add a standard module after loading a data module. useAutoDisplay = no # automatically add a standard module after loading a data module.
...@@ -29,14 +28,15 @@ useAutoDisplay = no # automatically add a standard module after loading a data m ...@@ -29,14 +28,15 @@ useAutoDisplay = no # automatically add a standard module after loading a data m
# 2 -> The text appears beside the icon. # 2 -> The text appears beside the icon.
# 3 -> The text appears under the icon. # 3 -> The text appears under the icon.
toolBarStyle = 0 toolBarStyle = 0
compatiblesToolBarStyle = 0 # this pref allows the compatibles toolbar to have a different style compatiblesToolBarStyle = 0 # this pref allows the compatibles toolbar to have a different style (overrides toolBarStyle)
# Position of the compatibles toolbar # Position of the compatibles toolbar
# 0 -> top # 0 -> top
# 1 -> bottom # 1 -> bottom
# 2 -> left # 2 -> left
# 3 -> right # 3 -> right
compatiblesToolBarPos = 0 # position of the compatibles toolbar toolBarPos = 0 # default position of the toolbars
compatiblesToolBarPos = 0 # position of the compatibles toolbar (overrides toolBarPos)
#################################################################### ####################################################################
# Dataset Browser # Dataset Browser
......
...@@ -25,7 +25,6 @@ whiteList ="Isosurface,Bounding Box,Isosurface Raytracer,Distance Map Isosurface ...@@ -25,7 +25,6 @@ whiteList ="Isosurface,Bounding Box,Isosurface Raytracer,Distance Map Isosurface
#################################################################### ####################################################################
# Toolbars # Toolbars
toolBarIconText = no # show text next to module's icon
# useToolBarBreak = no # put compatibles toolbar in separate row # useToolBarBreak = no # put compatibles toolbar in separate row
# useAutoDisplay = no # automatically add a standard module after loading a data module. # useAutoDisplay = no # automatically add a standard module after loading a data module.
...@@ -35,14 +34,15 @@ toolBarIconText = no # show text next to module's icon ...@@ -35,14 +34,15 @@ toolBarIconText = no # show text next to module's icon
# 2 -> The text appears beside the icon. # 2 -> The text appears beside the icon.
# 3 -> The text appears under the icon. # 3 -> The text appears under the icon.
toolBarStyle = 0 toolBarStyle = 0
compatiblesToolBarStyle = 0 # this pref allows the compatibles toolbar to have a different style compatiblesToolBarStyle = 0 # this pref allows the compatibles toolbar to have a different style (overrides toolBarStyle)
# Position of the compatibles toolbar # Position of the compatibles toolbar
# 0 -> top # 0 -> top
# 1 -> bottom # 1 -> bottom
# 2 -> left # 2 -> left
# 3 -> right # 3 -> right
compatiblesToolBarPos = 0 # position of the compatibles toolbar toolBarPos = 0 # default position of the toolbars
compatiblesToolBarPos = 0 # position of the compatibles toolbar (overrides toolBarPos)
#################################################################### ####################################################################
# Dataset Browser # Dataset Browser
......
...@@ -266,7 +266,7 @@ void WMainWindow::setupPermanentToolBar() ...@@ -266,7 +266,7 @@ void WMainWindow::setupPermanentToolBar()
m_permanentToolBar->addWidget( roiButton ); m_permanentToolBar->addWidget( roiButton );
m_permanentToolBar->addSeparator(); m_permanentToolBar->addSeparator();
addToolBar( Qt::TopToolBarArea, m_permanentToolBar ); addToolBar( WMainWindow::getToolbarPos(), m_permanentToolBar );
} }
void WMainWindow::autoAdd( boost::shared_ptr< WModule > module, std::string proto ) void WMainWindow::autoAdd( boost::shared_ptr< WModule > module, std::string proto )
...@@ -438,26 +438,8 @@ Qt::ToolButtonStyle WMainWindow::getToolbarStyle() const ...@@ -438,26 +438,8 @@ Qt::ToolButtonStyle WMainWindow::getToolbarStyle() const
return static_cast< Qt::ToolButtonStyle >( toolBarStyle ); return static_cast< Qt::ToolButtonStyle >( toolBarStyle );
} }
void WMainWindow::setCompatiblesToolbar( WQtCombinerToolbar* toolbar ) Qt::ToolBarArea WMainWindow::getToolbarPos()
{ {
delete m_currentCompatiblesToolbar;
m_currentCompatiblesToolbar = toolbar;
// optional toolbar break
{
bool useToolBarBreak = true;
WPreferences::getPreference( "qt4gui.useToolBarBreak", &useToolBarBreak );
if( useToolBarBreak )
{
// Blank toolbar for nicer layout in case of toolbar break
// This can be done nicer very probably.
//WQtToolBar* blankToolBar = new WQtToolBar( "Blank Toolbar", this );
//addToolBar( Qt::TopToolBarArea, blankToolBar );
addToolBarBreak( Qt::TopToolBarArea );
}
}
// and the position of the toolbar
int compatiblesToolbarPos = 0; int compatiblesToolbarPos = 0;
WPreferences::getPreference( "qt4gui.compatiblesToolBarPos", &compatiblesToolbarPos ); WPreferences::getPreference( "qt4gui.compatiblesToolBarPos", &compatiblesToolbarPos );
Qt::ToolBarArea pos = Qt::TopToolBarArea; Qt::ToolBarArea pos = Qt::TopToolBarArea;
...@@ -479,7 +461,37 @@ void WMainWindow::setCompatiblesToolbar( WQtCombinerToolbar* toolbar ) ...@@ -479,7 +461,37 @@ void WMainWindow::setCompatiblesToolbar( WQtCombinerToolbar* toolbar )
pos = Qt::TopToolBarArea; pos = Qt::TopToolBarArea;
break; break;
} }
addToolBar( pos, m_currentCompatiblesToolbar );
return pos;
}
void WMainWindow::setCompatiblesToolbar( WQtCombinerToolbar* toolbar )
{
if ( m_currentCompatiblesToolbar )
{
delete m_currentCompatiblesToolbar;
}
m_currentCompatiblesToolbar = toolbar;
if ( !toolbar )
{
// ok, reset the toolbar
// So create a dummy to permanently reserve the space
m_currentCompatiblesToolbar = new WQtCombinerToolbar( this, WModuleFactory::CompatiblesList() );
}
// optional toolbar break
{
bool useToolBarBreak = true;
WPreferences::getPreference( "qt4gui.useToolBarBreak", &useToolBarBreak );
if( useToolBarBreak )
{
addToolBarBreak( m_currentCompatiblesToolbar->getCompatiblesToolbarPos() );
}
}
// and the position of the toolbar
addToolBar( m_currentCompatiblesToolbar->getCompatiblesToolbarPos(), m_currentCompatiblesToolbar );
} }
WQtDatasetBrowser* WMainWindow::getDatasetBrowser() WQtDatasetBrowser* WMainWindow::getDatasetBrowser()
......
...@@ -122,6 +122,13 @@ public: ...@@ -122,6 +122,13 @@ public:
*/ */
Qt::ToolButtonStyle getToolbarStyle() const; Qt::ToolButtonStyle getToolbarStyle() const;
/**
* Returns the preferred position of toolbars.
*
* \return QT Position for the toolbars used as default for all toolbars.
*/
static Qt::ToolBarArea getToolbarPos();
/** /**
* This method removes the old compatibles toolbar and sets the specified one. * This method removes the old compatibles toolbar and sets the specified one.
* *
......
...@@ -83,7 +83,18 @@ WQtCombinerToolbar::WQtCombinerToolbar( WMainWindow* parent, WModuleFactory::Com ...@@ -83,7 +83,18 @@ WQtCombinerToolbar::WQtCombinerToolbar( WMainWindow* parent, WModuleFactory::Com
// The following makes the bar having button size from the beginning. // The following makes the bar having button size from the beginning.
QPushButton* dummyButton = new QPushButton; QPushButton* dummyButton = new QPushButton;
dummyButton->setFixedWidth( 0 );
if ( ( parent->getToolbarPos() == Qt::TopToolBarArea ) || ( ( parent->getToolbarPos() == Qt::BottomToolBarArea ) ) )
{
dummyButton->setFixedWidth( 0 );
dummyButton->setFixedHeight( 32 );
}
else
{
dummyButton->setFixedWidth( 48 ); // well this size must be more than 32 as there might be these little submenu arrows besides the icon
dummyButton->setFixedHeight( 0 );
}
addWidget( dummyButton ); addWidget( dummyButton );
} }
...@@ -91,3 +102,30 @@ WQtCombinerToolbar::~WQtCombinerToolbar() ...@@ -91,3 +102,30 @@ WQtCombinerToolbar::~WQtCombinerToolbar()
{ {
} }
Qt::ToolBarArea WQtCombinerToolbar::getCompatiblesToolbarPos()
{
int compatiblesToolbarPos = -1;
WPreferences::getPreference( "qt4gui.compatiblesToolBarPos", &compatiblesToolbarPos );
Qt::ToolBarArea pos = Qt::TopToolBarArea;
switch ( compatiblesToolbarPos )
{
case 0:
pos = Qt::TopToolBarArea;
break;
case 1:
pos = Qt::BottomToolBarArea;
break;
case 2:
pos = Qt::LeftToolBarArea;
break;
case 3:
pos = Qt::RightToolBarArea;
break;
default:
pos = WMainWindow::getToolbarPos();
break;
}
return pos;
}
...@@ -51,6 +51,13 @@ public: ...@@ -51,6 +51,13 @@ public:
*/ */
virtual ~WQtCombinerToolbar(); virtual ~WQtCombinerToolbar();
/**
* Returns the preferred position of compatibles toolbars. This overrides WMainWindow::getToolbarPos().
*
* \return QT Position for the compatibles toolbars
*/
static Qt::ToolBarArea getCompatiblesToolbarPos();
protected: protected:
private: private:
......
...@@ -269,8 +269,12 @@ void WQtConfigWidget::registerComponents() ...@@ -269,8 +269,12 @@ void WQtConfigWidget::registerComponents()
tbs->setMax( 3 ); tbs->setMax( 3 );
ctbs->setMin( 0 ); ctbs->setMin( 0 );
ctbs->setMax( 3 ); ctbs->setMax( 3 );
WPropInt tbpos = m_defaultProperties->addProperty( "qt4gui.toolBarPos", "The position of the toolbar in OpenWalnut", 0,
m_propCondition );
WPropInt ctbpos = m_defaultProperties->addProperty( "qt4gui.compatiblesToolBarPos", "The position of the compatibles toolbar in OpenWalnut", 0, WPropInt ctbpos = m_defaultProperties->addProperty( "qt4gui.compatiblesToolBarPos", "The position of the compatibles toolbar in OpenWalnut", 0,
m_propCondition ); m_propCondition );
tbpos->setMin( 0 );
tbpos->setMax( 3 );
ctbpos->setMin( 0 ); ctbpos->setMin( 0 );
ctbpos->setMax( 3 ); ctbpos->setMax( 3 );
......
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