@@ -170,9 +170,6 @@ ElementPropertiesDialog::ElementPropertiesDialog(Element *pComponent, QWidget *p
170170 pParametersScrollArea->setWidget (pParametersWidget);
171171 mParameterLabels .clear ();
172172 mParameterLineEdits .clear ();
173- LibraryTreeItem *pModelLibraryTreeItem = MainWindow::instance ()->getLibraryWidget ()->getLibraryTreeModel ()->findLibraryTreeItem (
174- StringHandler::getFirstWordBeforeDot (mpComponent->getLibraryTreeItem ()->getNameStructure ()));
175- bool modelInstantiated = pModelLibraryTreeItem && pModelLibraryTreeItem->isOMSModelInstantiated ();
176173 bool hasParameter = false ;
177174 if (mpComponent->getLibraryTreeItem ()->getOMSElement () && mpComponent->getLibraryTreeItem ()->getOMSElement ()->connectors ) {
178175 oms_connector_t ** pInterfaces = mpComponent->getLibraryTreeItem ()->getOMSElement ()->connectors ;
@@ -189,21 +186,21 @@ ElementPropertiesDialog::ElementPropertiesDialog(Element *pComponent, QWidget *p
189186 QDoubleValidator *pDoubleValidator = new QDoubleValidator (this );
190187 pParameterLineEdit->setValidator (pDoubleValidator);
191188 double value;
192- if (modelInstantiated && (status = OMSProxy::instance ()->getReal (nameStructure, &value))) {
189+ if ((status = OMSProxy::instance ()->getReal (nameStructure, &value))) {
193190 pParameterLineEdit->setText (QString::number (value));
194191 }
195192 } else if (pInterfaces[i]->type == oms_signal_type_integer) {
196193 QIntValidator *pIntValidator = new QIntValidator (this );
197194 pParameterLineEdit->setValidator (pIntValidator);
198195 int value;
199- if (modelInstantiated && (status = OMSProxy::instance ()->getInteger (nameStructure, &value))) {
196+ if ((status = OMSProxy::instance ()->getInteger (nameStructure, &value))) {
200197 pParameterLineEdit->setText (QString::number (value));
201198 }
202199 } else if (pInterfaces[i]->type == oms_signal_type_boolean) {
203200 QIntValidator *pIntValidator = new QIntValidator (this );
204201 pParameterLineEdit->setValidator (pIntValidator);
205202 bool value;
206- if (modelInstantiated && (status = OMSProxy::instance ()->getBoolean (nameStructure, &value))) {
203+ if ((status = OMSProxy::instance ()->getBoolean (nameStructure, &value))) {
207204 pParameterLineEdit->setText (QString::number (value));
208205 }
209206 } else if (pInterfaces[i]->type == oms_signal_type_string) {
@@ -258,21 +255,21 @@ ElementPropertiesDialog::ElementPropertiesDialog(Element *pComponent, QWidget *p
258255 QDoubleValidator *pDoubleValidator = new QDoubleValidator (this );
259256 pInputLineEdit->setValidator (pDoubleValidator);
260257 double value;
261- if (modelInstantiated && (status = OMSProxy::instance ()->getReal (nameStructure, &value))) {
258+ if ((status = OMSProxy::instance ()->getReal (nameStructure, &value))) {
262259 pInputLineEdit->setText (QString::number (value));
263260 }
264261 } else if (pInterfaces[i]->type == oms_signal_type_integer) {
265262 QIntValidator *pIntValidator = new QIntValidator (this );
266263 pInputLineEdit->setValidator (pIntValidator);
267264 int value;
268- if (modelInstantiated && (status = OMSProxy::instance ()->getInteger (nameStructure, &value))) {
265+ if ((status = OMSProxy::instance ()->getInteger (nameStructure, &value))) {
269266 pInputLineEdit->setText (QString::number (value));
270267 }
271268 } else if (pInterfaces[i]->type == oms_signal_type_boolean) {
272269 QIntValidator *pIntValidator = new QIntValidator (this );
273270 pInputLineEdit->setValidator (pIntValidator);
274271 bool value;
275- if (modelInstantiated && (status = OMSProxy::instance ()->getBoolean (nameStructure, &value))) {
272+ if ((status = OMSProxy::instance ()->getBoolean (nameStructure, &value))) {
276273 pInputLineEdit->setText (QString::number (value));
277274 }
278275 } else if (pInterfaces[i]->type == oms_signal_type_string) {
@@ -301,7 +298,6 @@ ElementPropertiesDialog::ElementPropertiesDialog(Element *pComponent, QWidget *p
301298 // Create the buttons
302299 mpOkButton = new QPushButton (Helper::ok);
303300 mpOkButton->setAutoDefault (true );
304- mpOkButton->setEnabled (modelInstantiated);
305301 connect (mpOkButton, SIGNAL (clicked ()), this , SLOT (updateProperties ()));
306302 mpCancelButton = new QPushButton (Helper::cancel);
307303 mpCancelButton->setAutoDefault (false );
@@ -355,38 +351,48 @@ void ElementPropertiesDialog::updateProperties()
355351 if (pInterfaces[i]->causality == oms_causality_parameter) {
356352 QString parameterValue = mParameterLineEdits .at (parametersIndex)->text ();
357353 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" );
370357 } 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+ }
372373 }
373374 } else if (pInterfaces[i]->causality == oms_causality_input) {
374375 QString inputValue = mInputLineEdits .at (inputsIndex)->text ();
375376 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" );
388380 } 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+ }
390396 }
391397 }
392398 }
0 commit comments