• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdesdk
  • Sitemap
  • Contact Us
 

umbrello/umbrello

UMLApp Class Reference

The base class for UML application windows. More...

#include <uml.h>

Inheritance diagram for UMLApp:

Inheritance graph
[legend]

List of all members.


Public Slots

bool activeLanguageIsCaseSensitive ()
QString activeLanguageScopeSeparator ()
QMenu * findMenu (const QString &name)
void generateAllCode ()
void generationWizard ()
Uml::Programming_Language getActiveLanguage ()
KConfig * getConfig ()
Uml::Programming_Language getDefaultLanguage ()
void initGenerator ()
void setActiveLanguage (Uml::Programming_Language pl)
void setupZoomMenu ()
void setZoom (int zoom)
void slotActivityDiagram ()
void slotAddDefaultDatatypes ()
void slotAlignBottom ()
void slotAlignHorizontalDistribute ()
void slotAlignHorizontalMiddle ()
void slotAlignLeft ()
void slotAlignRight ()
void slotAlignTop ()
void slotAlignVerticalDistribute ()
void slotAlignVerticalMiddle ()
void slotAllViewsExportImage ()
void slotApplyPrefs ()
void slotChangeTabLeft ()
void slotChangeTabRight ()
void slotClassDiagram ()
void slotClassWizard ()
void slotClipDataChanged ()
void slotCollaborationDiagram ()
void slotComponentDiagram ()
void slotCopyChanged ()
void slotCurrentViewChanged ()
void slotCurrentViewClearDiagram ()
void slotCurrentViewExportImage ()
void slotCurrentViewProperties ()
void slotCurrentViewToggleShowGrid ()
void slotCurrentViewToggleSnapToGrid ()
void slotDeleteDiagram (QWidget *tab=NULL)
void slotDeleteSelectedWidget ()
void slotDeploymentDiagram ()
void slotEditCopy ()
void slotEditCut ()
void slotEditPaste ()
void slotEditRedo ()
void slotEditUndo ()
void slotEntityRelationshipDiagram ()
void slotFileClose ()
void slotFileExportDocbook ()
void slotFileExportXhtml ()
void slotFileNew ()
void slotFileOpen ()
void slotFileOpenRecent (const KUrl &url)
void slotFilePrint ()
void slotFileQuit ()
void slotFileSave ()
bool slotFileSaveAs ()
void slotImportClasses ()
void slotImportProject ()
void slotMoveTabLeft ()
void slotMoveTabRight ()
void slotPrefs ()
void slotSelectAll ()
void slotSequenceDiagram ()
void slotSetZoom (QAction *action)
void slotShowGridToggled (bool gridOn)
void slotSnapToGridToggled (bool gridOn)
void slotStateDiagram ()
void slotStatusMsg (const QString &text)
void slotTabChanged (QWidget *tab)
void slotUpdateViews ()
void slotUseCaseDiagram ()
void slotXhtmlDocGenerationFinished (bool status)
void slotZoom100 ()
void slotZoomSliderMoved (int value)

Signals

void sigCutSuccessful ()

Public Member Functions

void BeginMacro (const QString &text)
void clearUndoStack ()
CodeGenerator * createGenerator ()
bool editCutCopy (bool bFromView)
void enablePrint (bool enable)
void enableRedo (bool enable)
void enableUndo (bool enable)
void EndMacro ()
void executeCommand (QUndoCommand *cmd)
CodeGenerationPolicy * getCommonPolicy ()
UMLView * getCurrentView ()
bool getCutCopyState ()
UMLDoc * getDocument () const
DocWindow * getDocWindow ()
CodeGenerator * getGenerator ()
QString const & getImageMimeType () const
UMLListView * getListView ()
QWidget * getMainViewWidget ()
bool getPasteState ()
CodeGenPolicyExt * getPolicyExt ()
bool getRedoEnabled ()
QString getStatusBarMsg ()
bool getUndoEnabled ()
WorkToolBar * getWorkToolBar ()
bool isSimpleCodeGeneratorActive ()
void newDocument ()
void openDocumentFile (const KUrl &url=KUrl())
void redo ()
void refactor (UMLClassifier *classifier)
void setCurrentView (UMLView *view)
void setDiagramMenuItemsState (bool bState)
CodeGenerator * setGenerator (Uml::Programming_Language pl)
void setGenerator (CodeGenerator *gen, bool giveWarning=true)
void setImageMimeType (QString const &mimeType)
void setModified (bool _m)
void setPolicyExt (CodeGenPolicyExt *policy)
KTabWidget * tabWidget ()
 UMLApp (QWidget *parent=0)
