Refactoring VPieceCarrouselLayer
This commit is contained in:
parent
690606b4e5
commit
8ca77baef0
|
@ -6,6 +6,7 @@ SOURCES += \
|
||||||
$$PWD/main.cpp \
|
$$PWD/main.cpp \
|
||||||
$$PWD/vpapplication.cpp \
|
$$PWD/vpapplication.cpp \
|
||||||
$$PWD/vpcarrousel.cpp \
|
$$PWD/vpcarrousel.cpp \
|
||||||
|
$$PWD/vpcarrouselpiecelist.cpp \
|
||||||
$$PWD/vpcommands.cpp \
|
$$PWD/vpcommands.cpp \
|
||||||
$$PWD/vpiececarrouselpiecepreview.cpp \
|
$$PWD/vpiececarrouselpiecepreview.cpp \
|
||||||
$$PWD/vpmainwindow.cpp \
|
$$PWD/vpmainwindow.cpp \
|
||||||
|
@ -21,7 +22,6 @@ SOURCES += \
|
||||||
$$PWD/xml/vplayoutfilereader.cpp \
|
$$PWD/xml/vplayoutfilereader.cpp \
|
||||||
$$PWD/xml/vplayoutfilewriter.cpp \
|
$$PWD/xml/vplayoutfilewriter.cpp \
|
||||||
$$PWD/xml/vplayoutliterals.cpp \
|
$$PWD/xml/vplayoutliterals.cpp \
|
||||||
$$PWD/vpiececarrousellayer.cpp \
|
|
||||||
$$PWD/vpiececarrouselpiece.cpp
|
$$PWD/vpiececarrouselpiece.cpp
|
||||||
|
|
||||||
*msvc*:SOURCES +=
|
*msvc*:SOURCES +=
|
||||||
|
@ -30,6 +30,7 @@ HEADERS += \
|
||||||
$$PWD/dialogs/vpdialogabout.h \
|
$$PWD/dialogs/vpdialogabout.h \
|
||||||
$$PWD/vpapplication.h \
|
$$PWD/vpapplication.h \
|
||||||
$$PWD/vpcarrousel.h \
|
$$PWD/vpcarrousel.h \
|
||||||
|
$$PWD/vpcarrouselpiecelist.h \
|
||||||
$$PWD/vpcommands.h \
|
$$PWD/vpcommands.h \
|
||||||
$$PWD/vpiececarrouselpiecepreview.h \
|
$$PWD/vpiececarrouselpiecepreview.h \
|
||||||
$$PWD/vpmainwindow.h \
|
$$PWD/vpmainwindow.h \
|
||||||
|
@ -46,7 +47,6 @@ HEADERS += \
|
||||||
$$PWD/xml/vplayoutfilereader.h \
|
$$PWD/xml/vplayoutfilereader.h \
|
||||||
$$PWD/xml/vplayoutfilewriter.h \
|
$$PWD/xml/vplayoutfilewriter.h \
|
||||||
$$PWD/xml/vplayoutliterals.h \
|
$$PWD/xml/vplayoutliterals.h \
|
||||||
$$PWD/vpiececarrousellayer.h \
|
|
||||||
$$PWD/vpiececarrouselpiece.h
|
$$PWD/vpiececarrouselpiece.h
|
||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
**
|
**
|
||||||
** @file vpiececarrousellayer.cpp
|
** @file vpcarrouselpiecelist.cpp
|
||||||
** @author Ronan Le Tiec
|
** @author Ronan Le Tiec
|
||||||
** @date 25 4, 2020
|
** @date 25 4, 2020
|
||||||
**
|
**
|
||||||
|
@ -26,7 +26,7 @@
|
||||||
**
|
**
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
#include "vpiececarrousellayer.h"
|
#include "vpcarrouselpiecelist.h"
|
||||||
#include "vpcarrousel.h"
|
#include "vpcarrousel.h"
|
||||||
#include "../vmisc/backport/qoverload.h"
|
#include "../vmisc/backport/qoverload.h"
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@
|
||||||
Q_LOGGING_CATEGORY(pCarrouselLayer, "p.carrouselLayer")
|
Q_LOGGING_CATEGORY(pCarrouselLayer, "p.carrouselLayer")
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VPieceCarrouselLayer::VPieceCarrouselLayer(VPuzzleLayer *layer, VPCarrousel *carrousel) :
|
VPCarrouselPieceList::VPCarrouselPieceList(VPuzzleLayer *layer, VPCarrousel *carrousel) :
|
||||||
m_layer(layer),
|
m_layer(layer),
|
||||||
m_carrousel(carrousel),
|
m_carrousel(carrousel),
|
||||||
m_carrouselPieces(QList<VPieceCarrouselPiece*>())
|
m_carrouselPieces(QList<VPieceCarrouselPiece*>())
|
||||||
|
@ -46,13 +46,13 @@ VPieceCarrouselLayer::VPieceCarrouselLayer(VPuzzleLayer *layer, VPCarrousel *car
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VPieceCarrouselLayer::~VPieceCarrouselLayer()
|
VPCarrouselPieceList::~VPCarrouselPieceList()
|
||||||
{
|
{
|
||||||
Clear();
|
Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VPieceCarrouselLayer::Init()
|
void VPCarrouselPieceList::Init()
|
||||||
{
|
{
|
||||||
// initiales the structure
|
// initiales the structure
|
||||||
QVBoxLayout *layoutPiecesLayout = new QVBoxLayout();
|
QVBoxLayout *layoutPiecesLayout = new QVBoxLayout();
|
||||||
|
@ -63,12 +63,12 @@ void VPieceCarrouselLayer::Init()
|
||||||
Refresh();
|
Refresh();
|
||||||
|
|
||||||
// add the connections
|
// add the connections
|
||||||
connect(m_layer, &VPuzzleLayer::PieceAdded, this, &VPieceCarrouselLayer::on_PieceAdded);
|
connect(m_layer, &VPuzzleLayer::PieceAdded, this, &VPCarrouselPieceList::on_PieceAdded);
|
||||||
connect(m_layer, &VPuzzleLayer::PieceRemoved, this, &VPieceCarrouselLayer::on_PieceRemoved);
|
connect(m_layer, &VPuzzleLayer::PieceRemoved, this, &VPCarrouselPieceList::on_PieceRemoved);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VPieceCarrouselLayer::Refresh()
|
void VPCarrouselPieceList::Refresh()
|
||||||
{
|
{
|
||||||
Clear();
|
Clear();
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ void VPieceCarrouselLayer::Refresh()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VPieceCarrouselLayer::Clear()
|
void VPCarrouselPieceList::Clear()
|
||||||
{
|
{
|
||||||
// Removes and deletes the carrousel pieces from the layer
|
// Removes and deletes the carrousel pieces from the layer
|
||||||
while (!m_carrouselPieces.isEmpty())
|
while (!m_carrouselPieces.isEmpty())
|
||||||
|
@ -111,25 +111,25 @@ void VPieceCarrouselLayer::Clear()
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QList<VPieceCarrouselPiece*> VPieceCarrouselLayer::GetCarrouselPieces()
|
QList<VPieceCarrouselPiece*> VPCarrouselPieceList::GetCarrouselPieces()
|
||||||
{
|
{
|
||||||
return m_carrouselPieces;
|
return m_carrouselPieces;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VPCarrousel* VPieceCarrouselLayer::GetCarrousel()
|
VPCarrousel* VPCarrouselPieceList::GetCarrousel()
|
||||||
{
|
{
|
||||||
return m_carrousel;
|
return m_carrousel;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VPuzzleLayer* VPieceCarrouselLayer::GetLayer()
|
VPuzzleLayer* VPCarrouselPieceList::GetLayer()
|
||||||
{
|
{
|
||||||
return m_layer;
|
return m_layer;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VPieceCarrouselLayer::on_PieceAdded(VPuzzlePiece* piece)
|
void VPCarrouselPieceList::on_PieceAdded(VPuzzlePiece* piece)
|
||||||
{
|
{
|
||||||
Q_UNUSED(piece)
|
Q_UNUSED(piece)
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ void VPieceCarrouselLayer::on_PieceAdded(VPuzzlePiece* piece)
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VPieceCarrouselLayer::on_PieceRemoved(VPuzzlePiece* piece)
|
void VPCarrouselPieceList::on_PieceRemoved(VPuzzlePiece* piece)
|
||||||
{
|
{
|
||||||
for (auto carrouselPiece : m_carrouselPieces)
|
for (auto carrouselPiece : m_carrouselPieces)
|
||||||
{
|
{
|
|
@ -1,6 +1,6 @@
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
**
|
**
|
||||||
** @file vpiececarrousellayer.h
|
** @file vpcarrouselpiecelist.h
|
||||||
** @author Ronan Le Tiec
|
** @author Ronan Le Tiec
|
||||||
** @date 25 4, 2020
|
** @date 25 4, 2020
|
||||||
**
|
**
|
||||||
|
@ -26,8 +26,8 @@
|
||||||
**
|
**
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
#ifndef VPIECECARROUSELLAYER_H
|
#ifndef VPCARROUSELPIECELIST_H
|
||||||
#define VPIECECARROUSELLAYER_H
|
#define VPCARROUSELPIECELIST_H
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include "vpuzzlelayer.h"
|
#include "vpuzzlelayer.h"
|
||||||
|
@ -35,12 +35,12 @@
|
||||||
|
|
||||||
class VPCarrousel;
|
class VPCarrousel;
|
||||||
|
|
||||||
class VPieceCarrouselLayer : public QWidget
|
class VPCarrouselPieceList : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
VPieceCarrouselLayer(VPuzzleLayer *layer, VPCarrousel *carrousel);
|
VPCarrouselPieceList(VPuzzleLayer *layer, VPCarrousel *carrousel);
|
||||||
~VPieceCarrouselLayer();
|
~VPCarrouselPieceList();
|
||||||
|
|
||||||
void Init();
|
void Init();
|
||||||
void Refresh();
|
void Refresh();
|
||||||
|
@ -61,7 +61,7 @@ public:
|
||||||
VPuzzleLayer* GetLayer();
|
VPuzzleLayer* GetLayer();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VPieceCarrouselLayer)
|
Q_DISABLE_COPY(VPCarrouselPieceList)
|
||||||
|
|
||||||
VPuzzleLayer *m_layer;
|
VPuzzleLayer *m_layer;
|
||||||
VPCarrousel *m_carrousel;
|
VPCarrousel *m_carrousel;
|
||||||
|
@ -81,4 +81,4 @@ private slots:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VPIECECARROUSELLAYER_H
|
#endif // VPCARROUSELPIECELIST_H
|
|
@ -38,7 +38,7 @@
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
|
|
||||||
#include "vpuzzlemimedatapiece.h"
|
#include "vpuzzlemimedatapiece.h"
|
||||||
#include "vpiececarrousellayer.h"
|
#include "vpcarrouselpiecelist.h"
|
||||||
#include "vpcarrousel.h"
|
#include "vpcarrousel.h"
|
||||||
|
|
||||||
#include <QLoggingCategory>
|
#include <QLoggingCategory>
|
||||||
|
@ -47,7 +47,7 @@ Q_LOGGING_CATEGORY(pCarrouselPiece, "p.carrouselPiece")
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VPieceCarrouselPiece::VPieceCarrouselPiece(VPuzzlePiece *piece, VPieceCarrouselLayer *carrouselLayer) :
|
VPieceCarrouselPiece::VPieceCarrouselPiece(VPuzzlePiece *piece, VPCarrouselPieceList *carrouselLayer) :
|
||||||
m_piece(piece),
|
m_piece(piece),
|
||||||
m_carrouselLayer(carrouselLayer),
|
m_carrouselLayer(carrouselLayer),
|
||||||
m_dragStart(QPoint())
|
m_dragStart(QPoint())
|
||||||
|
|
|
@ -37,13 +37,13 @@
|
||||||
#include "vpiececarrouselpiecepreview.h"
|
#include "vpiececarrouselpiecepreview.h"
|
||||||
|
|
||||||
|
|
||||||
class VPieceCarrouselLayer;
|
class VPCarrouselPieceList;
|
||||||
|
|
||||||
class VPieceCarrouselPiece : public QFrame
|
class VPieceCarrouselPiece : public QFrame
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit VPieceCarrouselPiece(VPuzzlePiece *piece, VPieceCarrouselLayer *carrouselLayer);
|
explicit VPieceCarrouselPiece(VPuzzlePiece *piece, VPCarrouselPieceList *carrouselLayer);
|
||||||
~VPieceCarrouselPiece();
|
~VPieceCarrouselPiece();
|
||||||
|
|
||||||
void Init();
|
void Init();
|
||||||
|
@ -82,7 +82,7 @@ private:
|
||||||
|
|
||||||
VPuzzlePiece *m_piece;
|
VPuzzlePiece *m_piece;
|
||||||
|
|
||||||
VPieceCarrouselLayer *m_carrouselLayer;
|
VPCarrouselPieceList *m_carrouselLayer;
|
||||||
|
|
||||||
QLabel *m_label{nullptr};
|
QLabel *m_label{nullptr};
|
||||||
VPieceCarrouselPiecePreview *m_piecePreview{nullptr};
|
VPieceCarrouselPiecePreview *m_piecePreview{nullptr};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user