30#include <QStylePlugin>
32#include <QDesktopServices>
40 QDialog(parent), ui(new
Ui::SkillDashboardConfig)
43 this->setWindowTitle(
"Configure Skill");
44 connect(ui->dialogButtons, &QDialogButtonBox::accepted,
this, &QDialog::accept);
45 connect(ui->dialogButtons, &QDialogButtonBox::rejected,
this, &QDialog::reject);
46 connect(ui->linkButton, &QPushButton::clicked,
this, &SkillDashboardConfigWindow::openNerdFontSearch);
47 connect(ui->buttonName,
48 &QLineEdit::textChanged,
50 &SkillDashboardConfigWindow::onShortcutNameChanged);
54 SkillDashboardConfigWindow::onShortcutNameChanged()
62 return ui->buttonName->text();
68 return ui->iconName->text();
72 SkillDashboardConfigWindow::openNerdFontSearch()
74 QDesktopServices::openUrl(QUrl(
"https://www.nerdfonts.com/cheat-sheet"));
81 return ui->skillName->text();
87 return ui->skillArgs->toPlainText();
93 ui->buttonName->setText(QString::fromStdString(name));
99 ui->skillName->setText(QString::fromStdString(
id));
105 ui->iconName->setText(QString::fromStdString(iconName));
111 ui->skillArgs->setPlainText(QString::fromStdString(config));
117 ui->infoText->setText(QString::fromStdString(info));
118 ui->infoText->setStyleSheet(
"color: red;");
128 this->hboxLayout =
new QHBoxLayout(
this);
129 this->hboxLayout->setContentsMargins(6, 2, 6, 2);
130 this->hboxLayout->setSpacing(4);
132 this->label =
new QLabel(
this);
133 this->label->setWordWrap(
true);
134 this->label->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
135 this->label->setStyleSheet(
"color: red;");
136 this->hboxLayout->addWidget(label);
141 this->closeButton =
new QPushButton(
"✕",
this);
142 this->closeButton->setFixedSize(18, 18);
143 this->closeButton->setStyleSheet(R
"(
154 this->showAllButton = new QPushButton(
this);
155 this->showAllButton->setFixedSize(20, 20);
157 this->showAllButton->setIcon(
158 parentWidget()->style()->standardIcon(QStyle::SP_ToolBarVerticalExtensionButton));
159 this->hboxLayout->addWidget(showAllButton);
161 showAllButton, &QPushButton::clicked,
this, &MessageWidget::showAllButtonClicked);
162 this->hboxLayout->addWidget(closeButton);
163 connect(closeButton, &QPushButton::clicked,
this, &MessageWidget::closeButtonClicked);
170 MessageWidget::closeButtonClicked()
172 this->messages.pop();
173 if (this->messages.empty())
179 this->label->setText(messages.top());
184 MessageWidget::showAllButtonClicked()
186 QLayout* mainLayout =
nullptr;
188 mainLayout = parentWidget()->layout();
192 if (not this->closeAllButton)
194 QPushButton* closeAll =
new QPushButton(
"Close all", parentWidget());
195 connect(closeAll, &QPushButton::clicked,
this, &MessageWidget::closeAllButtonClicked);
196 mainLayout->addWidget(closeAll);
197 this->closeAllButton =
true;
200 while (!messages.empty())
202 const QString& text = messages.top();
204 w->newErrorMessage(text);
205 mainLayout->addWidget(w);
206 allMessageWidgets.push_back(w);
214 MessageWidget::closeAllButtonClicked()
216 QLayout* mainLayout =
nullptr;
218 mainLayout = parentWidget()->layout();
225 mainLayout->removeWidget(w);
229 allMessageWidgets.clear();
231 QPushButton* button = qobject_cast<QPushButton*>(sender());
234 mainLayout->removeWidget(button);
236 button->deleteLater();
238 this->closeAllButton =
false;
244 this->messages.push(text);
245 this->label->setText(text);
246 if (not QWidget::isVisible())
~SkillDashboardConfigWindow()
void shortcutNameHasChanged()
void setSkillId(const std::string &id)
void setInfoText(const std::string &info)
void setIconName(const std::string &iconName)
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.