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:
parent
fc78cac797
commit
7c8f6173c1
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
#ifndef CSV_REPORT_H
|
||||
#define CSV_REPORT_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QTextStream>
|
||||
#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();
|
||||
|
||||
/**
|
||||
|
|
|
@ -21,8 +21,7 @@
|
|||
#include <QFile>
|
||||
#include "report.h"
|
||||
|
||||
Report::Report(const QString &filename, QObject * parent) :
|
||||
QObject(parent),
|
||||
Report::Report(const QString &filename) :
|
||||
mFilename(filename)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ public:
|
|||
CSV,
|
||||
};
|
||||
|
||||
Report(const QString &filename, QObject * parent = 0);
|
||||
Report(const QString &filename);
|
||||
virtual ~Report();
|
||||
|
||||
/**
|
||||
|
|
|
@ -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<ErrorItem> errors;
|
||||
if (report) {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
#include <QDir>
|
||||
#include "txtreport.h"
|
||||
|
||||
TxtReport::TxtReport(const QString &filename, QObject * parent) :
|
||||
Report(filename, parent)
|
||||
TxtReport::TxtReport(const QString &filename) :
|
||||
Report(filename)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
#ifndef TXT_REPORT_H
|
||||
#define TXT_REPORT_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QTextStream>
|
||||
#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();
|
||||
|
||||
/**
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
#ifndef XML_REPORTV1_H
|
||||
#define XML_REPORTV1_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QXmlStreamReader>
|
||||
#include <QXmlStreamWriter>
|
||||
|
@ -36,7 +35,7 @@
|
|||
*/
|
||||
class XmlReportV1 : public XmlReport {
|
||||
public:
|
||||
XmlReportV1(const QString &filename, QObject * parent = 0);
|
||||
XmlReportV1(const QString &filename);
|
||||
virtual ~XmlReportV1();
|
||||
|
||||
/**
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
*/
|
||||
class XmlReportV2 : public XmlReport {
|
||||
public:
|
||||
XmlReportV2(const QString &filename, QObject * parent = 0);
|
||||
XmlReportV2(const QString &filename);
|
||||
virtual ~XmlReportV2();
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue