From 4ae0c208b66e0f7954e194384464fe2d0a2c56dd Mon Sep 17 00:00:00 2001 From: tpearson Date: Sat, 31 Jul 2010 19:51:49 +0000 Subject: Trinity Qt initial conversion git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdesdk@1157652 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- umbrello/umbrello/petaltree2uml.cpp | 94 ++++++++++++++++++------------------- 1 file changed, 47 insertions(+), 47 deletions(-) (limited to 'umbrello/umbrello/petaltree2uml.cpp') diff --git a/umbrello/umbrello/petaltree2uml.cpp b/umbrello/umbrello/petaltree2uml.cpp index 41563785..c8cccdc2 100644 --- a/umbrello/umbrello/petaltree2uml.cpp +++ b/umbrello/umbrello/petaltree2uml.cpp @@ -12,7 +12,7 @@ // own header #include "petaltree2uml.h" // qt/kde includes -#include +#include #include // app includes #include "petalnode.h" @@ -38,12 +38,12 @@ namespace Import_Rose { * Return the given string without surrounding quotation marks. * Also remove a possible prefix "Logical View::", it is not modeled in Umbrello. */ -QString clean(const QString& s) { +TQString clean(const TQString& s) { if (s.isNull()) - return QString(); - QString str = s; + return TQString(); + TQString str = s; str.remove("\""); - str.remove(QRegExp("^Logical View::")); + str.remove(TQRegExp("^Logical View::")); return str; } @@ -51,7 +51,7 @@ QString clean(const QString& s) { * Extract the quid attribute from a petal node and return it as a Uml::IDType. */ Uml::IDType quid(const PetalNode *node) { - QString quidStr = node->findAttribute("quid").string; + TQString quidStr = node->findAttribute("quid").string; if (quidStr.isEmpty()) return Uml::id_None; quidStr.remove("\""); @@ -61,10 +61,10 @@ Uml::IDType quid(const PetalNode *node) { /** * Extract the quidu attribute from a petal node. */ -QString quidu(const PetalNode *node) { - QString quiduStr = node->findAttribute("quidu").string; +TQString quidu(const PetalNode *node) { + TQString quiduStr = node->findAttribute("quidu").string; if (quiduStr.isEmpty()) - return QString(); + return TQString(); quiduStr.remove("\""); return quiduStr; } @@ -74,10 +74,10 @@ QString quidu(const PetalNode *node) { * If the given name consists only of letters, digits, underscores, and * scope separators, then return Uml::ot_Class, else return Uml::ot_Datatype. */ -Uml::Object_Type typeToCreate(const QString& name) { - QString n = name; - n.remove(QRegExp("^.*::")); // don't consider the scope prefix, it may contain spaces - Uml::Object_Type t = (n.contains(QRegExp("\\W")) ? Uml::ot_Datatype : Uml::ot_Class); +Uml::Object_Type typeToCreate(const TQString& name) { + TQString n = name; + n.remove(TQRegExp("^.*::")); // don't consider the scope prefix, it may contain spaces + Uml::Object_Type t = (n.contains(TQRegExp("\\W")) ? Uml::ot_Datatype : Uml::ot_Class); return t; } @@ -88,7 +88,7 @@ Uml::Object_Type typeToCreate(const QString& name) { * @param to Pointer to UMLObject in which to set the Uml::Visibility */ void transferVisibility(const PetalNode *from, UMLObject *to) { - QString vis = from->findAttribute("exportControl").string; + TQString vis = from->findAttribute("exportControl").string; if (!vis.isEmpty()) { Uml::Visibility v = Uml::Visibility::fromString(clean(vis.lower())); to->setVisibility(v); @@ -119,7 +119,7 @@ public: virtual UMLObject *createListItem() = 0; virtual void setTypeReferences(UMLObject *item, - const QString& quid, const QString& type) { + const TQString& quid, const TQString& type) { if (!quid.isEmpty()) { item->setSecondaryId(quid); } @@ -148,7 +148,7 @@ public: * - invoke insertAtParent() with the new classifier list item as the argument * This is the user entry point. */ - void read(const PetalNode *node, const QString& name) { + void read(const PetalNode *node, const TQString& name) { PetalNode *attributes = node->findAttribute(m_attributeTag).node; if (attributes == NULL) { #ifdef VERBOSE_DEBUGGING @@ -160,7 +160,7 @@ public: PetalNode::NameValueList attributeList = attributes->attributes(); for (uint i = 0; i < attributeList.count(); i++) { PetalNode *attNode = attributeList[i].second.node; - QStringList initialArgs = attNode->initialArgs(); + TQStringList initialArgs = attNode->initialArgs(); if (attNode->name() != m_elementName) { kDebug() << "read(" << name << "): expecting " << m_elementName << ", " << "found " << initialArgs[0] << endl; @@ -170,18 +170,18 @@ public: if (initialArgs.count() > 1) item->setName(clean(initialArgs[1])); item->setID(quid(attNode)); - QString quidref = quidu(attNode); - QString type = clean(attNode->findAttribute(m_itemTypeDesignator).string); + TQString quidref = quidu(attNode); + TQString type = clean(attNode->findAttribute(m_itemTypeDesignator).string); setTypeReferences(item, quidref, type); transferVisibility(attNode, item); - QString doc = attNode->findAttribute("documentation").string; + TQString doc = attNode->findAttribute("documentation").string; if (! doc.isEmpty()) item->setDoc(doc); insertAtParent(attNode, item); } } protected: - const QString m_attributeTag, m_elementName, m_itemTypeDesignator; + const TQString m_attributeTag, m_elementName, m_itemTypeDesignator; }; class AttributesReader : public ClassifierListReader { @@ -253,7 +253,7 @@ public: * UMLAssociation itself but for its role B object. */ void setTypeReferences(UMLObject *item, - const QString& quid, const QString& type) { + const TQString& quid, const TQString& type) { UMLAssociation *assoc = static_cast(item); if (!quid.isEmpty()) { assoc->getUMLRole(Uml::B)->setSecondaryId(quid); @@ -286,7 +286,7 @@ public: * UMLAssociation itself but for its role B object. */ void setTypeReferences(UMLObject *item, - const QString& quid, const QString& type) { + const TQString& quid, const TQString& type) { UMLAssociation *assoc = static_cast(item); if (!quid.isEmpty()) { assoc->getUMLRole(Uml::B)->setSecondaryId(quid); @@ -313,11 +313,11 @@ protected: * @param parentPkg Pointer to the current parent UMLPackage. * @return True if the node actually contained a controlled unit. */ -bool handleControlledUnit(PetalNode *node, const QString& name, Uml::IDType id, UMLPackage *parentPkg) { +bool handleControlledUnit(PetalNode *node, const TQString& name, Uml::IDType id, UMLPackage *parentPkg) { if (node->findAttribute("is_unit").string != "TRUE") return false; bool is_loaded = (node->findAttribute("is_loaded").string != "FALSE"); - QString file_name = node->findAttribute("file_name").string; + TQString file_name = node->findAttribute("file_name").string; if (file_name.isEmpty()) { kError() << "handleControlledUnit(" << name << "): attribute file_name not found (?)" << endl; @@ -340,9 +340,9 @@ bool umbrellify(PetalNode *node, UMLPackage *parentPkg = NULL) { kError() << "umbrellify: node is NULL" << endl; return false; } - QStringList args = node->initialArgs(); - QString objType = args[0]; - QString name = clean(args[1]); + TQStringList args = node->initialArgs(); + TQString objType = args[0]; + TQString name = clean(args[1]); Uml::IDType id = quid(node); if (objType == "Class_Category") { @@ -365,7 +365,7 @@ bool umbrellify(PetalNode *node, UMLPackage *parentPkg = NULL) { o->setID(id); UMLClassifier *c = static_cast(o); // set stereotype - QString stereotype = clean(node->findAttribute("stereotype").string); + TQString stereotype = clean(node->findAttribute("stereotype").string); if (!stereotype.isEmpty()) { if (stereotype.lower() == "interface") c->setBaseType(Uml::ot_Interface); @@ -407,42 +407,42 @@ bool umbrellify(PetalNode *node, UMLPackage *parentPkg = NULL) { // index 0 corresponds to Umbrello roleB // index 1 corresponds to Umbrello roleA UMLRole *role = assoc->getUMLRole((Uml::Role_Type) !i); - QStringList initialArgs = roleNode->initialArgs(); + TQStringList initialArgs = roleNode->initialArgs(); if (initialArgs.count() > 1) { - QString roleName = clean(initialArgs[1]); + TQString roleName = clean(initialArgs[1]); if (! roleName.startsWith("$UNNAMED")) role->setName(roleName); } role->setID(quid(roleNode)); - QString quidref = quidu(roleNode); - QString type = clean(roleNode->findAttribute("supplier").string); + TQString quidref = quidu(roleNode); + TQString type = clean(roleNode->findAttribute("supplier").string); if (!quidref.isEmpty()) { role->setSecondaryId(quidref); } if (!type.isEmpty()) { role->setSecondaryFallback(type); } - QString label = clean(roleNode->findAttribute("label").string); + TQString label = clean(roleNode->findAttribute("label").string); if (!label.isEmpty()) { role->setName(label); } - QString client_cardinality = clean(roleNode->findAttribute("client_cardinality").string); + TQString client_cardinality = clean(roleNode->findAttribute("client_cardinality").string); if (!client_cardinality.isEmpty()) { role->setMultiplicity(client_cardinality); } - QString is_navigable = clean(roleNode->findAttribute("is_navigable").string); + TQString is_navigable = clean(roleNode->findAttribute("is_navigable").string); if (is_navigable == "FALSE") { assoc->setAssocType(Uml::at_Association); } - QString is_aggregate = clean(roleNode->findAttribute("is_aggregate").string); + TQString is_aggregate = clean(roleNode->findAttribute("is_aggregate").string); if (is_aggregate == "TRUE") { assoc->setAssocType(Uml::at_Aggregation); } - QString containment = clean(roleNode->findAttribute("Containment").string); + TQString containment = clean(roleNode->findAttribute("Containment").string); if (containment == "By Value") { assoc->setAssocType(Uml::at_Composition); } - QString doc = roleNode->findAttribute("documentation").string; + TQString doc = roleNode->findAttribute("documentation").string; if (! doc.isEmpty()) role->setDoc(doc); } @@ -488,14 +488,14 @@ Uml::ListView_Type folderType(UMLListViewItem *parent) { * Given a PetalNode for which the mapping to Umbrello is not yet * implemented umbrellify() is a no-op but also returns true. */ -bool umbrellify(PetalNode *node, const QString& modelsName, UMLListViewItem *parent) { +bool umbrellify(PetalNode *node, const TQString& modelsName, UMLListViewItem *parent) { if (node == NULL) { kError() << "umbrellify(" << modelsName << "): node is NULL" << endl; return false; } - QStringList args = node->initialArgs(); - QString objType = args[0]; - QString name = clean(args[1]); + TQStringList args = node->initialArgs(); + TQString objType = args[0]; + TQString name = clean(args[1]); Uml::IDType id = quid(node); UMLObject *obj = NULL; UMLListViewItem *item = NULL; @@ -504,7 +504,7 @@ bool umbrellify(PetalNode *node, const QString& modelsName, UMLListViewItem *par Uml::ListView_Type lvType = folderType(parent); item = new UMLListViewItem( parent, name, lvType, id ); } else if (objType == "Class") { - QString stereotype = clean(node->findAttribute("stereotype").string); + TQString stereotype = clean(node->findAttribute("stereotype").string); if (stereotype == "Actor") { UMLActor *act = new UMLActor(name, id); item = new UMLListViewItem(parent, name, Uml::lvt_Actor, act); @@ -540,7 +540,7 @@ bool umbrellify(PetalNode *node, const QString& modelsName, UMLListViewItem *par } } if (obj) { - QString doc = node->findAttribute("documentation").string; + TQString doc = node->findAttribute("documentation").string; if (! doc.isEmpty()) obj->setDoc(doc); UMLDoc *theDocument = UMLApp::app()->getDocument(); @@ -552,8 +552,8 @@ bool umbrellify(PetalNode *node, const QString& modelsName, UMLListViewItem *par /** * Auxiliary function for UseCase/Component/Deployment view import */ -bool importView(PetalNode *root, const QString& rootName, - const QString& modelsName, UMLListViewItem *lvParent) { +bool importView(PetalNode *root, const TQString& rootName, + const TQString& modelsName, UMLListViewItem *lvParent) { PetalNode *viewRoot = root->findAttribute(rootName).node; if (viewRoot == NULL) { kDebug() << "importView: cannot find " << rootName << endl; -- cgit v1.2.3