comparison main/MainWindow.cpp @ 448:54f3f0f29c95 toggle

Hide and restore menus that are not needed in minimal mode
author Chris Cannam
date Fri, 24 Jun 2011 11:52:30 +0100
parents bff590626547
children de2a049f213d
comparison
equal deleted inserted replaced
447:bff590626547 448:54f3f0f29c95
1600 } 1600 }
1601 1601
1602 void 1602 void
1603 MainWindow::setupHelpMenu() 1603 MainWindow::setupHelpMenu()
1604 { 1604 {
1605 QMenu *menu = menuBar()->addMenu(tr("&Help")); 1605 m_helpMenu = menuBar()->addMenu(tr("&Help"));
1606 menu->setTearOffEnabled(true); 1606 m_helpMenu->setTearOffEnabled(true);
1607 1607
1608 m_keyReference->setCategory(tr("Help")); 1608 m_keyReference->setCategory(tr("Help"));
1609 1609
1610 IconLoader il; 1610 IconLoader il;
1611 1611
1613 tr("&Help Reference"), this); 1613 tr("&Help Reference"), this);
1614 action->setShortcut(tr("F1")); 1614 action->setShortcut(tr("F1"));
1615 action->setStatusTip(tr("Open the Sonic Visualiser reference manual")); 1615 action->setStatusTip(tr("Open the Sonic Visualiser reference manual"));
1616 connect(action, SIGNAL(triggered()), this, SLOT(help())); 1616 connect(action, SIGNAL(triggered()), this, SLOT(help()));
1617 m_keyReference->registerShortcut(action); 1617 m_keyReference->registerShortcut(action);
1618 menu->addAction(action); 1618 m_helpMenu->addAction(action);
1619 1619
1620 action = new QAction(tr("&Key and Mouse Reference"), this); 1620 action = new QAction(tr("&Key and Mouse Reference"), this);
1621 action->setShortcut(tr("F2")); 1621 action->setShortcut(tr("F2"));
1622 action->setStatusTip(tr("Open a window showing the keystrokes you can use in Sonic Visualiser")); 1622 action->setStatusTip(tr("Open a window showing the keystrokes you can use in Sonic Visualiser"));
1623 connect(action, SIGNAL(triggered()), this, SLOT(keyReference())); 1623 connect(action, SIGNAL(triggered()), this, SLOT(keyReference()));
1624 m_keyReference->registerShortcut(action); 1624 m_keyReference->registerShortcut(action);
1625 menu->addAction(action); 1625 m_helpMenu->addAction(action);
1626 1626
1627 action = new QAction(tr("Sonic Visualiser on the &Web"), this); 1627 action = new QAction(tr("Sonic Visualiser on the &Web"), this);
1628 action->setStatusTip(tr("Open the Sonic Visualiser website")); 1628 action->setStatusTip(tr("Open the Sonic Visualiser website"));
1629 connect(action, SIGNAL(triggered()), this, SLOT(website())); 1629 connect(action, SIGNAL(triggered()), this, SLOT(website()));
1630 menu->addAction(action); 1630 m_helpMenu->addAction(action);
1631 1631
1632 action = new QAction(tr("&About Sonic Visualiser"), this); 1632 action = new QAction(tr("&About Sonic Visualiser"), this);
1633 action->setStatusTip(tr("Show information about Sonic Visualiser")); 1633 action->setStatusTip(tr("Show information about Sonic Visualiser"));
1634 connect(action, SIGNAL(triggered()), this, SLOT(about())); 1634 connect(action, SIGNAL(triggered()), this, SLOT(about()));
1635 menu->addAction(action); 1635 m_helpMenu->addAction(action);
1636 } 1636 }
1637 1637
1638 void 1638 void
1639 MainWindow::setupRecentFilesMenu() 1639 MainWindow::setupRecentFilesMenu()
1640 { 1640 {
4177 4177
4178 bool wasMinimal = m_viewManager->getMinimalModeEnabled(); 4178 bool wasMinimal = m_viewManager->getMinimalModeEnabled();
4179 bool show; 4179 bool show;
4180 4180
4181 if (wasMinimal) { 4181 if (wasMinimal) {
4182
4182 show = true; 4183 show = true;
4183 m_viewManager->setMinimalModeEnabled(false); 4184 m_viewManager->setMinimalModeEnabled(false);
4184 m_scroll->show(); 4185 m_scroll->show();
4186
4187 // Restore the hidden menus. We need to make sure they go back
4188 // in the right places, so first remove the ones that need to
4189 // be to the right of them and then add those back in as well
4190 // at the appropriate point
4191 menuBar()->removeAction(m_helpMenu->menuAction());
4192 menuBar()->removeAction(m_viewMenu->menuAction());
4193 menuBar()->addMenu(m_editMenu);
4194 menuBar()->addMenu(m_viewMenu);
4195 menuBar()->addMenu(m_paneMenu);
4196 menuBar()->addMenu(m_layerMenu);
4197 menuBar()->addMenu(m_transformsMenu);
4198 menuBar()->addMenu(m_playbackMenu);
4199 menuBar()->addMenu(m_helpMenu);
4200
4185 } else { 4201 } else {
4202
4186 settings.setValue("size", size()); 4203 settings.setValue("size", size());
4204
4187 show = false; 4205 show = false;
4188 m_viewManager->setMinimalModeEnabled(true); 4206 m_viewManager->setMinimalModeEnabled(true);
4189 m_scroll->hide(); 4207 m_scroll->hide();
4208
4209 menuBar()->removeAction(m_playbackMenu->menuAction());
4210 menuBar()->removeAction(m_transformsMenu->menuAction());
4211 menuBar()->removeAction(m_layerMenu->menuAction());
4212 menuBar()->removeAction(m_paneMenu->menuAction());
4213 menuBar()->removeAction(m_editMenu->menuAction());
4190 } 4214 }
4191 4215
4192 //cerr << "Call to MainWindow::toggleViewMode"<< endl; 4216 //cerr << "Call to MainWindow::toggleViewMode"<< endl;
4193 4217
4194 m_playModeToolBar->setVisible(show); 4218 m_playModeToolBar->setVisible(show);