diff options
author | Martin Smith <msmith@trolltech.com> | 2010-05-04 11:02:34 (GMT) |
---|---|---|
committer | Martin Smith <msmith@trolltech.com> | 2010-05-04 11:02:34 (GMT) |
commit | 3f6558c2e12f507b71e0b99deb0fc76ce36734af (patch) | |
tree | 125c699b807edce0c095f29de6d68a83125b405a /tools/qdoc3 | |
parent | 820568f3aedb91b411fd1a88c9a6733b883de0ef (diff) | |
download | Qt-3f6558c2e12f507b71e0b99deb0fc76ce36734af.zip Qt-3f6558c2e12f507b71e0b99deb0fc76ce36734af.tar.gz Qt-3f6558c2e12f507b71e0b99deb0fc76ce36734af.tar.bz2 |
qdoc: Fixed class list problem.
Task: QTBUG-10373
Task: QTBUG-10382
Diffstat (limited to 'tools/qdoc3')
-rw-r--r-- | tools/qdoc3/htmlgenerator.cpp | 48 | ||||
-rw-r--r-- | tools/qdoc3/htmlgenerator.h | 1 |
2 files changed, 36 insertions, 13 deletions
diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 40145ff..1840a85 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -599,7 +599,7 @@ int HtmlGenerator::generateAtom(const Atom *atom, generateAnnotatedList(relative, marker, nonCompatClasses); } else if (atom->string() == "classes") { - generateCompactList(relative, marker, nonCompatClasses); + generateCompactList(relative, marker, nonCompatClasses, true); } else if (atom->string().contains("classesbymodule")) { QString arg = atom->string().trimmed(); @@ -647,10 +647,10 @@ int HtmlGenerator::generateAtom(const Atom *atom, generateClassHierarchy(relative, marker, nonCompatClasses); } else if (atom->string() == "compatclasses") { - generateCompactList(relative, marker, compatClasses); + generateCompactList(relative, marker, compatClasses, false); } else if (atom->string() == "obsoleteclasses") { - generateCompactList(relative, marker, obsoleteClasses); + generateCompactList(relative, marker, obsoleteClasses, false); } else if (atom->string() == "functionindex") { generateFunctionIndex(relative, marker); @@ -659,10 +659,10 @@ int HtmlGenerator::generateAtom(const Atom *atom, generateLegaleseList(relative, marker); } else if (atom->string() == "mainclasses") { - generateCompactList(relative, marker, mainClasses); + generateCompactList(relative, marker, mainClasses, true); } else if (atom->string() == "services") { - generateCompactList(relative, marker, serviceClasses); + generateCompactList(relative, marker, serviceClasses, false); } else if (atom->string() == "overviews") { generateOverviewList(relative, marker); @@ -802,9 +802,9 @@ int HtmlGenerator::generateAtom(const Atom *atom, << "\"></a>\n"; out() << "<h3>" << protectEnc((*s).name) << "</h3>\n"; if (idx == Class) - generateCompactList(0, marker, ncmap.value(), QString("Q")); + generateCompactList(0, marker, ncmap.value(), false, QString("Q")); else if (idx == QmlClass) - generateCompactList(0, marker, nqcmap.value(), QString("Q")); + generateCompactList(0, marker, nqcmap.value(), false, QString("Q")); else if (idx == MemberFunction) { ParentMaps parentmaps; ParentMaps::iterator pmap; @@ -2314,10 +2314,11 @@ void HtmlGenerator::generateAnnotatedList(const Node *relative, void HtmlGenerator::generateCompactList(const Node *relative, CodeMarker *marker, const NodeMap &classMap, + bool includeAlphabet, QString commonPrefix) { const int NumParagraphs = 37; // '0' to '9', 'A' to 'Z', '_' - const int NumColumns = 3; // number of columns in the result + const int NumColumns = 2; // number of columns in the result if (classMap.isEmpty()) return; @@ -2428,15 +2429,15 @@ void HtmlGenerator::generateCompactList(const Node *relative, for (j = 0; j < NumParagraphs; j++) // j = 0..36 paragraphOffset[j + 1] = paragraphOffset[j] + paragraph[j].count(); - int firstOffset[NumColumns + 1]; // 4 + 1 - int currentOffset[NumColumns]; // 4 - int currentParagraphNo[NumColumns]; // 4 - int currentOffsetInParagraph[NumColumns]; // 4 + int firstOffset[NumColumns + 1]; + int currentOffset[NumColumns]; + int currentParagraphNo[NumColumns]; + int currentOffsetInParagraph[NumColumns]; int numRows = (classMap.count() + NumColumns - 1) / NumColumns; int curParagNo = 0; - for (i = 0; i < NumColumns; i++) { // i = 0..3 + for (i = 0; i < NumColumns; i++) { firstOffset[i] = qMin(i * numRows, classMap.size()); currentOffset[i] = firstOffset[i]; @@ -2452,6 +2453,16 @@ void HtmlGenerator::generateCompactList(const Node *relative, } firstOffset[NumColumns] = classMap.count(); + if (includeAlphabet) { + out() << "<p class=\"centerAlign functionIndex\"><b>"; + for (int i = 0; i < 26; i++) { + QChar ch('a' + i); + out() << QString("<a href=\"#%1\">%2</a> ").arg(ch).arg(ch.toUpper()); + } + out() << "</b></p>\n"; + } + + QSet<char> used; out() << "<table class=\"generic\">\n"; for (k = 0; k < numRows; k++) { out() << "<tr>\n"; @@ -2476,6 +2487,11 @@ void HtmlGenerator::generateCompactList(const Node *relative, out() << "<td class=\"rightAlign\">"; if (currentOffsetInParagraph[i] == 0) { // start a new paragraph + if (includeAlphabet) { + QChar c = paragraphName[currentParagraphNo[i]][0].toLower(); + out() << QString("<a name=\"%1\"></a>").arg(c); + used.insert(c.cell()); + } out() << "<b>" << paragraphName[currentParagraphNo[i]] << " </b>"; @@ -2517,6 +2533,12 @@ void HtmlGenerator::generateCompactList(const Node *relative, out() << "</tr>\n"; } out() << "</table>\n"; + char C = 'a'; + while (C <= 'z') { + if (!used.contains(C)) + out() << QString("<a name=\"%1\"></a>").arg(C); + ++C; + } } void HtmlGenerator::generateFunctionIndex(const Node *relative, diff --git a/tools/qdoc3/htmlgenerator.h b/tools/qdoc3/htmlgenerator.h index d80cbdb..e060257 100644 --- a/tools/qdoc3/htmlgenerator.h +++ b/tools/qdoc3/htmlgenerator.h @@ -173,6 +173,7 @@ class HtmlGenerator : public PageGenerator void generateCompactList(const Node *relative, CodeMarker *marker, const NodeMap &classMap, + bool includeAlphabet, QString commonPrefix = QString()); void generateFunctionIndex(const Node *relative, CodeMarker *marker); void generateLegaleseList(const Node *relative, CodeMarker *marker); |