[Uml-devel] KDE/kdesdk/umbrello/umbrello
Oliver Kellogg
okellogg at users.sourceforge.net
Sat Sep 23 07:41:43 UTC 2006
SVN commit 587568 by okellogg:
sync with branches/KDE/3.5 up to commit 587279
M +2 -2 codegenerators/cppwriter.cpp
M +5 -6 folder.cpp
M +6 -6 folder.h
M +6 -0 listpopupmenu.cpp
M +1 -0 uml.cpp
M +30 -40 umldoc.cpp
M +0 -12 umldoc.h
M +2 -3 umllistview.cpp
M +0 -7 umllistview.h
M +9 -15 umlobject.cpp
M +7 -2 umlobject.h
--- trunk/KDE/kdesdk/umbrello/umbrello/codegenerators/cppwriter.cpp #587567:587568
@@ -227,7 +227,7 @@
// Q: Why all utils? Isnt just List and Vector the only classes we are using?
// Our import *should* also look at operations, and check that objects being
// used arent in another package (and thus need to be explicitly imported here).
- cpp << "#include \"" << (m_classifierInfo->className).lower() << ".h\"" << m_endl;
+ cpp << "#include \"" << m_classifierInfo->className << ".h\"" << m_endl;
writeBlankLine(cpp);
if (c->getVisibility() == Uml::Visibility::Implementation) {
@@ -1231,7 +1231,7 @@
if( !isFirstClass && !a->getRoleName(Uml::A).isEmpty() && !a->getRoleName(Uml::B).isEmpty())
stream << "class " << current->getName() << ";" << m_endl; // special case: use forward declaration
else
- stream << "#include \"" << current->getName().lower() << ".h\"" << m_endl; // just the include statement
+ stream << "#include \"" << current->getName() << ".h\"" << m_endl; // just the include statement
}
}
--- trunk/KDE/kdesdk/umbrello/umbrello/folder.cpp #587567:587568
@@ -35,7 +35,6 @@
void UMLFolder::init() {
m_BaseType = Uml::ot_Folder;
- m_bPredefined = false;
m_diagrams.setAutoDelete(true);
UMLObject::setStereotype("folder");
}
@@ -46,12 +45,12 @@
return clone;
}
-void UMLFolder::markPredefined() {
- m_bPredefined = true;
+void UMLFolder::setLocalName(QString localName) {
+ m_localName = localName;
}
-bool UMLFolder::isPredefined() {
- return m_bPredefined;
+QString UMLFolder::getLocalName() {
+ return m_localName;
}
void UMLFolder::addView(UMLView *view) {
@@ -370,7 +369,7 @@
UMLFolder *logicalView = umldoc->getRootFolder(Uml::mt_Logical);
if (this == logicalView && Uml::tagEq(type, "Package")) {
QString thisName = tempElement.attribute("name", "");
- if (thisName == umldoc->datatypeFolderName()) {
+ if (thisName == "Datatypes") {
UMLFolder *datatypeFolder = umldoc->getDatatypeFolder();
if (!datatypeFolder->loadFromXMI(tempElement))
totalSuccess = false;
--- trunk/KDE/kdesdk/umbrello/umbrello/folder.h #587567:587568
@@ -59,18 +59,18 @@
virtual UMLObject* clone() const;
/**
- * Mark this folder as being for Umbrello special use.
+ * Set the localized name of this folder.
* This is set for the predefined root views (Logical,
* UseCase, Component, Deployment, EntityRelationship,
* and the Datatypes folder inside the Logical View.)
*/
- void markPredefined();
+ void setLocalName(QString localName);
/**
- * Return whther this folder is one of the Umbrello special
- * folders.
+ * Return the localized name of this folder.
+ * Only useful for the predefined root folders.
*/
- bool isPredefined();
+ QString getLocalName();
/**
* Add a view to the diagram list.
@@ -184,7 +184,7 @@
bool load(QDomElement & element);
private:
- bool m_bPredefined;
+ QString m_localName; ///< i18n name, only used for predefined root folders
/**
* If m_folderFile is not empty then it contains a file name to which
* this folder is saved.
--- trunk/KDE/kdesdk/umbrello/umbrello/listpopupmenu.cpp #587567:587568
@@ -772,6 +772,12 @@
case mt_Activity_Diagram:
type = Uml::dt_Activity;
break;
+ case mt_Component_Diagram:
+ type = Uml::dt_Component;
+ break;
+ case mt_Deployment_Diagram:
+ type = Uml::dt_Deployment;
+ break;
case mt_EntityRelationship_Diagram:
type = Uml::dt_EntityRelationship;
break;
--- trunk/KDE/kdesdk/umbrello/umbrello/uml.cpp #587567:587568
@@ -1662,6 +1662,7 @@
if (m_viewStack == NULL)
return;
m_viewStack->setCurrentWidget(view);
+ kapp->processEvents();
if (view) {
slotStatusMsg(view->getName());
}
--- trunk/KDE/kdesdk/umbrello/umbrello/umldoc.cpp #587567:587568
@@ -84,7 +84,6 @@
UMLDoc::UMLDoc() {
m_Name = i18n("UML Model");
m_modelID = "m1";
- m_datatypeFolderName = i18n("Datatypes");
m_count = 0;
m_pChangeLog = 0;
m_Doc = "";
@@ -99,7 +98,14 @@
void UMLDoc::init() {
// Initialize predefined folders.
- const QString predefinedName[Uml::N_MODELTYPES] = {
+ const QString nativeRootName[Uml::N_MODELTYPES] = {
+ "Logical View",
+ "Use Case View",
+ "Component View",
+ "Deployment View",
+ "Entity Relationship Model"
+ };
+ const QString localizedRootName[Uml::N_MODELTYPES] = {
i18n("Logical View"),
i18n("Use Case View"),
i18n("Component View"),
@@ -107,11 +113,11 @@
i18n("Entity Relationship Model")
};
for (int i = 0; i < Uml::N_MODELTYPES; i++) {
- m_root[i] = new UMLFolder(predefinedName[i]);
- m_root[i]->markPredefined();
+ m_root[i] = new UMLFolder(nativeRootName[i]);
+ m_root[i]->setLocalName(localizedRootName[i]);
}
- m_datatypeRoot = new UMLFolder(m_datatypeFolderName);
- m_datatypeRoot->markPredefined();
+ m_datatypeRoot = new UMLFolder("Datatypes");
+ m_datatypeRoot->setLocalName(i18n("Datatypes"));
m_datatypeRoot->setUMLPackage(m_root[Uml::mt_Logical]);
m_root[Uml::mt_Logical]->addObject(m_datatypeRoot);
@@ -291,8 +297,8 @@
for (int i = 0; i < Uml::N_MODELTYPES; i++)
m_root[i]->removeAllObjects();
// Restore the datatype folder, it has been deleted above.
- m_datatypeRoot = new UMLFolder(m_datatypeFolderName);
- m_datatypeRoot->markPredefined();
+ m_datatypeRoot = new UMLFolder("Datatypes");
+ m_datatypeRoot->setLocalName(i18n("Datatypes"));
m_datatypeRoot->setUMLPackage(m_root[Uml::mt_Logical]);
m_root[Uml::mt_Logical]->addObject(m_datatypeRoot);
listView->theDatatypeFolder()->setUMLObject(m_datatypeRoot);
@@ -1044,10 +1050,10 @@
temp->setType( type );
temp->setID( UniqueID::gen() );
addView(temp);
- emit sigDiagramCreated( UniqueID::get() );
+ emit sigDiagramCreated( temp->getID() );
setModified(true, false);
UMLApp::app()->enablePrint(true);
- changeCurrentView( UniqueID::get() );
+ changeCurrentView( temp->getID() );
break;
} else {
KMessageBox::error(0, i18n("A diagram is already using that name."), i18n("Not a Unique Name"));
@@ -1133,7 +1139,7 @@
void UMLDoc::changeCurrentView(Uml::IDType id) {
UMLApp* pApp = UMLApp::app();
UMLView* w = findView(id);
- if (w != pApp->getCurrentView() && w) {
+ if (w) {
pApp->setCurrentView(w);
emit sigDiagramChanged(w->getType());
pApp->setDiagramMenuItemsState( true );
@@ -1168,7 +1174,7 @@
if (currentView == NULL) {
if (m_pCurrentRoot)
return m_pCurrentRoot;
- kError() << "UMLDoc::currentRoot: currentView is NULL, assuming Logical View"
+ kDebug() << "UMLDoc::currentRoot: currentView is NULL, assuming Logical View"
<< endl;
return m_root[Uml::mt_Logical];
}
@@ -1712,13 +1718,6 @@
emit sigWriteToStatusBar( i18n("Loading UML elements...") );
bool bNativityIsDetermined = false;
- const QString nativeRootName[Uml::N_MODELTYPES] = {
- "Logical View",
- "Use Case View",
- "Component View",
- "Deployment View",
- "Entity Relationship Model"
- };
for (QDomNode node = element.firstChild(); !node.isNull();
node = node.nextSibling()) {
if (node.isComment())
@@ -1729,8 +1728,7 @@
bool foundUmbrelloRootFolder = false;
QString name = tempElement.attribute("name");
for (int i = 0; i < Uml::N_MODELTYPES; i++) {
- if (name == m_root[i]->getName() ||
- name == nativeRootName[i]) { // @todo checking for name creates i18n problem
+ if (name == m_root[i]->getName()) {
m_pCurrentRoot = m_root[i];
m_root[i]->loadFromXMI(tempElement);
foundUmbrelloRootFolder = true;
@@ -1781,35 +1779,27 @@
QString xmiId = tempElement.attribute("xmi.id", "");
bNativityIsDetermined = determineNativity(xmiId);
}
+ Uml::Object_Type ot = pObject->getBaseType();
+ // Set the parent root folder.
+ UMLPackage *pkg = NULL;
+ if (ot == Uml::ot_Datatype) {
+ pkg = m_datatypeRoot;
+ } else {
+ Uml::Model_Type guess = Model_Utils::guessContainer(pObject);
+ pkg = m_root[guess];
+ }
+ pObject->setUMLPackage(pkg);
+
bool status = pObject -> loadFromXMI( tempElement );
if ( !status ) {
delete pObject;
return false;
}
- Uml::Object_Type ot = pObject->getBaseType();
if (ot == ot_Stereotype) {
UMLStereotype *s = static_cast<UMLStereotype*>(pObject);
addStereotype(s);
continue;
}
- UMLPackage *pkg = pObject->getUMLPackage();
- if (pkg == NULL) {
- if (ot == Uml::ot_Datatype) {
- pkg = m_datatypeRoot;
- } else {
- Uml::Model_Type guess = Model_Utils::guessContainer(pObject);
- pkg = m_root[guess];
- /* Associations:
- "Association"
- "AssociationClass"
- "Generalization"
- "Realization"
- "Abstraction"
- "Dependency"
- */
- }
- pObject->setUMLPackage(pkg);
- }
pkg->addObject(pObject);
/* FIXME see comment at loadUMLObjectsFromXMI
--- trunk/KDE/kdesdk/umbrello/umbrello/umldoc.h #587567:587568
@@ -513,13 +513,6 @@
}
/**
- * Return the name of the predefined Datatypes folder in the Logical View.
- */
- QString datatypeFolderName() const {
- return m_datatypeFolderName;
- }
-
- /**
* Returns a list of the concepts in this UMLDoc.
*
* @param includeNested Whether to include the concepts from
@@ -814,11 +807,6 @@
UMLFolder *m_datatypeRoot;
/**
- * Name of the predefined Datatypes folder in the Logical View
- */
- QString m_datatypeFolderName;
-
- /**
* The UMLDoc is the sole owner of all stereotypes.
* UMLStereotype instances are reference counted.
* When an UMLStereotype is no longer referenced anywhere,
--- trunk/KDE/kdesdk/umbrello/umbrello/umllistview.cpp #587567:587568
@@ -216,7 +216,6 @@
// Switch to diagram on mouse release - not on mouse press
// because the user might intend a drag-to-note.
m_doc->changeCurrentView( item->getID() );
- emit diagramSelected( item->getID() );
UMLApp::app()->getDocWindow()->showDocumentation(m_doc->findView(item->getID()), false);
this->K3ListView::contentsMouseReleaseEvent(me);
}
@@ -1014,14 +1013,14 @@
Uml::Model_Type mt = (Uml::Model_Type)i;
UMLFolder *sysFolder = m_doc->getRootFolder(mt);
Uml::ListView_Type lvt = Model_Utils::convert_MT_LVT(mt);
- m_lv[i] = new UMLListViewItem(m_rv, sysFolder->getName(), lvt, sysFolder);
+ m_lv[i] = new UMLListViewItem(m_rv, sysFolder->getLocalName(), lvt, sysFolder);
}
} else {
for (int i = 0; i < Uml::N_MODELTYPES; i++)
deleteChildrenOf(m_lv[i]);
}
UMLFolder *datatypeFolder = m_doc->getDatatypeFolder();
- m_datatypeFolder = new UMLListViewItem(m_lv[Uml::mt_Logical], datatypeFolder->getName(),
+ m_datatypeFolder = new UMLListViewItem(m_lv[Uml::mt_Logical], datatypeFolder->getLocalName(),
Uml::lvt_Datatype_Folder, datatypeFolder);
m_rv->setOpen(true);
for (int i = 0; i < Uml::N_MODELTYPES; i++)
--- trunk/KDE/kdesdk/umbrello/umbrello/umllistview.h #587567:587568
@@ -467,13 +467,6 @@
*/
void slotCutSuccessful();
-signals:
-
- /**
- * change the current view
- */
- void diagramSelected(Uml::IDType);
-
private:
/**
* Searches the tree for a diagram (view).
--- trunk/KDE/kdesdk/umbrello/umbrello/umlobject.cpp #587567:587568
@@ -343,29 +343,23 @@
return name;
}
-QString UMLObject::getPackage(QString separator) {
- if (m_pUMLPackage == NULL)
+QString UMLObject::getPackage(QString separator, bool includeRoot) {
+ QString fqn = getFullyQualifiedName(separator, includeRoot);
+ if (!fqn.contains(separator))
return "";
- UMLPackageList pkgList;
- QStringList pkgNames;
- UMLPackage* pkg = m_pUMLPackage;
- do {
- pkgList.prepend(pkg);
- pkgNames.prepend(pkg->getName());
- pkg = pkg->getUMLPackage();
- } while (pkg != NULL && !pkgList.containsRef(pkg));
- if (separator.isEmpty())
- separator = UMLApp::app()->activeLanguageScopeSeparator();
- return pkgNames.join(separator);
+ QString scope = fqn.left(fqn.length() - separator.length() - m_Name.length());
+ return scope;
}
-UMLPackageList UMLObject::getPackages() const {
+UMLPackageList UMLObject::getPackages(bool includeRoot) const {
UMLPackageList pkgList;
UMLPackage* pkg = m_pUMLPackage;
while (pkg != NULL) {
pkgList.prepend(pkg);
pkg = pkg->getUMLPackage();
}
+ if (!includeRoot)
+ pkgList.removeFirst();
return pkgList;
}
@@ -755,7 +749,7 @@
} else if (m_pUMLPackage) {
m_pUMLPackage->addObject(this);
} else if (umldoc->rootFolderType(this) == Uml::N_MODELTYPES) {
- kError() << "UMLObject::loadFromXMI(" << m_Name << "): m_pUMLPackage is not set"
+ kDebug() << "UMLObject::loadFromXMI(" << m_Name << "): m_pUMLPackage is not set"
<< endl;
}
}
--- trunk/KDE/kdesdk/umbrello/umbrello/umlobject.h #587567:587568
@@ -192,17 +192,22 @@
* individual package prefixes (optional.)
* If no separator is given then the separator
* of the currently selected language is used.
+ * @param includeRoot Whether to prefix the root folder name.
+ * Default: false.
* @return The UMLObject's enclosing package(s) as a text.
*/
- QString getPackage(QString separator = QString::null);
+ QString getPackage(QString separator = QString::null,
+ bool includeRoot = false);
/**
* Return a list of the packages in which this class is embedded.
* The outermost package is first in the list.
*
+ * @param includeRoot Whether to prefix the root folder name.
+ * Default: false.
* @return UMLPackageList of the containing packages.
*/
- UMLPackageList getPackages() const;
+ UMLPackageList getPackages(bool includeRoot = false) const;
/**
* Returns the UMLPackage that this class is located in.
More information about the umbrello-devel
mailing list