qdoc: Duplicate QML types in the "All QML Types" list are distinguished

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ö <topi.reinio@digia.com>
This commit is contained in:
Martin Smith 2015-03-20 13:52:20 +01:00
parent 040e201ba2
commit 1341161998
7 changed files with 96 additions and 146 deletions

View File

@ -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() << "<a name=\"" << ref << "\"></a>" << divNavTop << '\n';
out() << "<h2 id=\"" << ref << "\">Namespaces</h2>\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() << "<a name=\"" << ref << "\"></a>" << divNavTop << '\n';
out() << "<h2 id=\"" << ref << "\">Classes</h2>\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() << "<div class=\"table\"><table class=\"annotated\">\n";
int row = 0;
NodeList nodes = nm.values();
NodeList nodes = nmm.values();
foreach (const Node* node, nodes) {
if (++row % 2 == 1)
out() << "<tr class=\"odd topAlign\">";
@ -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<char> 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<classMap.count(); i++) {
for (int i=0; i<nmm.count(); i++) {
while ((curParNr < NumParagraphs) &&
(curParOffset == paragraph[curParNr].count())) {
++curParNr;
@ -3026,7 +3014,8 @@ void HtmlGenerator::generateCompactList(ListType listType,
out() << "<dd>";
if ((curParNr < NumParagraphs) &&
!paragraphName[curParNr].isEmpty()) {
NodeMap::Iterator it;
NodeMultiMap::Iterator it;
NodeMultiMap::Iterator next;
it = paragraph[curParNr].begin();
for (int i=0; i<curParOffset; i++)
++it;
@ -3049,8 +3038,20 @@ void HtmlGenerator::generateCompactList(ListType listType,
}
QStringList pieces;
if (it.value()->isQmlType() || 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() << "</dd>\n";
curParOffset++;
}
if (classMap.count() > 0)
if (nmm.count() > 0)
out() << "</dl>\n";
out() << "</div>\n";

View File

@ -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);

View File

@ -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();

View File

@ -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<const ClassNode *>(*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);

View File

@ -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_;

View File

@ -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)

View File

@ -95,7 +95,7 @@ class Tree
typedef QMap<PropertyNode::FunctionRole, QString> RoleMap;
typedef QMap<PropertyNode*, RoleMap> 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_;