void undo ()
void viewCodeDocument (UMLClassifier *classifier)
 ~UMLApp ()

Static Public Member Functions

static UMLApp * app ()

Protected Member Functions

virtual void customEvent (QEvent *e)
void handleCursorKeyReleaseEvent (QKeyEvent *e)
void initActions ()
void initStatusBar ()
void initView ()
virtual void keyPressEvent (QKeyEvent *e)
virtual void keyReleaseEvent (QKeyEvent *e)
virtual bool queryClose ()
virtual bool queryExit ()
void readOptions ()
virtual void readProperties (const KConfigGroup &cfg)
void saveOptions ()
virtual void saveProperties (KConfigGroup &cfg)
void updateLangSelectMenu (Uml::Programming_Language activeLanguage)

Protected Attributes

CodeGenerationPolicy * m_commoncodegenpolicy

Detailed Description

The base class for UML application windows.

It sets up the main window and reads the config file as well as providing a menubar, toolbar and statusbar. A list of UMLView instances creates the center views, which are connected to the window's Doc object. The handling of views is realized with two different widgets:

  • stack widget
  • tab widget The current view handling is set as an option. UMLApp reimplements the methods that KMainWindow provides for main window handling and supports full session management as well as using KActions.

See also:
KMainWindow

KApplication

KConfig

Author:
Paul Hensgen <phensgen@techie.com> Bugs and comments to uml-devel@lists.sf.net or http://bugs.kde.org

Definition at line 79 of file uml.h.


Constructor & Destructor Documentation

UMLApp::UMLApp ( QWidget *  parent = 0  ) 

Constructor.

Calls all init functions to create the application.

Definition at line 111 of file uml.cpp.

UMLApp::~UMLApp (  ) 

Standard deconstructor.

Definition at line 172 of file uml.cpp.


Member Function Documentation

bool UMLApp::activeLanguageIsCaseSensitive (  )  [slot]

Return true if the active language is case sensitive.

Definition at line 1728 of file uml.cpp.

QString UMLApp::activeLanguageScopeSeparator (  )  [slot]

Return the target language depedent scope separator.

Definition at line 1737 of file uml.cpp.

UMLApp * UMLApp::app (  )  [static]

Get the last created instance of this class.

Definition at line 181 of file uml.cpp.

void UMLApp::BeginMacro ( const QString &  text  ) 

Begin a U/R command macro.

Definition at line 2267 of file uml.cpp.

void UMLApp::clearUndoStack (  ) 

Removes all entries from the UndoStack and RedoStack and disables the undo and redo actions.

Definition at line 2222 of file uml.cpp.

CodeGenerator* UMLApp::createGenerator (  ) 

Creates a new code generator for the given active language.

Returns:
Pointer to the CodeGenerator created.

void UMLApp::customEvent ( QEvent *  e  )  [protected, virtual]

Event handler to receive custom events.

It handles events such as exporting all views from command line (in that case, it executes the exportAllViews method in the event).

Definition at line 1976 of file uml.cpp.

bool UMLApp::editCutCopy ( bool  bFromView  ) 

Carries out the cut/copy command with different action performed depending on if from view or list view.

Cut/Copy are the same. It is up to the caller to delete/cut the selection..

If the operation is successful, the signal sigCutSuccessful() is emitted.

Callers should connect to this signal to know what to do next.

Definition at line 1407 of file uml.cpp.

void UMLApp::enablePrint ( bool  enable  ) 

Set whether to allow printing.

It will enable/disable the menu/toolbar options.

Parameters:
enable Set whether to allow printing.

Definition at line 1253 of file uml.cpp.

void UMLApp::enableRedo ( bool  enable  ) 

Set whether to allow printing.

