diff --git a/gui/include/DragAndDrop/DragDropHelper.h b/gui/include/DragAndDrop/DragDropGuiController.h similarity index 85% rename from gui/include/DragAndDrop/DragDropHelper.h rename to gui/include/DragAndDrop/DragDropGuiController.h index 7274376..9d223b4 100644 --- a/gui/include/DragAndDrop/DragDropHelper.h +++ b/gui/include/DragAndDrop/DragDropGuiController.h @@ -1,5 +1,5 @@ -#ifndef SCIQLOP_DRAGDROPHELPER_H -#define SCIQLOP_DRAGDROPHELPER_H +#ifndef SCIQLOP_DRAGDROPGUICONTROLLER_H +#define SCIQLOP_DRAGDROPGUICONTROLLER_H #include #include @@ -12,7 +12,7 @@ class VisualizationDragWidget; class VisualizationDragDropContainer; class QMimeData; -Q_DECLARE_LOGGING_CATEGORY(LOG_DragDropHelper) +Q_DECLARE_LOGGING_CATEGORY(LOG_DragDropGuiController) /** * @brief Helper class for drag&drop operations. @@ -21,15 +21,15 @@ Q_DECLARE_LOGGING_CATEGORY(LOG_DragDropHelper) * can interect with the gui. * @see SqpApplication */ -class DragDropHelper { +class DragDropGuiController { public: static const QString MIME_TYPE_GRAPH; static const QString MIME_TYPE_ZONE; enum class PlaceHolderType { Default, Graph, Zone }; - DragDropHelper(); - virtual ~DragDropHelper(); + DragDropGuiController(); + virtual ~DragDropGuiController(); /// Resets some internal variables. Must be called before any new drag&drop operation. void resetDragAndDrop(); @@ -68,8 +68,8 @@ public: void doCloseWidgets(); private: - class DragDropHelperPrivate; - spimpl::unique_impl_ptr impl; + class DragDropGuiControllerPrivate; + spimpl::unique_impl_ptr impl; }; -#endif // SCIQLOP_DRAGDROPHELPER_H +#endif // SCIQLOP_DRAGDROPGUICONTROLLER_H diff --git a/gui/include/SqpApplication.h b/gui/include/SqpApplication.h index c9d37a2..5e2d6b9 100644 --- a/gui/include/SqpApplication.h +++ b/gui/include/SqpApplication.h @@ -20,7 +20,7 @@ class NetworkController; class TimeController; class VariableController; class VisualizationController; -class DragDropHelper; +class DragDropGuiController; /** * @brief The SqpApplication class aims to make the link between SciQlop @@ -47,7 +47,7 @@ public: /// Accessors for the differents sciqlop helpers, these helpers classes are like controllers but /// doesn't live in a thread and access gui - DragDropHelper &dragDropHelper() noexcept; + DragDropGuiController &dragDropGuiController() noexcept; enum class PlotsInteractionMode { None, ZoomBox, DragAndDrop, SelectionZones }; diff --git a/gui/include/Visualization/VisualizationDragDropContainer.h b/gui/include/Visualization/VisualizationDragDropContainer.h index 25150ae..b3e6436 100644 --- a/gui/include/Visualization/VisualizationDragDropContainer.h +++ b/gui/include/Visualization/VisualizationDragDropContainer.h @@ -9,7 +9,7 @@ #include -#include +#include Q_DECLARE_LOGGING_CATEGORY(LOG_VisualizationDragDropContainer) @@ -41,7 +41,7 @@ public: void setAcceptDragWidgetFunction(AcceptDragWidgetFunction fun); - void setPlaceHolderType(DragDropHelper::PlaceHolderType type, + void setPlaceHolderType(DragDropGuiController::PlaceHolderType type, const QString &placeHolderText = QString()); protected: diff --git a/gui/src/DataSource/DataSourceTreeWidget.cpp b/gui/src/DataSource/DataSourceTreeWidget.cpp index d8bc863..c95ebcd 100644 --- a/gui/src/DataSource/DataSourceTreeWidget.cpp +++ b/gui/src/DataSource/DataSourceTreeWidget.cpp @@ -4,7 +4,7 @@ #include "DataSource/DataSourceItem.h" #include "DataSource/DataSourceTreeWidgetItem.h" -#include "DragAndDrop/DragDropHelper.h" +#include "DragAndDrop/DragDropGuiController.h" #include "SqpApplication.h" #include @@ -42,6 +42,6 @@ QMimeData *DataSourceTreeWidget::mimeData(const QList items) void DataSourceTreeWidget::startDrag(Qt::DropActions supportedActions) { // Resets the drag&drop operations before it's starting - sqpApp->dragDropHelper().resetDragAndDrop(); + sqpApp->dragDropGuiController().resetDragAndDrop(); QTreeWidget::startDrag(supportedActions); } diff --git a/gui/src/DragAndDrop/DragDropHelper.cpp b/gui/src/DragAndDrop/DragDropGuiController.cpp similarity index 77% rename from gui/src/DragAndDrop/DragDropHelper.cpp rename to gui/src/DragAndDrop/DragDropGuiController.cpp index 88a6756..1546c22 100644 --- a/gui/src/DragAndDrop/DragDropHelper.cpp +++ b/gui/src/DragAndDrop/DragDropGuiController.cpp @@ -1,4 +1,4 @@ -#include "DragAndDrop/DragDropHelper.h" +#include "DragAndDrop/DragDropGuiController.h" #include "DragAndDrop/DragDropScroller.h" #include "DragAndDrop/DragDropTabSwitcher.h" #include "SqpApplication.h" @@ -19,10 +19,10 @@ #include -Q_LOGGING_CATEGORY(LOG_DragDropHelper, "DragDropHelper") +Q_LOGGING_CATEGORY(LOG_DragDropGuiController, "DragDropGuiController") -struct DragDropHelper::DragDropHelperPrivate { +struct DragDropGuiController::DragDropGuiControllerPrivate { VisualizationDragWidget *m_CurrentDragWidget = nullptr; std::unique_ptr m_PlaceHolder = nullptr; @@ -40,7 +40,7 @@ struct DragDropHelper::DragDropHelperPrivate { QList m_WidgetToClose; - explicit DragDropHelperPrivate() + explicit DragDropGuiControllerPrivate() : m_PlaceHolder{std::make_unique()}, m_DragDropScroller{std::make_unique()}, m_DragDropTabSwitcher{std::make_unique()} @@ -64,7 +64,8 @@ struct DragDropHelper::DragDropHelperPrivate { m_ImageTempUrl = QDir::temp().absoluteFilePath("Sciqlop_graph.png"); } - void preparePlaceHolder(DragDropHelper::PlaceHolderType type, const QString &topLabelText) const + void preparePlaceHolder(DragDropGuiController::PlaceHolderType type, + const QString &topLabelText) const { if (m_CurrentDragWidget) { m_PlaceHolder->setMinimumSize(m_CurrentDragWidget->size()); @@ -79,12 +80,12 @@ struct DragDropHelper::DragDropHelperPrivate { } switch (type) { - case DragDropHelper::PlaceHolderType::Graph: + case DragDropGuiController::PlaceHolderType::Graph: m_PlaceBackground->setStyleSheet( "background-color: #BBD5EE; border: 1px solid #2A7FD4"); break; - case DragDropHelper::PlaceHolderType::Zone: - case DragDropHelper::PlaceHolderType::Default: + case DragDropGuiController::PlaceHolderType::Zone: + case DragDropGuiController::PlaceHolderType::Default: m_PlaceBackground->setStyleSheet( "background-color: #BBD5EE; border: 2px solid #2A7FD4"); m_PlaceHolderLabel->setStyleSheet("color: #2A7FD4"); @@ -97,22 +98,23 @@ struct DragDropHelper::DragDropHelperPrivate { }; -DragDropHelper::DragDropHelper() : impl{spimpl::make_unique_impl()} +DragDropGuiController::DragDropGuiController() + : impl{spimpl::make_unique_impl()} { } -DragDropHelper::~DragDropHelper() +DragDropGuiController::~DragDropGuiController() { QFile::remove(impl->m_ImageTempUrl); } -void DragDropHelper::resetDragAndDrop() +void DragDropGuiController::resetDragAndDrop() { setCurrentDragWidget(nullptr); impl->m_HighlightedDragWidget = nullptr; } -void DragDropHelper::setCurrentDragWidget(VisualizationDragWidget *dragWidget) +void DragDropGuiController::setCurrentDragWidget(VisualizationDragWidget *dragWidget) { if (impl->m_CurrentDragWidget) { @@ -129,18 +131,18 @@ void DragDropHelper::setCurrentDragWidget(VisualizationDragWidget *dragWidget) impl->m_CurrentDragWidget = dragWidget; } -VisualizationDragWidget *DragDropHelper::getCurrentDragWidget() const +VisualizationDragWidget *DragDropGuiController::getCurrentDragWidget() const { return impl->m_CurrentDragWidget; } -QWidget &DragDropHelper::placeHolder() const +QWidget &DragDropGuiController::placeHolder() const { return *impl->m_PlaceHolder; } -void DragDropHelper::insertPlaceHolder(QVBoxLayout *layout, int index, PlaceHolderType type, - const QString &topLabelText) +void DragDropGuiController::insertPlaceHolder(QVBoxLayout *layout, int index, PlaceHolderType type, + const QString &topLabelText) { removePlaceHolder(); impl->preparePlaceHolder(type, topLabelText); @@ -148,7 +150,7 @@ void DragDropHelper::insertPlaceHolder(QVBoxLayout *layout, int index, PlaceHold impl->m_PlaceHolder->show(); } -void DragDropHelper::removePlaceHolder() +void DragDropGuiController::removePlaceHolder() { auto parentWidget = impl->m_PlaceHolder->parentWidget(); if (parentWidget) { @@ -158,38 +160,38 @@ void DragDropHelper::removePlaceHolder() } } -bool DragDropHelper::isPlaceHolderSet() const +bool DragDropGuiController::isPlaceHolderSet() const { return impl->m_PlaceHolder->parentWidget(); } -void DragDropHelper::addDragDropScrollArea(QScrollArea *scrollArea) +void DragDropGuiController::addDragDropScrollArea(QScrollArea *scrollArea) { impl->m_DragDropScroller->addScrollArea(scrollArea); } -void DragDropHelper::removeDragDropScrollArea(QScrollArea *scrollArea) +void DragDropGuiController::removeDragDropScrollArea(QScrollArea *scrollArea) { impl->m_DragDropScroller->removeScrollArea(scrollArea); } -void DragDropHelper::addDragDropTabBar(QTabBar *tabBar) +void DragDropGuiController::addDragDropTabBar(QTabBar *tabBar) { impl->m_DragDropTabSwitcher->addTabBar(tabBar); } -void DragDropHelper::removeDragDropTabBar(QTabBar *tabBar) +void DragDropGuiController::removeDragDropTabBar(QTabBar *tabBar) { impl->m_DragDropTabSwitcher->removeTabBar(tabBar); } -QUrl DragDropHelper::imageTemporaryUrl(const QImage &image) const +QUrl DragDropGuiController::imageTemporaryUrl(const QImage &image) const { image.save(impl->m_ImageTempUrl); return QUrl::fromLocalFile(impl->m_ImageTempUrl); } -void DragDropHelper::setHightlightedDragWidget(VisualizationDragWidget *dragWidget) +void DragDropGuiController::setHightlightedDragWidget(VisualizationDragWidget *dragWidget) { if (impl->m_HighlightedDragWidget) { impl->m_HighlightedDragWidget->highlightForMerge(false); @@ -208,18 +210,18 @@ void DragDropHelper::setHightlightedDragWidget(VisualizationDragWidget *dragWidg impl->m_HighlightedDragWidget = dragWidget; } -VisualizationDragWidget *DragDropHelper::getHightlightedDragWidget() const +VisualizationDragWidget *DragDropGuiController::getHightlightedDragWidget() const { return impl->m_HighlightedDragWidget; } -void DragDropHelper::delayedCloseWidget(QWidget *widget) +void DragDropGuiController::delayedCloseWidget(QWidget *widget) { widget->hide(); impl->m_WidgetToClose << widget; } -void DragDropHelper::doCloseWidgets() +void DragDropGuiController::doCloseWidgets() { for (auto widget : impl->m_WidgetToClose) { widget->close(); @@ -228,12 +230,12 @@ void DragDropHelper::doCloseWidgets() impl->m_WidgetToClose.clear(); } -bool DragDropHelper::checkMimeDataForVisualization(const QMimeData *mimeData, - VisualizationDragDropContainer *dropContainer) +bool DragDropGuiController::checkMimeDataForVisualization( + const QMimeData *mimeData, VisualizationDragDropContainer *dropContainer) { if (!mimeData || !dropContainer) { - qCWarning(LOG_DragDropHelper()) << QObject::tr( - "DragDropHelper::checkMimeDataForVisualization, invalid input parameters."); + qCWarning(LOG_DragDropGuiController()) << QObject::tr( + "DragDropGuiController::checkMimeDataForVisualization, invalid input parameters."); Q_ASSERT(false); return false; } @@ -270,8 +272,8 @@ bool DragDropHelper::checkMimeDataForVisualization(const QMimeData *mimeData, } } else { - qCWarning(LOG_DragDropHelper()) << QObject::tr( - "DragDropHelper::checkMimeDataForVisualization, the parent " + qCWarning(LOG_DragDropGuiController()) << QObject::tr( + "DragDropGuiController::checkMimeDataForVisualization, the parent " "VisualizationWidget cannot be found. Cannot check if the variable is " "already used or not."); } diff --git a/gui/src/SqpApplication.cpp b/gui/src/SqpApplication.cpp index 4e676ed..e2f1f43 100644 --- a/gui/src/SqpApplication.cpp +++ b/gui/src/SqpApplication.cpp @@ -3,7 +3,7 @@ #include #include #include -#include +#include #include #include #include