From d9e3a08eac9946ee1719de2749e9149624b1c3cf Mon Sep 17 00:00:00 2001 From: Ronan Le Tiec Date: Sat, 23 May 2020 14:01:03 +0200 Subject: [PATCH] Refactoring VPuzzleLayoutFileReader --- src/app/puzzle/puzzle.pri | 4 +-- src/app/puzzle/puzzlemainwindow.cpp | 4 +-- ...tfilereader.cpp => vplayoutfilereader.cpp} | 32 +++++++++---------- ...ayoutfilereader.h => vplayoutfilereader.h} | 14 ++++---- 4 files changed, 27 insertions(+), 27 deletions(-) rename src/app/puzzle/xml/{vpuzzlelayoutfilereader.cpp => vplayoutfilereader.cpp} (91%) rename src/app/puzzle/xml/{vpuzzlelayoutfilereader.h => vplayoutfilereader.h} (89%) diff --git a/src/app/puzzle/puzzle.pri b/src/app/puzzle/puzzle.pri index 1a0814b52..0ebac1854 100644 --- a/src/app/puzzle/puzzle.pri +++ b/src/app/puzzle/puzzle.pri @@ -18,9 +18,9 @@ SOURCES += \ $$PWD/vpuzzlemimedatapiece.cpp \ $$PWD/vpuzzlepiece.cpp \ $$PWD/vpuzzlesettings.cpp \ + $$PWD/xml/vplayoutfilereader.cpp \ $$PWD/xml/vplayoutliterals.cpp \ $$PWD/xml/vpuzzlelayoutfilewriter.cpp \ - $$PWD/xml/vpuzzlelayoutfilereader.cpp \ $$PWD/vpiececarrousellayer.cpp \ $$PWD/vpiececarrouselpiece.cpp @@ -43,9 +43,9 @@ HEADERS += \ $$PWD/vpuzzlemimedatapiece.h \ $$PWD/vpuzzlepiece.h \ $$PWD/vpuzzlesettings.h \ + $$PWD/xml/vplayoutfilereader.h \ $$PWD/xml/vplayoutliterals.h \ $$PWD/xml/vpuzzlelayoutfilewriter.h \ - $$PWD/xml/vpuzzlelayoutfilereader.h \ $$PWD/vpiececarrousellayer.h \ $$PWD/vpiececarrouselpiece.h diff --git a/src/app/puzzle/puzzlemainwindow.cpp b/src/app/puzzle/puzzlemainwindow.cpp index 9a86fa91b..851c1eb12 100644 --- a/src/app/puzzle/puzzlemainwindow.cpp +++ b/src/app/puzzle/puzzlemainwindow.cpp @@ -33,7 +33,7 @@ #include "ui_puzzlemainwindow.h" #include "dialogs/vpdialogabout.h" #include "xml/vpuzzlelayoutfilewriter.h" -#include "xml/vpuzzlelayoutfilereader.h" +#include "xml/vplayoutfilereader.h" #include "puzzleapplication.h" #include "../vlayout/vrawlayout.h" #include "../vmisc/vsysexits.h" @@ -106,7 +106,7 @@ bool PuzzleMainWindow::LoadFile(QString path) QFile file(path); file.open(QIODevice::ReadOnly); - QScopedPointer fileReader(new VPuzzleLayoutFileReader()); + QScopedPointer fileReader(new VPLayoutFileReader()); if(m_layout == nullptr) { diff --git a/src/app/puzzle/xml/vpuzzlelayoutfilereader.cpp b/src/app/puzzle/xml/vplayoutfilereader.cpp similarity index 91% rename from src/app/puzzle/xml/vpuzzlelayoutfilereader.cpp rename to src/app/puzzle/xml/vplayoutfilereader.cpp index 1b7826fd2..046805035 100644 --- a/src/app/puzzle/xml/vpuzzlelayoutfilereader.cpp +++ b/src/app/puzzle/xml/vplayoutfilereader.cpp @@ -27,27 +27,27 @@ ** *************************************************************************/ #include -#include "vpuzzlelayoutfilereader.h" +#include "vplayoutfilereader.h" #include "vpuzzlelayoutfilewriter.h" #include "vplayoutliterals.h" #include "../ifc/exception/vexception.h" #include "../ifc/exception/vexceptionconversionerror.h" //--------------------------------------------------------------------------------------------------------------------- -VPuzzleLayoutFileReader::VPuzzleLayoutFileReader() +VPLayoutFileReader::VPLayoutFileReader() { } //--------------------------------------------------------------------------------------------------------------------- -VPuzzleLayoutFileReader::~VPuzzleLayoutFileReader() +VPLayoutFileReader::~VPLayoutFileReader() { // TODO } //--------------------------------------------------------------------------------------------------------------------- -bool VPuzzleLayoutFileReader::ReadFile(VPuzzleLayout *layout, QFile *file) +bool VPLayoutFileReader::ReadFile(VPuzzleLayout *layout, QFile *file) { setDevice(file); @@ -60,7 +60,7 @@ bool VPuzzleLayoutFileReader::ReadFile(VPuzzleLayout *layout, QFile *file) } //--------------------------------------------------------------------------------------------------------------------- -void VPuzzleLayoutFileReader::ReadLayout(VPuzzleLayout *layout) +void VPLayoutFileReader::ReadLayout(VPuzzleLayout *layout) { SCASSERT(isStartElement() && name() == ML::TagLayout); @@ -82,7 +82,7 @@ void VPuzzleLayoutFileReader::ReadLayout(VPuzzleLayout *layout) } //--------------------------------------------------------------------------------------------------------------------- -void VPuzzleLayoutFileReader::ReadProperties(VPuzzleLayout *layout) +void VPLayoutFileReader::ReadProperties(VPuzzleLayout *layout) { SCASSERT(isStartElement() && name() == ML::TagProperties); @@ -158,7 +158,7 @@ void VPuzzleLayoutFileReader::ReadProperties(VPuzzleLayout *layout) } //--------------------------------------------------------------------------------------------------------------------- -void VPuzzleLayoutFileReader::ReadTiles(VPuzzleLayout *layout) +void VPLayoutFileReader::ReadTiles(VPuzzleLayout *layout) { Q_UNUSED(layout); // to be removed when used @@ -193,7 +193,7 @@ void VPuzzleLayoutFileReader::ReadTiles(VPuzzleLayout *layout) } //--------------------------------------------------------------------------------------------------------------------- -void VPuzzleLayoutFileReader::ReadLayers(VPuzzleLayout *layout) +void VPLayoutFileReader::ReadLayers(VPuzzleLayout *layout) { SCASSERT(isStartElement() && name() == ML::TagLayers); @@ -217,7 +217,7 @@ void VPuzzleLayoutFileReader::ReadLayers(VPuzzleLayout *layout) } //--------------------------------------------------------------------------------------------------------------------- -void VPuzzleLayoutFileReader::ReadLayer(VPuzzleLayer *layer) +void VPLayoutFileReader::ReadLayer(VPuzzleLayer *layer) { SCASSERT(isStartElement() && (name() == ML::TagLayer || name() == ML::TagUnplacedPiecesLayer)); @@ -242,7 +242,7 @@ void VPuzzleLayoutFileReader::ReadLayer(VPuzzleLayer *layer) } //--------------------------------------------------------------------------------------------------------------------- -void VPuzzleLayoutFileReader::ReadPiece(VPuzzlePiece *piece) +void VPLayoutFileReader::ReadPiece(VPuzzlePiece *piece) { Q_UNUSED(piece); SCASSERT(isStartElement() && name() == ML::TagPiece); @@ -278,7 +278,7 @@ void VPuzzleLayoutFileReader::ReadPiece(VPuzzlePiece *piece) } //--------------------------------------------------------------------------------------------------------------------- -QMarginsF VPuzzleLayoutFileReader::ReadMargins() +QMarginsF VPLayoutFileReader::ReadMargins() { QMarginsF margins = QMarginsF(); @@ -292,7 +292,7 @@ QMarginsF VPuzzleLayoutFileReader::ReadMargins() } //--------------------------------------------------------------------------------------------------------------------- -QSizeF VPuzzleLayoutFileReader::ReadSize() +QSizeF VPLayoutFileReader::ReadSize() { QSizeF size = QSize(); @@ -304,7 +304,7 @@ QSizeF VPuzzleLayoutFileReader::ReadSize() } //--------------------------------------------------------------------------------------------------------------------- -QString VPuzzleLayoutFileReader::ReadAttributeString(const QXmlStreamAttributes &attribs, const QString &name, +QString VPLayoutFileReader::ReadAttributeString(const QXmlStreamAttributes &attribs, const QString &name, const QString &defValue) { const QString parameter = attribs.value(name).toString(); @@ -323,13 +323,13 @@ QString VPuzzleLayoutFileReader::ReadAttributeString(const QXmlStreamAttributes } //--------------------------------------------------------------------------------------------------------------------- -QString VPuzzleLayoutFileReader::ReadAttributeEmptyString(const QXmlStreamAttributes &attribs, const QString &name) +QString VPLayoutFileReader::ReadAttributeEmptyString(const QXmlStreamAttributes &attribs, const QString &name) { return attribs.value(name).toString(); } //--------------------------------------------------------------------------------------------------------------------- -bool VPuzzleLayoutFileReader::ReadAttributeBool(const QXmlStreamAttributes &attribs, const QString &name, +bool VPLayoutFileReader::ReadAttributeBool(const QXmlStreamAttributes &attribs, const QString &name, const QString &defValue) { QString parametr; @@ -366,7 +366,7 @@ bool VPuzzleLayoutFileReader::ReadAttributeBool(const QXmlStreamAttributes &attr } //--------------------------------------------------------------------------------------------------------------------- -qreal VPuzzleLayoutFileReader::ReadAttributeDouble(const QXmlStreamAttributes &attribs, const QString &name, +qreal VPLayoutFileReader::ReadAttributeDouble(const QXmlStreamAttributes &attribs, const QString &name, const QString &defValue) { bool ok = false; diff --git a/src/app/puzzle/xml/vpuzzlelayoutfilereader.h b/src/app/puzzle/xml/vplayoutfilereader.h similarity index 89% rename from src/app/puzzle/xml/vpuzzlelayoutfilereader.h rename to src/app/puzzle/xml/vplayoutfilereader.h index 7f4c00e1a..668bbec62 100644 --- a/src/app/puzzle/xml/vpuzzlelayoutfilereader.h +++ b/src/app/puzzle/xml/vplayoutfilereader.h @@ -26,8 +26,8 @@ ** ** *************************************************************************/ -#ifndef VPUZZLELAYOUTFILEREADER_H -#define VPUZZLELAYOUTFILEREADER_H +#ifndef VPLAYOUTFILEREADER_H +#define VPLAYOUTFILEREADER_H #include #include "../ifc/xml/vabstractconverter.h" @@ -35,17 +35,17 @@ #include "vpuzzlelayer.h" #include "vpuzzlepiece.h" -class VPuzzleLayoutFileReader : public QXmlStreamReader +class VPLayoutFileReader : public QXmlStreamReader { Q_DECLARE_TR_FUNCTIONS(VPuzzleLayoutFileReader) public: - VPuzzleLayoutFileReader(); - ~VPuzzleLayoutFileReader(); + VPLayoutFileReader(); + ~VPLayoutFileReader(); bool ReadFile(VPuzzleLayout *layout, QFile *file); private: - Q_DISABLE_COPY(VPuzzleLayoutFileReader) + Q_DISABLE_COPY(VPLayoutFileReader) void ReadLayout(VPuzzleLayout *layout); void ReadProperties(VPuzzleLayout *layout); @@ -65,4 +65,4 @@ private: const QString &defValue); }; -#endif // VPUZZLELAYOUTFILEREADER_H +#endif // VPLAYOUTFILEREADER_H