Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SDK
Umbrello
Commits
5bb6510e
Commit
5bb6510e
authored
Nov 26, 2019
by
Ralf Habacker
Browse files
Add context menu entry to classifier widgets for selecting a state diagram
CCBUG:413579
parent
caee1633
Changes
9
Hide whitespace changes
Inline
Side-by-side
umbrello/CMakeLists.txt
View file @
5bb6510e
...
...
@@ -205,6 +205,7 @@ set(libdialogs_SRCS
dialogs/objectnodedialog.cpp
dialogs/overwritedialog.cpp
dialogs/parameterpropertiesdialog.cpp
dialogs/selectdiagramdialog.cpp
dialogs/selectoperationdialog.cpp
dialogs/settingsdialog.cpp
dialogs/singlepagedialogbase.cpp
...
...
umbrello/dialogs/selectdiagramdialog.cpp
0 → 100644
View file @
5bb6510e
/***************************************************************************
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* copyright (C) 2019 *
* Umbrello UML Modeller Authors <umbrello-devel@kde.org> *
***************************************************************************/
// own header
#include
"selectdiagramdialog.h"
// app includes
#include
"selectdiagramwidget.h"
// kde includes
#include
<KLocalizedString>
SelectDiagramDialog
::
SelectDiagramDialog
(
QWidget
*
parent
,
Uml
::
DiagramType
::
Enum
type
,
const
QString
&
currentName
,
const
QString
excludeName
)
:
SinglePageDialogBase
(
parent
)
{
setCaption
(
i18n
(
"Select diagram"
));
m_widget
=
new
SelectDiagramWidget
(
i18n
(
"Diagram"
),
this
);
m_widget
->
setupWidget
(
type
,
currentName
,
excludeName
,
false
);
setMainWidget
(
m_widget
);
}
SelectDiagramDialog
::~
SelectDiagramDialog
()
{
}
Uml
::
ID
::
Type
SelectDiagramDialog
::
currentID
()
{
return
m_widget
->
currentID
();
}
umbrello/dialogs/selectdiagramdialog.h
0 → 100644
View file @
5bb6510e
/***************************************************************************
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* copyright (C) 2019 *
* Umbrello UML Modeller Authors <umbrello-devel@kde.org> *
***************************************************************************/
#ifndef SELECTDIAGRAMDIALOG_H
#define SELECTDIAGRAMDIALOG_H
//app includes
#include
"singlepagedialogbase.h"
#include
"basictypes.h"
class
SelectDiagramWidget
;
/**
* Provides dialog to select a diagram
*
* @author Ralf Habacker <ralf.habacker@freenet.de>
*/
class
SelectDiagramDialog
:
public
SinglePageDialogBase
{
Q_OBJECT
public:
SelectDiagramDialog
(
QWidget
*
parent
,
Uml
::
DiagramType
::
Enum
type
,
const
QString
&
currentName
,
const
QString
excludeName
);
~
SelectDiagramDialog
();
Uml
::
ID
::
Type
currentID
();
protected:
SelectDiagramWidget
*
m_widget
;
};
#endif
umbrello/menus/listpopupmenu.cpp
View file @
5bb6510e
...
...
@@ -250,6 +250,7 @@ void ListPopupMenu::insert(const MenuType m, KMenu* menu)
case
mt_ReturnToClass
:
m_actions
[
m
]
=
menu
->
addAction
(
Icon_Utils
::
SmallIcon
(
Icon_Utils
::
it_Redo
),
i18n
(
"Return to class"
));
break
;
case
mt_Reset_Label_Positions
:
m_actions
[
m
]
=
menu
->
addAction
(
i18n
(
"Reset Label Positions"
));
break
;
case
mt_Resize
:
insert
(
m
,
menu
,
i18n
(
"Resize"
));
break
;
case
mt_SelectStateDiagram
:
m_actions
[
m
]
=
menu
->
addAction
(
Icon_Utils
::
SmallIcon
(
Icon_Utils
::
it_Remove
),
i18n
(
"Select state diagram"
));
break
;
case
mt_Send_Signal
:
m_actions
[
m
]
=
menu
->
addAction
(
Icon_Utils
::
SmallIcon
(
Icon_Utils
::
it_Send_Signal
),
i18n
(
"Send Signal"
));
break
;
case
mt_ShallowHistory
:
m_actions
[
m
]
=
menu
->
addAction
(
Icon_Utils
::
SmallIcon
(
Icon_Utils
::
it_History_Shallow
),
i18n
(
"Shallow History"
));
break
;
case
mt_Show
:
m_actions
[
m
]
=
menu
->
addAction
(
Icon_Utils
::
SmallIcon
(
Icon_Utils
::
it_Show
),
i18n
(
"Show"
));
break
;
...
...
umbrello/menus/listpopupmenu.h
View file @
5bb6510e
...
...
@@ -116,6 +116,7 @@ public:
mt_PrePostCondition
,
mt_PrimaryKeyConstraint
,
mt_Region
,
mt_SelectStateDiagram
,
mt_Send_Signal
,
mt_ShallowHistory
,
mt_State
,
...
...
umbrello/menus/widgetbasepopupmenu.cpp
View file @
5bb6510e
...
...
@@ -26,6 +26,7 @@
#include
"pinportbase.h"
#include
"statewidget.h"
#include
"uml.h"
#include
"umldoc.h"
#include
"umllistview.h"
#include
"umlscene.h"
...
...
@@ -190,11 +191,13 @@ void WidgetBasePopupMenu::insertSingleSelectionMenu(WidgetBase* widget)
insertSubMenuNew
(
type
);
makeClassifierShowPopup
(
c
);
insertSubMenuColor
(
c
->
useFillColor
());
if
(
c
->
linkedDiagram
())
{
addSeparator
()
;
addSeparator
();
if
(
c
->
linkedDiagram
()
)
insert
(
mt_GoToStateDiagram
);
if
(
UMLApp
::
app
()
->
document
()
->
views
(
Uml
::
DiagramType
::
State
).
size
()
>
0
)
insert
(
mt_SelectStateDiagram
);
if
(
c
->
linkedDiagram
())
insert
(
mt_RemoveStateDiagram
);
}
insertStdItems
(
true
,
type
);
insert
(
mt_Rename
);
insert
(
mt_Change_Font
);
...
...
umbrello/umldoc.cpp
View file @
5bb6510e
...
...
@@ -3071,6 +3071,22 @@ UMLViewList UMLDoc::viewIterator()
return
accumulator
;
}
/**
* Return a list of filtered views of this document by type.
* @param type diagram type to filter
* @return List of UML views.
*/
UMLViewList
UMLDoc
::
views
(
Uml
::
DiagramType
::
Enum
type
)
{
UMLViewList
result
;
foreach
(
UMLView
*
v
,
viewIterator
())
{
if
(
type
==
Uml
::
DiagramType
::
Undefined
||
v
->
umlScene
()
->
type
()
==
type
)
result
.
append
(
v
);
}
return
result
;
}
/**
* Sets the modified flag for the document after a modifying
* action on the view connected to the document.
...
...
umbrello/umldoc.h
View file @
5bb6510e
...
...
@@ -201,6 +201,7 @@ public:
void
print
(
QPrinter
*
pPrinter
,
DiagramPrintPage
*
selectPage
);
UMLViewList
viewIterator
();
UMLViewList
views
(
Uml
::
DiagramType
::
Enum
type
=
Uml
::
DiagramType
::
Undefined
);
bool
assignNewIDs
(
UMLObject
*
obj
);
...
...
umbrello/umlwidgets/diagramproxywidget.cpp
View file @
5bb6510e
...
...
@@ -22,6 +22,7 @@
#include
"umlscene.h"
#include
"umlview.h"
#include
"umlwidget.h"
#include
"selectdiagramdialog.h"
DEBUG_REGISTER_DISABLED
(
DiagramProxyWidget
)
...
...
@@ -384,6 +385,15 @@ void DiagramProxyWidget::slotMenuSelection(QAction* action)
}
break
;
case
ListPopupMenu
::
mt_SelectStateDiagram
:
{
SelectDiagramDialog
dlg
(
nullptr
,
Uml
::
DiagramType
::
State
,
linkedDiagram
()
?
linkedDiagram
()
->
name
()
:
QString
(),
QString
());
if
(
dlg
.
exec
())
{
setDiagramLink
(
dlg
.
currentID
());
}
break
;
}
// classifier widget
case
ListPopupMenu
::
mt_GoToStateDiagram
:
// state widget
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment