[Uml-devel] branches/work/isi-umbrello/umbrello/umbrello
Caroline Bourdeu d'Aguerre
cbda at free.fr
Mon Feb 19 17:15:34 UTC 2007
SVN commit 635271 by bourdeu:
Add a state (UML 2.0) in the activity diagram: final state.
M +31 -0 activitywidget.cpp
M +1 -0 activitywidget.h
M +1 -1 cmds/widget/cmd_create_widget.cpp
M +2 -2 pics/CMakeLists.txt
AM pics/cursor-final_activity.png
AM pics/final_activity.png
M +1 -7 signalwidget.cpp
M +4 -0 toolbarstateother.cpp
M +3 -0 worktoolbar.cpp
M +2 -0 worktoolbar.h
--- branches/work/isi-umbrello/umbrello/umbrello/activitywidget.cpp #635270:635271
@@ -14,11 +14,13 @@
// qt includes
#include <qpainter.h>
+//#include <pen.h>
// kde includes
#include <klocale.h>
#include <kdebug.h>
#include <kinputdialog.h>
+#include <cmath>
// app includes
#include "uml.h"
@@ -45,6 +47,13 @@
void ActivityWidget::draw(QPainter & p, int offsetX, int offsetY) {
int w = width();
int h = height();
+
+ // Only for the final activity
+ float delta;
+ float x,x0,temp;
+ float y,y0;
+ QPen pen = p.pen();
+
switch ( m_ActivityType )
{
case Normal :
@@ -70,6 +79,25 @@
p.setBrush( WidgetBase::getLineColor() );
p.drawEllipse( offsetX, offsetY, w, h );
break;
+ case Final :
+
+ UMLWidget::setPen(p);
+ p.setBrush( Qt::white );
+ pen.setWidth( 2 );
+ pen.setColor ( Qt::red );
+ p.setPen( pen );
+ p.drawEllipse( offsetX, offsetY, w, h );
+
+ x = offsetX + w/2 ;
+ y = offsetY + h/2 ;
+
+ p.drawLine(x - (sqrt(2)/2) * (w/2) + 1, y - (sqrt(2)/2) * (w/2) + 1,
+ x + (sqrt(2)/2) * (w/2), y + (sqrt(2)/2) * (w/2));
+ p.drawLine(x + (sqrt(2)/2) * (w/2) - 1, y - (sqrt(2)/2) * (w/2) + 1,
+ x - (sqrt(2)/2) * (w/2), y + (sqrt(2)/2) * (w/2));
+
+
+ break;
case End :
UMLWidget::setPen(p);
p.setBrush( WidgetBase::getLineColor() );
@@ -179,6 +207,9 @@
case WorkToolBar::tbb_End_Activity:
resultType = End;
break;
+ case WorkToolBar::tbb_Final_Activity:
+ resultType = Final;
+ break;
case WorkToolBar::tbb_Branch:
resultType = Branch;
break;
--- branches/work/isi-umbrello/umbrello/umbrello/activitywidget.h #635270:635271
@@ -40,6 +40,7 @@
Initial = 0,
Normal,
End,
+ Final,
Branch,
Fork_DEPRECATED // use ForkJoinWidget instead
};
--- branches/work/isi-umbrello/umbrello/umbrello/cmds/widget/cmd_create_widget.cpp #635270:635271
@@ -26,7 +26,7 @@
cmdCreateWidget::~cmdCreateWidget()
{
- m_view->removeWidget(m_widget);
+ //m_view->removeWidget(m_widget);
}
// Create the UMLObject
--- branches/work/isi-umbrello/umbrello/umbrello/pics/CMakeLists.txt #635270:635271
@@ -7,7 +7,7 @@
CVprivate_meth.png CVprivate_signal.png CVprivate_slot.png CVprivate_var.png CVprotected_meth.png
CVprotected_signal.png CVprotected_slot.png CVprotected_var.png CVpublic_meth.png CVpublic_signal.png
CVpublic_slot.png CVpublic_var.png CVstruct.png deep-history.png shallow-history.png dependency.png
-end_state.png generalisation.png initial_state.png interface.png join.png junction.png datatype.png enum.png
+final_activity.png end_state.png generalisation.png initial_state.png interface.png join.png junction.png datatype.png enum.png
message-synchronous.png message-asynchronous.png note.png object_flow.png object.png startlogo.png template.png text.png
class.png uniassociation.png usecase.png branch.png fork.png state-fork.png package.png artifact.png
box.png node.png entity.png relationship.png subsystem.png cursor-actor.png message-found.png accept_signal.png accept_time_event.png send_signal.png cursor-andline.png
@@ -16,7 +16,7 @@
cursor-aggregation.png cursor-component.png cursor-containment.png cursor-interface.png cursor-datatype.png
cursor-enum.png cursor-text.png cursor-anchor.png cursor-object_flow.png cursor-composition.png cursor-message-asynchronous.png
cursor-class.png cursor-artifact.png cursor-dependency.png cursor-message-synchronous.png
-cursor-uniassociation.png cursor-association.png cursor-end_state.png cursor-node.png cursor-box.png
+cursor-uniassociation.png cursor-association.png cursor-end_state.png cursor-final_activity.png cursor-node.png cursor-box.png
cursor-fork.png cursor-note.png cursor-branch.png cursor-generalisation.png cursor-object.png
cursor-entity.png cursor-relationship.png precondition.png cursor-precondition.png cursor-send_signal.png cursor-accept_signal.png cursor-accept_time_event.png
cursor-message-found.png message-lost.png cursor-message-lost.png end_of_life.png cursor-end_of_life.png exception.png
** branches/work/isi-umbrello/umbrello/umbrello/pics/cursor-final_activity.png #property svn:mime-type
+ application/octet-stream
** branches/work/isi-umbrello/umbrello/umbrello/pics/final_activity.png #property svn:mime-type
+ application/octet-stream
--- branches/work/isi-umbrello/umbrello/umbrello/signalwidget.cpp #635270:635271
@@ -115,11 +115,7 @@
QFont font = UMLWidget::getFont();
font.setBold( false );
p.setFont( font );
-// p.drawText(offsetX + SIGNAL_MARGIN, offsetY + h,
-// w - SIGNAL_MARGIN * 2, fontHeight,
-// Qt::AlignCenter, getName());
- m_pName->setVisible( getName().length() > 1 );
- //m_pName->draw(p, offsetX, offsetY);
+
UMLWidget::setPen(p);
}
break;
@@ -155,8 +151,6 @@
m_Text = strName;
updateComponentSize();
adjustAssocs( getX(), getY() );
- if ( getSignalType() == Time)
- m_pName = new FloatingTextWidget(m_pView, Uml::tr_Floating, getName());
}
QString SignalWidget::getName() const {
--- branches/work/isi-umbrello/umbrello/umbrello/toolbarstateother.cpp #635270:635271
@@ -114,6 +114,10 @@
umlWidget = new ActivityWidget(m_pUMLView, ActivityWidget::End);
break;
+ case WorkToolBar::tbb_Final_Activity:
+ umlWidget = new ActivityWidget(m_pUMLView, ActivityWidget::Final);
+ break;
+
case WorkToolBar::tbb_Branch:
umlWidget = new ActivityWidget(m_pUMLView, ActivityWidget::Branch);
break;
--- branches/work/isi-umbrello/umbrello/umbrello/worktoolbar.cpp #635270:635271
@@ -142,6 +142,7 @@
insertHotBtn(tbb_Initial_Activity);
insertHotBtn(tbb_Activity);
insertHotBtn(tbb_End_Activity);
+ insertHotBtn(tbb_Final_Activity);
insertHotBtn(tbb_Branch);
insertHotBtn(tbb_Fork);
insertHotBtn(tbb_Activity_Transition);
@@ -307,6 +308,7 @@
{ tbb_Activity, i18n("Activity"), "usecase.png", SLOT(slotActivity()) },
{ tbb_State, i18n("State"), "usecase.png", SLOT(slotState()) },
{ tbb_End_Activity, i18n("End Activity"), "end_state.png", SLOT(slotEnd_Activity()) },
+ { tbb_Final_Activity, i18n("Final Activity"), "final_activity.png", SLOT(slotFinal_Activity()) },
{ tbb_Object_Flow, i18n("Object Flow"), "object_flow.png", SLOT(slotObject_Flow()) },
{ tbb_Initial_Activity, i18n("Initial Activity"), "initial_state.png", SLOT(slotInitial_Activity()) },
{ tbb_Coll_Message, i18n("Message"), "message-asynchronous.png", SLOT(slotColl_Message()) },
@@ -385,6 +387,7 @@
void WorkToolBar::slotActivity() {buttonChanged(tbb_Activity);}
void WorkToolBar::slotObject_Flow() {buttonChanged(tbb_Object_Flow);}
void WorkToolBar::slotEnd_Activity() {buttonChanged(tbb_End_Activity);}
+void WorkToolBar::slotFinal_Activity() {buttonChanged(tbb_Final_Activity);}
void WorkToolBar::slotBranch() {buttonChanged(tbb_Branch);}
void WorkToolBar::slotFork() {buttonChanged(tbb_Fork);}
void WorkToolBar::slotDeepHistory() {buttonChanged(tbb_DeepHistory);}
--- branches/work/isi-umbrello/umbrello/umbrello/worktoolbar.h #635270:635271
@@ -117,6 +117,7 @@
tbb_Initial_Activity,
tbb_Activity,
tbb_End_Activity,
+ tbb_Final_Activity,
tbb_Object_Flow,
tbb_Branch,
tbb_Fork,
@@ -237,6 +238,7 @@
void slotInitial_Activity();
void slotActivity();
void slotEnd_Activity();
+ void slotFinal_Activity();
void slotObject_Flow();
void slotBranch();
void slotSend_Signal();
More information about the umbrello-devel
mailing list