[Uml-devel] branches/work/soc-umbrello/umbrello
Andi Fischer
andi.fischer at hispeed.ch
Fri Sep 5 21:28:04 UTC 2008
SVN commit 857627 by fischer:
Fixing warnings and replacing tabs with spaces.
M +40 -40 newumlwidget.h
M +69 -71 signalwidget.cpp
M +1 -1 uml.cpp
--- branches/work/soc-umbrello/umbrello/newumlwidget.h #857626:857627
@@ -52,36 +52,36 @@
{
Q_OBJECT;
public:
- /**
- * This enumeration is used by NewUMLWidget::attributeChange() to
- * identify which attribute has changed.
- * This is modelled on QGraphicsItem::GraphicsItemChange.
- */
- enum WidgetAttributeChange {
- // These 3 work only if NewUMLWidget::setters are used , that
- // is, the notifications arent' sent when UMLObject::setters
- // are used.
- IDHasChanged,
- DocumentationHasChanged,
- NameHasChanged,
+ /**
+ * This enumeration is used by NewUMLWidget::attributeChange() to
+ * identify which attribute has changed.
+ * This is modelled on QGraphicsItem::GraphicsItemChange.
+ */
+ enum WidgetAttributeChange {
+ // These 3 work only if NewUMLWidget::setters are used , that
+ // is, the notifications arent' sent when UMLObject::setters
+ // are used.
+ IDHasChanged,
+ DocumentationHasChanged,
+ NameHasChanged,
- // Graphical attribute change notification
- LineColorHasChanged,
- LineWidthHasChanged,
- FontColorHasChanged,
- FontHasChanged,
- BrushHasChanged,
+ // Graphical attribute change notification
+ LineColorHasChanged,
+ LineWidthHasChanged,
+ FontColorHasChanged,
+ FontHasChanged,
+ BrushHasChanged,
- // Provided by NewUMLRectWidget
- SizeHasChanged
- };
+ // Provided by NewUMLRectWidget
+ SizeHasChanged
+ };
explicit NewUMLWidget(UMLObject *object);
~NewUMLWidget();
- /**
- * @retval The UMLObject represented by this widget
- * @retval null if no UMLObject representation.
+ /**
+ * @retval The UMLObject represented by this widget
+ * @retval null if no UMLObject representation.
*/
UMLObject* umlObject() const {
return m_umlObject;
@@ -91,7 +91,7 @@
Uml::IDType id() const;
void setID(Uml::IDType id);
- /// @return The base type rtti info.
+ /// @return The base type rtti info.
Uml::Widget_Type baseType() const {
return m_baseType;
}
@@ -103,49 +103,49 @@
void setDocumentation(const QString& doc);
QString name() const;
- void setName(const QString& doc);
+ void setName(const QString& name);
- /// @return The color used to draw lines of the widget.
+ /// @return The color used to draw lines of the widget.
QColor lineColor() const {
return m_lineColor;
}
void setLineColor(const QColor& color);
- /// @return The width of the lines drawn in the widget.
+ /// @return The width of the lines drawn in the widget.
uint lineWidth() const {
return m_lineWidth;
}
void setLineWidth(uint lw);
- /// @return Font color used to draw font.
+ /// @return Font color used to draw font.
QColor fontColor() const {
return m_fontColor;
}
void setFontColor(const QColor& color);
- /// @return The QBrush object used to fill this widget.
+ /// @return The QBrush object used to fill this widget.
QBrush brush() const {
return m_brush;
}
void setBrush(const QBrush& brush);
- /// @return The font used for displaying any text
+ /// @return The font used for displaying any text
QFont font() const {
return m_font;
}
void setFont(const QFont& font);
- /**
- * @return The bounding rectangle for this widget.
- * @see setBoundingRect
- */
+ /**
+ * @return The bounding rectangle for this widget.
+ * @see setBoundingRect
+ */
QRectF boundingRect() const {
return m_boundingRect;
}
- /**
- * @return The shape of this widget.
- * @see setShape
- */
+ /**
+ * @return The shape of this widget.
+ * @see setShape
+ */
QPainterPath shape() const {
return m_shape;
}
@@ -170,7 +170,7 @@
protected:
void contextMenuEvent(QGraphicsSceneContextMenuEvent *event);
- virtual QVariant attributeChange(WidgetAttributeChange change, const QVariant& oldValue);
+ virtual QVariant attributeChange(WidgetAttributeChange change, const QVariant& oldValue);
virtual QVariant itemChange(GraphicsItemChange change, const QVariant& value);
virtual void updateGeometry();
--- branches/work/soc-umbrello/umbrello/signalwidget.cpp #857626:857627
@@ -1,5 +1,4 @@
/***************************************************************************
- * *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
@@ -34,11 +33,11 @@
* @param id The ID to assign (-1 will prompt a new ID.)
*/
SignalWidget::SignalWidget(SignalType signalType, Uml::IDType id)
- : NewUMLRectWidget(0, id)
+ : NewUMLRectWidget(0, id)
{
m_baseType = Uml::wt_Signal;
m_signalType = signalType;
- createTextItemGroup();
+ createTextItemGroup();
}
/// Destructor
@@ -51,16 +50,16 @@
*/
void SignalWidget::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
{
- painter->setPen(QPen(lineColor(), lineWidth()));
- painter->setBrush(brush());
- painter->drawPath(m_signalPath);
+ painter->setPen(QPen(lineColor(), lineWidth()));
+ painter->setBrush(brush());
+ painter->drawPath(m_signalPath);
}
/// Sets the signaltype of widget to \a signalType
void SignalWidget::setSignalType( SignalType signalType )
{
m_signalType = signalType;
- updateTextItemGroups();
+ updateTextItemGroups();
}
/**
@@ -81,9 +80,9 @@
return false;
setName(qElement.attribute( "signalname", "" ));
- setDocumentation(qElement.attribute( "documentation", "" ));
+ setDocumentation(qElement.attribute( "documentation", "" ));
- QString type = qElement.attribute( "signaltype", "" );
+ QString type = qElement.attribute( "signaltype", "" );
setSignalType((SignalType)type.toInt());
return true;
@@ -112,18 +111,18 @@
bool ok = false;
QString text;
- // ListPopupMenu is passed as parent of action
- ListPopupMenu *menu = qobject_cast<ListPopupMenu*>(action->parent());
+ // ListPopupMenu is passed as parent of action
+ ListPopupMenu *menu = qobject_cast<ListPopupMenu*>(action->parent());
ListPopupMenu::Menu_Type sel = menu->getMenuType(action);
switch( sel ) {
case ListPopupMenu::mt_Rename:
text = KInputDialog::getText( i18n("Enter signal name"),
- i18n("Enter the signal name :"),
- name(), &ok );
+ i18n("Enter the signal name :"),
+ name(), &ok );
if (ok && !text.isEmpty()) {
setName(text);
- }
+ }
break;
default:
@@ -137,15 +136,15 @@
*/
void SignalWidget::updateGeometry()
{
- QSizeF minSize = textItemGroupAt(GroupIndex)->minimumSize();
- if (minSize.width() < SignalWidget::MinimumSize.width()) {
- minSize.setWidth(SignalWidget::MinimumSize.width());
- }
+ QSizeF minSize = textItemGroupAt(GroupIndex)->minimumSize();
+ if (minSize.width() < SignalWidget::MinimumSize.width()) {
+ minSize.setWidth(SignalWidget::MinimumSize.width());
+ }
- if (m_signalType == SignalWidget::Accept) {
+ if (m_signalType == SignalWidget::Accept) {
// We need 1/3rd part for the '>' shape.(hollow or convex)
- minSize.rwidth() += minSize.width() / 3 + margin();
- }
+ minSize.rwidth() += minSize.width() / 3 + margin();
+ }
else if (m_signalType == SignalWidget::Send) {
// Add one third for the '>' shape.
minSize.rwidth() += minSize.width() / 3 + margin();
@@ -153,12 +152,12 @@
else if (m_signalType == SignalWidget::Time) {
// In case of SignalWidget::Time add minimum height to
// calculated as the text appears below drawing.
- minSize.rheight() += SignalWidget::MinimumSize.height();
- }
+ minSize.rheight() += SignalWidget::MinimumSize.height();
+ }
- setMinimumSize(minSize);
+ setMinimumSize(minSize);
- NewUMLRectWidget::updateGeometry();
+ NewUMLRectWidget::updateGeometry();
}
/**
@@ -167,13 +166,13 @@
*/
void SignalWidget::updateTextItemGroups()
{
- TextItemGroup *grp = textItemGroupAt(GroupIndex);
- grp->setTextItemCount(1); // Only name item
+ TextItemGroup *grp = textItemGroupAt(GroupIndex);
+ grp->setTextItemCount(1); // Only name item
- TextItem *nameItem = grp->textItemAt(0);
- nameItem->setText(name());
+ TextItem *nameItem = grp->textItemAt(0);
+ nameItem->setText(name());
- NewUMLRectWidget::updateTextItemGroups();
+ NewUMLRectWidget::updateTextItemGroups();
}
/**
@@ -183,15 +182,14 @@
*/
QVariant SignalWidget::attributeChange(WidgetAttributeChange change, const QVariant& oldValue)
{
- if (change == SizeHasChanged) {
- QSizeF sz = size();
- TextItemGroup *grp = textItemGroupAt(GroupIndex);
+ if (change == SizeHasChanged) {
+ QSizeF sz = size();
+ TextItemGroup *grp = textItemGroupAt(GroupIndex);
const QSizeF grpMinSize = grp->minimumSize();
- const qreal m = margin();
- m_signalPath = QPainterPath(); // reset path
+ m_signalPath = QPainterPath(); // reset path
- if (m_signalType == SignalWidget::Send) {
- QPolygonF poly;
+ if (m_signalType == SignalWidget::Send) {
+ QPolygonF poly;
qreal vShapeWidth = sz.width() - grpMinSize.width();
// Ensure atmost one third of space is available at the
@@ -199,21 +197,21 @@
vShapeWidth = qMin(vShapeWidth, sz.width() / 3.0);
qreal textWidth = sz.width() - vShapeWidth;
- poly << QPointF(0,0)
- << QPointF(textWidth, 0)
- << QPointF(sz.width(), 0.5 * sz.height())
- << QPointF(textWidth, sz.height())
- << QPointF(0, sz.height())
- << QPointF(0, 0);
+ poly << QPointF(0,0)
+ << QPointF(textWidth, 0)
+ << QPointF(sz.width(), 0.5 * sz.height())
+ << QPointF(textWidth, sz.height())
+ << QPointF(0, sz.height())
+ << QPointF(0, 0);
- m_signalPath.addPolygon(poly);
+ m_signalPath.addPolygon(poly);
QRectF grpRect = rect();
grpRect.setRight(textWidth);
- grp->setGroupGeometry(grpRect);
- }
- else if (m_signalType == SignalWidget::Accept) {
- QPolygonF poly;
+ grp->setGroupGeometry(grpRect);
+ }
+ else if (m_signalType == SignalWidget::Accept) {
+ QPolygonF poly;
// This represents the sharp point of VShape.
qreal vShapeX = sz.width() - grpMinSize.width();
@@ -221,35 +219,35 @@
// doesn't look ugly.
vShapeX = qMin(vShapeX, sz.width() / 3.);
- poly << QPointF(0, 0)
- << QPointF(vShapeX, .5 * sz.height())
- << QPointF(0 , sz.height())
- << QPointF(sz.width(), sz.height())
- << QPointF(sz.width(), 0)
- << QPointF(0, 0);
+ poly << QPointF(0, 0)
+ << QPointF(vShapeX, .5 * sz.height())
+ << QPointF(0 , sz.height())
+ << QPointF(sz.width(), sz.height())
+ << QPointF(sz.width(), 0)
+ << QPointF(0, 0);
- m_signalPath.addPolygon(poly);
- QRectF grpRect(vShapeX, 0,
- sz.width() - vShapeX, sz.height());
- grp->setGroupGeometry(grpRect);
- }
- else if (m_signalType == SignalWidget::Time) {
+ m_signalPath.addPolygon(poly);
+ QRectF grpRect(vShapeX, 0,
+ sz.width() - vShapeX, sz.height());
+ grp->setGroupGeometry(grpRect);
+ }
+ else if (m_signalType == SignalWidget::Time) {
QRectF polyRect(0, 0, sz.width(), sz.height() - grpMinSize.height());
- QPolygonF poly;
- poly << polyRect.topLeft()
- << polyRect.bottomRight()
- << polyRect.bottomLeft()
- << polyRect.topRight()
- << polyRect.topLeft();
+ QPolygonF poly;
+ poly << polyRect.topLeft()
+ << polyRect.bottomRight()
+ << polyRect.bottomLeft()
+ << polyRect.topRight()
+ << polyRect.topLeft();
- m_signalPath.addPolygon(poly);
+ m_signalPath.addPolygon(poly);
- QRectF grpRect(0, polyRect.bottom(), polyRect.width(), grpMinSize.height());
- grp->setGroupGeometry(grpRect);
+ QRectF grpRect(0, polyRect.bottom(), polyRect.width(), grpMinSize.height());
+ grp->setGroupGeometry(grpRect);
}
- }
+ }
- return NewUMLRectWidget::attributeChange(change, oldValue);
+ return NewUMLRectWidget::attributeChange(change, oldValue);
}
#include "signalwidget.moc"
--- branches/work/soc-umbrello/umbrello/uml.cpp #857626:857627
@@ -229,7 +229,7 @@
editPaste = KStandardAction::paste(this, SLOT(slotEditPaste()), actionCollection());
createStandardStatusBarAction();
setStandardToolBarMenuEnabled(true);
- QAction* selectAll = KStandardAction::selectAll(this, SLOT( slotSelectAll() ), actionCollection());
+ /* QAction* selectAll = */ KStandardAction::selectAll(this, SLOT( slotSelectAll() ), actionCollection());
QAction* fileExportDocbook = actionCollection()->addAction("file_export_docbook");
fileExportDocbook->setText(i18n("&Export model to DocBook"));
More information about the umbrello-devel
mailing list