Skip to content

Commit

Permalink
Removed the updateClassAnnotation signal.
Browse files Browse the repository at this point in the history
  • Loading branch information
adeas31 committed Oct 22, 2015
1 parent 732bcca commit 981224e
Show file tree
Hide file tree
Showing 12 changed files with 35 additions and 23 deletions.
2 changes: 0 additions & 2 deletions OMEdit/OMEditGUI/Annotations/BitmapAnnotation.cpp
Expand Up @@ -51,8 +51,6 @@ BitmapAnnotation::BitmapAnnotation(QString classFileName, QString annotation, Gr
ShapeAnnotation::setUserDefaults();
parseShapeAnnotation(annotation);
setShapeFlags(true);
connect(this, SIGNAL(updateClassAnnotation()), this, SIGNAL(updateReferenceShapes()));
connect(this, SIGNAL(updateClassAnnotation()), mpGraphicsView, SLOT(addClassAnnotation()));
}

BitmapAnnotation::BitmapAnnotation(ShapeAnnotation *pShapeAnnotation, Component *pParent)
Expand Down
2 changes: 0 additions & 2 deletions OMEdit/OMEditGUI/Annotations/EllipseAnnotation.cpp
Expand Up @@ -50,8 +50,6 @@ EllipseAnnotation::EllipseAnnotation(QString annotation, GraphicsView *pGraphics
ShapeAnnotation::setUserDefaults();
parseShapeAnnotation(annotation);
setShapeFlags(true);
connect(this, SIGNAL(updateClassAnnotation()), this, SIGNAL(updateReferenceShapes()));
connect(this, SIGNAL(updateClassAnnotation()), mpGraphicsView, SLOT(addClassAnnotation()));
}

EllipseAnnotation::EllipseAnnotation(ShapeAnnotation *pShapeAnnotation, Component *pParent)
Expand Down
2 changes: 0 additions & 2 deletions OMEdit/OMEditGUI/Annotations/LineAnnotation.cpp
Expand Up @@ -52,8 +52,6 @@ LineAnnotation::LineAnnotation(QString annotation, GraphicsView *pGraphicsView)
ShapeAnnotation::setUserDefaults();
parseShapeAnnotation(annotation);
setShapeFlags(true);
connect(this, SIGNAL(updateClassAnnotation()), this, SIGNAL(updateReferenceShapes()));
connect(this, SIGNAL(updateClassAnnotation()), mpGraphicsView, SLOT(addClassAnnotation()));
}

LineAnnotation::LineAnnotation(ShapeAnnotation *pShapeAnnotation, Component *pParent)
Expand Down
2 changes: 0 additions & 2 deletions OMEdit/OMEditGUI/Annotations/PolygonAnnotation.cpp
Expand Up @@ -50,8 +50,6 @@ PolygonAnnotation::PolygonAnnotation(QString annotation, GraphicsView *pGraphics
ShapeAnnotation::setUserDefaults();
parseShapeAnnotation(annotation);
setShapeFlags(true);
connect(this, SIGNAL(updateClassAnnotation()), this, SIGNAL(updateReferenceShapes()));
connect(this, SIGNAL(updateClassAnnotation()), mpGraphicsView, SLOT(addClassAnnotation()));
}

PolygonAnnotation::PolygonAnnotation(ShapeAnnotation *pShapeAnnotation, Component *pParent)
Expand Down
2 changes: 0 additions & 2 deletions OMEdit/OMEditGUI/Annotations/RectangleAnnotation.cpp
Expand Up @@ -50,8 +50,6 @@ RectangleAnnotation::RectangleAnnotation(QString annotation, GraphicsView *pGrap
ShapeAnnotation::setUserDefaults();
parseShapeAnnotation(annotation);
setShapeFlags(true);
connect(this, SIGNAL(updateClassAnnotation()), this, SIGNAL(updateReferenceShapes()));
connect(this, SIGNAL(updateClassAnnotation()), mpGraphicsView, SLOT(addClassAnnotation()));
}

