~ubuntu-branches/ubuntu/vivid/kdesdk/vivid

« back to all changes in this revision

Viewing changes to umbrello/umbrello/widgets/activitywidget.cpp

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2012-06-06 11:49:54 UTC
  • mfrom: (0.4.21)
  • Revision ID: package-import@ubuntu.com-20120606114954-rdls73fzlpzxglbx
Tags: 4:4.8.80-0ubuntu1
* New uptream beta release
* Update dont_export_private_classes.diff

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
// app includes
15
15
#include "activitydialog.h"
16
16
#include "debug_utils.h"
17
 
#include "docwindow.h"
18
17
#include "listpopupmenu.h"
19
18
#include "uml.h"
20
19
#include "umldoc.h"
54
53
}
55
54
 
56
55
/**
 
56
 * Returns the type string of activity.
 
57
 */
 
58
QString ActivityWidget::activityTypeStr() const
 
59
{
 
60
    return QLatin1String(ENUM_NAME(ActivityWidget, ActivityType, m_activityType));
 
61
}
 
62
 
 
63
/**
57
64
 * Sets the type of activity.
58
65
 */
59
66
void ActivityWidget::setActivityType( ActivityType activityType )
100
107
}
101
108
 
102
109
/**
103
 
 * This method get the name of the preText attribute
 
110
 * This method get the name of the preText attribute.
104
111
 */
105
 
QString ActivityWidget::preconditionText()
 
112
QString ActivityWidget::preconditionText() const
106
113
{
107
114
    return m_preconditionText;
108
115
}
114
121
{
115
122
    m_preconditionText = aPreText;
116
123
    updateComponentSize();
117
 
    adjustAssocs( getX(), getY() );
 
124
    adjustAssocs( x(), y() );
118
125
}
119
126
 
120
127
/**
121
 
 * This method get the name of the postText attribute
 
128
 * This method get the name of the postText attribute.
122
129
 */
123
 
QString ActivityWidget::postconditionText()
 
130
QString ActivityWidget::postconditionText() const
124
131
{
125
 
    return m_postconditionText ;
 
132
    return m_postconditionText;
126
133
}
127
134
 
128
 
 /**
 
135
/**
129
136
 * This method set the name of the postText attribute
130
137
 */
131
138
void ActivityWidget::setPostconditionText(const QString& aPostText)
132
139
{
133
140
    m_postconditionText = aPostText;
134
141
    updateComponentSize();
135
 
    adjustAssocs( getX(), getY() );
 
142
    adjustAssocs( x(), y() );
136
143
}
137
144
 
138
145
/**
141
148
 */
