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
This commit is contained in:
PKEuS 2012-10-27 12:22:56 +02:00
parent fc78cac797
commit 7c8f6173c1
14 changed files with 25 additions and 29 deletions

View File

@ -23,8 +23,8 @@
#include "report.h" #include "report.h"
#include "csvreport.h" #include "csvreport.h"
CsvReport::CsvReport(const QString &filename, QObject * parent) : CsvReport::CsvReport(const QString &filename) :
Report(filename, parent) Report(filename)
{ {
} }

View File

@ -19,7 +19,6 @@
#ifndef CSV_REPORT_H #ifndef CSV_REPORT_H
#define CSV_REPORT_H #define CSV_REPORT_H
#include <QObject>
#include <QString> #include <QString>
#include <QTextStream> #include <QTextStream>
#include "report.h" #include "report.h"
@ -36,7 +35,7 @@
*/ */
class CsvReport : public Report { class CsvReport : public Report {
public: public:
CsvReport(const QString &filename, QObject * parent = 0); CsvReport(const QString &filename);
virtual ~CsvReport(); virtual ~CsvReport();
/** /**

View File

@ -21,8 +21,7 @@
#include <QFile> #include <QFile>
#include "report.h" #include "report.h"
Report::Report(const QString &filename, QObject * parent) : Report::Report(const QString &filename) :
QObject(parent),
mFilename(filename) mFilename(filename)
{ {
} }

View File

@ -40,7 +40,7 @@ public:
CSV, CSV,
}; };
Report(const QString &filename, QObject * parent = 0); Report(const QString &filename);
virtual ~Report(); virtual ~Report();
/** /**

View File

@ -132,7 +132,7 @@ void ResultsView::FilterResults(const QString& filter)
mUI.mTree->FilterResults(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) { if (!mErrorsFound) {
QMessageBox msgBox; QMessageBox msgBox;
@ -145,16 +145,16 @@ void ResultsView::Save(const QString &filename, Report::Type type)
switch (type) { switch (type) {
case Report::CSV: case Report::CSV:
report = new CsvReport(filename, this); report = new CsvReport(filename);
break; break;
case Report::TXT: case Report::TXT:
report = new TxtReport(filename, this); report = new TxtReport(filename);
break; break;
case Report::XML: case Report::XML:
report = new XmlReportV1(filename, this); report = new XmlReportV1(filename);
break; break;
case Report::XMLV2: case Report::XMLV2:
report = new XmlReportV2(filename, this); report = new XmlReportV2(filename);
break; break;
} }
@ -272,9 +272,9 @@ void ResultsView::ReadErrorsXml(const QString &filename)
XmlReport *report = NULL; XmlReport *report = NULL;
if (version == 1) if (version == 1)
report = new XmlReportV1(filename, this); report = new XmlReportV1(filename);
else if (version == 2) else if (version == 2)
report = new XmlReportV2(filename, this); report = new XmlReportV2(filename);
QList<ErrorItem> errors; QList<ErrorItem> errors;
if (report) { if (report) {

View File

@ -73,7 +73,7 @@ public:
* @param filename Filename to save results to * @param filename Filename to save results to
* @param type Type of the report. * @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 * @brief Update tree settings

View File

@ -19,8 +19,8 @@
#include <QDir> #include <QDir>
#include "txtreport.h" #include "txtreport.h"
TxtReport::TxtReport(const QString &filename, QObject * parent) : TxtReport::TxtReport(const QString &filename) :
Report(filename, parent) Report(filename)
{ {
} }

View File

@ -19,7 +19,6 @@
#ifndef TXT_REPORT_H #ifndef TXT_REPORT_H
#define TXT_REPORT_H #define TXT_REPORT_H
#include <QObject>
#include <QString> #include <QString>
#include <QTextStream> #include <QTextStream>
#include "report.h" #include "report.h"
@ -36,7 +35,7 @@ class TxtReport : public Report {
Q_OBJECT Q_OBJECT
public: public:
TxtReport(const QString &filename, QObject * parent = 0); TxtReport(const QString &filename);
virtual ~TxtReport(); virtual ~TxtReport();
/** /**

View File

@ -26,8 +26,8 @@
static const char ResultElementName[] = "results"; static const char ResultElementName[] = "results";
static const char VersionAttribute[] = "version"; static const char VersionAttribute[] = "version";
XmlReport::XmlReport(const QString &filename, QObject * parent) : XmlReport::XmlReport(const QString &filename) :
Report(filename, parent) Report(filename)
{ {
} }

View File

@ -35,7 +35,7 @@ class QObject;
*/ */
class XmlReport : public Report { class XmlReport : public Report {
public: public:
XmlReport(const QString &filename, QObject * parent = 0); XmlReport(const QString &filename);
/** /**
* @brief Read contents of the report file. * @brief Read contents of the report file.

View File

@ -35,8 +35,8 @@ static const char IdAttribute[] = "id";
static const char SeverityAttribute[] = "severity"; static const char SeverityAttribute[] = "severity";
static const char MsgAttribute[] = "msg"; static const char MsgAttribute[] = "msg";
XmlReportV1::XmlReportV1(const QString &filename, QObject * parent) : XmlReportV1::XmlReportV1(const QString &filename) :
XmlReport(filename, parent), XmlReport(filename),
mXmlReader(NULL), mXmlReader(NULL),
mXmlWriter(NULL) mXmlWriter(NULL)
{ {

View File

@ -19,7 +19,6 @@
#ifndef XML_REPORTV1_H #ifndef XML_REPORTV1_H
#define XML_REPORTV1_H #define XML_REPORTV1_H
#include <QObject>
#include <QString> #include <QString>
#include <QXmlStreamReader> #include <QXmlStreamReader>
#include <QXmlStreamWriter> #include <QXmlStreamWriter>
@ -36,7 +35,7 @@
*/ */
class XmlReportV1 : public XmlReport { class XmlReportV1 : public XmlReport {
public: public:
XmlReportV1(const QString &filename, QObject * parent = 0); XmlReportV1(const QString &filename);
virtual ~XmlReportV1(); virtual ~XmlReportV1();
/** /**

View File

@ -41,8 +41,8 @@ static const char MsgAttribute[] = "msg";
static const char VersionAttribute[] = "version"; static const char VersionAttribute[] = "version";
static const char VerboseAttribute[] = "verbose"; static const char VerboseAttribute[] = "verbose";
XmlReportV2::XmlReportV2(const QString &filename, QObject * parent) : XmlReportV2::XmlReportV2(const QString &filename) :
XmlReport(filename, parent), XmlReport(filename),
mXmlReader(NULL), mXmlReader(NULL),
mXmlWriter(NULL) mXmlWriter(NULL)
{ {

View File

@ -36,7 +36,7 @@
*/ */
class XmlReportV2 : public XmlReport { class XmlReportV2 : public XmlReport {
public: public:
XmlReportV2(const QString &filename, QObject * parent = 0); XmlReportV2(const QString &filename);
virtual ~XmlReportV2(); virtual ~XmlReportV2();
/** /**