[Uml-devel] branches/work/soc-umbrello/umbrello
Andi Fischer
andi.fischer at hispeed.ch
Thu May 31 11:56:57 UTC 2012
SVN commit 1297451 by fischer:
Differences to gsoc branch reduced.
M +25 -28 toolbarstate.cpp
M +10 -19 toolbarstate.h
M +3 -3 toolbarstateassociation.cpp
M +4 -4 toolbarstatemessages.cpp
M +5 -1 uml.cpp
M +1 -1 umldoc.cpp
M +2 -3 umlscene.cpp
M +5 -5 widgets/toolbarstateonewidget.cpp
M +11 -0 widgets/widgetbase.cpp
M +2 -0 widgets/widgetbase.h
--- branches/work/soc-umbrello/umbrello/toolbarstate.cpp #1297450:1297451
@@ -85,9 +85,9 @@
setCurrentElement();
- if (getCurrentWidget()) {
+ if (currentWidget()) {
mousePressWidget();
- } else if (getCurrentAssociation()) {
+ } else if (currentAssociation()) {
mousePressAssociation();
} else {
mousePressEmpty();
@@ -111,10 +111,10 @@
// TODO, should only be available in this state?
m_pUMLScene->setPos(m_pMouseEvent->scenePos());
- if (getCurrentWidget()) {
+ if (currentWidget()) {
mouseReleaseWidget();
setCurrentWidget(0);
- } else if (getCurrentAssociation()) {
+ } else if (currentAssociation()) {
mouseReleaseAssociation();
setCurrentAssociation(0);
} else {
@@ -139,7 +139,7 @@
setMouseEvent(ome, QEvent::MouseButtonDblClick);
UMLWidget* currentWidget = m_pUMLScene->widgetAt(m_pMouseEvent->scenePos());
- AssociationWidget* currentAssociation = getAssociationAt(m_pMouseEvent->scenePos());
+ AssociationWidget* currentAssociation = associationAt(m_pMouseEvent->scenePos());
if (currentWidget) {
setCurrentWidget(currentWidget);
mouseDoubleClickWidget();
@@ -170,9 +170,9 @@
{
setMouseEvent(ome, QEvent::MouseMove);
- if (getCurrentWidget()) {
+ if (currentWidget()) {
mouseMoveWidget();
- } else if (getCurrentAssociation()) {
+ } else if (currentAssociation()) {
mouseMoveAssociation();
} else {
mouseMoveEmpty();
@@ -206,7 +206,7 @@
*/
void ToolBarState::slotAssociationRemoved(AssociationWidget* association)
{
- if (association == getCurrentAssociation()) {
+ if (association == currentAssociation()) {
setCurrentAssociation(0);
}
}
@@ -219,7 +219,7 @@
*/
void ToolBarState::slotWidgetRemoved(UMLWidget* widget)
{
- if (widget == getCurrentWidget()) {
+ if (widget == currentWidget()) {
setCurrentWidget(0);
}
}
@@ -234,9 +234,9 @@
*/
ToolBarState::ToolBarState(UMLScene *umlScene)
: QObject(umlScene),
- m_pUMLScene(umlScene)
+ m_pUMLScene(umlScene),
+ m_pMouseEvent(0)
{
- m_pMouseEvent = NULL;
init();
}
@@ -251,7 +251,7 @@
void ToolBarState::setCurrentElement()
{
// Check associations.
- AssociationWidget* association = getAssociationAt(m_pMouseEvent->scenePos());
+ AssociationWidget* association = associationAt(m_pMouseEvent->scenePos());
if (association) {
setCurrentAssociation(association);
return;
@@ -259,14 +259,14 @@
// Check messages.
//TODO check why message widgets are treated different
- MessageWidget* message = getMessageAt(m_pMouseEvent->scenePos());
+ MessageWidget* message = messageAt(m_pMouseEvent->scenePos());
if (message) {
setCurrentWidget(message);
return;
}
//TODO check why message widgets are treated different
- FloatingDashLineWidget* floatingline = getFloatingLineAt(m_pMouseEvent->scenePos());
+ FloatingDashLineWidget* floatingline = floatingLineAt(m_pMouseEvent->scenePos());
if (floatingline) {
setCurrentWidget(floatingline);
return;
@@ -404,7 +404,7 @@
*
* @return The widget currently in use.
*/
-UMLWidget* ToolBarState::getCurrentWidget() const
+UMLWidget* ToolBarState::currentWidget() const
{
return m_currentWidget;
}
@@ -416,11 +416,11 @@
* Default implementation is set the specified widget, although this
* behaviour can be overridden in subclasses if needed.
*
- * @param currentWidget The widget to be set.
+ * @param widget The widget to be set.
*/
-void ToolBarState::setCurrentWidget(UMLWidget* currentWidget)
+void ToolBarState::setCurrentWidget(UMLWidget* widget)
{
- m_currentWidget = currentWidget;
+ m_currentWidget = widget;
}
/**
@@ -428,7 +428,7 @@
*
* @return The association currently in use.
*/
-AssociationWidget* ToolBarState::getCurrentAssociation() const
+AssociationWidget* ToolBarState::currentAssociation() const
{
return m_currentAssociation;
}
@@ -440,11 +440,11 @@
* Default implementation is set the specified association, although this
* behaviour can be overridden in subclasses if needed.
*
- * @param currentAssociation The association to be set.
+ * @param association The association to be set.
*/
-void ToolBarState::setCurrentAssociation(AssociationWidget* currentAssociation)
+void ToolBarState::setCurrentAssociation(AssociationWidget* association)
{
- m_currentAssociation = currentAssociation;
+ m_currentAssociation = association;
}
/**
@@ -482,7 +482,7 @@
* @return The MessageWidget at the specified position, or null if there is none.
* @todo Better handling for messages at the same point
*/
-MessageWidget* ToolBarState::getMessageAt(const UMLScenePoint& pos)
+MessageWidget* ToolBarState::messageAt(const UMLScenePoint& pos)
{
QList<QGraphicsItem*> collisions = m_pUMLScene->items(pos);
@@ -491,7 +491,6 @@
if (msgWidget) {
return msgWidget;
}
-
}
return 0;
}
@@ -504,7 +503,7 @@
* @return The AssociationWidget at the specified position, or null if there is none.
* @todo Better handling for associations at the same point
*/
-AssociationWidget* ToolBarState::getAssociationAt(const UMLScenePoint& pos)
+AssociationWidget* ToolBarState::associationAt(const UMLScenePoint& pos)
{
QList<QGraphicsItem*> collisions = m_pUMLScene->items(pos);
@@ -514,7 +513,6 @@
return assocWidget;
}
}
-
return 0;
}
@@ -525,7 +523,7 @@
* @param pos The position to get the floatingLine.
* @return The MessageWidget at the specified position, or null if there is none.
*/
-FloatingDashLineWidget* ToolBarState::getFloatingLineAt(const UMLScenePoint& pos)
+FloatingDashLineWidget* ToolBarState::floatingLineAt(const UMLScenePoint& pos)
{
QList<QGraphicsItem*> collisions = m_pUMLScene->items(pos);
@@ -540,4 +538,3 @@
}
#include "toolbarstate.moc"
-
--- branches/work/soc-umbrello/umbrello/toolbarstate.h #1297450:1297451
@@ -15,7 +15,6 @@
#include <QtCore/QEvent>
#include <QtCore/QObject>
-#include <QtCore/QPoint>
class AssociationWidget;
class MessageWidget;
@@ -71,7 +70,6 @@
{
Q_OBJECT
public:
-
virtual ~ToolBarState();
virtual void init();
@@ -84,12 +82,10 @@
virtual void mouseMove(UMLSceneMouseEvent* ome);
public slots:
-
virtual void slotAssociationRemoved(AssociationWidget* association);
virtual void slotWidgetRemoved(UMLWidget* widget);
protected:
-
ToolBarState(UMLScene *umlScene);
virtual void setCurrentElement();
@@ -109,29 +105,24 @@
virtual void changeTool();
- virtual UMLWidget* getCurrentWidget() const;
- virtual void setCurrentWidget(UMLWidget* currentWidget);
+ virtual UMLWidget* currentWidget() const;
+ virtual void setCurrentWidget(UMLWidget* widget);
- virtual AssociationWidget* getCurrentAssociation() const;
- virtual void setCurrentAssociation(AssociationWidget* currentAssociation);
+ virtual AssociationWidget* currentAssociation() const;
+ virtual void setCurrentAssociation(AssociationWidget* association);
void setMouseEvent(UMLSceneMouseEvent* ome, const QEvent::Type &type);
- AssociationWidget* getAssociationAt(const UMLScenePoint& pos);
- MessageWidget* getMessageAt(const UMLScenePoint& pos);
- FloatingDashLineWidget* getFloatingLineAt(const UMLScenePoint& pos);
+ AssociationWidget* associationAt(const UMLScenePoint& pos);
+ MessageWidget* messageAt(const UMLScenePoint& pos);
+ FloatingDashLineWidget* floatingLineAt(const UMLScenePoint& pos);
UMLScene* m_pUMLScene; ///< The UMLScene.
+ UMLSceneMouseEvent* m_pMouseEvent; ///< The mouse event currently in use.
+ // This event is the equivalent of the received event after transforming it
+ // using the inverse world matrix in the UMLScene.
- /**
- * The mouse event currently in use.
- * This event is the equivalent of the received event after transforming it
- * using the inverse world matrix in the UMLScene.
- */
- UMLSceneMouseEvent* m_pMouseEvent;
-
private:
-
UMLWidget* m_currentWidget; ///< The widget currently in use, if any.
AssociationWidget* m_currentAssociation; ///< The association currently in use, if any.
--- branches/work/soc-umbrello/umbrello/toolbarstateassociation.cpp #1297450:1297451
@@ -117,7 +117,7 @@
return;
}
- getCurrentAssociation()->setAssociationClass(
+ currentAssociation()->setAssociationClass(
static_cast<ClassifierWidget*>(m_firstWidget));
cleanAssociation();
}
@@ -168,7 +168,7 @@
*/
void ToolBarStateAssociation::setFirstWidget()
{
- UMLWidget* widget = getCurrentWidget();
+ UMLWidget* widget = currentWidget();
Uml::AssociationType type = getAssociationType();
if (!AssocRules::allowAssociation(type, widget)) {
@@ -208,7 +208,7 @@
{
Uml::AssociationType type = getAssociationType();
UMLWidget* widgetA = m_firstWidget;
- UMLWidget* widgetB = getCurrentWidget();
+ UMLWidget* widgetB = currentWidget();
WidgetBase::WidgetType at = widgetA->baseType();
bool valid = true;
if (type == Uml::AssociationType::Generalization) {
--- branches/work/soc-umbrello/umbrello/toolbarstatemessages.cpp #1297450:1297451
@@ -146,7 +146,7 @@
//TODO When an association between UMLObjects of invalid types is made, an error message
//is shown. Shouldn't also a message be used here?
if (m_pMouseEvent->button() != Qt::LeftButton ||
- getCurrentWidget()->baseType() != WidgetBase::wt_Object) {
+ currentWidget()->baseType() != WidgetBase::wt_Object) {
cleanMessage();
return;
}
@@ -156,14 +156,14 @@
}
if (!m_isObjectWidgetLine) {
- setSecondWidget(static_cast<ObjectWidget*>(getCurrentWidget()), CreationMessage);
+ setSecondWidget(static_cast<ObjectWidget*>(currentWidget()), CreationMessage);
return;
}
if (!m_firstObject) {
- setFirstWidget(static_cast<ObjectWidget*>(getCurrentWidget()));
+ setFirstWidget(static_cast<ObjectWidget*>(currentWidget()));
} else {
- setSecondWidget(static_cast<ObjectWidget*>(getCurrentWidget()), NormalMessage);
+ setSecondWidget(static_cast<ObjectWidget*>(currentWidget()), NormalMessage);
}
}
--- branches/work/soc-umbrello/umbrello/uml.cpp #1297450:1297451
@@ -230,15 +230,19 @@
QAction* fileSaveAs = KStandardAction::saveAs(this, SLOT(slotFileSaveAs()), actionCollection());
QAction* fileClose = KStandardAction::close(this, SLOT(slotFileClose()), actionCollection());
filePrint = KStandardAction::print(this, SLOT(slotFilePrint()), actionCollection());
+ printPreview = KStandardAction::printPreview(this, SLOT(slotPrintPreview()), actionCollection());
+#if QT_VERSION >= 0x040600
filePrint->setPriority(QAction::LowPriority); // icon only
- printPreview = KStandardAction::printPreview(this, SLOT(slotPrintPreview()), actionCollection());
printPreview->setPriority(QAction::LowPriority); // icon only
+#endif
QAction* fileQuit = KStandardAction::quit(this, SLOT(slotFileQuit()), actionCollection());
editUndo = m_pUndoStack->createUndoAction(actionCollection());
editRedo = m_pUndoStack->createRedoAction(actionCollection());
+#if QT_VERSION >= 0x040600
editUndo->setPriority(QAction::LowPriority); // icon only
editRedo->setPriority(QAction::LowPriority); // icon only
+#endif
disconnect( m_pUndoStack, SIGNAL(undoTextChanged(QString)), editUndo, 0 );
disconnect( m_pUndoStack, SIGNAL(redoTextChanged(QString)), editRedo, 0 );
--- branches/work/soc-umbrello/umbrello/umldoc.cpp #1297450:1297451
@@ -69,7 +69,7 @@
#include <QtXml/QDomDocument>
// Update this version when changing the XMI file format
-#define XMI_FILE_VERSION "1.6.0"
+#define XMI_FILE_VERSION "1.6.1"
/**
* Constructor for the fileclass of the application.
--- branches/work/soc-umbrello/umbrello/umlscene.cpp #1297450:1297451
@@ -1471,7 +1471,6 @@
} else {
removeWidget(widget);
}
-
}
// Delete any selected associations.
@@ -3457,6 +3456,7 @@
/**
* Shows the properties dialog for the view.
+ * FIXME belongs to UMLView
*/
bool UMLScene::showPropDialog()
{
@@ -3637,8 +3637,7 @@
void UMLScene::clearDiagram()
{
if (KMessageBox::Continue == KMessageBox::warningContinueCancel(activeView(),
- i18n("You are about to delete "
- "the entire diagram.\nAre you sure?"),
+ i18n("You are about to delete the entire diagram.\nAre you sure?"),
i18n("Delete Diagram?"),
KGuiItem(i18n("&Delete"), "edit-delete"))) {
removeAllWidgets();
--- branches/work/soc-umbrello/umbrello/widgets/toolbarstateonewidget.cpp #1297450:1297451
@@ -127,14 +127,14 @@
}
if (m_pMouseEvent->button() != Qt::LeftButton ||(
- getCurrentWidget()->baseType() != WidgetBase::wt_Object &&
- getCurrentWidget()->baseType() != WidgetBase::wt_Activity &&
- getCurrentWidget()->baseType() != WidgetBase::wt_Region)) {
+ currentWidget()->baseType() != WidgetBase::wt_Object &&
+ currentWidget()->baseType() != WidgetBase::wt_Activity &&
+ currentWidget()->baseType() != WidgetBase::wt_Region)) {
return;
}
if (!m_firstObject && type == WidgetBase::wt_Pin) {
- setWidget(getCurrentWidget());
+ setWidget(currentWidget());
return ;
}
@@ -143,7 +143,7 @@
}
if (!m_firstObject) {
- setWidget(getCurrentWidget());
+ setWidget(currentWidget());
}
}
--- branches/work/soc-umbrello/umbrello/widgets/widgetbase.cpp #1297450:1297451
@@ -854,6 +854,17 @@
}
/**
+ * Helper function for debug output.
+ * Returns the given enum value as string.
+ * @param wt WidgetType of which a string representation is wanted
+ * @return the WidgetType as string
+ */
+QString WidgetBase::toString(WidgetType wt)
+{
+ return QLatin1String(ENUM_NAME(WidgetBase, WidgetType, wt));
+}
+
+/**
* @return Whether the widget type has an associated UMLObject
*/
bool WidgetBase::widgetHasUMLObject(WidgetType type)
--- branches/work/soc-umbrello/umbrello/widgets/widgetbase.h #1297450:1297451
@@ -96,6 +96,8 @@
wt_Category // has UMLObject representation
};
+ static QString toString(WidgetType wt);
+
/**
* This enumeration is used by WidgetBase::attributeChange() to
* identify which attribute has changed.
More information about the umbrello-devel
mailing list