Skip to content

Commit

Permalink
Handle enum connectors same as integers (#7403)
Browse files Browse the repository at this point in the history
Co-authored-by: Adeel Asghar <adeel.asghar@liu.se>
  • Loading branch information
lochel and adeas31 committed Apr 27, 2021
1 parent 6d0557a commit 6fe0e58
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 19 deletions.
8 changes: 2 additions & 6 deletions OMEdit/OMEditLIB/Element/Element.cpp
Expand Up @@ -1940,6 +1940,7 @@ void Element::drawOMSElement()
pInputPolygonAnnotation->setFillPattern(StringHandler::FillSolid);
switch (mpLibraryTreeItem->getOMSConnector()->type) {
case oms_signal_type_integer:
case oms_signal_type_enum:
pInputPolygonAnnotation->setLineColor(QColor(255,127,0));
pInputPolygonAnnotation->setFillColor(QColor(255,127,0));
break;
Expand All @@ -1950,9 +1951,6 @@ void Element::drawOMSElement()
case oms_signal_type_string:
qDebug() << "Element::drawOMSElement oms_signal_type_string not implemented yet.";
break;
case oms_signal_type_enum:
qDebug() << "Element::drawOMSElement oms_signal_type_enum not implemented yet.";
break;
case oms_signal_type_bus:
qDebug() << "Element::drawOMSElement oms_signal_type_bus not implemented yet.";
break;
Expand All @@ -1971,6 +1969,7 @@ void Element::drawOMSElement()
pOutputPolygonAnnotation->setFillPattern(StringHandler::FillSolid);
switch (mpLibraryTreeItem->getOMSConnector()->type) {
case oms_signal_type_integer:
case oms_signal_type_enum:
pOutputPolygonAnnotation->setLineColor(QColor(255, 127, 0));
pOutputPolygonAnnotation->setFillColor(QColor(255, 255, 255));
break;
Expand All @@ -1981,9 +1980,6 @@ void Element::drawOMSElement()
case oms_signal_type_string:
qDebug() << "Element::drawOMSElement oms_signal_type_string not implemented yet.";
break;
case oms_signal_type_enum:
qDebug() << "Element::drawOMSElement oms_signal_type_enum not implemented yet.";
break;
case oms_signal_type_bus:
qDebug() << "Element::drawOMSElement oms_signal_type_bus not implemented yet.";
break;
Expand Down
1 change: 1 addition & 0 deletions OMEdit/OMEditLIB/Modeling/LibraryTreeWidget.cpp
Expand Up @@ -455,6 +455,7 @@ QIcon LibraryTreeItem::getLibraryTreeItemIcon() const
return ResourceCache::getIcon(":/Resources/icons/package-icon.svg");
}
case oms_signal_type_integer:
case oms_signal_type_enum:
switch (mpOMSConnector->causality) {
case oms_causality_input:
return ResourceCache::getIcon(":/Resources/icons/integer-input-connector.svg");
Expand Down
16 changes: 4 additions & 12 deletions OMEdit/OMEditLIB/OMS/ElementPropertiesDialog.cpp
Expand Up @@ -186,7 +186,7 @@ ElementPropertiesDialog::ElementPropertiesDialog(Element *pComponent, QWidget *p
if ((status = OMSProxy::instance()->getReal(nameStructure, &value))) {
pParameterLineEdit->setText(QString::number(value));
}
} else if (pInterfaces[i]->type == oms_signal_type_integer) {
} else if (pInterfaces[i]->type == oms_signal_type_integer || pInterfaces[i]->type == oms_signal_type_enum) {
QIntValidator *pIntValidator = new QIntValidator(this);
pParameterLineEdit->setValidator(pIntValidator);
int value;
Expand All @@ -202,8 +202,6 @@ ElementPropertiesDialog::ElementPropertiesDialog(Element *pComponent, QWidget *p
}
} else if (pInterfaces[i]->type == oms_signal_type_string) {
qDebug() << "ElementPropertiesDialog::ElementPropertiesDialog() oms_signal_type_string not implemented yet.";
} else if (pInterfaces[i]->type == oms_signal_type_enum) {
qDebug() << "ElementPropertiesDialog::ElementPropertiesDialog() oms_signal_type_enum not implemented yet.";
} else if (pInterfaces[i]->type == oms_signal_type_bus) {
qDebug() << "ElementPropertiesDialog::ElementPropertiesDialog() oms_signal_type_bus not implemented yet.";
} else {
Expand Down Expand Up @@ -256,7 +254,7 @@ ElementPropertiesDialog::ElementPropertiesDialog(Element *pComponent, QWidget *p
if ((status = OMSProxy::instance()->getReal(nameStructure, &value))) {
pInputLineEdit->setText(QString::number(value));
}
} else if (pInterfaces[i]->type == oms_signal_type_integer) {
} else if (pInterfaces[i]->type == oms_signal_type_integer || pInterfaces[i]->type == oms_signal_type_enum) {
QIntValidator *pIntValidator = new QIntValidator(this);
pInputLineEdit->setValidator(pIntValidator);
int value;
Expand All @@ -272,8 +270,6 @@ ElementPropertiesDialog::ElementPropertiesDialog(Element *pComponent, QWidget *p
}
} else if (pInterfaces[i]->type == oms_signal_type_string) {
qDebug() << "ElementPropertiesDialog::ElementPropertiesDialog() oms_signal_type_string not implemented yet.";
} else if (pInterfaces[i]->type == oms_signal_type_enum) {
qDebug() << "ElementPropertiesDialog::ElementPropertiesDialog() oms_signal_type_enum not implemented yet.";
} else if (pInterfaces[i]->type == oms_signal_type_bus) {
qDebug() << "ElementPropertiesDialog::ElementPropertiesDialog() oms_signal_type_bus not implemented yet.";
} else {
Expand Down Expand Up @@ -351,14 +347,12 @@ void ElementPropertiesDialog::updateProperties()
} else {
if (pInterfaces[i]->type == oms_signal_type_real) {
OMSProxy::instance()->setReal(nameStructure, parameterValue.toDouble());
} else if (pInterfaces[i]->type == oms_signal_type_integer) {
} else if (pInterfaces[i]->type == oms_signal_type_integer || pInterfaces[i]->type == oms_signal_type_enum) {
OMSProxy::instance()->setInteger(nameStructure, parameterValue.toInt());
} else if (pInterfaces[i]->type == oms_signal_type_boolean) {
OMSProxy::instance()->setBoolean(nameStructure, parameterValue.toInt());
} else if (pInterfaces[i]->type == oms_signal_type_string) {
qDebug() << "ElementPropertiesDialog::updateProperties() oms_signal_type_string not implemented yet.";
} else if (pInterfaces[i]->type == oms_signal_type_enum) {
qDebug() << "ElementPropertiesDialog::updateProperties() oms_signal_type_enum not implemented yet.";
} else if (pInterfaces[i]->type == oms_signal_type_bus) {
qDebug() << "ElementPropertiesDialog::updateProperties() oms_signal_type_bus not implemented yet.";
} else {
Expand All @@ -374,14 +368,12 @@ void ElementPropertiesDialog::updateProperties()
} else {
if (pInterfaces[i]->type == oms_signal_type_real) {
OMSProxy::instance()->setReal(nameStructure, inputValue.toDouble());
} else if (pInterfaces[i]->type == oms_signal_type_integer) {
} else if (pInterfaces[i]->type == oms_signal_type_integer || pInterfaces[i]->type == oms_signal_type_enum) {
OMSProxy::instance()->setInteger(nameStructure, inputValue.toInt());
} else if (pInterfaces[i]->type == oms_signal_type_boolean) {
OMSProxy::instance()->setBoolean(nameStructure, inputValue.toInt());
} else if (pInterfaces[i]->type == oms_signal_type_string) {
qDebug() << "ElementPropertiesDialog::updateProperties() oms_signal_type_string not implemented yet.";
} else if (pInterfaces[i]->type == oms_signal_type_enum) {
qDebug() << "ElementPropertiesDialog::updateProperties() oms_signal_type_enum not implemented yet.";
} else if (pInterfaces[i]->type == oms_signal_type_bus) {
qDebug() << "ElementPropertiesDialog::updateProperties() oms_signal_type_bus not implemented yet.";
} else {
Expand Down

0 comments on commit 6fe0e58

Please sign in to comment.