30#include <QStylePlugin>
38 QDialog(parent), ui(new
Ui::SkillDashboardConfig)
41 this->setWindowTitle(
"Configure Skill");
42 connect(ui->dialogButtons, &QDialogButtonBox::accepted,
this, &QDialog::accept);
43 connect(ui->dialogButtons, &QDialogButtonBox::rejected,
this, &QDialog::reject);
44 connect(ui->buttonName,
45 &QLineEdit::textChanged,
47 &SkillDashboardConfigWindow::onShortcutNameChanged);
51 SkillDashboardConfigWindow::onShortcutNameChanged()
59 return ui->buttonName->text();
65 return ui->skillName->text();
71 return ui->skillArgs->toPlainText();
77 ui->buttonName->setText(QString::fromStdString(name));
83 ui->skillName->setText(QString::fromStdString(
id));
89 ui->skillArgs->setPlainText(QString::fromStdString(config));
95 ui->infoText->setText(QString::fromStdString(info));
96 ui->infoText->setStyleSheet(
"color: red;");
106 this->hboxLayout =
new QHBoxLayout(
this);
107 this->hboxLayout->setContentsMargins(6, 2, 6, 2);
108 this->hboxLayout->setSpacing(4);
110 this->label =
new QLabel(
this);
111 this->label->setWordWrap(
true);
112 this->label->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
113 this->label->setStyleSheet(
"color: red;");
114 this->hboxLayout->addWidget(label);
119 this->closeButton =
new QPushButton(
"✕",
this);
120 this->closeButton->setFixedSize(18, 18);
121 this->closeButton->setStyleSheet(R
"(
132 this->showAllButton = new QPushButton(
this);
133 this->showAllButton->setFixedSize(20, 20);
135 this->showAllButton->setIcon(
136 parentWidget()->style()->standardIcon(QStyle::SP_ToolBarVerticalExtensionButton));
137 this->hboxLayout->addWidget(showAllButton);
139 showAllButton, &QPushButton::clicked,
this, &MessageWidget::showAllButtonClicked);
140 this->hboxLayout->addWidget(closeButton);
141 connect(closeButton, &QPushButton::clicked,
this, &MessageWidget::closeButtonClicked);
148 MessageWidget::closeButtonClicked()
150 this->messages.pop();
151 if (this->messages.empty())
157 this->label->setText(messages.top());
162 MessageWidget::showAllButtonClicked()
164 QLayout* mainLayout =
nullptr;
166 mainLayout = parentWidget()->layout();
170 if (not this->closeAllButton)
172 QPushButton* closeAll =
new QPushButton(
"Close all", parentWidget());
173 connect(closeAll, &QPushButton::clicked,
this, &MessageWidget::closeAllButtonClicked);
174 mainLayout->addWidget(closeAll);
175 this->closeAllButton =
true;
178 while (!messages.empty())
180 const QString& text = messages.top();
182 w->newErrorMessage(text);
183 mainLayout->addWidget(w);
184 allMessageWidgets.push_back(w);
192 MessageWidget::closeAllButtonClicked()
194 QLayout* mainLayout =
nullptr;
196 mainLayout = parentWidget()->layout();
203 mainLayout->removeWidget(w);
207 allMessageWidgets.clear();
209 QPushButton* button = qobject_cast<QPushButton*>(sender());
212 mainLayout->removeWidget(button);
214 button->deleteLater();
216 this->closeAllButton =
false;
222 this->messages.push(text);
223 this->label->setText(text);
224 if (not QWidget::isVisible())
~SkillDashboardConfigWindow()
void shortcutNameHasChanged()
void setSkillId(const std::string &id)
void setInfoText(const std::string &info)
void setShortcutName(const std::string &name)
SkillDashboardConfigWindow(QWidget *parent=nullptr)
QString getShortcutName()
void setSkillConfig(const std::string &config)
This file offers overloads of toIce() and fromIce() functions for STL container types.