It will enable/disable the menu/toolbar options.

Parameters:
enable Set whether to allow printing.

Definition at line 1263 of file uml.cpp.

void UMLApp::enableUndo ( bool  enable  ) 

Set whether to allow printing.

It will enable/disable the menu/toolbar options.

Parameters:
enable Set whether to allow printing.

Definition at line 1258 of file uml.cpp.

void UMLApp::EndMacro (  ) 

End an U/R command macro.

Definition at line 2277 of file uml.cpp.

void UMLApp::executeCommand ( QUndoCommand *  cmd  ) 

Execute a command and pushit in the stack.

Definition at line 2257 of file uml.cpp.

QMenu * UMLApp::findMenu ( const QString &  name  )  [slot]

Searches for a menu with the given name.

Parameters:
name The name of the menu to search for (name, not text)
Todo:
This is an ugly _HACK_ to allow to compile umbrello. All the menu stuff should be ported to KDE4 (using actions)

Definition at line 101 of file uml.cpp.

void UMLApp::generateAllCode (  )  [slot]

Generate code for all classes.

Definition at line 1609 of file uml.cpp.

void UMLApp::generationWizard (  )  [slot]

Runs the code generation wizard.

Definition at line 1616 of file uml.cpp.

Uml::Programming_Language UMLApp::getActiveLanguage (  )  [slot]

Get the language for import and code generation.

Definition at line 1723 of file uml.cpp.

CodeGenerationPolicy * UMLApp::getCommonPolicy (  ) 

Returns the default code generation policy.

Definition at line 1548 of file uml.cpp.

KConfig* UMLApp::getConfig (  )  [inline, slot]

Get the configuration data.

Definition at line 871 of file uml.h.

UMLView * UMLApp::getCurrentView (  ) 

Get the current view.

This may return a null pointer (when no view was previously specified.)

Definition at line 2094 of file uml.cpp.

bool UMLApp::getCutCopyState (  ) 

Returns the state on Cut/Copy.

Returns:
True if Cut/Copy is enabled.

Definition at line 1402 of file uml.cpp.

Uml::Programming_Language UMLApp::getDefaultLanguage (  )  [slot]

Return the default code generation language as configured by KConfig.

If the activeLanguage is not found in the KConfig then use Uml::pl_Cpp as the default.

Definition at line 1939 of file uml.cpp.

UMLDoc * UMLApp::getDocument (  )  const

Returns a pointer to the current document connected to the KMainWindow instance.

Used by the View class to access the document object's methods.

Definition at line 686 of file uml.cpp.

DocWindow* UMLApp::getDocWindow (  )  [inline]

Returns a pointer to the documentation window.

Returns:
Pointer to the DocWindow.

Definition at line 166 of file uml.h.

CodeGenerator * UMLApp::getGenerator (  ) 

Gets the appropriate CodeGenerator.

Returns:
Pointer to the CodeGenerator.

Definition at line 1594 of file uml.cpp.

QString const& UMLApp::getImageMimeType (  )  const [inline]

Gets the default mime type for all diagrams that are exported as images.

Returns:
The default MIME type for images.

Definition at line 296 of file uml.h.

UMLListView * UMLApp::getListView (  ) 

Returns a pointer to the list view.

Returns:
The listview being used.

Definition at line 691 of file uml.cpp.

QWidget * UMLApp::getMainViewWidget (  ) 

Returns the widget used as the parent for UMLViews.

Returns:
The main view widget.

Definition at line 2052 of file uml.cpp.

bool UMLApp::getPasteState (  ) 

Returns the paste state.

Returns:
True if Paste is enabled.

Definition at line 1397 of file uml.cpp.

CodeGenPolicyExt * UMLApp::getPolicyExt (  ) 

Returns the CodeGenPolicyExt object.

Definition at line 1558 of file uml.cpp.

bool UMLApp::getRedoEnabled (  ) 

Returns the redo state.

Returns:
True if Redo is enabled.

Definition at line 1392 of file uml.cpp.

QString UMLApp::getStatusBarMsg (  ) 

Returns the current text in the status bar.

Returns:
The text in the status bar.

Definition at line 2217 of file uml.cpp.

