changeset 493:3a85461ab9a7 fullscreen

Make it possible to toggle full-screen through the menu
author Chris Cannam
date Fri, 20 Jan 2012 20:21:28 +0000
parents ab3bcd06b5c2
children 238a97d2a8f4
files main/MainWindow.cpp main/main.cpp
diffstat 2 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/main/MainWindow.cpp	Fri Jan 20 17:08:47 2012 +0000
+++ b/main/MainWindow.cpp	Fri Jan 20 20:21:28 2012 +0000
@@ -381,7 +381,6 @@
     ps->setParent(0);
     ps->showFullScreen();
 //    ps->showMaximized();
-    //!!! we don't really want to create this every time!
     QShortcut *sc = new QShortcut(QKeySequence("Esc"), ps);
     connect(sc, SIGNAL(activated()), this, SLOT(endFullScreen()));
 //    QApplication::processEvents();
@@ -391,6 +390,8 @@
 void
 MainWindow::endFullScreen()
 {
+    QShortcut *sc = dynamic_cast<QShortcut *>(sender());
+    if (sc) delete sc; // it was only created in goFullScreen
     m_mainScroll->setWidget(m_paneStack);
 }
 
@@ -964,6 +965,11 @@
     action->setStatusTip(tr("Open a window listing interactions and other events"));
     connect(action, SIGNAL(triggered()), this, SLOT(showActivityLog()));
     menu->addAction(action);
+
+    //!!!
+    action = new QAction(tr("Go Full-Screen"), this);
+    connect(action, SIGNAL(triggered()), this, SLOT(goFullScreen()));
+    menu->addAction(action);
 }
 
 void
--- a/main/main.cpp	Fri Jan 20 17:08:47 2012 +0000
+++ b/main/main.cpp	Fri Jan 20 20:21:28 2012 +0000
@@ -352,7 +352,6 @@
     settings.endGroup();
     
     gui->show();
-    gui->goFullScreen();
 
     // The MainWindow class seems to have trouble dealing with this if
     // it tries to adapt to this preference before the constructor is