Fix closeEvent's not firing, and not saving settings properly

This commit is contained in:
Mark Watkins 2014-06-22 13:54:56 +10:00
parent 41622b1ed9
commit 9d6ac34025
5 changed files with 17 additions and 12 deletions

View File

@ -79,9 +79,6 @@ public:
*/ */
explicit Daily(QWidget *parent, gGraphView *shared); explicit Daily(QWidget *parent, gGraphView *shared);
~Daily(); ~Daily();
void closeEvent(QCloseEvent *);
void showEvent(QShowEvent *);
/*! \fn ReloadGraphs() /*! \fn ReloadGraphs()
\brief Reload all graph information from disk and updates the view. \brief Reload all graph information from disk and updates the view.
@ -259,6 +256,8 @@ private slots:
void doToggleSession(Session *); void doToggleSession(Session *);
protected: protected:
virtual void closeEvent(QCloseEvent *);
virtual void showEvent(QShowEvent *);
private: private:
/*! \fn CreateJournalSession() /*! \fn CreateJournalSession()

View File

@ -1,16 +1,18 @@
<html> <html>
<body> <body>
<h1><image src="qrc:/docs/sheep.png" width=64 height=64>SleepyHead v0.9.6 <b>BETA</b></h1> <h1><image src="qrc:/docs/sheep.png" width=64 height=64>SleepyHead v0.9.6 <b>Testing</b></h1>
<p><h2><b>Release Notes</b></h2></p> <p><h2><b>Release Notes</b></h2></p>
<p>Greetings!</p> <p>Greetings!</p>
<p>Here is a new and hopefully improved SleepyHead build.</p> <p>Here is a new and hopefully improved SleepyHead build.</p>
<p>This build features rework to the graphing code which should hopefully increase compatability a little, at the cost of a little performance.</p>
<b>New features & bugs fixes in v0.9.6</b><br/> <b>New features & bugs fixes in v0.9.6</b><br/>
<list> <list>
<li>Threadsafety improvements to debug/logger</li>
<li>Multithreaded PRS1 and ResMed loader improvements</li>
<li>Minor user interface tweaks</li> <li>Minor user interface tweaks</li>
<li>Added ChoiceMMed MD300W1 Oximeter file import support</li> <li>Added ChoiceMMed MD300W1 Oximeter file import support</li>
<li>Graph Preferences min/max settings are now honoured correctly</li>
<li>Complete Rewrite of CMS50 Importer</li> <li>Complete Rewrite of CMS50 Importer</li>
<li>Completely redesigned Oximetery with new Import Wizard</li> <li>Completely redesigned Oximetery with new Import Wizard</li>
<li>Improved data Purge and Reimport from backup abilities</li> <li>Improved data Purge and Reimport from backup abilities</li>

View File

@ -306,24 +306,24 @@ MainWindow::MainWindow(QWidget *parent) :
void MainWindow::closeEvent(QCloseEvent * event) void MainWindow::closeEvent(QCloseEvent * event)
{ {
// Shutdown and Save the current User profile
Profiles::Done();
if (daily) { if (daily) {
//daily->close(); daily->close();
daily->deleteLater(); daily->deleteLater();
} }
if (overview) { if (overview) {
//overview->close(); overview->close();
overview->deleteLater(); overview->deleteLater();
} }
if (oximetry) { if (oximetry) {
//oximetry->close(); oximetry->close();
oximetry->deleteLater(); oximetry->deleteLater();
} }
// Shutdown and Save the current User profile
Profiles::Done();
// Save current window position // Save current window position
QSettings settings(getDeveloperName(), getAppName()); QSettings settings(getDeveloperName(), getAppName());
settings.setValue("MainWindow/geometry", saveGeometry()); settings.setValue("MainWindow/geometry", saveGeometry());

View File

@ -140,13 +140,13 @@ class MainWindow : public QMainWindow
//! \brief Internal function to set Records Box html from statistics module //! \brief Internal function to set Records Box html from statistics module
void setRecBoxHTML(QString html); void setRecBoxHTML(QString html);
void closeEvent(QCloseEvent *);
public slots: public slots:
//! \brief Recalculate all event summaries and flags //! \brief Recalculate all event summaries and flags
void doReprocessEvents(); void doReprocessEvents();
protected: protected:
virtual void closeEvent(QCloseEvent *);
virtual void keyPressEvent(QKeyEvent *event); virtual void keyPressEvent(QKeyEvent *event);
private slots: private slots:

View File

@ -546,6 +546,7 @@ bool PreferencesDialog::Save()
PREF.Save(); PREF.Save();
PROFILE.Save(); PROFILE.Save();
if (recalc_events) { if (recalc_events) {
// send a signal instead? // send a signal instead?
mainwin->reprocessEvents(needs_restart); mainwin->reprocessEvents(needs_restart);
@ -553,6 +554,9 @@ bool PreferencesDialog::Save()
mainwin->RestartApplication(); mainwin->RestartApplication();
} else { } else {
mainwin->getDaily()->LoadDate(mainwin->getDaily()->getDate()); mainwin->getDaily()->LoadDate(mainwin->getDaily()->getDate());
// Save early.. just in case..
mainwin->getDaily()->graphView()->SaveSettings("Daily");
mainwin->getOverview()->graphView()->SaveSettings("Overview");
} }
return true; return true;