Commit 0826f7a3 authored by Matthias Möller's avatar Matthias Möller

add hotkeys toogle the visibility of the tool/menubar

refs #1380

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@16098 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 794265a8
...@@ -694,6 +694,7 @@ CoreWidget::toggleFullscreen() { ...@@ -694,6 +694,7 @@ CoreWidget::toggleFullscreen() {
setViewMode( OpenFlipper::Options::currentViewMode() ); setViewMode( OpenFlipper::Options::currentViewMode() );
//show the menubar //show the menubar
if ( ! OpenFlipperSettings().value("Core/Gui/MenuBar/hidden",false).toBool())
menuBar()->show(); menuBar()->show();
// show the statusbar if this is the requested state // show the statusbar if this is the requested state
...@@ -789,6 +790,46 @@ CoreWidget::showToolbox( bool _state ) { ...@@ -789,6 +790,46 @@ CoreWidget::showToolbox( bool _state ) {
toolBoxArea_->setVisible(true); toolBoxArea_->setVisible(true);
} }
} }
//-----------------------------------------------------------------------------
/// Hide or show menu bar
void CoreWidget::toogleMenuBar()
{
bool hidden = OpenFlipperSettings().value("Core/Gui/MenuBar/hidden",false).toBool();
if ( hidden )
menuBar()->show();
else
menuBar()->hide();
OpenFlipperSettings().setValue("Core/Gui/MenuBar/hidden",!hidden);
}
//-----------------------------------------------------------------------------
/// Hide or show current toolbar
void CoreWidget::toggleToolbar()
{
bool hidden = OpenFlipperSettings().value("Core/Gui/Toolbar/hidden",false).toBool();
OpenFlipperSettings().setValue("Core/Gui/Toolbar/hidden",!hidden);
if ( !hidden )
{
//hide main toolbar
if ( ! mainToolbar_->isFloating() )
mainToolbar_->hide();
//hide viewer toolbar
if ( ! viewerToolbar_->isFloating() )
viewerToolbar_->hide();
for (uint p=0; p < plugins_.size(); p++)
for ( uint j = 0 ; j < plugins_[p].toolbars.size(); ++j ) {
if ( ! plugins_[p].toolbars[j].second->isFloating() )
plugins_[p].toolbars[j].second->hide();
}
}
else
{
//show toolbars
setViewMode( OpenFlipper::Options::currentViewMode() );
}
}
//============================================================================= //=============================================================================
......
...@@ -494,6 +494,12 @@ public: ...@@ -494,6 +494,12 @@ public:
/// Hide or show toolbox area /// Hide or show toolbox area
void toggleToolbox(); void toggleToolbox();
/// Hide or show menu bar
void toogleMenuBar();
//Hide or show current toolbar
void toggleToolbar();
/// Change visibility of the Status Bar /// Change visibility of the Status Bar
void toggleStatusBar(); void toggleStatusBar();
......
...@@ -527,6 +527,8 @@ void CoreWidget::registerCoreKeys() { ...@@ -527,6 +527,8 @@ void CoreWidget::registerCoreKeys() {
emit registerKey(Qt::Key_T , Qt::ControlModifier, "Show/Hide Toolbox"); emit registerKey(Qt::Key_T , Qt::ControlModifier, "Show/Hide Toolbox");
emit registerKey(Qt::Key_F , Qt::ControlModifier, "Toggle Fullscreen"); emit registerKey(Qt::Key_F , Qt::ControlModifier, "Toggle Fullscreen");
emit registerKey(Qt::Key_B , Qt::ControlModifier, "Show/Hide StatusBar"); emit registerKey(Qt::Key_B , Qt::ControlModifier, "Show/Hide StatusBar");
emit registerKey(Qt::Key_Z , Qt::ControlModifier, "Show/Hide ToolBar");
emit registerKey(Qt::Key_M , Qt::ControlModifier, "Show/Hide MenuBar");
if ( OpenFlipper::Options::isLinux() ) { if ( OpenFlipper::Options::isLinux() ) {
...@@ -600,12 +602,19 @@ void CoreWidget::coreKeyPressEvent (QKeyEvent* _e){ ...@@ -600,12 +602,19 @@ void CoreWidget::coreKeyPressEvent (QKeyEvent* _e){
toggleToolbox(); toggleToolbox();
return; return;
case Qt::Key_M :
toogleMenuBar();
return;
case Qt::Key_Z:
toggleToolbar();
return;
case Qt::Key_O : case Qt::Key_O :
loadMenu(); loadMenu();
case Qt::Key_S : case Qt::Key_S :
saveMenu(); saveMenu();
default: default:
return; return;
} }
......
...@@ -424,6 +424,8 @@ void CoreWidget::slotChangeView(QString _mode, QStringList _toolboxWidgets, QStr ...@@ -424,6 +424,8 @@ void CoreWidget::slotChangeView(QString _mode, QStringList _toolboxWidgets, QStr
if (_expandAll) if (_expandAll)
toolBox_->expandAll(); toolBox_->expandAll();
if ( ! OpenFlipperSettings().value("Core/Gui/Toolbar/hidden",false).toBool())
{
//find all Toolbars that should be visible and hide the others //find all Toolbars that should be visible and hide the others
for (uint p=0; p < plugins_.size(); p++) for (uint p=0; p < plugins_.size(); p++)
for ( uint j = 0 ; j < plugins_[p].toolbars.size(); ++j ) for ( uint j = 0 ; j < plugins_[p].toolbars.size(); ++j )
...@@ -444,6 +446,7 @@ void CoreWidget::slotChangeView(QString _mode, QStringList _toolboxWidgets, QStr ...@@ -444,6 +446,7 @@ void CoreWidget::slotChangeView(QString _mode, QStringList _toolboxWidgets, QStr
viewerToolbar_->show(); viewerToolbar_->show();
else else
viewerToolbar_->hide(); viewerToolbar_->hide();
}
if (_mode != "") if (_mode != "")
......
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