From 0d8b7af2b3440311a7d46b28dd22e97c917a5c32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Fri, 28 Jul 2017 11:12:05 +0200 Subject: [PATCH] GUI: Renamed methods in Report --- gui/csvreport.cpp | 12 ++++++------ gui/csvreport.h | 8 ++++---- gui/printablereport.cpp | 10 +++++----- gui/printablereport.h | 10 +++++----- gui/report.cpp | 12 ++++++------ gui/report.h | 14 +++++++------- gui/resultstree.cpp | 6 +++--- gui/resultsview.cpp | 8 ++++---- gui/txtreport.cpp | 12 ++++++------ gui/txtreport.h | 8 ++++---- gui/xmlreport.h | 2 +- gui/xmlreportv1.cpp | 24 ++++++++++++------------ gui/xmlreportv1.h | 14 +++++++------- gui/xmlreportv2.cpp | 24 ++++++++++++------------ gui/xmlreportv2.h | 14 +++++++------- 15 files changed, 89 insertions(+), 89 deletions(-) diff --git a/gui/csvreport.cpp b/gui/csvreport.cpp index bca3ce80d..43472a24a 100644 --- a/gui/csvreport.cpp +++ b/gui/csvreport.cpp @@ -32,26 +32,26 @@ CsvReport::~CsvReport() { } -bool CsvReport::Create() +bool CsvReport::create() { - if (Report::Create()) { - mTxtWriter.setDevice(Report::GetFile()); + if (Report::create()) { + mTxtWriter.setDevice(Report::getFile()); return true; } return false; } -void CsvReport::WriteHeader() +void CsvReport::writeHeader() { // No header for CSV report } -void CsvReport::WriteFooter() +void CsvReport::writeFooter() { // No footer for CSV report } -void CsvReport::WriteError(const ErrorItem &error) +void CsvReport::writeError(const ErrorItem &error) { /* Error as CSV line diff --git a/gui/csvreport.h b/gui/csvreport.h index 007c47eb5..12760b9cc 100644 --- a/gui/csvreport.h +++ b/gui/csvreport.h @@ -42,23 +42,23 @@ public: * @brief Create the report (file). * @return true if succeeded, false if file could not be created. */ - virtual bool Create(); + virtual bool create(); /** * @brief Write report header. */ - virtual void WriteHeader(); + virtual void writeHeader(); /** * @brief Write report footer. */ - virtual void WriteFooter(); + virtual void writeFooter(); /** * @brief Write error to report. * @param error Error data. */ - virtual void WriteError(const ErrorItem &error); + virtual void writeError(const ErrorItem &error); private: diff --git a/gui/printablereport.cpp b/gui/printablereport.cpp index 5e0a918b8..860adea21 100644 --- a/gui/printablereport.cpp +++ b/gui/printablereport.cpp @@ -28,22 +28,22 @@ PrintableReport::~PrintableReport() { } -bool PrintableReport::Create() +bool PrintableReport::create() { return true; } -void PrintableReport::WriteHeader() +void PrintableReport::writeHeader() { // No header for printable report } -void PrintableReport::WriteFooter() +void PrintableReport::writeFooter() { // No footer for printable report } -void PrintableReport::WriteError(const ErrorItem &error) +void PrintableReport::writeError(const ErrorItem &error) { const QString file = QDir::toNativeSeparators(error.errorPath.back().file); QString line = QString("%1,%2,").arg(file).arg(error.errorPath.back().line); @@ -53,7 +53,7 @@ void PrintableReport::WriteError(const ErrorItem &error) mFormattedReport += "\n"; } -QString PrintableReport::GetFormattedReportText() const +QString PrintableReport::getFormattedReportText() const { return mFormattedReport; } diff --git a/gui/printablereport.h b/gui/printablereport.h index 6865507b2..1b05d0f81 100644 --- a/gui/printablereport.h +++ b/gui/printablereport.h @@ -38,28 +38,28 @@ public: * @brief Create the report (file). * @return true if succeeded, false if file could not be created. */ - virtual bool Create(); + virtual bool create(); /** * @brief Write report header. */ - virtual void WriteHeader(); + virtual void writeHeader(); /** * @brief Write report footer. */ - virtual void WriteFooter(); + virtual void writeFooter(); /** * @brief Write error to report. * @param error Error data. */ - virtual void WriteError(const ErrorItem &error); + virtual void writeError(const ErrorItem &error); /** * @brief Returns the formatted report. */ - QString GetFormattedReportText() const; + QString getFormattedReportText() const; private: diff --git a/gui/report.cpp b/gui/report.cpp index 70caadc62..9f32b8f80 100644 --- a/gui/report.cpp +++ b/gui/report.cpp @@ -16,22 +16,22 @@ * along with this program. If not, see . */ -#include #include #include #include "report.h" Report::Report(const QString &filename) : + QObject(), mFilename(filename) { } Report::~Report() { - Close(); + close(); } -bool Report::Create() +bool Report::create() { bool succeed = false; if (!mFile.isOpen()) { @@ -41,7 +41,7 @@ bool Report::Create() return succeed; } -bool Report::Open() +bool Report::open() { bool succeed = false; if (!mFile.isOpen()) { @@ -51,13 +51,13 @@ bool Report::Open() return succeed; } -void Report::Close() +void Report::close() { if (mFile.isOpen()) mFile.close(); } -QFile* Report::GetFile() +QFile* Report::getFile() { return &mFile; } diff --git a/gui/report.h b/gui/report.h index 292be057b..e6f53a994 100644 --- a/gui/report.h +++ b/gui/report.h @@ -47,41 +47,41 @@ public: * @brief Create the report (file). * @return true if succeeded, false if file could not be created. */ - virtual bool Create(); + virtual bool create(); /** * @brief Open the existing report (file). * @return true if succeeded, false if file could not be created. */ - virtual bool Open(); + virtual bool open(); /** * @brief Close the report (file). */ - virtual void Close(); + virtual void close(); /** * @brief Write report header. */ - virtual void WriteHeader() = 0; + virtual void writeHeader() = 0; /** * @brief Write report footer. */ - virtual void WriteFooter() = 0; + virtual void writeFooter() = 0; /** * @brief Write error to report. * @param error Error data. */ - virtual void WriteError(const ErrorItem &error) = 0; + virtual void writeError(const ErrorItem &error) = 0; protected: /** * @brief Get the file object where the report is written to. */ - QFile* GetFile(); + QFile* getFile(); private: diff --git a/gui/resultstree.cpp b/gui/resultstree.cpp index 2163038ec..101af18af 100644 --- a/gui/resultstree.cpp +++ b/gui/resultstree.cpp @@ -964,7 +964,7 @@ QString ResultsTree::SeverityToIcon(Severity::SeverityType severity) const void ResultsTree::SaveResults(Report *report) const { - report->WriteHeader(); + report->writeHeader(); for (int i = 0; i < mModel.rowCount(); i++) { QStandardItem *item = mModel.item(i, 0); @@ -972,7 +972,7 @@ void ResultsTree::SaveResults(Report *report) const SaveErrors(report, item); } - report->WriteFooter(); + report->writeFooter(); } void ResultsTree::SaveErrors(Report *report, QStandardItem *item) const @@ -1027,7 +1027,7 @@ void ResultsTree::SaveErrors(Report *report, QStandardItem *item) const item.errorPath << e; } - report->WriteError(item); + report->writeError(item); } } diff --git a/gui/resultsview.cpp b/gui/resultsview.cpp index 9779f0a75..1d5a6e46b 100644 --- a/gui/resultsview.cpp +++ b/gui/resultsview.cpp @@ -162,7 +162,7 @@ void ResultsView::Save(const QString &filename, Report::Type type) const } if (report) { - if (report->Create()) + if (report->create()) mUI.mTree->SaveResults(report); else { QMessageBox msgBox; @@ -211,7 +211,7 @@ void ResultsView::Print(QPrinter* printer) PrintableReport report; mUI.mTree->SaveResults(&report); - QTextDocument doc(report.GetFormattedReportText()); + QTextDocument doc(report.getFormattedReportText()); doc.print(printer); } @@ -322,8 +322,8 @@ void ResultsView::ReadErrorsXml(const QString &filename) QList errors; if (report) { - if (report->Open()) - errors = report->Read(); + if (report->open()) + errors = report->read(); else { QMessageBox msgBox; msgBox.setText(tr("Failed to read the report.")); diff --git a/gui/txtreport.cpp b/gui/txtreport.cpp index a71e5d56c..122fe530b 100644 --- a/gui/txtreport.cpp +++ b/gui/txtreport.cpp @@ -28,26 +28,26 @@ TxtReport::~TxtReport() { } -bool TxtReport::Create() +bool TxtReport::create() { - if (Report::Create()) { - mTxtWriter.setDevice(Report::GetFile()); + if (Report::create()) { + mTxtWriter.setDevice(Report::getFile()); return true; } return false; } -void TxtReport::WriteHeader() +void TxtReport::writeHeader() { // No header for txt report } -void TxtReport::WriteFooter() +void TxtReport::writeFooter() { // No footer for txt report } -void TxtReport::WriteError(const ErrorItem &error) +void TxtReport::writeError(const ErrorItem &error) { /* Error example from the core program in text diff --git a/gui/txtreport.h b/gui/txtreport.h index ab2354ece..81577e308 100644 --- a/gui/txtreport.h +++ b/gui/txtreport.h @@ -42,23 +42,23 @@ public: * @brief Create the report (file). * @return true if succeeded, false if file could not be created. */ - virtual bool Create(); + virtual bool create(); /** * @brief Write report header. */ - virtual void WriteHeader(); + virtual void writeHeader(); /** * @brief Write report footer. */ - virtual void WriteFooter(); + virtual void writeFooter(); /** * @brief Write error to report. * @param error Error data. */ - virtual void WriteError(const ErrorItem &error); + virtual void writeError(const ErrorItem &error); private: diff --git a/gui/xmlreport.h b/gui/xmlreport.h index 356beee99..f21216526 100644 --- a/gui/xmlreport.h +++ b/gui/xmlreport.h @@ -40,7 +40,7 @@ public: /** * @brief Read contents of the report file. */ - virtual QList Read() = 0; + virtual QList read() = 0; /** * @brief Quote the message. diff --git a/gui/xmlreportv1.cpp b/gui/xmlreportv1.cpp index de79b01a2..79bd8829f 100644 --- a/gui/xmlreportv1.cpp +++ b/gui/xmlreportv1.cpp @@ -48,38 +48,38 @@ XmlReportV1::~XmlReportV1() delete mXmlWriter; } -bool XmlReportV1::Create() +bool XmlReportV1::create() { - if (Report::Create()) { - mXmlWriter = new QXmlStreamWriter(Report::GetFile()); + if (Report::create()) { + mXmlWriter = new QXmlStreamWriter(Report::getFile()); return true; } return false; } -bool XmlReportV1::Open() +bool XmlReportV1::open() { - if (Report::Open()) { - mXmlReader = new QXmlStreamReader(Report::GetFile()); + if (Report::open()) { + mXmlReader = new QXmlStreamReader(Report::getFile()); return true; } return false; } -void XmlReportV1::WriteHeader() +void XmlReportV1::writeHeader() { mXmlWriter->setAutoFormatting(true); mXmlWriter->writeStartDocument(); mXmlWriter->writeStartElement(ResultElementName); } -void XmlReportV1::WriteFooter() +void XmlReportV1::writeFooter() { mXmlWriter->writeEndElement(); mXmlWriter->writeEndDocument(); } -void XmlReportV1::WriteError(const ErrorItem &error) +void XmlReportV1::writeError(const ErrorItem &error) { /* Error example from the core program in xml @@ -106,7 +106,7 @@ void XmlReportV1::WriteError(const ErrorItem &error) mXmlWriter->writeEndElement(); } -QList XmlReportV1::Read() +QList XmlReportV1::read() { QList errors; bool insideResults = false; @@ -122,7 +122,7 @@ QList XmlReportV1::Read() // Read error element from inside result element if (insideResults && mXmlReader->name() == ErrorElementName) { - ErrorItem item = ReadError(mXmlReader); + ErrorItem item = readError(mXmlReader); errors.append(item); } break; @@ -148,7 +148,7 @@ QList XmlReportV1::Read() return errors; } -ErrorItem XmlReportV1::ReadError(QXmlStreamReader *reader) +ErrorItem XmlReportV1::readError(QXmlStreamReader *reader) { ErrorItem item; if (reader->name().toString() == ErrorElementName) { diff --git a/gui/xmlreportv1.h b/gui/xmlreportv1.h index 6ef7fa443..8399b7a53 100644 --- a/gui/xmlreportv1.h +++ b/gui/xmlreportv1.h @@ -42,40 +42,40 @@ public: * @brief Create the report (file). * @return true if succeeded, false if file could not be created. */ - virtual bool Create(); + virtual bool create(); /** * @brief Open existing report file. */ - bool Open(); + bool open(); /** * @brief Write report header. */ - virtual void WriteHeader(); + virtual void writeHeader(); /** * @brief Write report footer. */ - virtual void WriteFooter(); + virtual void writeFooter(); /** * @brief Write error to report. * @param error Error data. */ - virtual void WriteError(const ErrorItem &error); + virtual void writeError(const ErrorItem &error); /** * @brief Read contents of the report file. */ - virtual QList Read(); + virtual QList read(); protected: /** * @brief Read and parse error item from XML stream. * @param reader XML stream reader to use. */ - ErrorItem ReadError(QXmlStreamReader *reader); + ErrorItem readError(QXmlStreamReader *reader); private: /** diff --git a/gui/xmlreportv2.cpp b/gui/xmlreportv2.cpp index 8f0663fa2..d5e244091 100644 --- a/gui/xmlreportv2.cpp +++ b/gui/xmlreportv2.cpp @@ -59,25 +59,25 @@ XmlReportV2::~XmlReportV2() delete mXmlWriter; } -bool XmlReportV2::Create() +bool XmlReportV2::create() { - if (Report::Create()) { - mXmlWriter = new QXmlStreamWriter(Report::GetFile()); + if (Report::create()) { + mXmlWriter = new QXmlStreamWriter(Report::getFile()); return true; } return false; } -bool XmlReportV2::Open() +bool XmlReportV2::open() { - if (Report::Open()) { - mXmlReader = new QXmlStreamReader(Report::GetFile()); + if (Report::open()) { + mXmlReader = new QXmlStreamReader(Report::getFile()); return true; } return false; } -void XmlReportV2::WriteHeader() +void XmlReportV2::writeHeader() { mXmlWriter->setAutoFormatting(true); mXmlWriter->writeStartDocument(); @@ -89,14 +89,14 @@ void XmlReportV2::WriteHeader() mXmlWriter->writeStartElement(ErrorsElementName); } -void XmlReportV2::WriteFooter() +void XmlReportV2::writeFooter() { mXmlWriter->writeEndElement(); // errors mXmlWriter->writeEndElement(); // results mXmlWriter->writeEndDocument(); } -void XmlReportV2::WriteError(const ErrorItem &error) +void XmlReportV2::writeError(const ErrorItem &error) { /* Error example from the core program in xml @@ -141,7 +141,7 @@ void XmlReportV2::WriteError(const ErrorItem &error) mXmlWriter->writeEndElement(); } -QList XmlReportV2::Read() +QList XmlReportV2::read() { QList errors; bool insideResults = false; @@ -157,7 +157,7 @@ QList XmlReportV2::Read() // Read error element from inside result element if (insideResults && mXmlReader->name() == ErrorElementName) { - ErrorItem item = ReadError(mXmlReader); + ErrorItem item = readError(mXmlReader); errors.append(item); } break; @@ -183,7 +183,7 @@ QList XmlReportV2::Read() return errors; } -ErrorItem XmlReportV2::ReadError(QXmlStreamReader *reader) +ErrorItem XmlReportV2::readError(QXmlStreamReader *reader) { /* Error example from the core program in xml diff --git a/gui/xmlreportv2.h b/gui/xmlreportv2.h index d680d6bb9..d2b295f21 100644 --- a/gui/xmlreportv2.h +++ b/gui/xmlreportv2.h @@ -43,40 +43,40 @@ public: * @brief Create the report (file). * @return true if succeeded, false if file could not be created. */ - virtual bool Create(); + virtual bool create(); /** * @brief Open existing report file. */ - bool Open(); + bool open(); /** * @brief Write report header. */ - virtual void WriteHeader(); + virtual void writeHeader(); /** * @brief Write report footer. */ - virtual void WriteFooter(); + virtual void writeFooter(); /** * @brief Write error to report. * @param error Error data. */ - virtual void WriteError(const ErrorItem &error); + virtual void writeError(const ErrorItem &error); /** * @brief Read contents of the report file. */ - virtual QList Read(); + virtual QList read(); protected: /** * @brief Read and parse error item from XML stream. * @param reader XML stream reader to use. */ - ErrorItem ReadError(QXmlStreamReader *reader); + ErrorItem readError(QXmlStreamReader *reader); private: /**