142
149
void ActivityWidget::showPropertiesDialog()
143
150
{
144
 
    DocWindow *docwindow = UMLApp::app()->docWindow();
145
 
    docwindow->updateDocumentation(false);
 
151
    umlScene()->updateDocumentation(false);
146
152
 
147
 
    QPointer<ActivityDialog> dialog = new ActivityDialog(umlScene(), this);
 
153
    QPointer<ActivityDialog> dialog = new ActivityDialog(umlScene()->view(), this);
148
154
    if (dialog->exec() && dialog->getChangesMade()) {
149
 
        docwindow->showDocumentation(this, true);
 
155
        umlScene()->showDocumentation(this, true);
150
156
        UMLApp::app()->document()->setModified(true);
151
157
    }
152
158
    delete dialog;
167
173
 
168
174
    switch ( m_activityType )
169
175
    {
170
 
    case Normal :
 
176
    case Normal:
171
177
        UMLWidget::setPenFromSettings(p);
172
178
        if ( UMLWidget::useFillColor() ) {
173
179
            p.setBrush( UMLWidget::fillColor() );
177
183
            const int fontHeight  = fm.lineSpacing();
178
184
            int textStartY = (h / 2) - (fontHeight / 2);
179
185
            p.drawRoundRect(offsetX, offsetY, w, h, (h * 60) / w, 60);
180
 
            p.setPen(Qt::black);
 
186
            p.setPen(textColor());
181
187
            p.setFont( UMLWidget::font() );
182
188
            p.drawText(offsetX + ACTIVITY_MARGIN, offsetY + textStartY,
183
189
                       w - ACTIVITY_MARGIN * 2, fontHeight, Qt::AlignCenter, name());
184
190
        }
185
191
        break;
186
192
 
187
 
    case Initial :
 
193
    case Initial:
188
194
        p.setPen( QPen(m_LineColor, 1) );
189
195
        p.setBrush( WidgetBase::lineColor() );
190
196
        p.drawEllipse( offsetX, offsetY, w, h );
191
197
        break;
192
198
 
193
 
    case Final :
194
 
 
 
199
    case Final:
195
200
        UMLWidget::setPenFromSettings(p);
196
201
        p.setBrush( Qt::white );
197
202
        pen.setWidth( 2 );
207
212
        }
208
213
        break;
209
214
 
210
 
    case End :
 
215
    case End:
211
216
        p.setPen( QPen(m_LineColor, 1) );
212
217
        p.setBrush( WidgetBase::lineColor() );
213
218
        p.drawEllipse( offsetX, offsetY, w, h );
217
222
        p.drawEllipse( offsetX + 3, offsetY + 3, w - 6, h - 6 );
218
223
        break;
219
224
 
220
 
    case Branch :
 
225
    case Branch:
221
226
        UMLWidget::setPenFromSettings(p);
222
227
        p.setBrush( UMLWidget::fillColor() );
223
228
        {
231
236
        }
232
237
        break;
233
238
 
234
 
    case Invok :
 
239
    case Invok:
235
240
        UMLWidget::setPenFromSettings(p);
236
241
        if ( UMLWidget::useFillColor() ) {
237
242
            p.setBrush( UMLWidget::fillColor() );
241
246
            const int fontHeight  = fm.lineSpacing();
242
247
            int textStartY = (h / 2) - (fontHeight / 2);
243
248
            p.drawRoundRect(offsetX, offsetY, w, h, (h * 60) / w, 60);
244
 
            p.setPen(Qt::black);
 
249
            p.setPen(textColor());
245
250
            p.setFont( UMLWidget::font() );
246
251
            p.drawText(offsetX + ACTIVITY_MARGIN, offsetY + textStartY,
247
252
                       w - ACTIVITY_MARGIN * 2, fontHeight, Qt::AlignCenter, name());
256
261
        p.drawLine((int)(x + 10),(int)(y + 10), (int)(x + 10), (int)(y + 20));
257
262
        break;
258
263
 
259
 
    case Param :
 
264
    case Param:
260
265
        UMLWidget::setPenFromSettings(p);
261
266
        if ( UMLWidget::useFillColor() ) {
262
267
            p.setBrush( UMLWidget::fillColor() );
268
273
            QString postCond= "<<postcondition>> "+postconditionText();
269
274
            //int textStartY = (h / 2) - (fontHeight / 2);
270
275
            p.drawRoundRect(offsetX, offsetY, w, h, (h * 60) / w, 60);
271
 
            p.setPen(Qt::black);
 
276
            p.setPen(textColor());
272
277
            p.setFont( UMLWidget::font() );
273
278
            p.drawText(offsetX + ACTIVITY_MARGIN, offsetY + fontHeight + 10,
274
279
                       w - ACTIVITY_MARGIN * 2, fontHeight, Qt::AlignCenter, preCond);
280
285
 
281
286
        break;
282
287
    }
283
 
    if(m_selected)
 
288
    if (m_selected)
284
289
        drawSelected(&p, offsetX, offsetY);
285
290
}
286
291
 
287
292
/**
288
293
 * Loads the widget from the "activitywidget" XMI element.
289
294
 */
290
 
bool ActivityWidget::loadFromXMI( QDomElement & qElement )
 
295
bool ActivityWidget::loadFromXMI(QDomElement& qElement)
291
296
{
292
297
    if( !UMLWidget::loadFromXMI( qElement ) )
293
298
        return false;