From 1341161998d3ed9fe005fc94eda1723b8da02079 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 20 Mar 2015 13:52:20 +0100 Subject: qdoc: Duplicate QML types in the "All QML Types" list are distinguished MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We have two State types in the All QML Types list. One is in QtQuick and the other is in QtQml, but they are both just listed as "State" with no way to tell which is which. Now they look like this: State: QtQml State: QtQuick Change-Id: I48bb3deda10a61f565d1aed1910360fea4fb7891 Task-number: QTBUG-45141 Reviewed-by: Topi Reiniƶ --- src/tools/qdoc/htmlgenerator.cpp | 95 ++++++++++++++++++++-------------------- src/tools/qdoc/htmlgenerator.h | 4 +- src/tools/qdoc/main.cpp | 7 ++- src/tools/qdoc/qdocdatabase.cpp | 83 +++++++---------------------------- src/tools/qdoc/qdocdatabase.h | 40 +++++++---------- src/tools/qdoc/tree.cpp | 9 +++- src/tools/qdoc/tree.h | 4 +- 7 files changed, 96 insertions(+), 146 deletions(-) (limited to 'src') diff --git a/src/tools/qdoc/htmlgenerator.cpp b/src/tools/qdoc/htmlgenerator.cpp index 00a292b17f..8bc910e6a6 100644 --- a/src/tools/qdoc/htmlgenerator.cpp +++ b/src/tools/qdoc/htmlgenerator.cpp @@ -705,11 +705,6 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark else if (atom->string() == "classhierarchy") { generateClassHierarchy(relative, qdb_->getCppClasses()); } - else if (atom->string() == "compatclasses") { - // "compatclasses" is no longer used. Delete this at some point. - // mws 03/10/2013 - generateCompactList(Generic, relative, qdb_->getCompatibilityClasses(), false, QStringLiteral("Q")); - } else if (atom->string() == "obsoleteclasses") { generateCompactList(Generic, relative, qdb_->getObsoleteClasses(), false, QStringLiteral("Q")); } @@ -728,16 +723,6 @@ int HtmlGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMark else if (atom->string() == "legalese") { generateLegaleseList(relative, marker); } - else if (atom->string() == "mainclasses") { - // "mainclasses" is no longer used. Delete this at some point. - // mws 03/10/2013 - generateCompactList(Generic, relative, qdb_->getMainClasses(), true, QStringLiteral("Q")); - } - else if (atom->string() == "services") { - // "services" is no longer used. Delete this at some point. - // mws 03/10/2013 - generateCompactList(Generic, relative, qdb_->getServiceClasses(), false, QStringLiteral("Q")); - } else if (atom->string() == "overviews") { generateList(relative, marker, "overviews"); } @@ -1772,23 +1757,23 @@ void HtmlGenerator::generateCollectionNode(CollectionNode* cn, CodeMarker* marke generateStatus(cn, marker); generateSince(cn, marker); - NodeMap nm; - cn->getMemberNamespaces(nm); - if (!nm.isEmpty()) { + NodeMultiMap nmm; + cn->getMemberNamespaces(nmm); + if (!nmm.isEmpty()) { ref = registerRef("namespaces"); out() << "" << divNavTop << '\n'; out() << "

Namespaces

\n"; - generateAnnotatedList(cn, marker, nm); + generateAnnotatedList(cn, marker, nmm); } - nm.clear(); - cn->getMemberClasses(nm); - if (!nm.isEmpty()) { + nmm.clear(); + cn->getMemberClasses(nmm); + if (!nmm.isEmpty()) { ref = registerRef("classes"); out() << "" << divNavTop << '\n'; out() << "

Classes

\n"; - generateAnnotatedList(cn, marker, nm); + generateAnnotatedList(cn, marker, nmm); } - nm.clear(); + nmm.clear(); } sections = marker->sections(cn, CodeMarker::Summary, CodeMarker::Okay); @@ -2837,11 +2822,11 @@ void HtmlGenerator::generateClassHierarchy(const Node *relative, NodeMap& classM */ void HtmlGenerator::generateAnnotatedList(const Node* relative, CodeMarker* marker, - const NodeMap& nodeMap) + const NodeMultiMap& nmm) { - if (nodeMap.isEmpty()) + if (nmm.isEmpty()) return; - generateAnnotatedList(relative, marker, nodeMap.values()); + generateAnnotatedList(relative, marker, nmm.values()); } /*! @@ -2850,19 +2835,19 @@ void HtmlGenerator::generateAnnotatedList(const Node *relative, CodeMarker *marker, const NodeList& unsortedNodes) { - NodeMap nm; + NodeMultiMap nmm; bool allInternal = true; foreach (Node* node, unsortedNodes) { if (!node->isInternal() && !node->isObsolete()) { allInternal = false; - nm.insert(node->fullName(relative), node); + nmm.insert(node->fullName(relative), node); } } if (allInternal) return; out() << "
\n"; int row = 0; - NodeList nodes = nm.values(); + NodeList nodes = nmm.values(); foreach (const Node* node, nodes) { if (++row % 2 == 1) out() << ""; @@ -2901,20 +2886,21 @@ void HtmlGenerator::generateAnnotatedList(const Node *relative, /*! This function finds the common prefix of the names of all - the classes in \a classMap and then generates a compact - list of the class names alphabetized on the part of the - name not including the common prefix. You can tell the - function to use \a comonPrefix as the common prefix, but - normally you let it figure it out itself by looking at - the name of the first and last classes in \a classMap. + the classes in the class map \a nmm and then generates a + compact list of the class names alphabetized on the part + of the name not including the common prefix. You can tell + the function to use \a comonPrefix as the common prefix, + but normally you let it figure it out itself by looking at + the name of the first and last classes in the class map + \a nmm. */ void HtmlGenerator::generateCompactList(ListType listType, const Node *relative, - const NodeMap &classMap, + const NodeMultiMap &nmm, bool includeAlphabet, QString commonPrefix) { - if (classMap.isEmpty()) + if (nmm.isEmpty()) return; const int NumParagraphs = 37; // '0' to '9', 'A' to 'Z', '_' @@ -2924,14 +2910,14 @@ void HtmlGenerator::generateCompactList(ListType listType, Divide the data into 37 paragraphs: 0, ..., 9, A, ..., Z, underscore (_). QAccel will fall in paragraph 10 (A) and QXtWidget in paragraph 33 (X). This is the only place where we - assume that NumParagraphs is 37. Each paragraph is a NodeMap. + assume that NumParagraphs is 37. Each paragraph is a NodeMultiMap. */ - NodeMap paragraph[NumParagraphs+1]; + NodeMultiMap paragraph[NumParagraphs+1]; QString paragraphName[NumParagraphs+1]; QSet usedParagraphNames; - NodeMap::ConstIterator c = classMap.constBegin(); - while (c != classMap.constEnd()) { + NodeMultiMap::ConstIterator c = nmm.constBegin(); + while (c != nmm.constEnd()) { QStringList pieces = c.key().split("::"); QString key; int idx = commonPrefixLen; @@ -2991,8 +2977,10 @@ void HtmlGenerator::generateCompactList(ListType listType, int curParNr = 0; int curParOffset = 0; + QString previousName; + bool multipleOccurrences = false; - for (int i=0; i"; if ((curParNr < NumParagraphs) && !paragraphName[curParNr].isEmpty()) { - NodeMap::Iterator it; + NodeMultiMap::Iterator it; + NodeMultiMap::Iterator next; it = paragraph[curParNr].begin(); for (int i=0; iisQmlType() || it.value()->isJsType()) - pieces << it.value()->name(); + if (it.value()->isQmlType() || it.value()->isJsType()) { + QString name = it.value()->name(); + next = it; + ++next; + if (name != previousName) + multipleOccurrences = false; + if ((next != paragraph[curParNr].end()) && (name == next.value()->name())) { + multipleOccurrences = true; + previousName = name; + } + if (multipleOccurrences) + name += ": " + it.value()->tree()->camelCaseModuleName(); + pieces << name; + } else pieces = it.value()->fullName(relative).split("::"); out() << protectEnc(pieces.last()); @@ -3064,7 +3065,7 @@ void HtmlGenerator::generateCompactList(ListType listType, out() << "\n"; curParOffset++; } - if (classMap.count() > 0) + if (nmm.count() > 0) out() << "\n"; out() << "\n"; diff --git a/src/tools/qdoc/htmlgenerator.h b/src/tools/qdoc/htmlgenerator.h index 0c7a4af5ff..efd38ea104 100644 --- a/src/tools/qdoc/htmlgenerator.h +++ b/src/tools/qdoc/htmlgenerator.h @@ -159,11 +159,11 @@ private: CodeMarker *marker, CodeMarker::Status status); void generateClassHierarchy(const Node *relative, NodeMap &classMap); - void generateAnnotatedList(const Node* relative, CodeMarker* marker, const NodeMap& nodeMap); + void generateAnnotatedList(const Node* relative, CodeMarker* marker, const NodeMultiMap& nodeMap); void generateAnnotatedList(const Node* relative, CodeMarker* marker, const NodeList& nodes); void generateCompactList(ListType listType, const Node *relative, - const NodeMap &classMap, + const NodeMultiMap &classMap, bool includeAlphabet, QString commonPrefix); void generateFunctionIndex(const Node *relative); diff --git a/src/tools/qdoc/main.cpp b/src/tools/qdoc/main.cpp index 74d706efe1..825358c354 100644 --- a/src/tools/qdoc/main.cpp +++ b/src/tools/qdoc/main.cpp @@ -341,17 +341,16 @@ static void processQdocconfFile(const QString &fileName) Location outputFormatsLocation = config.lastLocation(); qdb->clearSearchOrder(); - QString p = config.getString(CONFIG_PROJECT).toLower(); if (!Generator::singleExec()) { Generator::debug(" loading index files"); loadIndexFiles(config); Generator::debug(" done loading index files"); - qdb->newPrimaryTree(p); + qdb->newPrimaryTree(project); } else if (Generator::preparing()) - qdb->newPrimaryTree(p); + qdb->newPrimaryTree(project); else - qdb->setPrimaryTree(p); + qdb->setPrimaryTree(project); dependModules = config.getStringList(CONFIG_DEPENDS); dependModules.removeDuplicates(); diff --git a/src/tools/qdoc/qdocdatabase.cpp b/src/tools/qdoc/qdocdatabase.cpp index 30d4d28a17..a0b91a9c72 100644 --- a/src/tools/qdoc/qdocdatabase.cpp +++ b/src/tools/qdoc/qdocdatabase.cpp @@ -138,8 +138,9 @@ Tree* QDocForest::nextTree() */ void QDocForest::setPrimaryTree(const QString& t) { - primaryTree_ = findTree(t); - forest_.remove(t); + QString T = t.toLower(); + primaryTree_ = findTree(T); + forest_.remove(T); if (!primaryTree_) qDebug() << "ERROR: Could not set primary tree to:" << t; } @@ -841,7 +842,7 @@ TextToNodeMap& QDocDatabase::getLegaleseTexts() have not already been constructed. Returns a reference to the map of C++ classes with obsolete members. */ -NodeMap& QDocDatabase::getClassesWithObsoleteMembers() +NodeMultiMap& QDocDatabase::getClassesWithObsoleteMembers() { if (obsoleteClasses_.isEmpty() && obsoleteQmlTypes_.isEmpty()) processForest(&QDocDatabase::findAllObsoleteThings); @@ -853,7 +854,7 @@ NodeMap& QDocDatabase::getClassesWithObsoleteMembers() have not already been constructed. Returns a reference to the map of obsolete QML types. */ -NodeMap& QDocDatabase::getObsoleteQmlTypes() +NodeMultiMap& QDocDatabase::getObsoleteQmlTypes() { if (obsoleteClasses_.isEmpty() && obsoleteQmlTypes_.isEmpty()) processForest(&QDocDatabase::findAllObsoleteThings); @@ -865,38 +866,24 @@ NodeMap& QDocDatabase::getObsoleteQmlTypes() have not already been constructed. Returns a reference to the map of QML types with obsolete members. */ -NodeMap& QDocDatabase::getQmlTypesWithObsoleteMembers() +NodeMultiMap& QDocDatabase::getQmlTypesWithObsoleteMembers() { if (obsoleteClasses_.isEmpty() && obsoleteQmlTypes_.isEmpty()) processForest(&QDocDatabase::findAllObsoleteThings); return qmlTypesWithObsoleteMembers_; } -/*! \fn NodeMap& QDocDatabase::getNamespaces() +/*! \fn NodeMultiMap& QDocDatabase::getNamespaces() Returns a reference to the map of all namespace nodes. This function must not be called in the -prepare phase. */ -/*! - Construct the C++ class data structures, if they have not - already been constructed. Returns a reference to the map - of C++ service clases. - - \note This is currently not used. - */ -NodeMap& QDocDatabase::getServiceClasses() -{ - if (cppClasses_.isEmpty() && qmlTypes_.isEmpty()) - processForest(&QDocDatabase::findAllClasses); - return serviceClasses_; -} - /*! Construct the data structures for QML basic types, if they have not already been constructed. Returns a reference to the map of QML basic types. */ -NodeMap& QDocDatabase::getQmlBasicTypes() +NodeMultiMap& QDocDatabase::getQmlBasicTypes() { if (cppClasses_.isEmpty() && qmlBasicTypes_.isEmpty()) processForest(&QDocDatabase::findAllClasses); @@ -906,9 +893,9 @@ NodeMap& QDocDatabase::getQmlBasicTypes() /*! Construct the data structures for obsolete things, if they have not already been constructed. Returns a reference to - the map of obsolete QML types. + the multimap of QML types. */ -NodeMap& QDocDatabase::getQmlTypes() +NodeMultiMap& QDocDatabase::getQmlTypes() { if (cppClasses_.isEmpty() && qmlTypes_.isEmpty()) processForest(&QDocDatabase::findAllClasses); @@ -920,46 +907,19 @@ NodeMap& QDocDatabase::getQmlTypes() have not already been constructed. Returns a reference to the map of obsolete C++ clases. */ -NodeMap& QDocDatabase::getObsoleteClasses() +NodeMultiMap& QDocDatabase::getObsoleteClasses() { if (obsoleteClasses_.isEmpty() && obsoleteQmlTypes_.isEmpty()) processForest(&QDocDatabase::findAllObsoleteThings); return obsoleteClasses_; } -/*! - Construct the C++ class data structures, if they have not - already been constructed. Returns a reference to the map - of compatibility C++ clases. - */ -NodeMap& QDocDatabase::getCompatibilityClasses() -{ - if (cppClasses_.isEmpty() && qmlTypes_.isEmpty()) - processForest(&QDocDatabase::findAllClasses); - return compatClasses_; -} - -/*! - Construct the C++ class data structures, if they have not - already been constructed. Returns a reference to the map - of main C++ clases. - - \note The main C++ classes data structure is currently not - used. - */ -NodeMap& QDocDatabase::getMainClasses() -{ - if (cppClasses_.isEmpty() && qmlTypes_.isEmpty()) - processForest(&QDocDatabase::findAllClasses); - return mainClasses_; -} - /*! Construct the C++ class data structures, if they have not already been constructed. Returns a reference to the map of all C++ classes. */ -NodeMap& QDocDatabase::getCppClasses() +NodeMultiMap& QDocDatabase::getCppClasses() { if (cppClasses_.isEmpty() && qmlTypes_.isEmpty()) processForest(&QDocDatabase::findAllClasses); @@ -974,7 +934,8 @@ void QDocDatabase::findAllClasses(InnerNode* node) { NodeList::const_iterator c = node->childNodes().constBegin(); while (c != node->childNodes().constEnd()) { - if ((*c)->access() != Node::Private && (!(*c)->isInternal() || showInternal_)) { + if ((*c)->access() != Node::Private && (!(*c)->isInternal() || showInternal_) && + (*c)->tree()->camelCaseModuleName() != QString("QDoc")) { if ((*c)->type() == Node::Class && !(*c)->doc().isEmpty()) { QString className = (*c)->name(); if ((*c)->parent() && @@ -982,19 +943,7 @@ void QDocDatabase::findAllClasses(InnerNode* node) !(*c)->parent()->name().isEmpty()) className = (*c)->parent()->name()+"::"+className; - if ((*c)->status() == Node::Compat) { - compatClasses_.insert(className, *c); - } - else { - cppClasses_.insert(className, *c); - if ((*c)->status() == Node::Main) - mainClasses_.insert(className, *c); - } - - QString serviceName = (static_cast(*c))->serviceName(); - if (!serviceName.isEmpty()) { - serviceClasses_.insert(serviceName, *c); - } + cppClasses_.insert(className, *c); } else if (((*c)->isQmlType() || (*c)->isQmlBasicType() || (*c)->isJsType() || (*c)->isJsBasicType()) && !(*c)->doc().isEmpty()) { @@ -1299,7 +1248,7 @@ const NodeMap& QDocDatabase::getQmlTypeMap(const QString& key) a reference to the value, which is a NodeMultiMap. If \a key is not found, return a reference to an empty NodeMultiMap. */ -const NodeMultiMap& QDocDatabase::getSinceMap(const QString& key) +const NodeMap& QDocDatabase::getSinceMap(const QString& key) { if (newSinceMaps_.isEmpty() && newClassMaps_.isEmpty() && newQmlTypeMaps_.isEmpty()) processForest(&QDocDatabase::findAllSince); diff --git a/src/tools/qdoc/qdocdatabase.h b/src/tools/qdoc/qdocdatabase.h index d0c59d731c..b8ca8bc32d 100644 --- a/src/tools/qdoc/qdocdatabase.h +++ b/src/tools/qdoc/qdocdatabase.h @@ -271,22 +271,19 @@ class QDocDatabase /******************************************************************* special collection access functions ********************************************************************/ - NodeMap& getCppClasses(); - NodeMap& getMainClasses(); - NodeMap& getCompatibilityClasses(); - NodeMap& getObsoleteClasses(); - NodeMap& getClassesWithObsoleteMembers(); - NodeMap& getObsoleteQmlTypes(); - NodeMap& getQmlTypesWithObsoleteMembers(); - NodeMap& getNamespaces() { resolveNamespaces(); return namespaceIndex_; } - NodeMap& getServiceClasses(); - NodeMap& getQmlBasicTypes(); - NodeMap& getQmlTypes(); + NodeMultiMap& getCppClasses(); + NodeMultiMap& getObsoleteClasses(); + NodeMultiMap& getClassesWithObsoleteMembers(); + NodeMultiMap& getObsoleteQmlTypes(); + NodeMultiMap& getQmlTypesWithObsoleteMembers(); + NodeMultiMap& getNamespaces() { resolveNamespaces(); return namespaceIndex_; } + NodeMultiMap& getQmlBasicTypes(); + NodeMultiMap& getQmlTypes(); NodeMapMap& getFunctionIndex(); TextToNodeMap& getLegaleseTexts(); const NodeMap& getClassMap(const QString& key); const NodeMap& getQmlTypeMap(const QString& key); - const NodeMultiMap& getSinceMap(const QString& key); + const NodeMap& getSinceMap(const QString& key); /******************************************************************* Many of these will be either eliminated or replaced. @@ -438,18 +435,15 @@ class QDocDatabase QString version_; QDocForest forest_; - NodeMap cppClasses_; - NodeMap mainClasses_; // MWS: not needed, should be delete - NodeMap compatClasses_; - NodeMap obsoleteClasses_; - NodeMap classesWithObsoleteMembers_; - NodeMap obsoleteQmlTypes_; - NodeMap qmlTypesWithObsoleteMembers_; - NodeMap namespaceIndex_; + NodeMultiMap cppClasses_; + NodeMultiMap obsoleteClasses_; + NodeMultiMap classesWithObsoleteMembers_; + NodeMultiMap obsoleteQmlTypes_; + NodeMultiMap qmlTypesWithObsoleteMembers_; + NodeMultiMap namespaceIndex_; NodeMultiMap nmm_; - NodeMap serviceClasses_; // MWS: not needed, should be deleted - NodeMap qmlBasicTypes_; - NodeMap qmlTypes_; + NodeMultiMap qmlBasicTypes_; + NodeMultiMap qmlTypes_; NodeMapMap newClassMaps_; NodeMapMap newQmlTypeMaps_; NodeMultiMapMap newSinceMaps_; diff --git a/src/tools/qdoc/tree.cpp b/src/tools/qdoc/tree.cpp index d36003c665..d0d0bcbb5a 100644 --- a/src/tools/qdoc/tree.cpp +++ b/src/tools/qdoc/tree.cpp @@ -64,12 +64,17 @@ QT_BEGIN_NAMESPACE Constructs a Tree. \a qdb is the pointer to the singleton qdoc database that is constructing the tree. This might not be necessary, and it might be removed later. + + \a camelCaseModuleName is the project name for this tree, + which was obtained from the qdocconf file via the Config + singleton. */ -Tree::Tree(const QString& physicalModuleName, QDocDatabase* qdb) +Tree::Tree(const QString& camelCaseModuleName, QDocDatabase* qdb) : treeHasBeenAnalyzed_(false), docsHaveBeenGenerated_(false), linkCount_(0), - physicalModuleName_(physicalModuleName), + camelCaseModuleName_(camelCaseModuleName), + physicalModuleName_(camelCaseModuleName.toLower()), qdb_(qdb), root_(0, QString()), targetListMap_(0) diff --git a/src/tools/qdoc/tree.h b/src/tools/qdoc/tree.h index 67063ef86a..1e9612aeec 100644 --- a/src/tools/qdoc/tree.h +++ b/src/tools/qdoc/tree.h @@ -95,7 +95,7 @@ class Tree typedef QMap RoleMap; typedef QMap PropertyMap; - Tree(const QString& module, QDocDatabase* qdb); + Tree(const QString& camelCaseModuleName, QDocDatabase* qdb); ~Tree(); Node* findNodeForInclude(const QStringList& path) const; @@ -212,6 +212,7 @@ class Tree QStringList getTargetListKeys() { return targetListMap_->keys(); } public: + const QString& camelCaseModuleName() const { return camelCaseModuleName_; } const QString& physicalModuleName() const { return physicalModuleName_; } const QString& indexFileName() const { return indexFileName_; } long incrementLinkCount() { return --linkCount_; } @@ -222,6 +223,7 @@ private: bool treeHasBeenAnalyzed_; bool docsHaveBeenGenerated_; long linkCount_; + QString camelCaseModuleName_; QString physicalModuleName_; QString indexFileName_; QDocDatabase* qdb_; -- cgit v1.2.3