Refactoring VPuzzleLayout

This commit is contained in:
Ronan Le Tiec 2020-05-23 15:34:11 +02:00
parent 34b67cc6e3
commit 5e785bfa79
18 changed files with 97 additions and 97 deletions

View File

@ -13,9 +13,9 @@ SOURCES += \
$$PWD/vpcommands.cpp \ $$PWD/vpcommands.cpp \
$$PWD/vpgraphicspiece.cpp \ $$PWD/vpgraphicspiece.cpp \
$$PWD/vpgraphicssheet.cpp \ $$PWD/vpgraphicssheet.cpp \
$$PWD/vplayout.cpp \
$$PWD/vpmainwindow.cpp \ $$PWD/vpmainwindow.cpp \
$$PWD/vppiecelist.cpp \ $$PWD/vppiecelist.cpp \
$$PWD/vpuzzlelayout.cpp \
$$PWD/vpuzzlemaingraphicsview.cpp \ $$PWD/vpuzzlemaingraphicsview.cpp \
$$PWD/vpuzzlemimedatapiece.cpp \ $$PWD/vpuzzlemimedatapiece.cpp \
$$PWD/vpuzzlepiece.cpp \ $$PWD/vpuzzlepiece.cpp \
@ -37,10 +37,10 @@ HEADERS += \
$$PWD/vpcommands.h \ $$PWD/vpcommands.h \
$$PWD/vpgraphicspiece.h \ $$PWD/vpgraphicspiece.h \
$$PWD/vpgraphicssheet.h \ $$PWD/vpgraphicssheet.h \
$$PWD/vplayout.h \
$$PWD/vpmainwindow.h \ $$PWD/vpmainwindow.h \
$$PWD/vppiecelist.h \ $$PWD/vppiecelist.h \
$$PWD/vpstable.h \ $$PWD/vpstable.h \
$$PWD/vpuzzlelayout.h \
$$PWD/vpuzzlemaingraphicsview.h \ $$PWD/vpuzzlemaingraphicsview.h \
$$PWD/vpuzzlemimedatapiece.h \ $$PWD/vpuzzlemimedatapiece.h \
$$PWD/vpuzzlepiece.h \ $$PWD/vpuzzlepiece.h \

View File

@ -41,7 +41,7 @@
Q_LOGGING_CATEGORY(pCarrousel, "p.carrousel") Q_LOGGING_CATEGORY(pCarrousel, "p.carrousel")
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VPCarrousel::VPCarrousel(VPuzzleLayout *layout, QWidget *parent) : VPCarrousel::VPCarrousel(VPLayout *layout, QWidget *parent) :
QWidget(parent), QWidget(parent),
ui(new Ui::VPCarrousel), ui(new Ui::VPCarrousel),
m_layout(layout) m_layout(layout)

View File

