48 QList<QString> selectedProxies,
51 const QMap<QString, QString>& statechartGroupConfigurations,
52 const QString& description,
57 packageTool(packageTool),
59 statechartProfiles(statechartProfiles),
60 configurations(statechartGroupConfigurations),
61 variantInfo(variantInfo),
65 ui->btnShowPackageError->setVisible(
false);
67 ui->checkBoxGenerateContext->setChecked(generateContext);
69 connect(ui->checkBoxGenerateContext,
70 SIGNAL(stateChanged(
int)),
76 setWindowTitle(
"Create new Statechart Group");
77 QRegExp rx(
"([a-zA-Z][a-zA-Z0-9]*)");
78 ui->editStatechartGroup->setValidator(
new QRegExpValidator(rx,
this));
80 connect(ui->btnSelectPackageFolder, SIGNAL(clicked()),
this, SLOT(
selectPackagePath()));
81 connect(ui->editPackagePath,
82 SIGNAL(textChanged(QString)),
85 connect(ui->editStatechartGroup,
86 SIGNAL(textChanged(QString)),
90 timer =
new QTimer(
this);
92 timer->setSingleShot(
true);
95 ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(
false);
96 ui->tabWidget->setCurrentIndex(0);
100 setWindowTitle(groupName +
" - Properties");
101 ui->editStatechartGroup->setText(groupName);
102 ui->textEditGroupDescription->setPlainText(description);
103 ui->editPackagePath->setEnabled(
false);
104 ui->editStatechartGroup->setEnabled(
false);
105 ui->btnSelectPackageFolder->setEnabled(
false);
107 ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(
true);
111 throw LocalException(
"Not supported enum value.");
114 QStringList properties;
115 QStandardItemModel* model =
new QStandardItemModel(ui->listProxies);
119 QString libName = QString::fromUtf8(lib->getName().c_str());
124 QString proxyHumanName = QString::fromUtf8(proxy->getHumanName().c_str());
125 QString proxyMemberName = QString::fromUtf8(proxy->getMemberName().c_str());
126 QString display = QString(
"[%1] %3").arg(libName, proxyHumanName);
127 QStandardItem* listItem =
new QStandardItem(display);
128 QString proxyId = QString(
"%1.%2").arg(libName, proxyMemberName);
129 listItem->setData(proxyId, Qt::UserRole);
130 listItem->setCheckable(
true);
131 listItem->setEditable(
false);
132 listItem->setCheckState(selectedProxies.contains(proxyId) ? Qt::Checked
134 model->appendRow(listItem);
138 filterModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
139 filterModel->setSourceModel(model);
140 ui->listProxies->setModel(filterModel);
141 connect(ui->lineEditProxyFilter,
142 SIGNAL(textChanged(QString)),
144 SLOT(setFilterFixedString(QString)));
147 std::list<StatechartProfilePtr> profileQueue;
148 profileQueue.push_back(statechartProfiles->getRootProfile());
149 connect(ui->comboBoxStatechartProfiles,
150 SIGNAL(currentIndexChanged(QString)),
153 connect(ui->tabWidget,
154 SIGNAL(currentChanged(
int)),
157 while (!profileQueue.empty())
160 profileQueue.pop_front();
161 ui->comboBoxStatechartProfiles->addItem(
162 QString(currentProfile->getNesting(),
'-') +
" " +
163 QString::fromStdString(currentProfile->getName()),
164 QString::fromStdString(currentProfile->getName()));
165 for (
auto it = currentProfile->getChildren().rbegin();
166 it != currentProfile->getChildren().rend();
169 profileQueue.push_front(*it);
171 if (profileQueue.size() == 0)
175 if (configurations[QString::fromStdString(currentProfile->getName())].isEmpty())
177 configurations[QString::fromStdString(currentProfile->getName())] =
178 properties.join(
"\n");
183 connect(ui->listProxies->model(),
184 SIGNAL(dataChanged(QModelIndex, QModelIndex)),
358 std::string cmdOutput;
359 if (packageTool->checkPackagePath(ui->editPackagePath->text().toStdString(), cmdOutput))
361 ui->labelPackageError->setText(
"Package path is valid.");
362 QPalette p(ui->labelPackageError->palette());
363 p.setColor(ui->labelPackageError->backgroundRole(), QColor::fromRgb(120, 255, 120));
365 ui->labelPackageError->setPalette(p);
367 if (!ui->editStatechartGroup->text().isEmpty())
369 ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(
true);
373 ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(
false);
375 ui->labelPackageError->setToolTip(
"");
376 ui->btnShowPackageError->setVisible(
false);
380 ui->labelPackageError->setText(
"Package path is not valid!");
381 ui->labelPackageError->setToolTip(QString::fromStdString(cmdOutput));
382 QPalette p(ui->labelPackageError->palette());
383 p.setColor(ui->labelPackageError->backgroundRole(), QColor::fromRgb(255, 120, 120));
384 ui->labelPackageError->setPalette(p);
385 ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(
false);
386 ui->btnShowPackageError->setVisible(
true);
428 QString libName = QString::fromUtf8(lib->getName().c_str());
431 QString proxyMemberName = QString::fromUtf8(proxy->getMemberName().c_str());
432 QString proxyId = QString(
"%1.%2").arg(libName, proxyMemberName);
433 if (selectedProxies.contains(proxyId))
435 if (!libs.contains(libName))
445 Ice::StringSeq types;
448 for (
auto& param : state->getInputParameters())
450 vars.insert(param->type);
452 for (
auto& param : state->getLocalParameters())
454 vars.insert(param->type);
456 for (
auto& param : state->getOutputParameters())
458 vars.insert(param->type);
461 for (
auto& var : vars)
466 types.push_back(type);
469 for (std::string& lib : variantInfo->findLibNames(types))
471 auto libName = QString::fromStdString(lib);
472 if (!libs.contains(libName))
478 ui->editDependencies->setText(libs.join(
" "));
EditStatechartGroupDialog(EditMode editMode, QString groupName, ArmarXPackageToolInterfacePtr packageTool, VariantInfoPtr variantInfo, QList< QString > selectedProxies, bool generateContext, const StatechartProfilesPtr &statechartProfiles, const QMap< QString, QString > &statechartGroupConfigurations=QMap< QString, QString >(), const QString &description="", StatechartGroupPtr group=StatechartGroupPtr(), QWidget *parent=0)