bool UMLApp::getUndoEnabled (  ) 

Returns the undo state.

Returns:
True if Undo is enabled.

Definition at line 1387 of file uml.cpp.

WorkToolBar * UMLApp::getWorkToolBar (  ) 

Returns the toolbar being used.

Returns:
The toolbar being used.

Definition at line 1232 of file uml.cpp.

void UMLApp::handleCursorKeyReleaseEvent ( QKeyEvent *  e  )  [protected]

Helper method for handling cursor key release events (refactoring).

Definition at line 1985 of file uml.cpp.

void UMLApp::initActions (  )  [protected]

Initializes the KActions and the status bar of the application and calls setupGUI().

Definition at line 193 of file uml.cpp.

void UMLApp::initGenerator (  )  [slot]

Reads the activeLanguage from the KConfig and calls updateLangSelectMenu().

Definition at line 1945 of file uml.cpp.

void UMLApp::initStatusBar (  )  [protected]

Sets up the statusbar for the main window by initialzing a statuslabel.

Definition at line 582 of file uml.cpp.

void UMLApp::initView (  )  [protected]

Creates the centerwidget of the KMainWindow instance and sets it as the view.

Definition at line 588 of file uml.cpp.

bool UMLApp::isSimpleCodeGeneratorActive (  ) 

Determines if SimpleCodeGenerator is active.

Returns:
true if SimpleCodeGenerator is active.

Definition at line 1599 of file uml.cpp.

void UMLApp::keyPressEvent ( QKeyEvent *  e  )  [protected, virtual]

Definition at line 1963 of file uml.cpp.

void UMLApp::keyReleaseEvent ( QKeyEvent *  e  )  [protected, virtual]

Definition at line 2022 of file uml.cpp.

void UMLApp::newDocument (  ) 

Calls the UMLDoc method to create a new Document.

Definition at line 2046 of file uml.cpp.

void UMLApp::openDocumentFile ( const KUrl &  url = KUrl()  ) 

Opens a file specified by commandline option.

Definition at line 675 of file uml.cpp.

bool UMLApp::queryClose (  )  [protected, virtual]

queryClose is called by KMainWindow on each closeEvent of a window.

Counter to the default implementation (which only returns true), this calls saveModified() on the document object to ask if the document shall be saved if Modified; on cancel the closeEvent is rejected.

See also:
KMainWindow::queryClose

KMainWindow::closeEvent

Returns:
True if window may be closed.

Definition at line 869 of file uml.cpp.

bool UMLApp::queryExit (  )  [protected, virtual]

queryExit is called by KMainWindow when the last window of the application is going to be closed during the closeEvent().

In contrast to the default implementation that just returns true, this calls saveOptions() to save the settings of the last window's properties.

See also:
KMainWindow::queryExit

KMainWindow::closeEvent

Returns:
True if window may be closed.

Definition at line 874 of file uml.cpp.

void UMLApp::readOptions (  )  [protected]

Read general Options again and initialize all variables like the recent file list.

Definition at line 803 of file uml.cpp.

void UMLApp::readProperties ( const KConfigGroup &  cfg  )  [protected, virtual]

Reads the session config file and restores the application's state including the last opened files and documents by reading the temporary files saved by saveProperties().

See also:
KMainWindow::readProperties

Definition at line 834 of file uml.cpp.

void UMLApp::redo (  ) 

Redo last 'undoed' command.

Definition at line 2242 of file uml.cpp.

void UMLApp::refactor ( UMLClassifier *  classifier  ) 

Call the refactoring assistant on a classifier.

Parameters:
classifier Pointer to the classifier to refactor.

Definition at line 1539 of file uml.cpp.

void UMLApp::saveOptions (  )  [protected]

Save general Options like all bar positions and status as well as the geometry and the recent file list to the configuration file.

Definition at line 696 of file uml.cpp.

void UMLApp::saveProperties ( KConfigGroup &  cfg  )  [protected, virtual]

Saves the window properties for each open window during session end to the session config file, including saving the currently opened file by a temporary filename provided by KApplication.

See also:
KMainWindow::saveProperties

Definition at line 814 of file uml.cpp.

