Skip to content
Snippets Groups Projects
ProfileMenuWidget.cpp 2.52 KiB
Newer Older
#include "ProfileMenuWidget.h"
#include <QHBoxLayout>
#include <QLabel>
#include <QVBoxLayout>
#include <qboxlayout.h>
namespace armarx::skills::gui
{

Peter Albrecht's avatar
Peter Albrecht committed
    QIcon
    getIcon(const std::string name)
    {
        QPixmap pix(QString::fromStdString(":icons/" + name));
        QIcon icon(pix);
        return icon;
    }

    void
    ProfileMenuWidget::setupUi()
    {
        setArgsFromClipboard = new QPushButton();
        copyArgsToClipboard = new QPushButton();
Peter Albrecht's avatar
Peter Albrecht committed
        copySkillIdToClipboard = new QPushButton();
        resetArgsToProfile = new QPushButton();
        //profileSelector = new QComboBox();
        historySelector = new QPushButton();
        changesSelector = new QPushButton();
        // layouting
        QVBoxLayout* mainLayout = new QVBoxLayout();
        QHBoxLayout* topLayout = new QHBoxLayout();
        QHBoxLayout* bottomLayout = new QHBoxLayout();

        mainLayout->addLayout(topLayout);
        //mainLayout->addWidget(profileSelector);
        mainLayout->addLayout(bottomLayout);
        bottomLayout->addWidget(historySelector);
        bottomLayout->addWidget(changesSelector);
        

        topLayout->addWidget(setArgsFromClipboard);
        topLayout->addWidget(copyArgsToClipboard);
Peter Albrecht's avatar
Peter Albrecht committed
        topLayout->addWidget(copySkillIdToClipboard);
        topLayout->addWidget(resetArgsToProfile);

        this->setLayout(mainLayout);

        // Text
        setArgsFromClipboard->setText(QString::fromStdString(SET_ARGS_BUTTON_TEXT));
        copyArgsToClipboard->setText(QString::fromStdString(COPY_ARGS_BUTTON_TEXT));
Peter Albrecht's avatar
Peter Albrecht committed
        copyArgsToClipboard->setIcon(getIcon("edit-copy-4.svg"));
Peter Albrecht's avatar
Peter Albrecht committed
        copySkillIdToClipboard->setText(QString::fromStdString(COPY_SKILL_BUTTON_TEXT));
        copySkillIdToClipboard->setIcon(getIcon("edit-copy-4.svg"));
        resetArgsToProfile->setText(QString::fromStdString(RESET_ARGS_BUTTON_TEXT));
Peter Albrecht's avatar
Peter Albrecht committed
        resetArgsToProfile->setIcon(getIcon("refresh-black.svg"));
        //profileSelector->addItem(QString::fromStdString(DEFAULT_PROFILE_TEXT));
        //profileSelector->setDisabled(true);
        //profileSelector->setToolTip(QString::fromStdString(PROFILE_NOT_IMPLEMENTED));
        historySelector->setText(QString::fromStdString(HIST_BUTTON_TEXT));
        changesSelector->setText(QString::fromStdString(CNGS_BUTTON_TEXT));
    void ProfileMenuWidget::updateChangesSelector(skills::SkillID shownSkill) 
    {
        auto params = memory->getLatestParametersForSkill(shownSkill);
        changesSelector->setDisabled(not params.has_value());
    }


} // namespace armarx::skills::gui