RectangleAnnotation::RectangleAnnotation(ShapeAnnotation *pShapeAnnotation, Component *pParent)
Expand Down
14 changes: 8 additions & 6 deletions OMEdit/OMEditGUI/Annotations/ShapeAnnotation.cpp
Expand Up @@ -423,10 +423,6 @@ void ShapeAnnotation::createActions()
mpShapePropertiesAction = new QAction(Helper::properties, mpGraphicsView);
mpShapePropertiesAction->setStatusTip(tr("Shows the shape properties"));
connect(mpShapePropertiesAction, SIGNAL(triggered()), SLOT(showShapeProperties()));
// manhattanize properties
mpManhattanizeShapeAction = new QAction(tr("Manhattanize"), mpGraphicsView);
mpManhattanizeShapeAction->setStatusTip(tr("Manhattanize the lines"));
connect(mpManhattanizeShapeAction, SIGNAL(triggered()), SLOT(manhattanizeShape()));
}

/*!
Expand Down Expand Up @@ -1740,7 +1736,7 @@ void ShapeAnnotation::contextMenuEvent(QGraphicsSceneContextMenuEvent *pEvent)
menu.addAction(mpShapePropertiesAction);
menu.addSeparator();
if (isInheritedShape()) {
mpManhattanizeShapeAction->setDisabled(true);
mpGraphicsView->getManhattanizeAction()->setDisabled(true);
mpGraphicsView->getDeleteAction()->setDisabled(true);
mpGraphicsView->getDuplicateAction()->setDisabled(true);
mpGraphicsView->getBringToFrontAction()->setDisabled(true);
Expand All @@ -1754,7 +1750,7 @@ void ShapeAnnotation::contextMenuEvent(QGraphicsSceneContextMenuEvent *pEvent)
LineAnnotation::LineType lineType = LineAnnotation::ShapeType;
if (pLineAnnotation) {
lineType = pLineAnnotation->getLineType();
menu.addAction(mpManhattanizeShapeAction);
menu.addAction(mpGraphicsView->getManhattanizeAction());
}
menu.addAction(mpGraphicsView->getDeleteAction());
if (lineType != LineAnnotation::ConnectionType) {
Expand Down Expand Up @@ -1797,6 +1793,9 @@ QVariant ShapeAnnotation::itemChange(GraphicsItemChange change, const QVariant &
connect(mpGraphicsView, SIGNAL(mouseDelete()), SLOT(deleteConnection()), Qt::UniqueConnection);
connect(mpGraphicsView, SIGNAL(keyPressDelete()), SLOT(deleteConnection()), Qt::UniqueConnection);
} else {
if (pLineAnnotation) {
connect(mpGraphicsView, SIGNAL(mouseManhattanize()), this, SLOT(manhattanizeShape()), Qt::UniqueConnection);
}
connect(mpGraphicsView, SIGNAL(mouseDelete()), this, SLOT(deleteMe()), Qt::UniqueConnection);
connect(mpGraphicsView->getDuplicateAction(), SIGNAL(triggered()), this, SLOT(duplicate()), Qt::UniqueConnection);
connect(mpGraphicsView->getBringToFrontAction(), SIGNAL(triggered()), this, SLOT(bringToFront()), Qt::UniqueConnection);
Expand Down Expand Up @@ -1832,6 +1831,9 @@ QVariant ShapeAnnotation::itemChange(GraphicsItemChange change, const QVariant &
disconnect(mpGraphicsView, SIGNAL(mouseDelete()), this, SLOT(deleteConnection()));
disconnect(mpGraphicsView, SIGNAL(keyPressDelete()), this, SLOT(deleteConnection()));
} else {
if (pLineAnnotation) {
disconnect(mpGraphicsView, SIGNAL(mouseManhattanize()), this, SLOT(manhattanizeShape()));
}
disconnect(mpGraphicsView, SIGNAL(mouseDelete()), this, SLOT(deleteMe()));
disconnect(mpGraphicsView->getDuplicateAction(), SIGNAL(triggered()), this, SLOT(duplicate()));
disconnect(mpGraphicsView->getBringToFrontAction(), SIGNAL(triggered()), this, SLOT(bringToFront()));
Expand Down
2 changes: 0 additions & 2 deletions OMEdit/OMEditGUI/Annotations/ShapeAnnotation.h
Expand Up @@ -114,7 +114,6 @@ class ShapeAnnotation : public QObject, public QGraphicsItem, public GraphicItem
QPointF mOldScenePosition;
bool mIsCornerItemClicked;
QAction *mpShapePropertiesAction;
QAction *mpManhattanizeShapeAction;
public:
enum LineGeometryType {VerticalLine, HorizontalLine};
Transformation mTransformation;
Expand Down Expand Up @@ -194,7 +193,6 @@ class ShapeAnnotation : public QObject, public QGraphicsItem, public GraphicItem
void emitChanged() {emit changed();}
void emitDeleted() {emit deleted();}
signals:
void updateClassAnnotation();
void updateReferenceShapes();
void added();
void changed();
Expand Down
2 changes: 2 additions & 0 deletions OMEdit/OMEditGUI/Annotations/ShapePropertiesDialog.cpp
Expand Up @@ -851,6 +851,8 @@ bool ShapePropertiesDialog::applyShapeProperties()
pUpdateShapeCommand = new UpdateShapeCommand(mpShapeAnnotation, mOldAnnotation, mpShapeAnnotation->getOMCShapeAnnotation(),
mpShapeAnnotation->getGraphicsView());
mpShapeAnnotation->getGraphicsView()->getModelWidget()->getUndoStack()->push(pUpdateShapeCommand);
mpShapeAnnotation->getGraphicsView()->getModelWidget()->updateClassAnnotationIfNeeded();
mpShapeAnnotation->getGraphicsView()->getModelWidget()->updateModelicaText();
}
return true;
}
Expand Down
2 changes: 0 additions & 2 deletions OMEdit/OMEditGUI/Annotations/TextAnnotation.cpp
Expand Up @@ -61,8 +61,6 @@ TextAnnotation::TextAnnotation(QString annotation, GraphicsView *pGraphicsView)
ShapeAnnotation::setUserDefaults();
parseShapeAnnotation(annotation);
setShapeFlags(true);
connect(this, SIGNAL(updateClassAnnotation()), this, SIGNAL(updateReferenceShapes()));
connect(this, SIGNAL(updateClassAnnotation()), mpGraphicsView, SLOT(addClassAnnotation()));
}

TextAnnotation::TextAnnotation(ShapeAnnotation *pShapeAnnotation, Component *pParent)
Expand Down
4 changes: 2 additions & 2 deletions OMEdit/OMEditGUI/Component/CornerItem.cpp
Expand Up @@ -74,8 +74,6 @@ CornerItem::CornerItem(qreal x, qreal y, int connectedPointIndex, ShapeAnnotatio
LineAnnotation *pLineAnnotation = dynamic_cast<LineAnnotation*>(mpShapeAnnotation);
if (pLineAnnotation && pLineAnnotation->getLineType() == LineAnnotation::ConnectionType) {
connect(this, SIGNAL(cornerItemPositionChanged()), pLineAnnotation, SLOT(updateConnectionAnnotation()));
} else {
connect(this, SIGNAL(cornerItemPositionChanged()), mpShapeAnnotation, SIGNAL(updateClassAnnotation()));
}
}
}
Expand Down Expand Up @@ -160,6 +158,8 @@ void CornerItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
ModelWidget *pModelWidget = mpShapeAnnotation->getGraphicsView()->getModelWidget();
pModelWidget->getUndoStack()->push(new UpdateShapeCommand(mpShapeAnnotation, mOldAnnotation, mpShapeAnnotation->getOMCShapeAnnotation(),
mpShapeAnnotation->getGraphicsView()));
pModelWidget->updateClassAnnotationIfNeeded();
pModelWidget->updateModelicaText();
}
}
}
Expand Down
20 changes: 19 additions & 1 deletion OMEdit/OMEditGUI/Modeling/ModelWidgetContainer.cpp
Expand Up @@ -970,7 +970,12 @@ void GraphicsView::createActions()
// Graphics View Properties Action
mpPropertiesAction = new QAction(Helper::properties, this);
connect(mpPropertiesAction, SIGNAL(triggered()), SLOT(showGraphicsViewProperties()));
// Actions for Components
// Actions for shapes and Components
// Manhattanize Action
mpManhattanizeAction = new QAction(tr("Manhattanize"), this);
mpManhattanizeAction->setStatusTip(tr("Manhattanize the lines"));
mpManhattanizeAction->setDisabled(isSystemLibrary);
connect(mpManhattanizeAction, SIGNAL(triggered()), SLOT(manhattanizeItems()));
// Delete Action
mpDeleteAction = new QAction(QIcon(":/Resources/icons/delete.svg"), Helper::deleteStr, this);
mpDeleteAction->setStatusTip(tr("Deletes the item"));
Expand Down Expand Up @@ -1298,6 +1303,19 @@ void GraphicsView::showGraphicsViewProperties()
pGraphicsViewProperties->show();
}

/*!
* \brief GraphicsView::manhattanizeItems
* Manhattanize the selected items by emitting GraphicsView::mouseManhattanize() SIGNAL.
*/
void GraphicsView::manhattanizeItems()
{
mpModelWidget->getUndoStack()->beginMacro("Manhattanize by mouse");
emit mouseManhattanize();
mpModelWidget->updateClassAnnotationIfNeeded();
mpModelWidget->updateModelicaText();
mpModelWidget->getUndoStack()->endMacro();
}

