Shut down GraphView tabs a little more cleanly

This commit is contained in:
Mark Watkins 2014-05-12 05:04:34 +10:00
parent 924a988769
commit 7eea8ca365
7 changed files with 38 additions and 11 deletions

View File

@ -396,15 +396,12 @@ Daily::Daily(QWidget *parent,gGraphView * shared)
previous_date=QDate(); previous_date=QDate();
} }
Daily::~Daily() Daily::~Daily()
{ {
GraphView->SaveSettings("Daily");
// disconnect(sessbar, SIGNAL(toggledSession(Session*)), this, SLOT(doToggleSession(Session*))); // disconnect(sessbar, SIGNAL(toggledSession(Session*)), this, SLOT(doToggleSession(Session*)));
disconnect(webView,SIGNAL(linkClicked(QUrl)),this,SLOT(Link_clicked(QUrl)));
// Save any last minute changes.. // Save any last minute changes..
if (previous_date.isValid())
Unload(previous_date);
// delete splitter; // delete splitter;
delete ui; delete ui;
@ -412,6 +409,17 @@ Daily::~Daily()
delete icon_off; delete icon_off;
} }
void Daily::closeEvent(QCloseEvent *event)
{
disconnect(webView,SIGNAL(linkClicked(QUrl)),this,SLOT(Link_clicked(QUrl)));
if (previous_date.isValid())
Unload(previous_date);
GraphView->SaveSettings("Daily");
QWidget::closeEvent(event);
}
void Daily::doToggleSession(Session * sess) void Daily::doToggleSession(Session * sess)
{ {
Q_UNUSED(sess) Q_UNUSED(sess)

View File

@ -79,6 +79,8 @@ public:
*/ */
explicit Daily(QWidget *parent, gGraphView *shared); explicit Daily(QWidget *parent, gGraphView *shared);
~Daily(); ~Daily();
void closeEvent(QCloseEvent *);
/*! \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.
*/ */

View File

@ -242,17 +242,20 @@ void MainWindow::closeEvent(QCloseEvent * event)
{ {
if (daily) { if (daily) {
daily->close(); daily->close();
delete daily; daily->deleteLater();
// delete daily;
} }
if (overview) { if (overview) {
overview->close(); overview->close();
delete overview; overview->deleteLater();
// delete overview;
} }
if (oximetry) { if (oximetry) {
oximetry->close(); oximetry->close();
delete oximetry; oximetry->deleteLater();
// delete oximetry;
} }
// Shutdown and Save the current User profile // Shutdown and Save the current User profile

View File

@ -299,13 +299,19 @@ Overview::Overview(QWidget *parent, gGraphView *shared) :
} }
Overview::~Overview() Overview::~Overview()
{ {
GraphView->SaveSettings("Overview");//no trans
disconnect(this, SLOT(dateStart_currentPageChanged(int, int)));
disconnect(this, SLOT(dateEnd_currentPageChanged(int, int)));
delete ui; delete ui;
delete icon_on; delete icon_on;
delete icon_off; delete icon_off;
} }
void Overview::closeEvent(QCloseEvent *event)
{
GraphView->SaveSettings("Overview");//no trans
disconnect(this, SLOT(dateStart_currentPageChanged(int, int)));
disconnect(this, SLOT(dateEnd_currentPageChanged(int, int)));
QWidget::closeEvent(event);
}
gGraph *Overview::createGraph(QString name, QString units, YTickerType yttype) gGraph *Overview::createGraph(QString name, QString units, YTickerType yttype)
{ {
int default_height = PROFILE.appearance->graphHeight(); int default_height = PROFILE.appearance->graphHeight();

View File

@ -39,6 +39,7 @@ class Overview : public QWidget
public: public:
explicit Overview(QWidget *parent, gGraphView *shared = nullptr); explicit Overview(QWidget *parent, gGraphView *shared = nullptr);
~Overview(); ~Overview();
void closeEvent(QCloseEvent *);
//! \brief Returns Overview gGraphView object containing it's graphs //! \brief Returns Overview gGraphView object containing it's graphs
gGraphView *graphView() { return GraphView; } gGraphView *graphView() { return GraphView; }

View File

@ -1248,10 +1248,16 @@ Oximetry::Oximetry(QWidget *parent, gGraphView *shared) :
} }
Oximetry::~Oximetry() Oximetry::~Oximetry()
{
delete ui;
}
void Oximetry::closeEvent(QCloseEvent *event)
{ {
delete oximeter; delete oximeter;
GraphView->SaveSettings("Oximetry"); GraphView->SaveSettings("Oximetry");
delete ui;
QWidget::closeEvent(event);
} }
void Oximetry::on_RefreshPortsButton_clicked() void Oximetry::on_RefreshPortsButton_clicked()

View File

@ -306,6 +306,7 @@ class Oximetry : public QWidget
public: public:
explicit Oximetry(QWidget *parent, gGraphView *shared = nullptr); explicit Oximetry(QWidget *parent, gGraphView *shared = nullptr);
~Oximetry(); ~Oximetry();
void closeEvent(QCloseEvent *);
//! \brief Calls updateGL to redraw the graphs //! \brief Calls updateGL to redraw the graphs
void RedrawGraphs(); void RedrawGraphs();