Commit 9e5cfbf2 authored by Matthias Möller's avatar Matthias Möller
Browse files

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 f9ad188d
......@@ -694,6 +694,7 @@ CoreWidget::toggleFullscreen() {
setViewMode( OpenFlipper::Options::currentViewMode() );
//show the menubar
if ( ! OpenFlipperSettings().value("Core/Gui/MenuBar/hidden",false).toBool())
menuBar()->show();
// show the statusbar if this is the requested state
......@@ -789,6 +790,46 @@ CoreWidget::showToolbox( bool _state ) {
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:
/// Hide or show toolbox area
void toggleToolbox();
/// Hide or show menu bar
void toogleMenuBar();
//Hide or show current toolbar
void toggleToolbar();
/// Change visibility of the Status Bar
void toggleStatusBar();
......
......@@ -527,6 +527,8 @@ void CoreWidget::registerCoreKeys() {
emit registerKey(Qt::Key_T , Qt::ControlModifier, "Show/Hide Toolbox");
emit registerKey(Qt::Key_F , Qt::ControlModifier, "Toggle Fullscreen");
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() ) {
......@@ -600,12 +602,19 @@ void CoreWidget::coreKeyPressEvent (QKeyEvent* _e){
toggleToolbox();
return;
case Qt::Key_M :
toogleMenuBar();
return;
case Qt::Key_Z:
toggleToolbar();
return;
case Qt::Key_O :
loadMenu();
case Qt::Key_S :
saveMenu();
default:
return;
}
......
......@@ -424,6 +424,8 @@ void CoreWidget::slotChangeView(QString _mode, QStringList _toolboxWidgets, QStr
if (_expandAll)
toolBox_->expandAll();
if ( ! OpenFlipperSettings().value("Core/Gui/Toolbar/hidden",false).toBool())
{
//find all Toolbars that should be visible and hide the others
for (uint p=0; p < plugins_.size(); p++)
for ( uint j = 0 ; j < plugins_[p].toolbars.size(); ++j )
......@@ -444,6 +446,7 @@ void CoreWidget::slotChangeView(QString _mode, QStringList _toolboxWidgets, QStr
viewerToolbar_->show();
else
viewerToolbar_->hide();
}
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