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,7 +694,8 @@ CoreWidget::toggleFullscreen() { ...@@ -694,7 +694,8 @@ CoreWidget::toggleFullscreen() {
setViewMode( OpenFlipper::Options::currentViewMode() ); setViewMode( OpenFlipper::Options::currentViewMode() );
//show the menubar //show the menubar
menuBar()->show(); if ( ! OpenFlipperSettings().value("Core/Gui/MenuBar/hidden",false).toBool())
menuBar()->show();
// show the statusbar if this is the requested state // show the statusbar if this is the requested state
// stored in the properties // stored in the properties
...@@ -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,26 +424,29 @@ void CoreWidget::slotChangeView(QString _mode, QStringList _toolboxWidgets, QStr ...@@ -424,26 +424,29 @@ void CoreWidget::slotChangeView(QString _mode, QStringList _toolboxWidgets, QStr
if (_expandAll) if (_expandAll)
toolBox_->expandAll(); toolBox_->expandAll();
//find all Toolbars that should be visible and hide the others if ( ! OpenFlipperSettings().value("Core/Gui/Toolbar/hidden",false).toBool())
for (uint p=0; p < plugins_.size(); p++) {
for ( uint j = 0 ; j < plugins_[p].toolbars.size(); ++j ) //find all Toolbars that should be visible and hide the others
if (_toolbars.contains( plugins_[p].toolbars[j].first ) ) for (uint p=0; p < plugins_.size(); p++)
plugins_[p].toolbars[j].second->show(); for ( uint j = 0 ; j < plugins_[p].toolbars.size(); ++j )
else if (_toolbars.contains( plugins_[p].toolbars[j].first ) )
plugins_[p].toolbars[j].second->hide(); plugins_[p].toolbars[j].second->show();
else
plugins_[p].toolbars[j].second->hide();
// Check the Main Toolbar:
if ( _toolbars.contains(tr("Main Toolbar")) )
mainToolbar_->show(); // Check the Main Toolbar:
else if ( _toolbars.contains(tr("Main Toolbar")) )
mainToolbar_->hide(); mainToolbar_->show();
else
// Check the Main Toolbar: mainToolbar_->hide();
if ( _toolbars.contains(tr("Viewer Toolbar")) )
viewerToolbar_->show(); // Check the Main Toolbar:
else if ( _toolbars.contains(tr("Viewer Toolbar")) )
viewerToolbar_->hide(); viewerToolbar_->show();
else
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