Refactoring VPuzzleMimeDataPiece

This commit is contained in:
Ronan Le Tiec 2020-05-23 15:38:59 +02:00
parent 2accd83d6b
commit 6079d69c93
5 changed files with 20 additions and 20 deletions

View File

@ -16,8 +16,8 @@ SOURCES += \
$$PWD/vplayout.cpp \ $$PWD/vplayout.cpp \
$$PWD/vpmaingraphicsview.cpp \ $$PWD/vpmaingraphicsview.cpp \
$$PWD/vpmainwindow.cpp \ $$PWD/vpmainwindow.cpp \
$$PWD/vpmimedatapiece.cpp \
$$PWD/vppiecelist.cpp \ $$PWD/vppiecelist.cpp \
$$PWD/vpuzzlemimedatapiece.cpp \
$$PWD/vpuzzlepiece.cpp \ $$PWD/vpuzzlepiece.cpp \
$$PWD/vpuzzlesettings.cpp \ $$PWD/vpuzzlesettings.cpp \
$$PWD/xml/vplayoutfilereader.cpp \ $$PWD/xml/vplayoutfilereader.cpp \
@ -40,9 +40,9 @@ HEADERS += \
$$PWD/vplayout.h \ $$PWD/vplayout.h \
$$PWD/vpmaingraphicsview.h \ $$PWD/vpmaingraphicsview.h \
$$PWD/vpmainwindow.h \ $$PWD/vpmainwindow.h \
$$PWD/vpmimedatapiece.h \
$$PWD/vppiecelist.h \ $$PWD/vppiecelist.h \
$$PWD/vpstable.h \ $$PWD/vpstable.h \
$$PWD/vpuzzlemimedatapiece.h \
$$PWD/vpuzzlepiece.h \ $$PWD/vpuzzlepiece.h \
$$PWD/vpuzzlesettings.h \ $$PWD/vpuzzlesettings.h \
$$PWD/xml/vplayoutfilereader.h \ $$PWD/xml/vplayoutfilereader.h \

View File

@ -37,7 +37,7 @@
#include <QApplication> #include <QApplication>
#include <QMenu> #include <QMenu>
#include "vpuzzlemimedatapiece.h" #include "vpmimedatapiece.h"
#include "vpcarrouselpiecelist.h" #include "vpcarrouselpiecelist.h"
#include "vpcarrousel.h" #include "vpcarrousel.h"
@ -212,7 +212,7 @@ void VPCarrouselPiece::mouseMoveEvent(QMouseEvent *event)
// starts the dragging // starts the dragging
QDrag *drag = new QDrag(this); QDrag *drag = new QDrag(this);
VPuzzleMimeDataPiece *mimeData = new VPuzzleMimeDataPiece(); VPMimeDataPiece *mimeData = new VPMimeDataPiece();
mimeData->SetPiecePtr(m_piece); mimeData->SetPiecePtr(m_piece);
mimeData->setObjectName("piecePointer"); mimeData->setObjectName("piecePointer");

View File

@ -32,7 +32,7 @@
#include <QMimeData> #include <QMimeData>
#include <QKeyEvent> #include <QKeyEvent>
#include "vpuzzlemimedatapiece.h" #include "vpmimedatapiece.h"
#include "vppiecelist.h" #include "vppiecelist.h"
#include "../vwidgets/vmaingraphicsscene.h" #include "../vwidgets/vmaingraphicsscene.h"
@ -111,7 +111,7 @@ void VPMainGraphicsView::dropEvent(QDropEvent *event)
if(mime->objectName() == "piecePointer") if(mime->objectName() == "piecePointer")
{ {
const VPuzzleMimeDataPiece *mimePiece = qobject_cast<const VPuzzleMimeDataPiece *> (mime); const VPMimeDataPiece *mimePiece = qobject_cast<const VPMimeDataPiece *> (mime);
VPuzzlePiece *piece = mimePiece->GetPiecePtr(); VPuzzlePiece *piece = mimePiece->GetPiecePtr();
if(piece != nullptr) if(piece != nullptr)

View File

@ -1,6 +1,6 @@
/************************************************************************ /************************************************************************
** **
** @file vpuzzlemimedatapiece.cpp ** @file vpmimedatapiece.cpp
** @author Ronan Le Tiec ** @author Ronan Le Tiec
** @date 4 5, 2020 ** @date 4 5, 2020
** **
@ -26,28 +26,28 @@
** **
*************************************************************************/ *************************************************************************/
#include "vpuzzlemimedatapiece.h" #include "vpmimedatapiece.h"
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VPuzzleMimeDataPiece::VPuzzleMimeDataPiece() VPMimeDataPiece::VPMimeDataPiece()
{ {
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VPuzzleMimeDataPiece::~VPuzzleMimeDataPiece() VPMimeDataPiece::~VPMimeDataPiece()
{ {
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
VPuzzlePiece* VPuzzleMimeDataPiece::GetPiecePtr() const VPuzzlePiece* VPMimeDataPiece::GetPiecePtr() const
{ {
return m_piece; return m_piece;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VPuzzleMimeDataPiece::SetPiecePtr(VPuzzlePiece* piece) void VPMimeDataPiece::SetPiecePtr(VPuzzlePiece* piece)
{ {
m_piece = piece; m_piece = piece;
} }

View File

@ -1,6 +1,6 @@
/************************************************************************ /************************************************************************
** **
** @file vpuzzlemimedatapiece.h ** @file vpmimedatapiece.h
** @author Ronan Le Tiec ** @author Ronan Le Tiec
** @date 4 5, 2020 ** @date 4 5, 2020
** **
@ -26,21 +26,21 @@
** **
*************************************************************************/ *************************************************************************/
#ifndef VPUZZLEMIMEDATAPIECE_H #ifndef VPMIMEDATAPIECE_H
#define VPUZZLEMIMEDATAPIECE_H #define VPMIMEDATAPIECE_H
#include <QMimeData> #include <QMimeData>
#include "vpuzzlepiece.h" #include "vpuzzlepiece.h"
class VPuzzleMimeDataPiece : public QMimeData class VPMimeDataPiece : public QMimeData
{ {
Q_OBJECT Q_OBJECT
public: public:
VPuzzleMimeDataPiece(); VPMimeDataPiece();
~VPuzzleMimeDataPiece(); ~VPMimeDataPiece();
/** /**
* @brief GetPiecePtr Returns the piece pointer of the mime data * @brief GetPiecePtr Returns the piece pointer of the mime data
@ -55,11 +55,11 @@ public:
void SetPiecePtr(VPuzzlePiece* piece); void SetPiecePtr(VPuzzlePiece* piece);
private: private:
Q_DISABLE_COPY(VPuzzleMimeDataPiece) Q_DISABLE_COPY(VPMimeDataPiece)
VPuzzlePiece *m_piece{nullptr}; VPuzzlePiece *m_piece{nullptr};
}; };
#endif // VPUZZLEMIMEDATAPIECE_H #endif // VPMIMEDATAPIECE_H