changeset 489:c11a29843fe1 fullscreen

Start hacking in some fullscreen stuff (so far, this is just a mess)
author Chris Cannam
date Thu, 19 Jan 2012 15:34:33 +0000
parents 073733da4b6c
children 9137b619b652
files main/MainWindow.cpp main/MainWindow.h main/main.cpp
diffstat 3 files changed, 32 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/main/MainWindow.cpp	Thu Jan 19 14:44:35 2012 +0000
+++ b/main/MainWindow.cpp	Thu Jan 19 15:34:33 2012 +0000
@@ -149,6 +149,7 @@
     m_soloAction(0),
     m_soloModified(false),
     m_prevSolo(false),
+    m_exiting(false),
     m_rwdStartAction(0),
     m_rwdSimilarAction(0),
     m_rwdAction(0),
@@ -196,12 +197,12 @@
 
     m_descriptionLabel = new QLabel; //!!! hang on, this is declared in base class -- should be declared and initialised by same class
 
-    QScrollArea *scroll = new QScrollArea(frame);
-    scroll->setWidgetResizable(true);
-    scroll->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
-    scroll->setFrameShape(QFrame::NoFrame);
-
-    scroll->setWidget(m_paneStack);
+    m_mainScroll = new QScrollArea(frame);
+    m_mainScroll->setWidgetResizable(true);
+    m_mainScroll->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+    m_mainScroll->setFrameShape(QFrame::NoFrame);
+
+    m_mainScroll->setWidget(m_paneStack);
 
     m_overview = new Overview(frame);
     m_overview->setViewManager(m_viewManager);
@@ -258,7 +259,7 @@
     m_playControlsSpacer = new QFrame;
 
     layout->setSpacing(4);
-    layout->addWidget(scroll, 0, 0, 1, 5);
+    layout->addWidget(m_mainScroll, 0, 0, 1, 5);
     layout->addWidget(m_overview, 1, 1);
     layout->addWidget(m_playControlsSpacer, 1, 2);
     layout->addWidget(m_playSpeed, 1, 3);
@@ -373,6 +374,13 @@
 }
 
 void
+MainWindow::goFullScreen()
+{
+    m_paneStack->setParent(0);
+    m_paneStack->showFullScreen();
+}
+
+void
 MainWindow::setupFileMenu()
 {
     if (m_mainMenusCreated) return;
@@ -2989,6 +2997,11 @@
 void
 MainWindow::closeEvent(QCloseEvent *e)
 {
+    if (m_exiting) {
+        e->accept();
+        return;
+    }
+
 //    SVDEBUG << "MainWindow::closeEvent" << endl;
 
     if (m_openingAudioFile) {
@@ -3021,6 +3034,10 @@
     closeSession();
 
     e->accept();
+
+    m_exiting = true;
+    qApp->closeAllWindows();
+    
     return;
 }
 
--- a/main/MainWindow.h	Thu Jan 19 14:44:35 2012 +0000
+++ b/main/MainWindow.h	Thu Jan 19 15:34:33 2012 +0000
@@ -59,6 +59,7 @@
 class Labeller;
 class ActivityLog;
 class QFileSystemWatcher;
+class QScrollArea;
 
 class MainWindow : public MainWindowBase
 {
@@ -77,6 +78,8 @@
     virtual void preferenceChanged(PropertyContainer::PropertyName);
     virtual bool commitData(bool mayAskUser);
 
+    void goFullScreen();
+
 protected slots:
     virtual void openSession();
     virtual void importAudio();
@@ -186,6 +189,8 @@
     Fader                   *m_fader;
     AudioDial               *m_playSpeed;
     WaveformLayer           *m_panLayer;
+    
+    QScrollArea             *m_mainScroll;
 
     bool                     m_mainMenusCreated;
     QMenu                   *m_paneMenu;
@@ -218,6 +223,8 @@
     bool                     m_soloModified;
     bool                     m_prevSolo;
 
+    bool                     m_exiting;
+
     QFrame                  *m_playControlsSpacer;
     int                      m_playControlsWidth;
 
--- a/main/main.cpp	Thu Jan 19 14:44:35 2012 +0000
+++ b/main/main.cpp	Thu Jan 19 15:34:33 2012 +0000
@@ -352,6 +352,7 @@
     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