##// END OF EJS Templates
Rename "DragDropHelper" in "DragDropGuiController"
trabillard -
r1110:029fbf916457
parent child
Show More
@@ -1,5 +1,5
1 #ifndef SCIQLOP_DRAGDROPHELPER_H
2 #define SCIQLOP_DRAGDROPHELPER_H
1 #ifndef SCIQLOP_DRAGDROPGUICONTROLLER_H
2 #define SCIQLOP_DRAGDROPGUICONTROLLER_H
3 3
4 4 #include <Common/spimpl.h>
5 5 #include <QLoggingCategory>
@@ -12,7 +12,7 class VisualizationDragWidget;
12 12 class VisualizationDragDropContainer;
13 13 class QMimeData;
14 14
15 Q_DECLARE_LOGGING_CATEGORY(LOG_DragDropHelper)
15 Q_DECLARE_LOGGING_CATEGORY(LOG_DragDropGuiController)
16 16
17 17 /**
18 18 * @brief Helper class for drag&drop operations.
@@ -21,15 +21,15 Q_DECLARE_LOGGING_CATEGORY(LOG_DragDropHelper)
21 21 * can interect with the gui.
22 22 * @see SqpApplication
23 23 */
24 class DragDropHelper {
24 class DragDropGuiController {
25 25 public:
26 26 static const QString MIME_TYPE_GRAPH;
27 27 static const QString MIME_TYPE_ZONE;
28 28
29 29 enum class PlaceHolderType { Default, Graph, Zone };
30 30
31 DragDropHelper();
32 virtual ~DragDropHelper();
31 DragDropGuiController();
32 virtual ~DragDropGuiController();
33 33
34 34 /// Resets some internal variables. Must be called before any new drag&drop operation.
35 35 void resetDragAndDrop();
@@ -68,8 +68,8 public:
68 68 void doCloseWidgets();
69 69
70 70 private:
71 class DragDropHelperPrivate;
72 spimpl::unique_impl_ptr<DragDropHelperPrivate> impl;
71 class DragDropGuiControllerPrivate;
72 spimpl::unique_impl_ptr<DragDropGuiControllerPrivate> impl;
73 73 };
74 74
75 #endif // SCIQLOP_DRAGDROPHELPER_H
75 #endif // SCIQLOP_DRAGDROPGUICONTROLLER_H
@@ -20,7 +20,7 class NetworkController;
20 20 class TimeController;
21 21 class VariableController;
22 22 class VisualizationController;
23 class DragDropHelper;
23 class DragDropGuiController;
24 24
25 25 /**
26 26 * @brief The SqpApplication class aims to make the link between SciQlop
@@ -47,7 +47,7 public:
47 47
48 48 /// Accessors for the differents sciqlop helpers, these helpers classes are like controllers but
49 49 /// doesn't live in a thread and access gui
50 DragDropHelper &dragDropHelper() noexcept;
50 DragDropGuiController &dragDropGuiController() noexcept;
51 51
52 52 enum class PlotsInteractionMode { None, ZoomBox, DragAndDrop, SelectionZones };
53 53
@@ -9,7 +9,7
9 9
10 10 #include <functional>
11 11
12 #include <DragAndDrop/DragDropHelper.h>
12 #include <DragAndDrop/DragDropGuiController.h>
13 13
14 14 Q_DECLARE_LOGGING_CATEGORY(LOG_VisualizationDragDropContainer)
15 15
@@ -41,7 +41,7 public:
41 41
42 42 void setAcceptDragWidgetFunction(AcceptDragWidgetFunction fun);
43 43
44 void setPlaceHolderType(DragDropHelper::PlaceHolderType type,
44 void setPlaceHolderType(DragDropGuiController::PlaceHolderType type,
45 45 const QString &placeHolderText = QString());
46 46
47 47 protected:
@@ -4,7 +4,7
4 4 #include "DataSource/DataSourceItem.h"
5 5 #include "DataSource/DataSourceTreeWidgetItem.h"
6 6
7 #include "DragAndDrop/DragDropHelper.h"
7 #include "DragAndDrop/DragDropGuiController.h"
8 8 #include "SqpApplication.h"
9 9
10 10 #include <QMimeData>
@@ -42,6 +42,6 QMimeData *DataSourceTreeWidget::mimeData(const QList<QTreeWidgetItem *> items)
42 42 void DataSourceTreeWidget::startDrag(Qt::DropActions supportedActions)
43 43 {
44 44 // Resets the drag&drop operations before it's starting
45 sqpApp->dragDropHelper().resetDragAndDrop();
45 sqpApp->dragDropGuiController().resetDragAndDrop();
46 46 QTreeWidget::startDrag(supportedActions);
47 47 }
@@ -1,4 +1,4
1 #include "DragAndDrop/DragDropHelper.h"
1 #include "DragAndDrop/DragDropGuiController.h"
2 2 #include "DragAndDrop/DragDropScroller.h"
3 3 #include "DragAndDrop/DragDropTabSwitcher.h"
4 4 #include "SqpApplication.h"
@@ -19,10 +19,10
19 19 #include <QVBoxLayout>
20 20
21 21
22 Q_LOGGING_CATEGORY(LOG_DragDropHelper, "DragDropHelper")
22 Q_LOGGING_CATEGORY(LOG_DragDropGuiController, "DragDropGuiController")
23 23
24 24
25 struct DragDropHelper::DragDropHelperPrivate {
25 struct DragDropGuiController::DragDropGuiControllerPrivate {
26 26
27 27 VisualizationDragWidget *m_CurrentDragWidget = nullptr;
28 28 std::unique_ptr<QWidget> m_PlaceHolder = nullptr;
@@ -40,7 +40,7 struct DragDropHelper::DragDropHelperPrivate {
40 40
41 41 QList<QWidget *> m_WidgetToClose;
42 42
43 explicit DragDropHelperPrivate()
43 explicit DragDropGuiControllerPrivate()
44 44 : m_PlaceHolder{std::make_unique<QWidget>()},
45 45 m_DragDropScroller{std::make_unique<DragDropScroller>()},
46 46 m_DragDropTabSwitcher{std::make_unique<DragDropTabSwitcher>()}
@@ -64,7 +64,8 struct DragDropHelper::DragDropHelperPrivate {
64 64 m_ImageTempUrl = QDir::temp().absoluteFilePath("Sciqlop_graph.png");
65 65 }
66 66
67 void preparePlaceHolder(DragDropHelper::PlaceHolderType type, const QString &topLabelText) const
67 void preparePlaceHolder(DragDropGuiController::PlaceHolderType type,
68 const QString &topLabelText) const
68 69 {
69 70 if (m_CurrentDragWidget) {
70 71 m_PlaceHolder->setMinimumSize(m_CurrentDragWidget->size());
@@ -79,12 +80,12 struct DragDropHelper::DragDropHelperPrivate {
79 80 }
80 81
81 82 switch (type) {
82 case DragDropHelper::PlaceHolderType::Graph:
83 case DragDropGuiController::PlaceHolderType::Graph:
83 84 m_PlaceBackground->setStyleSheet(
84 85 "background-color: #BBD5EE; border: 1px solid #2A7FD4");
85 86 break;
86 case DragDropHelper::PlaceHolderType::Zone:
87 case DragDropHelper::PlaceHolderType::Default:
87 case DragDropGuiController::PlaceHolderType::Zone:
88 case DragDropGuiController::PlaceHolderType::Default:
88 89 m_PlaceBackground->setStyleSheet(
89 90 "background-color: #BBD5EE; border: 2px solid #2A7FD4");
90 91 m_PlaceHolderLabel->setStyleSheet("color: #2A7FD4");
@@ -97,22 +98,23 struct DragDropHelper::DragDropHelperPrivate {
97 98 };
98 99
99 100
100 DragDropHelper::DragDropHelper() : impl{spimpl::make_unique_impl<DragDropHelperPrivate>()}
101 DragDropGuiController::DragDropGuiController()
102 : impl{spimpl::make_unique_impl<DragDropGuiControllerPrivate>()}
101 103 {
102 104 }
103 105
104 DragDropHelper::~DragDropHelper()
106 DragDropGuiController::~DragDropGuiController()
105 107 {
106 108 QFile::remove(impl->m_ImageTempUrl);
107 109 }
108 110
109 void DragDropHelper::resetDragAndDrop()
111 void DragDropGuiController::resetDragAndDrop()
110 112 {
111 113 setCurrentDragWidget(nullptr);
112 114 impl->m_HighlightedDragWidget = nullptr;
113 115 }
114 116
115 void DragDropHelper::setCurrentDragWidget(VisualizationDragWidget *dragWidget)
117 void DragDropGuiController::setCurrentDragWidget(VisualizationDragWidget *dragWidget)
116 118 {
117 119 if (impl->m_CurrentDragWidget) {
118 120
@@ -129,18 +131,18 void DragDropHelper::setCurrentDragWidget(VisualizationDragWidget *dragWidget)
129 131 impl->m_CurrentDragWidget = dragWidget;
130 132 }
131 133
132 VisualizationDragWidget *DragDropHelper::getCurrentDragWidget() const
134 VisualizationDragWidget *DragDropGuiController::getCurrentDragWidget() const
133 135 {
134 136 return impl->m_CurrentDragWidget;
135 137 }
136 138
137 QWidget &DragDropHelper::placeHolder() const
139 QWidget &DragDropGuiController::placeHolder() const
138 140 {
139 141 return *impl->m_PlaceHolder;
140 142 }
141 143
142 void DragDropHelper::insertPlaceHolder(QVBoxLayout *layout, int index, PlaceHolderType type,
143 const QString &topLabelText)
144 void DragDropGuiController::insertPlaceHolder(QVBoxLayout *layout, int index, PlaceHolderType type,
145 const QString &topLabelText)
144 146 {
145 147 removePlaceHolder();
146 148 impl->preparePlaceHolder(type, topLabelText);
@@ -148,7 +150,7 void DragDropHelper::insertPlaceHolder(QVBoxLayout *layout, int index, PlaceHold
148 150 impl->m_PlaceHolder->show();
149 151 }
150 152
151 void DragDropHelper::removePlaceHolder()
153 void DragDropGuiController::removePlaceHolder()
152 154 {
153 155 auto parentWidget = impl->m_PlaceHolder->parentWidget();
154 156 if (parentWidget) {
@@ -158,38 +160,38 void DragDropHelper::removePlaceHolder()
158 160 }
159 161 }
160 162
161 bool DragDropHelper::isPlaceHolderSet() const
163 bool DragDropGuiController::isPlaceHolderSet() const
162 164 {
163 165 return impl->m_PlaceHolder->parentWidget();
164 166 }
165 167
166 void DragDropHelper::addDragDropScrollArea(QScrollArea *scrollArea)
168 void DragDropGuiController::addDragDropScrollArea(QScrollArea *scrollArea)
167 169 {
168 170 impl->m_DragDropScroller->addScrollArea(scrollArea);
169 171 }
170 172
171 void DragDropHelper::removeDragDropScrollArea(QScrollArea *scrollArea)
173 void DragDropGuiController::removeDragDropScrollArea(QScrollArea *scrollArea)
172 174 {
173 175 impl->m_DragDropScroller->removeScrollArea(scrollArea);
174 176 }
175 177
176 void DragDropHelper::addDragDropTabBar(QTabBar *tabBar)
178 void DragDropGuiController::addDragDropTabBar(QTabBar *tabBar)
177 179 {
178 180 impl->m_DragDropTabSwitcher->addTabBar(tabBar);
179 181 }
180 182
181 void DragDropHelper::removeDragDropTabBar(QTabBar *tabBar)
183 void DragDropGuiController::removeDragDropTabBar(QTabBar *tabBar)
182 184 {
183 185 impl->m_DragDropTabSwitcher->removeTabBar(tabBar);
184 186 }
185 187
186 QUrl DragDropHelper::imageTemporaryUrl(const QImage &image) const
188 QUrl DragDropGuiController::imageTemporaryUrl(const QImage &image) const
187 189 {
188 190 image.save(impl->m_ImageTempUrl);
189 191 return QUrl::fromLocalFile(impl->m_ImageTempUrl);
190 192 }
191 193
192 void DragDropHelper::setHightlightedDragWidget(VisualizationDragWidget *dragWidget)
194 void DragDropGuiController::setHightlightedDragWidget(VisualizationDragWidget *dragWidget)
193 195 {
194 196 if (impl->m_HighlightedDragWidget) {
195 197 impl->m_HighlightedDragWidget->highlightForMerge(false);
@@ -208,18 +210,18 void DragDropHelper::setHightlightedDragWidget(VisualizationDragWidget *dragWidg
208 210 impl->m_HighlightedDragWidget = dragWidget;
209 211 }
210 212
211 VisualizationDragWidget *DragDropHelper::getHightlightedDragWidget() const
213 VisualizationDragWidget *DragDropGuiController::getHightlightedDragWidget() const
212 214 {
213 215 return impl->m_HighlightedDragWidget;
214 216 }
215 217
216 void DragDropHelper::delayedCloseWidget(QWidget *widget)
218 void DragDropGuiController::delayedCloseWidget(QWidget *widget)
217 219 {
218 220 widget->hide();
219 221 impl->m_WidgetToClose << widget;
220 222 }
221 223
222 void DragDropHelper::doCloseWidgets()
224 void DragDropGuiController::doCloseWidgets()
223 225 {
224 226 for (auto widget : impl->m_WidgetToClose) {
225 227 widget->close();
@@ -228,12 +230,12 void DragDropHelper::doCloseWidgets()
228 230 impl->m_WidgetToClose.clear();
229 231 }
230 232
231 bool DragDropHelper::checkMimeDataForVisualization(const QMimeData *mimeData,
232 VisualizationDragDropContainer *dropContainer)
233 bool DragDropGuiController::checkMimeDataForVisualization(
234 const QMimeData *mimeData, VisualizationDragDropContainer *dropContainer)
233 235 {
234 236 if (!mimeData || !dropContainer) {
235 qCWarning(LOG_DragDropHelper()) << QObject::tr(
236 "DragDropHelper::checkMimeDataForVisualization, invalid input parameters.");
237 qCWarning(LOG_DragDropGuiController()) << QObject::tr(
238 "DragDropGuiController::checkMimeDataForVisualization, invalid input parameters.");
237 239 Q_ASSERT(false);
238 240 return false;
239 241 }
@@ -270,8 +272,8 bool DragDropHelper::checkMimeDataForVisualization(const QMimeData *mimeData,
270 272 }
271 273 }
272 274 else {
273 qCWarning(LOG_DragDropHelper()) << QObject::tr(
274 "DragDropHelper::checkMimeDataForVisualization, the parent "
275 qCWarning(LOG_DragDropGuiController()) << QObject::tr(
276 "DragDropGuiController::checkMimeDataForVisualization, the parent "
275 277 "VisualizationWidget cannot be found. Cannot check if the variable is "
276 278 "already used or not.");
277 279 }
@@ -3,7 +3,7
3 3 #include <Catalogue/CatalogueController.h>
4 4 #include <Data/IDataProvider.h>
5 5 #include <DataSource/DataSourceController.h>
6 #include <DragAndDrop/DragDropHelper.h>
6 #include <DragAndDrop/DragDropGuiController.h>
7 7 #include <Network/NetworkController.h>
8 8 #include <QThread>
9 9 #include <Time/TimeController.h>
@@ -22,7 +22,7 public:
22 22 m_TimeController{std::make_unique<TimeController>()},
23 23 m_NetworkController{std::make_unique<NetworkController>()},
24 24 m_VisualizationController{std::make_unique<VisualizationController>()},
25 m_DragDropHelper{std::make_unique<DragDropHelper>()},
25 m_DragDropGuiController{std::make_unique<DragDropGuiController>()},
26 26 m_CatalogueController{std::make_unique<CatalogueController>()},
27 27 m_PlotInterractionMode(SqpApplication::PlotsInteractionMode::None),
28 28 m_PlotCursorMode(SqpApplication::PlotsCursorMode::NoCursor)
@@ -100,7 +100,7 public:
100 100 QThread m_VisualizationControllerThread;
101 101 QThread m_CatalogueControllerThread;
102 102
103 std::unique_ptr<DragDropHelper> m_DragDropHelper;
103 std::unique_ptr<DragDropGuiController> m_DragDropGuiController;
104 104
105 105 SqpApplication::PlotsInteractionMode m_PlotInterractionMode;
106 106 SqpApplication::PlotsCursorMode m_PlotCursorMode;
@@ -177,9 +177,9 VisualizationController &SqpApplication::visualizationController() noexcept
177 177 return *impl->m_VisualizationController;
178 178 }
179 179
180 DragDropHelper &SqpApplication::dragDropHelper() noexcept
180 DragDropGuiController &SqpApplication::dragDropGuiController() noexcept
181 181 {
182 return *impl->m_DragDropHelper;
182 return *impl->m_DragDropGuiController;
183 183 }
184 184
185 185 SqpApplication::PlotsInteractionMode SqpApplication::plotsInteractionMode() const
@@ -4,7 +4,7
4 4 #include <Common/DateUtils.h>
5 5 #include <Common/MimeTypesDef.h>
6 6
7 #include <DragAndDrop/DragDropHelper.h>
7 #include <DragAndDrop/DragDropGuiController.h>
8 8 #include <SqpApplication.h>
9 9 #include <Time/TimeController.h>
10 10
@@ -145,7 +145,7 void TimeWidget::mouseMoveEvent(QMouseEvent *event)
145 145 auto pixmap = QPixmap{":/icones/time.png"};
146 146 drag->setPixmap(pixmap.scaledToWidth(22));
147 147
148 sqpApp->dragDropHelper().resetDragAndDrop();
148 sqpApp->dragDropGuiController().resetDragAndDrop();
149 149
150 150 // Note: The exec() is blocking on windows but not on linux and macOS
151 151 drag->exec(Qt::MoveAction | Qt::CopyAction);
@@ -1,6 +1,6
1 1 #include "Variable/VariableInspectorTableView.h"
2 2
3 #include "DragAndDrop/DragDropHelper.h"
3 #include "DragAndDrop/DragDropGuiController.h"
4 4 #include "SqpApplication.h"
5 5
6 6 VariableInspectorTableView::VariableInspectorTableView(QWidget *parent) : QTableView(parent)
@@ -10,6 +10,6 VariableInspectorTableView::VariableInspectorTableView(QWidget *parent) : QTable
10 10 void VariableInspectorTableView::startDrag(Qt::DropActions supportedActions)
11 11 {
12 12 // Resets the drag&drop operations before it's starting
13 sqpApp->dragDropHelper().resetDragAndDrop();
13 sqpApp->dragDropGuiController().resetDragAndDrop();
14 14 QTableView::startDrag(supportedActions);
15 15 }
@@ -12,7 +12,7
12 12 #include <QStyledItemDelegate>
13 13 #include <QWidgetAction>
14 14
15 #include <DragAndDrop/DragDropHelper.h>
15 #include <DragAndDrop/DragDropGuiController.h>
16 16 #include <SqpApplication.h>
17 17
18 18 Q_LOGGING_CATEGORY(LOG_VariableInspectorWidget, "VariableInspectorWidget")
@@ -1,5 +1,5
1 1 #include "Visualization/VisualizationDragDropContainer.h"
2 #include "DragAndDrop/DragDropHelper.h"
2 #include "DragAndDrop/DragDropGuiController.h"
3 3 #include "SqpApplication.h"
4 4 #include "Visualization/VisualizationDragWidget.h"
5 5
@@ -21,7 +21,7 struct VisualizationDragDropContainer::VisualizationDragDropContainerPrivate {
21 21 QVBoxLayout *m_Layout;
22 22 QHash<QString, VisualizationDragDropContainer::DropBehavior> m_AcceptedMimeTypes;
23 23 QString m_PlaceHolderText;
24 DragDropHelper::PlaceHolderType m_PlaceHolderType;
24 DragDropGuiController::PlaceHolderType m_PlaceHolderType;
25 25
26 26 VisualizationDragDropContainer::AcceptMimeDataFunction m_AcceptMimeDataFun
27 27 = [](auto mimeData) { return true; };
@@ -31,7 +31,7 struct VisualizationDragDropContainer::VisualizationDragDropContainerPrivate {
31 31 int m_MinContainerHeight = 0;
32 32
33 33 explicit VisualizationDragDropContainerPrivate(QWidget *widget)
34 : m_PlaceHolderType(DragDropHelper::PlaceHolderType::Graph)
34 : m_PlaceHolderType(DragDropGuiController::PlaceHolderType::Graph)
35 35 {
36 36 m_Layout = new QVBoxLayout(widget);
37 37 m_Layout->setContentsMargins(0, 0, 0, 0);
@@ -104,7 +104,8 struct VisualizationDragDropContainer::VisualizationDragDropContainerPrivate {
104 104
105 105 bool hasPlaceHolder() const
106 106 {
107 return sqpApp->dragDropHelper().placeHolder().parentWidget() == m_Layout->parentWidget();
107 return sqpApp->dragDropGuiController().placeHolder().parentWidget()
108 == m_Layout->parentWidget();
108 109 }
109 110
110 111 VisualizationDragWidget *getChildDragWidgetAt(const QWidget *parent, const QPoint &pos) const
@@ -128,7 +129,7 struct VisualizationDragDropContainer::VisualizationDragDropContainerPrivate {
128 129 {
129 130 auto widgetUnderMouse = sqpApp->widgetAt(QCursor::pos());
130 131 return container->isAncestorOf(widgetUnderMouse) && widgetUnderMouse != container
131 && sqpApp->dragDropHelper().placeHolder().isAncestorOf(widgetUnderMouse);
132 && sqpApp->dragDropGuiController().placeHolder().isAncestorOf(widgetUnderMouse);
132 133 }
133 134
134 135 int countDragWidget(const QWidget *parent, bool onlyVisible = false) const
@@ -196,7 +197,7 void VisualizationDragDropContainer::setAcceptDragWidgetFunction(
196 197 impl->m_AcceptDragWidgetFun = fun;
197 198 }
198 199
199 void VisualizationDragDropContainer::setPlaceHolderType(DragDropHelper::PlaceHolderType type,
200 void VisualizationDragDropContainer::setPlaceHolderType(DragDropGuiController::PlaceHolderType type,
200 201 const QString &placeHolderText)
201 202 {
202 203 impl->m_PlaceHolderType = type;
@@ -206,7 +207,7 void VisualizationDragDropContainer::setPlaceHolderType(DragDropHelper::PlaceHol
206 207 void VisualizationDragDropContainer::startDrag(VisualizationDragWidget *dragWidget,
207 208 const QPoint &dragPosition)
208 209 {
209 auto &helper = sqpApp->dragDropHelper();
210 auto &helper = sqpApp->dragDropGuiController();
210 211 helper.resetDragAndDrop();
211 212
212 213 // Note: The management of the drag object is done by Qt
@@ -261,7 +262,7 void VisualizationDragDropContainer::dragEnterEvent(QDragEnterEvent *event)
261 262 if (impl->acceptMimeData(event->mimeData())) {
262 263 event->acceptProposedAction();
263 264
264 auto &helper = sqpApp->dragDropHelper();
265 auto &helper = sqpApp->dragDropGuiController();
265 266
266 267 if (!impl->hasPlaceHolder()) {
267 268 auto dragWidget = helper.getCurrentDragWidget();
@@ -298,7 +299,7 void VisualizationDragDropContainer::dragLeaveEvent(QDragLeaveEvent *event)
298 299 {
299 300 Q_UNUSED(event);
300 301
301 auto &helper = sqpApp->dragDropHelper();
302 auto &helper = sqpApp->dragDropGuiController();
302 303
303 304 if (!impl->cursorIsInContainer(this)) {
304 305 helper.removePlaceHolder();
@@ -342,7 +343,7 void VisualizationDragDropContainer::dragMoveEvent(QDragMoveEvent *event)
342 343
343 344 void VisualizationDragDropContainer::dropEvent(QDropEvent *event)
344 345 {
345 auto &helper = sqpApp->dragDropHelper();
346 auto &helper = sqpApp->dragDropGuiController();
346 347
347 348 if (impl->acceptMimeData(event->mimeData())) {
348 349 auto dragWidget = helper.getCurrentDragWidget();
@@ -398,7 +399,7 void VisualizationDragDropContainer::dropEvent(QDropEvent *event)
398 399 event->ignore();
399 400 }
400 401
401 sqpApp->dragDropHelper().setHightlightedDragWidget(nullptr);
402 sqpApp->dragDropGuiController().setHightlightedDragWidget(nullptr);
402 403 impl->m_MinContainerHeight = 0;
403 404
404 405 QWidget::dropEvent(event);
@@ -409,7 +410,7 bool VisualizationDragDropContainer::VisualizationDragDropContainerPrivate::find
409 410 const QPoint &pos, const QMimeData *mimeData, bool canInsert, bool canMerge,
410 411 const VisualizationDragDropContainer *container)
411 412 {
412 auto &helper = sqpApp->dragDropHelper();
413 auto &helper = sqpApp->dragDropGuiController();
413 414
414 415 auto absPos = container->mapToGlobal(pos);
415 416 auto isOnPlaceHolder = helper.placeHolder().isAncestorOf(sqpApp->widgetAt(absPos));
@@ -14,7 +14,7
14 14 #include <Data/ArrayData.h>
15 15 #include <Data/IDataSeries.h>
16 16 #include <Data/SpectrogramSeries.h>
17 #include <DragAndDrop/DragDropHelper.h>
17 #include <DragAndDrop/DragDropGuiController.h>
18 18 #include <Settings/SqpSettingsDefs.h>
19 19 #include <SqpApplication.h>
20 20 #include <Time/TimeController.h>
@@ -11,7 +11,7
11 11
12 12 #include "Common/MimeTypesDef.h"
13 13
14 #include "DragAndDrop/DragDropHelper.h"
14 #include "DragAndDrop/DragDropGuiController.h"
15 15 #include "SqpApplication.h"
16 16
17 17 Q_LOGGING_CATEGORY(LOG_VisualizationTabWidget, "VisualizationTabWidget")
@@ -78,7 +78,7 VisualizationTabWidget::VisualizationTabWidget(const QString &name, QWidget *par
78 78 impl->m_MacScrollBarStyle->selfInstallOn(ui->scrollArea, true);
79 79 #endif
80 80
81 ui->dragDropContainer->setPlaceHolderType(DragDropHelper::PlaceHolderType::Zone, "Zone");
81 ui->dragDropContainer->setPlaceHolderType(DragDropGuiController::PlaceHolderType::Zone, "Zone");
82 82 ui->dragDropContainer->layout()->setContentsMargins(0, 0, 0, 12);
83 83 ui->dragDropContainer->layout()->setSpacing(0);
84 84 ui->dragDropContainer->setMimeType(MIME_TYPE_GRAPH,
@@ -89,14 +89,14 VisualizationTabWidget::VisualizationTabWidget(const QString &name, QWidget *par
89 89 VisualizationDragDropContainer::DropBehavior::Inserted);
90 90
91 91 ui->dragDropContainer->setAcceptMimeDataFunction([this](auto mimeData) {
92 return sqpApp->dragDropHelper().checkMimeDataForVisualization(mimeData,
93 ui->dragDropContainer);
92 return sqpApp->dragDropGuiController().checkMimeDataForVisualization(mimeData,
93 ui->dragDropContainer);
94 94 });
95 95
96 96 connect(ui->dragDropContainer, &VisualizationDragDropContainer::dropOccuredInContainer, this,
97 97 &VisualizationTabWidget::dropMimeData);
98 98
99 sqpApp->dragDropHelper().addDragDropScrollArea(ui->scrollArea);
99 sqpApp->dragDropGuiController().addDragDropScrollArea(ui->scrollArea);
100 100
101 101 // Widget is deleted when closed
102 102 setAttribute(Qt::WA_DeleteOnClose);
@@ -104,7 +104,7 VisualizationTabWidget::VisualizationTabWidget(const QString &name, QWidget *par
104 104
105 105 VisualizationTabWidget::~VisualizationTabWidget()
106 106 {
107 sqpApp->dragDropHelper().removeDragDropScrollArea(ui->scrollArea);
107 sqpApp->dragDropGuiController().removeDragDropScrollArea(ui->scrollArea);
108 108 delete ui;
109 109 }
110 110
@@ -213,7 +213,7 void VisualizationTabWidget::dropMimeData(int index, const QMimeData *mimeData)
213 213 void VisualizationTabWidget::VisualizationTabWidgetPrivate::dropGraph(
214 214 int index, VisualizationTabWidget *tabWidget)
215 215 {
216 auto &helper = sqpApp->dragDropHelper();
216 auto &helper = sqpApp->dragDropGuiController();
217 217
218 218 auto graphWidget = qobject_cast<VisualizationGraphWidget *>(helper.getCurrentDragWidget());
219 219 if (!graphWidget) {
@@ -286,7 +286,7 void VisualizationTabWidget::VisualizationTabWidgetPrivate::dropGraph(
286 286 void VisualizationTabWidget::VisualizationTabWidgetPrivate::dropZone(
287 287 int index, VisualizationTabWidget *tabWidget)
288 288 {
289 auto &helper = sqpApp->dragDropHelper();
289 auto &helper = sqpApp->dragDropGuiController();
290 290
291 291 auto zoneWidget = qobject_cast<VisualizationZoneWidget *>(helper.getCurrentDragWidget());
292 292 if (!zoneWidget) {
@@ -12,7 +12,7
12 12
13 13 #include "ui_VisualizationWidget.h"
14 14
15 #include "DragAndDrop/DragDropHelper.h"
15 #include "DragAndDrop/DragDropGuiController.h"
16 16 #include "SqpApplication.h"
17 17
18 18 #include <QToolButton>
@@ -84,7 +84,7 VisualizationWidget::VisualizationWidget(QWidget *parent)
84 84 connect(addTabViewButton, &QToolButton::clicked, addTabView);
85 85 connect(ui->tabWidget, &QTabWidget::tabCloseRequested, removeTabView);
86 86
87 sqpApp->dragDropHelper().addDragDropTabBar(ui->tabWidget->tabBar());
87 sqpApp->dragDropGuiController().addDragDropTabBar(ui->tabWidget->tabBar());
88 88
89 89 // Adds default tab
90 90 addTabView();
@@ -92,7 +92,7 VisualizationWidget::VisualizationWidget(QWidget *parent)
92 92
93 93 VisualizationWidget::~VisualizationWidget()
94 94 {
95 sqpApp->dragDropHelper().removeDragDropTabBar(ui->tabWidget->tabBar());
95 sqpApp->dragDropGuiController().removeDragDropTabBar(ui->tabWidget->tabBar());
96 96 delete ui;
97 97 }
98 98
@@ -16,7 +16,7
16 16
17 17 #include <Visualization/operations/FindVariableOperation.h>
18 18
19 #include <DragAndDrop/DragDropHelper.h>
19 #include <DragAndDrop/DragDropGuiController.h>
20 20 #include <QUuid>
21 21 #include <SqpApplication.h>
22 22 #include <cmath>
@@ -86,7 +86,7 VisualizationZoneWidget::VisualizationZoneWidget(const QString &name, QWidget *p
86 86
87 87 ui->zoneNameLabel->setText(name);
88 88
89 ui->dragDropContainer->setPlaceHolderType(DragDropHelper::PlaceHolderType::Graph);
89 ui->dragDropContainer->setPlaceHolderType(DragDropGuiController::PlaceHolderType::Graph);
90 90 ui->dragDropContainer->setMimeType(MIME_TYPE_GRAPH,
91 91 VisualizationDragDropContainer::DropBehavior::Inserted);
92 92 ui->dragDropContainer->setMimeType(
@@ -98,8 +98,8 VisualizationZoneWidget::VisualizationZoneWidget(const QString &name, QWidget *p
98 98 ui->dragDropContainer->setMimeType(MIME_TYPE_SELECTION_ZONE,
99 99 VisualizationDragDropContainer::DropBehavior::Forbidden);
100 100 ui->dragDropContainer->setAcceptMimeDataFunction([this](auto mimeData) {
101 return sqpApp->dragDropHelper().checkMimeDataForVisualization(mimeData,
102 ui->dragDropContainer);
101 return sqpApp->dragDropGuiController().checkMimeDataForVisualization(mimeData,
102 ui->dragDropContainer);
103 103 });
104 104
105 105 auto acceptDragWidgetFun = [](auto dragWidget, auto mimeData) {
@@ -501,7 +501,7 void VisualizationZoneWidget::dropMimeDataOnGraph(VisualizationDragWidget *dragW
501 501 void VisualizationZoneWidget::VisualizationZoneWidgetPrivate::dropGraph(
502 502 int index, VisualizationZoneWidget *zoneWidget)
503 503 {
504 auto &helper = sqpApp->dragDropHelper();
504 auto &helper = sqpApp->dragDropGuiController();
505 505
506 506 auto graphWidget = qobject_cast<VisualizationGraphWidget *>(helper.getCurrentDragWidget());
507 507 if (!graphWidget) {
General Comments 4
Under Review
author

Auto status change to "Under Review"

Approved

Status change > Approved

Approved

Status change > Approved

You need to be logged in to leave comments. Login now