SkillDashboardWidgetController.cpp
Go to the documentation of this file.
2
3#include <cmath>
4#include <fstream>
5#include <iostream>
6#include <string>
7
8#include <IceUtil/Optional.h>
9
10#include <nlohmann/json.hpp>
11
12#include <QDateTime>
13#include <QDebug>
14#include <QHBoxLayout>
15#include <QLabel>
16#include <QLineEdit>
17#include <QMessageBox>
18#include <QPalette>
19#include <QPushButton>
20#include <QString>
21#include <QStringList>
22#include <QTimer>
23#include <QToolButton>
24#include <Qt>
25#include <QtConcurrent/QtConcurrent>
26#include <QtGlobal>
27#include <QtWidgets/QSlider>
28#include <QtWidgets/QTableWidgetItem>
29
38
42#include <RobotAPI/interface/components/SkillDashboardInterface.h>
43#include <RobotAPI/interface/skills/SkillManagerInterface.h>
44
45#include "EllipsisPushButton.h"
46
47namespace armarx
48{
53
55 DEFAULT_SETTINGS_PLUGIN_NAME("SkillDashboardGuiPlugin"),
56 DEFAULT_SETTINGS_CUSTOM_TEXT("custom text")
57 {
58 // init gui
59 ARMARX_INFO << "Setup UI";
60 ui.setupUi(getWidget());
61 this->shortcutLayout = new QVBoxLayout();
62 this->dialog = new SkillDashboardConfigWindow();
63 this->editModeAction = new QAction("Edit Mode", this);
64 this->editModeAction->setCheckable(true);
65 this->editModeAction->setToolTip("If toggled the shortcut config buttons and the reload, "
66 "add and export button will be shown.");
67
68 this->recoverButtons = new QToolButton();
69 QIcon iconRecover = getWidget()->style()->standardIcon(QStyle::SP_BrowserReload);
70 this->recoverButtons->setIcon(iconRecover);
71 this->recoverButtons->setToolTip("Recover all buttons");
72
73 this->errorMessageArea = new MessageWidget(true, getWidget());
74 ui.messageArea->layout()->addWidget(this->errorMessageArea);
75
76 ui.shortcutListWidget->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
77 ui.shortcutListWidget->setDragDropMode(QAbstractItemView::InternalMove);
78 ui.shortcutListWidget->setDefaultDropAction(Qt::MoveAction);
79 ui.shortcutListWidget->setSelectionMode(QAbstractItemView::SingleSelection);
80 ui.shortcutListWidget->setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContents);
81 ui.shortcutListWidget->setStyleSheet(R"(
82 QListWidget {
83 background: transparent;
84 border: none;
85 }
86 QListWidget::item {
87 margin: 0px;
88 padding: 0px;
89 }
90)");
91
92 qRegisterMetaType<skills::core::dto::Execution::Status>(
93 "skills::core::dto::Execution::Status");
94
95 connect(this->editModeAction, SIGNAL(toggled(bool)), this, SLOT(editMode(bool)));
96 connect(this->recoverButtons,
97 &QToolButton::clicked,
98 this,
99 &SkillDashboardWidget::enableBlockedButtons);
100 connect(ui.addFromClipboardButton,
101 &QPushButton::clicked,
102 this,
103 &SkillDashboardWidget::addFromClipboard);
104 connect(ui.addButton,
105 &QPushButton::clicked,
106 this,
107 [this]() { openConfigWindow("", "", "", ""); });
108 connect(ui.reloadButton, &QPushButton::clicked, this, &SkillDashboardWidget::loadButtons);
109 connect(
110 this, &SkillDashboardWidget::loadButtonInit, this, &SkillDashboardWidget::loadButtons);
111 connect(ui.exportButton, &QPushButton::clicked, this, &SkillDashboardWidget::exportButtons);
112 connect(ui.importButton, &QPushButton::clicked, this, &SkillDashboardWidget::importButtons);
113
114 connect(this,
116 this,
117 &SkillDashboardWidget::activateButton);
118
119
120 connect(this->dialog,
122 this,
123 &SkillDashboardWidget::onShortcutNameChanged);
124 connect(ui.stopAllButton, &QPushButton::clicked, this, &SkillDashboardWidget::stopAll);
125 connect(this, &SkillDashboardWidget::loadPathInfo, this, &SkillDashboardWidget::loadPath);
126
127 this->editModeAction->toggle();
128
129 ARMARX_INFO << "Done: Setup UI";
130 }
131
132 void
134 {
136
137 usingProxy(skillDashboardProxyName);
138
139 if (not this->skillManagerOberserverName.empty())
140 {
141 usingProxy(this->skillManagerOberserverName);
142 }
143 else
144 {
145 ARMARX_IMPORTANT << "empty";
146 }
147 }
148
149 void
151 {
153 this->connected.store(true);
154 getProxy(this->dashboardPrx, skillDashboardProxyName);
155 getProxy(this->managerPrx, this->skillManagerOberserverName);
156 ARMARX_INFO << "Starting thread that queries the SkillsMemory if skills are running in the "
157 "dashboard.";
158 this->exampleTask = std::thread([&] { exampleThreadMethod(); });
159 emit loadButtonInit();
160 emit loadPathInfo();
161 }
162
163 void
164 SkillDashboardWidget::updateShortcutListHeight()
165 {
166 int rows = ui.shortcutListWidget->count();
167 if (rows == 0)
168 {
169 ui.shortcutListWidget->setMinimumHeight(0);
170 return;
171 }
172
173 int rowHeight = ui.shortcutListWidget->sizeHintForRow(0);
174 int frame = ui.shortcutListWidget->frameWidth() * 2;
175 ui.shortcutListWidget->setMinimumHeight(rows * rowHeight + frame);
176 }
177
178 std::string
179 errorStatustoString(skills::core::dto::Execution::Status s)
180 {
181 switch (s)
182 {
183 case skills::core::dto::Execution::Status::Failed:
184 return "Failed";
185 case skills::core::dto::Execution::Status::Succeeded:
186 return "Succeeded";
187 case skills::core::dto::Execution::Status::Aborted:
188 return "Aborted";
189 default:
190 return "Other";
191 }
192 return "Unknown";
193 }
194
195 void
196 SkillDashboardWidget::saveShortcutOrder()
197 {
198 std::vector<std::string> order;
199
200 for (int i = 0; i < ui.shortcutListWidget->count(); ++i)
201 {
202 QListWidgetItem* item = ui.shortcutListWidget->item(i);
203 QString name = item->data(Qt::UserRole).toString();
204 order.push_back(name.toStdString());
205 }
206
207 try
208 {
209 dashboardPrx->saveShortcutOrder(order);
210 }
211 catch (Ice::Exception const&)
212 {
213 ARMARX_WARNING << "Could not save shortcut order";
214 }
215 }
216
217 void
218 SkillDashboardWidget::loadPath()
219 {
220 std::vector<std::string> pathSegments;
221 try
222 {
223 pathSegments = dashboardPrx->getPathStructure();
224 }
225 catch (Ice::Exception const&)
226 {
227 ARMARX_WARNING << "Could not request path";
228 }
229 if (pathSegments.size() == 3)
230 {
231 ui.packageEdit->setText(QString::fromStdString(pathSegments[0]));
232 ui.folderEdit->setText(QString::fromStdString(pathSegments[1]));
233 ui.fileNameEdit->setText(QString::fromStdString(pathSegments[2]));
234 }
235 }
236
237 void
238 SkillDashboardWidget::activateButton(const std::string& name,
239 skills::core::dto::Execution::Status status)
240 {
241 auto* btn = this->shortcutButtons.at(name);
242 btn->setDisabled(false);
243 if (status != skills::core::dto::Execution::Status::Succeeded)
244 {
245 btn->finishProgress(true);
246 std::string text = "Shortcut '" + name + "' terminated with status '" +
248 QString timestamp = QDateTime::currentDateTime().toString("HH:mm:ss");
249 QString messageWithTimestamp =
250 QString("[%1] %2").arg(timestamp, QString::fromStdString(text));
251 this->errorMessageArea->newErrorMessage(messageWithTimestamp);
252 }
253 btn->finishProgress(false);
254 }
255
256 void
257 SkillDashboardWidget::addFromClipboard()
258 {
259 QClipboard* clipboard = QApplication::clipboard();
260 auto clipboardText = clipboard->text().toStdString();
261 nlohmann::json j;
262 try
263 {
264 j = nlohmann::json::parse(clipboardText);
265 }
266 catch (const nlohmann::json::parse_error& e)
267 {
268 ARMARX_ERROR << "JSON Parse Error: " << e.what() << "\n";
269 }
270
271 auto shortcutImport = j["shortcuts"][0];
272 auto skillArgs = shortcutImport["skill_args"].dump(2);
273 auto skillId = shortcutImport["skill_id"];
274 this->openConfigWindow("", skillId, skillArgs, "");
275 }
276
277 void
278 SkillDashboardWidget::stopAll()
279 {
280 QtConcurrent::run(
281 [this]
282 {
283 try
284 {
285 auto results = managerPrx->abortAllSkills();
286 for (auto& r : results)
287 ARMARX_IMPORTANT << r.success;
288 }
289 catch (Ice::Exception const&)
290 {
291 ARMARX_WARNING << "Could not send stop all request.";
292 }
293 });
294 this->enableBlockedButtons();
295 }
296
297 void
298 SkillDashboardWidget::exampleThreadMethod()
299 {
300 while (this->connected.load())
301 {
302 if (not this->runningSkills.empty())
303 {
304 for (auto it = this->runningSkills.cbegin(); it != this->runningSkills.cend();)
305 {
306 skills::core::dto::Execution::Status status =
307 skills::core::dto::Execution::Status::Succeeded;
308
309 try
310 {
311 IceUtil::Optional<skills::manager::dto::SkillStatusUpdate> update =
312 this->managerPrx->getSkillExecutionStatus(it->second);
313 if (update)
314 {
315 status = update->status;
316 }
317 }
318 catch (Ice::Exception const&)
319 {
320 ARMARX_WARNING << "Could not get skill status." << deactivateSpam(10);
321 }
322
323 if (status == skills::core::dto::Execution::Status::Succeeded ||
324 status == skills::core::dto::Execution::Status::Failed ||
325 status == skills::core::dto::Execution::Status::Aborted)
326 {
327 ARMARX_INFO << "Finished skill " << it->first;
328 emit skillFinished(it->first, status);
329 it = this->runningSkills.erase(it);
330 }
331 else
332 {
333 ++it;
334 }
335 }
336 ARMARX_INFO << deactivateSpam(10) << "Waiting for skills to finish..";
337 }
339 }
340 }
341
342 void
343 SkillDashboardWidget::onShortcutNameChanged()
344 {
345
346 if ((this->shortcutButtons.find(this->dialog->getShortcutName().toStdString()) !=
347 this->shortcutButtons.end()) and
348 (this->dialog->getShortcutName().toStdString() != this->currentShortcutName))
349 {
350 this->dialog->setInfoText(
351 "A shortcut with this name already exists! The old one will be overwritten.");
353 << "A shortcut with this name already exists! The old one will be overwritten!";
354 }
355 else
356 {
357 this->dialog->setInfoText("");
358 }
359 }
360
361 void
362 SkillDashboardWidget::openConfigWindow(const std::string& name,
363 const std::string& id,
364 const std::string& args,
365 const std::string& iconName)
366 {
367
368 this->dialog->setShortcutName(name);
369 this->dialog->setSkillId(id);
370 this->dialog->setIconName(iconName);
371 this->dialog->setSkillConfig(args);
372
373
374 if (this->dialog->exec() == QDialog::Accepted)
375 {
376 try
377 {
378 SkillShortcut newShortcut;
379 newShortcut.shortcutName = this->dialog->getShortcutName().toStdString();
380 newShortcut.skillId = this->dialog->getSkillId().toStdString();
381 newShortcut.skillArgs = this->dialog->getSkillConfig().toStdString();
382 newShortcut.iconName = this->dialog->getIconName().toStdString();
383 this->dashboardPrx->addNewShortcut(newShortcut);
384 }
385 catch (Ice::Exception const&)
386 {
387 ARMARX_WARNING << "Could not send new Shortcut." << deactivateSpam(10);
388 }
389 loadButtons();
390 }
391 }
392
393 void
394 SkillDashboardWidget::exportButtons()
395 {
396 saveShortcutOrder();
397 std::string packageName = ui.packageEdit->text().toStdString();
398 std::string folderName = ui.folderEdit->text().toStdString();
399 if (ui.fileNameEdit->text().count(' ') == ui.fileNameEdit->text().length())
400 {
401 ARMARX_ERROR << "please enter a file name!";
402 return;
403 }
404 std::string fileName = ui.fileNameEdit->text().toStdString();
405 try
406 {
407 this->dashboardPrx->exportShortcuts(packageName, folderName, fileName);
408 }
409 catch (Ice::Exception const&)
410 {
411 ARMARX_WARNING << "Could not send export task." << deactivateSpam(10);
412 }
413
414 std::string coloredPath = "<span style='color:red;'>" + packageName + "/" + folderName +
415 "/" + fileName + "</span>";
416 std::string propertyPath = "Insert " + coloredPath +
417 " into the property 'ArmarX.SkillDashboard.ShortcutPath' of the "
418 "SkillDashboard component.";
419
420
421 ui.exportPath->setFullText(QString::fromStdString(propertyPath));
422 ui.exportPath->setTextInteractionFlags(Qt::TextSelectableByMouse);
423 }
424
425 void
426 SkillDashboardWidget::importButtons()
427 {
428 bool success = false;
429 std::string packageName = ui.packageEdit->text().toStdString();
430 std::string folderName = ui.folderEdit->text().toStdString();
431 if (ui.fileNameEdit->text().count(' ') == ui.fileNameEdit->text().length())
432 {
433 ARMARX_ERROR << "please enter a file name!";
434 return;
435 }
436 std::string fileName = ui.fileNameEdit->text().toStdString();
437 try
438 {
439 success = this->dashboardPrx->importShortcuts(packageName, folderName, fileName);
440 }
441 catch (Ice::Exception const&)
442 {
443 ARMARX_WARNING << "Could not send import task." << deactivateSpam(10);
444 }
445 if (success)
446 {
447 this->loadButtons();
448 }
449 }
450
451 void
452 SkillDashboardWidget::loadButtons()
453 {
454 this->shortcutButtons.clear();
455 this->configButtons.clear();
456 this->deleteButtons.clear();
457 ui.shortcutListWidget->clear();
458
459 std::vector<SkillShortcut> shortcuts;
460 try
461 {
462 shortcuts = this->dashboardPrx->getShortcuts();
463 }
464 catch (Ice::Exception const& e)
465 {
466 ARMARX_WARNING << "Could not fetch shortcuts. " << e.what() << deactivateSpam(10);
467 }
468
469
470 for (const auto& shortcut : shortcuts)
471 {
472 auto* mainButton =
473 new EllipsisPushButton(QString::fromStdString(shortcut.shortcutName));
474 mainButton->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
475 mainButton->setToolTip(QString("Execute"));
476
477 QToolButton* editButton = new QToolButton();
478 editButton->setIcon(
479 getWidget()->style()->standardIcon(QStyle::SP_FileDialogContentsView));
480 editButton->setToolTip(QString("Edit"));
481
482 QToolButton* deleteButton = new QToolButton();
483 deleteButton->setIcon(getWidget()->style()->standardIcon(QStyle::SP_TrashIcon));
484 deleteButton->setToolTip(QString("Delete"));
485
486 QWidget* rowWidget = new QWidget();
487 QHBoxLayout* layout = new QHBoxLayout(rowWidget);
488 layout->setContentsMargins(0, 0, 0, 0);
489 layout->setSpacing(2);
490 layout->addWidget(mainButton);
491 layout->addWidget(editButton);
492 layout->addWidget(deleteButton);
493
494 QListWidgetItem* item = new QListWidgetItem(ui.shortcutListWidget);
495 item->setSizeHint(rowWidget->sizeHint());
496 item->setData(Qt::UserRole, QString::fromStdString(shortcut.shortcutName));
497 ui.shortcutListWidget->addItem(item);
498 ui.shortcutListWidget->setItemWidget(item, rowWidget);
499
500 this->shortcutButtons[shortcut.shortcutName] = mainButton;
501 this->configButtons[shortcut.shortcutName] = editButton;
502 this->deleteButtons[shortcut.shortcutName] = deleteButton;
503
504 connect(mainButton,
505 &QPushButton::clicked,
506 this,
507 [this, name = shortcut.shortcutName] { executeSkill(name); });
508 connect(editButton,
509 &QToolButton::clicked,
510 this,
511 [this, name = shortcut.shortcutName] { editShortcut(name); });
512 connect(deleteButton,
513 &QToolButton::clicked,
514 this,
515 [this, name = shortcut.shortcutName] { deleteShortcut(name); });
516 }
517 updateShortcutListHeight();
518 }
519
520 void
521 SkillDashboardWidget::executeSkill(const std::string& name)
522 {
523 ARMARX_INFO << "About to execute skill with shortcut name `" << name
524 << "` from skill dashboard.";
525
526 SkillShortcut shortcut;
527 try
528 {
529 shortcut = this->dashboardPrx->getShortcut(name);
530 }
531 catch (Ice::Exception const&)
532 {
533 ARMARX_WARNING << "Could not fetch shortcut." << deactivateSpam(10);
534 std::string text = "Shortcut '" + name + "': Could not fetch shortcut.";
535 QString timestamp = QDateTime::currentDateTime().toString("HH:mm:ss");
536 QString messageWithTimestamp =
537 QString("[%1] %2").arg(timestamp, QString::fromStdString(text));
538 this->errorMessageArea->newErrorMessage(messageWithTimestamp);
539 }
540
541 size_t pos = shortcut.skillId.find('/');
542 std::string provider = "";
543 std::string nameSkill = "";
544 nlohmann::json json = nlohmann::json::parse(shortcut.skillArgs);
547 aron::data::dto::DictPtr paramterDto = data->toAronDictDTO();
548
549 if (pos != std::string::npos)
550 {
551 provider = shortcut.skillId.substr(0, pos);
552 nameSkill = shortcut.skillId.substr(pos + 1);
553 skills::manager::dto::ProviderID providerId{.providerName = provider};
554
555 skills::manager::dto::SkillID skillId{.providerId = providerId, .skillName = nameSkill};
556
557 char hostname[HOST_NAME_MAX];
558 gethostname(hostname, HOST_NAME_MAX);
559
560 skills::manager::dto::SkillExecutionRequest request{
561 .skillId = skillId,
562 .executorName = "Skills.Dashboard GUI (hostname: " + std::string(hostname) + ")",
563 .parameters = paramterDto,
564 };
565
566
567 try
568 {
569 ARMARX_IMPORTANT << "Executing skill with shortcut name `" << shortcut.shortcutName
570 << "` from skill dashboard.";
571 armarx::core::time::Duration skillTimeout =
573
574 IceUtil::Optional<armarx::skills::manager::dto::SkillDescription> optDto =
575 managerPrx->getSkillDescription(skillId);
576
577 if (optDto)
578 {
579 const auto& dto = *optDto;
580 skillTimeout =
581 armarx::core::time::Duration::MicroSeconds(dto.timeout.microSeconds);
582 }
583 else
584 {
585 ARMARX_WARNING << "SkillDescription not found";
586 }
587 skills::manager::dto::SkillExecutionID executionId =
588 this->managerPrx->executeSkillAsync(request);
589 this->runningSkills[shortcut.shortcutName] = executionId;
590 auto* btn = this->shortcutButtons.at(shortcut.shortcutName);
591 btn->setDisabled(true);
592 btn->startTimeout(skillTimeout.toSeconds());
593 }
594 catch (Ice::Exception const&)
595 {
596 ARMARX_WARNING << "Could not send execute request." << deactivateSpam(10);
597 std::string text = "Shortcut '" + name + "': Could not send execute request.";
598 QString timestamp = QDateTime::currentDateTime().toString("HH:mm:ss");
599 QString messageWithTimestamp =
600 QString("[%1] %2").arg(timestamp, QString::fromStdString(text));
601 this->errorMessageArea->newErrorMessage(messageWithTimestamp);
602 }
603 }
604 else
605 {
606 ARMARX_IMPORTANT << "Invalid SkillID";
607 }
608 }
609
610 void
611 SkillDashboardWidget::editShortcut(const std::string& name)
612 {
613 this->currentShortcutName = name;
614
615 SkillShortcut shortcut;
616 try
617 {
618 shortcut = this->dashboardPrx->getShortcut(name);
619 }
620 catch (Ice::Exception const&)
621 {
622 ARMARX_WARNING << "Could not fetch shortcut." << deactivateSpam(10);
623 }
624 openConfigWindow(
625 shortcut.shortcutName, shortcut.skillId, shortcut.skillArgs, shortcut.iconName);
626 this->currentShortcutName = "not set";
627 }
628
629 void
630 SkillDashboardWidget::deleteShortcut(const std::string& name)
631 {
632 ARMARX_INFO << "delete shortcut: " << name;
633 try
634 {
635 this->dashboardPrx->deleteShortcut(name);
636 //this->shortcutButtons.erase(this->shortcutButtons.find(name));
637 }
638 catch (Ice::Exception const&)
639 {
640 ARMARX_WARNING << "Could not delete shortcut." << deactivateSpam(10);
641 }
642 loadButtons();
643 }
644
645 void
646 SkillDashboardWidget::clearLayout(QLayout* layout)
647 {
648 if (!layout)
649 return;
650
651 while (QLayoutItem* item = layout->takeAt(0))
652 {
653 if (QWidget* widget = item->widget())
654 {
655 widget->deleteLater();
656 }
657 else if (QLayout* subLayout = item->layout())
658 {
659 clearLayout(subLayout);
660 }
661 delete item;
662 }
663 }
664
665 QPointer<QWidget>
667 {
668 if (customToolbar)
669 {
670 if (parent != customToolbar->parent())
671 {
672 customToolbar->setParent(parent);
673 }
674
675 return customToolbar.data();
676 }
677
678 customToolbar = new QToolBar(parent);
679 customToolbar->setIconSize(QSize(16, 16));
680 customToolbar->addAction(editModeAction);
681 customToolbar->addWidget(this->recoverButtons);
682
683 return customToolbar.data();
684 }
685
686 void
687 SkillDashboardWidget::editMode(bool edit)
688 {
689 if (edit)
690 {
691 for (const auto& button : this->deleteButtons)
692 {
693 button.second->setVisible(true);
694 }
695 for (const auto& button : this->configButtons)
696 {
697 button.second->setVisible(true);
698 }
699 ui.addButton->setVisible(true);
700 ui.reloadButton->setVisible(true);
701 ui.exportButton->setVisible(true);
702 ui.importButton->setVisible(true);
703 ui.exportConfiguration->setVisible(true);
704 ui.addFromClipboardButton->setVisible(true);
705 ui.shortcutListWidget->setDragDropMode(QAbstractItemView::InternalMove);
706 }
707 else
708 {
709 for (const auto& button : this->deleteButtons)
710 {
711 button.second->setVisible(false);
712 }
713 for (const auto& button : this->configButtons)
714 {
715 button.second->setVisible(false);
716 }
717 ui.addButton->setVisible(false);
718 ui.reloadButton->setVisible(false);
719 ui.exportButton->setVisible(false);
720 ui.importButton->setVisible(false);
721 ui.exportConfiguration->setVisible(false);
722 ui.addFromClipboardButton->setVisible(false);
723 ui.shortcutListWidget->setDragDropMode(QAbstractItemView::NoDragDrop);
724 }
725 }
726
727 void
728 SkillDashboardWidget::enableBlockedButtons()
729 {
730 for (auto& shortCutB : this->shortcutButtons)
731 {
732 shortCutB.second->setDisabled(false);
733 }
734 }
735
736 void
738 {
739 this->connected.store(false);
740 ARMARX_INFO << "Stopping thread which queries skill memory ...";
741 this->exampleTask.join();
742 ARMARX_INFO << "Stopped!";
743 }
744
745 void
749
750 QPointer<QDialog>
752 {
754
755 if (not m_config_dialog)
756 {
757 m_config_dialog = new armarx::SimpleConfigDialog{parent};
758 m_config_dialog->addProxyFinder<SkillDashboardInterfacePrx>(
759 {"SkillDashboard", "Skill Dashboard", "*SkillDashboard"});
760 m_config_dialog->addProxyFinder<skills::manager::dti::SkillManagerInterfacePrx>(
761 "SkillMemory", "", "*SkillMemory");
762 }
763 return qobject_cast<QDialog*>(m_config_dialog);
764 }
765
766 void
768 {
770 this->skillDashboardProxyName =
771 settings
772 ->value("skillDashboardProxyName", QString::fromStdString(skillDashboardProxyName))
773 .toString()
774 .toStdString();
775 this->skillManagerOberserverName =
776 settings->value("SkillMemory", "SkillMemory").toString().toStdString();
777 }
778
779 void
781 {
783 settings->setValue("skillDashboardProxyName",
784 QString::fromStdString(skillDashboardProxyName));
785 settings->setValue("SkillMemory", QString::fromStdString(this->skillManagerOberserverName));
786 }
787
788 void
790 {
792 if (m_config_dialog)
793 {
794 this->skillDashboardProxyName = m_config_dialog->getProxyName("SkillDashboard");
795 this->skillManagerOberserverName = m_config_dialog->getProxyName("SkillMemory");
796 }
797 }
798
799
800} // namespace armarx
std::string timestamp()
uint8_t data[1]
SpamFilterDataPtr deactivateSpam(SpamFilterDataPtr const &spamFilter, float deactivationDurationSec, const std::string &identifier, bool deactivate)
Definition Logging.cpp:75
std::enable_if<!HasGetWidgetName< ArmarXWidgetType >::value >::type addWidget()
virtual QPointer< QWidget > getWidget()
getWidget returns a pointer to the a widget of this controller.
static Duration SecondsDouble(double seconds)
Constructs a duration in seconds.
Definition Duration.cpp:78
bool usingProxy(const std::string &name, const std::string &endpoints="")
Registers a proxy for retrieval after initialization and adds it to the dependency list.
Ice::ObjectPrx getProxy(long timeoutMs=0, bool waitForScheduler=true) const
Returns the proxy of this object (optionally it waits for the proxy)
A config-dialog containing one (or multiple) proxy finders.
void addProxyFinder(const std::vector< EntryData > &entryData)
void onInitComponent() override
Pure virtual hook for the subclass.
QPointer< QWidget > getCustomTitlebarWidget(QWidget *parent) override
getTitleToolbar returns a pointer to the a toolbar widget of this controller.
void onDisconnectComponent() override
Hook for subclass.
void loadSettings(QSettings *settings) override
Implement to load the settings that are part of the GUI configuration.
void saveSettings(QSettings *settings) override
Implement to save the settings as part of the GUI configuration.
void onConnectComponent() override
Pure virtual hook for the subclass.
void configured() override
This function must be implemented by the user, if he supplies a config dialog.
void skillFinished(const std::string &name, skills::core::dto::Execution::Status status)
void onExitComponent() override
Hook for subclass.
QPointer< QDialog > getConfigDialog(QWidget *parent) override
getConfigDialog returns a pointer to the a configuration widget of this controller.
static data::DictPtr ConvertFromNlohmannJSONObject(const nlohmann::json &, const armarx::aron::Path &p={})
static void WaitFor(const Duration &duration)
Wait for a certain duration on the virtual clock.
Definition Clock.cpp:99
static Duration MicroSeconds(std::int64_t microSeconds)
Constructs a duration in microseconds.
Definition Duration.cpp:24
static Duration Seconds(std::int64_t seconds)
Constructs a duration in seconds.
Definition Duration.cpp:72
std::int64_t toSeconds() const
Returns the amount of seconds.
Definition Duration.cpp:84
#define ARMARX_INFO
The normal logging level.
Definition Logging.h:181
#define ARMARX_IMPORTANT
The logging level for always important information, but expected behaviour (in contrast to ARMARX_WAR...
Definition Logging.h:190
#define ARMARX_ERROR
The logging level for unexpected behaviour, that must be fixed.
Definition Logging.h:196
#define ARMARX_WARNING
The logging level for unexpected behaviour, but not a serious problem.
Definition Logging.h:193
bool update(mongocxx::collection &coll, const nlohmann::json &query, const nlohmann::json &update)
Definition mongodb.cpp:68
::IceInternal::Handle< Dict > DictPtr
std::shared_ptr< Dict > DictPtr
Definition Dict.h:42
This file offers overloads of toIce() and fromIce() functions for STL container types.
std::string errorStatustoString(skills::core::dto::Execution::Status s)
#define ARMARX_TRACE
Definition trace.h:77