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();
}
Daily::~Daily()
{
GraphView->SaveSettings("Daily");
// disconnect(sessbar, SIGNAL(toggledSession(Session*)), this, SLOT(doToggleSession(Session*)));
disconnect(webView,SIGNAL(linkClicked(QUrl)),this,SLOT(Link_clicked(QUrl)));
// Save any last minute changes..
if (previous_date.isValid())
Unload(previous_date);
// delete splitter;
delete ui;
@ -412,6 +409,17 @@ Daily::~Daily()
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)
{
Q_UNUSED(sess)

View File

@ -79,6 +79,8 @@ public:
*/
explicit Daily(QWidget *parent, gGraphView *shared);
~Daily();
void closeEvent(QCloseEvent *);
/*! \fn ReloadGraphs()
\brief Reload all graph information from disk and updates the view.
*/

View File

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

View File

@ -299,13 +299,19 @@ Overview::Overview(QWidget *parent, gGraphView *shared) :
}
Overview::~Overview()
{
GraphView->SaveSettings("Overview");//no trans
disconnect(this, SLOT(dateStart_currentPageChanged(int, int)));
disconnect(this, SLOT(dateEnd_currentPageChanged(int, int)));
delete ui;
delete icon_on;
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)
{
int default_height = PROFILE.appearance->graphHeight();

View File

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

View File

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

View File

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