From 61e0e6ec665ebbee721ecf4e566a197c6481c33b Mon Sep 17 00:00:00 2001 From: Peter Albrecht <albrecpe@gmail.com> Date: Fri, 6 Sep 2024 16:40:39 +0200 Subject: [PATCH] run clang-format to remove empty lines --- .../AronTreeWidgetController.cpp | 3 +- .../aron_tree_widget/AronTreeWidgetItem.cpp | 3 +- .../visitors/AronTreeWidgetConverter.cpp | 53 +++++++------------ .../visitors/AronTreeWidgetSetter.cpp | 34 +++++------- 4 files changed, 33 insertions(+), 60 deletions(-) diff --git a/source/RobotAPI/libraries/skills_gui/aron_tree_widget/AronTreeWidgetController.cpp b/source/RobotAPI/libraries/skills_gui/aron_tree_widget/AronTreeWidgetController.cpp index 8c24f906f..2c877a7f5 100644 --- a/source/RobotAPI/libraries/skills_gui/aron_tree_widget/AronTreeWidgetController.cpp +++ b/source/RobotAPI/libraries/skills_gui/aron_tree_widget/AronTreeWidgetController.cpp @@ -136,7 +136,7 @@ namespace armarx::skills::gui void AronTreeWidgetController::onTreeWidgetItemChanged(QTreeWidgetItem* item, int column) { - + tree->blockSignals(true); auto* aronElem = AronTreeWidgetItem::DynamicCast(item); @@ -160,7 +160,6 @@ namespace armarx::skills::gui // else perhaps the GUI was stopped or died. tree->blockSignals(false); - } } // namespace armarx::skills::gui diff --git a/source/RobotAPI/libraries/skills_gui/aron_tree_widget/AronTreeWidgetItem.cpp b/source/RobotAPI/libraries/skills_gui/aron_tree_widget/AronTreeWidgetItem.cpp index 5f24c40c9..acbd6b876 100644 --- a/source/RobotAPI/libraries/skills_gui/aron_tree_widget/AronTreeWidgetItem.cpp +++ b/source/RobotAPI/libraries/skills_gui/aron_tree_widget/AronTreeWidgetItem.cpp @@ -149,7 +149,7 @@ namespace armarx::skills::gui void AronTreeWidgetItem::onUserChange(int changedColumn) { - + QTreeWidgetItem* qParent = QTreeWidgetItem::parent(); ARMARX_CHECK(qParent); AronTreeWidgetItem* aronParent = DynamicCast(qParent); @@ -173,7 +173,6 @@ namespace armarx::skills::gui preventIllegalKeyChange(); } } - } void diff --git a/source/RobotAPI/libraries/skills_gui/aron_tree_widget/visitors/AronTreeWidgetConverter.cpp b/source/RobotAPI/libraries/skills_gui/aron_tree_widget/visitors/AronTreeWidgetConverter.cpp index b4c2802ec..173e8dca1 100644 --- a/source/RobotAPI/libraries/skills_gui/aron_tree_widget/visitors/AronTreeWidgetConverter.cpp +++ b/source/RobotAPI/libraries/skills_gui/aron_tree_widget/visitors/AronTreeWidgetConverter.cpp @@ -75,19 +75,18 @@ namespace armarx::skills::gui void AronTreeWidgetConverterVisitor::handleErrors(bool ownFault) { - + ARMARX_TRACE; isDirectError = ownFault; auto* aronItem = AronTreeWidgetItem::DynamicCast(parentItem->child(index)); ARMARX_CHECK(aronItem); aronItem->setValueErrorState(isDirectError, false); - } void AronTreeWidgetConverterVisitor::visitAronVariant(const aron::type::ObjectPtr& i) { - + ARMARX_TRACE; auto createdAronDict = std::make_shared<aron::data::Dict>(i->getPath()); createdAron = createdAronDict; @@ -116,13 +115,12 @@ namespace armarx::skills::gui createdAronDict->addElement(key, v.createdAron); } } - } void AronTreeWidgetConverterVisitor::visitAronVariant(const aron::type::DictPtr& i) { - + ARMARX_TRACE; auto createdAronDict = std::make_shared<aron::data::Dict>(i->getPath()); createdAron = createdAronDict; @@ -151,13 +149,12 @@ namespace armarx::skills::gui createdAronDict->addElement(key, v.createdAron); } } - } void AronTreeWidgetConverterVisitor::visitAronVariant(const aron::type::ListPtr& i) { - + ARMARX_TRACE; auto createdAronList = std::make_shared<aron::data::List>(i->getPath()); createdAron = createdAronList; @@ -186,13 +183,12 @@ namespace armarx::skills::gui createdAronList->addElement(convVisitor.createdAron); } } - } void AronTreeWidgetConverterVisitor::visitAronVariant(const aron::type::PairPtr& i) { - + ARMARX_TRACE; auto createdAronPair = std::make_shared<aron::data::List>(i->getPath()); createdAron = createdAronPair; @@ -217,13 +213,12 @@ namespace armarx::skills::gui createdAronPair->addElement(convVisitor.createdAron); } } - } void AronTreeWidgetConverterVisitor::visitAronVariant(const aron::type::TuplePtr& i) { - + ARMARX_TRACE; auto createdAronList = std::make_shared<aron::data::List>(i->getPath()); createdAron = createdAronList; @@ -251,7 +246,6 @@ namespace armarx::skills::gui createdAronList->addElement(v.createdAron); } } - } void @@ -264,7 +258,7 @@ namespace armarx::skills::gui void AronTreeWidgetConverterVisitor::visitAronVariant(const aron::type::MatrixPtr& i) { - + ARMARX_TRACE; auto createdMatrix = std::make_shared<aron::data::NDArray>(i->getPath()); int dataSize = 0; @@ -289,7 +283,7 @@ namespace armarx::skills::gui break; }; - + // UGLY HACK: FIX ME!!! switch (i->getElementType()) { @@ -322,7 +316,7 @@ namespace armarx::skills::gui break; }; - + createdMatrix->setShape({i->getRows(), i->getCols(), dataSize}); int totalByteSize = i->getRows() * i->getCols() * dataSize; createdAron = createdMatrix; @@ -338,7 +332,7 @@ namespace armarx::skills::gui } } - + auto* rootWidget = el->treeWidget(); ARMARX_CHECK(rootWidget); auto* widget = rootWidget->itemWidget(el, 1); @@ -352,7 +346,7 @@ namespace armarx::skills::gui return; } - + // write to aron data std::vector<unsigned char> elems; elems.reserve(totalByteSize); @@ -368,13 +362,12 @@ namespace armarx::skills::gui } } createdMatrix->setData(totalByteSize, elems.data()); - } void AronTreeWidgetConverterVisitor::visitAronVariant(const aron::type::QuaternionPtr& i) { - + ARMARX_TRACE; auto createdQuat = std::make_shared<aron::data::NDArray>(i->getPath()); createdAron = createdQuat; @@ -411,7 +404,6 @@ namespace armarx::skills::gui << "serialized quaternions did not return byte sequence of correct length!"; } createdQuat->setData(serialized.size(), serialized.data()); - } void @@ -431,7 +423,7 @@ namespace armarx::skills::gui void AronTreeWidgetConverterVisitor::visitAronVariant(const aron::type::IntEnumPtr& i) { - + ARMARX_TRACE; QTreeWidgetItem* el = parentItem->child(index); @@ -456,13 +448,12 @@ namespace armarx::skills::gui std::tie(success, createdAron) = intEnumWidget->parseToAron(); handleErrors(!success); - } void AronTreeWidgetConverterVisitor::visitAronVariant(const aron::type::IntPtr& i) { - + ARMARX_TRACE; auto createdAronInt = std::make_shared<aron::data::Int>(i->getPath()); createdAron = createdAronInt; @@ -497,13 +488,12 @@ namespace armarx::skills::gui return; } handleErrors(false); - } void AronTreeWidgetConverterVisitor::visitAronVariant(const aron::type::LongPtr& i) { - + ARMARX_TRACE; auto createdAronLong = std::make_shared<aron::data::Long>(i->getPath()); createdAron = createdAronLong; @@ -537,13 +527,12 @@ namespace armarx::skills::gui return; } handleErrors(false); - } void AronTreeWidgetConverterVisitor::visitAronVariant(const aron::type::FloatPtr& i) { - + ARMARX_TRACE; auto createdAronFloat = std::make_shared<aron::data::Float>(i->getPath()); createdAron = createdAronFloat; @@ -576,13 +565,12 @@ namespace armarx::skills::gui return; } handleErrors(false); - } void AronTreeWidgetConverterVisitor::visitAronVariant(const aron::type::DoublePtr& i) { - + ARMARX_TRACE; auto createdAronDouble = std::make_shared<aron::data::Double>(i->getPath()); createdAron = createdAronDouble; @@ -615,13 +603,12 @@ namespace armarx::skills::gui return; } handleErrors(false); - } void AronTreeWidgetConverterVisitor::visitAronVariant(const aron::type::BoolPtr& i) { - + ARMARX_TRACE; auto createdAronBool = std::make_shared<aron::data::Bool>(i->getPath()); createdAron = createdAronBool; @@ -654,13 +641,12 @@ namespace armarx::skills::gui return; } handleErrors(false); - } void AronTreeWidgetConverterVisitor::visitAronVariant(const aron::type::StringPtr& i) { - + ARMARX_TRACE; auto createdAronString = std::make_shared<aron::data::String>(i->getPath()); createdAron = createdAronString; @@ -683,7 +669,6 @@ namespace armarx::skills::gui std::string str = el->text(1).toStdString(); createdAronString->setValue(str); - } void diff --git a/source/RobotAPI/libraries/skills_gui/aron_tree_widget/visitors/AronTreeWidgetSetter.cpp b/source/RobotAPI/libraries/skills_gui/aron_tree_widget/visitors/AronTreeWidgetSetter.cpp index 373086b4f..796de3584 100644 --- a/source/RobotAPI/libraries/skills_gui/aron_tree_widget/visitors/AronTreeWidgetSetter.cpp +++ b/source/RobotAPI/libraries/skills_gui/aron_tree_widget/visitors/AronTreeWidgetSetter.cpp @@ -35,12 +35,12 @@ template <typename T> std::string usString(T number, size_t precision = 3) { - + std::stringstream ss; const char* locale = "C"; ss.imbue(std::locale(locale)); ss << std::fixed << std::setprecision(precision) << number; - + return ss.str(); } @@ -103,7 +103,7 @@ namespace armarx::skills::gui void AronTreeWidgetSetterVisitor::visitAronVariant(const aron::data::DictPtr& i) { - + // either it is the root or it has a name if (i->getPath().size() == 0 || checkTreeWidgetItemForSimilarName(i->getPath().getLastElement())) @@ -128,13 +128,12 @@ namespace armarx::skills::gui el->setCheckState(1, Qt::CheckState::Checked); } } - } void AronTreeWidgetSetterVisitor::visitAronVariant(const aron::data::ListPtr& i) { - + if (checkTreeWidgetItemForSimilarName(i->getPath().getLastElement())) { AronTreeWidgetItem* el = AronTreeWidgetItem::DynamicCast(parentItem->child(index)); @@ -165,7 +164,6 @@ namespace armarx::skills::gui el->setCheckState(1, Qt::CheckState::Checked); } } - } void @@ -173,7 +171,7 @@ namespace armarx::skills::gui const std::shared_ptr<armarx::aron::type::Matrix>& matrixType, const aron::data::NDArrayPtr& arr) { - + auto elemType = matrixType->getElementType(); auto* rawData = arr->getData(); // string can convert any item @@ -256,7 +254,7 @@ namespace armarx::skills::gui std::shared_ptr<armarx::aron::type::Quaternion>& quatType, const aron::data::NDArrayPtr& arr) { - + auto elemType = quatType->getElementType(); auto rawData = arr->getData(); auto shape = arr->getShape(); @@ -287,13 +285,12 @@ namespace armarx::skills::gui { quatWidget->setText((QuaternionWidget::QuaternionComponents)i, toString(i)); } - } void AronTreeWidgetSetterVisitor::visitAronVariant(const aron::data::NDArrayPtr& arr) { - + // Matrices are handled as NDArray. Raw ndarrays cannot be created currently auto* el = AronTreeWidgetItem::DynamicCast(parentItem->child(index)); ARMARX_CHECK(el); @@ -324,13 +321,12 @@ namespace armarx::skills::gui { el->setCheckState(1, Qt::CheckState::Checked); } - } void AronTreeWidgetSetterVisitor::visitAronVariant(const aron::data::IntPtr& i) { - + if (checkTreeWidgetItemForSimilarName(i->getPath().getLastElement())) { AronTreeWidgetItem* el = AronTreeWidgetItem::DynamicCast(parentItem->child(index)); @@ -352,13 +348,12 @@ namespace armarx::skills::gui el->setCheckState(1, Qt::CheckState::Checked); } } - } void AronTreeWidgetSetterVisitor::visitAronVariant(const aron::data::LongPtr& i) { - + if (checkTreeWidgetItemForSimilarName(i->getPath().getLastElement())) { AronTreeWidgetItem* el = AronTreeWidgetItem::DynamicCast(parentItem->child(index)); @@ -369,7 +364,6 @@ namespace armarx::skills::gui el->setCheckState(1, Qt::CheckState::Checked); } } - } void @@ -386,13 +380,12 @@ namespace armarx::skills::gui el->setCheckState(1, Qt::CheckState::Checked); } } - } void AronTreeWidgetSetterVisitor::visitAronVariant(const aron::data::DoublePtr& i) { - + if (checkTreeWidgetItemForSimilarName(i->getPath().getLastElement())) { AronTreeWidgetItem* el = AronTreeWidgetItem::DynamicCast(parentItem->child(index)); @@ -403,13 +396,12 @@ namespace armarx::skills::gui el->setCheckState(1, Qt::CheckState::Checked); } } - } void AronTreeWidgetSetterVisitor::visitAronVariant(const aron::data::BoolPtr& i) { - + if (checkTreeWidgetItemForSimilarName(i->getPath().getLastElement())) { AronTreeWidgetItem* el = AronTreeWidgetItem::DynamicCast(parentItem->child(index)); @@ -420,13 +412,12 @@ namespace armarx::skills::gui el->setCheckState(1, Qt::CheckState::Checked); } } - } void AronTreeWidgetSetterVisitor::visitAronVariant(const aron::data::StringPtr& i) { - + if (checkTreeWidgetItemForSimilarName(i->getPath().getLastElement())) { AronTreeWidgetItem* el = AronTreeWidgetItem::DynamicCast(parentItem->child(index)); @@ -437,7 +428,6 @@ namespace armarx::skills::gui el->setCheckState(1, Qt::CheckState::Checked); } } - } void -- GitLab