From 815cb6cb91699cdba51733e60a84454123384c2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Fri, 1 Jun 2018 19:07:21 +0200 Subject: [PATCH] Code cleanup --- src/GUI/filebrowser.cpp | 5 ----- src/GUI/filebrowser.h | 1 - src/GUI/graphview.cpp | 18 ++++++------------ src/GUI/gui.cpp | 20 ++++++-------------- src/GUI/gui.h | 1 - 5 files changed, 12 insertions(+), 33 deletions(-) diff --git a/src/GUI/filebrowser.cpp b/src/GUI/filebrowser.cpp index bdc64d61..a56df027 100644 --- a/src/GUI/filebrowser.cpp +++ b/src/GUI/filebrowser.cpp @@ -13,11 +13,6 @@ FileBrowser::FileBrowser(QObject *parent) : QObject(parent) _index = -1; } -FileBrowser::~FileBrowser() -{ - delete _watcher; -} - void FileBrowser::setCurrent(const QString &path) { QFileInfo file(path); diff --git a/src/GUI/filebrowser.h b/src/GUI/filebrowser.h index 6a011cac..cddca22d 100644 --- a/src/GUI/filebrowser.h +++ b/src/GUI/filebrowser.h @@ -13,7 +13,6 @@ class FileBrowser : public QObject public: FileBrowser(QObject *parent = 0); - ~FileBrowser(); void setFilter(const QStringList &filter); void setCurrent(const QString &path); diff --git a/src/GUI/graphview.cpp b/src/GUI/graphview.cpp index ff67d149..0792d71e 100644 --- a/src/GUI/graphview.cpp +++ b/src/GUI/graphview.cpp @@ -63,20 +63,14 @@ GraphView::GraphView(QWidget *parent) GraphView::~GraphView() { - if (_xAxis->scene() != _scene) - delete _xAxis; - if (_yAxis->scene() != _scene) - delete _yAxis; - if (_slider->scene() != _scene) - delete _slider; - if (_info->scene() != _scene) - delete _info; - if (_grid->scene() != _scene) - delete _grid; + delete _xAxis; + delete _yAxis; + delete _slider; + delete _info; + delete _grid; for (int i = 0; i < _graphs.count(); i++) - if (_graphs.at(i)->scene() != _scene) - delete _graphs[i]; + delete _graphs[i]; } void GraphView::createXLabel() diff --git a/src/GUI/gui.cpp b/src/GUI/gui.cpp index 511e7792..b0cc17b9 100644 --- a/src/GUI/gui.cpp +++ b/src/GUI/gui.cpp @@ -96,14 +96,6 @@ GUI::GUI() updateStatusBarInfo(); } -GUI::~GUI() -{ - for (int i = 0; i < _tabs.size(); i++) { - if (_graphTabWidget->indexOf(_tabs.at(i)) < 0) - delete _tabs.at(i); - } -} - void GUI::loadMaps() { _ml = new MapList(this); @@ -557,12 +549,12 @@ void GUI::createGraphTabs() _graphTabWidget->setDocumentMode(true); #endif // Q_OS_WIN32 - _tabs.append(new ElevationGraph); - _tabs.append(new SpeedGraph); - _tabs.append(new HeartRateGraph); - _tabs.append(new CadenceGraph); - _tabs.append(new PowerGraph); - _tabs.append(new TemperatureGraph); + _tabs.append(new ElevationGraph(_graphTabWidget)); + _tabs.append(new SpeedGraph(_graphTabWidget)); + _tabs.append(new HeartRateGraph(_graphTabWidget)); + _tabs.append(new CadenceGraph(_graphTabWidget)); + _tabs.append(new PowerGraph(_graphTabWidget)); + _tabs.append(new TemperatureGraph(_graphTabWidget)); for (int i = 0; i < _tabs.count(); i++) connect(_tabs.at(i), SIGNAL(sliderPositionChanged(qreal)), this, diff --git a/src/GUI/gui.h b/src/GUI/gui.h index 4e12bb70..8435a652 100644 --- a/src/GUI/gui.h +++ b/src/GUI/gui.h @@ -35,7 +35,6 @@ class GUI : public QMainWindow public: GUI(); - ~GUI(); bool openFile(const QString &fileName);