@ -32,7 +32,7 @@
#include <QWidget> #include <QWidget>
#include <QComboBox> #include <QComboBox>
#include <QScrollArea> #include <QScrollArea>
#include "vpuzzlelayout.h" #include "vplayout.h"
#include "vpuzzlepiece.h" #include "vpuzzlepiece.h"
namespace Ui namespace Ui
@ -44,7 +44,7 @@ class VPCarrousel : public QWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit VPCarrousel(VPuzzleLayout *layout, QWidget *parent = nullptr); explicit VPCarrousel(VPLayout *layout, QWidget *parent = nullptr);
virtual ~VPCarrousel() = default; virtual ~VPCarrousel() = default;
/** /**
@ -79,7 +79,7 @@ private:
Q_DISABLE_COPY(VPCarrousel) Q_DISABLE_COPY(VPCarrousel)
Ui::VPCarrousel *ui; Ui::VPCarrousel *ui;
VPuzzleLayout *m_layout; VPLayout *m_layout;
QList<VPPieceList*> m_pieceLists{}; QList<VPPieceList*> m_pieceLists{};
Qt::Orientation m_orientation{Qt::Vertical}; Qt::Orientation m_orientation{Qt::Vertical};

View File

@ -41,7 +41,7 @@
#include "vpuzzlepiece.h" #include "vpuzzlepiece.h"
#include "vppiecelist.h" #include "vppiecelist.h"
#include "vpuzzlelayout.h" #include "vplayout.h"
#include <QLoggingCategory> #include <QLoggingCategory>
Q_LOGGING_CATEGORY(pGraphicsPiece, "p.graphicsPiece") Q_LOGGING_CATEGORY(pGraphicsPiece, "p.graphicsPiece")

View File

@ -29,7 +29,7 @@
#include "vpgraphicssheet.h" #include "vpgraphicssheet.h"
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VPGraphicsSheet::VPGraphicsSheet(VPuzzleLayout *layout, QGraphicsItem *parent): VPGraphicsSheet::VPGraphicsSheet(VPLayout *layout, QGraphicsItem *parent):
QGraphicsItem(parent), QGraphicsItem(parent),
m_layout(layout), m_layout(layout),
m_boundingRect(GetLayoutRect()) m_boundingRect(GetLayoutRect())

View File

@ -32,12 +32,12 @@
#include <QGraphicsItem> #include <QGraphicsItem>
#include <QPainter> #include <QPainter>
#include "vpuzzlelayout.h" #include "vplayout.h"
class VPGraphicsSheet : public QGraphicsItem class VPGraphicsSheet : public QGraphicsItem
{ {
public: public:
explicit VPGraphicsSheet(VPuzzleLayout *layout, QGraphicsItem *parent = nullptr); explicit VPGraphicsSheet(VPLayout *layout, QGraphicsItem *parent = nullptr);
~VPGraphicsSheet(); ~VPGraphicsSheet();
QRectF boundingRect() const override; QRectF boundingRect() const override;
@ -51,7 +51,7 @@ public:
private: private:
Q_DISABLE_COPY(VPGraphicsSheet) Q_DISABLE_COPY(VPGraphicsSheet)
VPuzzleLayout *m_layout{nullptr}; VPLayout *m_layout{nullptr};
QRectF m_boundingRect; QRectF m_boundingRect;
}; };

View File

@ -1,6 +1,6 @@
/************************************************************************ /************************************************************************
** **
** @file vpuzzlelayout.cpp ** @file vplayout.cpp
** @author Ronan Le Tiec ** @author Ronan Le Tiec
** @date 13 4, 2020 ** @date 13 4, 2020
** **
@ -25,12 +25,12 @@
** along with Valentina. If not, see <http://www.gnu.org/licenses/>. ** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
** **
*************************************************************************/ *************************************************************************/
#include "vpuzzlelayout.h" #include "vplayout.h"
#include "vppiecelist.h" #include "vppiecelist.h"
#include "vpuzzlepiece.h" #include "vpuzzlepiece.h"
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VPuzzleLayout::VPuzzleLayout() : VPLayout::VPLayout() :
m_unplacedPieceList(new VPPieceList(this)) m_unplacedPieceList(new VPPieceList(this))
{ {
m_unplacedPieceList->SetName(QObject::tr("Unplaced pieces")); m_unplacedPieceList->SetName(QObject::tr("Unplaced pieces"));
@ -45,20 +45,20 @@ VPuzzleLayout::VPuzzleLayout() :
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VPuzzleLayout::~VPuzzleLayout() VPLayout::~VPLayout()
{ {
qDeleteAll(m_pieceLists); qDeleteAll(m_pieceLists);
delete m_unplacedPieceList; delete m_unplacedPieceList;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VPPieceList* VPuzzleLayout::GetUnplacedPieceList() VPPieceList* VPLayout::GetUnplacedPieceList()
{ {
return m_unplacedPieceList; return m_unplacedPieceList;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VPPieceList* VPuzzleLayout::AddPieceList() VPPieceList* VPLayout::AddPieceList()
{ {
VPPieceList *newPieceList = new VPPieceList(this); VPPieceList *newPieceList = new VPPieceList(this);
m_pieceLists.append(newPieceList); m_pieceLists.append(newPieceList);
@ -66,20 +66,20 @@ VPPieceList* VPuzzleLayout::AddPieceList()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VPPieceList* VPuzzleLayout::AddPieceList(VPPieceList *pieceList) VPPieceList* VPLayout::AddPieceList(VPPieceList *pieceList)
{ {
m_pieceLists.append(pieceList); m_pieceLists.append(pieceList);
return pieceList; return pieceList;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QList<VPPieceList *> VPuzzleLayout::GetPiecesLists() QList<VPPieceList *> VPLayout::GetPiecesLists()
{ {
return m_pieceLists; return m_pieceLists;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QList<VPuzzlePiece *> VPuzzleLayout::GetSelectedPieces() QList<VPuzzlePiece *> VPLayout::GetSelectedPieces()
{ {
QList<VPuzzlePiece *> result = QList<VPuzzlePiece *>(); QList<VPuzzlePiece *> result = QList<VPuzzlePiece *>();
@ -102,39 +102,39 @@ QList<VPuzzlePiece *> VPuzzleLayout::GetSelectedPieces()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPuzzleLayout::SetUnit(Unit unit) void VPLayout::SetUnit(Unit unit)
{ {
m_unit = unit; m_unit = unit;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
Unit VPuzzleLayout::GetUnit() const Unit VPLayout::GetUnit() const
{ {
return m_unit; return m_unit;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPuzzleLayout::SetLayoutSize(qreal width, qreal height) void VPLayout::SetLayoutSize(qreal width, qreal height)
{ {
m_size.setWidth(width); m_size.setWidth(width);
m_size.setHeight(height); m_size.setHeight(height);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPuzzleLayout::SetLayoutSizeConverted(qreal width, qreal height) void VPLayout::SetLayoutSizeConverted(qreal width, qreal height)
{ {
m_size.setWidth(UnitConvertor(width, m_unit, Unit::Px)); m_size.setWidth(UnitConvertor(width, m_unit, Unit::Px));
m_size.setHeight(UnitConvertor(height, m_unit, Unit::Px)); m_size.setHeight(UnitConvertor(height, m_unit, Unit::Px));
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPuzzleLayout::SetLayoutSize(const QSizeF &size) void VPLayout::SetLayoutSize(const QSizeF &size)
{ {
m_size = size; m_size = size;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPuzzleLayout::SetLayoutSizeConverted(const QSizeF &size) void VPLayout::SetLayoutSizeConverted(const QSizeF &size)
{ {
m_size = QSizeF( m_size = QSizeF(
UnitConvertor(size.width(), m_unit, Unit::Px), UnitConvertor(size.width(), m_unit, Unit::Px),
@ -143,13 +143,13 @@ void VPuzzleLayout::SetLayoutSizeConverted(const QSizeF &size)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QSizeF VPuzzleLayout::GetLayoutSize() const QSizeF VPLayout::GetLayoutSize() const
{ {
return m_size; return m_size;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QSizeF VPuzzleLayout::GetLayoutSizeConverted() const QSizeF VPLayout::GetLayoutSizeConverted() const
{ {
QSizeF convertedSize = QSizeF( QSizeF convertedSize = QSizeF(
UnitConvertor(m_size.width(), Unit::Px, m_unit), UnitConvertor(m_size.width(), Unit::Px, m_unit),
@ -160,7 +160,7 @@ QSizeF VPuzzleLayout::GetLayoutSizeConverted() const
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPuzzleLayout::SetLayoutMargins(qreal left, qreal top, qreal right, qreal bottom) void VPLayout::SetLayoutMargins(qreal left, qreal top, qreal right, qreal bottom)
{ {
m_margins.setLeft(left); m_margins.setLeft(left);
m_margins.setTop(top); m_margins.setTop(top);
@ -168,7 +168,7 @@ void VPuzzleLayout::SetLayoutMargins(qreal left, qreal top, qreal right, qreal b
m_margins.setBottom(bottom); m_margins.setBottom(bottom);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPuzzleLayout::SetLayoutMarginsConverted(qreal left, qreal top, qreal right, qreal bottom) void VPLayout::SetLayoutMarginsConverted(qreal left, qreal top, qreal right, qreal bottom)
{ {
m_margins.setLeft(UnitConvertor(left, m_unit, Unit::Px)); m_margins.setLeft(UnitConvertor(left, m_unit, Unit::Px));
m_margins.setTop(UnitConvertor(top, m_unit, Unit::Px)); m_margins.setTop(UnitConvertor(top, m_unit, Unit::Px));
@ -177,103 +177,103 @@ void VPuzzleLayout::SetLayoutMarginsConverted(qreal left, qreal top, qreal right
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPuzzleLayout::SetLayoutMargins(const QMarginsF &margins) void VPLayout::SetLayoutMargins(const QMarginsF &margins)
{ {
m_margins = margins; m_margins = margins;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPuzzleLayout::SetLayoutMarginsConverted(const QMarginsF &margins) void VPLayout::SetLayoutMarginsConverted(const QMarginsF &margins)
{ {
m_margins = UnitConvertor(margins, m_unit, Unit::Px); m_margins = UnitConvertor(margins, m_unit, Unit::Px);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QMarginsF VPuzzleLayout::GetLayoutMargins() const QMarginsF VPLayout::GetLayoutMargins() const
{ {
return m_margins; return m_margins;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QMarginsF VPuzzleLayout::GetLayoutMarginsConverted() const QMarginsF VPLayout::GetLayoutMarginsConverted() const
{ {
return UnitConvertor(m_margins, Unit::Px, m_unit); return UnitConvertor(m_margins, Unit::Px, m_unit);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPuzzleLayout::SetFollowGrainline(FollowGrainline state) void VPLayout::SetFollowGrainline(FollowGrainline state)
{ {
m_followGrainLine = state; m_followGrainLine = state;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
FollowGrainline VPuzzleLayout::GetFollowGrainline() const FollowGrainline VPLayout::GetFollowGrainline() const
{ {
return m_followGrainLine; return m_followGrainLine;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPuzzleLayout::SetPiecesGap(qreal value) void VPLayout::SetPiecesGap(qreal value)
{ {
m_piecesGap = value; m_piecesGap = value;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPuzzleLayout::SetPiecesGapConverted(qreal value) void VPLayout::SetPiecesGapConverted(qreal value)
{ {
m_piecesGap = UnitConvertor(value, m_unit, Unit::Px); m_piecesGap = UnitConvertor(value, m_unit, Unit::Px);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
qreal VPuzzleLayout::GetPiecesGap() const qreal VPLayout::GetPiecesGap() const
{ {
return m_piecesGap; return m_piecesGap;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
qreal VPuzzleLayout::GetPiecesGapConverted() const qreal VPLayout::GetPiecesGapConverted() const
{ {
return UnitConvertor(m_piecesGap, Unit::Px, m_unit); return UnitConvertor(m_piecesGap, Unit::Px, m_unit);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPuzzleLayout::SetWarningSuperpositionOfPieces(bool state) void VPLayout::SetWarningSuperpositionOfPieces(bool state)
{ {
m_warningSuperpositionOfPieces = state; m_warningSuperpositionOfPieces = state;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
bool VPuzzleLayout::GetWarningSuperpositionOfPieces() const bool VPLayout::GetWarningSuperpositionOfPieces() const
{ {
return m_warningSuperpositionOfPieces; return m_warningSuperpositionOfPieces;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPuzzleLayout::SetWarningPiecesOutOfBound(bool state) void VPLayout::SetWarningPiecesOutOfBound(bool state)
{ {
m_warningPiecesOutOfBound = state; m_warningPiecesOutOfBound = state;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
bool VPuzzleLayout::GetWarningPiecesOutOfBound() const bool VPLayout::GetWarningPiecesOutOfBound() const
{ {
return m_warningPiecesOutOfBound; return m_warningPiecesOutOfBound;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPuzzleLayout::SetStickyEdges(bool state) void VPLayout::SetStickyEdges(bool state)
{ {
m_stickyEdges = state; m_stickyEdges = state;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
bool VPuzzleLayout::GetStickyEdges() const bool VPLayout::GetStickyEdges() const
{ {
return m_stickyEdges; return m_stickyEdges;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPuzzleLayout::ClearSelection() void VPLayout::ClearSelection()
{ {
m_unplacedPieceList->ClearSelection(); m_unplacedPieceList->ClearSelection();
@ -284,7 +284,7 @@ void VPuzzleLayout::ClearSelection()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPuzzleLayout::SetFocusedPieceList(VPPieceList* focusedPieceList) void VPLayout::SetFocusedPieceList(VPPieceList* focusedPieceList)
{ {
if(focusedPieceList == nullptr) if(focusedPieceList == nullptr)
{ {
@ -297,13 +297,13 @@ void VPuzzleLayout::SetFocusedPieceList(VPPieceList* focusedPieceList)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VPPieceList* VPuzzleLayout::GetFocusedPieceList() VPPieceList* VPLayout::GetFocusedPieceList()
{ {
return m_focusedPieceList; return m_focusedPieceList;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPuzzleLayout::MovePieceToPieceList(VPuzzlePiece* piece, VPPieceList* pieceList) void VPLayout::MovePieceToPieceList(VPuzzlePiece* piece, VPPieceList* pieceList)
{ {
VPPieceList* pieceListBefore = piece->GetPieceList(); VPPieceList* pieceListBefore = piece->GetPieceList();

View File

@ -1,6 +1,6 @@
/************************************************************************ /************************************************************************
** **
** @file vpuzzlelayout.h ** @file vplayout.h
** @author Ronan Le Tiec ** @author Ronan Le Tiec
** @date 13 4, 2020 ** @date 13 4, 2020
** **
@ -25,8 +25,8 @@
** along with Valentina. If not, see <http://www.gnu.org/licenses/>. ** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
** **
*************************************************************************/ *************************************************************************/
#ifndef VPUZZLELAYOUT_H #ifndef VPLAYOUT_H
#define VPUZZLELAYOUT_H #define VPLAYOUT_H
#include <QSizeF> #include <QSizeF>
#include <QMarginsF> #include <QMarginsF>
@ -40,12 +40,12 @@ class VPuzzlePiece;
// is this the right place for the definition? // is this the right place for the definition?
enum class FollowGrainline : qint8 { No = 0, Follow90 = 1, Follow180 = 2}; enum class FollowGrainline : qint8 { No = 0, Follow90 = 1, Follow180 = 2};
class VPuzzleLayout : public QObject class VPLayout : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
VPuzzleLayout(); VPLayout();
virtual ~VPuzzleLayout(); virtual ~VPLayout();
/** /**
* @brief GetUnplacedPieceList Returns the piece list of unplaced pieces * @brief GetUnplacedPieceList Returns the piece list of unplaced pieces
@ -231,7 +231,7 @@ signals:
void PieceMovedToPieceList(VPuzzlePiece *piece, VPPieceList *pieceListBefore, VPPieceList *pieceListAfter); void PieceMovedToPieceList(VPuzzlePiece *piece, VPPieceList *pieceListBefore, VPPieceList *pieceListAfter);
private: private:
Q_DISABLE_COPY(VPuzzleLayout) Q_DISABLE_COPY(VPLayout)
VPPieceList *m_unplacedPieceList; VPPieceList *m_unplacedPieceList;
QList<VPPieceList *> m_pieceLists{}; QList<VPPieceList *> m_pieceLists{};
@ -268,4 +268,4 @@ private:
}; };
#endif // VPUZZLELAYOUT_H #endif // VPLAYOUT_H

View File

@ -58,7 +58,7 @@ VPMainWindow::VPMainWindow(const VPCommandLinePtr &cmd, QWidget *parent) :
m_cmd(cmd) m_cmd(cmd)
{ {
m_layout = new VPuzzleLayout(); m_layout = new VPLayout();
// ----- for test purposes, to be removed------------------ // ----- for test purposes, to be removed------------------
m_layout->SetLayoutMarginsConverted(2, 2, 2, 2); m_layout->SetLayoutMarginsConverted(2, 2, 2, 2);
@ -110,7 +110,7 @@ bool VPMainWindow::LoadFile(QString path)
if(m_layout == nullptr) if(m_layout == nullptr)
{ {
m_layout = new VPuzzleLayout(); m_layout = new VPLayout();
} }
fileReader->ReadFile(m_layout, &file); fileReader->ReadFile(m_layout, &file);

View File

@ -35,7 +35,7 @@
#include "../vmisc/def.h" #include "../vmisc/def.h"
#include "vpcarrousel.h" #include "vpcarrousel.h"
#include "vpuzzlemaingraphicsview.h" #include "vpuzzlemaingraphicsview.h"
#include "vpuzzlelayout.h" #include "vplayout.h"
#include "vpuzzlepiece.h" #include "vpuzzlepiece.h"
#include "../vlayout/vlayoutpiece.h" #include "../vlayout/vlayoutpiece.h"
#include "vpcommandline.h" #include "vpcommandline.h"
@ -95,7 +95,7 @@ private:
VPCommandLinePtr m_cmd; VPCommandLinePtr m_cmd;
VPuzzleLayout *m_layout{nullptr}; VPLayout *m_layout{nullptr};
QList<VPuzzlePiece *>m_selectedPieces{QList<VPuzzlePiece *>()}; QList<VPuzzlePiece *>m_selectedPieces{QList<VPuzzlePiece *>()};
/** /**

View File

@ -27,14 +27,14 @@
*************************************************************************/ *************************************************************************/
#include "vppiecelist.h" #include "vppiecelist.h"
#include "vpuzzlelayout.h" #include "vplayout.h"
#include <QLoggingCategory> #include <QLoggingCategory>
Q_LOGGING_CATEGORY(pPieceList, "p.pieceList") Q_LOGGING_CATEGORY(pPieceList, "p.pieceList")
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VPPieceList::VPPieceList(VPuzzleLayout *layout): VPPieceList::VPPieceList(VPLayout *layout):
m_layout(layout) m_layout(layout)
{ {
@ -47,7 +47,7 @@ VPPieceList::~VPPieceList()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VPuzzleLayout* VPPieceList::GetLayout() VPLayout* VPPieceList::GetLayout()
{ {
return m_layout; return m_layout;
} }

View File

@ -31,13 +31,13 @@
#include <QList> #include <QList>
#include "vpuzzlepiece.h" #include "vpuzzlepiece.h"
class VPuzzleLayout; class VPLayout;
class VPPieceList : public QObject class VPPieceList : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
VPPieceList(VPuzzleLayout *layout); VPPieceList(VPLayout *layout);
~VPPieceList(); ~VPPieceList();
QList<VPuzzlePiece *> GetPieces(); QList<VPuzzlePiece *> GetPieces();
@ -57,7 +57,7 @@ public:
* @brief GetLayout Returns the layout in which this piece list is * @brief GetLayout Returns the layout in which this piece list is
* @return the layout of this piece list * @return the layout of this piece list
*/ */
VPuzzleLayout* GetLayout(); VPLayout* GetLayout();
/** /**
* @brief ClearSelection Clears the selection of the pieces in this piece list * @brief ClearSelection Clears the selection of the pieces in this piece list
@ -81,7 +81,7 @@ private:
QString m_name{}; QString m_name{};
QList<VPuzzlePiece *> m_pieces{}; QList<VPuzzlePiece *> m_pieces{};
VPuzzleLayout *m_layout{nullptr}; VPLayout *m_layout{nullptr};
// control // control
bool m_isVisible{true}; bool m_isVisible{true};

View File

@ -42,7 +42,7 @@ Q_LOGGING_CATEGORY(pMainGraphicsView, "p.mainGraphicsView")
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VPuzzleMainGraphicsView::VPuzzleMainGraphicsView(VPuzzleLayout *layout, QWidget *parent) : VPuzzleMainGraphicsView::VPuzzleMainGraphicsView(VPLayout *layout, QWidget *parent) :
VMainGraphicsView(parent), VMainGraphicsView(parent),
m_layout(layout) m_layout(layout)
{ {
@ -56,7 +56,7 @@ VPuzzleMainGraphicsView::VPuzzleMainGraphicsView(VPuzzleLayout *layout, QWidget
setAcceptDrops(true); setAcceptDrops(true);
// add the connections // add the connections
connect(m_layout, &VPuzzleLayout::PieceMovedToPieceList, this, &VPuzzleMainGraphicsView::on_PieceMovedToPieceList); connect(m_layout, &VPLayout::PieceMovedToPieceList, this, &VPuzzleMainGraphicsView::on_PieceMovedToPieceList);
connect(m_scene, &VMainGraphicsScene::selectionChanged, this, connect(m_scene, &VMainGraphicsScene::selectionChanged, this,
&VPuzzleMainGraphicsView::on_SceneSelectionChanged); &VPuzzleMainGraphicsView::on_SceneSelectionChanged);
} }

View File

@ -40,7 +40,7 @@ class VPuzzleMainGraphicsView : public VMainGraphicsView
{ {
Q_OBJECT Q_OBJECT
public: public:
VPuzzleMainGraphicsView(VPuzzleLayout *layout, QWidget *parent); VPuzzleMainGraphicsView(VPLayout *layout, QWidget *parent);
~VPuzzleMainGraphicsView() = default; ~VPuzzleMainGraphicsView() = default;
/** /**
@ -77,7 +77,7 @@ private:
VMainGraphicsScene *m_scene{nullptr}; VMainGraphicsScene *m_scene{nullptr};
VPGraphicsSheet *m_graphicsSheet{nullptr}; VPGraphicsSheet *m_graphicsSheet{nullptr};
VPuzzleLayout *m_layout{nullptr}; VPLayout *m_layout{nullptr};
QList<VPGraphicsPiece*> m_graphicsPieces{}; QList<VPGraphicsPiece*> m_graphicsPieces{};

View File

@ -47,7 +47,7 @@ VPLayoutFileReader::~VPLayoutFileReader()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
bool VPLayoutFileReader::ReadFile(VPuzzleLayout *layout, QFile *file) bool VPLayoutFileReader::ReadFile(VPLayout *layout, QFile *file)
{ {
setDevice(file); setDevice(file);
@ -60,7 +60,7 @@ bool VPLayoutFileReader::ReadFile(VPuzzleLayout *layout, QFile *file)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPLayoutFileReader::ReadLayout(VPuzzleLayout *layout) void VPLayoutFileReader::ReadLayout(VPLayout *layout)
{ {
SCASSERT(isStartElement() && name() == ML::TagLayout); SCASSERT(isStartElement() && name() == ML::TagLayout);
@ -82,7 +82,7 @@ void VPLayoutFileReader::ReadLayout(VPuzzleLayout *layout)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPLayoutFileReader::ReadProperties(VPuzzleLayout *layout) void VPLayoutFileReader::ReadProperties(VPLayout *layout)
{ {
SCASSERT(isStartElement() && name() == ML::TagProperties); SCASSERT(isStartElement() && name() == ML::TagProperties);
@ -158,7 +158,7 @@ void VPLayoutFileReader::ReadProperties(VPuzzleLayout *layout)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPLayoutFileReader::ReadTiles(VPuzzleLayout *layout) void VPLayoutFileReader::ReadTiles(VPLayout *layout)
{ {
Q_UNUSED(layout); // to be removed when used Q_UNUSED(layout); // to be removed when used
@ -193,7 +193,7 @@ void VPLayoutFileReader::ReadTiles(VPuzzleLayout *layout)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPLayoutFileReader::ReadPieceLists(VPuzzleLayout *layout) void VPLayoutFileReader::ReadPieceLists(VPLayout *layout)
{ {
SCASSERT(isStartElement() && name() == ML::TagPieceLists); SCASSERT(isStartElement() && name() == ML::TagPieceLists);

View File

@ -31,26 +31,26 @@
#include <QXmlStreamReader> #include <QXmlStreamReader>
#include "../ifc/xml/vabstractconverter.h" #include "../ifc/xml/vabstractconverter.h"
#include "vpuzzlelayout.h" #include "vplayout.h"
#include "vppiecelist.h" #include "vppiecelist.h"
#include "vpuzzlepiece.h" #include "vpuzzlepiece.h"
class VPLayoutFileReader : public QXmlStreamReader class VPLayoutFileReader : public QXmlStreamReader
{ {
Q_DECLARE_TR_FUNCTIONS(VPuzzleLayoutFileReader) Q_DECLARE_TR_FUNCTIONS(VPLayoutFileReader)
public: public:
VPLayoutFileReader(); VPLayoutFileReader();
~VPLayoutFileReader(); ~VPLayoutFileReader();
bool ReadFile(VPuzzleLayout *layout, QFile *file); bool ReadFile(VPLayout *layout, QFile *file);
private: private:
Q_DISABLE_COPY(VPLayoutFileReader) Q_DISABLE_COPY(VPLayoutFileReader)
void ReadLayout(VPuzzleLayout *layout); void ReadLayout(VPLayout *layout);
void ReadProperties(VPuzzleLayout *layout); void ReadProperties(VPLayout *layout);
void ReadTiles(VPuzzleLayout *layout); void ReadTiles(VPLayout *layout);
void ReadPieceLists(VPuzzleLayout *layout); void ReadPieceLists(VPLayout *layout);
void ReadPieceList(VPPieceList *pieceList); void ReadPieceList(VPPieceList *pieceList);
void ReadPiece(VPuzzlePiece *piece); void ReadPiece(VPuzzlePiece *piece);

View File

@ -27,7 +27,7 @@
*************************************************************************/ *************************************************************************/
#include "vplayoutfilewriter.h" #include "vplayoutfilewriter.h"
#include "vpuzzlelayout.h" #include "vplayout.h"
#include "vppiecelist.h" #include "vppiecelist.h"
#include "vpuzzlepiece.h" #include "vpuzzlepiece.h"
#include "vplayoutliterals.h" #include "vplayoutliterals.h"
@ -46,7 +46,7 @@ VPLayoutFileWriter::~VPLayoutFileWriter()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPLayoutFileWriter::WriteFile(VPuzzleLayout *layout, QFile *file) void VPLayoutFileWriter::WriteFile(VPLayout *layout, QFile *file)
{ {
setDevice(file); setDevice(file);
setAutoFormatting(true); setAutoFormatting(true);
@ -59,7 +59,7 @@ void VPLayoutFileWriter::WriteFile(VPuzzleLayout *layout, QFile *file)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPLayoutFileWriter::WriteLayout(VPuzzleLayout *layout) void VPLayoutFileWriter::WriteLayout(VPLayout *layout)
{ {
writeStartElement(ML::TagLayout); writeStartElement(ML::TagLayout);
SetAttribute(ML::AttrVersion, VLayoutConverter::LayoutMaxVerStr); SetAttribute(ML::AttrVersion, VLayoutConverter::LayoutMaxVerStr);
@ -71,7 +71,7 @@ void VPLayoutFileWriter::WriteLayout(VPuzzleLayout *layout)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPLayoutFileWriter::WriteProperties(VPuzzleLayout *layout) void VPLayoutFileWriter::WriteProperties(VPLayout *layout)
{ {
writeStartElement(ML::TagProperties); writeStartElement(ML::TagProperties);
@ -97,7 +97,7 @@ void VPLayoutFileWriter::WriteProperties(VPuzzleLayout *layout)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPLayoutFileWriter::WriteTiles(VPuzzleLayout *layout) void VPLayoutFileWriter::WriteTiles(VPLayout *layout)
{ {
Q_UNUSED(layout); // to be removed Q_UNUSED(layout); // to be removed
@ -116,7 +116,7 @@ void VPLayoutFileWriter::WriteTiles(VPuzzleLayout *layout)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPLayoutFileWriter::WritePieceLists(VPuzzleLayout *layout) void VPLayoutFileWriter::WritePieceLists(VPLayout *layout)
{ {
writeStartElement(ML::TagPieceLists); writeStartElement(ML::TagPieceLists);

View File

@ -34,7 +34,7 @@
#include "../vmisc/literals.h" #include "../vmisc/literals.h"
class VPuzzleLayout; class VPLayout;
class VPPieceList; class VPPieceList;
class VPuzzlePiece; class VPuzzlePiece;
class QFile; class QFile;
@ -46,14 +46,14 @@ public:
VPLayoutFileWriter(); VPLayoutFileWriter();
~VPLayoutFileWriter(); ~VPLayoutFileWriter();
void WriteFile(VPuzzleLayout *layout, QFile *file); void WriteFile(VPLayout *layout, QFile *file);
private: private:
void WriteLayout(VPuzzleLayout *layout); void WriteLayout(VPLayout *layout);
void WriteProperties(VPuzzleLayout *layout); void WriteProperties(VPLayout *layout);
void WriteTiles(VPuzzleLayout *layout); void WriteTiles(VPLayout *layout);
void WritePieceLists(VPuzzleLayout *layout); void WritePieceLists(VPLayout *layout);
void WritePieceList(VPPieceList *pieceList); void WritePieceList(VPPieceList *pieceList);
void WritePieceList(VPPieceList *pieceList, const QString &tagName); void WritePieceList(VPPieceList *pieceList, const QString &tagName);
void WritePiece(VPuzzlePiece *piece); void WritePiece(VPuzzlePiece *piece);