/*!
* \brief GraphicsView::deleteItems
* Deletes the selected items by emitting GraphicsView::mouseDelete() SIGNAL.
Expand Down
4 changes: 4 additions & 0 deletions OMEdit/OMEditGUI/Modeling/ModelWidgetContainer.h
Expand Up @@ -128,6 +128,7 @@ class GraphicsView : public QGraphicsView
TextAnnotation *mpTextShapeAnnotation;
BitmapAnnotation *mpBitmapShapeAnnotation;
QAction *mpPropertiesAction;
QAction *mpManhattanizeAction;
QAction *mpDeleteAction;
QAction *mpBringToFrontAction;
QAction *mpBringForwardAction;
Expand Down Expand Up @@ -171,6 +172,7 @@ class GraphicsView : public QGraphicsView
void setRenderingLibraryPixmap(bool renderingLibraryPixmap) {mRenderingLibraryPixmap = renderingLibraryPixmap;}
bool isRenderingLibraryPixmap() {return mRenderingLibraryPixmap;}
QList<ShapeAnnotation*> getShapesList() {return mShapesList;}
QAction* getManhattanizeAction() {return mpManhattanizeAction;}
QAction* getDeleteAction() {return mpDeleteAction;}
QAction* getDuplicateAction() {return mpDuplicateAction;}
QAction* getBringToFrontAction() {return mpBringToFrontAction;}
Expand Down Expand Up @@ -227,6 +229,7 @@ class GraphicsView : public QGraphicsView
bool isClassDroppedOnItself(LibraryTreeItem *pLibraryTreeItem);
bool isAnyItemSelectedAndEditable(int key);
signals:
void mouseManhattanize();
void mouseDelete();
void mouseRotateClockwise();
void mouseRotateAntiClockwise();
Expand Down Expand Up @@ -257,6 +260,7 @@ public slots:
void clearSelection();
void addClassAnnotation(bool updateModelicaText = true);
void showGraphicsViewProperties();
void manhattanizeItems();
void deleteItems();
void rotateClockwise();
void rotateAntiClockwise();
Expand Down

0 comments on commit 981224e

Please sign in to comment.