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