From 00ae2619d35f8ad3511810083f21645b57e87fc6 2017-07-25 09:49:13 From: mperrinel Date: 2017-07-25 09:49:13 Subject: [PATCH] Correction for MR --- diff --git a/gui/include/Visualization/VisualizationGraphWidget.h b/gui/include/Visualization/VisualizationGraphWidget.h index 5286447..1f31ed2 100644 --- a/gui/include/Visualization/VisualizationGraphWidget.h +++ b/gui/include/Visualization/VisualizationGraphWidget.h @@ -40,7 +40,7 @@ public: void removeVariable(std::shared_ptr variable) noexcept; void setRange(std::shared_ptr variable, const SqpDateTime &range); - SqpDateTime graphRange(); + SqpDateTime graphRange() const noexcept; void setGraphRange(const SqpDateTime &range); // IVisualizationWidget interface diff --git a/gui/src/Variable/VariableInspectorWidget.cpp b/gui/src/Variable/VariableInspectorWidget.cpp index d9a1cab..94d06f9 100644 --- a/gui/src/Variable/VariableInspectorWidget.cpp +++ b/gui/src/Variable/VariableInspectorWidget.cpp @@ -78,9 +78,9 @@ public: auto buttonRect = QRect(progressRect.right(), option.rect.top(), cancelButtonWidth, option.rect.height()); - QMouseEvent *e = (QMouseEvent *)event; - int clickX = e->x(); - int clickY = e->y(); + auto e = (QMouseEvent *)event; + auto clickX = e->x(); + auto clickY = e->y(); auto x = buttonRect.left(); // the X coordinate auto y = buttonRect.top(); // the Y coordinate @@ -89,7 +89,6 @@ public: if (clickX > x && clickX < x + w) { if (clickY > y && clickY < y + h) { - qCritical(LOG_VariableInspectorWidget()) << tr("editorEvent CLIC"); auto variableModel = sqpApp->variableController().variableModel(); variableModel->abortProgress(index); } diff --git a/gui/src/Visualization/VisualizationGraphWidget.cpp b/gui/src/Visualization/VisualizationGraphWidget.cpp index 1e8cc0d..bf903ae 100644 --- a/gui/src/Visualization/VisualizationGraphWidget.cpp +++ b/gui/src/Visualization/VisualizationGraphWidget.cpp @@ -25,7 +25,7 @@ const auto VERTICAL_ZOOM_MODIFIER = Qt::ControlModifier; struct VisualizationGraphWidget::VisualizationGraphWidgetPrivate { - explicit VisualizationGraphWidgetPrivate() : m_DoSynchronize(true), m_IsCalibration(false) {} + explicit VisualizationGraphWidgetPrivate() : m_DoSynchronize{true}, m_IsCalibration{false} {} // Return the operation when range changed @@ -106,8 +106,8 @@ void VisualizationGraphWidget::addVariableUsingGraph(std::shared_ptr v auto variableDateTimeWithTolerance = dateTime; - // add 10% tolerance for each side - auto tolerance = 0.1 * (dateTime.m_TEnd - dateTime.m_TStart); + // add 20% tolerance for each side + auto tolerance = 0.2 * (dateTime.m_TEnd - dateTime.m_TStart); variableDateTimeWithTolerance.m_TStart -= tolerance; variableDateTimeWithTolerance.m_TEnd += tolerance; @@ -142,6 +142,8 @@ void VisualizationGraphWidget::removeVariable(std::shared_ptr variable void VisualizationGraphWidget::setRange(std::shared_ptr variable, const SqpDateTime &range) { + // Note: in case of different axes that depends on variable, we could start with a code like + // that: // auto componentsIt = impl->m_VariableToPlotMultiMap.equal_range(variable); // for (auto it = componentsIt.first; it != componentsIt.second;) { // } @@ -149,7 +151,7 @@ void VisualizationGraphWidget::setRange(std::shared_ptr variable, ui->widget->replot(); } -SqpDateTime VisualizationGraphWidget::graphRange() +SqpDateTime VisualizationGraphWidget::graphRange() const noexcept { auto grapheRange = ui->widget->xAxis->range(); return SqpDateTime{grapheRange.lower, grapheRange.upper}; diff --git a/gui/src/Visualization/VisualizationWidget.cpp b/gui/src/Visualization/VisualizationWidget.cpp index 076ff3c..c5d86c7 100644 --- a/gui/src/Visualization/VisualizationWidget.cpp +++ b/gui/src/Visualization/VisualizationWidget.cpp @@ -146,7 +146,7 @@ void VisualizationWidget::onVariableAboutToBeDeleted(std::shared_ptr v void VisualizationWidget::onRangeChanged(std::shared_ptr variable, const SqpDateTime &range) noexcept { - // Calls the operation of removing all references to the variable in the visualization + // Calls the operation of rescaling all graph that contrains variable in the visualization auto rescaleVariableOperation = RescaleAxeOperation{variable, range}; accept(&rescaleVariableOperation); } diff --git a/gui/src/Visualization/operations/RescaleAxeOperation.cpp b/gui/src/Visualization/operations/RescaleAxeOperation.cpp index 7145109..7f8fc66 100644 --- a/gui/src/Visualization/operations/RescaleAxeOperation.cpp +++ b/gui/src/Visualization/operations/RescaleAxeOperation.cpp @@ -6,7 +6,7 @@ Q_LOGGING_CATEGORY(LOG_RescaleAxeOperation, "RescaleAxeOperation") struct RescaleAxeOperation::RescaleAxeOperationPrivate { explicit RescaleAxeOperationPrivate(std::shared_ptr variable, const SqpDateTime &range) - : m_Variable(variable), m_Range(range) + : m_Variable{variable}, m_Range{range} { } @@ -59,7 +59,7 @@ void RescaleAxeOperation::visitLeave(VisualizationZoneWidget *zoneWidget) void RescaleAxeOperation::visit(VisualizationGraphWidget *graphWidget) { if (graphWidget) { - // If the widget contains the variable, removes it + // If the widget contains the variable, rescale it if (impl->m_Variable && graphWidget->contains(*impl->m_Variable)) { graphWidget->setRange(impl->m_Variable, impl->m_Range); } diff --git a/plugins/amda/tests/TestAmdaResultParser.cpp b/plugins/amda/tests/TestAmdaResultParser.cpp index 961a746..0501e79 100644 --- a/plugins/amda/tests/TestAmdaResultParser.cpp +++ b/plugins/amda/tests/TestAmdaResultParser.cpp @@ -156,11 +156,11 @@ void TestAmdaResultParser::testReadTxt_data() QVector{-2.71850, -2.52150}}; // Invalid files - QTest::newRow("Invalid file (unexisting file)") - << QStringLiteral("UnexistingFile.txt") << ExpectedResults{}; + QTest::newRow("Invalid file (unexisting file)") << QStringLiteral("UnexistingFile.txt") + << ExpectedResults{}; - QTest::newRow("Invalid file (file not found on server)") - << QStringLiteral("FileNotFound.txt") << ExpectedResults{}; + QTest::newRow("Invalid file (file not found on server)") << QStringLiteral("FileNotFound.txt") + << ExpectedResults{}; } void TestAmdaResultParser::testReadTxt()