Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
- Better vector connections support.

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@25186 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adeas31 committed Mar 20, 2015
1 parent 925859c commit 08cc985
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 19 deletions.
20 changes: 4 additions & 16 deletions OMEdit/OMEditGUI/Annotations/LineAnnotation.cpp
Expand Up @@ -691,16 +691,13 @@ ConnectionArray::ConnectionArray(GraphicsView *pGraphicsView, LineAnnotation *pC
}
mpDescriptionLabel = new Label(tr("Connect ").append(startComponentDescription).append(tr(" with ")).append(endComponentDescription));
// start component
QIntValidator *pIntValidator = new QIntValidator(this);
pIntValidator->setBottom(0);
if (pConnectionLineAnnotation->getStartComponent()->getParentComponent()) {
mpStartComponentLabel = new Label(tr("Enter <b>index</b> value for <b>").append(pConnectionLineAnnotation->getStartComponent()->getParentComponent()->getName())
.append(".").append(pConnectionLineAnnotation->getStartComponent()->getName()).append("<b>"));
} else {
mpStartComponentLabel = new Label(tr("Enter <b>index</b> value for <b>").append(pConnectionLineAnnotation->getStartComponent()->getName()).append("<b>"));
}
mpStartComponentTextBox = new QLineEdit;
mpStartComponentTextBox->setValidator(pIntValidator);
// end component
if (pConnectionLineAnnotation->getEndComponent()->getParentComponent()) {
mpEndComponentLabel = new Label(tr("Enter <b>index</b> value for <b>").append(pConnectionLineAnnotation->getEndComponent()->getParentComponent()->getName())
Expand All @@ -709,7 +706,6 @@ ConnectionArray::ConnectionArray(GraphicsView *pGraphicsView, LineAnnotation *pC
mpEndComponentLabel = new Label(tr("Enter <b>index</b> value for <b>").append(pConnectionLineAnnotation->getEndComponent()->getName()).append("</b>"));
}
mpEndComponentTextBox = new QLineEdit;
mpEndComponentTextBox->setValidator(pIntValidator);
// Create the buttons
mpOkButton = new QPushButton(Helper::ok);
mpOkButton->setAutoDefault(true);
Expand Down Expand Up @@ -758,13 +754,9 @@ void ConnectionArray::saveArrayIndex()
// set the start component name if start component is an array
if (mpConnectionLineAnnotation->getStartComponent()->getComponentInfo()) {
if (mpConnectionLineAnnotation->getStartComponent()->getComponentInfo()->isArray()) {
if (mpStartComponentTextBox->text().isEmpty()) {
QMessageBox::critical(mpGraphicsView->getModelWidget()->getModelWidgetContainer()->getMainWindow(),
QString(Helper::applicationName).append(" - ").append(Helper::error),
GUIMessages::getMessage(GUIMessages::ENTER_VALID_INTEGER).arg(startComponentName), Helper::ok);
return;
if (!mpStartComponentTextBox->text().isEmpty()) {
startComponentName = QString(startComponentName).append("[").append(mpStartComponentTextBox->text()).append("]");
}
startComponentName = QString(startComponentName).append("[").append(mpStartComponentTextBox->text()).append("]");
}
}
// set end component name
Expand All @@ -777,13 +769,9 @@ void ConnectionArray::saveArrayIndex()
// set the end component name if end component is an array
if (mpConnectionLineAnnotation->getEndComponent()->getComponentInfo()) {
if (mpConnectionLineAnnotation->getEndComponent()->getComponentInfo()->isArray()) {
if (mpEndComponentTextBox->text().isEmpty()) {
QMessageBox::critical(mpGraphicsView->getModelWidget()->getModelWidgetContainer()->getMainWindow(),
QString(Helper::applicationName).append(" - ").append(Helper::error),
GUIMessages::getMessage(GUIMessages::ENTER_VALID_INTEGER).arg(endComponentName), Helper::ok);
return;
if (!mpEndComponentTextBox->text().isEmpty()) {
endComponentName = QString(endComponentName).append("[").append(mpEndComponentTextBox->text()).append("]");
}
endComponentName = QString(endComponentName).append("[").append(mpEndComponentTextBox->text()).append("]");
}
}
mpGraphicsView->createConnection(startComponentName, endComponentName);
Expand Down
2 changes: 0 additions & 2 deletions OMEdit/OMEditGUI/Util/Helper.cpp
Expand Up @@ -538,8 +538,6 @@ QString GUIMessages::getMessage(int type)
return tr("You cannot do a plot parametric between two different simulation result files. Make sure you select two variables from the same simulation result file.");
case FILE_FORMAT_NOT_SUPPORTED:
return tr("The file <b>%1</b> is not a valid Modelica file. The file format is not supported. You can only open <b>%2</b>.");
case ENTER_VALID_INTEGER:
return tr("Enter a valid positive integer index value for <b>%1</b>.");
case ENTER_VALID_NUMBER:
return tr("Enter a valid number value for <b>%1</b>.");
case ITEM_DROPPED_ON_ITSELF:
Expand Down
1 change: 0 additions & 1 deletion OMEdit/OMEditGUI/Util/Helper.h
Expand Up @@ -334,7 +334,6 @@ class GUIMessages : public QObject
ICON_VIEW_DROP_MSG,
PLOT_PARAMETRIC_DIFF_FILES,
FILE_FORMAT_NOT_SUPPORTED,
ENTER_VALID_INTEGER,
ENTER_VALID_NUMBER,
ITEM_DROPPED_ON_ITSELF,
MAKE_REPLACEABLE_IF_PARTIAL,
Expand Down

0 comments on commit 08cc985

Please sign in to comment.