From 7c8f6173c1fe41eab32ada3be3da22975c283bf8 Mon Sep 17 00:00:00 2001 From: PKEuS Date: Sat, 27 Oct 2012 12:22:56 +0200 Subject: [PATCH] Don't need parent of QObject to be set in Report -> Increase constness of ResultsView::Save() - our code already deletes all Report instances; there is no need for garbage collector --- gui/csvreport.cpp | 4 ++-- gui/csvreport.h | 3 +-- gui/report.cpp | 3 +-- gui/report.h | 2 +- gui/resultsview.cpp | 14 +++++++------- gui/resultsview.h | 2 +- gui/txtreport.cpp | 4 ++-- gui/txtreport.h | 3 +-- gui/xmlreport.cpp | 4 ++-- gui/xmlreport.h | 2 +- gui/xmlreportv1.cpp | 4 ++-- gui/xmlreportv1.h | 3 +-- gui/xmlreportv2.cpp | 4 ++-- gui/xmlreportv2.h | 2 +- 14 files changed, 25 insertions(+), 29 deletions(-) diff --git a/gui/csvreport.cpp b/gui/csvreport.cpp index 18c242d62..53d3ac600 100644 --- a/gui/csvreport.cpp +++ b/gui/csvreport.cpp @@ -23,8 +23,8 @@ #include "report.h" #include "csvreport.h" -CsvReport::CsvReport(const QString &filename, QObject * parent) : - Report(filename, parent) +CsvReport::CsvReport(const QString &filename) : + Report(filename) { } diff --git a/gui/csvreport.h b/gui/csvreport.h index 192c01c75..526af2fbe 100644 --- a/gui/csvreport.h +++ b/gui/csvreport.h @@ -19,7 +19,6 @@ #ifndef CSV_REPORT_H #define CSV_REPORT_H -#include #include #include #include "report.h" @@ -36,7 +35,7 @@ */ class CsvReport : public Report { public: - CsvReport(const QString &filename, QObject * parent = 0); + CsvReport(const QString &filename); virtual ~CsvReport(); /** diff --git a/gui/report.cpp b/gui/report.cpp index 664b59ccf..471b6c79e 100644 --- a/gui/report.cpp +++ b/gui/report.cpp @@ -21,8 +21,7 @@ #include #include "report.h" -Report::Report(const QString &filename, QObject * parent) : - QObject(parent), +Report::Report(const QString &filename) : mFilename(filename) { } diff --git a/gui/report.h b/gui/report.h index 28dfa0aac..464cd98ec 100644 --- a/gui/report.h +++ b/gui/report.h @@ -40,7 +40,7 @@ public: CSV, }; - Report(const QString &filename, QObject * parent = 0); + Report(const QString &filename); virtual ~Report(); /** diff --git a/gui/resultsview.cpp b/gui/resultsview.cpp index 5540e3be5..a9e732124 100644 --- a/gui/resultsview.cpp +++ b/gui/resultsview.cpp @@ -132,7 +132,7 @@ void ResultsView::FilterResults(const QString& filter) mUI.mTree->FilterResults(filter); } -void ResultsView::Save(const QString &filename, Report::Type type) +void ResultsView::Save(const QString &filename, Report::Type type) const { if (!mErrorsFound) { QMessageBox msgBox; @@ -145,16 +145,16 @@ void ResultsView::Save(const QString &filename, Report::Type type) switch (type) { case Report::CSV: - report = new CsvReport(filename, this); + report = new CsvReport(filename); break; case Report::TXT: - report = new TxtReport(filename, this); + report = new TxtReport(filename); break; case Report::XML: - report = new XmlReportV1(filename, this); + report = new XmlReportV1(filename); break; case Report::XMLV2: - report = new XmlReportV2(filename, this); + report = new XmlReportV2(filename); break; } @@ -272,9 +272,9 @@ void ResultsView::ReadErrorsXml(const QString &filename) XmlReport *report = NULL; if (version == 1) - report = new XmlReportV1(filename, this); + report = new XmlReportV1(filename); else if (version == 2) - report = new XmlReportV2(filename, this); + report = new XmlReportV2(filename); QList errors; if (report) { diff --git a/gui/resultsview.h b/gui/resultsview.h index 832dc0bc4..e9a2bb090 100644 --- a/gui/resultsview.h +++ b/gui/resultsview.h @@ -73,7 +73,7 @@ public: * @param filename Filename to save results to * @param type Type of the report. */ - void Save(const QString &filename, Report::Type type); + void Save(const QString &filename, Report::Type type) const; /** * @brief Update tree settings diff --git a/gui/txtreport.cpp b/gui/txtreport.cpp index 89310f489..ab518af71 100644 --- a/gui/txtreport.cpp +++ b/gui/txtreport.cpp @@ -19,8 +19,8 @@ #include #include "txtreport.h" -TxtReport::TxtReport(const QString &filename, QObject * parent) : - Report(filename, parent) +TxtReport::TxtReport(const QString &filename) : + Report(filename) { } diff --git a/gui/txtreport.h b/gui/txtreport.h index 2310999da..85f059973 100644 --- a/gui/txtreport.h +++ b/gui/txtreport.h @@ -19,7 +19,6 @@ #ifndef TXT_REPORT_H #define TXT_REPORT_H -#include #include #include #include "report.h" @@ -36,7 +35,7 @@ class TxtReport : public Report { Q_OBJECT public: - TxtReport(const QString &filename, QObject * parent = 0); + TxtReport(const QString &filename); virtual ~TxtReport(); /** diff --git a/gui/xmlreport.cpp b/gui/xmlreport.cpp index dc79879d5..122c65d3e 100644 --- a/gui/xmlreport.cpp +++ b/gui/xmlreport.cpp @@ -26,8 +26,8 @@ static const char ResultElementName[] = "results"; static const char VersionAttribute[] = "version"; -XmlReport::XmlReport(const QString &filename, QObject * parent) : - Report(filename, parent) +XmlReport::XmlReport(const QString &filename) : + Report(filename) { } diff --git a/gui/xmlreport.h b/gui/xmlreport.h index 16f780e96..9aae171cd 100644 --- a/gui/xmlreport.h +++ b/gui/xmlreport.h @@ -35,7 +35,7 @@ class QObject; */ class XmlReport : public Report { public: - XmlReport(const QString &filename, QObject * parent = 0); + XmlReport(const QString &filename); /** * @brief Read contents of the report file. diff --git a/gui/xmlreportv1.cpp b/gui/xmlreportv1.cpp index 91458e75d..2c2525f68 100644 --- a/gui/xmlreportv1.cpp +++ b/gui/xmlreportv1.cpp @@ -35,8 +35,8 @@ static const char IdAttribute[] = "id"; static const char SeverityAttribute[] = "severity"; static const char MsgAttribute[] = "msg"; -XmlReportV1::XmlReportV1(const QString &filename, QObject * parent) : - XmlReport(filename, parent), +XmlReportV1::XmlReportV1(const QString &filename) : + XmlReport(filename), mXmlReader(NULL), mXmlWriter(NULL) { diff --git a/gui/xmlreportv1.h b/gui/xmlreportv1.h index 59fd4a7f6..12036aafe 100644 --- a/gui/xmlreportv1.h +++ b/gui/xmlreportv1.h @@ -19,7 +19,6 @@ #ifndef XML_REPORTV1_H #define XML_REPORTV1_H -#include #include #include #include @@ -36,7 +35,7 @@ */ class XmlReportV1 : public XmlReport { public: - XmlReportV1(const QString &filename, QObject * parent = 0); + XmlReportV1(const QString &filename); virtual ~XmlReportV1(); /** diff --git a/gui/xmlreportv2.cpp b/gui/xmlreportv2.cpp index 03a1ce321..5d1cb5786 100644 --- a/gui/xmlreportv2.cpp +++ b/gui/xmlreportv2.cpp @@ -41,8 +41,8 @@ static const char MsgAttribute[] = "msg"; static const char VersionAttribute[] = "version"; static const char VerboseAttribute[] = "verbose"; -XmlReportV2::XmlReportV2(const QString &filename, QObject * parent) : - XmlReport(filename, parent), +XmlReportV2::XmlReportV2(const QString &filename) : + XmlReport(filename), mXmlReader(NULL), mXmlWriter(NULL) { diff --git a/gui/xmlreportv2.h b/gui/xmlreportv2.h index 2405d3aca..3383cea91 100644 --- a/gui/xmlreportv2.h +++ b/gui/xmlreportv2.h @@ -36,7 +36,7 @@ */ class XmlReportV2 : public XmlReport { public: - XmlReportV2(const QString &filename, QObject * parent = 0); + XmlReportV2(const QString &filename); virtual ~XmlReportV2(); /**