[Uml-devel] KDE/kdesdk/umbrello
Oliver Kellogg
okellogg at users.sourceforge.net
Mon Jun 18 18:58:18 UTC 2007
SVN commit 677246 by okellogg:
merge r674109:677223 from branches/KDE/3.5
M +2 -0 ChangeLog
M +39 -18 umbrello/activitywidget.cpp
M +6 -2 umbrello/activitywidget.h
M +3 -3 umbrello/assocrules.cpp
M +45 -17 umbrello/umllistview.cpp
M +0 -3 umbrello/umlwidget.cpp
M +8 -8 umbrello/widget_factory.cpp
--- trunk/KDE/kdesdk/umbrello/ChangeLog #677245:677246
@@ -2,6 +2,8 @@
* Bugs/wishes from http://bugs.kde.org:
* Wrong pascal code generation (146676)
+* Crash when linking to undefined xmi.id (146748)
+* End Activity Symbol gets invalid when line thickness is increased (146925)
Version 1.5.71
--- trunk/KDE/kdesdk/umbrello/umbrello/activitywidget.cpp #677245:677246
@@ -74,7 +74,7 @@
break;
case Initial :
- UMLWidget::setPen(p);
+ p.setPen( QPen(m_LineColour, 1) );
p.setBrush( WidgetBase::getLineColor() );
p.drawEllipse( offsetX, offsetY, w, h );
break;
@@ -97,7 +97,7 @@
break;
case End :
- UMLWidget::setPen(p);
+ p.setPen( QPen(m_LineColour, 1) );
p.setBrush( WidgetBase::getLineColor() );
p.drawEllipse( offsetX, offsetY, w, h );
p.setBrush( Qt::white );
@@ -169,16 +169,45 @@
break;
- case Fork_DEPRECATED : // to be removed
- p.fillRect( offsetX, offsetY, width(), height(), QBrush( Qt::darkYellow ));
- break;
}
if(m_bSelected)
drawSelected(&p, offsetX, offsetY);
}
+void ActivityWidget::constrain(int& width, int& height) {
+ if (m_ActivityType == Normal || m_ActivityType == Invok || m_ActivityType == Param) {
+ QSize minSize = calculateSize();
+ if (width < minSize.width())
+ width = minSize.width();
+ if (height < minSize.height())
+ height = minSize.height();
+ return;
+ }
+ if (width > height)
+ width = height;
+ else if (height > width)
+ height = width;
+ if (m_ActivityType == Branch) {
+ if (width < 20) {
+ width = 20;
+ height = 20;
+ } else if (width > 50) {
+ width = 50;
+ height = 50;
+ }
+ } else {
+ if (width < 15) {
+ width = 15;
+ height = 15;
+ } else if (width > 30) {
+ width = 30;
+ height = 30;
+ }
+ }
+}
+
QSize ActivityWidget::calculateSize() {
- int width = 10, height = 10;
+ int width, height;
if ( m_ActivityType == Normal || m_ActivityType == Invok || m_ActivityType == Param ) {
const QFontMetrics &fm = getFontMetrics(FT_NORMAL);
const int fontHeight = fm.lineSpacing();
@@ -190,11 +219,9 @@
textWidth = textWidth > ACTIVITY_WIDTH ? textWidth : ACTIVITY_WIDTH;
- if (m_ActivityType == Invok)
- {
+ if (m_ActivityType == Invok) {
height += 40;
- }
- else if ( m_ActivityType == Param) {
+ } else if (m_ActivityType == Param) {
QString maxSize;
maxSize = getName().length() > getPostText().length() ? getName() : getPostText();
@@ -205,13 +232,11 @@
height += 100;
}
-
width = textWidth > ACTIVITY_WIDTH ? textWidth : ACTIVITY_WIDTH;
width += ACTIVITY_MARGIN * 4;
-
- } else if ( m_ActivityType == Branch ) {
+ } else {
width = height = 20;
}
return QSize(width, height);
@@ -224,7 +249,7 @@
void ActivityWidget::setActivityType( ActivityType activityType ) {
m_ActivityType = activityType;
updateComponentSize();
- UMLWidget::m_bResizable = (m_ActivityType == Normal || m_ActivityType == Invok || m_ActivityType == Param );
+ UMLWidget::m_bResizable = true;
}
void ActivityWidget::slotMenuSelection(int sel) {
@@ -282,10 +307,6 @@
case WorkToolBar::tbb_Branch:
resultType = Branch;
break;
- case WorkToolBar::tbb_Fork:
- kError() << "ActivityWidget::isActivity returns Fork_DEPRECATED" << endl;
- resultType = Fork_DEPRECATED;
- break;
default:
status = false;
break;
--- trunk/KDE/kdesdk/umbrello/umbrello/activitywidget.h #677245:677246
@@ -45,8 +45,7 @@
Final,
Branch,
Invok,
- Param,
- Fork_DEPRECATED // use ForkJoinWidget instead
+ Param
};
/**
@@ -70,6 +69,11 @@
void draw(QPainter & p, int offsetX, int offsetY);
/**
+ * Overrides Method from UMLWidget.
+ */
+ void constrain(int& width, int& height);
+
+ /**
* Returns the type of activity.
*/
ActivityType getActivityType() const;
--- trunk/KDE/kdesdk/umbrello/umbrello/assocrules.cpp #677245:677246
@@ -218,11 +218,11 @@
if (actB && actB->getActivityType() == ActivityWidget::Initial) {
return false;
}
- // Fork_DEPRECATED here means "not applicable".
- ActivityWidget::ActivityType actTypeA = ActivityWidget::Fork_DEPRECATED;
+ // actType -1 here means "not applicable".
+ int actTypeA = -1;
if (actA)
actTypeA = actA->getActivityType();
- ActivityWidget::ActivityType actTypeB = ActivityWidget::Fork_DEPRECATED;
+ int actTypeB = -1;
if (actB)
actTypeB = actB->getActivityType();
// only from a signalwidget a objectnode widget, a normal activity, branch or fork activity, to the end
--- trunk/KDE/kdesdk/umbrello/umbrello/umllistview.cpp #677245:677246
@@ -1308,7 +1308,10 @@
if (newParentType == Uml::lvt_UseCase_Folder ||
newParentType == Uml::lvt_UseCase_View) {
newItem = move->deepCopy(newParent);
- delete move;
+ if (m_doc->loading()) // deletion is not safe while loading
+ move->setVisible(false); // (the <listview> XMI may be corrupted)
+ else
+ delete move;
addAtContainer(newItem, newParent);
}
break;
@@ -1318,7 +1321,10 @@
if (newParentType == Uml::lvt_Component_Folder ||
newParentType == Uml::lvt_Component_View) {
newItem = move->deepCopy(newParent);
- delete move;
+ if (m_doc->loading()) // deletion is not safe while loading
+ move->setVisible(false); // (the <listview> XMI may be corrupted)
+ else
+ delete move;
addAtContainer(newItem, newParent);
}
break;
@@ -1327,7 +1333,10 @@
newParentType == Uml::lvt_Component_View ||
newParentType == Uml::lvt_Subsystem) {
newItem = move->deepCopy(newParent);
- delete move;
+ if (m_doc->loading()) // deletion is not safe while loading
+ move->setVisible(false); // (the <listview> XMI may be corrupted)
+ else
+ delete move;
addAtContainer(newItem, newParent);
}
break;
@@ -1337,7 +1346,10 @@
newParentType == Uml::lvt_Component ||
newParentType == Uml::lvt_Subsystem) {
newItem = move->deepCopy(newParent);
- delete move;
+ if (m_doc->loading()) // deletion is not safe while loading
+ move->setVisible(false); // (the <listview> XMI may be corrupted)
+ else
+ delete move;
addAtContainer(newItem, newParent);
}
break;
@@ -1347,7 +1359,10 @@
if (newParentType == Uml::lvt_Deployment_Folder ||
newParentType == Uml::lvt_Deployment_View) {
newItem = move->deepCopy(newParent);
- delete move;
+ if (m_doc->loading()) // deletion is not safe while loading
+ move->setVisible(false); // (the <listview> XMI may be corrupted)
+ else
+ delete move;
addAtContainer(newItem, newParent);
}
break;
@@ -1357,7 +1372,10 @@
if (newParentType == Uml::lvt_EntityRelationship_Folder ||
newParentType == Uml::lvt_EntityRelationship_Model) {
newItem = move->deepCopy(newParent);
- delete move;
+ if (m_doc->loading()) // deletion is not safe while loading
+ move->setVisible(false); // (the <listview> XMI may be corrupted)
+ else
+ delete move;
addAtContainer(newItem, newParent);
}
break;
@@ -1370,7 +1388,10 @@
if (newParentType == Uml::lvt_Logical_Folder ||
newParentType == Uml::lvt_Logical_View) {
newItem = move->deepCopy(newParent);
- delete move;
+ if (m_doc->loading()) // deletion is not safe while loading
+ move->setVisible(false); // (the <listview> XMI may be corrupted)
+ else
+ delete move;
addAtContainer(newItem, newParent);
}
break;
@@ -1386,7 +1407,10 @@
newParentType == Uml::lvt_Interface ||
newParentType == Uml::lvt_Package) {
newItem = move->deepCopy(newParent);
- delete move;
+ if (m_doc->loading()) // deletion is not safe while loading
+ move->setVisible(false); // (the <listview> XMI may be corrupted)
+ else
+ delete move;
UMLCanvasObject *o = static_cast<UMLCanvasObject*>(newItem->getUMLObject());
if (o == NULL) {
kDebug() << "moveObject: newItem's UMLObject is NULL" << endl;
@@ -2420,8 +2444,7 @@
// Pull a new ID now.
nID = UniqueID::get();
} else {
- kError() << "UMLListView::loadChildrenFromXMI: item of type "
- << type << " has no ID, skipping." << endl;
+ kError() << pfx << "item of type " << type << " has no ID, skipping." << endl;
domElement = node.toElement();
continue;
}
@@ -2482,14 +2505,19 @@
// listview item might be located in a user created folder.
// Thanks to Achim Spangler for spotting the problem.
UMLListViewItem *itmParent = dynamic_cast<UMLListViewItem*>(item->parent());
- kDebug() << pfx << parent->getText() << " (" << parent << ") != "
+ kDebug() << pfx << item->getText() << " parent "
+ << parent->getText() << " (" << parent << ") != "
<< itmParent->getText() << " (" << itmParent << ")" << endl;
- UMLListViewItem *newItem = moveObject(nID, lvType, parent);
- item = newItem;
- if (item) {
- kDebug() << pfx << "Attempted reparenting of " << item->getText()
- << "(current parent: " << (itmParent ? itmParent->getText() : "NULL")
- << ", new parent: " << parent->getText() << ")" << endl;
+ if (item == m_datatypeFolder && itmParent == m_lv[Uml::mt_Logical]) {
+ kDebug() << pfx << "Reparenting the Datatypes folder is prohibited" << endl;
+ } else {
+ UMLListViewItem *newItem = moveObject(nID, lvType, parent);
+ item = newItem;
+ if (item) {
+ kDebug() << pfx << "Attempted reparenting of " << item->getText()
+ << "(current parent: " << (itmParent ? itmParent->getText() : "NULL")
+ << ", new parent: " << parent->getText() << ")" << endl;
+ }
}
}
break;
--- trunk/KDE/kdesdk/umbrello/umbrello/umlwidget.cpp #677245:677246
@@ -851,9 +851,6 @@
const QSize minSize = calculateSize();
const int w = minSize.width();
const int h = minSize.height();
- if (m_Type != Uml::wt_ForkJoin && m_Type != Uml::wt_Object &&
- getWidth() >= w && getHeight() >= h)
- return;
setSize(w, h);
adjustAssocs( getX(), getY() ); // adjust assoc lines
}
--- trunk/KDE/kdesdk/umbrello/umbrello/widget_factory.cpp #677245:677246
@@ -178,15 +178,15 @@
// just graphic stuff with no real model information
//FIXME while boxes and texts are just diagram objects, activities and
// states should be UMLObjects
- if (tag == "statewidget") {
+ if (tag == "statewidget" || tag == "UML:StateWidget") {
widget = new StateWidget(view, StateWidget::Normal, Uml::id_Reserved);
- } else if (tag == "notewidget") {
+ } else if (tag == "notewidget" || tag == "UML:NoteWidget") {
widget = new NoteWidget(view, NoteWidget::Normal, Uml::id_Reserved);
} else if (tag == "boxwidget") {
widget = new BoxWidget(view, Uml::id_Reserved);
- } else if (tag == "floatingtext") {
+ } else if (tag == "floatingtext" || tag == "UML:FloatingTextWidget") {
widget = new FloatingTextWidget(view, Uml::tr_Floating, "", Uml::id_Reserved);
- } else if (tag == "activitywidget") {
+ } else if (tag == "activitywidget" || tag == "UML:ActivityWidget") {
widget = new ActivityWidget(view, ActivityWidget::Initial, Uml::id_Reserved);
} else if (tag == "messagewidget") {
widget = new MessageWidget(view, Uml::sequence_message_asynchronous, Uml::id_Reserved);
@@ -220,13 +220,13 @@
<< ID2STR(id) << endl;
}
- if (tag == "actorwidget") {
+ if (tag == "actorwidget" || tag == "UML:ActorWidget") {
if (validateObjType(Uml::ot_Actor, o, id))
widget = new ActorWidget(view, static_cast<UMLActor*>(o));
- } else if (tag == "usecasewidget") {
+ } else if (tag == "usecasewidget" || tag == "UML:UseCaseWidget") {
if (validateObjType(Uml::ot_UseCase, o, id))
widget = new UseCaseWidget(view, static_cast<UMLUseCase*>(o));
- } else if (tag == "classwidget") {
+ } else if (tag == "classwidget" || tag == "UML:ClassWidget") {
if (validateObjType(Uml::ot_Class, o, id))
widget = new ClassifierWidget(view, static_cast<UMLClassifier*>(o));
} else if (tag == "packagewidget") {
@@ -253,7 +253,7 @@
} else if (tag == "entitywidget") {
if (validateObjType(Uml::ot_Entity, o, id))
widget = new EntityWidget(view, static_cast<UMLEntity*>(o));
- } else if (tag == "objectwidget") {
+ } else if (tag == "objectwidget" || tag == "UML:ObjectWidget") {
widget = new ObjectWidget(view, o );
} else {
kWarning() << "Trying to create an unknown widget:" << tag << endl;
More information about the umbrello-devel
mailing list