void UMLApp::setActiveLanguage ( Uml::Programming_Language  pl  )  [slot]

Set the language for which code will be generated.

Parameters:
pl The name of the language to set

Definition at line 1717 of file uml.cpp.

void UMLApp::setCurrentView ( UMLView *  view  ) 

Puts this view to the top of the viewStack, i.e.

makes it visible to the user.

Parameters:
view Pointer to the UMLView to push.

Definition at line 2063 of file uml.cpp.

void UMLApp::setDiagramMenuItemsState ( bool  bState  ) 

Sets the state of the view properties menu item.

Parameters:
bState Boolean, true to enable the view properties item.

Definition at line 1782 of file uml.cpp.

CodeGenerator * UMLApp::setGenerator ( Uml::Programming_Language  pl  ) 

Auxiliary function for UMLDoc::loadExtensionsFromXMI(): Return the code generator of the given language if it already exists; if it does not yet exist then create it and return the newly created generator.

It is the caller's responsibility to load XMI into the newly created generator.

Definition at line 1563 of file uml.cpp.

void UMLApp::setGenerator ( CodeGenerator *  gen,
bool  giveWarning = true 
)

Set the current generator for this app.

If giveWarning is true, then a popup box warning that the code generation library is out-of-date will show if you attempt to set the generator to NULL.

Parameters:
gen Pointer to the CodeGenerator to set.
giveWarning True to enable out-of-date warning.

void UMLApp::setImageMimeType ( QString const &  mimeType  )  [inline]

Sets the default mime type for all diagrams that are exported as images.

Parameters:
mimeType The MIME type to set as the default.

Definition at line 288 of file uml.h.

void UMLApp::setModified ( bool  _m  ) 

Sets whether the program has been modified.

This will change how the program saves/exits.

Parameters:
_m true - modified.

Definition at line 1237 of file uml.cpp.

void UMLApp::setPolicyExt ( CodeGenPolicyExt *  policy  ) 

Sets the CodeGenPolicyExt object.

Definition at line 1553 of file uml.cpp.

void UMLApp::setupZoomMenu (  )  [slot]

Prepares the zoom menu for display.

Definition at line 551 of file uml.cpp.

void UMLApp::setZoom ( int  zoom  )  [slot]

Set the zoom factor of the current diagram.

Parameters:
zoom Zoom factor in percentage.

Definition at line 525 of file uml.cpp.

void UMLApp::sigCutSuccessful (  )  [signal]

Emitted when a cut operation is successful.

void UMLApp::slotActivityDiagram (  )  [slot]

Create this view.

Definition at line 1172 of file uml.cpp.

void UMLApp::slotAddDefaultDatatypes (  )  [slot]

Calls the active code generator to add its default datatypes.

Definition at line 1884 of file uml.cpp.

void UMLApp::slotAlignBottom (  )  [slot]

Bottom Alignment.

Definition at line 1207 of file uml.cpp.

void UMLApp::slotAlignHorizontalDistribute (  )  [slot]

Horizontal Distribute Alignment.

Definition at line 1227 of file uml.cpp.

void UMLApp::slotAlignHorizontalMiddle (  )  [slot]

Horizontal Middle Alignment.

Definition at line 1217 of file uml.cpp.

void UMLApp::slotAlignLeft (  )  [slot]

Left Alignment.

Definition at line 1192 of file uml.cpp.

void UMLApp::slotAlignRight (  )  [slot]

Right Alignment.

Definition at line 1197 of file uml.cpp.

void UMLApp::slotAlignTop (  )  [slot]

Top Alignment.

Definition at line 1202 of file uml.cpp.

void UMLApp::slotAlignVerticalDistribute (  )  [slot]

Vertical Distribute Alignment.

Definition at line 1222 of file uml.cpp.

void UMLApp::slotAlignVerticalMiddle (  )  [slot]

Vertical Middle Alignment.

Definition at line 1212 of file uml.cpp.

void UMLApp::slotAllViewsExportImage (  )  [slot]

Menu selection for exporting all views as images.

Definition at line 1772 of file uml.cpp.

void UMLApp::slotApplyPrefs (  )  [slot]

Commits the changes from the global preferences dialog.

