From 9d6ac340255466ed7a572e08b9350a47b924fdd4 Mon Sep 17 00:00:00 2001 From: Mark Watkins Date: Sun, 22 Jun 2014 13:54:56 +1000 Subject: [PATCH] Fix closeEvent's not firing, and not saving settings properly --- sleepyhead/daily.h | 5 ++--- sleepyhead/docs/release_notes.html | 6 ++++-- sleepyhead/mainwindow.cpp | 12 ++++++------ sleepyhead/mainwindow.h | 2 +- sleepyhead/preferencesdialog.cpp | 4 ++++ 5 files changed, 17 insertions(+), 12 deletions(-) diff --git a/sleepyhead/daily.h b/sleepyhead/daily.h index bc384a73..261eda07 100644 --- a/sleepyhead/daily.h +++ b/sleepyhead/daily.h @@ -79,9 +79,6 @@ public: */ explicit Daily(QWidget *parent, gGraphView *shared); ~Daily(); - void closeEvent(QCloseEvent *); - void showEvent(QShowEvent *); - /*! \fn ReloadGraphs() \brief Reload all graph information from disk and updates the view. @@ -259,6 +256,8 @@ private slots: void doToggleSession(Session *); protected: + virtual void closeEvent(QCloseEvent *); + virtual void showEvent(QShowEvent *); private: /*! \fn CreateJournalSession() diff --git a/sleepyhead/docs/release_notes.html b/sleepyhead/docs/release_notes.html index a3cbc0e6..da1b1f7e 100644 --- a/sleepyhead/docs/release_notes.html +++ b/sleepyhead/docs/release_notes.html @@ -1,16 +1,18 @@ -

SleepyHead v0.9.6 BETA

+

SleepyHead v0.9.6 Testing

Release Notes

Greetings!

Here is a new and hopefully improved SleepyHead build.

-

This build features rework to the graphing code which should hopefully increase compatability a little, at the cost of a little performance.

New features & bugs fixes in v0.9.6
+
  • Threadsafety improvements to debug/logger
  • +
  • Multithreaded PRS1 and ResMed loader improvements
  • Minor user interface tweaks
  • Added ChoiceMMed MD300W1 Oximeter file import support
  • +
  • Graph Preferences min/max settings are now honoured correctly
  • Complete Rewrite of CMS50 Importer
  • Completely redesigned Oximetery with new Import Wizard
  • Improved data Purge and Reimport from backup abilities
  • diff --git a/sleepyhead/mainwindow.cpp b/sleepyhead/mainwindow.cpp index 6ce17209..49fec450 100644 --- a/sleepyhead/mainwindow.cpp +++ b/sleepyhead/mainwindow.cpp @@ -306,24 +306,24 @@ MainWindow::MainWindow(QWidget *parent) : void MainWindow::closeEvent(QCloseEvent * event) { - // Shutdown and Save the current User profile - Profiles::Done(); - if (daily) { - //daily->close(); + daily->close(); daily->deleteLater(); } if (overview) { - //overview->close(); + overview->close(); overview->deleteLater(); } if (oximetry) { - //oximetry->close(); + oximetry->close(); oximetry->deleteLater(); } + // Shutdown and Save the current User profile + Profiles::Done(); + // Save current window position QSettings settings(getDeveloperName(), getAppName()); settings.setValue("MainWindow/geometry", saveGeometry()); diff --git a/sleepyhead/mainwindow.h b/sleepyhead/mainwindow.h index 95e781f6..052e6458 100644 --- a/sleepyhead/mainwindow.h +++ b/sleepyhead/mainwindow.h @@ -140,13 +140,13 @@ class MainWindow : public QMainWindow //! \brief Internal function to set Records Box html from statistics module void setRecBoxHTML(QString html); - void closeEvent(QCloseEvent *); public slots: //! \brief Recalculate all event summaries and flags void doReprocessEvents(); protected: + virtual void closeEvent(QCloseEvent *); virtual void keyPressEvent(QKeyEvent *event); private slots: diff --git a/sleepyhead/preferencesdialog.cpp b/sleepyhead/preferencesdialog.cpp index 94333e24..fe095c95 100644 --- a/sleepyhead/preferencesdialog.cpp +++ b/sleepyhead/preferencesdialog.cpp @@ -546,6 +546,7 @@ bool PreferencesDialog::Save() PREF.Save(); PROFILE.Save(); + if (recalc_events) { // send a signal instead? mainwin->reprocessEvents(needs_restart); @@ -553,6 +554,9 @@ bool PreferencesDialog::Save() mainwin->RestartApplication(); } else { mainwin->getDaily()->LoadDate(mainwin->getDaily()->getDate()); + // Save early.. just in case.. + mainwin->getDaily()->graphView()->SaveSettings("Daily"); + mainwin->getOverview()->graphView()->SaveSettings("Overview"); } return true;