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() {
setViewMode( OpenFlipper::Options::currentViewMode() );
//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
// stored in the properties
......@@ -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,26 +424,29 @@ void CoreWidget::slotChangeView(QString _mode, QStringList _toolboxWidgets, QStr
if (_expandAll)
toolBox_->expandAll();
//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 )
if (_toolbars.contains( plugins_[p].toolbars[j].first ) )
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();
else
mainToolbar_->hide();
// Check the Main Toolbar:
if ( _toolbars.contains(tr("Viewer Toolbar")) )
viewerToolbar_->show();
else
viewerToolbar_->hide();
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 )
if (_toolbars.contains( plugins_[p].toolbars[j].first ) )
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();
else
mainToolbar_->hide();
// Check the Main Toolbar:
if ( _toolbars.contains(tr("Viewer Toolbar")) )
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