Changeset 9d11fa2 in OpenModelica
- Timestamp:
- 2020-10-16T15:17:36+02:00 (3 years ago)
- Branches:
- Added-citation-metadata, maintenance/v1.17, maintenance/v1.18, maintenance/v1.19, maintenance/v1.20, maintenance/v1.21, maintenance/v1.22, master, omlib-staging
- Children:
- 23fedde
- Parents:
- 1da8b221
- git-author:
- arun3688 <rain100falls@…> (10/16/20 15:17:36)
- git-committer:
- GitHub <noreply@…> (10/16/20 15:17:36)
- Location:
- OMEdit/OMEditLIB/OMS
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
OMEdit/OMEditLIB/OMS/ElementPropertiesDialog.cpp
r1a785313 r9d11fa2 171 171 mParameterLabels.clear(); 172 172 mParameterLineEdits.clear(); 173 LibraryTreeItem *pModelLibraryTreeItem = MainWindow::instance()->getLibraryWidget()->getLibraryTreeModel()->findLibraryTreeItem(174 StringHandler::getFirstWordBeforeDot(mpComponent->getLibraryTreeItem()->getNameStructure()));175 bool modelInstantiated = pModelLibraryTreeItem && pModelLibraryTreeItem->isOMSModelInstantiated();176 173 bool hasParameter = false; 177 174 if (mpComponent->getLibraryTreeItem()->getOMSElement() && mpComponent->getLibraryTreeItem()->getOMSElement()->connectors) { … … 190 187 pParameterLineEdit->setValidator(pDoubleValidator); 191 188 double value; 192 if ( modelInstantiated &&(status = OMSProxy::instance()->getReal(nameStructure, &value))) {189 if ((status = OMSProxy::instance()->getReal(nameStructure, &value))) { 193 190 pParameterLineEdit->setText(QString::number(value)); 194 191 } … … 197 194 pParameterLineEdit->setValidator(pIntValidator); 198 195 int value; 199 if ( modelInstantiated &&(status = OMSProxy::instance()->getInteger(nameStructure, &value))) {196 if ((status = OMSProxy::instance()->getInteger(nameStructure, &value))) { 200 197 pParameterLineEdit->setText(QString::number(value)); 201 198 } … … 204 201 pParameterLineEdit->setValidator(pIntValidator); 205 202 bool value; 206 if ( modelInstantiated &&(status = OMSProxy::instance()->getBoolean(nameStructure, &value))) {203 if ((status = OMSProxy::instance()->getBoolean(nameStructure, &value))) { 207 204 pParameterLineEdit->setText(QString::number(value)); 208 205 } … … 259 256 pInputLineEdit->setValidator(pDoubleValidator); 260 257 double value; 261 if ( modelInstantiated &&(status = OMSProxy::instance()->getReal(nameStructure, &value))) {258 if ((status = OMSProxy::instance()->getReal(nameStructure, &value))) { 262 259 pInputLineEdit->setText(QString::number(value)); 263 260 } … … 266 263 pInputLineEdit->setValidator(pIntValidator); 267 264 int value; 268 if ( modelInstantiated &&(status = OMSProxy::instance()->getInteger(nameStructure, &value))) {265 if ((status = OMSProxy::instance()->getInteger(nameStructure, &value))) { 269 266 pInputLineEdit->setText(QString::number(value)); 270 267 } … … 273 270 pInputLineEdit->setValidator(pIntValidator); 274 271 bool value; 275 if ( modelInstantiated &&(status = OMSProxy::instance()->getBoolean(nameStructure, &value))) {272 if ((status = OMSProxy::instance()->getBoolean(nameStructure, &value))) { 276 273 pInputLineEdit->setText(QString::number(value)); 277 274 } … … 302 299 mpOkButton = new QPushButton(Helper::ok); 303 300 mpOkButton->setAutoDefault(true); 304 mpOkButton->setEnabled(modelInstantiated);305 301 connect(mpOkButton, SIGNAL(clicked()), this, SLOT(updateProperties())); 306 302 mpCancelButton = new QPushButton(Helper::cancel); … … 356 352 QString parameterValue = mParameterLineEdits.at(parametersIndex)->text(); 357 353 parametersIndex++; 358 if (pInterfaces[i]->type == oms_signal_type_real) { 359 OMSProxy::instance()->setReal(nameStructure, parameterValue.toDouble()); 360 } else if (pInterfaces[i]->type == oms_signal_type_integer) { 361 OMSProxy::instance()->setInteger(nameStructure, parameterValue.toInt()); 362 } else if (pInterfaces[i]->type == oms_signal_type_boolean) { 363 OMSProxy::instance()->setBoolean(nameStructure, parameterValue.toInt()); 364 } else if (pInterfaces[i]->type == oms_signal_type_string) { 365 qDebug() << "ElementPropertiesDialog::updateProperties() oms_signal_type_string not implemented yet."; 366 } else if (pInterfaces[i]->type == oms_signal_type_enum) { 367 qDebug() << "ElementPropertiesDialog::updateProperties() oms_signal_type_enum not implemented yet."; 368 } else if (pInterfaces[i]->type == oms_signal_type_bus) { 369 qDebug() << "ElementPropertiesDialog::updateProperties() oms_signal_type_bus not implemented yet."; 354 if (parameterValue.isEmpty()) { 355 // delete start values only 356 OMSProxy::instance()->omsDelete(nameStructure + ":start"); 370 357 } else { 371 qDebug() << "ElementPropertiesDialog::updateProperties() unknown oms_signal_type_enu_t."; 358 if (pInterfaces[i]->type == oms_signal_type_real) { 359 OMSProxy::instance()->setReal(nameStructure, parameterValue.toDouble()); 360 } else if (pInterfaces[i]->type == oms_signal_type_integer) { 361 OMSProxy::instance()->setInteger(nameStructure, parameterValue.toInt()); 362 } else if (pInterfaces[i]->type == oms_signal_type_boolean) { 363 OMSProxy::instance()->setBoolean(nameStructure, parameterValue.toInt()); 364 } else if (pInterfaces[i]->type == oms_signal_type_string) { 365 qDebug() << "ElementPropertiesDialog::updateProperties() oms_signal_type_string not implemented yet."; 366 } else if (pInterfaces[i]->type == oms_signal_type_enum) { 367 qDebug() << "ElementPropertiesDialog::updateProperties() oms_signal_type_enum not implemented yet."; 368 } else if (pInterfaces[i]->type == oms_signal_type_bus) { 369 qDebug() << "ElementPropertiesDialog::updateProperties() oms_signal_type_bus not implemented yet."; 370 } else { 371 qDebug() << "ElementPropertiesDialog::updateProperties() unknown oms_signal_type_enu_t."; 372 } 372 373 } 373 374 } else if (pInterfaces[i]->causality == oms_causality_input) { 374 375 QString inputValue = mInputLineEdits.at(inputsIndex)->text(); 375 376 inputsIndex++; 376 if (pInterfaces[i]->type == oms_signal_type_real) { 377 OMSProxy::instance()->setReal(nameStructure, inputValue.toDouble()); 378 } else if (pInterfaces[i]->type == oms_signal_type_integer) { 379 OMSProxy::instance()->setInteger(nameStructure, inputValue.toInt()); 380 } else if (pInterfaces[i]->type == oms_signal_type_boolean) { 381 OMSProxy::instance()->setBoolean(nameStructure, inputValue.toInt()); 382 } else if (pInterfaces[i]->type == oms_signal_type_string) { 383 qDebug() << "ElementPropertiesDialog::updateProperties() oms_signal_type_string not implemented yet."; 384 } else if (pInterfaces[i]->type == oms_signal_type_enum) { 385 qDebug() << "ElementPropertiesDialog::updateProperties() oms_signal_type_enum not implemented yet."; 386 } else if (pInterfaces[i]->type == oms_signal_type_bus) { 387 qDebug() << "ElementPropertiesDialog::updateProperties() oms_signal_type_bus not implemented yet."; 377 if (inputValue.isEmpty()){ 378 // delete start values only 379 OMSProxy::instance()->omsDelete(nameStructure + ":start"); 388 380 } else { 389 qDebug() << "ElementPropertiesDialog::updateProperties() unknown oms_signal_type_enu_t."; 381 if (pInterfaces[i]->type == oms_signal_type_real) { 382 OMSProxy::instance()->setReal(nameStructure, inputValue.toDouble()); 383 } else if (pInterfaces[i]->type == oms_signal_type_integer) { 384 OMSProxy::instance()->setInteger(nameStructure, inputValue.toInt()); 385 } else if (pInterfaces[i]->type == oms_signal_type_boolean) { 386 OMSProxy::instance()->setBoolean(nameStructure, inputValue.toInt()); 387 } else if (pInterfaces[i]->type == oms_signal_type_string) { 388 qDebug() << "ElementPropertiesDialog::updateProperties() oms_signal_type_string not implemented yet."; 389 } else if (pInterfaces[i]->type == oms_signal_type_enum) { 390 qDebug() << "ElementPropertiesDialog::updateProperties() oms_signal_type_enum not implemented yet."; 391 } else if (pInterfaces[i]->type == oms_signal_type_bus) { 392 qDebug() << "ElementPropertiesDialog::updateProperties() oms_signal_type_bus not implemented yet."; 393 } else { 394 qDebug() << "ElementPropertiesDialog::updateProperties() unknown oms_signal_type_enu_t."; 395 } 390 396 } 391 397 } -
OMEdit/OMEditLIB/OMS/ModelDialog.cpp
r1a785313 r9d11fa2 534 534 mpCausalityComboBox->addItem("Input", oms_causality_input); 535 535 mpCausalityComboBox->addItem("Output", oms_causality_output); 536 mpCausalityComboBox->addItem("Parameter", oms_causality_parameter); 537 536 538 // type 537 539 mpTypeLabel = new Label(Helper::type);
Note: See TracChangeset
for help on using the changeset viewer.