ProfileMenuWidget.cpp
Go to the documentation of this file.
1#include "ProfileMenuWidget.h"
2
3#include <QHBoxLayout>
4#include <QLabel>
5#include <QVBoxLayout>
6#include <qboxlayout.h>
7
9{
10
11 QIcon
12 getIcon(const std::string name)
13 {
14 QPixmap pix(QString::fromStdString(":icons/" + name));
15 QIcon icon(pix);
16 return icon;
17 }
18
19 void
20 ProfileMenuWidget::setupUi()
21 {
22 setArgsFromClipboard = new QPushButton();
23 copyArgsToClipboard = new QPushButton();
24 copyShortcutToClipboard = new QPushButton();
25 resetArgsToProfile = new QPushButton();
26 //profileSelector = new QComboBox();
27 historySelector = new QPushButton();
28 changesSelector = new QPushButton();
29
30 // layouting
31 QVBoxLayout* mainLayout = new QVBoxLayout();
32 QHBoxLayout* topLayout = new QHBoxLayout();
33 QHBoxLayout* bottomLayout = new QHBoxLayout();
34
35 mainLayout->addLayout(topLayout);
36 //mainLayout->addWidget(profileSelector);
37 mainLayout->addLayout(bottomLayout);
38 bottomLayout->addWidget(historySelector);
39 bottomLayout->addWidget(changesSelector);
40
41
42 topLayout->addWidget(setArgsFromClipboard);
43 topLayout->addWidget(copyArgsToClipboard);
44 topLayout->addWidget(copyShortcutToClipboard);
45 topLayout->addWidget(resetArgsToProfile);
46
47 this->setLayout(mainLayout);
48
49 // Text
50 setArgsFromClipboard->setText(QString::fromStdString(SET_ARGS_BUTTON_TEXT));
51 copyArgsToClipboard->setText(QString::fromStdString(COPY_ARGS_BUTTON_TEXT));
52 copyArgsToClipboard->setIcon(getIcon("edit-copy-4.svg"));
53 copyShortcutToClipboard->setText(QString::fromStdString(COPY_SHORTCUT_BUTTON_TEXT));
54 copyShortcutToClipboard->setIcon(getIcon("edit-copy-4.svg"));
55 resetArgsToProfile->setText(QString::fromStdString(RESET_ARGS_BUTTON_TEXT));
56 resetArgsToProfile->setIcon(getIcon("refresh-black.svg"));
57 //profileSelector->addItem(QString::fromStdString(DEFAULT_PROFILE_TEXT));
58 //profileSelector->setDisabled(true);
59 //profileSelector->setToolTip(QString::fromStdString(PROFILE_NOT_IMPLEMENTED));
60 historySelector->setText(QString::fromStdString(HIST_BUTTON_TEXT));
61 changesSelector->setText(QString::fromStdString(CNGS_BUTTON_TEXT));
62 }
63
64 void
66 {
67 auto params = memory->getLatestParametersForSkill(shownSkill);
68 changesSelector->setDisabled(not params.has_value());
69 }
70
71
72} // namespace armarx::skills::gui
std::shared_ptr< SkillManagerWrapper > memory
static const constexpr char * HIST_BUTTON_TEXT
static const constexpr char * SET_ARGS_BUTTON_TEXT
static const constexpr char * RESET_ARGS_BUTTON_TEXT
static const constexpr char * CNGS_BUTTON_TEXT
void updateChangesSelector(const skills::SkillID shownSkill)
static const constexpr char * COPY_SHORTCUT_BUTTON_TEXT
static const constexpr char * COPY_ARGS_BUTTON_TEXT
QIcon getIcon(const std::string name)