Definition at line 1338 of file uml.cpp.

void UMLApp::slotChangeTabLeft (  )  [slot]

Make the tab on the left of the current one the active one.

Definition at line 2107 of file uml.cpp.

void UMLApp::slotChangeTabRight (  )  [slot]

Make the tab on the right of the current one the active one.

Definition at line 2134 of file uml.cpp.

void UMLApp::slotClassDiagram (  )  [slot]

Create this view.

Definition at line 1147 of file uml.cpp.

void UMLApp::slotClassWizard (  )  [slot]

Class wizard menu selection.

Definition at line 1878 of file uml.cpp.

void UMLApp::slotClipDataChanged (  )  [slot]

Notification of changed clipboard data.

Definition at line 1303 of file uml.cpp.

void UMLApp::slotCollaborationDiagram (  )  [slot]

Create this view.

Definition at line 1157 of file uml.cpp.

void UMLApp::slotComponentDiagram (  )  [slot]

Create this view.

Definition at line 1177 of file uml.cpp.

void UMLApp::slotCopyChanged (  )  [slot]

Slot for enabling cut and copy to clipboard.

Definition at line 1311 of file uml.cpp.

void UMLApp::slotCurrentViewChanged (  )  [slot]

The displayed diagram has changed.

Definition at line 1889 of file uml.cpp.

void UMLApp::slotCurrentViewClearDiagram (  )  [slot]

Menu selection for clear current view.

Definition at line 1750 of file uml.cpp.

void UMLApp::slotCurrentViewExportImage (  )  [slot]

Menu selection for exporting current view as an image.

Definition at line 1767 of file uml.cpp.

void UMLApp::slotCurrentViewProperties (  )  [slot]

Menu selection for current view properties.

Definition at line 1777 of file uml.cpp.

void UMLApp::slotCurrentViewToggleShowGrid (  )  [slot]

Menu selection for current view show grid property.

Definition at line 1761 of file uml.cpp.

void UMLApp::slotCurrentViewToggleSnapToGrid (  )  [slot]

Menu selection for current view snap to grid property.

Definition at line 1755 of file uml.cpp.

void UMLApp::slotDeleteDiagram ( QWidget *  tab = NULL  )  [slot]

Deletes the current diagram.

Parameters:
tab Widget's tab to close

Definition at line 1925 of file uml.cpp.

void UMLApp::slotDeleteSelectedWidget (  )  [slot]

Deletes the selected widget.

Definition at line 1915 of file uml.cpp.

void UMLApp::slotDeploymentDiagram (  )  [slot]

Create this view.

Definition at line 1182 of file uml.cpp.

void UMLApp::slotEditCopy (  )  [slot]

Put the marked text/object into the clipboard.

Definition at line 1110 of file uml.cpp.

void UMLApp::slotEditCut (  )  [slot]

Put the marked text/object into the clipboard and remove it from the document.

Definition at line 1096 of file uml.cpp.

void UMLApp::slotEditPaste (  )  [slot]

Paste the clipboard into the document.

Definition at line 1119 of file uml.cpp.

void UMLApp::slotEditRedo (  )  [slot]

Reverts the document back to the state it was prior to the last undo.

Definition at line 1090 of file uml.cpp.

void UMLApp::slotEditUndo (  )  [slot]

Reverts the document back to the state it was prior to the last action performed by the user.

Definition at line 1084 of file uml.cpp.

void UMLApp::slotEntityRelationshipDiagram (  )  [slot]

Create this view.

Definition at line 1187 of file uml.cpp.

void UMLApp::slotFileClose (  )  [slot]

Asks for saving if the file is modified, then closes the current file and window.

Definition at line 1032 of file uml.cpp.

void UMLApp::slotFileExportDocbook (  )  [slot]

Exports the current model to docbook in a subdir of the current model directory named from the model name.

Todo:
Let the user chose the destination directory and name, using network transparency.

Definition at line 1067 of file uml.cpp.

void UMLApp::slotFileExportXhtml (  )  [slot]

Exports the current model to XHTML in a subdir of the current model directory named from the model name.

Todo:
Let the user chose the destination directory and name, using network transparency.

Definition at line 1074 of file uml.cpp.