54 QPointer<TipDialog> tipDialog,
58 stateInstance(stateInstance),
59 communicator(communicator),
60 variantInfo(variantInfo),
61 currentProfile(currentProfile),
66 setWindowTitle(
"State " + stateInstance->getInstanceName() +
" Dialog");
67 ui->tableInput->setCommunicator(communicator);
68 ui->tableLocal->setCommunicator(communicator);
69 ui->tableOutput->setCommunicator(communicator);
70 ui->tableInput->setCurrentProfile(currentProfile);
71 ui->tableLocal->setCurrentProfile(currentProfile);
72 ui->tableOutput->setCurrentProfile(currentProfile);
74 ui->tableLocal->hideValueColumns();
75 ui->tableOutput->hideValueColumns();
80 ui->tableInput->setVariantInfo(variantInfo);
81 ui->tableLocal->setVariantInfo(variantInfo);
82 ui->tableOutput->setVariantInfo(variantInfo);
88 if (!stateInstance->getParent())
91 ui->editInstanceName->setEnabled(
false);
94 ui->editInstanceName->setText(stateInstance->getInstanceName());
95 ui->editInstanceName->setValidator(
96 new QRegExpValidator(QRegExp(
"([a-zA-Z][a-zA-Z0-9_]*)"),
this));
100 ui->editStateName->setText(state->getStateName());
101 ui->stateDocuEditor->setPlainText(state->getDescription());
105 ui->cbOutgoingEvents->addItem(e->name);
106 eventDescriptionMap[e->name] = e->description;
109 if (!outgoingEvents.isEmpty())
111 eventNameComboboxChanged(ui->cbOutgoingEvents->currentText());
114 ui->tableInput->setStateInstance(stateInstance);
115 ui->tableInput->buildFromMap(state->getInputParameters());
116 ui->tableLocal->setStateInstance(stateInstance);
117 ui->tableLocal->buildFromMap(state->getLocalParameters());
118 ui->tableOutput->setStateInstance(stateInstance);
119 ui->tableOutput->buildFromMap(state->getOutputParameters());
121 connect(ui->tabWidget, SIGNAL(currentChanged(
int)),
this, SLOT(setBlackLists()));
126 ui->editStateName->setEnabled(
false);
127 ui->stateDocuEditor->setEnabled(
false);
128 ui->cbOutgoingEvents->setEnabled(
false);
129 ui->btnAddEvent->setEnabled(
false);
130 ui->tabWidget->setTabEnabled(1,
false);
131 ui->tabWidget->setTabEnabled(2,
false);
132 ui->tabWidget->setTabEnabled(3,
false);
136 std::dynamic_pointer_cast<statechartmodel::RemoteState>(stateInstance);
140 ui->editProxyName->setText(remoteState->proxyName);
144 ui->editProxyName->setEnabled(
false);
148 std::dynamic_pointer_cast<statechartmodel::EndState>(stateInstance);
152 ui->labelInstanceName->setText(
"State/Event name");
156 ui->labelInstanceName->setText(
"State Instance name");
160 fileDialog =
new QFileDialog(
this);
161 fileDialog->setModal(
true);
162 fileDialog->setFileMode(QFileDialog::ExistingFiles);
163 fileDialog->setOption(QFileDialog::HideNameFilterDetails,
false);
165 urls << QUrl::fromLocalFile(
166 QDesktopServices::storageLocation(QDesktopServices::HomeLocation))
167 << QUrl::fromLocalFile(
168 QDesktopServices::storageLocation(QDesktopServices::DesktopLocation));
175 fileDialog->setSidebarUrls(urls);
176 QStringList fileTypes;
177 fileTypes << tr(
"Libraries (*.so)") << tr(
"All Files (*.*)");
178 fileDialog->setNameFilters(fileTypes);
180 connect(fileDialog, SIGNAL(accepted()),
this, SLOT(loadLibrary()));
182 connect(ui->cbOutgoingEvents,
183 SIGNAL(currentIndexChanged(
const QString&)),
185 SLOT(eventNameComboboxChanged(
const QString&)));
186 connect(ui->btnAddEvent, SIGNAL(clicked()),
this, SLOT(eventButtonAdd()));
187 connect(ui->btnDeleteEvent, SIGNAL(clicked()),
this, SLOT(eventButtonDelete()));
189 ui->editEventDescription, SIGNAL(textChanged()),
this, SLOT(eventDescriptionChanged()));
190 connect(ui->btnLock, SIGNAL(toggled(
bool)),
this, SLOT(setLockStatus(
bool)));
191 connect(ui->tableInput,
192 SIGNAL(typeChanged(
int, QString)),
194 SLOT(updateLinkHint(
int, QString)));
195 connect(ui->tableLocal,
196 SIGNAL(typeChanged(
int, QString)),
198 SLOT(updateLinkHint(
int, QString)));
199 connect(ui->tableOutput,
200 SIGNAL(typeChanged(
int, QString)),
202 SLOT(updateLinkHint(
int, QString)));
204 ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(!readOnly);
209 setLockStatus(
false);
212 if (readOnly || !locked)
217 QRect rec = QApplication::desktop()->screenGeometry();
218 this->resize(rec.width() * 0.9, this->height());
220 updateLinkHint(0, 0);