[Uml-devel] branches/work/soc-umbrello/umbrello
Andi Fischer
andi.fischer at hispeed.ch
Fri Jul 13 09:55:12 UTC 2012
SVN commit 1305528 by fischer:
Deprecated functions from WidgetBase removed.
M +4 -4 cmds/widget/cmd_changeFillColor.cpp
M +15 -11 dialogs/umlwidgetstylepage.cpp
M +19 -18 listpopupmenu.cpp
M +3 -3 listpopupmenu.h
M +6 -4 umlscene.cpp
M +1 -15 widgets/widgetbase.cpp
M +4 -26 widgets/widgetbase.h
--- branches/work/soc-umbrello/umbrello/cmds/widget/cmd_changeFillColor.cpp #1305527:1305528
@@ -4,7 +4,7 @@
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
- * copyright (C) 2002-2011 *
+ * copyright (C) 2002-2012 *
* Umbrello UML Modeller Authors <uml-devel at uml.sf.net> *
***************************************************************************/
@@ -24,7 +24,7 @@
m_color(col)
{
setText(i18n("Change fill color : %1", w->name()));
- m_oldColor = w->fillColor();
+ m_oldColor = w->brush().color();
}
CmdChangeFillColor::~CmdChangeFillColor()
@@ -33,11 +33,11 @@
void CmdChangeFillColor::redo()
{
- m_umlWidget->setFillColor( m_color );
+ m_umlWidget->setBrush(QBrush(m_color));
}
void CmdChangeFillColor::undo()
{
- m_umlWidget->setFillColor( m_oldColor );
+ m_umlWidget->setBrush(QBrush(m_oldColor));
}
}
--- branches/work/soc-umbrello/umbrello/dialogs/umlwidgetstylepage.cpp #1305527:1305528
@@ -21,13 +21,13 @@
#include <kcolorbutton.h>
#include <KIntSpinBox>
-#include <QtGui/QLayout>
-#include <QtGui/QGroupBox>
-#include <QtGui/QLabel>
-#include <QtGui/QPushButton>
-#include <QtGui/QCheckBox>
-#include <QtGui/QVBoxLayout>
-#include <QtGui/QGridLayout>
+#include <QCheckBox>
+#include <QGridLayout>
+#include <QGroupBox>
+#include <QLabel>
+#include <QLayout>
+#include <QPushButton>
+#include <QVBoxLayout>
/**
* Constructor - Observe a UMLWidget.
@@ -40,8 +40,8 @@
init();
m_pTextColorB->setColor( pWidget->textColor() );
m_pLineColorB->setColor( pWidget->lineColor() );
- m_pFillColorB->setColor( pWidget->fillColor() );
- m_pUseFillColorCB->setChecked( pWidget->useFillColor() );
+ m_pFillColorB->setColor( pWidget->brush().color() );
+ m_pUseFillColorCB->setChecked( (pWidget->brush().style() != Qt::NoBrush) );
m_lineWidthB->setValue( pWidget->lineWidth() );
if (!m_pUMLWidget) { // when we are on the diagram
@@ -238,10 +238,14 @@
void UMLWidgetStylePage::updateUMLWidget()
{
if (m_pUMLWidget) {
- m_pUMLWidget->setUseFillColor( m_pUseFillColorCB->isChecked() );
m_pUMLWidget->setTextColor( m_pTextColorB->color() );
m_pUMLWidget->setLineColor( m_pLineColorB->color() );
- m_pUMLWidget->setFillColor( m_pFillColorB->color() );
+ if (m_pUseFillColorCB->isChecked()) {
+ m_pUMLWidget->setBrush( QBrush(m_pFillColorB->color()) );
+ }
+ else {
+ m_pUMLWidget->setBrush(Qt::NoBrush);
+ }
m_pUMLWidget->setLineWidth( m_lineWidthB->value() );
}
else if (m_options) {
--- branches/work/soc-umbrello/umbrello/listpopupmenu.cpp #1305527:1305528
@@ -289,7 +289,7 @@
return;
WidgetBase::WidgetType type = object->baseType();
// uDebug() << "ListPopupMenu created with multi=" << multi << " , unique="
- // << unique << " for WidgetType=" << type;
+ // << unique << " for WidgetType=" << WidgetBase::toString(type);
if (multi) {
ClassifierWidget *c = NULL;
@@ -297,7 +297,7 @@
c = static_cast<ClassifierWidget *>( object );
makeMultiClassifierPopup(c);
}
- insertSubMenuColor(object->useFillColor());
+ insertSubMenuColor(object);
addSeparator();
insert(mt_Cut);
insert(mt_Copy);
@@ -326,7 +326,7 @@
switch (type) {
case WidgetBase::wt_Actor:
case WidgetBase::wt_UseCase:
- insertSubMenuColor(object->useFillColor());
+ insertSubMenuColor(object);
insertStdItems(true, type);
insert(mt_Rename);
insert(mt_Change_Font);
@@ -339,7 +339,7 @@
static_cast<UMLCategory*>(object->umlObject()));
m->setTitle(i18n("Category Type"));
addMenu(m);
- insertSubMenuColor(object->useFillColor());
+ insertSubMenuColor(object);
insertStdItems(true, type);
insert(mt_Rename);
insert(mt_Change_Font);
@@ -352,7 +352,7 @@
case WidgetBase::wt_Enum:
insertSubMenuNew(mt_Enum);
- insertSubMenuColor(object->useFillColor());
+ insertSubMenuColor(object);
insertStdItems(true, type);
insert(mt_Rename);
insert(mt_Change_Font);
@@ -361,7 +361,7 @@
case WidgetBase::wt_Entity:
insertSubMenuNew(mt_Entity);
- insertSubMenuColor(object->useFillColor());
+ insertSubMenuColor(object);
insertStdItems(true, type);
insert(mt_Rename);
insert(mt_Change_Font);
@@ -373,7 +373,7 @@
case WidgetBase::wt_Component:
case WidgetBase::wt_Node:
case WidgetBase::wt_Artifact:
- insertSubMenuColor(object->useFillColor());
+ insertSubMenuColor(object);
insertStdItems(false, type);
insert(mt_Rename);
insert(mt_Change_Font);
@@ -383,7 +383,7 @@
case WidgetBase::wt_Object:
{
//Used for sequence diagram and collaboration diagram widgets
- insertSubMenuColor( object->useFillColor() );
+ insertSubMenuColor(object);
if (object->umlScene() &&
object->umlScene()->type() == Uml::DiagramType::Sequence) {
addSeparator();
@@ -410,7 +410,7 @@
break;
case WidgetBase::wt_Note:
- insertSubMenuColor(object->useFillColor());
+ insertSubMenuColor(object);
addSeparator();
insert(mt_Cut);
insert(mt_Copy);
@@ -433,7 +433,7 @@
if (pState->stateType() == StateWidget::Normal) {
insertSubMenuNew(mt_New_Activity);
}
- insertSubMenuColor( object->useFillColor() );
+ insertSubMenuColor(object);
insertStdItems(false, type);
switch (pState->stateType()) {
case StateWidget::Normal:
@@ -474,7 +474,7 @@
if( pActivity->activityType() == ActivityWidget::Normal
|| pActivity->activityType() == ActivityWidget::Invok
|| pActivity->activityType() == ActivityWidget::Param) {
- insertSubMenuColor( object->useFillColor() );
+ insertSubMenuColor(object);
}
insertStdItems(false, type);
if( pActivity->activityType() == ActivityWidget::Normal
@@ -493,7 +493,7 @@
if (objWidget->objectNodeType() == ObjectNodeWidget::Buffer
|| objWidget->objectNodeType() == ObjectNodeWidget::Data
|| objWidget->objectNodeType() == ObjectNodeWidget::Flow) {
- insertSubMenuColor( object->useFillColor() );
+ insertSubMenuColor(object);
}
insertStdItems(false, type);
if (objWidget->objectNodeType() == ObjectNodeWidget::Buffer
@@ -510,7 +510,7 @@
case WidgetBase::wt_Signal:
case WidgetBase::wt_FloatingDashLine:
case WidgetBase::wt_Precondition:
- insertSubMenuColor(object->useFillColor());
+ insertSubMenuColor(object);
addSeparator();
insert(mt_Cut);
insert(mt_Copy);
@@ -529,7 +529,7 @@
insert(mt_AddInteractionOperand, i18n("Add Interaction Operand"));
addSeparator();
}
- insertSubMenuColor(object->useFillColor());
+ insertSubMenuColor(object);
addSeparator();
insert(mt_Cut);
insert(mt_Copy);
@@ -583,7 +583,7 @@
}
break;
default:
- uWarning() << "unhandled WidgetType " << type;
+ uWarning() << "unhandled WidgetType " << WidgetBase::toString(type);
break;
}//end switch
@@ -978,7 +978,7 @@
makeMultiClassifierPopup(c);
- insertSubMenuColor(c->useFillColor());
+ insertSubMenuColor(c);
insertStdItems(true, type);
insert(mt_Rename);
insert(mt_Change_Font);
@@ -1001,13 +1001,14 @@
*
* @param fc The "Use Fill Color" is checked.
*/
-void ListPopupMenu::insertSubMenuColor(bool fc)
+void ListPopupMenu::insertSubMenuColor(WidgetBase *w)
{
KMenu* color = new KMenu(i18nc("color menu", "Color"), this);
insert(mt_Line_Color, color, Icon_Utils::SmallIcon(Icon_Utils::it_Color_Line), i18n("Line Color..."));
insert(mt_Fill_Color, color, Icon_Utils::SmallIcon(Icon_Utils::it_Color_Fill), i18n("Fill Color..."));
insert(mt_Use_Fill_Color, color, i18n("Use Fill Color"), CHECKABLE);
- setActionChecked(mt_Use_Fill_Color, fc);
+ bool fillColor = (w->brush().style() != Qt::NoBrush);
+ setActionChecked(mt_Use_Fill_Color, fillColor);
addMenu(color);
}
--- branches/work/soc-umbrello/umbrello/listpopupmenu.h #1305527:1305528
@@ -4,7 +4,7 @@
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
- * copyright (C) 2003-2011 *
+ * copyright (C) 2003-2012 *
* Umbrello UML Modeller Authors <uml-devel at uml.sf.net> *
***************************************************************************/
@@ -19,7 +19,7 @@
#include <kmenu.h>
// #include <kaction.h>
-#include <QtCore/QHash>
+#include <QHash>
class UMLView;
class ClassifierWidget;
@@ -266,7 +266,7 @@
KMenu* makeCategoryTypeMenu(UMLCategory* category);
void insertSubMenuNew(MenuType type);
- void insertSubMenuColor(bool fc);
+ void insertSubMenuColor(WidgetBase* w);
void setupDiagramMenu(UMLView* view);
void setupMenu(MenuType type);
--- branches/work/soc-umbrello/umbrello/umlscene.cpp #1305527:1305528
@@ -1334,10 +1334,12 @@
*/
void UMLScene::selectionUseFillColor(bool useFC)
{
- foreach(UMLWidget* temp, selectedWidgets()) {
- temp->setUseFillColor(useFC);
+ foreach(UMLWidget* widget, selectedWidgets()) {
+ if (!useFC) {
+ widget->setBrush(Qt::NoBrush);
}
}
+}
/**
* Set the font for all the currently selected items.
@@ -1390,8 +1392,8 @@
{
UMLApp::app()->beginMacro(i18n("Change Fill Color"));
- foreach(UMLWidget* temp, selectedWidgets()) {
- temp->setFillColor(color);
+ foreach(UMLWidget* widget, selectedWidgets()) {
+ widget->setBrush(QBrush(color));
// [PORT] temp->setUsesDiagramFillColour(false);
}
UMLApp::app()->endMacro();
--- branches/work/soc-umbrello/umbrello/widgets/widgetbase.cpp #1305527:1305528
@@ -953,7 +953,7 @@
case ListPopupMenu::mt_Fill_Color:
widget = umlScene()->getFirstMultiSelectedWidget();
if (widget) {
- newColour = widget->fillColor();
+ newColour = widget->brush().color();
}
if (KColorDialog::getColor(newColour)) {
umlScene()->selectionSetFillColor(newColour);
@@ -1241,18 +1241,4 @@
update();
}
-
-
-///////////////////////////////SOME DEPRECATED STUFF///////////////
-
-QColor WidgetBase::fillColor() const
-{
- QBrush b = brush();
- if (b.gradient() || b.style() == Qt::TexturePattern || b.style() == Qt::NoBrush) {
- return QColor(Qt::transparent);
- }
- return b.color();
-}
-
-
#include "widgetbase.moc"
--- branches/work/soc-umbrello/umbrello/widgets/widgetbase.h #1305527:1305528
@@ -33,12 +33,12 @@
#include <QPen>
// Forward delcarations
+class IDChangeLog;
+class ListPopupMenu;
+class UMLDoc;
class UMLObject;
class UMLScene;
-class UMLDoc;
class WidgetInterfaceData;
-class ListPopupMenu;
-class IDChangeLog;
/**
* @short The base class for UML widgets that appear on UML diagrams.
@@ -220,7 +220,6 @@
QRectF m_boundingRect;
QPainterPath m_shape;
-
QPointF m_itemPositionChangePos;
/**
@@ -231,24 +230,16 @@
* WidgetBase::loadFromXMI
*/
QVariantMap m_loadData;
- // Property that will be saved.
WidgetType m_baseType;
private:
UMLObject *m_umlObject;
-
- // Properties that will be saved.
-
QColor m_lineColor;
uint m_lineWidth;
-
QColor m_textColor;
-
QBrush m_brush;
QFont m_font;
- // End of properties that will be saved.
-
/**
* This flag is used to hold whether a widget is partially constructed (due to
* delayed construction of sub components) or not.
@@ -265,20 +256,7 @@
bool m_usesDiagramTextColor:1;
// Disable the copy constructor and assignment operator.
- Q_DISABLE_COPY(WidgetBase);
-
-public:
-
- // DEPRECATED SECTION ///////////////////////////////
-
- QColor fillColor() const;
- void setFillColor(const QColor& col) { setBrush(QBrush(col)); }
-
- bool useFillColor() const { return false; }
- void setUseFillColor(bool) {} //:TODO: fix UMLWidgetColorPage
-
- ////////////////////////////////////////////////////////////////////////////////
-
+ Q_DISABLE_COPY(WidgetBase)
};
Q_DECLARE_OPERATORS_FOR_FLAGS(WidgetBase::UserChange)
More information about the umbrello-devel
mailing list