RemoveVariableOperation.cpp
74 lines
| 2.1 KiB
| text/x-c
|
CppLexer
Alexandre Leroux
|
r333 | #include "Visualization/operations/RemoveVariableOperation.h" | ||
#include "Visualization/VisualizationGraphWidget.h" | ||||
r1420 | #include <Variable/Variable2.h> | |||
Alexandre Leroux
|
r333 | |||
Q_LOGGING_CATEGORY(LOG_RemoveVariableOperation, "RemoveVariableOperation") | ||||
r1420 | struct RemoveVariableOperation::RemoveVariableOperationPrivate | |||
{ | ||||
explicit RemoveVariableOperationPrivate(std::shared_ptr<Variable2> variable) | ||||
Alexandre Leroux
|
r333 | : m_Variable(variable) | ||
{ | ||||
} | ||||
r1420 | std::shared_ptr<Variable2> m_Variable; | |||
Alexandre Leroux
|
r333 | }; | ||
r1420 | RemoveVariableOperation::RemoveVariableOperation(std::shared_ptr<Variable2> variable) | |||
: impl { spimpl::make_unique_impl<RemoveVariableOperationPrivate>(variable) } | ||||
Alexandre Leroux
|
r333 | { | ||
} | ||||
r1420 | void RemoveVariableOperation::visitEnter(VisualizationWidget* widget) | |||
Alexandre Leroux
|
r333 | { | ||
// VisualizationWidget is not intended to contain a variable | ||||
Q_UNUSED(widget) | ||||
} | ||||
r1420 | void RemoveVariableOperation::visitLeave(VisualizationWidget* widget) | |||
Alexandre Leroux
|
r333 | { | ||
// VisualizationWidget is not intended to contain a variable | ||||
Q_UNUSED(widget) | ||||
} | ||||
r1420 | void RemoveVariableOperation::visitEnter(VisualizationTabWidget* tabWidget) | |||
Alexandre Leroux
|
r333 | { | ||
// VisualizationTabWidget is not intended to contain a variable | ||||
Q_UNUSED(tabWidget) | ||||
} | ||||
r1420 | void RemoveVariableOperation::visitLeave(VisualizationTabWidget* tabWidget) | |||
Alexandre Leroux
|
r333 | { | ||
// VisualizationTabWidget is not intended to contain a variable | ||||
Q_UNUSED(tabWidget) | ||||
} | ||||
r1420 | void RemoveVariableOperation::visitEnter(VisualizationZoneWidget* zoneWidget) | |||
Alexandre Leroux
|
r333 | { | ||
// VisualizationZoneWidget is not intended to contain a variable | ||||
Q_UNUSED(zoneWidget) | ||||
} | ||||
r1420 | void RemoveVariableOperation::visitLeave(VisualizationZoneWidget* zoneWidget) | |||
Alexandre Leroux
|
r333 | { | ||
// VisualizationZoneWidget is not intended to contain a variable | ||||
Q_UNUSED(zoneWidget) | ||||
} | ||||
r1420 | void RemoveVariableOperation::visit(VisualizationGraphWidget* graphWidget) | |||
Alexandre Leroux
|
r333 | { | ||
r1420 | if (graphWidget) | |||
{ | ||||
Alexandre Leroux
|
r333 | // If the widget contains the variable, removes it | ||
r1420 | if (impl->m_Variable && graphWidget->contains(*impl->m_Variable)) | |||
{ | ||||
Alexandre Leroux
|
r333 | graphWidget->removeVariable(impl->m_Variable); | ||
} | ||||
} | ||||
r1420 | else | |||
{ | ||||
Alexandre Leroux
|
r333 | qCCritical(LOG_RemoveVariableOperation(), | ||
r1420 | "Can't visit VisualizationGraphWidget : the widget is null"); | |||
Alexandre Leroux
|
r333 | } | ||
} | ||||