Skip to content

Commit

Permalink
Better naming convention for metamodels and TLM.
Browse files Browse the repository at this point in the history
  • Loading branch information
adeas31 committed Mar 10, 2016
1 parent 04f142b commit 36a52a8
Show file tree
Hide file tree
Showing 26 changed files with 368 additions and 368 deletions.
8 changes: 4 additions & 4 deletions OMEdit/OMEditGUI/Annotations/LineAnnotation.cpp
Expand Up @@ -466,7 +466,7 @@ QString LineAnnotation::getShapeAnnotation()
return QString("Line(").append(annotationString.join(",")).append(")");
}

QString LineAnnotation::getTLMShapeAnnotation()
QString LineAnnotation::getMetaModelShapeAnnotation()
{
QStringList annotationString;
annotationString.append(GraphicItem::getShapeAnnotation());
Expand Down Expand Up @@ -710,9 +710,9 @@ void LineAnnotation::handleComponentMoved()
*/
void LineAnnotation::updateConnectionAnnotation()
{
if (mpGraphicsView->getModelWidget()->getLibraryTreeItem()->getLibraryType()== LibraryTreeItem::TLM) {
TLMEditor *pTLMEditor = dynamic_cast<TLMEditor*>(mpGraphicsView->getModelWidget()->getEditor());
pTLMEditor->updateTLMConnectiontAnnotation(getStartComponentName(), getEndComponentName(), getTLMShapeAnnotation());
if (mpGraphicsView->getModelWidget()->getLibraryTreeItem()->getLibraryType()== LibraryTreeItem::MetaModel) {
MetaModelEditor *pMetaModelEditor = dynamic_cast<MetaModelEditor*>(mpGraphicsView->getModelWidget()->getEditor());
pMetaModelEditor->updateConnection(getStartComponentName(), getEndComponentName(), getMetaModelShapeAnnotation());
} else {
// get the connection line annotation.
QString annotationString = QString("annotate=").append(getShapeAnnotation());
Expand Down
2 changes: 1 addition & 1 deletion OMEdit/OMEditGUI/Annotations/LineAnnotation.h
Expand Up @@ -75,7 +75,7 @@ class LineAnnotation : public ShapeAnnotation
QPolygonF drawArrow(QPointF startPos, QPointF endPos, qreal size, int arrowType) const;
QString getOMCShapeAnnotation();
QString getShapeAnnotation();
QString getTLMShapeAnnotation();
QString getMetaModelShapeAnnotation();
void addPoint(QPointF point);
void removePoint(int index);
void clearPoints();
Expand Down
4 changes: 2 additions & 2 deletions OMEdit/OMEditGUI/Annotations/ShapeAnnotation.cpp
Expand Up @@ -1463,7 +1463,7 @@ bool ShapeAnnotation::isLineStraight(QPointF point1, QPointF point2)
*/
void ShapeAnnotation::showShapeProperties()
{
if (!mpGraphicsView || mpGraphicsView->getModelWidget()->getLibraryTreeItem()->getLibraryType()== LibraryTreeItem::TLM) {
if (!mpGraphicsView || mpGraphicsView->getModelWidget()->getLibraryTreeItem()->getLibraryType()== LibraryTreeItem::MetaModel) {
return;
}
MainWindow *pMainWindow = mpGraphicsView->getModelWidget()->getModelWidgetContainer()->getMainWindow();
Expand All @@ -1489,7 +1489,7 @@ void ShapeAnnotation::contextMenuEvent(QGraphicsSceneContextMenuEvent *pEvent)
}

QMenu menu(mpGraphicsView);
if (mpGraphicsView->getModelWidget()->getLibraryTreeItem()->getLibraryType()== LibraryTreeItem::TLM) {
if (mpGraphicsView->getModelWidget()->getLibraryTreeItem()->getLibraryType()== LibraryTreeItem::MetaModel) {
menu.addAction(mpGraphicsView->getDeleteAction());
} else {
menu.addAction(mpShapePropertiesAction);
Expand Down
36 changes: 18 additions & 18 deletions OMEdit/OMEditGUI/Component/Component.cpp
Expand Up @@ -356,7 +356,7 @@ Component::Component(QString name, LibraryTreeItem *pLibraryTreeItem, QString tr
setComponentFlags(true);
createNonExistingComponent();
createDefaultComponent();
if (mpGraphicsView->getModelWidget()->getLibraryTreeItem()->getLibraryType() == LibraryTreeItem::TLM) {
if (mpGraphicsView->getModelWidget()->getLibraryTreeItem()->getLibraryType() == LibraryTreeItem::MetaModel) {
mpDefaultComponentRectangle->setVisible(true);
mpDefaultComponentText->setVisible(true);
} else {
Expand Down Expand Up @@ -1215,10 +1215,10 @@ void Component::createActions()
mpViewDocumentationAction = new QAction(QIcon(":/Resources/icons/info-icon.svg"), Helper::viewDocumentation, mpGraphicsView);
mpViewDocumentationAction->setStatusTip(Helper::viewDocumentationTip);
connect(mpViewDocumentationAction, SIGNAL(triggered()), SLOT(viewDocumentation()));
// TLM attributes Action
mpTLMAttributesAction = new QAction(Helper::attributes, mpGraphicsView);
mpTLMAttributesAction->setStatusTip(tr("Shows the component attributes"));
connect(mpTLMAttributesAction, SIGNAL(triggered()), SLOT(showTLMAttributes()));
// SubModel attributes Action
mpSubModelAttributesAction = new QAction(Helper::attributes, mpGraphicsView);
mpSubModelAttributesAction->setStatusTip(tr("Shows the submodel attributes"));
connect(mpSubModelAttributesAction, SIGNAL(triggered()), SLOT(showSubModelAttributes()));
}

void Component::createResizerItems()
Expand Down Expand Up @@ -1468,11 +1468,11 @@ void Component::updatePlacementAnnotation()
{
// Add component annotation.
LibraryTreeItem *pLibraryTreeItem = mpGraphicsView->getModelWidget()->getLibraryTreeItem();
if (pLibraryTreeItem->getLibraryType()== LibraryTreeItem::TLM) {
TLMEditor *pTLMEditor = dynamic_cast<TLMEditor*>(mpGraphicsView->getModelWidget()->getEditor());
pTLMEditor->updateSubModelPlacementAnnotation(mpComponentInfo->getName(), mTransformation.getVisible()? "true" : "false",
getTransformationOrigin(), getTransformationExtent(),
QString::number(mTransformation.getRotateAngle()));
if (pLibraryTreeItem->getLibraryType()== LibraryTreeItem::MetaModel) {
MetaModelEditor *pMetaModelEditor = dynamic_cast<MetaModelEditor*>(mpGraphicsView->getModelWidget()->getEditor());
pMetaModelEditor->updateSubModelPlacementAnnotation(mpComponentInfo->getName(), mTransformation.getVisible()? "true" : "false",
getTransformationOrigin(), getTransformationExtent(),
QString::number(mTransformation.getRotateAngle()));
} else {
OMCProxy *pOMCProxy = mpGraphicsView->getModelWidget()->getModelWidgetContainer()->getMainWindow()->getOMCProxy();
pOMCProxy->updateComponent(mpComponentInfo->getName(), mpComponentInfo->getClassName(),
Expand Down Expand Up @@ -2106,14 +2106,14 @@ void Component::viewDocumentation()
}

/*!
* \brief Component::showTLMAttributes
* \brief Component::showSubModelAttributes
* Slot that opens up the SubModelAttributes Dialog.
*/
void Component::showTLMAttributes()
void Component::showSubModelAttributes()
{
MainWindow *pMainWindow = mpGraphicsView->getModelWidget()->getModelWidgetContainer()->getMainWindow();
SubModelAttributes *pTLMComponentAttributes = new SubModelAttributes(this, pMainWindow);
pTLMComponentAttributes->exec();
SubModelAttributes *pSubModelAttributes = new SubModelAttributes(this, pMainWindow);
pSubModelAttributes->exec();
}

/*!
Expand All @@ -2126,8 +2126,8 @@ void Component::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
{
Q_UNUSED(event);
LibraryTreeItem *pLibraryTreeItem = mpGraphicsView->getModelWidget()->getLibraryTreeItem();
if(pLibraryTreeItem->getLibraryType()== LibraryTreeItem::TLM) {
emit showTLMAttributes();
if(pLibraryTreeItem->getLibraryType()== LibraryTreeItem::MetaModel) {
emit showSubModelAttributes();
} else {
if (!mpParentComponent) { // if root component is double clicked then show parameters.
mpGraphicsView->removeCurrentConnection();
Expand Down Expand Up @@ -2189,8 +2189,8 @@ void Component::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
menu.addAction(mpGraphicsView->getFlipHorizontalAction());
menu.addAction(mpGraphicsView->getFlipVerticalAction());
break;
case LibraryTreeItem::TLM:
menu.addAction(pComponent->getTLMAttributesAction());
case LibraryTreeItem::MetaModel:
menu.addAction(pComponent->getSubModelAttributesAction());
break;
}
menu.exec(event->screenPos());
Expand Down
6 changes: 3 additions & 3 deletions OMEdit/OMEditGUI/Component/Component.h
Expand Up @@ -185,7 +185,7 @@ class Component : public QObject, public QGraphicsItem
QAction* getAttributesAction() {return mpAttributesAction;}
QAction* getOpenClassAction() {return mpOpenClassAction;}
QAction* getViewDocumentationAction() {return mpViewDocumentationAction;}
QAction* getTLMAttributesAction() {return mpTLMAttributesAction;}
QAction* getSubModelAttributesAction() {return mpSubModelAttributesAction;}
ComponentInfo* getComponentInfo() {return mpComponentInfo;}
QList<ShapeAnnotation*> getShapesList() {return mShapesList;}
QList<Component*> getInheritedComponentsList() {return mInheritedComponentsList;}
Expand Down Expand Up @@ -242,7 +242,7 @@ class Component : public QObject, public QGraphicsItem
QAction *mpAttributesAction;
QAction *mpOpenClassAction;
QAction *mpViewDocumentationAction;
QAction *mpTLMAttributesAction;
QAction *mpSubModelAttributesAction;
ResizerItem *mpBottomLeftResizerItem;
ResizerItem *mpTopLeftResizerItem;
ResizerItem *mpTopRightResizerItem;
Expand Down Expand Up @@ -327,7 +327,7 @@ public slots:
void showAttributes();
void openClass();
void viewDocumentation();
void showTLMAttributes();
void showSubModelAttributes();
protected:
virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event);
Expand Down
6 changes: 3 additions & 3 deletions OMEdit/OMEditGUI/Component/ComponentProperties.cpp
Expand Up @@ -1457,10 +1457,10 @@ void TLMConnectionAttributes::initializeDialog()
*/
void TLMConnectionAttributes::createTLMConnection()
{
TLMEditor *pTLMEditor = dynamic_cast<TLMEditor*>(mpMainWindow->getModelWidgetContainer()->getCurrentModelWidget()->getEditor());
MetaModelEditor *pMetaModelEditor = dynamic_cast<MetaModelEditor*>(mpMainWindow->getModelWidgetContainer()->getCurrentModelWidget()->getEditor());
QString startFrom = mpStartSubModelNameTextBox->text().append(".").append(mpStartSubModelInterfacePointComboBox->currentText());
QString endTo = mpEndSubModelNameTextBox->text().append(".").append(mpEndSubModelInterfacePointComboBox->currentText());
pTLMEditor->createConnection(startFrom, endTo, mpDelayTextBox->text(), mpAlphaTextBox->text(),mpZfTextBox->text(), mpZfrTextBox->text(),
mpConnectionLineAnnotation->getTLMShapeAnnotation());
pMetaModelEditor->createConnection(startFrom, endTo, mpDelayTextBox->text(), mpAlphaTextBox->text(),mpZfTextBox->text(), mpZfrTextBox->text(),
mpConnectionLineAnnotation->getMetaModelShapeAnnotation());
accept();
}
12 changes: 6 additions & 6 deletions OMEdit/OMEditGUI/Editors/BaseEditor.cpp
Expand Up @@ -669,8 +669,8 @@ void BaseEditor::PlainTextEdit::updateCursorPosition()
void BaseEditor::PlainTextEdit::setLineWrapping()
{
OptionsDialog *pOptionsDialog = mpBaseEditor->getMainWindow()->getOptionsDialog();
if (dynamic_cast<TLMEditor*>(mpBaseEditor)) {
if (pOptionsDialog->getTLMEditorPage()->getLineWrappingCheckbox()->isChecked()) {
if (dynamic_cast<MetaModelEditor*>(mpBaseEditor)) {
if (pOptionsDialog->getMetaModelEditorPage()->getLineWrappingCheckbox()->isChecked()) {
setLineWrapMode(QPlainTextEdit::WidgetWidth);
} else {
setLineWrapMode(QPlainTextEdit::NoWrap);
Expand Down Expand Up @@ -716,8 +716,8 @@ void BaseEditor::PlainTextEdit::toggleBreakpoint(const QString fileName, int lin
void BaseEditor::PlainTextEdit::indentOrUnindent(bool doIndent)
{
TabSettings tabSettings;
if (dynamic_cast<TLMEditor*>(mpBaseEditor)) {
tabSettings = mpBaseEditor->getMainWindow()->getOptionsDialog()->getTLMTabSettings();
if (dynamic_cast<MetaModelEditor*>(mpBaseEditor)) {
tabSettings = mpBaseEditor->getMainWindow()->getOptionsDialog()->getMetaModelTabSettings();
} else { //! @todo we should check all editors here.
tabSettings = mpBaseEditor->getMainWindow()->getOptionsDialog()->getModelicaTabSettings();
}
Expand Down Expand Up @@ -949,8 +949,8 @@ void BaseEditor::PlainTextEdit::keyPressEvent(QKeyEvent *pEvent)
/*! @todo We should add formatter classes to handle this based on editor language i.e Modelica or C/C++. */
if (pEvent->key() == Qt::Key_Enter || pEvent->key() == Qt::Key_Return) {
TabSettings tabSettings;
if (dynamic_cast<TLMEditor*>(mpBaseEditor)) {
tabSettings = mpBaseEditor->getMainWindow()->getOptionsDialog()->getTLMTabSettings();
if (dynamic_cast<MetaModelEditor*>(mpBaseEditor)) {
tabSettings = mpBaseEditor->getMainWindow()->getOptionsDialog()->getMetaModelTabSettings();
} else { //! @todo we should check all editors here.
tabSettings = mpBaseEditor->getMainWindow()->getOptionsDialog()->getModelicaTabSettings();
}
Expand Down

0 comments on commit 36a52a8

Please sign in to comment.