From 2accd83d6bc7bde7aa95bdcf83505335d0a59ad1 Mon Sep 17 00:00:00 2001 From: Ronan Le Tiec Date: Sat, 23 May 2020 15:36:46 +0200 Subject: [PATCH] Refactoring VPuzzleMainGraphicsView --- src/app/puzzle/puzzle.pri | 4 +-- ...raphicsview.cpp => vpmaingraphicsview.cpp} | 26 +++++++++---------- ...aingraphicsview.h => vpmaingraphicsview.h} | 16 ++++++------ src/app/puzzle/vpmainwindow.cpp | 2 +- src/app/puzzle/vpmainwindow.h | 4 +-- 5 files changed, 26 insertions(+), 26 deletions(-) rename src/app/puzzle/{vpuzzlemaingraphicsview.cpp => vpmaingraphicsview.cpp} (87%) rename src/app/puzzle/{vpuzzlemaingraphicsview.h => vpmaingraphicsview.h} (87%) diff --git a/src/app/puzzle/puzzle.pri b/src/app/puzzle/puzzle.pri index b7442b82a..8e111294e 100644 --- a/src/app/puzzle/puzzle.pri +++ b/src/app/puzzle/puzzle.pri @@ -14,9 +14,9 @@ SOURCES += \ $$PWD/vpgraphicspiece.cpp \ $$PWD/vpgraphicssheet.cpp \ $$PWD/vplayout.cpp \ + $$PWD/vpmaingraphicsview.cpp \ $$PWD/vpmainwindow.cpp \ $$PWD/vppiecelist.cpp \ - $$PWD/vpuzzlemaingraphicsview.cpp \ $$PWD/vpuzzlemimedatapiece.cpp \ $$PWD/vpuzzlepiece.cpp \ $$PWD/vpuzzlesettings.cpp \ @@ -38,10 +38,10 @@ HEADERS += \ $$PWD/vpgraphicspiece.h \ $$PWD/vpgraphicssheet.h \ $$PWD/vplayout.h \ + $$PWD/vpmaingraphicsview.h \ $$PWD/vpmainwindow.h \ $$PWD/vppiecelist.h \ $$PWD/vpstable.h \ - $$PWD/vpuzzlemaingraphicsview.h \ $$PWD/vpuzzlemimedatapiece.h \ $$PWD/vpuzzlepiece.h \ $$PWD/vpuzzlesettings.h \ diff --git a/src/app/puzzle/vpuzzlemaingraphicsview.cpp b/src/app/puzzle/vpmaingraphicsview.cpp similarity index 87% rename from src/app/puzzle/vpuzzlemaingraphicsview.cpp rename to src/app/puzzle/vpmaingraphicsview.cpp index 53a80e1e4..97d39ac57 100644 --- a/src/app/puzzle/vpuzzlemaingraphicsview.cpp +++ b/src/app/puzzle/vpmaingraphicsview.cpp @@ -1,6 +1,6 @@ /************************************************************************ ** - ** @file vpuzzlemaingraphicsview.cpp + ** @file vpmaingraphicsview.cpp ** @author Ronan Le Tiec ** @date 3 5, 2020 ** @@ -26,7 +26,7 @@ ** *************************************************************************/ -#include "vpuzzlemaingraphicsview.h" +#include "vpmaingraphicsview.h" #include #include @@ -42,7 +42,7 @@ Q_LOGGING_CATEGORY(pMainGraphicsView, "p.mainGraphicsView") //--------------------------------------------------------------------------------------------------------------------- -VPuzzleMainGraphicsView::VPuzzleMainGraphicsView(VPLayout *layout, QWidget *parent) : +VPMainGraphicsView::VPMainGraphicsView(VPLayout *layout, QWidget *parent) : VMainGraphicsView(parent), m_layout(layout) { @@ -56,13 +56,13 @@ VPuzzleMainGraphicsView::VPuzzleMainGraphicsView(VPLayout *layout, QWidget *pare setAcceptDrops(true); // add the connections - connect(m_layout, &VPLayout::PieceMovedToPieceList, this, &VPuzzleMainGraphicsView::on_PieceMovedToPieceList); + connect(m_layout, &VPLayout::PieceMovedToPieceList, this, &VPMainGraphicsView::on_PieceMovedToPieceList); connect(m_scene, &VMainGraphicsScene::selectionChanged, this, - &VPuzzleMainGraphicsView::on_SceneSelectionChanged); + &VPMainGraphicsView::on_SceneSelectionChanged); } //--------------------------------------------------------------------------------------------------------------------- -void VPuzzleMainGraphicsView::RefreshLayout() +void VPMainGraphicsView::RefreshLayout() { // FIXME: Is that the way to go? @@ -72,7 +72,7 @@ void VPuzzleMainGraphicsView::RefreshLayout() } //--------------------------------------------------------------------------------------------------------------------- -void VPuzzleMainGraphicsView::dragEnterEvent(QDragEnterEvent *event) +void VPMainGraphicsView::dragEnterEvent(QDragEnterEvent *event) { const QMimeData *mime = event->mimeData(); @@ -84,7 +84,7 @@ void VPuzzleMainGraphicsView::dragEnterEvent(QDragEnterEvent *event) } //--------------------------------------------------------------------------------------------------------------------- -void VPuzzleMainGraphicsView::dragMoveEvent(QDragMoveEvent *event) +void VPMainGraphicsView::dragMoveEvent(QDragMoveEvent *event) { const QMimeData *mime = event->mimeData(); @@ -95,7 +95,7 @@ void VPuzzleMainGraphicsView::dragMoveEvent(QDragMoveEvent *event) } //--------------------------------------------------------------------------------------------------------------------- -void VPuzzleMainGraphicsView::dragLeaveEvent(QDragLeaveEvent *event) +void VPMainGraphicsView::dragLeaveEvent(QDragLeaveEvent *event) { event->accept(); } @@ -103,7 +103,7 @@ void VPuzzleMainGraphicsView::dragLeaveEvent(QDragLeaveEvent *event) //--------------------------------------------------------------------------------------------------------------------- -void VPuzzleMainGraphicsView::dropEvent(QDropEvent *event) +void VPMainGraphicsView::dropEvent(QDropEvent *event) { const QMimeData *mime = event->mimeData(); @@ -133,7 +133,7 @@ void VPuzzleMainGraphicsView::dropEvent(QDropEvent *event) } //--------------------------------------------------------------------------------------------------------------------- -void VPuzzleMainGraphicsView::keyPressEvent(QKeyEvent *event) +void VPMainGraphicsView::keyPressEvent(QKeyEvent *event) { if(event->key() == Qt::Key_Backspace || event->key() == Qt::Key_Delete) { @@ -153,7 +153,7 @@ void VPuzzleMainGraphicsView::keyPressEvent(QKeyEvent *event) } //--------------------------------------------------------------------------------------------------------------------- -void VPuzzleMainGraphicsView::on_PieceMovedToPieceList(VPuzzlePiece *piece, VPPieceList *pieceListBefore, VPPieceList *pieceListAfter) +void VPMainGraphicsView::on_PieceMovedToPieceList(VPuzzlePiece *piece, VPPieceList *pieceListBefore, VPPieceList *pieceListAfter) { Q_UNUSED(pieceListBefore) @@ -188,7 +188,7 @@ void VPuzzleMainGraphicsView::on_PieceMovedToPieceList(VPuzzlePiece *piece, VPPi } //--------------------------------------------------------------------------------------------------------------------- -void VPuzzleMainGraphicsView::on_SceneSelectionChanged() +void VPMainGraphicsView::on_SceneSelectionChanged() { // most of the selection behaviour taks place automatically // but we need to make sure that the unplaced pieces are unselected when the scene selection has changed diff --git a/src/app/puzzle/vpuzzlemaingraphicsview.h b/src/app/puzzle/vpmaingraphicsview.h similarity index 87% rename from src/app/puzzle/vpuzzlemaingraphicsview.h rename to src/app/puzzle/vpmaingraphicsview.h index 7fc605d7c..ac802549d 100644 --- a/src/app/puzzle/vpuzzlemaingraphicsview.h +++ b/src/app/puzzle/vpmaingraphicsview.h @@ -1,6 +1,6 @@ /************************************************************************ ** - ** @file vpuzzlemaingraphicsview.h + ** @file vpmaingraphicsview.h ** @author Ronan Le Tiec ** @date 3 5, 2020 ** @@ -26,8 +26,8 @@ ** *************************************************************************/ -#ifndef VPUZZLEMAINGRAPHICSVIEW_H -#define VPUZZLEMAINGRAPHICSVIEW_H +#ifndef VPMAINGRAPHICSVIEW_H +#define VPMAINGRAPHICSVIEW_H #include "vpgraphicssheet.h" #include "vpgraphicspiece.h" @@ -36,12 +36,12 @@ class VMainGraphicsScene; -class VPuzzleMainGraphicsView : public VMainGraphicsView +class VPMainGraphicsView : public VMainGraphicsView { Q_OBJECT public: - VPuzzleMainGraphicsView(VPLayout *layout, QWidget *parent); - ~VPuzzleMainGraphicsView() = default; + VPMainGraphicsView(VPLayout *layout, QWidget *parent); + ~VPMainGraphicsView() = default; /** * @brief RefreshLayout Refreshes the rectangles for the layout border and the margin @@ -72,7 +72,7 @@ private slots: void on_SceneSelectionChanged(); private: - Q_DISABLE_COPY(VPuzzleMainGraphicsView) + Q_DISABLE_COPY(VPMainGraphicsView) VMainGraphicsScene *m_scene{nullptr}; @@ -83,4 +83,4 @@ private: }; -#endif // VPUZZLEMAINGRAPHICVIEW_H +#endif // VPMAINGRAPHICSVIEW_H diff --git a/src/app/puzzle/vpmainwindow.cpp b/src/app/puzzle/vpmainwindow.cpp index 39c634f95..24ce82e64 100644 --- a/src/app/puzzle/vpmainwindow.cpp +++ b/src/app/puzzle/vpmainwindow.cpp @@ -436,7 +436,7 @@ void VPMainWindow::SetPropertyTabTilesData() //--------------------------------------------------------------------------------------------------------------------- void VPMainWindow::InitMainGraphics() { - m_graphicsView = new VPuzzleMainGraphicsView(m_layout, this); + m_graphicsView = new VPMainGraphicsView(m_layout, this); ui->centralWidget->layout()->addWidget(m_graphicsView); m_graphicsView->RefreshLayout(); diff --git a/src/app/puzzle/vpmainwindow.h b/src/app/puzzle/vpmainwindow.h index 7ec2d1ac0..a2c7cd962 100644 --- a/src/app/puzzle/vpmainwindow.h +++ b/src/app/puzzle/vpmainwindow.h @@ -34,7 +34,7 @@ #include "../vmisc/def.h" #include "vpcarrousel.h" -#include "vpuzzlemaingraphicsview.h" +#include "vpmaingraphicsview.h" #include "vplayout.h" #include "vpuzzlepiece.h" #include "../vlayout/vlayoutpiece.h" @@ -91,7 +91,7 @@ private: Ui::VPMainWindow *ui; VPCarrousel *m_carrousel{nullptr}; - VPuzzleMainGraphicsView *m_graphicsView{nullptr}; + VPMainGraphicsView *m_graphicsView{nullptr}; VPCommandLinePtr m_cmd;