summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Smith <msmith@trolltech.com>2010-03-30 11:03:10 (GMT)
committerMartin Smith <msmith@trolltech.com>2010-03-30 11:03:10 (GMT)
commit2d9260e863ff2e3a5bb77d37b2b9b90072bce825 (patch)
treee64fcf9691356c462409980272e89751948f196e
parentdcb055cde3a8d31e52a2d2143f14ca8662859541 (diff)
downloadQt-2d9260e863ff2e3a5bb77d37b2b9b90072bce825.zip
Qt-2d9260e863ff2e3a5bb77d37b2b9b90072bce825.tar.gz
Qt-2d9260e863ff2e3a5bb77d37b2b9b90072bce825.tar.bz2
qdoc: Added <div> elements to some html output for class references.
Task: QTBUG-9504
-rw-r--r--tools/qdoc3/codemarker.cpp2
-rw-r--r--tools/qdoc3/codemarker.h24
-rw-r--r--tools/qdoc3/cppcodemarker.cpp76
-rw-r--r--tools/qdoc3/htmlgenerator.cpp8
-rw-r--r--tools/qdoc3/qscodemarker.cpp18
5 files changed, 86 insertions, 42 deletions
diff --git a/tools/qdoc3/codemarker.cpp b/tools/qdoc3/codemarker.cpp
index 15f2c2d..818a91f 100644
--- a/tools/qdoc3/codemarker.cpp
+++ b/tools/qdoc3/codemarker.cpp
@@ -457,7 +457,7 @@ bool CodeMarker::insertReimpFunc(FastSection& fs, Node* node, Status status)
void CodeMarker::append(QList<Section>& sectionList, const FastSection& fs)
{
if (!fs.isEmpty()) {
- Section section(fs.name,fs.singularMember,fs.pluralMember);
+ Section section(fs.name,fs.divClass,fs.singularMember,fs.pluralMember);
section.members = fs.memberMap.values();
section.reimpMembers = fs.reimpMemberMap.values();
section.inherited = fs.inherited;
diff --git a/tools/qdoc3/codemarker.h b/tools/qdoc3/codemarker.h
index 1b21753..aab8a9c 100644
--- a/tools/qdoc3/codemarker.h
+++ b/tools/qdoc3/codemarker.h
@@ -58,6 +58,7 @@ class Tree;
struct Section
{
QString name;
+ QString divClass;
QString singularMember;
QString pluralMember;
NodeList members;
@@ -66,9 +67,11 @@ struct Section
Section() { }
Section(const QString& name0,
+ const QString& divClass0,
const QString& singularMember0,
const QString& pluralMember0)
- : name(name0),
+ : name(name0),
+ divClass(divClass0),
singularMember(singularMember0),
pluralMember(pluralMember0) { }
void appendMember(Node* node) { members.append(node); }
@@ -79,6 +82,7 @@ struct FastSection
{
const InnerNode *innerNode;
QString name;
+ QString divClass;
QString singularMember;
QString pluralMember;
QMap<QString, Node *> memberMap;
@@ -86,20 +90,30 @@ struct FastSection
QList<QPair<ClassNode *, int> > inherited;
FastSection(const InnerNode *innerNode0,
- const QString& name0 = "",
- const QString& singularMember0 = "member",
- const QString& pluralMember0 = "members")
+ const QString& name0,
+ const QString& divClass0,
+ const QString& singularMember0,
+ const QString& pluralMember0)
: innerNode(innerNode0),
name(name0),
+ divClass(divClass0),
singularMember(singularMember0),
pluralMember(pluralMember0) { }
bool isEmpty() const {
- return (memberMap.isEmpty() && inherited.isEmpty() &&
+ return (memberMap.isEmpty() &&
+ inherited.isEmpty() &&
reimpMemberMap.isEmpty());
}
};
+#if 0
+ const QString& name0 = "",
+ const QString& divClass0 = "",
+ const QString& singularMember0 = "member",
+ const QString& pluralMember0 = "members")
+#endif
+
class CodeMarker
{
public:
diff --git a/tools/qdoc3/cppcodemarker.cpp b/tools/qdoc3/cppcodemarker.cpp
index 3ff6ebe..c4ee054 100644
--- a/tools/qdoc3/cppcodemarker.cpp
+++ b/tools/qdoc3/cppcodemarker.cpp
@@ -482,55 +482,66 @@ QList<Section> CppCodeMarker::sections(const InnerNode *inner,
if (style == Summary) {
FastSection privateFunctions(classe,
"Private Functions",
+ "",
"private function",
"private functions");
- FastSection privateSlots(classe, "Private Slots", "private slot", "private slots");
- FastSection privateTypes(classe, "Private Types", "private type", "private types");
+ FastSection privateSlots(classe, "Private Slots", "", "private slot", "private slots");
+ FastSection privateTypes(classe, "Private Types", "", "private type", "private types");
FastSection protectedFunctions(classe,
"Protected Functions",
+ "",
"protected function",
"protected functions");
FastSection protectedSlots(classe,
"Protected Slots",
+ "",
"protected slot",
"protected slots");
FastSection protectedTypes(classe,
"Protected Types",
+ "",
"protected type",
"protected types");
FastSection protectedVariables(classe,
"Protected Variables",
+ "",
"protected type",
"protected variables");
FastSection publicFunctions(classe,
"Public Functions",
+ "",
"public function",
"public functions");
- FastSection publicSignals(classe, "Signals", "signal", "signals");
- FastSection publicSlots(classe, "Public Slots", "public slot", "public slots");
- FastSection publicTypes(classe, "Public Types", "public type", "public types");
+ FastSection publicSignals(classe, "Signals", "", "signal", "signals");
+ FastSection publicSlots(classe, "Public Slots", "", "public slot", "public slots");
+ FastSection publicTypes(classe, "Public Types", "", "public type", "public types");
FastSection publicVariables(classe,
"Public Variables",
- "public type",
+ "",
+ "public variable",
"public variables");
- FastSection properties(classe, "Properties", "property", "properties");
+ FastSection properties(classe, "Properties", "", "property", "properties");
FastSection relatedNonMembers(classe,
"Related Non-Members",
+ "",
"related non-member",
"related non-members");
FastSection staticPrivateMembers(classe,
"Static Private Members",
+ "",
"static private member",
"static private members");
FastSection staticProtectedMembers(classe,
"Static Protected Members",
+ "",
"static protected member",
"static protected members");
FastSection staticPublicMembers(classe,
"Static Public Members",
+ "",
"static public member",
"static public members");
- FastSection macros(inner, "Macros", "macro", "macros");
+ FastSection macros(inner, "Macros", "", "macro", "macros");
NodeList::ConstIterator r = classe->relatedNodes().begin();
while (r != classe->relatedNodes().end()) {
@@ -666,12 +677,12 @@ QList<Section> CppCodeMarker::sections(const InnerNode *inner,
append(sections, macros);
}
else if (style == Detailed) {
- FastSection memberFunctions(classe,"Member Function Documentation");
- FastSection memberTypes(classe,"Member Type Documentation");
- FastSection memberVariables(classe,"Member Variable Documentation");
- FastSection properties(classe,"Property Documentation");
- FastSection relatedNonMembers(classe,"Related Non-Members");
- FastSection macros(classe,"Macro Documentation");
+ FastSection memberFunctions(classe,"Member Function Documentation","func","member","members");
+ FastSection memberTypes(classe,"Member Type Documentation","types","member","members");
+ FastSection memberVariables(classe,"Member Variable Documentation","vars","member","members");
+ FastSection properties(classe,"Property Documentation","prop","member","members");
+ FastSection relatedNonMembers(classe,"Related Non-Members","relnonmem","member","members");
+ FastSection macros(classe,"Macro Documentation","macros","member","members");
NodeList::ConstIterator r = classe->relatedNodes().begin();
while (r != classe->relatedNodes().end()) {
@@ -717,7 +728,7 @@ QList<Section> CppCodeMarker::sections(const InnerNode *inner,
append(sections, macros);
}
else {
- FastSection all(classe);
+ FastSection all(classe,"","","member","members");
QStack<const ClassNode *> stack;
stack.push(classe);
@@ -747,25 +758,29 @@ QList<Section> CppCodeMarker::sections(const InnerNode *inner,
if (style == Summary || style == Detailed) {
FastSection namespaces(inner,
"Namespaces",
+ style == Detailed ? "nmspace" : "",
"namespace",
"namespaces");
FastSection classes(inner,
"Classes",
+ style == Detailed ? "classes" : "",
"class",
"classes");
FastSection types(inner,
- style == Summary ?
- "Types" : "Type Documentation",
+ style == Summary ? "Types" : "Type Documentation",
+ style == Detailed ? "types" : "",
"type",
"types");
FastSection functions(inner,
style == Summary ?
"Functions" : "Function Documentation",
+ style == Detailed ? "func" : "",
"function",
"functions");
FastSection macros(inner,
style == Summary ?
"Macros" : "Macro Documentation",
+ style == Detailed ? "macros" : "",
"macro",
"macros");
@@ -1116,26 +1131,32 @@ QList<Section> CppCodeMarker::qmlSections(const QmlClassNode* qmlClassNode,
if (style == Summary) {
FastSection qmlproperties(qmlClassNode,
"Properties",
+ "",
"property",
"properties");
FastSection qmlattachedproperties(qmlClassNode,
"Attached Properties",
+ "",
"property",
"properties");
FastSection qmlsignals(qmlClassNode,
- "Signals",
- "signal",
- "signals");
+ "Signals",
+ "",
+ "signal",
+ "signals");
FastSection qmlattachedsignals(qmlClassNode,
"Attached Signals",
+ "",
"signal",
"signals");
FastSection qmlmethods(qmlClassNode,
"Methods",
+ "",
"method",
"methods");
FastSection qmlattachedmethods(qmlClassNode,
"Attached Methods",
+ "",
"method",
"methods");
@@ -1179,12 +1200,15 @@ QList<Section> CppCodeMarker::qmlSections(const QmlClassNode* qmlClassNode,
append(sections,qmlattachedmethods);
}
else if (style == Detailed) {
- FastSection qmlproperties(qmlClassNode, "Property Documentation");
- FastSection qmlattachedproperties(qmlClassNode,"Attached Property Documentation");
- FastSection qmlsignals(qmlClassNode,"Signal Documentation");
- FastSection qmlattachedsignals(qmlClassNode,"Attached Signal Documentation");
- FastSection qmlmethods(qmlClassNode,"Method Documentation");
- FastSection qmlattachedmethods(qmlClassNode,"Attached Method Documentation");
+ FastSection qmlproperties(qmlClassNode, "Property Documentation","qmlprop","member","members");
+ FastSection qmlattachedproperties(qmlClassNode,"Attached Property Documentation","qmlattprop",
+ "member","members");
+ FastSection qmlsignals(qmlClassNode,"Signal Documentation","qmlsig","member","members");
+ FastSection qmlattachedsignals(qmlClassNode,"Attached Signal Documentation","qmlattsig",
+ "member","members");
+ FastSection qmlmethods(qmlClassNode,"Method Documentation","qmlmeth","member","members");
+ FastSection qmlattachedmethods(qmlClassNode,"Attached Method Documentation","qmlattmeth",
+ "member","members");
NodeList::ConstIterator c = qmlClassNode->childNodes().begin();
while (c != qmlClassNode->childNodes().end()) {
if ((*c)->subType() == Node::QmlPropertyGroup) {
diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp
index cd3da3e..fb9fa95 100644
--- a/tools/qdoc3/htmlgenerator.cpp
+++ b/tools/qdoc3/htmlgenerator.cpp
@@ -696,7 +696,7 @@ int HtmlGenerator::generateAtom(const Atom *atom,
QList<Section> sections;
QList<Section>::ConstIterator s;
for (int i=0; i<LastSinceType; ++i)
- sections.append(Section(sinceTitle(i),QString(),QString()));
+ sections.append(Section(sinceTitle(i),QString(),QString(),QString()));
NodeMultiMap::const_iterator n = nsmap.value().constBegin();
while (n != nsmap.value().constEnd()) {
@@ -1356,8 +1356,10 @@ void HtmlGenerator::generateClassLikeNode(const InnerNode *inner,
if (!inner->doc().isEmpty()) {
out() << "<hr />\n"
+ << "<div class=\"descr\"/>\n"
<< "<h2>" << "Detailed Description" << "</h2>\n";
generateBody(inner, marker);
+ out() << "</div>\n";
generateAlsoList(inner, marker);
}
@@ -1365,6 +1367,8 @@ void HtmlGenerator::generateClassLikeNode(const InnerNode *inner,
s = sections.begin();
while (s != sections.end()) {
out() << "<hr />\n";
+ if (!(*s).divClass.isEmpty())
+ out() << "<div class=\"" << (*s).divClass << "\"/>\n";
out() << "<h2>" << protectEnc((*s).name) << "</h2>\n";
NodeList::ConstIterator m = (*s).members.begin();
@@ -1414,6 +1418,8 @@ void HtmlGenerator::generateClassLikeNode(const InnerNode *inner,
}
++m;
}
+ if (!(*s).divClass.isEmpty())
+ out() << "</div>\n";
++s;
}
generateFooter(inner);
diff --git a/tools/qdoc3/qscodemarker.cpp b/tools/qdoc3/qscodemarker.cpp
index 89c9c5c..d4b8e80 100644
--- a/tools/qdoc3/qscodemarker.cpp
+++ b/tools/qdoc3/qscodemarker.cpp
@@ -279,11 +279,11 @@ QList<Section> QsCodeMarker::sections( const InnerNode *inner, SynopsisStyle sty
const ClassNode *classe = static_cast<const ClassNode *>(inner);
if ( style == Summary ) {
- FastSection enums(classe, "Enums", "enum", "enums");
- FastSection functions(classe, "Functions", "function", "functions");
- FastSection readOnlyProperties(classe, "Read-Only Properties", "property", "properties");
- FastSection signalz(classe, "Signals", "signal", "signals");
- FastSection writableProperties(classe, "Writable Properties", "property", "properties");
+ FastSection enums(classe, "Enums", "", "enum", "enums");
+ FastSection functions(classe, "Functions", "", "function", "functions");
+ FastSection readOnlyProperties(classe, "", "Read-Only Properties", "property", "properties");
+ FastSection signalz(classe, "Signals", "", "signal", "signals");
+ FastSection writableProperties(classe, "", "Writable Properties", "property", "properties");
QStack<const ClassNode *> stack;
stack.push( classe );
@@ -328,9 +328,9 @@ QList<Section> QsCodeMarker::sections( const InnerNode *inner, SynopsisStyle sty
append( sections, functions );
append( sections, signalz );
} else if ( style == Detailed ) {
- FastSection enums( classe, "Enum Documentation" );
- FastSection functionsAndSignals( classe, "Function and Signal Documentation" );
- FastSection properties( classe, "Property Documentation" );
+ FastSection enums( classe, "Enum Documentation", "", "member", "members");
+ FastSection functionsAndSignals( classe, "Function and Signal Documentation", "", "member", "members");
+ FastSection properties( classe, "Property Documentation", "", "member", "members");
NodeList::ConstIterator c = classe->childNodes().begin();
while ( c != classe->childNodes().end() ) {
@@ -349,7 +349,7 @@ QList<Section> QsCodeMarker::sections( const InnerNode *inner, SynopsisStyle sty
append( sections, properties );
append( sections, functionsAndSignals );
} else { // ( style == SeparateList )
- FastSection all( classe );
+ FastSection all(classe, "", "", "member", "members");
QStack<const ClassNode *> stack;
stack.push( classe );