diff --git a/source/RobotAPI/libraries/armem_gui/query_widgets/QueryWidget.cpp b/source/RobotAPI/libraries/armem_gui/query_widgets/QueryWidget.cpp index 5eecd2181f34a23b1966cd54f504b1f04ccc9136..d8f01c81be35b546d25d83e749a5e4770eee045e 100644 --- a/source/RobotAPI/libraries/armem_gui/query_widgets/QueryWidget.cpp +++ b/source/RobotAPI/libraries/armem_gui/query_widgets/QueryWidget.cpp @@ -7,17 +7,16 @@ #include <QGroupBox> #include <QHBoxLayout> #include <QLabel> +#include <QLineEdit> #include <QPushButton> +#include <QScrollArea> #include <QSpinBox> #include <QTabWidget> #include <QVBoxLayout> #include <QWidget> -#include <QScrollArea> -#include <QLineEdit> #include <ArmarXCore/core/exceptions/local/ExpressionException.h> - namespace armarx::armem::gui { @@ -74,6 +73,7 @@ namespace armarx::armem::gui recDepthHLayout->addStretch(); vboxlayout->addLayout(recDepthHLayout); + /* auto* exportPathHLayout = new QHBoxLayout(); _exportPathLabel = new QLabel("Export path:"); exportPathHLayout->addWidget(_exportPathLabel); @@ -101,6 +101,7 @@ namespace armarx::armem::gui exportNameHLayout->addWidget(_exportNameConfirmButton); _exportNameConfirmButton->setFixedWidth(100); vboxlayout->addLayout(exportNameHLayout); +*/ auto ltmButtonsLayout = new QVBoxLayout(); _storeInLTMButton = new QPushButton("Query and store in LTM"); @@ -121,23 +122,27 @@ namespace armarx::armem::gui vlayout->addLayout(hlayout); // Public connections. + /* connect(_exportPathConfirmButton, &QPushButton::pressed, this, [=]() { confirmExportPath(_exportPathLineEdit->text().toStdString()); }); connect(_exportNameConfirmButton, &QPushButton::pressed, this, [=]() { confirmExportPath(_exportNameLineEdit->text().toStdString()); }); +*/ connect(_storeInLTMButton, &QPushButton::pressed, this, &This::storeInLTM); connect(_startLTMRecordingButton, &QPushButton::pressed, this, &This::startRecording); connect(_stopLTMRecordingButton, &QPushButton::pressed, this, &This::stopRecording); // Private connections. - connect(_dataCheckBox, &QCheckBox::stateChanged, this, &This::setRecursionDepthSpinnerEnabled); + connect( + _dataCheckBox, &QCheckBox::stateChanged, this, &This::setRecursionDepthSpinnerEnabled); setLayout(vlayout); } - void QueryWidget::update(const std::vector<std::string>& activeMemoryNames) + void + QueryWidget::update(const std::vector<std::string>& activeMemoryNames) { std::scoped_lock l(enabledMemoriesMutex); std::vector<std::string> alreadyPresentMemoryCheckboxes; @@ -149,14 +154,18 @@ namespace armarx::armem::gui auto w = _availableMemoriesGroupBox->layout()->itemAt(i)->widget(); QCheckBox* box = static_cast<QCheckBox*>(w); std::string memoryName = box->text().toStdString(); - if (box->isEnabled() && std::find(activeMemoryNames.begin(), activeMemoryNames.end(), memoryName) == activeMemoryNames.end()) + if (box->isEnabled() && + std::find(activeMemoryNames.begin(), activeMemoryNames.end(), memoryName) == + activeMemoryNames.end()) { // checkbox is enabled but memory is not available anymore box->setVisible(false); box->setChecked(false); box->setEnabled(false); } - if (not(box->isEnabled()) && std::find(activeMemoryNames.begin(), activeMemoryNames.end(), memoryName) != activeMemoryNames.end()) + if (not(box->isEnabled()) && + std::find(activeMemoryNames.begin(), activeMemoryNames.end(), memoryName) != + activeMemoryNames.end()) { // checkbox is disabled but memory is available again box->setVisible(true); @@ -169,7 +178,9 @@ namespace armarx::armem::gui // Add checkboxes for new memories for (const auto& memoryName : activeMemoryNames) { - if (std::find(alreadyPresentMemoryCheckboxes.begin(), alreadyPresentMemoryCheckboxes.end(), memoryName) == alreadyPresentMemoryCheckboxes.end()) + if (std::find(alreadyPresentMemoryCheckboxes.begin(), + alreadyPresentMemoryCheckboxes.end(), + memoryName) == alreadyPresentMemoryCheckboxes.end()) { // new memory available auto box = new QCheckBox(QString::fromStdString(memoryName)); @@ -181,24 +192,27 @@ namespace armarx::armem::gui } } - armem::query::DataMode QueryWidget::dataMode() const + armem::query::DataMode + QueryWidget::dataMode() const { - return _dataCheckBox->isChecked() - ? armem::query::DataMode::WithData - : armem::query::DataMode::NoData; + return _dataCheckBox->isChecked() ? armem::query::DataMode::WithData + : armem::query::DataMode::NoData; } - bool QueryWidget::dropRemovedMemories() const + bool + QueryWidget::dropRemovedMemories() const { return _dropRemovedCheckBox->isChecked(); } - bool QueryWidget::dropDisabledMemories() const + bool + QueryWidget::dropDisabledMemories() const { return _dropDisabledCheckBox->isChecked(); } - std::map<std::string, QueryWidget::ActiveMemoryState> QueryWidget::getAvailableMemoryStates() const + std::map<std::string, QueryWidget::ActiveMemoryState> + QueryWidget::getAvailableMemoryStates() const { std::scoped_lock l(enabledMemoriesMutex); @@ -225,8 +239,8 @@ namespace armarx::armem::gui return states; } - - std::vector<std::string> QueryWidget::getEnabledMemories() const + std::vector<std::string> + QueryWidget::getEnabledMemories() const { std::scoped_lock l(enabledMemoriesMutex); @@ -246,7 +260,8 @@ namespace armarx::armem::gui return enabledMemoryCheckboxes; } - int QueryWidget::queryLinkRecursionDepth() const + int + QueryWidget::queryLinkRecursionDepth() const { return _recursionDepthSpinner->value(); } @@ -265,4 +280,4 @@ namespace armarx::armem::gui break; } } -} +} // namespace armarx::armem::gui diff --git a/source/RobotAPI/libraries/armem_gui/query_widgets/QueryWidget.h b/source/RobotAPI/libraries/armem_gui/query_widgets/QueryWidget.h index 7e4c98c1de8782f566401cef5a287ed9cb1e8242..3cad51e99c69452de5541dbf10c8d21bcf4f4267 100644 --- a/source/RobotAPI/libraries/armem_gui/query_widgets/QueryWidget.h +++ b/source/RobotAPI/libraries/armem_gui/query_widgets/QueryWidget.h @@ -2,8 +2,8 @@ #include <mutex> -#include <RobotAPI/libraries/armem/core/query/DataMode.h> #include <RobotAPI/libraries/armem/client/query/Builder.h> +#include <RobotAPI/libraries/armem/core/query/DataMode.h> #include "SnapshotSelectorWidget.h" @@ -22,7 +22,6 @@ namespace armarx::armem::gui using This = QueryWidget; public: - enum class ActiveMemoryState { FoundAndChecked, @@ -52,7 +51,7 @@ namespace armarx::armem::gui void storeInLTM(); void startRecording(); void stopRecording(); - void confirmExportPath(std::string path); + //void confirmExportPath(std::string path); // ToDo: // void queryChanged(armem::query::data::Input query); @@ -64,9 +63,7 @@ namespace armarx::armem::gui signals: - private: - QCheckBox* _dataCheckBox; QCheckBox* _dropRemovedCheckBox; @@ -93,4 +90,4 @@ namespace armarx::armem::gui mutable std::mutex enabledMemoriesMutex; }; -} +} // namespace armarx::armem::gui