Refactoring VPuzzleLayout
This commit is contained in:
parent
34b67cc6e3
commit
5e785bfa79
|
@ -13,9 +13,9 @@ SOURCES += \
|
|||
$$PWD/vpcommands.cpp \
|
||||
$$PWD/vpgraphicspiece.cpp \
|
||||
$$PWD/vpgraphicssheet.cpp \
|
||||
$$PWD/vplayout.cpp \
|
||||
$$PWD/vpmainwindow.cpp \
|
||||
$$PWD/vppiecelist.cpp \
|
||||
$$PWD/vpuzzlelayout.cpp \
|
||||
$$PWD/vpuzzlemaingraphicsview.cpp \
|
||||
$$PWD/vpuzzlemimedatapiece.cpp \
|
||||
$$PWD/vpuzzlepiece.cpp \
|
||||
|
@ -37,10 +37,10 @@ HEADERS += \
|
|||
$$PWD/vpcommands.h \
|
||||
$$PWD/vpgraphicspiece.h \
|
||||
$$PWD/vpgraphicssheet.h \
|
||||
$$PWD/vplayout.h \
|
||||
$$PWD/vpmainwindow.h \
|
||||
$$PWD/vppiecelist.h \
|
||||
$$PWD/vpstable.h \
|
||||
$$PWD/vpuzzlelayout.h \
|
||||
$$PWD/vpuzzlemaingraphicsview.h \
|
||||
$$PWD/vpuzzlemimedatapiece.h \
|
||||
$$PWD/vpuzzlepiece.h \
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
Q_LOGGING_CATEGORY(pCarrousel, "p.carrousel")
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VPCarrousel::VPCarrousel(VPuzzleLayout *layout, QWidget *parent) :
|
||||
VPCarrousel::VPCarrousel(VPLayout *layout, QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::VPCarrousel),
|
||||
m_layout(layout)
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#include <QWidget>
|
||||
#include <QComboBox>
|
||||
#include <QScrollArea>
|
||||
#include "vpuzzlelayout.h"
|
||||
#include "vplayout.h"
|
||||
#include "vpuzzlepiece.h"
|
||||
|
||||
namespace Ui
|
||||
|
@ -44,7 +44,7 @@ class VPCarrousel : public QWidget
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit VPCarrousel(VPuzzleLayout *layout, QWidget *parent = nullptr);
|
||||
explicit VPCarrousel(VPLayout *layout, QWidget *parent = nullptr);
|
||||
virtual ~VPCarrousel() = default;
|
||||
|
||||
/**
|
||||
|
@ -79,7 +79,7 @@ private:
|
|||
Q_DISABLE_COPY(VPCarrousel)
|
||||
Ui::VPCarrousel *ui;
|
||||
|
||||
VPuzzleLayout *m_layout;
|
||||
VPLayout *m_layout;
|
||||
QList<VPPieceList*> m_pieceLists{};
|
||||
|
||||
Qt::Orientation m_orientation{Qt::Vertical};
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
|
||||
#include "vpuzzlepiece.h"
|
||||
#include "vppiecelist.h"
|
||||
#include "vpuzzlelayout.h"
|
||||
#include "vplayout.h"
|
||||
|
||||
#include <QLoggingCategory>
|
||||
Q_LOGGING_CATEGORY(pGraphicsPiece, "p.graphicsPiece")
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include "vpgraphicssheet.h"
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VPGraphicsSheet::VPGraphicsSheet(VPuzzleLayout *layout, QGraphicsItem *parent):
|
||||
VPGraphicsSheet::VPGraphicsSheet(VPLayout *layout, QGraphicsItem *parent):
|
||||
QGraphicsItem(parent),
|
||||
m_layout(layout),
|
||||
m_boundingRect(GetLayoutRect())
|
||||
|
|
|
@ -32,12 +32,12 @@
|
|||
#include <QGraphicsItem>
|
||||
#include <QPainter>
|
||||
|
||||
#include "vpuzzlelayout.h"
|
||||
#include "vplayout.h"
|
||||
|
||||
class VPGraphicsSheet : public QGraphicsItem
|
||||
{
|
||||
public:
|
||||
explicit VPGraphicsSheet(VPuzzleLayout *layout, QGraphicsItem *parent = nullptr);
|
||||
explicit VPGraphicsSheet(VPLayout *layout, QGraphicsItem *parent = nullptr);
|
||||
~VPGraphicsSheet();
|
||||
|
||||
QRectF boundingRect() const override;
|
||||
|
@ -51,7 +51,7 @@ public:
|
|||
private:
|
||||
Q_DISABLE_COPY(VPGraphicsSheet)
|
||||
|
||||
VPuzzleLayout *m_layout{nullptr};
|
||||
VPLayout *m_layout{nullptr};
|
||||
QRectF m_boundingRect;
|
||||
};
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file vpuzzlelayout.cpp
|
||||
** @file vplayout.cpp
|
||||
** @author Ronan Le Tiec
|
||||
** @date 13 4, 2020
|
||||
**
|
||||
|
@ -25,12 +25,12 @@
|
|||
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
||||
**
|
||||
*************************************************************************/
|
||||
#include "vpuzzlelayout.h"
|
||||
#include "vplayout.h"
|
||||
#include "vppiecelist.h"
|
||||
#include "vpuzzlepiece.h"
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VPuzzleLayout::VPuzzleLayout() :
|
||||
VPLayout::VPLayout() :
|
||||
m_unplacedPieceList(new VPPieceList(this))
|
||||
{
|
||||
m_unplacedPieceList->SetName(QObject::tr("Unplaced pieces"));
|
||||
|
@ -45,20 +45,20 @@ VPuzzleLayout::VPuzzleLayout() :
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VPuzzleLayout::~VPuzzleLayout()
|
||||
VPLayout::~VPLayout()
|
||||
{
|
||||
qDeleteAll(m_pieceLists);
|
||||
delete m_unplacedPieceList;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VPPieceList* VPuzzleLayout::GetUnplacedPieceList()
|
||||
VPPieceList* VPLayout::GetUnplacedPieceList()
|
||||
{
|
||||
return m_unplacedPieceList;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VPPieceList* VPuzzleLayout::AddPieceList()
|
||||
VPPieceList* VPLayout::AddPieceList()
|
||||
{
|
||||
VPPieceList *newPieceList = new VPPieceList(this);
|
||||
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);
|
||||
return pieceList;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QList<VPPieceList *> VPuzzleLayout::GetPiecesLists()
|
||||
QList<VPPieceList *> VPLayout::GetPiecesLists()
|
||||
{
|
||||
return m_pieceLists;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QList<VPuzzlePiece *> VPuzzleLayout::GetSelectedPieces()
|
||||
QList<VPuzzlePiece *> VPLayout::GetSelectedPieces()
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
Unit VPuzzleLayout::GetUnit() const
|
||||
Unit VPLayout::GetUnit() const
|
||||
{
|
||||
return m_unit;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPuzzleLayout::SetLayoutSize(qreal width, qreal height)
|
||||
void VPLayout::SetLayoutSize(qreal width, qreal height)
|
||||
{
|
||||
m_size.setWidth(width);
|
||||
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.setHeight(UnitConvertor(height, m_unit, Unit::Px));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPuzzleLayout::SetLayoutSize(const QSizeF &size)
|
||||
void VPLayout::SetLayoutSize(const QSizeF &size)
|
||||
{
|
||||
m_size = size;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPuzzleLayout::SetLayoutSizeConverted(const QSizeF &size)
|
||||
void VPLayout::SetLayoutSizeConverted(const QSizeF &size)
|
||||
{
|
||||
m_size = QSizeF(
|
||||
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;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QSizeF VPuzzleLayout::GetLayoutSizeConverted() const
|
||||
QSizeF VPLayout::GetLayoutSizeConverted() const
|
||||
{
|
||||
QSizeF convertedSize = QSizeF(
|
||||
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.setTop(top);
|
||||
|
@ -168,7 +168,7 @@ void VPuzzleLayout::SetLayoutMargins(qreal left, qreal top, qreal right, qreal b
|
|||
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.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;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPuzzleLayout::SetLayoutMarginsConverted(const QMarginsF &margins)
|
||||
void VPLayout::SetLayoutMarginsConverted(const QMarginsF &margins)
|
||||
{
|
||||
m_margins = UnitConvertor(margins, m_unit, Unit::Px);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QMarginsF VPuzzleLayout::GetLayoutMargins() const
|
||||
QMarginsF VPLayout::GetLayoutMargins() const
|
||||
{
|
||||
return m_margins;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QMarginsF VPuzzleLayout::GetLayoutMarginsConverted() const
|
||||
QMarginsF VPLayout::GetLayoutMarginsConverted() const
|
||||
{
|
||||
return UnitConvertor(m_margins, Unit::Px, m_unit);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPuzzleLayout::SetFollowGrainline(FollowGrainline state)
|
||||
void VPLayout::SetFollowGrainline(FollowGrainline state)
|
||||
{
|
||||
m_followGrainLine = state;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
FollowGrainline VPuzzleLayout::GetFollowGrainline() const
|
||||
FollowGrainline VPLayout::GetFollowGrainline() const
|
||||
{
|
||||
return m_followGrainLine;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPuzzleLayout::SetPiecesGap(qreal value)
|
||||
void VPLayout::SetPiecesGap(qreal value)
|
||||
{
|
||||
m_piecesGap = value;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPuzzleLayout::SetPiecesGapConverted(qreal value)
|
||||
void VPLayout::SetPiecesGapConverted(qreal value)
|
||||
{
|
||||
m_piecesGap = UnitConvertor(value, m_unit, Unit::Px);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
qreal VPuzzleLayout::GetPiecesGap() const
|
||||
qreal VPLayout::GetPiecesGap() const
|
||||
{
|
||||
return m_piecesGap;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
qreal VPuzzleLayout::GetPiecesGapConverted() const
|
||||
qreal VPLayout::GetPiecesGapConverted() const
|
||||
{
|
||||
return UnitConvertor(m_piecesGap, Unit::Px, m_unit);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPuzzleLayout::SetWarningSuperpositionOfPieces(bool state)
|
||||
void VPLayout::SetWarningSuperpositionOfPieces(bool state)
|
||||
{
|
||||
m_warningSuperpositionOfPieces = state;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VPuzzleLayout::GetWarningSuperpositionOfPieces() const
|
||||
bool VPLayout::GetWarningSuperpositionOfPieces() const
|
||||
{
|
||||
return m_warningSuperpositionOfPieces;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPuzzleLayout::SetWarningPiecesOutOfBound(bool state)
|
||||
void VPLayout::SetWarningPiecesOutOfBound(bool state)
|
||||
{
|
||||
m_warningPiecesOutOfBound = state;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VPuzzleLayout::GetWarningPiecesOutOfBound() const
|
||||
bool VPLayout::GetWarningPiecesOutOfBound() const
|
||||
{
|
||||
return m_warningPiecesOutOfBound;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPuzzleLayout::SetStickyEdges(bool state)
|
||||
void VPLayout::SetStickyEdges(bool state)
|
||||
{
|
||||
m_stickyEdges = state;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VPuzzleLayout::GetStickyEdges() const
|
||||
bool VPLayout::GetStickyEdges() const
|
||||
{
|
||||
return m_stickyEdges;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPuzzleLayout::ClearSelection()
|
||||
void VPLayout::ClearSelection()
|
||||
{
|
||||
m_unplacedPieceList->ClearSelection();
|
||||
|
||||
|
@ -284,7 +284,7 @@ void VPuzzleLayout::ClearSelection()
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPuzzleLayout::SetFocusedPieceList(VPPieceList* focusedPieceList)
|
||||
void VPLayout::SetFocusedPieceList(VPPieceList* focusedPieceList)
|
||||
{
|
||||
if(focusedPieceList == nullptr)
|
||||
{
|
||||
|
@ -297,13 +297,13 @@ void VPuzzleLayout::SetFocusedPieceList(VPPieceList* focusedPieceList)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VPPieceList* VPuzzleLayout::GetFocusedPieceList()
|
||||
VPPieceList* VPLayout::GetFocusedPieceList()
|
||||
{
|
||||
return m_focusedPieceList;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPuzzleLayout::MovePieceToPieceList(VPuzzlePiece* piece, VPPieceList* pieceList)
|
||||
void VPLayout::MovePieceToPieceList(VPuzzlePiece* piece, VPPieceList* pieceList)
|
||||
{
|
||||
VPPieceList* pieceListBefore = piece->GetPieceList();
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file vpuzzlelayout.h
|
||||
** @file vplayout.h
|
||||
** @author Ronan Le Tiec
|
||||
** @date 13 4, 2020
|
||||
**
|
||||
|
@ -25,8 +25,8 @@
|
|||
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
||||
**
|
||||
*************************************************************************/
|
||||
#ifndef VPUZZLELAYOUT_H
|
||||
#define VPUZZLELAYOUT_H
|
||||
#ifndef VPLAYOUT_H
|
||||
#define VPLAYOUT_H
|
||||
|
||||
#include <QSizeF>
|
||||
#include <QMarginsF>
|
||||
|
@ -40,12 +40,12 @@ class VPuzzlePiece;
|
|||
// is this the right place for the definition?
|
||||
enum class FollowGrainline : qint8 { No = 0, Follow90 = 1, Follow180 = 2};
|
||||
|
||||
class VPuzzleLayout : public QObject
|
||||
class VPLayout : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
VPuzzleLayout();
|
||||
virtual ~VPuzzleLayout();
|
||||
VPLayout();
|
||||
virtual ~VPLayout();
|
||||
|
||||
/**
|
||||
* @brief GetUnplacedPieceList Returns the piece list of unplaced pieces
|
||||
|
@ -231,7 +231,7 @@ signals:
|
|||
void PieceMovedToPieceList(VPuzzlePiece *piece, VPPieceList *pieceListBefore, VPPieceList *pieceListAfter);
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(VPuzzleLayout)
|
||||
Q_DISABLE_COPY(VPLayout)
|
||||
|
||||
VPPieceList *m_unplacedPieceList;
|
||||
QList<VPPieceList *> m_pieceLists{};
|
||||
|
@ -268,4 +268,4 @@ private:
|
|||
|
||||
};
|
||||
|
||||
#endif // VPUZZLELAYOUT_H
|
||||
#endif // VPLAYOUT_H
|
|
@ -58,7 +58,7 @@ VPMainWindow::VPMainWindow(const VPCommandLinePtr &cmd, QWidget *parent) :
|
|||
m_cmd(cmd)
|
||||
{
|
||||
|
||||
m_layout = new VPuzzleLayout();
|
||||
m_layout = new VPLayout();
|
||||
|
||||
// ----- for test purposes, to be removed------------------
|
||||
m_layout->SetLayoutMarginsConverted(2, 2, 2, 2);
|
||||
|
@ -110,7 +110,7 @@ bool VPMainWindow::LoadFile(QString path)
|
|||
|
||||
if(m_layout == nullptr)
|
||||
{
|
||||
m_layout = new VPuzzleLayout();
|
||||
m_layout = new VPLayout();
|
||||
}
|
||||
|
||||
fileReader->ReadFile(m_layout, &file);
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
#include "../vmisc/def.h"
|
||||
#include "vpcarrousel.h"
|
||||
#include "vpuzzlemaingraphicsview.h"
|
||||
#include "vpuzzlelayout.h"
|
||||
#include "vplayout.h"
|
||||
#include "vpuzzlepiece.h"
|
||||
#include "../vlayout/vlayoutpiece.h"
|
||||
#include "vpcommandline.h"
|
||||
|
@ -95,7 +95,7 @@ private:
|
|||
|
||||
VPCommandLinePtr m_cmd;
|
||||
|
||||
VPuzzleLayout *m_layout{nullptr};
|
||||
VPLayout *m_layout{nullptr};
|
||||
QList<VPuzzlePiece *>m_selectedPieces{QList<VPuzzlePiece *>()};
|
||||
|
||||
/**
|
||||
|
|
|
@ -27,14 +27,14 @@
|
|||
*************************************************************************/
|
||||
#include "vppiecelist.h"
|
||||
|
||||
#include "vpuzzlelayout.h"
|
||||
#include "vplayout.h"
|
||||
|
||||
#include <QLoggingCategory>
|
||||
|
||||
Q_LOGGING_CATEGORY(pPieceList, "p.pieceList")
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VPPieceList::VPPieceList(VPuzzleLayout *layout):
|
||||
VPPieceList::VPPieceList(VPLayout *layout):
|
||||
m_layout(layout)
|
||||
{
|
||||
|
||||
|
@ -47,7 +47,7 @@ VPPieceList::~VPPieceList()
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VPuzzleLayout* VPPieceList::GetLayout()
|
||||
VPLayout* VPPieceList::GetLayout()
|
||||
{
|
||||
return m_layout;
|
||||
}
|
||||
|
|
|
@ -31,13 +31,13 @@
|
|||
#include <QList>
|
||||
#include "vpuzzlepiece.h"
|
||||
|
||||
class VPuzzleLayout;
|
||||
class VPLayout;
|
||||
|
||||
class VPPieceList : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
VPPieceList(VPuzzleLayout *layout);
|
||||
VPPieceList(VPLayout *layout);
|
||||
~VPPieceList();
|
||||
|
||||
QList<VPuzzlePiece *> GetPieces();
|
||||
|
@ -57,7 +57,7 @@ public:
|
|||
* @brief GetLayout Returns the layout in which this piece list is
|
||||
* @return the layout of this piece list
|
||||
*/
|
||||
VPuzzleLayout* GetLayout();
|
||||
VPLayout* GetLayout();
|
||||
|
||||
/**
|
||||
* @brief ClearSelection Clears the selection of the pieces in this piece list
|
||||
|
@ -81,7 +81,7 @@ private:
|
|||
QString m_name{};
|
||||
QList<VPuzzlePiece *> m_pieces{};
|
||||
|
||||
VPuzzleLayout *m_layout{nullptr};
|
||||
VPLayout *m_layout{nullptr};
|
||||
|
||||
// control
|
||||
bool m_isVisible{true};
|
||||
|
|
|
@ -42,7 +42,7 @@ Q_LOGGING_CATEGORY(pMainGraphicsView, "p.mainGraphicsView")
|
|||
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VPuzzleMainGraphicsView::VPuzzleMainGraphicsView(VPuzzleLayout *layout, QWidget *parent) :
|
||||
VPuzzleMainGraphicsView::VPuzzleMainGraphicsView(VPLayout *layout, QWidget *parent) :
|
||||
VMainGraphicsView(parent),
|
||||
m_layout(layout)
|
||||
{
|
||||
|
@ -56,7 +56,7 @@ VPuzzleMainGraphicsView::VPuzzleMainGraphicsView(VPuzzleLayout *layout, QWidget
|
|||
setAcceptDrops(true);
|
||||
|
||||
// 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,
|
||||
&VPuzzleMainGraphicsView::on_SceneSelectionChanged);
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ class VPuzzleMainGraphicsView : public VMainGraphicsView
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
VPuzzleMainGraphicsView(VPuzzleLayout *layout, QWidget *parent);
|
||||
VPuzzleMainGraphicsView(VPLayout *layout, QWidget *parent);
|
||||
~VPuzzleMainGraphicsView() = default;
|
||||
|
||||
/**
|
||||
|
@ -77,7 +77,7 @@ private:
|
|||
VMainGraphicsScene *m_scene{nullptr};
|
||||
|
||||
VPGraphicsSheet *m_graphicsSheet{nullptr};
|
||||
VPuzzleLayout *m_layout{nullptr};
|
||||
VPLayout *m_layout{nullptr};
|
||||
|
||||
QList<VPGraphicsPiece*> m_graphicsPieces{};
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ VPLayoutFileReader::~VPLayoutFileReader()
|
|||
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VPLayoutFileReader::ReadFile(VPuzzleLayout *layout, QFile *file)
|
||||
bool VPLayoutFileReader::ReadFile(VPLayout *layout, QFile *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);
|
||||
|
||||
|
@ -82,7 +82,7 @@ void VPLayoutFileReader::ReadLayout(VPuzzleLayout *layout)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPLayoutFileReader::ReadProperties(VPuzzleLayout *layout)
|
||||
void VPLayoutFileReader::ReadProperties(VPLayout *layout)
|
||||
{
|
||||
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
|
||||
|
||||
|
@ -193,7 +193,7 @@ void VPLayoutFileReader::ReadTiles(VPuzzleLayout *layout)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPLayoutFileReader::ReadPieceLists(VPuzzleLayout *layout)
|
||||
void VPLayoutFileReader::ReadPieceLists(VPLayout *layout)
|
||||
{
|
||||
SCASSERT(isStartElement() && name() == ML::TagPieceLists);
|
||||
|
||||
|
|
|
@ -31,26 +31,26 @@
|
|||
|
||||
#include <QXmlStreamReader>
|
||||
#include "../ifc/xml/vabstractconverter.h"
|
||||
#include "vpuzzlelayout.h"
|
||||
#include "vplayout.h"
|
||||
#include "vppiecelist.h"
|
||||
#include "vpuzzlepiece.h"
|
||||
|
||||
class VPLayoutFileReader : public QXmlStreamReader
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(VPuzzleLayoutFileReader)
|
||||
Q_DECLARE_TR_FUNCTIONS(VPLayoutFileReader)
|
||||
public:
|
||||
VPLayoutFileReader();
|
||||
~VPLayoutFileReader();
|
||||
|
||||
bool ReadFile(VPuzzleLayout *layout, QFile *file);
|
||||
bool ReadFile(VPLayout *layout, QFile *file);
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(VPLayoutFileReader)
|
||||
|
||||
void ReadLayout(VPuzzleLayout *layout);
|
||||
void ReadProperties(VPuzzleLayout *layout);
|
||||
void ReadTiles(VPuzzleLayout *layout);
|
||||
void ReadPieceLists(VPuzzleLayout *layout);
|
||||
void ReadLayout(VPLayout *layout);
|
||||
void ReadProperties(VPLayout *layout);
|
||||
void ReadTiles(VPLayout *layout);
|
||||
void ReadPieceLists(VPLayout *layout);
|
||||
void ReadPieceList(VPPieceList *pieceList);
|
||||
void ReadPiece(VPuzzlePiece *piece);
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
*************************************************************************/
|
||||
|
||||
#include "vplayoutfilewriter.h"
|
||||
#include "vpuzzlelayout.h"
|
||||
#include "vplayout.h"
|
||||
#include "vppiecelist.h"
|
||||
#include "vpuzzlepiece.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);
|
||||
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);
|
||||
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);
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -116,7 +116,7 @@ void VPLayoutFileWriter::WriteTiles(VPuzzleLayout *layout)
|
|||
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPLayoutFileWriter::WritePieceLists(VPuzzleLayout *layout)
|
||||
void VPLayoutFileWriter::WritePieceLists(VPLayout *layout)
|
||||
{
|
||||
writeStartElement(ML::TagPieceLists);
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
|
||||
#include "../vmisc/literals.h"
|
||||
|
||||
class VPuzzleLayout;
|
||||
class VPLayout;
|
||||
class VPPieceList;
|
||||
class VPuzzlePiece;
|
||||
class QFile;
|
||||
|
@ -46,14 +46,14 @@ public:
|
|||
VPLayoutFileWriter();
|
||||
~VPLayoutFileWriter();
|
||||
|
||||
void WriteFile(VPuzzleLayout *layout, QFile *file);
|
||||
void WriteFile(VPLayout *layout, QFile *file);
|
||||
|
||||
private:
|
||||
|
||||
void WriteLayout(VPuzzleLayout *layout);
|
||||
void WriteProperties(VPuzzleLayout *layout);
|
||||
void WriteTiles(VPuzzleLayout *layout);
|
||||
void WritePieceLists(VPuzzleLayout *layout);
|
||||
void WriteLayout(VPLayout *layout);
|
||||
void WriteProperties(VPLayout *layout);
|
||||
void WriteTiles(VPLayout *layout);
|
||||
void WritePieceLists(VPLayout *layout);
|
||||
void WritePieceList(VPPieceList *pieceList);
|
||||
void WritePieceList(VPPieceList *pieceList, const QString &tagName);
|
||||
void WritePiece(VPuzzlePiece *piece);
|
||||
|
|
Loading…
Reference in New Issue
Block a user