From 4051e1cfc7f5d8a7017ca4ff7b30de483950a59b Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Tue, 7 Sep 2010 09:13:59 +0200 Subject: qdoc: Updated with current dita xml generation code from oslo-staging-1. --- tools/qdoc3/ditaxmlgenerator.cpp | 1250 +++++++++++++++++++++----------------- tools/qdoc3/ditaxmlgenerator.h | 22 +- tools/qdoc3/node.cpp | 4 +- tools/qdoc3/pagegenerator.cpp | 10 + 4 files changed, 717 insertions(+), 569 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index a83a321..3d1c53e 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -1,4 +1,3 @@ - /**************************************************************************** ** ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). @@ -378,6 +377,7 @@ DitaXmlGenerator::DitaXmlGenerator() inContents(false), inSectionHeading(false), inTableHeader(false), + inTableBody(false), numTableRows(0), threeColumnEnumValueTable(true), offlineDocs(true), @@ -385,7 +385,8 @@ DitaXmlGenerator::DitaXmlGenerator() myTree(0), slow(false), obsoleteLinks(false), - noLinks(0) + noLinks(0), + tableColumnCount(0) { } @@ -577,7 +578,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, int skipAhead = 0; QString hx; static bool in_para = false; - QString guid; + QString guid, hc; switch (atom->type()) { case Atom::AbstractLeft: @@ -649,37 +650,29 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, writer.writeCharacters(protectEnc(plainCode(atom->string()))); } else { - writer.writeCharacters(highlightedCode(atom->string(), marker, relative)); + writeText(atom->string(), marker, relative); } writer.writeEndElement(); // sse writeStartElement() above break; case Atom::Code: writer.writeStartElement("pre"); - writer.writeAttribute("outputclass","highlightedCode"); - writer.writeCharacters(trimmedTrailing(highlightedCode(indent(codeIndent,atom->string()), - marker, - relative))); + writer.writeAttribute("outputclass","highlightedcode"); + writeText(atom->string(), marker, relative); writer.writeEndElement(); // break; -#ifdef QDOC_QML case Atom::Qml: writer.writeStartElement("pre"); - writer.writeAttribute("outputclass","highlightedCode"); - writer.writeCharacters(trimmedTrailing(highlightedCode(indent(codeIndent,atom->string()), - marker, - relative))); + writer.writeAttribute("outputclass","highlightedcode"); + writeText(atom->string(), marker, relative); writer.writeEndElement(); // pre break; -#endif case Atom::CodeNew: writer.writeStartElement("p"); writer.writeCharacters("you can rewrite it as"); writer.writeEndElement(); //

writer.writeStartElement("pre"); - writer.writeAttribute("outputclass","highlightedCode"); - writer.writeCharacters(trimmedTrailing(highlightedCode(indent(codeIndent,atom->string()), - marker, - relative))); + writer.writeAttribute("outputclass","highlightedcode"); + writeText(atom->string(), marker, relative); writer.writeEndElement(); // break; case Atom::CodeOld: @@ -689,7 +682,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, // fallthrough case Atom::CodeBad: writer.writeStartElement("pre"); - writer.writeAttribute("outputclass","highlightedCode"); + writer.writeAttribute("outputclass","highlightedcode"); writer.writeCharacters(trimmedTrailing(protectEnc(plainCode(indent(codeIndent,atom->string()))))); writer.writeEndElement(); // break; @@ -1075,51 +1068,53 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, else if (atom->string() == ATOM_LIST_VALUE) { threeColumnEnumValueTable = isThreeColumnEnumValueTable(atom); if (threeColumnEnumValueTable) { - writer.writeStartElement("table"); + writer.writeStartElement("simpletable"); writer.writeAttribute("outputclass","valuelist"); - writer.writeStartElement("tr"); + writer.writeStartElement("sthead"); if (++numTableRows % 2 == 1) writer.writeAttribute("outputclass","odd"); else writer.writeAttribute("outputclass","even"); - writer.writeStartElement("th"); + writer.writeStartElement("stentry"); writer.writeCharacters("Constant"); - writer.writeEndElement(); // - writer.writeStartElement("th"); + writer.writeEndElement(); // + writer.writeStartElement("stentry"); writer.writeCharacters("Value"); - writer.writeEndElement(); // - writer.writeStartElement("th"); + writer.writeEndElement(); // + writer.writeStartElement("stentry"); writer.writeCharacters("Description"); - writer.writeEndElement(); // - writer.writeEndElement(); // + writer.writeEndElement(); // + writer.writeEndElement(); // } else { - writer.writeStartElement("table"); + writer.writeStartElement("simpletable"); writer.writeAttribute("outputclass","valuelist"); - writer.writeStartElement("tr"); - writer.writeStartElement("th"); + writer.writeStartElement("sthead"); + writer.writeStartElement("stentry"); writer.writeCharacters("Constant"); - writer.writeEndElement(); // - writer.writeStartElement("th"); + writer.writeEndElement(); // + writer.writeStartElement("stentry"); writer.writeCharacters("Value"); - writer.writeEndElement(); // - writer.writeEndElement(); // + writer.writeEndElement(); // + writer.writeEndElement(); // } } else { writer.writeStartElement("ol"); if (atom->string() == ATOM_LIST_UPPERALPHA) - writer.writeAttribute("type","A"); + writer.writeAttribute("outputclass","upperalpha"); else if (atom->string() == ATOM_LIST_LOWERALPHA) - writer.writeAttribute("type","a"); + writer.writeAttribute("outputclass","loweralpha"); else if (atom->string() == ATOM_LIST_UPPERROMAN) - writer.writeAttribute("type","I"); + writer.writeAttribute("outputclass","upperroman"); else if (atom->string() == ATOM_LIST_LOWERROMAN) - writer.writeAttribute("type","i"); + writer.writeAttribute("outputclass","lowerroman"); else // (atom->string() == ATOM_LIST_NUMERIC) - writer.writeAttribute("type","1"); - if (atom->next() != 0 && atom->next()->string().toInt() != 1) + writer.writeAttribute("outputclass","numeric"); + if (atom->next() != 0 && atom->next()->string().toInt() != 1) { + // I don't think this attribute is supported. writer.writeAttribute("start",atom->next()->string()); + } } break; case Atom::ListItemNumber: @@ -1130,15 +1125,15 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, writer.writeStartElement("dt"); } else { // (atom->string() == ATOM_LIST_VALUE) - writer.writeStartElement("tr"); - writer.writeStartElement("td"); + writer.writeStartElement("strow"); + writer.writeStartElement("stentry"); writer.writeAttribute("outputclass","topAlign"); writer.writeStartElement("tt"); writer.writeCharacters(protectEnc(plainCode(marker->markedUpEnumValue(atom->next()->string(), relative)))); writer.writeEndElement(); // - writer.writeEndElement(); // - writer.writeStartElement("td"); + writer.writeEndElement(); // + writer.writeStartElement("stentry"); writer.writeAttribute("outputclass","topAlign"); QString itemValue; @@ -1167,8 +1162,8 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, } else if (atom->string() == ATOM_LIST_VALUE) { if (threeColumnEnumValueTable) { - writer.writeEndElement(); // - writer.writeStartElement("td"); + writer.writeEndElement(); // + writer.writeStartElement("stentry"); writer.writeAttribute("outputclass","topAlign"); if (matchAhead(atom, Atom::ListItemRight)) writer.writeCharacters(" "); @@ -1185,8 +1180,8 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, writer.writeEndElement(); // } else if (atom->string() == ATOM_LIST_VALUE) { - writer.writeEndElement(); // - writer.writeEndElement(); // + writer.writeEndElement(); // + writer.writeEndElement(); // } else { writer.writeEndElement(); // @@ -1200,7 +1195,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, writer.writeEndElement(); // } else if (atom->string() == ATOM_LIST_VALUE) { - writer.writeEndElement(); // + writer.writeEndElement(); // } else { writer.writeEndElement(); // @@ -1264,61 +1259,80 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, } break; case Atom::TableLeft: - if (in_para) { - writer.writeEndElement(); //

- in_para = false; + { + if (in_para) { + writer.writeEndElement(); //

+ in_para = false; + } + writer.writeStartElement("table"); + writer.writeAttribute("outputclass","generic"); + numTableRows = 0; + if (tableColumnCount != 0) { + qDebug() << "ERROR: Nested tables!"; + tableColumnCount = 0; + } + const Atom* t = atom->next(); + while ((t->type() != Atom::TableHeaderRight) && + (t->type() != Atom::TableRowRight) && + (t->type() != Atom::TableRight)) { + if (t->type() == Atom::TableItemLeft) + ++tableColumnCount; + t = t->next(); + } + writer.writeStartElement("tgroup"); + writer.writeAttribute("cols",QString::number(tableColumnCount)); } - writer.writeStartElement("table"); - writer.writeAttribute("outputclass","generic"); - numTableRows = 0; break; case Atom::TableRight: + writer.writeEndElement(); // + writer.writeEndElement(); // writer.writeEndElement(); // + tableColumnCount = 0; break; case Atom::TableHeaderLeft: writer.writeStartElement("thead"); - writer.writeStartElement("tr"); + writer.writeStartElement("row"); writer.writeAttribute("outputclass","qt-style topAlign"); inTableHeader = true; + inTableBody = false; break; case Atom::TableHeaderRight: - writer.writeEndElement(); // + writer.writeEndElement(); // if (matchAhead(atom, Atom::TableHeaderLeft)) { skipAhead = 1; - writer.writeStartElement("tr"); + writer.writeStartElement("row"); writer.writeAttribute("outputclass","qt-style topAlign"); } else { writer.writeEndElement(); // inTableHeader = false; + inTableBody = true; + writer.writeStartElement("tbody"); } break; case Atom::TableRowLeft: - writer.writeStartElement("tr"); + if (!inTableHeader && !inTableBody) { + inTableBody = true; + writer.writeStartElement("tbody"); + } + writer.writeStartElement("row"); if (++numTableRows % 2 == 1) writer.writeAttribute("outputclass","odd topAlign"); else writer.writeAttribute("outputclass","even topAlign"); break; case Atom::TableRowRight: - writer.writeEndElement(); // \n"; + writer.writeEndElement(); // \n"; break; case Atom::TableItemLeft: { if (inTableHeader) - writer.writeStartElement("th"); + writer.writeStartElement("entry"); else - writer.writeStartElement("td"); + writer.writeStartElement("entry"); QStringList spans = atom->string().split(","); if (spans.size() == 2) { -#if zzz - - if (spans.at(0) != "1") - out() << " colspan=\"" << spans.at(0) << "\""; - if (spans.at(1) != "1") - out() << " rowspan=\"" << spans.at(1) << "\""; -#endif if (!inTableHeader) writer.writeStartElement("p"); } @@ -1328,10 +1342,10 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, break; case Atom::TableItemRight: if (inTableHeader) - writer.writeEndElement(); // + writer.writeEndElement(); // else { writer.writeEndElement(); //

- writer.writeEndElement(); // + writer.writeEndElement(); // } if (matchAhead(atom, Atom::ParaLeft)) skipAhead = 1; @@ -1384,12 +1398,10 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, writer.writeCharacters(protectEnc(atom->string())); writer.writeEndElement(); // break; -#ifdef QDOC_QML case Atom::QmlText: case Atom::EndQmlText: // don't do anything with these. They are just tags. break; -#endif default: // unknownAtom(atom); break; @@ -1398,7 +1410,9 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, } /*! - Generate a reference page for a C++ class. + Generate a element (and all the stuff inside it) + for the C++ class represented by \a innerNode. \a marker is + for marking up the code. I don't know what that means exactly. */ void DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* marker) @@ -1432,7 +1446,9 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark writer.writeCharacters(fullTitle); writer.writeEndElement(); // - generateBrief(inner, marker); + generateBrief(inner, marker); // + + // not included: writer.writeStartElement(CXXCLASSDETAIL); writer.writeStartElement(CXXCLASSDEFINITION); @@ -1445,7 +1461,10 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark writer.writeAttribute("value","abstract"); writer.writeEndElement(); // } - writeDerivations(cn, marker); + writeDerivations(cn, marker); // + + // not included: + writeLocation(cn); writer.writeEndElement(); // writer.writeStartElement(APIDESC); @@ -1456,12 +1475,18 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark writer.writeCharacters("Detailed Description"); writer.writeEndElement(); //

generateBody(inner, marker); - // generateAlsoList(inner, marker); + // generateAlsoList(inner, marker); } writer.writeEndElement(); // + + // not included: ,
, or + writer.writeEndElement(); // + // not included: + // not included: + sections = marker->sections(inner, CodeMarker::Detailed, CodeMarker::Okay); s = sections.begin(); while (s != sections.end()) { @@ -1483,199 +1508,11 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark } ++s; } - writer.writeEndElement(); // - } - -#ifdef WRITE_HTML - Text subtitleText; - if (rawTitle != fullTitle) - subtitleText << "(" << Atom(Atom::AutoLink, fullTitle) << ")" - << Atom(Atom::LineBreak); - - QString shortVersion; - shortVersion = project + " " + shortVersion + ": "; - shortVersion = myTree->version(); - if (shortVersion.count(QChar('.')) == 2) - shortVersion.truncate(shortVersion.lastIndexOf(QChar('.'))); - if (!shortVersion.isEmpty()) { - if (project == "QSA") - shortVersion = "QSA " + shortVersion + ": "; - else - shortVersion = "Qt " + shortVersion + ": "; - } - - out() << " " << shortVersion << protectEnc(title) << "\n"; - -#if 0 - out() << QString(postHeader).replace("\\" + COMMAND_VERSION, myTree->version()); - generateBreadCrumbs(title,node,marker); - out() << QString(postPostHeader).replace("\\" + COMMAND_VERSION, myTree->version()); -#endif - - sections = marker->sections(inner, CodeMarker::Summary, CodeMarker::Okay); - generateTableOfContents(inner,marker,§ions); - generateTitle(title, subtitleText, SmallSubTitle, inner, marker); - -#ifdef QDOC_QML - if (cn && !cn->qmlElement().isEmpty()) { - generateInstantiatedBy(cn,marker); - } -#endif - - generateBrief(inner, marker); - generateIncludes(inner, marker); - generateStatus(inner, marker); - if (cn) { - generateInherits(cn, marker); - generateInheritedBy(cn, marker); - } - generateThreadSafeness(inner, marker); - generateSince(inner, marker); - - out() << "
    \n"; - - QString membersLink = generateListOfAllMemberFile(inner, marker); - if (!membersLink.isEmpty()) - out() << "
  • " - << "List of all members, including inherited members
  • \n"; - - QString obsoleteLink = generateLowStatusMemberFile(inner, - marker, - CodeMarker::Obsolete); - if (!obsoleteLink.isEmpty()) - out() << "
  • " - << "Obsolete members
  • \n"; - - QString compatLink = generateLowStatusMemberFile(inner, - marker, - CodeMarker::Compat); - if (!compatLink.isEmpty()) - out() << "
  • " - << "Qt 3 support members
  • \n"; - - out() << "
\n"; - - bool needOtherSection = false; - - /* - sections is built above for the call to generateTableOfContents(). - */ - s = sections.begin(); - while (s != sections.end()) { - if (s->members.isEmpty() && s->reimpMembers.isEmpty()) { - if (!s->inherited.isEmpty()) - needOtherSection = true; - } - else { - if (!s->members.isEmpty()) { - out() << "
\n"; - out() << "\n"; - out() << "

" << protectEnc((*s).name) << "

\n"; - generateSection(s->members, inner, marker, CodeMarker::Summary); - } - if (!s->reimpMembers.isEmpty()) { - QString name = QString("Reimplemented ") + (*s).name; - out() << "
\n"; - out() << "\n"; - out() << "

" << protectEnc(name) << "

\n"; - generateSection(s->reimpMembers, inner, marker, CodeMarker::Summary); - } - - if (!s->inherited.isEmpty()) { - out() << "
    \n"; - generateSectionInheritedList(*s, inner, marker, true); - out() << "
\n"; - } - } - ++s; - } - - if (needOtherSection) { - out() << "

Additional Inherited Members

\n" - "
    \n"; - - s = sections.begin(); - while (s != sections.end()) { - if (s->members.isEmpty() && !s->inherited.isEmpty()) - generateSectionInheritedList(*s, inner, marker); - ++s; - } - out() << "
\n"; - } - - out() << "\n"; - - if (!inner->doc().isEmpty()) { - out() << "
\n" - << "
\n" // QTBUG-9504 - << "

" << "Detailed Description" << "

\n"; - generateBody(inner, marker); - out() << "
\n"; // QTBUG-9504 - generateAlsoList(inner, marker); - } - - sections = marker->sections(inner, CodeMarker::Detailed, CodeMarker::Okay); - s = sections.begin(); - while (s != sections.end()) { - out() << "
\n"; - if (!(*s).divClass.isEmpty()) - out() << "
\n"; // QTBUG-9504 - out() << "

" << protectEnc((*s).name) << "

\n"; - - NodeList::ConstIterator m = (*s).members.begin(); - while (m != (*s).members.end()) { - if ((*m)->access() != Node::Private) { // ### check necessary? - if ((*m)->type() != Node::Class) - generateDetailedMember(*m, inner, marker); - else { - out() << "

class "; - generateFullName(*m, inner, marker); - out() << "

"; - generateBrief(*m, marker, inner); - } - QStringList names; - names << (*m)->name(); - if ((*m)->type() == Node::Function) { - const FunctionNode *func = reinterpret_cast(*m); - if (func->metaness() == FunctionNode::Ctor || - func->metaness() == FunctionNode::Dtor || - func->overloadNumber() != 1) - names.clear(); - } - else if ((*m)->type() == Node::Property) { - const PropertyNode *prop = reinterpret_cast(*m); - if (!prop->getters().isEmpty() && - !names.contains(prop->getters().first()->name())) - names << prop->getters().first()->name(); - if (!prop->setters().isEmpty()) - names << prop->setters().first()->name(); - if (!prop->resetters().isEmpty()) - names << prop->resetters().first()->name(); - } - else if ((*m)->type() == Node::Enum) { - const EnumNode *enume = reinterpret_cast(*m); - if (enume->flagsType()) - names << enume->flagsType()->name(); + // not included: - foreach (const QString &enumName, - enume->doc().enumItemNames().toSet() - - enume->doc().omitEnumItemNames().toSet()) - names << plainCode(marker->markedUpEnumValue(enumName, - enume)); - } - } - ++m; - } - if (!(*s).divClass.isEmpty()) - out() << "
\n"; // QTBUG-9504 - ++s; + writer.writeEndElement(); // } -#endif } /*! @@ -1684,14 +1521,18 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark */ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) { - return; // zzz - SubTitleSize subTitleSize = LargeSubTitle; QList
sections; QList
::const_iterator s; QString fullTitle = fake->fullTitle(); QString htmlTitle = fullTitle; + /* + NOTE: For now we only handle \page elements. + */ + if (fake->subType() != Node::Page) + return; + if (fake->subType() == Node::File && !fake->subTitle().isEmpty()) { subTitleSize = SmallSubTitle; htmlTitle += " (" + fake->subTitle() + ")"; @@ -1702,7 +1543,30 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker } generateHeader(fake); - + + if (fake->subType() == Node::Page) { + writer.writeStartElement("topic"); + writer.writeAttribute("id",fake->guid()); + writer.writeStartElement("title"); + writer.writeCharacters(fullTitle); + writer.writeEndElement(); // + + generateBrief(fake, marker); // + + if (!fake->doc().isEmpty()) { + writer.writeStartElement("body"); + writer.writeStartElement("p"); + writer.writeAttribute("outputclass","h2"); + writer.writeCharacters("Detailed Description"); + writer.writeEndElement(); //

+ generateBody(fake, marker); + writer.writeEndElement(); // + } + writer.writeEndElement(); // + } +} + +#if 0 /* Generate the TOC for the new doc format. Don't generate a TOC for the home page. @@ -1715,7 +1579,7 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker subTitleSize, fake, marker); - + if (fake->subType() == Node::Module) { // Generate brief text and status for modules. generateBrief(fake, marker); @@ -1760,7 +1624,6 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker out() << "\n"; } -#ifdef QDOC_QML else if (fake->subType() == Node::QmlClass) { const QmlClassNode* qml_cn = static_cast(fake); const ClassNode* cn = qml_cn->classNode(); @@ -1800,7 +1663,8 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker return; } #endif - + +#if 0 sections = marker->sections(fake, CodeMarker::Summary, CodeMarker::Okay); s = sections.begin(); while (s != sections.end()) { @@ -1845,7 +1709,7 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker } ++s; } -} +#endif /*! Returns "xml" for this subclass of Generator. @@ -1943,6 +1807,12 @@ void DitaXmlGenerator::generateBreadCrumbs(const QString& title, } } +/*! + Outputs an XML file header depending on which kind of DITA + file is being generated. + + \note This does not cover all cases yet. + */ void DitaXmlGenerator::generateHeader(const Node* node) { writer.setDevice(out().device()); @@ -1953,18 +1823,28 @@ void DitaXmlGenerator::generateHeader(const Node* node) if (!node) return; - QString docType; + QString doctype; + QString element; QString dtd; + QString base; QString version; if (node->type() == Node::Class) { - docType = "cxxClass"; + element = "cxxClass"; dtd = "dtd/cxxClass.dtd"; version = "0.6.0"; + doctype = ""; + } + else if (node->type() == Node::Fake) { + if (node->subType() == Node::Page) { + element = "topic"; + dtd = "dtd/topic.dtd"; + doctype = ""; + } } - QString doctype = ""; writer.writeDTD(doctype); writer.writeComment(node->doc().location().fileName()); } @@ -1989,7 +1869,7 @@ void DitaXmlGenerator::generateTitle(const QString& title, } /*! - Outputs the brief command as a element. */ void DitaXmlGenerator::generateBrief(const Node* node, CodeMarker* marker) { @@ -2006,11 +1886,10 @@ void DitaXmlGenerator::generateBrief(const Node* node, CodeMarker* marker) void DitaXmlGenerator::generateIncludes(const InnerNode *inner, CodeMarker *marker) { if (!inner->includes().isEmpty()) { - out() << "
"
-              << trimmedTrailing(highlightedCode(indent(codeIndent,
-                                                        marker->markedUpIncludes(inner->includes())),
-                                                 marker,inner))
-              << "
"; + writer.writeStartElement("pree"); + writer.writeAttribute("outputclass","highlightedcode"); + writeText(marker->markedUpIncludes(inner->includes()), marker, inner); + writer.writeEndElement(); // } } @@ -2532,19 +2411,27 @@ void DitaXmlGenerator::generateCompactList(const Node *relative, Output the alphabet as a row of links. */ if (includeAlphabet) { - out() << "

"; + writer.writeStartElement("p"); + writer.writeAttribute("outputclass","centerAlign functionIndex"); + writer.writeStartElement("b"); for (int i = 0; i < 26; i++) { QChar ch('a' + i); - if (usedParagraphNames.contains(char('a' + i))) - out() << QString("%2 ").arg(ch).arg(ch.toUpper()); + if (usedParagraphNames.contains(char('a' + i))) { + writer.writeStartElement("xref"); + writer.writeAttribute("href",QString("#%1").arg(ch)); + writer.writeCharacters(QString(ch.toUpper())); + writer.writeEndElement(); // + } } - out() << "

\n"; + writer.writeEndElement(); // + writer.writeEndElement(); //

} /* - Output a
element to contain all the
elements. + Output a

element to contain all the

elements. */ - out() << "
\n"; + writer.writeStartElement("p"); + writer.writeAttribute("outputclass","compactlist flowListDiv"); for (int i=0; i. */ if (curParOffset == 0) { - if (i > 0) - out() << "
\n"; + if (i > 0) { + writer.writeEndElement(); // + writer.writeEndElement(); //
+ } + writer.writeStartElement("dl"); if (++numTableRows % 2 == 1) - out() << "
"; + writer.writeAttribute("outputclass","flowList odd"); else - out() << "
"; - out() << "
"; + writer.writeAttribute("outputclass","flowList even"); + writer.writeStartElement("dlentry"); + writer.writeStartElement("dt"); + writer.writeAttribute("outputclass","alphaChar"); if (includeAlphabet) { QChar c = paragraphName[curParNr][0].toLower(); - out() << QString("").arg(c); + writer.writeStartElement("a"); + writer.writeAttribute("name",c); } - out() << "" - << paragraphName[curParNr] - << ""; - out() << "
\n"; + writer.writeStartElement("b"); + writer.writeCharacters(paragraphName[curParNr]); + writer.writeEndElement(); // + writer.writeEndElement(); // } /* Output a
for the current offset in the current paragraph. */ - out() << "
"; + writer.writeStartElement("dd"); if ((curParNr < NumParagraphs) && !paragraphName[curParNr].isEmpty()) { NodeMap::Iterator it; @@ -2589,26 +2482,28 @@ void DitaXmlGenerator::generateCompactList(const Node *relative, Previously, we used generateFullName() for this, but we require some special formatting. */ - out() << ""; + writer.writeStartElement("xref"); + writer.writeAttribute("href",linkForNode(it.value(), relative)); QStringList pieces; if (it.value()->subType() == Node::QmlClass) pieces << it.value()->name(); else pieces = fullName(it.value(), relative, marker).split("::"); - out() << protectEnc(pieces.last()); - out() << ""; + writer.writeCharacters(protectEnc(pieces.last())); + writer.writeEndElement(); // if (pieces.size() > 1) { - out() << " ("; - generateFullName(it.value()->parent(), relative, marker); - out() << ")"; + writer.writeCharacters(" ("); + generateFullName(it.value()->parent(),relative,marker); + writer.writeCharacters(")"); } } - out() << "
\n"; + writer.writeEndElement(); // curParOffset++; } - out() << "
\n"; - out() << "
\n"; + writer.writeEndElement(); // + writer.writeEndElement(); // + writer.writeEndElement(); //

} void DitaXmlGenerator::generateFunctionIndex(const Node *relative, @@ -2624,16 +2519,10 @@ void DitaXmlGenerator::generateFunctionIndex(const Node *relative, char nextLetter = 'a'; char currentLetter; -#if 1 out() << "
    \n"; -#endif QMap::ConstIterator f = funcIndex.begin(); while (f != funcIndex.end()) { -#if 1 out() << "
  • "; -#else - out() << "

    "; -#endif out() << protectEnc(f.key()) << ":"; currentLetter = f.key()[0].unicode(); @@ -2648,17 +2537,11 @@ void DitaXmlGenerator::generateFunctionIndex(const Node *relative, generateFullName((*s)->parent(), relative, marker, *s); ++s; } -#if 1 out() << "

  • "; -#else - out() << "

    "; -#endif out() << "\n"; ++f; } -#if 1 out() << "
\n"; -#endif } void DitaXmlGenerator::generateLegaleseList(const Node *relative, @@ -2680,45 +2563,6 @@ void DitaXmlGenerator::generateLegaleseList(const Node *relative, } } -/*void DitaXmlGenerator::generateSynopsis(const Node *node, - const Node *relative, - CodeMarker *marker, - CodeMarker::SynopsisStyle style) -{ - QString marked = marker->markedUpSynopsis(node, relative, style); - QRegExp templateTag("(<[^@>]*>)"); - if (marked.indexOf(templateTag) != -1) { - QString contents = protectEnc(marked.mid(templateTag.pos(1), - templateTag.cap(1).length())); - marked.replace(templateTag.pos(1), templateTag.cap(1).length(), - contents); - } - marked.replace(QRegExp("<@param>([a-z]+)_([1-9n])"), - "\\1\\2"); - marked.replace("<@param>", ""); - marked.replace("", ""); - - if (style == CodeMarker::Summary) - marked.replace("@name>", "b>"); - - if (style == CodeMarker::SeparateList) { - QRegExp extraRegExp("<@extra>.*"); - extraRegExp.setMinimal(true); - marked.replace(extraRegExp, ""); - } - else { - marked.replace("<@extra>", "  "); - marked.replace("", ""); - } - - if (style != CodeMarker::Detailed) { - marked.replace("<@type>", ""); - marked.replace("", ""); - } - out() << highlightedCode(marked, marker, relative); -}*/ - -#ifdef QDOC_QML void DitaXmlGenerator::generateQmlItem(const Node *node, const Node *relative, CodeMarker *marker, @@ -2747,9 +2591,8 @@ void DitaXmlGenerator::generateQmlItem(const Node *node, marked.replace("<@type>", ""); marked.replace("", ""); } - out() << highlightedCode(marked, marker, relative); + writeText(marked, marker, relative); } -#endif void DitaXmlGenerator::generateOverviewList(const Node *relative, CodeMarker * /* marker */) { @@ -2882,13 +2725,24 @@ void DitaXmlGenerator::generateSection(const NodeList& nl, name_alignment = false; } if (name_alignment) { - out() << "\n"; + writer.writeStartElement("table"); + writer.writeAttribute("outputclass","alignedsummary"); + writer.writeStartElement("tgroup"); + writer.writeAttribute("cols","2"); + writer.writeStartElement("tbody"); } else { - if (twoColumn) - out() << "
\n" - << "\n"; - else - out() << "\n"; + QString marked = getMarkedUpSynopsis(*m, relative, marker, style); + writeText(marked, marker, relative, name_alignment); + if (name_alignment) { + writer.writeEndElement(); // + writer.writeEndElement(); // + } + else { + writer.writeEndElement(); // + } i++; ++m; } - if (name_alignment) - out() << "
"; - out() << "
    \n"; + if (twoColumn) { + writer.writeStartElement("table"); + writer.writeAttribute("outputclass","propsummary"); + writer.writeStartElement("tgroup"); + writer.writeAttribute("cols","1"); + writer.writeStartElement("tbody"); + writer.writeStartElement("row"); + writer.writeStartElement("entry"); + writer.writeAttribute("outputclass","topAlign"); + } + writer.writeStartElement("ul"); } int i = 0; @@ -2900,28 +2754,48 @@ void DitaXmlGenerator::generateSection(const NodeList& nl, } if (name_alignment) { - out() << "
"; + writer.writeStartElement("row"); + writer.writeStartElement("entry"); + writer.writeAttribute("outputclass","memItemLeft rightAlign topAlign"); } else { - if (twoColumn && i == (int) (nl.count() + 1) / 2) - out() << "
    \n"; - out() << "
  • "; + if (twoColumn && i == (int) (nl.count() + 1) / 2) { + writer.writeEndElement(); //
+ writer.writeEndElement(); // + writer.writeStartElement("entry"); + writer.writeAttribute("outputclass","topAlign"); + writer.writeStartElement("ul"); + } + writer.writeStartElement("li"); + writer.writeAttribute("outputclass","fn"); } - generateSynopsis(*m, relative, marker, style, name_alignment); - if (name_alignment) - out() << "
\n"; + if (name_alignment) { + writer.writeEndElement(); // + writer.writeEndElement(); // + writer.writeEndElement(); // + } else { - out() << "\n"; - if (twoColumn) - out() << "\n\n"; + writer.writeEndElement(); // + if (twoColumn) { + writer.writeEndElement(); // + writer.writeEndElement(); // + writer.writeEndElement(); // + writer.writeEndElement(); // + writer.writeEndElement(); // + } } } } @@ -2969,7 +2843,8 @@ void DitaXmlGenerator::generateSectionList(const Section& section, out() << "
  • "; } - generateSynopsis(*m, relative, marker, style, name_alignment); + QString marked = getMarkedUpSynopsis(*m, relative, marker, style); + writeText(marked, marker, relative, name_alignment); if (name_alignment) out() << "\n"; else @@ -3019,51 +2894,58 @@ void DitaXmlGenerator::generateSectionInheritedList(const Section& section, } } -void DitaXmlGenerator::generateSynopsis(const Node *node, - const Node *relative, - CodeMarker *marker, - CodeMarker::SynopsisStyle style, - bool nameAlignment) +/*! + Get the synopsis from the \a node using the \a relative + node if needed, and mark up the synopsis using \a marker. + Use the style to decide which kind of sysnopsis to build, + normally \c Summary or \c Detailed. Return the marked up + string. + */ +QString DitaXmlGenerator::getMarkedUpSynopsis(const Node* node, + const Node* relative, + CodeMarker* marker, + CodeMarker::SynopsisStyle style) { QString marked = marker->markedUpSynopsis(node, relative, style); QRegExp templateTag("(<[^@>]*>)"); if (marked.indexOf(templateTag) != -1) { QString contents = protectEnc(marked.mid(templateTag.pos(1), - templateTag.cap(1).length())); - marked.replace(templateTag.pos(1), templateTag.cap(1).length(), - contents); + templateTag.cap(1).length())); + marked.replace(templateTag.pos(1), + templateTag.cap(1).length(), + contents); } marked.replace(QRegExp("<@param>([a-z]+)_([1-9n])"), "\\1\\2"); - marked.replace("<@param>", ""); - marked.replace("", ""); + marked.replace("<@param>",""); + marked.replace("",""); if (style == CodeMarker::Summary) { - marked.replace("<@name>", ""); // was "" - marked.replace("", ""); // was "" + marked.replace("<@name>",""); // was "" + marked.replace("",""); // was "" } if (style == CodeMarker::SeparateList) { QRegExp extraRegExp("<@extra>.*"); extraRegExp.setMinimal(true); - marked.replace(extraRegExp, ""); - } else { - marked.replace("<@extra>", ""); - marked.replace("", ""); + marked.replace(extraRegExp,""); + } + else { + marked.replace("<@extra>",""); + marked.replace("",""); } if (style != CodeMarker::Detailed) { - marked.replace("<@type>", ""); - marked.replace("", ""); + marked.replace("<@type>",""); + marked.replace("",""); } - out() << highlightedCode(marked, marker, relative, style, nameAlignment); + return marked; } -QString DitaXmlGenerator::highlightedCode(const QString& markedCode, - CodeMarker *marker, - const Node *relative, - CodeMarker::SynopsisStyle , - bool nameAlignment) +void DitaXmlGenerator::writeText(const QString& markedCode, + CodeMarker* marker, + const Node* relative, + bool nameAlignment) { QString src = markedCode; QString html; @@ -3079,7 +2961,13 @@ QString DitaXmlGenerator::highlightedCode(const QString& markedCode, for (int i = 0, n = src.size(); i < n;) { if (src.at(i) == charLangle && src.at(i + 1).unicode() == '@') { if (nameAlignment && !done) {// && (i != 0)) Why was this here? - html += ""; + if (!html.isEmpty()) { + writer.writeCharacters(html); + html.clear(); + } + writer.writeEndElement(); // + writer.writeStartElement("entry"); + writer.writeAttribute("outputclass=","memItemRight bottomAlign"); done = true; } i += 2; @@ -3100,36 +2988,6 @@ QString DitaXmlGenerator::highlightedCode(const QString& markedCode, } } - - if (slow) { - // is this block ever used at all? - // replace all <@func> tags: "(<@func target=\"([^\"]*)\">)(.*)()" - src = html; - html = QString(); - static const QString funcTag("func"); - for (int i = 0, n = src.size(); i < n;) { - if (src.at(i) == charLangle && src.at(i + 1) == charAt) { - i += 2; - if (parseArg(src, funcTag, &i, n, &arg, &par1)) { - QString link = linkForNode( - marker->resolveTarget(par1.toString(), - myTree, - relative), - relative); - addLink(link, arg, &html); - par1 = QStringRef(); - } - else { - html += charLangle; - html += charAt; - } - } - else { - html += src.at(i++); - } - } - } - // replace all "(<@(type|headerfile|func)(?: +[^>]*)?>)(.*)()" tags src = html; html = QString(); @@ -3225,8 +3083,8 @@ QString DitaXmlGenerator::highlightedCode(const QString& markedCode, ++i; } } - - return html; + if (!html.isEmpty()) + writer.writeCharacters(html); } void DitaXmlGenerator::generateLink(const Atom* atom, @@ -3406,29 +3264,6 @@ QString DitaXmlGenerator::fileBase(const Node *node) return result; } -#if 0 -QString DitaXmlGenerator::fileBase(const Node *node, - const SectionIterator& section) -{ - QStringList::ConstIterator s = section.sectionNumber().end(); - QStringList::ConstIterator b = section.baseNameStack().end(); - - QString suffix; - QString base = fileBase(node); - - while (s != section.sectionNumber().begin()) { - --s; - --b; - if (!(*b).isEmpty()) { - base = *b; - break; - } - suffix.prepend("-" + *s); - } - return base + suffix; -} -#endif - QString DitaXmlGenerator::fileName(const Node *node) { if (node->type() == Node::Fake) { @@ -3474,23 +3309,19 @@ QString DitaXmlGenerator::refForNode(const Node *node) ref += "-" + QString::number(func->overloadNumber()); } break; -#ifdef QDOC_QML case Node::Fake: if (node->subType() != Node::QmlPropertyGroup) break; case Node::QmlProperty: -#endif case Node::Property: ref = node->name() + "-prop"; break; -#ifdef QDOC_QML case Node::QmlSignal: ref = node->name() + "-signal"; break; case Node::QmlMethod: ref = node->name() + "-method"; break; -#endif case Node::Variable: ref = node->name() + "-var"; break; @@ -3542,59 +3373,54 @@ QString DitaXmlGenerator::refForAtom(Atom *atom, const Node * /* node */) } } -void DitaXmlGenerator::generateFullName(const Node *apparentNode, - const Node *relative, - CodeMarker *marker, - const Node *actualNode) +void DitaXmlGenerator::generateFullName(const Node* apparentNode, + const Node* relative, + CodeMarker* marker, + const Node* actualNode) { if (actualNode == 0) actualNode = apparentNode; - out() << "status() != actualNode->status()) { switch (actualNode->status()) { case Node::Obsolete: - out() << "\" class=\"obsolete"; + writer.writeAttribute("outputclass","obsolete"); break; case Node::Compat: - out() << "\" class=\"compat"; + writer.writeAttribute("outputclass","compat"); break; default: ; } } - out() << "\">"; - out() << protectEnc(fullName(apparentNode, relative, marker)); - out() << ""; + writer.writeCharacters(protectEnc(fullName(apparentNode, relative, marker))); + writer.writeEndElement(); // } -void DitaXmlGenerator::generateDetailedMember(const Node *node, - const InnerNode *relative, - CodeMarker *marker) +void DitaXmlGenerator::generateDetailedMember(const Node* node, + const InnerNode* relative, + CodeMarker* marker) { - const EnumNode *enume; + QString marked; + const EnumNode* en; -#ifdef GENERATE_MAC_REFS - generateMacRef(node, marker); -#endif - if (node->type() == Node::Enum - && (enume = static_cast(node))->flagsType()) { -#ifdef GENERATE_MAC_REFS - generateMacRef(enume->flagsType(), marker); -#endif + if ((node->type() == Node::Enum) && + (en = static_cast(node))->flagsType()) { out() << "

    "; out() << ""; - generateSynopsis(enume, relative, marker, CodeMarker::Detailed); + marked = getMarkedUpSynopsis(en, relative, marker, CodeMarker::Detailed); + writeText(marked, marker, relative); out() << "
    "; - generateSynopsis(enume->flagsType(), - relative, - marker, - CodeMarker::Detailed); + marked = getMarkedUpSynopsis(en->flagsType(),relative,marker,CodeMarker::Detailed); + writeText(marked,marker,relative); out() << "

    \n"; } else { out() << "

    "; out() << ""; - generateSynopsis(node, relative, marker, CodeMarker::Detailed); + marked = getMarkedUpSynopsis(node,relative,marker,CodeMarker::Detailed); + writeText(marked,marker,relative); out() << "

    \n"; } @@ -3626,14 +3452,14 @@ void DitaXmlGenerator::generateDetailedMember(const Node *node, } } else if (node->type() == Node::Enum) { - const EnumNode *enume = static_cast(node); - if (enume->flagsType()) { - out() << "

    The " << protectEnc(enume->flagsType()->name()) + en = static_cast(node); + if (en->flagsType()) { + out() << "

    The " << protectEnc(en->flagsType()->name()) << " type is a typedef for " << "QFlags<" - << protectEnc(enume->name()) + << protectEnc(en->name()) << ">. It stores an OR combination of " - << protectEnc(enume->name()) + << protectEnc(en->name()) << " values.

    \n"; } } @@ -3694,8 +3520,8 @@ void DitaXmlGenerator::findAllClasses(const InnerNode *node) } /*! - For generating the "New Classes... in 4.6" section on the - What's New in 4.6" page. + For generating the "New Classes... in 4.x" section on the + What's New in 4.x" page. */ void DitaXmlGenerator::findAllSince(const InnerNode *node) { @@ -3757,13 +3583,6 @@ void DitaXmlGenerator::findAllSince(const InnerNode *node) } } -#if 0 - const QRegExp versionSeparator("[\\-\\.]"); - const int minorIndex = version.indexOf(versionSeparator); - const int patchIndex = version.indexOf(versionSeparator, minorIndex+1); - version = version.left(patchIndex); -#endif - void DitaXmlGenerator::findAllFunctions(const InnerNode *node) { NodeList::ConstIterator c = node->childNodes().begin(); @@ -3835,12 +3654,6 @@ int DitaXmlGenerator::hOffset(const Node *node) return 2; case Node::Fake: return 1; -#if 0 - if (node->doc().briefText().isEmpty()) - return 1; - else - return 2; -#endif case Node::Enum: case Node::Typedef: case Node::Function: @@ -3986,14 +3799,6 @@ QString DitaXmlGenerator::getLink(const Atom *atom, << (*node)->name() << "no relative"; } } -#if 0 - else if ((*node)->status() == Node::Deprecated) { - qDebug() << "Link to Deprecated entity"; - } - else if ((*node)->status() == Node::Internal) { - qDebug() << "Link to Internal entity"; - } -#endif } while (!path.isEmpty()) { @@ -4070,21 +3875,6 @@ void DitaXmlGenerator::generateStatus(const Node *node, CodeMarker *marker) } } -#ifdef GENERATE_MAC_REFS -/* - No longer valid. - */ -void DitaXmlGenerator::generateMacRef(const Node *node, CodeMarker *marker) -{ - if (!pleaseGenerateMacRef || marker == 0) - return; - - QStringList macRefs = marker->macRefsForNode(node); - foreach (const QString &macRef, macRefs) - out() << "\n"; -} -#endif - void DitaXmlGenerator::beginLink(const QString &link, const Node *node, const Node *relative, @@ -4143,8 +3933,6 @@ void DitaXmlGenerator::endLink() inObsoleteLink = false; } -#ifdef QDOC_QML - /*! Generates the summary for the \a section. Only used for sections of QML element documentation. @@ -4196,10 +3984,8 @@ void DitaXmlGenerator::generateDetailedQmlMember(const Node *node, const InnerNode *relative, CodeMarker *marker) { + QString marked; const QmlPropertyNode* qpn = 0; -#ifdef GENERATE_MAC_REFS - generateMacRef(node, marker); -#endif out() << "
    "; if (node->subType() == Node::QmlPropertyGroup) { const QmlPropGroupNode* qpgn = static_cast(node); @@ -4242,7 +4028,8 @@ void DitaXmlGenerator::generateDetailedQmlMember(const Node *node, out() << ""; out() << "

    "; out() << ""; - generateSynopsis(qsn,relative,marker,CodeMarker::Detailed,false); + marked = getMarkedUpSynopsis(qsn, relative, marker, CodeMarker::Detailed); + writeText(marked, marker, relative); //generateQmlItem(qsn,relative,marker,false); out() << "

    "; out() << ""; @@ -4259,7 +4046,8 @@ void DitaXmlGenerator::generateDetailedQmlMember(const Node *node, out() << ""; out() << "

    "; out() << ""; - generateSynopsis(qmn,relative,marker,CodeMarker::Detailed,false); + marked = getMarkedUpSynopsis(qmn, relative, marker, CodeMarker::Detailed); + writeText(marked, marker, relative); out() << "

    "; out() << ""; out() << "
    "; @@ -4510,8 +4298,6 @@ void DitaXmlGenerator::generatePageIndex(const QString& fileName, CodeMarker* ma file.close(); } -#endif - /*! Return the full qualification of the node \a n, but without the name of \a n itself. e.g. A::B::C @@ -4537,6 +4323,26 @@ QString DitaXmlGenerator::fullQualification(const Node* n) return fq; } +/*! + Outputs the element. + \code + + + ... + + ... + + \endcode + + The element is: + + \code + + + Base + + \endcode + */ void DitaXmlGenerator::writeDerivations(const ClassNode* cn, CodeMarker* marker) { QList::ConstIterator r; @@ -4551,17 +4357,31 @@ void DitaXmlGenerator::writeDerivations(const ClassNode* cn, CodeMarker* marker) writer.writeStartElement(CXXCLASSDERIVATIONACCESSSPECIFIER); writer.writeAttribute("value",(*r).accessString()); writer.writeEndElement(); // + + // not included: + writer.writeStartElement(CXXCLASSBASECLASS); writer.writeAttribute("href",(*r).node->ditaXmlHref()); writer.writeCharacters(marker->plainFullName((*r).node)); writer.writeEndElement(); // + + // not included: or + writer.writeEndElement(); // + + // not included: + ++r; } writer.writeEndElement(); // } } +/*! + Writes a element, depending on the + type of the node \a n, which can be a class, function, enum, + typedef, or property. + */ void DitaXmlGenerator::writeLocation(const Node* n) { QString s1, s2, s3; @@ -4601,9 +4421,16 @@ void DitaXmlGenerator::writeLocation(const Node* n) QString lineNr; writer.writeAttribute("value",lineNr.setNum(n->location().lineNo())); writer.writeEndElement(); // DeclarationFileLine> + + // not included: , , + // and + writer.writeEndElement(); // ApiItemLocation> } +/*! + Write the elements. + */ void DitaXmlGenerator::writeFunctions(const Section& s, const ClassNode* cn, CodeMarker* marker) @@ -4615,28 +4442,42 @@ void DitaXmlGenerator::writeFunctions(const Section& s, writer.writeStartElement(CXXFUNCTION); writer.writeAttribute("id",fn->guid()); writer.writeStartElement(APINAME); + if (fn->metaness() == FunctionNode::Signal) + writer.writeAttribute("class","signal"); + else if (fn->metaness() == FunctionNode::Slot) + writer.writeAttribute("class","slot"); writer.writeCharacters(fn->name()); writer.writeEndElement(); // generateBrief(fn,marker); + + // not included: + writer.writeStartElement(CXXFUNCTIONDETAIL); writer.writeStartElement(CXXFUNCTIONDEFINITION); writer.writeStartElement(CXXFUNCTIONACCESSSPECIFIER); writer.writeAttribute("value",fn->accessString()); writer.writeEndElement(); // + // not included: + if (fn->isStatic()) { writer.writeStartElement(CXXFUNCTIONSTORAGECLASSSPECIFIERSTATIC); writer.writeAttribute("name","static"); writer.writeAttribute("value","static"); writer.writeEndElement(); // } - + + // not included: , + if (fn->isConst()) { writer.writeStartElement(CXXFUNCTIONCONST); writer.writeAttribute("name","const"); writer.writeAttribute("value","const"); writer.writeEndElement(); // } + + // not included: + // virtualness() != FunctionNode::NonVirtual) { writer.writeStartElement(CXXFUNCTIONVIRTUAL); @@ -4668,6 +4509,9 @@ void DitaXmlGenerator::writeFunctions(const Section& s, writer.writeCharacters(fn->returnType()); writer.writeEndElement(); // } + + // not included: + QString fq = fullQualification(fn); if (!fq.isEmpty()) { writer.writeStartElement(CXXFUNCTIONSCOPEDNAME); @@ -4707,6 +4551,9 @@ void DitaXmlGenerator::writeFunctions(const Section& s, } writer.writeEndElement(); // + + // not included: ,
    , or + writer.writeEndElement(); // writer.writeEndElement(); // @@ -4719,6 +4566,9 @@ void DitaXmlGenerator::writeFunctions(const Section& s, } } +/*! + This function writes the element. + */ void DitaXmlGenerator::writeParameters(const FunctionNode* fn, CodeMarker* marker) { const QList& parameters = fn->parameters(); @@ -4735,11 +4585,17 @@ void DitaXmlGenerator::writeParameters(const FunctionNode* fn, CodeMarker* marke writer.writeStartElement(CXXFUNCTIONPARAMETERDECLARATIONNAME); writer.writeCharacters((*p).name()); writer.writeEndElement(); // + + // not included: + if (!(*p).defaultValue().isEmpty()) { writer.writeStartElement(CXXFUNCTIONPARAMETERDEFAULTVALUE); writer.writeCharacters((*p).defaultValue()); writer.writeEndElement(); // } + + // not included: + writer.writeEndElement(); // ++p; } @@ -4747,6 +4603,9 @@ void DitaXmlGenerator::writeParameters(const FunctionNode* fn, CodeMarker* marke } } +/*! + This function writes the enum types. + */ void DitaXmlGenerator::writeEnumerations(const Section& s, const ClassNode* cn, CodeMarker* marker) @@ -4761,6 +4620,9 @@ void DitaXmlGenerator::writeEnumerations(const Section& s, writer.writeCharacters(en->name()); writer.writeEndElement(); // generateBrief(en,marker); + + // not included + writer.writeStartElement(CXXENUMERATIONDETAIL); writer.writeStartElement(CXXENUMERATIONDEFINITION); writer.writeStartElement(CXXENUMERATIONACCESSSPECIFIER); @@ -4797,6 +4659,8 @@ void DitaXmlGenerator::writeEnumerations(const Section& s, writer.writeCharacters(en->parent()->name() + "::" + en->name()); writer.writeEndElement(); // + // not included: + if (!items.isEmpty()) { writer.writeStartElement(CXXENUMERATORS); QList::ConstIterator i = items.begin(); @@ -4824,6 +4688,9 @@ void DitaXmlGenerator::writeEnumerations(const Section& s, writer.writeAttribute("value", (*i).value()); writer.writeEndElement(); // } + + // not included: + if (!(*i).text().isEmpty()) { writer.writeStartElement(APIDESC); generateText((*i).text(), en, marker); @@ -4844,13 +4711,22 @@ void DitaXmlGenerator::writeEnumerations(const Section& s, } writer.writeEndElement(); // + + // not included: ,
    , or + writer.writeEndElement(); // + + // not included: + writer.writeEndElement(); // } ++m; } } +/*! + This function writes the output for the \typedef commands. + */ void DitaXmlGenerator::writeTypedefs(const Section& s, const ClassNode* cn, CodeMarker* marker) @@ -4865,22 +4741,32 @@ void DitaXmlGenerator::writeTypedefs(const Section& s, writer.writeCharacters(tn->name()); writer.writeEndElement(); // generateBrief(tn,marker); + + // not included: + writer.writeStartElement(CXXTYPEDEFDETAIL); writer.writeStartElement(CXXTYPEDEFDEFINITION); writer.writeStartElement(CXXTYPEDEFACCESSSPECIFIER); writer.writeAttribute("value",tn->accessString()); writer.writeEndElement(); // + // not included: + QString fq = fullQualification(tn); if (!fq.isEmpty()) { writer.writeStartElement(CXXTYPEDEFSCOPEDNAME); writer.writeCharacters(fq); writer.writeEndElement(); // } + + // not included: + writer.writeStartElement(CXXTYPEDEFNAMELOOKUP); writer.writeCharacters(tn->parent()->name() + "::" + tn->name()); writer.writeEndElement(); // - + + // not included: + writeLocation(tn); writer.writeEndElement(); // writer.writeStartElement(APIDESC); @@ -4890,13 +4776,23 @@ void DitaXmlGenerator::writeTypedefs(const Section& s, } writer.writeEndElement(); // + + // not included: ,
    , or + writer.writeEndElement(); // + + // not included: + writer.writeEndElement(); // } ++m; } } +/*! + This function writes the output for the \property commands. + This is the Q_PROPERTYs. + */ void DitaXmlGenerator::writeProperties(const Section& s, const ClassNode* cn, CodeMarker* marker) @@ -4911,12 +4807,20 @@ void DitaXmlGenerator::writeProperties(const Section& s, writer.writeCharacters(pn->name()); writer.writeEndElement(); // generateBrief(pn,marker); + + // not included: + writer.writeStartElement(CXXVARIABLEDETAIL); writer.writeStartElement(CXXVARIABLEDEFINITION); writer.writeStartElement(CXXVARIABLEACCESSSPECIFIER); writer.writeAttribute("value",pn->accessString()); writer.writeEndElement(); // + // not included: , + // , + // , + // , + if (!pn->qualifiedDataType().isEmpty()) { writer.writeStartElement(CXXVARIABLEDECLAREDTYPE); writer.writeCharacters(pn->qualifiedDataType()); @@ -4934,10 +4838,10 @@ void DitaXmlGenerator::writeProperties(const Section& s, writer.writeCharacters(pn->qualifiedDataType()); writer.writeCharacters(" "); writer.writeCharacters(pn->name()); - writePropParams("READ",pn->getters()); - writePropParams("WRITE",pn->setters()); - writePropParams("RESET",pn->resetters()); - writePropParams("NOTIFY",pn->notifiers()); + writePropertyParameter("READ",pn->getters()); + writePropertyParameter("WRITE",pn->setters()); + writePropertyParameter("RESET",pn->resetters()); + writePropertyParameter("NOTIFY",pn->notifiers()); if (pn->isDesignable() != pn->designableDefault()) { writer.writeCharacters(" DESIGNABLE "); if (!pn->runtimeDesignabilityFunction().isEmpty()) @@ -4988,13 +4892,22 @@ void DitaXmlGenerator::writeProperties(const Section& s, } writer.writeEndElement(); // + + // not included: ,
    , or + writer.writeEndElement(); // + + // not included: + writer.writeEndElement(); // } ++m; } } +/*! + This function outputs the nodes resulting from \variable commands. + */ void DitaXmlGenerator::writeDataMembers(const Section& s, const ClassNode* cn, CodeMarker* marker) @@ -5009,12 +4922,17 @@ void DitaXmlGenerator::writeDataMembers(const Section& s, writer.writeCharacters(vn->name()); writer.writeEndElement(); // generateBrief(vn,marker); + + // not included: + writer.writeStartElement(CXXVARIABLEDETAIL); writer.writeStartElement(CXXVARIABLEDEFINITION); writer.writeStartElement(CXXVARIABLEACCESSSPECIFIER); writer.writeAttribute("value",vn->accessString()); writer.writeEndElement(); // + // not included: + if (vn->isStatic()) { writer.writeStartElement(CXXVARIABLESTORAGECLASSSPECIFIERSTATIC); writer.writeAttribute("name","static"); @@ -5022,6 +4940,9 @@ void DitaXmlGenerator::writeDataMembers(const Section& s, writer.writeEndElement(); // } + // not included: , + // , + writer.writeStartElement(CXXVARIABLEDECLAREDTYPE); writer.writeCharacters(vn->leftType()); if (!vn->rightType().isEmpty()) @@ -5047,6 +4968,8 @@ void DitaXmlGenerator::writeDataMembers(const Section& s, writer.writeCharacters(vn->parent()->name() + "::" + vn->name()); writer.writeEndElement(); // + // not included: + writeLocation(vn); writer.writeEndElement(); // writer.writeStartElement(APIDESC); @@ -5056,13 +4979,22 @@ void DitaXmlGenerator::writeDataMembers(const Section& s, } writer.writeEndElement(); // + + // not included: ,
    , + writer.writeEndElement(); // + + // not included: + writer.writeEndElement(); // } ++m; } } +/*! + This function writes a \macro as a . + */ void DitaXmlGenerator::writeMacros(const Section& s, const ClassNode* cn, CodeMarker* marker) @@ -5078,6 +5010,9 @@ void DitaXmlGenerator::writeMacros(const Section& s, writer.writeCharacters(fn->name()); writer.writeEndElement(); // generateBrief(fn,marker); + + // not included: + writer.writeStartElement(CXXDEFINEDETAIL); writer.writeStartElement(CXXDEFINEDEFINITION); writer.writeStartElement(CXXDEFINEACCESSSPECIFIER); @@ -5125,6 +5060,9 @@ void DitaXmlGenerator::writeMacros(const Section& s, writer.writeStartElement(CXXDEFINEPARAMETERDECLARATIONNAME); writer.writeCharacters(params[i]); writer.writeEndElement(); // + + // not included: + writer.writeEndElement(); // } writer.writeEndElement(); // @@ -5140,7 +5078,13 @@ void DitaXmlGenerator::writeMacros(const Section& s, } writer.writeEndElement(); // + + // not included: ,
    , or + writer.writeEndElement(); // + + // not included: + writer.writeEndElement(); // } } @@ -5148,7 +5092,12 @@ void DitaXmlGenerator::writeMacros(const Section& s, } } -void DitaXmlGenerator::writePropParams(const QString& tag, const NodeList& nlist) +/*! + This function writes one parameter of a Q_PROPERTY macro. + The property is identified by \a tag ("READ" "WRIE" etc), + and it is found in the 'a nlist. + */ +void DitaXmlGenerator::writePropertyParameter(const QString& tag, const NodeList& nlist) { NodeList::const_iterator n = nlist.begin(); while (n != nlist.end()) { @@ -5161,3 +5110,192 @@ void DitaXmlGenerator::writePropParams(const QString& tag, const NodeList& nlist } QT_END_NAMESPACE + +#ifdef TO_BE_INCLUDED_IN_API_DESC + Text subtitleText; + if (rawTitle != fullTitle) + subtitleText << "(" << Atom(Atom::AutoLink, fullTitle) << ")" + << Atom(Atom::LineBreak); + + QString shortVersion; + shortVersion = project + " " + shortVersion + ": "; + shortVersion = myTree->version(); + if (shortVersion.count(QChar('.')) == 2) + shortVersion.truncate(shortVersion.lastIndexOf(QChar('.'))); + if (!shortVersion.isEmpty()) { + if (project == "QSA") + shortVersion = "QSA " + shortVersion + ": "; + else + shortVersion = "Qt " + shortVersion + ": "; + } + + out() << " " << shortVersion << protectEnc(title) << "\n"; + +#if 0 + out() << QString(postHeader).replace("\\" + COMMAND_VERSION, myTree->version()); + generateBreadCrumbs(title,node,marker); + out() << QString(postPostHeader).replace("\\" + COMMAND_VERSION, myTree->version()); +#endif + + sections = marker->sections(inner, CodeMarker::Summary, CodeMarker::Okay); + generateTableOfContents(inner,marker,§ions); + generateTitle(title, subtitleText, SmallSubTitle, inner, marker); + + if (cn && !cn->qmlElement().isEmpty()) { + generateInstantiatedBy(cn,marker); + } + + generateBrief(inner, marker); + generateIncludes(inner, marker); + generateStatus(inner, marker); + if (cn) { + generateInherits(cn, marker); + generateInheritedBy(cn, marker); + } + generateThreadSafeness(inner, marker); + generateSince(inner, marker); + + out() << "
      \n"; + + QString membersLink = generateListOfAllMemberFile(inner, marker); + if (!membersLink.isEmpty()) + out() << "
    • " + << "List of all members, including inherited members
    • \n"; + + QString obsoleteLink = generateLowStatusMemberFile(inner, + marker, + CodeMarker::Obsolete); + if (!obsoleteLink.isEmpty()) + out() << "
    • " + << "Obsolete members
    • \n"; + + QString compatLink = generateLowStatusMemberFile(inner, + marker, + CodeMarker::Compat); + if (!compatLink.isEmpty()) + out() << "
    • " + << "Qt 3 support members
    • \n"; + + out() << "
    \n"; + + bool needOtherSection = false; + + /* + sections is built above for the call to generateTableOfContents(). + */ + s = sections.begin(); + while (s != sections.end()) { + if (s->members.isEmpty() && s->reimpMembers.isEmpty()) { + if (!s->inherited.isEmpty()) + needOtherSection = true; + } + else { + if (!s->members.isEmpty()) { + out() << "
    \n"; + out() << "\n"; + out() << "

    " << protectEnc((*s).name) << "

    \n"; + generateSection(s->members, inner, marker, CodeMarker::Summary); + } + if (!s->reimpMembers.isEmpty()) { + QString name = QString("Reimplemented ") + (*s).name; + out() << "
    \n"; + out() << "\n"; + out() << "

    " << protectEnc(name) << "

    \n"; + generateSection(s->reimpMembers, inner, marker, CodeMarker::Summary); + } + + if (!s->inherited.isEmpty()) { + out() << "
      \n"; + generateSectionInheritedList(*s, inner, marker, true); + out() << "
    \n"; + } + } + ++s; + } + + if (needOtherSection) { + out() << "

    Additional Inherited Members

    \n" + "
      \n"; + + s = sections.begin(); + while (s != sections.end()) { + if (s->members.isEmpty() && !s->inherited.isEmpty()) + generateSectionInheritedList(*s, inner, marker); + ++s; + } + out() << "
    \n"; + } + + out() << "\n"; + + if (!inner->doc().isEmpty()) { + out() << "
    \n" + << "
    \n" // QTBUG-9504 + << "

    " << "Detailed Description" << "

    \n"; + generateBody(inner, marker); + out() << "
    \n"; // QTBUG-9504 + generateAlsoList(inner, marker); + } + + sections = marker->sections(inner, CodeMarker::Detailed, CodeMarker::Okay); + s = sections.begin(); + while (s != sections.end()) { + out() << "
    \n"; + if (!(*s).divClass.isEmpty()) + out() << "
    \n"; // QTBUG-9504 + out() << "

    " << protectEnc((*s).name) << "

    \n"; + + NodeList::ConstIterator m = (*s).members.begin(); + while (m != (*s).members.end()) { + if ((*m)->access() != Node::Private) { // ### check necessary? + if ((*m)->type() != Node::Class) + generateDetailedMember(*m, inner, marker); + else { + out() << "

    class "; + generateFullName(*m, inner, marker); + out() << "

    "; + generateBrief(*m, marker, inner); + } + + QStringList names; + names << (*m)->name(); + if ((*m)->type() == Node::Function) { + const FunctionNode *func = reinterpret_cast(*m); + if (func->metaness() == FunctionNode::Ctor || + func->metaness() == FunctionNode::Dtor || + func->overloadNumber() != 1) + names.clear(); + } + else if ((*m)->type() == Node::Property) { + const PropertyNode *prop = reinterpret_cast(*m); + if (!prop->getters().isEmpty() && + !names.contains(prop->getters().first()->name())) + names << prop->getters().first()->name(); + if (!prop->setters().isEmpty()) + names << prop->setters().first()->name(); + if (!prop->resetters().isEmpty()) + names << prop->resetters().first()->name(); + } + else if ((*m)->type() == Node::Enum) { + const EnumNode *enume = reinterpret_cast(*m); + if (enume->flagsType()) + names << enume->flagsType()->name(); + + foreach (const QString &enumName, + enume->doc().enumItemNames().toSet() - + enume->doc().omitEnumItemNames().toSet()) + names << plainCode(marker->markedUpEnumValue(enumName, + enume)); + } + } + ++m; + } + if (!(*s).divClass.isEmpty()) + out() << "
    \n"; // QTBUG-9504 + ++s; + } +#endif // TO_BE_INCLUDED_IN_API_DESC diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index 446f735..91d7147 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -133,7 +133,7 @@ class DitaXmlGenerator : public PageGenerator void writeMacros(const Section& s, const ClassNode* cn, CodeMarker* marker); - void writePropParams(const QString& tag, const NodeList& nlist); + void writePropertyParameter(const QString& tag, const NodeList& nlist); private: enum SubTitleSize { SmallSubTitle, LargeSubTitle }; @@ -205,20 +205,18 @@ class DitaXmlGenerator : public PageGenerator const Node *relative, CodeMarker *marker, CodeMarker::SynopsisStyle style); - void generateSynopsis(const Node *node, - const Node *relative, - CodeMarker *marker, - CodeMarker::SynopsisStyle style, - bool nameAlignment = false); + QString getMarkedUpSynopsis(const Node *node, + const Node *relative, + CodeMarker *marker, + CodeMarker::SynopsisStyle style); void generateSectionInheritedList(const Section& section, const Node *relative, CodeMarker *marker, bool nameAlignment = false); - QString highlightedCode(const QString& markedCode, - CodeMarker *marker, - const Node *relative, - CodeMarker::SynopsisStyle style = CodeMarker::Accessors, - bool nameAlignment = false); + void writeText(const QString& markedCode, + CodeMarker *marker, + const Node *relative, + bool nameAlignment = false); void generateFullName(const Node *apparentNode, const Node *relative, @@ -280,6 +278,7 @@ class DitaXmlGenerator : public PageGenerator bool inContents; bool inSectionHeading; bool inTableHeader; + bool inTableBody; int numTableRows; bool threeColumnEnumValueTable; bool offlineDocs; @@ -302,6 +301,7 @@ class DitaXmlGenerator : public PageGenerator bool slow; bool obsoleteLinks; int noLinks; + int tableColumnCount; QMap moduleClassMap; QMap moduleNamespaceMap; NodeMap nonCompatClasses; diff --git a/tools/qdoc3/node.cpp b/tools/qdoc3/node.cpp index 41f90d5..ce53b86 100644 --- a/tools/qdoc3/node.cpp +++ b/tools/qdoc3/node.cpp @@ -1152,8 +1152,8 @@ QString Parameter::reconstruct(bool value) const if (!p.endsWith(QChar('*')) && !p.endsWith(QChar('&')) && !p.endsWith(QChar(' '))) p += " "; p += nam; - if (value) - p += def; + if (value && !def.isEmpty()) + p += " = " + def; return p; } diff --git a/tools/qdoc3/pagegenerator.cpp b/tools/qdoc3/pagegenerator.cpp index a187c2e..39ee98b 100644 --- a/tools/qdoc3/pagegenerator.cpp +++ b/tools/qdoc3/pagegenerator.cpp @@ -273,6 +273,11 @@ QString PageGenerator::outFileName() return QFileInfo(static_cast(out().device())->fileName()).fileName(); } +/*! + Creates the file named \a fileName in the output directory. + Attaches a QTextStream to the created file, which is written + to all over the place using out(). + */ void PageGenerator::beginSubPage(const Location& location, const QString& fileName) { @@ -285,6 +290,11 @@ void PageGenerator::beginSubPage(const Location& location, outStreamStack.push(out); } +/*! + Flush the text stream associated with the subpage, and + then pop it off the text stream stack and delete it. + This terminates output of the subpage. + */ void PageGenerator::endSubPage() { outStreamStack.top()->flush(); -- cgit v0.12 From 7a3273ebbbff161e84c87de01e448047ffa0f2b5 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Tue, 7 Sep 2010 13:20:26 +0200 Subject: qdoc: Generate correct dita table for the annotated list. --- tools/qdoc3/ditaxmlgenerator.cpp | 47 +++++++++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 17 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 3d1c53e..93fd523 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -2239,43 +2239,56 @@ void DitaXmlGenerator::generateClassHierarchy(const Node *relative, } } -void DitaXmlGenerator::generateAnnotatedList(const Node *relative, - CodeMarker *marker, - const NodeMap &nodeMap) +void DitaXmlGenerator::generateAnnotatedList(const Node* relative, + CodeMarker* marker, + const NodeMap& nodeMap) { - out() << "\n"; + writer.writeStartElement("table"); + writer.writeAttribute("outputclass","annotated"); + writer.writeStartElement("tgroup"); + writer.writeAttribute("cols","2"); + writer.writeStartElement("tbody"); int row = 0; - foreach (const QString &name, nodeMap.keys()) { - const Node *node = nodeMap[name]; + foreach (const QString& name, nodeMap.keys()) { + const Node* node = nodeMap[name]; if (node->status() == Node::Obsolete) continue; + writer.writeStartElement("row"); if (++row % 2 == 1) - out() << ""; + writer.writeAttribute("outputclass","odd topAlign"); else - out() << ""; - out() << ""; + writer.writeEndElement(); //

    + writer.writeEndElement(); // if (!(node->type() == Node::Fake)) { Text brief = node->doc().trimmedBriefText(name); if (!brief.isEmpty()) { - out() << ""; + writer.writeEndElement(); //

    + writer.writeEndElement(); // } } else { - out() << ""; + writer.writeStartElement("entry"); + writer.writeStartElement("p"); + writer.writeCharacters(protectEnc(node->doc().briefText().toString())); + writer.writeEndElement(); //

    + writer.writeEndElement(); // } - out() << "\n"; + writer.writeEndElement(); // } - out() << "

    "; + writer.writeAttribute("outputclass","even topAlign"); + writer.writeStartElement("entry"); + writer.writeStartElement("p"); generateFullName(node, relative, marker); - out() << "

    "; + writer.writeStartElement("entry"); + writer.writeStartElement("p"); generateText(brief, node, marker); - out() << "

    "; - out() << protectEnc(node->doc().briefText().toString()); - out() << "

    \n"; + writer.writeEndElement(); // + writer.writeEndElement(); // + writer.writeEndElement(); // } /*! -- cgit v0.12 From 12ac485add4a4c7db5996dcd51400e90ea44ef23 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 8 Sep 2010 15:18:09 +0200 Subject: qdoc: Generate xml for more kinds of pages. Not complete. --- tools/qdoc3/atom.cpp | 26 ++++---- tools/qdoc3/ditaxmlgenerator.cpp | 136 ++++++++++++++++++++++++++------------- tools/qdoc3/generator.cpp | 13 ++-- 3 files changed, 114 insertions(+), 61 deletions(-) diff --git a/tools/qdoc3/atom.cpp b/tools/qdoc3/atom.cpp index 88f44ea..6f1602e 100644 --- a/tools/qdoc3/atom.cpp +++ b/tools/qdoc3/atom.cpp @@ -241,25 +241,25 @@ static const struct { { 0, 0 } }; -/*! \fn Atom::Atom( Type type, const QString& string ) +/*! \fn Atom::Atom(Type type, const QString& string) Constructs an atom (\a type, \a string) outside of any atom list. */ -/*! \fn Atom( Atom *prev, Type type, const QString& string ) +/*! \fn Atom(Atom *prev, Type type, const QString& string) Constructs an atom (\a type, \a string) that follows \a prev in \a prev's atom list. */ -/*! \fn void Atom::appendChar( QChar ch ) +/*! \fn void Atom::appendChar(QChar ch) Appends \a ch to the string parameter of this atom. \also string() */ -/*! \fn void Atom::appendString( const QString& string ) +/*! \fn void Atom::appendString(const QString& string) Appends \a string to the string parameter of this atom. @@ -316,18 +316,18 @@ QString Atom::typeString() const { static bool deja = false; - if ( !deja ) { + if (!deja) { int i = 0; - while ( atms[i].english != 0 ) { - if ( atms[i].no != i ) - Location::internalError( tr("atom %1 missing").arg(i) ); + while (atms[i].english != 0) { + if (atms[i].no != i) + Location::internalError(tr("atom %1 missing").arg(i)); i++; } deja = true; } int i = (int) type(); - if ( i < 0 || i > (int) Last ) + if (i < 0 || i > (int) Last) return QLatin1String("Invalid"); return QLatin1String(atms[i].english); } @@ -346,10 +346,10 @@ QString Atom::typeString() const void Atom::dump() const { QString str = string(); - str.replace( "\\", "\\\\" ); - str.replace( "\"", "\\\"" ); - str.replace( "\n", "\\n" ); - str.replace( QRegExp("[^\x20-\x7e]"), "?" ); + str.replace("\\", "\\\\"); + str.replace("\"", "\\\""); + str.replace("\n", "\\n"); + str.replace(QRegExp("[^\x20-\x7e]"), "?"); if (!str.isEmpty()) str = " \"" + str + "\""; fprintf(stderr, diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 93fd523..d2b20a6 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -579,7 +579,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, QString hx; static bool in_para = false; QString guid, hc; - + switch (atom->type()) { case Atom::AbstractLeft: break; @@ -1530,8 +1530,8 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker /* NOTE: For now we only handle \page elements. */ - if (fake->subType() != Node::Page) - return; + //if (fake->subType() != Node::Page) + //return; if (fake->subType() == Node::File && !fake->subTitle().isEmpty()) { subTitleSize = SmallSubTitle; @@ -1542,28 +1542,56 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker htmlTitle = fullTitle; } - generateHeader(fake); - - if (fake->subType() == Node::Page) { - writer.writeStartElement("topic"); - writer.writeAttribute("id",fake->guid()); - writer.writeStartElement("title"); - writer.writeCharacters(fullTitle); - writer.writeEndElement(); // + QString outputclass; + switch (fake->subType()) { + case Node::Page: + outputclass = "page"; + break; + case Node::Group: + outputclass = "group"; + break; + case Node::Example: + outputclass = "example"; + break; + case Node::HeaderFile: + outputclass = "header"; + break; + case Node::File: + outputclass = "file"; + break; + case Node::Image: + outputclass = "image"; + break; + case Node::Module: + outputclass = "module"; + break; + case Node::ExternalPage: + outputclass = "externalpage"; + break; + case Node::QmlClass: + outputclass = "QML"; + break; + default: + return; + } - generateBrief(fake, marker); // + generateHeader(fake); + + writer.writeStartElement("topic"); + writer.writeAttribute("id",fake->guid()); + writer.writeAttribute("outputclass",outputclass); + writer.writeStartElement("title"); + writer.writeCharacters(fullTitle); + writer.writeEndElement(); // + + generateBrief(fake, marker); // - if (!fake->doc().isEmpty()) { - writer.writeStartElement("body"); - writer.writeStartElement("p"); - writer.writeAttribute("outputclass","h2"); - writer.writeCharacters("Detailed Description"); - writer.writeEndElement(); //

    - generateBody(fake, marker); - writer.writeEndElement(); // - } - writer.writeEndElement(); // + if (!fake->doc().isEmpty()) { + writer.writeStartElement("body"); + generateBody(fake, marker); + writer.writeEndElement(); // } + writer.writeEndElement(); // } #if 0 @@ -1837,11 +1865,23 @@ void DitaXmlGenerator::generateHeader(const Node* node) version + "//EN\" \"" + dtd + "\">"; } else if (node->type() == Node::Fake) { - if (node->subType() == Node::Page) { + switch (node->subType()) { + case Node::Page: + case Node::Group: + case Node::Example: + case Node::HeaderFile: + case Node::File: + case Node::Image: + case Node::Module: + case Node::ExternalPage: + case Node::QmlClass: element = "topic"; dtd = "dtd/topic.dtd"; doctype = ""; + break; + default: + break; } } @@ -2300,11 +2340,11 @@ void DitaXmlGenerator::generateAnnotatedList(const Node* relative, normally you let it figure it out itself by looking at the name of the first and last classes in \a classMap. */ -void DitaXmlGenerator::generateCompactList(const Node *relative, - CodeMarker *marker, - const NodeMap &classMap, - bool includeAlphabet, - QString commonPrefix) +void DitaXmlGenerator::generateCompactList(const Node* relative, + CodeMarker* marker, + const NodeMap& classMap, + bool includeAlphabet, + QString commonPrefix) { const int NumParagraphs = 37; // '0' to '9', 'A' to 'Z', '_' @@ -2519,42 +2559,50 @@ void DitaXmlGenerator::generateCompactList(const Node *relative, writer.writeEndElement(); //

    } -void DitaXmlGenerator::generateFunctionIndex(const Node *relative, - CodeMarker *marker) +void DitaXmlGenerator::generateFunctionIndex(const Node* relative, + CodeMarker* marker) { - out() << "

    "; + writer.writeStartElement("p"); + writer.writeAttribute("outputclass","centerAlign functionIndex"); + writer.writeStartElement("b"); for (int i = 0; i < 26; i++) { QChar ch('a' + i); - out() << QString("%2 ").arg(ch).arg(ch.toUpper()); + writer.writeStartElement("xref"); + writer.writeAttribute("href",QString("#%1").arg(ch)); + writer.writeCharacters(QString(ch.toUpper())); + writer.writeEndElement(); // } - out() << "

    \n"; + writer.writeEndElement(); // + writer.writeEndElement(); //

    char nextLetter = 'a'; char currentLetter; - out() << "
      \n"; + writer.writeStartElement("ul"); QMap::ConstIterator f = funcIndex.begin(); while (f != funcIndex.end()) { - out() << "
    • "; - out() << protectEnc(f.key()) << ":"; - + writer.writeStartElement("li"); currentLetter = f.key()[0].unicode(); while (islower(currentLetter) && currentLetter >= nextLetter) { - out() << QString("").arg(nextLetter); + writer.writeStartElement("p"); + writeGuidAttribute(QString(nextLetter)); + writer.writeAttribute("outputclass","target"); + writer.writeCharacters(QString(nextLetter)); + writer.writeEndElement(); //

      nextLetter++; } + writer.writeCharacters(protectEnc(f.key())); + writer.writeCharacters(":"); NodeMap::ConstIterator s = (*f).begin(); while (s != (*f).end()) { - out() << " "; generateFullName((*s)->parent(), relative, marker, *s); ++s; } - out() << "
    • "; - out() << "\n"; + writer.writeEndElement(); // ++f; } - out() << "
    \n"; + writer.writeEndElement(); // } void DitaXmlGenerator::generateLegaleseList(const Node *relative, @@ -3596,7 +3644,7 @@ void DitaXmlGenerator::findAllSince(const InnerNode *node) } } -void DitaXmlGenerator::findAllFunctions(const InnerNode *node) +void DitaXmlGenerator::findAllFunctions(const InnerNode* node) { NodeList::ConstIterator c = node->childNodes().begin(); while (c != node->childNodes().end()) { @@ -3605,7 +3653,7 @@ void DitaXmlGenerator::findAllFunctions(const InnerNode *node) findAllFunctions(static_cast(*c)); } else if ((*c)->type() == Node::Function) { - const FunctionNode *func = static_cast(*c); + const FunctionNode* func = static_cast(*c); if ((func->status() > Node::Obsolete) && (func->metaness() != FunctionNode::Ctor) && (func->metaness() != FunctionNode::Dtor)) { diff --git a/tools/qdoc3/generator.cpp b/tools/qdoc3/generator.cpp index 7f39be2..eee998a 100644 --- a/tools/qdoc3/generator.cpp +++ b/tools/qdoc3/generator.cpp @@ -54,6 +54,7 @@ #include "quoter.h" #include "separator.h" #include "tokenizer.h" +#include "ditaxmlgenerator.h" QT_BEGIN_NAMESPACE @@ -385,16 +386,19 @@ void Generator::generateBody(const Node *node, CodeMarker *marker) } else if (node->type() == Node::Fake) { const FakeNode *fake = static_cast(node); - if (fake->subType() == Node::Example) + if (fake->subType() == Node::Example) { generateExampleFiles(fake, marker); - else if ((fake->subType() == Node::File) || (fake->subType() == Node::Image)) + } + else if ((fake->subType() == Node::File) || (fake->subType() == Node::Image)) { quiet = true; + } } if (node->doc().isEmpty()) { - if (!quiet && !node->isReimp()) // ### might be unnecessary + if (!quiet && !node->isReimp()) { // ### might be unnecessary node->location().warning(tr("No documentation for '%1'") .arg(marker->plainFullName(node))); + } } else { if (node->type() == Node::Function) { @@ -403,9 +407,10 @@ void Generator::generateBody(const Node *node, CodeMarker *marker) generateReimplementedFrom(func, marker); } - if (!generateText(node->doc().body(), node, marker)) + if (!generateText(node->doc().body(), node, marker)) { if (node->isReimp()) return; + } if (node->type() == Node::Enum) { const EnumNode *enume = (const EnumNode *) node; -- cgit v0.12 From 7d5366966e4f29b1ccf112e42bc32a3f64bfb0bb Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Thu, 9 Sep 2010 09:58:27 +0200 Subject: qdoc: Generate more xml for module pages. --- tools/qdoc3/ditaxmlgenerator.cpp | 66 +++++++++++++++++++++++++--------------- tools/qdoc3/ditaxmlgenerator.h | 3 ++ 2 files changed, 44 insertions(+), 25 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index d2b20a6..55e873f 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -657,14 +657,14 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, case Atom::Code: writer.writeStartElement("pre"); writer.writeAttribute("outputclass","highlightedcode"); - writeText(atom->string(), marker, relative); + writeText(trimmedTrailing(atom->string()), marker, relative); writer.writeEndElement(); // break; case Atom::Qml: writer.writeStartElement("pre"); writer.writeAttribute("outputclass","highlightedcode"); - writeText(atom->string(), marker, relative); - writer.writeEndElement(); // pre + writeText(trimmedTrailing(atom->string()), marker, relative); + writer.writeEndElement(); // break; case Atom::CodeNew: writer.writeStartElement("p"); @@ -672,7 +672,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, writer.writeEndElement(); //

    writer.writeStartElement("pre"); writer.writeAttribute("outputclass","highlightedcode"); - writeText(atom->string(), marker, relative); + writeText(trimmedTrailing(atom->string()), marker, relative); writer.writeEndElement(); // break; case Atom::CodeOld: @@ -683,7 +683,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, case Atom::CodeBad: writer.writeStartElement("pre"); writer.writeAttribute("outputclass","highlightedcode"); - writer.writeCharacters(trimmedTrailing(protectEnc(plainCode(indent(codeIndent,atom->string()))))); + writer.writeCharacters(trimmedTrailing(protectEnc(plainCode(atom->string())))); writer.writeEndElement(); // break; case Atom::FootnoteLeft: @@ -1516,6 +1516,25 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark } /*! + Write a paragraph for the \a target and a poaragraph for + the \a header. Use the \a attribute for the \a header. + */ +void DitaXmlGenerator::writeTargetAndHeader(const QString& target, + const QString& header, + const QString& attribute) +{ + writer.writeStartElement("p"); + writeGuidAttribute(registerRef(target)); + writer.writeAttribute("outputclass","target"); + writer.writeCharacters(header); + writer.writeEndElement(); //

    + writer.writeStartElement("p"); + writer.writeAttribute("outputclass",attribute); + writer.writeCharacters(header); + writer.writeEndElement(); //

    +} + +/*! Generate the html page for a qdoc file that doesn't map to an underlying c++ file. */ @@ -1585,10 +1604,25 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker writer.writeEndElement(); // generateBrief(fake, marker); // + if (fake->subType() == Node::Module) { + generateStatus(fake, marker); + if (moduleNamespaceMap.contains(fake->name())) { + writeTargetAndHeader("namespaces","Namespaces","h2"); + generateAnnotatedList(fake, marker, moduleNamespaceMap[fake->name()]); + } + if (moduleClassMap.contains(fake->name())) { + writeTargetAndHeader("classes","Classes","h2"); + generateAnnotatedList(fake, marker, moduleClassMap[fake->name()]); + } + } if (!fake->doc().isEmpty()) { writer.writeStartElement("body"); + if (fake->subType() == Node::Module) { + writeTargetAndHeader("details","Detailed Description","h2"); + } generateBody(fake, marker); + generateAlsoList(fake, marker); writer.writeEndElement(); // } writer.writeEndElement(); // @@ -1608,22 +1642,7 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker fake, marker); - if (fake->subType() == Node::Module) { - // Generate brief text and status for modules. - generateBrief(fake, marker); - generateStatus(fake, marker); - if (moduleNamespaceMap.contains(fake->name())) { - out() << "\n"; - out() << "

    Namespaces

    \n"; - generateAnnotatedList(fake, marker, moduleNamespaceMap[fake->name()]); - } - if (moduleClassMap.contains(fake->name())) { - out() << "\n"; - out() << "

    Classes

    \n"; - generateAnnotatedList(fake, marker, moduleClassMap[fake->name()]); - } - } else if (fake->subType() == Node::HeaderFile) { // Generate brief text and status for modules. generateBrief(fake, marker); @@ -1711,10 +1730,6 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker else out() << "
    \n"; // QTBUG-9504 - generateBody(fake, marker); - out() << "
    \n"; // QTBUG-9504 - generateAlsoList(fake, marker); - if (!fake->groupMembers().isEmpty()) { NodeMap groupMembersMap; foreach (const Node *node, fake->groupMembers()) { @@ -3248,7 +3263,8 @@ QString DitaXmlGenerator::registerRef(const QString& ref) if (prevRef.isEmpty()) { prevRef = ref; break; - } else if (prevRef == ref) { + } + else if (prevRef == ref) { break; } clean += "x"; diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index 91d7147..fe7a434 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -110,6 +110,9 @@ class DitaXmlGenerator : public PageGenerator virtual QString linkForNode(const Node *node, const Node *relative); virtual QString refForAtom(Atom *atom, const Node *node); + void writeTargetAndHeader(const QString& target, + const QString& header, + const QString& attribute); QString fullQualification(const Node* n); void writeDerivations(const ClassNode* cn, CodeMarker* marker); -- cgit v0.12 From d623e2bb039111957efd5edd7da84e3c5a22751e Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Thu, 9 Sep 2010 10:40:01 +0200 Subject: qdoc: Generate more xml for group pages. --- tools/qdoc3/ditaxmlgenerator.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 55e873f..cd644ec 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -1623,6 +1623,16 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker } generateBody(fake, marker); generateAlsoList(fake, marker); + + if (!fake->groupMembers().isEmpty()) { + NodeMap groupMembersMap; + foreach (const Node *node, fake->groupMembers()) { + if (node->type() == Node::Class || node->type() == Node::Namespace) + groupMembersMap[node->name()] = node; + } + generateAnnotatedList(fake, marker, groupMembersMap); + } + writer.writeEndElement(); // } writer.writeEndElement(); // @@ -1730,15 +1740,6 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker else out() << "
    \n"; // QTBUG-9504 - if (!fake->groupMembers().isEmpty()) { - NodeMap groupMembersMap; - foreach (const Node *node, fake->groupMembers()) { - if (node->type() == Node::Class || node->type() == Node::Namespace) - groupMembersMap[node->name()] = node; - } - generateAnnotatedList(fake, marker, groupMembersMap); - } - sections = marker->sections(fake, CodeMarker::Detailed, CodeMarker::Okay); s = sections.begin(); while (s != sections.end()) { -- cgit v0.12 From 916b610a272f1a1db41ad4177651e34904dd18a0 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Thu, 9 Sep 2010 13:45:58 +0200 Subject: qdoc: Generate more xml for group pages. --- tools/qdoc3/ditaxmlgenerator.cpp | 278 +++++++++++++++++++++------------------ tools/qdoc3/ditaxmlgenerator.h | 195 +++++++++++++-------------- tools/qdoc3/generator.cpp | 6 +- 3 files changed, 252 insertions(+), 227 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index cd644ec..1ff9592 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -928,13 +928,8 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, s = sections.constBegin(); while (s != sections.constEnd()) { if (!(*s).members.isEmpty()) { - - writer.writeStartElement("li"); - writer.writeStartElement("xref"); - writer.writeAttribute("href",QString("#" + Doc::canonicalTitle((*s).name))); - writer.writeCharacters((*s).name); - writer.writeEndElement(); // - writer.writeEndElement(); //
  • + writeXrefListItem(QString("#" + Doc::canonicalTitle((*s).name)), + (*s).name); } ++s; } @@ -1535,6 +1530,19 @@ void DitaXmlGenerator::writeTargetAndHeader(const QString& target, } /*! + Write a list item for a \a link with the given \a text. + */ +void DitaXmlGenerator::writeXrefListItem(const QString& link, const QString& text) +{ + writer.writeStartElement("li"); + writer.writeStartElement("xref"); + writer.writeAttribute("href",link); + writer.writeCharacters(text); + writer.writeEndElement(); // + writer.writeEndElement(); // +} + +/*! Generate the html page for a qdoc file that doesn't map to an underlying c++ file. */ @@ -1615,6 +1623,31 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker generateAnnotatedList(fake, marker, moduleClassMap[fake->name()]); } } + else if (fake->subType() == Node::HeaderFile) { + generateStatus(fake, marker); + writer.writeStartElement("ul"); + + QString membersLink = generateListOfAllMemberFile(fake, marker); + if (!membersLink.isEmpty()) { + writeXrefListItem(membersLink,"List of all members, including inherited members"); + } + + QString obsoleteLink = generateLowStatusMemberFile(fake, + marker, + CodeMarker::Obsolete); + if (!obsoleteLink.isEmpty()) { + writeXrefListItem(obsoleteLink,"Obsolete members"); + } + + QString compatLink = generateLowStatusMemberFile(fake, + marker, + CodeMarker::Compat); + if (!compatLink.isEmpty()) { + writeXrefListItem(compatLink,"Qt 3 support members"); + } + + writer.writeEndElement(); // + } if (!fake->doc().isEmpty()) { writer.writeStartElement("body"); @@ -1631,7 +1664,7 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker groupMembersMap[node->name()] = node; } generateAnnotatedList(fake, marker, groupMembersMap); - } + } writer.writeEndElement(); // } @@ -1653,34 +1686,6 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker marker); - else if (fake->subType() == Node::HeaderFile) { - // Generate brief text and status for modules. - generateBrief(fake, marker); - generateStatus(fake, marker); - - out() << "
      \n"; - - QString membersLink = generateListOfAllMemberFile(fake, marker); - if (!membersLink.isEmpty()) - out() << "
    • " - << "List of all members, including inherited members
    • \n"; - - QString obsoleteLink = generateLowStatusMemberFile(fake, - marker, - CodeMarker::Obsolete); - if (!obsoleteLink.isEmpty()) - out() << "
    • " - << "Obsolete members
    • \n"; - - QString compatLink = generateLowStatusMemberFile(fake, - marker, - CodeMarker::Compat); - if (!compatLink.isEmpty()) - out() << "
    • " - << "Qt 3 support members
    • \n"; - - out() << "
    \n"; - } else if (fake->subType() == Node::QmlClass) { const QmlClassNode* qml_cn = static_cast(fake); const ClassNode* cn = qml_cn->classNode(); @@ -2177,8 +2182,8 @@ QString DitaXmlGenerator::generateListOfAllMemberFile(const InnerNode *inner, return fileName; } -QString DitaXmlGenerator::generateLowStatusMemberFile(const InnerNode *inner, - CodeMarker *marker, +QString DitaXmlGenerator::generateLowStatusMemberFile(const InnerNode* inner, + CodeMarker* marker, CodeMarker::Status status) { QList
    sections = marker->sections(inner, @@ -2193,7 +2198,6 @@ QString DitaXmlGenerator::generateLowStatusMemberFile(const InnerNode *inner, return QString(); int i; - QString title; QString fileName; @@ -2640,10 +2644,10 @@ void DitaXmlGenerator::generateLegaleseList(const Node *relative, } } -void DitaXmlGenerator::generateQmlItem(const Node *node, - const Node *relative, - CodeMarker *marker, - bool summary) +void DitaXmlGenerator::generateQmlItem(const Node* node, + const Node* relative, + CodeMarker* marker, + bool summary) { QString marked = marker->markedUpQmlItem(node,summary); QRegExp templateTag("(<[^@>]*>)"); @@ -2671,17 +2675,17 @@ void DitaXmlGenerator::generateQmlItem(const Node *node, writeText(marked, marker, relative); } -void DitaXmlGenerator::generateOverviewList(const Node *relative, CodeMarker * /* marker */) +void DitaXmlGenerator::generateOverviewList(const Node* relative, CodeMarker* /* marker */) { - QMap > fakeNodeMap; - QMap groupTitlesMap; - QMap uncategorizedNodeMap; + QMap > fakeNodeMap; + QMap groupTitlesMap; + QMap uncategorizedNodeMap; QRegExp singleDigit("\\b([0-9])\\b"); const NodeList children = myTree->root()->childNodes(); - foreach (Node *child, children) { + foreach (Node* child, children) { if (child->type() == Node::Fake && child != relative) { - FakeNode *fakeNode = static_cast(child); + FakeNode* fakeNode = static_cast(child); // Check whether the page is part of a group or is the group // definition page. @@ -2713,24 +2717,25 @@ void DitaXmlGenerator::generateOverviewList(const Node *relative, CodeMarker * / if (isGroupPage) { // If we encounter a group definition page, we add all // the pages in that group to the list for that group. - foreach (Node *member, fakeNode->groupMembers()) { + foreach (Node* member, fakeNode->groupMembers()) { if (member->type() != Node::Fake) continue; - FakeNode *page = static_cast(member); + FakeNode* page = static_cast(member); if (page) { QString sortKey = page->fullTitle().toLower(); if (sortKey.startsWith("the ")) sortKey.remove(0, 4); sortKey.replace(singleDigit, "0\\1"); - fakeNodeMap[const_cast(fakeNode)].insert(sortKey, page); - groupTitlesMap[fakeNode->fullTitle()] = const_cast(fakeNode); + fakeNodeMap[const_cast(fakeNode)].insert(sortKey, page); + groupTitlesMap[fakeNode->fullTitle()] = const_cast(fakeNode); } } } else if (!isGroupPage) { // If we encounter a page that belongs to a group then // we add that page to the list for that group. - const FakeNode *groupNode = static_cast(myTree->root()->findNode(group, Node::Fake)); + const FakeNode* groupNode = + static_cast(myTree->root()->findNode(group, Node::Fake)); if (groupNode) fakeNodeMap[groupNode].insert(sortKey, fakeNode); //else @@ -2786,9 +2791,9 @@ void DitaXmlGenerator::generateOverviewList(const Node *relative, CodeMarker * / } void DitaXmlGenerator::generateSection(const NodeList& nl, - const Node *relative, - CodeMarker *marker, - CodeMarker::SynopsisStyle style) + const Node* relative, + CodeMarker* marker, + CodeMarker::SynopsisStyle style) { bool name_alignment = true; if (!nl.isEmpty()) { @@ -2878,9 +2883,9 @@ void DitaXmlGenerator::generateSection(const NodeList& nl, } void DitaXmlGenerator::generateSectionList(const Section& section, - const Node *relative, - CodeMarker *marker, - CodeMarker::SynopsisStyle style) + const Node* relative, + CodeMarker* marker, + CodeMarker::SynopsisStyle style) { bool name_alignment = true; if (!section.members.isEmpty()) { @@ -2946,9 +2951,9 @@ void DitaXmlGenerator::generateSectionList(const Section& section, } void DitaXmlGenerator::generateSectionInheritedList(const Section& section, - const Node *relative, - CodeMarker *marker, - bool nameAlignment) + const Node* relative, + CodeMarker* marker, + bool nameAlignment) { QList >::ConstIterator p = section.inherited.begin(); while (p != section.inherited.end()) { @@ -3165,8 +3170,8 @@ void DitaXmlGenerator::writeText(const QString& markedCode, } void DitaXmlGenerator::generateLink(const Atom* atom, - const Node* /* relative */, - CodeMarker* marker) + const Node* /* relative */, + CodeMarker* marker) { static QRegExp camelCase("[A-Z][A-Z][a-z]|[a-z][A-Z0-9]|_"); @@ -3183,7 +3188,8 @@ void DitaXmlGenerator::generateLink(const Atom* atom, } inLink = false; writer.writeCharacters(protectEnc(atom->string().mid(k))); - } else if (marker->recognizeLanguage("Java")) { + } + else if (marker->recognizeLanguage("Java")) { // hack for Java: remove () and use when appropriate bool func = atom->string().endsWith("()"); bool tt = (func || atom->string().contains(camelCase)); @@ -3214,14 +3220,17 @@ QString DitaXmlGenerator::cleanRef(const QString& ref) const uint u = c.unicode(); if ((u >= 'a' && u <= 'z') || - (u >= 'A' && u <= 'Z') || - (u >= '0' && u <= '9')) { + (u >= 'A' && u <= 'Z') || + (u >= '0' && u <= '9')) { clean += c; - } else if (u == '~') { + } + else if (u == '~') { clean += "dtor."; - } else if (u == '_') { + } + else if (u == '_') { clean += "underscore."; - } else { + } + else { clean += "A"; } @@ -3229,25 +3238,33 @@ QString DitaXmlGenerator::cleanRef(const QString& ref) const QChar c = ref[i]; const uint u = c.unicode(); if ((u >= 'a' && u <= 'z') || - (u >= 'A' && u <= 'Z') || - (u >= '0' && u <= '9') || u == '-' || - u == '_' || u == ':' || u == '.') { + (u >= 'A' && u <= 'Z') || + (u >= '0' && u <= '9') || u == '-' || + u == '_' || u == ':' || u == '.') { clean += c; - } else if (c.isSpace()) { + } + else if (c.isSpace()) { clean += "-"; - } else if (u == '!') { + } + else if (u == '!') { clean += "-not"; - } else if (u == '&') { + } + else if (u == '&') { clean += "-and"; - } else if (u == '<') { + } + else if (u == '<') { clean += "-lt"; - } else if (u == '=') { + } + else if (u == '=') { clean += "-eq"; - } else if (u == '>') { + } + else if (u == '>') { clean += "-gt"; - } else if (u == '#') { + } + else if (u == '#') { clean += "#"; - } else { + } + else { clean += "-"; clean += QString::number((int)u, 16); } @@ -3273,12 +3290,12 @@ QString DitaXmlGenerator::registerRef(const QString& ref) return clean; } -QString DitaXmlGenerator::protectEnc(const QString &string) +QString DitaXmlGenerator::protectEnc(const QString& string) { return protect(string, outputEncoding); } -QString DitaXmlGenerator::protect(const QString &string, const QString &outputEncoding) +QString DitaXmlGenerator::protect(const QString& string, const QString& outputEncoding) { #define APPEND(x) \ if (xml.isEmpty()) { \ @@ -3295,20 +3312,25 @@ QString DitaXmlGenerator::protect(const QString &string, const QString &outputEn if (ch == QLatin1Char('&')) { APPEND("&"); - } else if (ch == QLatin1Char('<')) { + } + else if (ch == QLatin1Char('<')) { APPEND("<"); - } else if (ch == QLatin1Char('>')) { + } + else if (ch == QLatin1Char('>')) { APPEND(">"); - } else if (ch == QLatin1Char('"')) { + } + else if (ch == QLatin1Char('"')) { APPEND("""); - } else if ((outputEncoding == "ISO-8859-1" && ch.unicode() > 0x007F) - || (ch == QLatin1Char('*') && i + 1 < n && string.at(i) == QLatin1Char('/')) - || (ch == QLatin1Char('.') && i > 2 && string.at(i - 2) == QLatin1Char('.'))) { + } + else if ((outputEncoding == "ISO-8859-1" && ch.unicode() > 0x007F) || + (ch == QLatin1Char('*') && i + 1 < n && string.at(i) == QLatin1Char('/')) || + (ch == QLatin1Char('.') && i > 2 && string.at(i - 2) == QLatin1Char('.'))) { // we escape '*/' and the last dot in 'e.g.' and 'i.e.' for the Javadoc generator APPEND("&#x"); xml += QString::number(ch.unicode(), 16); xml += QLatin1Char(';'); - } else { + } + else { if (!xml.isEmpty()) xml += ch; } @@ -3321,12 +3343,10 @@ QString DitaXmlGenerator::protect(const QString &string, const QString &outputEn #undef APPEND } -QString DitaXmlGenerator::fileBase(const Node *node) +QString DitaXmlGenerator::fileBase(const Node* node) { QString result; - result = PageGenerator::fileBase(node); - if (!node->isInnerNode()) { switch (node->status()) { case Node::Compat: @@ -3342,21 +3362,21 @@ QString DitaXmlGenerator::fileBase(const Node *node) return result; } -QString DitaXmlGenerator::fileName(const Node *node) +QString DitaXmlGenerator::fileName(const Node* node) { if (node->type() == Node::Fake) { - if (static_cast(node)->subType() == Node::ExternalPage) + if (static_cast(node)->subType() == Node::ExternalPage) return node->name(); - if (static_cast(node)->subType() == Node::Image) + if (static_cast(node)->subType() == Node::Image) return node->name(); } return PageGenerator::fileName(node); } -QString DitaXmlGenerator::refForNode(const Node *node) +QString DitaXmlGenerator::refForNode(const Node* node) { - const FunctionNode *func; - const TypedefNode *typedeffe; + const FunctionNode* func; + const TypedefNode* typedeffe; QString ref; switch (node->type()) { @@ -3409,7 +3429,7 @@ QString DitaXmlGenerator::refForNode(const Node *node) return registerRef(ref); } -QString DitaXmlGenerator::linkForNode(const Node *node, const Node *relative) +QString DitaXmlGenerator::linkForNode(const Node* node, const Node* relative) { QString link; QString fn; @@ -3438,7 +3458,7 @@ QString DitaXmlGenerator::linkForNode(const Node *node, const Node *relative) return link; } -QString DitaXmlGenerator::refForAtom(Atom *atom, const Node * /* node */) +QString DitaXmlGenerator::refForAtom(Atom* atom, const Node* /* node */) { if (atom->type() == Atom::SectionLeft) { return Doc::canonicalTitle(Text::sectionHeading(atom).toString()); @@ -3544,7 +3564,7 @@ void DitaXmlGenerator::generateDetailedMember(const Node* node, generateAlsoList(node, marker); } -void DitaXmlGenerator::findAllClasses(const InnerNode *node) +void DitaXmlGenerator::findAllClasses(const InnerNode* node) { NodeList::const_iterator c = node->childNodes().constBegin(); while (c != node->childNodes().constEnd()) { @@ -3601,7 +3621,7 @@ void DitaXmlGenerator::findAllClasses(const InnerNode *node) For generating the "New Classes... in 4.x" section on the What's New in 4.x" page. */ -void DitaXmlGenerator::findAllSince(const InnerNode *node) +void DitaXmlGenerator::findAllSince(const InnerNode* node) { NodeList::const_iterator child = node->childNodes().constBegin(); while (child != node->childNodes().constEnd()) { @@ -3667,7 +3687,7 @@ void DitaXmlGenerator::findAllFunctions(const InnerNode* node) while (c != node->childNodes().end()) { if ((*c)->access() != Node::Private) { if ((*c)->isInnerNode() && (*c)->url().isEmpty()) { - findAllFunctions(static_cast(*c)); + findAllFunctions(static_cast(*c)); } else if ((*c)->type() == Node::Function) { const FunctionNode* func = static_cast(*c); @@ -3682,7 +3702,7 @@ void DitaXmlGenerator::findAllFunctions(const InnerNode* node) } } -void DitaXmlGenerator::findAllLegaleseTexts(const InnerNode *node) +void DitaXmlGenerator::findAllLegaleseTexts(const InnerNode* node) { NodeList::ConstIterator c = node->childNodes().begin(); while (c != node->childNodes().end()) { @@ -3696,7 +3716,7 @@ void DitaXmlGenerator::findAllLegaleseTexts(const InnerNode *node) } } -void DitaXmlGenerator::findAllNamespaces(const InnerNode *node) +void DitaXmlGenerator::findAllNamespaces(const InnerNode* node) { NodeList::ConstIterator c = node->childNodes().begin(); while (c != node->childNodes().end()) { @@ -3724,7 +3744,7 @@ void DitaXmlGenerator::findAllNamespaces(const InnerNode *node) } } -int DitaXmlGenerator::hOffset(const Node *node) +int DitaXmlGenerator::hOffset(const Node* node) { switch (node->type()) { case Node::Namespace: @@ -3741,7 +3761,7 @@ int DitaXmlGenerator::hOffset(const Node *node) } } -bool DitaXmlGenerator::isThreeColumnEnumValueTable(const Atom *atom) +bool DitaXmlGenerator::isThreeColumnEnumValueTable(const Atom* atom) { while (atom != 0 && !(atom->type() == Atom::ListRight && atom->string() == ATOM_LIST_VALUE)) { if (atom->type() == Atom::ListItemLeft && !matchAhead(atom, Atom::ListItemRight)) @@ -3751,12 +3771,12 @@ bool DitaXmlGenerator::isThreeColumnEnumValueTable(const Atom *atom) return false; } -const Node *DitaXmlGenerator::findNodeForTarget(const QString &target, - const Node *relative, - CodeMarker *marker, - const Atom *atom) +const Node* DitaXmlGenerator::findNodeForTarget(const QString& target, + const Node* relative, + CodeMarker* marker, + const Atom* atom) { - const Node *node = 0; + const Node* node = 0; if (target.isEmpty()) { node = relative; @@ -3780,7 +3800,7 @@ const Node *DitaXmlGenerator::findNodeForTarget(const QString &target, return node; } -const QPair DitaXmlGenerator::anchorForNode(const Node *node) +const QPair DitaXmlGenerator::anchorForNode(const Node* node) { QPair anchorPair; @@ -3793,10 +3813,10 @@ const QPair DitaXmlGenerator::anchorForNode(const Node *node) return anchorPair; } -QString DitaXmlGenerator::getLink(const Atom *atom, - const Node *relative, - CodeMarker *marker, - const Node** node) +QString DitaXmlGenerator::getLink(const Atom* atom, + const Node* relative, + CodeMarker* marker, + const Node** node) { QString link; *node = 0; @@ -3897,14 +3917,14 @@ QString DitaXmlGenerator::getLink(const Atom *atom, return link; } -void DitaXmlGenerator::generateIndex(const QString &fileBase, - const QString &url, - const QString &title) +void DitaXmlGenerator::generateIndex(const QString& fileBase, + const QString& url, + const QString& title) { myTree->generateIndex(outputDir() + "/" + fileBase + ".index", url, title); } -void DitaXmlGenerator::generateStatus(const Node *node, CodeMarker *marker) +void DitaXmlGenerator::generateStatus(const Node* node, CodeMarker* marker) { Text text; @@ -3953,10 +3973,10 @@ void DitaXmlGenerator::generateStatus(const Node *node, CodeMarker *marker) } } -void DitaXmlGenerator::beginLink(const QString &link, - const Node *node, - const Node *relative, - CodeMarker *marker) +void DitaXmlGenerator::beginLink(const QString& link, + const Node* node, + const Node* relative, + CodeMarker* marker) { Q_UNUSED(marker) Q_UNUSED(relative) @@ -4018,8 +4038,8 @@ void DitaXmlGenerator::endLink() Currently handles only the QML property group. */ void DitaXmlGenerator::generateQmlSummary(const Section& section, - const Node *relative, - CodeMarker *marker) + const Node* relative, + CodeMarker* marker) { if (!section.members.isEmpty()) { NodeList::ConstIterator m; diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index fe7a434..dad1c6f 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -91,28 +91,29 @@ class DitaXmlGenerator : public PageGenerator virtual void initializeGenerator(const Config& config); virtual void terminateGenerator(); virtual QString format(); - virtual void generateTree(const Tree *tree, CodeMarker *marker); + virtual void generateTree(const Tree* tree, CodeMarker* marker); - QString protectEnc(const QString &string); - static QString protect(const QString &string, const QString &encoding = "ISO-8859-1"); + QString protectEnc(const QString& string); + static QString protect(const QString& string, const QString& encoding = "ISO-8859-1"); static QString cleanRef(const QString& ref); static QString sinceTitle(int i) { return sinceTitles[i]; } protected: - virtual void startText(const Node *relative, CodeMarker *marker); - virtual int generateAtom(const Atom *atom, - const Node *relative, - CodeMarker *marker); - virtual void generateClassLikeNode(const InnerNode *inner, CodeMarker *marker); - virtual void generateFakeNode(const FakeNode *fake, CodeMarker *marker); - virtual QString fileExtension(const Node *node) const; - virtual QString refForNode(const Node *node); - virtual QString linkForNode(const Node *node, const Node *relative); - virtual QString refForAtom(Atom *atom, const Node *node); + virtual void startText(const Node* relative, CodeMarker* marker); + virtual int generateAtom(const Atom* atom, + const Node* relative, + CodeMarker* marker); + virtual void generateClassLikeNode(const InnerNode* inner, CodeMarker* marker); + virtual void generateFakeNode(const FakeNode* fake, CodeMarker* marker); + virtual QString fileExtension(const Node* node) const; + virtual QString refForNode(const Node* node); + virtual QString linkForNode(const Node* node, const Node* relative); + virtual QString refForAtom(Atom* atom, const Node* node); void writeTargetAndHeader(const QString& target, const QString& header, const QString& attribute); + void writeXrefListItem(const QString& link, const QString& text); QString fullQualification(const Node* n); void writeDerivations(const ClassNode* cn, CodeMarker* marker); @@ -141,63 +142,63 @@ class DitaXmlGenerator : public PageGenerator private: enum SubTitleSize { SmallSubTitle, LargeSubTitle }; - const QPair anchorForNode(const Node *node); - const Node *findNodeForTarget(const QString &target, - const Node *relative, - CodeMarker *marker, - const Atom *atom = 0); + const QPair anchorForNode(const Node* node); + const Node* findNodeForTarget(const QString& target, + const Node* relative, + CodeMarker* marker, + const Atom* atom = 0); void generateBreadCrumbs(const QString& title, - const Node *node, - CodeMarker *marker); + const Node* node, + CodeMarker* marker); void generateHeader(const Node* node); void generateTitle(const QString& title, - const Text &subTitle, + const Text& subTitle, SubTitleSize subTitleSize, - const Node *relative, - CodeMarker *marker); + const Node* relative, + CodeMarker* marker); void generateBrief(const Node* node, CodeMarker* marker); - void generateIncludes(const InnerNode *inner, CodeMarker *marker); - void generateTableOfContents(const Node *node, - CodeMarker *marker, + void generateIncludes(const InnerNode* inner, CodeMarker* marker); + void generateTableOfContents(const Node* node, + CodeMarker* marker, Doc::SectioningUnit sectioningUnit, int numColumns, - const Node *relative = 0); - void generateTableOfContents(const Node *node, - CodeMarker *marker, + const Node* relative = 0); + void generateTableOfContents(const Node* node, + CodeMarker* marker, QList
    * sections = 0); - QString generateListOfAllMemberFile(const InnerNode *inner, CodeMarker *marker); - QString generateLowStatusMemberFile(const InnerNode *inner, - CodeMarker *marker, + QString generateListOfAllMemberFile(const InnerNode* inner, CodeMarker* marker); + QString generateLowStatusMemberFile(const InnerNode* inner, + CodeMarker* marker, CodeMarker::Status status); - void generateClassHierarchy(const Node *relative, - CodeMarker *marker, - const NodeMap &classMap); - void generateAnnotatedList(const Node *relative, - CodeMarker *marker, - const NodeMap &nodeMap); - void generateCompactList(const Node *relative, - CodeMarker *marker, - const NodeMap &classMap, + void generateClassHierarchy(const Node* relative, + CodeMarker* marker, + const NodeMap& classMap); + void generateAnnotatedList(const Node* relative, + CodeMarker* marker, + const NodeMap& nodeMap); + 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); - void generateOverviewList(const Node *relative, CodeMarker *marker); + void generateFunctionIndex(const Node* relative, CodeMarker* marker); + void generateLegaleseList(const Node* relative, CodeMarker* marker); + void generateOverviewList(const Node* relative, CodeMarker* marker); void generateSectionList(const Section& section, - const Node *relative, - CodeMarker *marker, + const Node* relative, + CodeMarker* marker, CodeMarker::SynopsisStyle style); #ifdef QDOC_QML void generateQmlSummary(const Section& section, - const Node *relative, - CodeMarker *marker); - void generateQmlItem(const Node *node, - const Node *relative, - CodeMarker *marker, + const Node* relative, + CodeMarker* marker); + void generateQmlItem(const Node* node, + const Node* relative, + CodeMarker* marker, bool summary); - void generateDetailedQmlMember(const Node *node, - const InnerNode *relative, - CodeMarker *marker); + void generateDetailedQmlMember(const Node* node, + const InnerNode* relative, + CodeMarker* marker); void generateQmlInherits(const QmlClassNode* cn, CodeMarker* marker); void generateQmlInheritedBy(const QmlClassNode* cn, CodeMarker* marker); void generateQmlInstantiates(const QmlClassNode* qcn, CodeMarker* marker); @@ -205,61 +206,61 @@ class DitaXmlGenerator : public PageGenerator #endif void generateSection(const NodeList& nl, - const Node *relative, - CodeMarker *marker, + const Node* relative, + CodeMarker* marker, CodeMarker::SynopsisStyle style); - QString getMarkedUpSynopsis(const Node *node, - const Node *relative, - CodeMarker *marker, + QString getMarkedUpSynopsis(const Node* node, + const Node* relative, + CodeMarker* marker, CodeMarker::SynopsisStyle style); void generateSectionInheritedList(const Section& section, - const Node *relative, - CodeMarker *marker, + const Node* relative, + CodeMarker* marker, bool nameAlignment = false); void writeText(const QString& markedCode, - CodeMarker *marker, - const Node *relative, + CodeMarker* marker, + const Node* relative, bool nameAlignment = false); - void generateFullName(const Node *apparentNode, - const Node *relative, - CodeMarker *marker, - const Node *actualNode = 0); - void generateDetailedMember(const Node *node, - const InnerNode *relative, - CodeMarker *marker); - void generateLink(const Atom *atom, - const Node *relative, - CodeMarker *marker); - void generateStatus(const Node *node, CodeMarker *marker); + void generateFullName(const Node* apparentNode, + const Node* relative, + CodeMarker* marker, + const Node* actualNode = 0); + void generateDetailedMember(const Node* node, + const InnerNode* relative, + CodeMarker* marker); + void generateLink(const Atom* atom, + const Node* relative, + CodeMarker* marker); + void generateStatus(const Node* node, CodeMarker* marker); QString registerRef(const QString& ref); - QString fileBase(const Node *node); + QString fileBase(const Node* node); #if 0 - QString fileBase(const Node *node, const SectionIterator& section); + QString fileBase(const Node* node, const SectionIterator& section); #endif - QString fileName(const Node *node); - void findAllClasses(const InnerNode *node); - void findAllFunctions(const InnerNode *node); - void findAllLegaleseTexts(const InnerNode *node); - void findAllNamespaces(const InnerNode *node); - void findAllSince(const InnerNode *node); - static int hOffset(const Node *node); - static bool isThreeColumnEnumValueTable(const Atom *atom); - virtual QString getLink(const Atom *atom, - const Node *relative, - CodeMarker *marker, + QString fileName(const Node* node); + void findAllClasses(const InnerNode* node); + void findAllFunctions(const InnerNode* node); + void findAllLegaleseTexts(const InnerNode* node); + void findAllNamespaces(const InnerNode* node); + void findAllSince(const InnerNode* node); + static int hOffset(const Node* node); + static bool isThreeColumnEnumValueTable(const Atom* atom); + virtual QString getLink(const Atom* atom, + const Node* relative, + CodeMarker* marker, const Node** node); - virtual void generateIndex(const QString &fileBase, - const QString &url, - const QString &title); + virtual void generateIndex(const QString& fileBase, + const QString& url, + const QString& title); #ifdef GENERATE_MAC_REFS - void generateMacRef(const Node *node, CodeMarker *marker); + void generateMacRef(const Node* node, CodeMarker* marker); #endif - void beginLink(const QString &link, - const Node *node, - const Node *relative, - CodeMarker *marker); + void beginLink(const QString& link, + const Node* node, + const Node* relative, + CodeMarker* marker); void endLink(); bool generatePageElement(QXmlStreamWriter& writer, const Node* node, @@ -300,7 +301,7 @@ class DitaXmlGenerator : public PageGenerator QString navigationLinks; QStringList stylesheets; QStringList customHeadElements; - const Tree *myTree; + const Tree* myTree; bool slow; bool obsoleteLinks; int noLinks; @@ -317,7 +318,7 @@ class DitaXmlGenerator : public PageGenerator NodeMap qmlClasses; #endif QMap funcIndex; - QMap legaleseTexts; + QMap legaleseTexts; NewSinceMaps newSinceMaps; static QString sinceTitles[]; NewClassMaps newClassMaps; diff --git a/tools/qdoc3/generator.cpp b/tools/qdoc3/generator.cpp index eee998a..5bd5156 100644 --- a/tools/qdoc3/generator.cpp +++ b/tools/qdoc3/generator.cpp @@ -860,7 +860,11 @@ QMap& Generator::formattingRightMap() return fmtRightMaps[format()]; } -QString Generator::trimmedTrailing(const QString &string) +/* + Trims trailimng whitespace off the \a string and returns + the trimmed string. + */ +QString Generator::trimmedTrailing(const QString& string) { QString trimmed = string; while (trimmed.length() > 0 && trimmed[trimmed.length() - 1].isSpace()) -- cgit v0.12 From 0770668614e8445cb452ccbc50543eede5fed2d1 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 13 Sep 2010 14:43:42 +0200 Subject: qdoc: Implemented stacking of XML stream writers. --- tools/qdoc3/ditaxmlgenerator.cpp | 1893 ++++++++++++++++++-------------------- tools/qdoc3/ditaxmlgenerator.h | 24 +- tools/qdoc3/pagegenerator.h | 18 +- 3 files changed, 886 insertions(+), 1049 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 1ff9592..f572cc7 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -508,7 +508,7 @@ QString DitaXmlGenerator::format() QString DitaXmlGenerator::writeGuidAttribute(QString text) { QString guid = lookupGuid(text); - writer.writeAttribute("id",guid); + xmlWriter().writeAttribute("id",guid); return guid; } @@ -595,11 +595,11 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, endLink(); } else { - writer.writeCharacters(protectEnc(atom->string())); + xmlWriter().writeCharacters(protectEnc(atom->string())); } } else { - writer.writeCharacters(protectEnc(atom->string())); + xmlWriter().writeCharacters(protectEnc(atom->string())); } break; case Atom::BaseName: @@ -609,7 +609,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, skipAhead = skipAtoms(atom, Atom::BriefRight); break; } - writer.writeStartElement(SHORTDESC); + xmlWriter().writeStartElement(SHORTDESC); if (relative->type() == Node::Property || relative->type() == Node::Variable) { QString str; @@ -624,94 +624,94 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, str[0] = str[0].toLower(); if (str.right(1) == ".") str.truncate(str.length() - 1); - writer.writeCharacters("This "); + xmlWriter().writeCharacters("This "); if (relative->type() == Node::Property) - writer.writeCharacters("property"); + xmlWriter().writeCharacters("property"); else - writer.writeCharacters("variable"); + xmlWriter().writeCharacters("variable"); QStringList words = str.split(" "); if (!(words.first() == "contains" || words.first() == "specifies" || words.first() == "describes" || words.first() == "defines" || words.first() == "holds" || words.first() == "determines")) - writer.writeCharacters(" holds "); + xmlWriter().writeCharacters(" holds "); else - writer.writeCharacters(" "); - writer.writeCharacters(str + "."); + xmlWriter().writeCharacters(" "); + xmlWriter().writeCharacters(str + "."); } break; case Atom::BriefRight: if (relative->type() != Node::Fake) { - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // } break; case Atom::C: - writer.writeStartElement(formattingLeftMap()[ATOM_FORMATTING_TELETYPE]); + xmlWriter().writeStartElement(formattingLeftMap()[ATOM_FORMATTING_TELETYPE]); if (inLink) { - writer.writeCharacters(protectEnc(plainCode(atom->string()))); + xmlWriter().writeCharacters(protectEnc(plainCode(atom->string()))); } else { writeText(atom->string(), marker, relative); } - writer.writeEndElement(); // sse writeStartElement() above + xmlWriter().writeEndElement(); // sse writeStartElement() above break; case Atom::Code: - writer.writeStartElement("pre"); - writer.writeAttribute("outputclass","highlightedcode"); + xmlWriter().writeStartElement("pre"); + xmlWriter().writeAttribute("outputclass","highlightedcode"); writeText(trimmedTrailing(atom->string()), marker, relative); - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // break; case Atom::Qml: - writer.writeStartElement("pre"); - writer.writeAttribute("outputclass","highlightedcode"); + xmlWriter().writeStartElement("pre"); + xmlWriter().writeAttribute("outputclass","highlightedcode"); writeText(trimmedTrailing(atom->string()), marker, relative); - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // break; case Atom::CodeNew: - writer.writeStartElement("p"); - writer.writeCharacters("you can rewrite it as"); - writer.writeEndElement(); //

    - writer.writeStartElement("pre"); - writer.writeAttribute("outputclass","highlightedcode"); + xmlWriter().writeStartElement("p"); + xmlWriter().writeCharacters("you can rewrite it as"); + xmlWriter().writeEndElement(); //

    + xmlWriter().writeStartElement("pre"); + xmlWriter().writeAttribute("outputclass","highlightedcode"); writeText(trimmedTrailing(atom->string()), marker, relative); - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // break; case Atom::CodeOld: - writer.writeStartElement("p"); - writer.writeCharacters("For example, if you have code like"); - writer.writeEndElement(); //

    + xmlWriter().writeStartElement("p"); + xmlWriter().writeCharacters("For example, if you have code like"); + xmlWriter().writeEndElement(); //

    // fallthrough case Atom::CodeBad: - writer.writeStartElement("pre"); - writer.writeAttribute("outputclass","highlightedcode"); - writer.writeCharacters(trimmedTrailing(protectEnc(plainCode(atom->string())))); - writer.writeEndElement(); // + xmlWriter().writeStartElement("pre"); + xmlWriter().writeAttribute("outputclass","highlightedcode"); + xmlWriter().writeCharacters(trimmedTrailing(protectEnc(plainCode(atom->string())))); + xmlWriter().writeEndElement(); // break; case Atom::FootnoteLeft: // ### For now if (in_para) { - writer.writeEndElement(); //

    + xmlWriter().writeEndElement(); //

    in_para = false; } - writer.writeCharacters(""); + xmlWriter().writeCharacters("-->"); break; case Atom::FormatElse: case Atom::FormatEndif: case Atom::FormatIf: break; case Atom::FormattingLeft: - writer.writeStartElement(formattingLeftMap()[atom->string()]); + xmlWriter().writeStartElement(formattingLeftMap()[atom->string()]); if (atom->string() == ATOM_FORMATTING_PARAMETER) { if (atom->next() != 0 && atom->next()->type() == Atom::String) { QRegExp subscriptRegExp("([a-z]+)_([0-9n])"); if (subscriptRegExp.exactMatch(atom->next()->string())) { - writer.writeCharacters(subscriptRegExp.cap(1)); - writer.writeStartElement("sub"); - writer.writeCharacters(subscriptRegExp.cap(2)); - writer.writeEndElement(); // + xmlWriter().writeCharacters(subscriptRegExp.cap(1)); + xmlWriter().writeStartElement("sub"); + xmlWriter().writeCharacters(subscriptRegExp.cap(2)); + xmlWriter().writeEndElement(); // skipAhead = 1; } } @@ -722,7 +722,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, endLink(); } else { - writer.writeEndElement(); // ? + xmlWriter().writeEndElement(); // ? } break; case Atom::AnnotatedList: @@ -924,7 +924,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, /* First generate the table of contents. */ - writer.writeStartElement("ul"); + xmlWriter().writeStartElement("ul"); s = sections.constBegin(); while (s != sections.constEnd()) { if (!(*s).members.isEmpty()) { @@ -933,17 +933,17 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, } ++s; } - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // int idx = 0; s = sections.constBegin(); while (s != sections.constEnd()) { if (!(*s).members.isEmpty()) { - writer.writeStartElement("p"); + xmlWriter().writeStartElement("p"); writeGuidAttribute(Doc::canonicalTitle((*s).name)); - writer.writeAttribute("outputclass","h3"); - writer.writeCharacters(protectEnc((*s).name)); - writer.writeEndElement(); //

    + xmlWriter().writeAttribute("outputclass","h3"); + xmlWriter().writeCharacters(protectEnc((*s).name)); + xmlWriter().writeEndElement(); //

    if (idx == Class) generateCompactList(0, marker, ncmap.value(), false, QString("Q")); else if (idx == QmlClass) @@ -963,23 +963,24 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, pmap = parentmaps.begin(); while (pmap != parentmaps.end()) { NodeList nlist = pmap->values(); - writer.writeStartElement("p"); - writer.writeCharacters("Class "); - writer.writeStartElement("xref"); - writer.writeAttribute("href",linkForNode(pmap.key(), 0)); + xmlWriter().writeStartElement("p"); + xmlWriter().writeCharacters("Class "); + xmlWriter().writeStartElement("xref"); + xmlWriter().writeAttribute("href",linkForNode(pmap.key(), 0)); QStringList pieces = fullName(pmap.key(), 0, marker).split("::"); - writer.writeCharacters(protectEnc(pieces.last())); - writer.writeEndElement(); // - writer.writeCharacters(":"); - writer.writeEndElement(); //

    + xmlWriter().writeCharacters(protectEnc(pieces.last())); + xmlWriter().writeEndElement(); // + xmlWriter().writeCharacters(":"); + xmlWriter().writeEndElement(); //

    generateSection(nlist, 0, marker, CodeMarker::Summary); - writer.writeEmptyElement("br"); + xmlWriter().writeEmptyElement("br"); ++pmap; } } - else + else { generateSection(s->members, 0, marker, CodeMarker::Summary); + } } ++idx; ++s; @@ -995,39 +996,39 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, if (atom->next() != 0) text = atom->next()->string(); if (atom->type() == Atom::Image) { - writer.writeStartElement("p"); - writer.writeAttribute("outputclass","centerAlign"); + xmlWriter().writeStartElement("p"); + xmlWriter().writeAttribute("outputclass","centerAlign"); } if (fileName.isEmpty()) { - writer.writeStartElement("font"); - writer.writeAttribute("color","red"); - writer.writeCharacters("[Missing image: "); - writer.writeCharacters(protectEnc(atom->string())); - writer.writeEndElement(); // + xmlWriter().writeStartElement("font"); + xmlWriter().writeAttribute("color","red"); + xmlWriter().writeCharacters("[Missing image: "); + xmlWriter().writeCharacters(protectEnc(atom->string())); + xmlWriter().writeEndElement(); // } else { - writer.writeStartElement("img"); - writer.writeAttribute("src",protectEnc(fileName)); + xmlWriter().writeStartElement("img"); + xmlWriter().writeAttribute("src",protectEnc(fileName)); if (!text.isEmpty()) - writer.writeAttribute("alt",protectEnc(text)); - writer.writeEndElement(); // + xmlWriter().writeAttribute("alt",protectEnc(text)); + xmlWriter().writeEndElement(); // } if (atom->type() == Atom::Image) - writer.writeEndElement(); //

    + xmlWriter().writeEndElement(); //

    } break; case Atom::ImageText: // nothing break; case Atom::LegaleseLeft: - writer.writeStartElement("p"); - writer.writeAttribute("outputclass","legalese"); + xmlWriter().writeStartElement("p"); + xmlWriter().writeAttribute("outputclass","legalese"); break; case Atom::LegaleseRight: - writer.writeEndElement(); //

    + xmlWriter().writeEndElement(); //

    break; case Atom::LineBreak: - writer.writeEmptyElement("br"); + xmlWriter().writeEmptyElement("br"); break; case Atom::Link: { @@ -1051,64 +1052,64 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, break; case Atom::ListLeft: if (in_para) { - writer.writeEndElement(); //

    + xmlWriter().writeEndElement(); //

    in_para = false; } if (atom->string() == ATOM_LIST_BULLET) { - writer.writeStartElement("ul"); + xmlWriter().writeStartElement("ul"); } else if (atom->string() == ATOM_LIST_TAG) { - writer.writeStartElement("dl"); + xmlWriter().writeStartElement("dl"); } else if (atom->string() == ATOM_LIST_VALUE) { threeColumnEnumValueTable = isThreeColumnEnumValueTable(atom); if (threeColumnEnumValueTable) { - writer.writeStartElement("simpletable"); - writer.writeAttribute("outputclass","valuelist"); - writer.writeStartElement("sthead"); + xmlWriter().writeStartElement("simpletable"); + xmlWriter().writeAttribute("outputclass","valuelist"); + xmlWriter().writeStartElement("sthead"); if (++numTableRows % 2 == 1) - writer.writeAttribute("outputclass","odd"); + xmlWriter().writeAttribute("outputclass","odd"); else - writer.writeAttribute("outputclass","even"); - writer.writeStartElement("stentry"); - writer.writeCharacters("Constant"); - writer.writeEndElement(); // - writer.writeStartElement("stentry"); - writer.writeCharacters("Value"); - writer.writeEndElement(); // - writer.writeStartElement("stentry"); - writer.writeCharacters("Description"); - writer.writeEndElement(); // - writer.writeEndElement(); // + xmlWriter().writeAttribute("outputclass","even"); + xmlWriter().writeStartElement("stentry"); + xmlWriter().writeCharacters("Constant"); + xmlWriter().writeEndElement(); // + xmlWriter().writeStartElement("stentry"); + xmlWriter().writeCharacters("Value"); + xmlWriter().writeEndElement(); // + xmlWriter().writeStartElement("stentry"); + xmlWriter().writeCharacters("Description"); + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // } else { - writer.writeStartElement("simpletable"); - writer.writeAttribute("outputclass","valuelist"); - writer.writeStartElement("sthead"); - writer.writeStartElement("stentry"); - writer.writeCharacters("Constant"); - writer.writeEndElement(); // - writer.writeStartElement("stentry"); - writer.writeCharacters("Value"); - writer.writeEndElement(); // - writer.writeEndElement(); // + xmlWriter().writeStartElement("simpletable"); + xmlWriter().writeAttribute("outputclass","valuelist"); + xmlWriter().writeStartElement("sthead"); + xmlWriter().writeStartElement("stentry"); + xmlWriter().writeCharacters("Constant"); + xmlWriter().writeEndElement(); // + xmlWriter().writeStartElement("stentry"); + xmlWriter().writeCharacters("Value"); + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // } } else { - writer.writeStartElement("ol"); + xmlWriter().writeStartElement("ol"); if (atom->string() == ATOM_LIST_UPPERALPHA) - writer.writeAttribute("outputclass","upperalpha"); + xmlWriter().writeAttribute("outputclass","upperalpha"); else if (atom->string() == ATOM_LIST_LOWERALPHA) - writer.writeAttribute("outputclass","loweralpha"); + xmlWriter().writeAttribute("outputclass","loweralpha"); else if (atom->string() == ATOM_LIST_UPPERROMAN) - writer.writeAttribute("outputclass","upperroman"); + xmlWriter().writeAttribute("outputclass","upperroman"); else if (atom->string() == ATOM_LIST_LOWERROMAN) - writer.writeAttribute("outputclass","lowerroman"); + xmlWriter().writeAttribute("outputclass","lowerroman"); else // (atom->string() == ATOM_LIST_NUMERIC) - writer.writeAttribute("outputclass","numeric"); + xmlWriter().writeAttribute("outputclass","numeric"); if (atom->next() != 0 && atom->next()->string().toInt() != 1) { // I don't think this attribute is supported. - writer.writeAttribute("start",atom->next()->string()); + xmlWriter().writeAttribute("start",atom->next()->string()); } } break; @@ -1117,19 +1118,19 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, break; case Atom::ListTagLeft: if (atom->string() == ATOM_LIST_TAG) { - writer.writeStartElement("dt"); + xmlWriter().writeStartElement("dt"); } else { // (atom->string() == ATOM_LIST_VALUE) - writer.writeStartElement("strow"); - writer.writeStartElement("stentry"); - writer.writeAttribute("outputclass","topAlign"); - writer.writeStartElement("tt"); - writer.writeCharacters(protectEnc(plainCode(marker->markedUpEnumValue(atom->next()->string(), + xmlWriter().writeStartElement("strow"); + xmlWriter().writeStartElement("stentry"); + xmlWriter().writeAttribute("outputclass","topAlign"); + xmlWriter().writeStartElement("tt"); + xmlWriter().writeCharacters(protectEnc(plainCode(marker->markedUpEnumValue(atom->next()->string(), relative)))); - writer.writeEndElement(); //
    - writer.writeEndElement(); // - writer.writeStartElement("stentry"); - writer.writeAttribute("outputclass","topAlign"); + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // + xmlWriter().writeStartElement("stentry"); + xmlWriter().writeAttribute("outputclass","topAlign"); QString itemValue; if (relative->type() == Node::Enum) { @@ -1138,105 +1139,105 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, } if (itemValue.isEmpty()) - writer.writeCharacters("?"); + xmlWriter().writeCharacters("?"); else { - writer.writeStartElement("tt"); - writer.writeCharacters(protectEnc(itemValue)); - writer.writeEndElement(); // + xmlWriter().writeStartElement("tt"); + xmlWriter().writeCharacters(protectEnc(itemValue)); + xmlWriter().writeEndElement(); // } skipAhead = 1; } break; case Atom::ListTagRight: if (atom->string() == ATOM_LIST_TAG) - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // break; case Atom::ListItemLeft: if (atom->string() == ATOM_LIST_TAG) { - writer.writeStartElement("dd"); + xmlWriter().writeStartElement("dd"); } else if (atom->string() == ATOM_LIST_VALUE) { if (threeColumnEnumValueTable) { - writer.writeEndElement(); // - writer.writeStartElement("stentry"); - writer.writeAttribute("outputclass","topAlign"); + xmlWriter().writeEndElement(); // + xmlWriter().writeStartElement("stentry"); + xmlWriter().writeAttribute("outputclass","topAlign"); if (matchAhead(atom, Atom::ListItemRight)) - writer.writeCharacters(" "); + xmlWriter().writeCharacters(" "); } } else { - writer.writeStartElement("li"); + xmlWriter().writeStartElement("li"); } if (matchAhead(atom, Atom::ParaLeft)) skipAhead = 1; break; case Atom::ListItemRight: if (atom->string() == ATOM_LIST_TAG) { - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // } else if (atom->string() == ATOM_LIST_VALUE) { - writer.writeEndElement(); // - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // } else { - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // } break; case Atom::ListRight: if (atom->string() == ATOM_LIST_BULLET) { - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // } else if (atom->string() == ATOM_LIST_TAG) { - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // } else if (atom->string() == ATOM_LIST_VALUE) { - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // } else { - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // } break; case Atom::Nop: // nothing break; case Atom::ParaLeft: - writer.writeStartElement("p"); + xmlWriter().writeStartElement("p"); in_para = true; break; case Atom::ParaRight: endLink(); if (in_para) { - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // break; case Atom::RawString: - writer.writeCharacters(atom->string()); + xmlWriter().writeCharacters(atom->string()); break; case Atom::SectionLeft: - writer.writeStartElement("p"); + xmlWriter().writeStartElement("p"); writeGuidAttribute(Doc::canonicalTitle(Text::sectionHeading(atom).toString())); - writer.writeAttribute("outputclass","target"); - writer.writeCharacters(protectEnc(Text::sectionHeading(atom).toString())); - writer.writeEndElement(); //

    + xmlWriter().writeAttribute("outputclass","target"); + xmlWriter().writeCharacters(protectEnc(Text::sectionHeading(atom).toString())); + xmlWriter().writeEndElement(); //

    break; case Atom::SectionRight: // nothing break; case Atom::SectionHeadingLeft: - writer.writeStartElement("p"); + xmlWriter().writeStartElement("p"); hx = "h" + QString::number(atom->string().toInt() + hOffset(relative)); - writer.writeAttribute("outputclass",hx); + xmlWriter().writeAttribute("outputclass",hx); inSectionHeading = true; break; case Atom::SectionHeadingRight: - writer.writeEndElement(); //

    (see case Atom::SectionHeadingLeft) + xmlWriter().writeEndElement(); //

    (see case Atom::SectionHeadingLeft) inSectionHeading = false; break; case Atom::SidebarLeft: @@ -1250,17 +1251,17 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, generateLink(atom, relative, marker); } else { - writer.writeCharacters(protectEnc(atom->string())); + xmlWriter().writeCharacters(protectEnc(atom->string())); } break; case Atom::TableLeft: { if (in_para) { - writer.writeEndElement(); //

    + xmlWriter().writeEndElement(); //

    in_para = false; } - writer.writeStartElement("table"); - writer.writeAttribute("outputclass","generic"); + xmlWriter().writeStartElement("table"); + xmlWriter().writeAttribute("outputclass","generic"); numTableRows = 0; if (tableColumnCount != 0) { qDebug() << "ERROR: Nested tables!"; @@ -1274,62 +1275,62 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, ++tableColumnCount; t = t->next(); } - writer.writeStartElement("tgroup"); - writer.writeAttribute("cols",QString::number(tableColumnCount)); + xmlWriter().writeStartElement("tgroup"); + xmlWriter().writeAttribute("cols",QString::number(tableColumnCount)); } break; case Atom::TableRight: - writer.writeEndElement(); // - writer.writeEndElement(); // - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // tableColumnCount = 0; break; case Atom::TableHeaderLeft: - writer.writeStartElement("thead"); - writer.writeStartElement("row"); - writer.writeAttribute("outputclass","qt-style topAlign"); + xmlWriter().writeStartElement("thead"); + xmlWriter().writeStartElement("row"); + xmlWriter().writeAttribute("outputclass","qt-style topAlign"); inTableHeader = true; inTableBody = false; break; case Atom::TableHeaderRight: - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // if (matchAhead(atom, Atom::TableHeaderLeft)) { skipAhead = 1; - writer.writeStartElement("row"); - writer.writeAttribute("outputclass","qt-style topAlign"); + xmlWriter().writeStartElement("row"); + xmlWriter().writeAttribute("outputclass","qt-style topAlign"); } else { - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // inTableHeader = false; inTableBody = true; - writer.writeStartElement("tbody"); + xmlWriter().writeStartElement("tbody"); } break; case Atom::TableRowLeft: if (!inTableHeader && !inTableBody) { inTableBody = true; - writer.writeStartElement("tbody"); + xmlWriter().writeStartElement("tbody"); } - writer.writeStartElement("row"); + xmlWriter().writeStartElement("row"); if (++numTableRows % 2 == 1) - writer.writeAttribute("outputclass","odd topAlign"); + xmlWriter().writeAttribute("outputclass","odd topAlign"); else - writer.writeAttribute("outputclass","even topAlign"); + xmlWriter().writeAttribute("outputclass","even topAlign"); break; case Atom::TableRowRight: - writer.writeEndElement(); // \n"; + xmlWriter().writeEndElement(); // \n"; break; case Atom::TableItemLeft: { if (inTableHeader) - writer.writeStartElement("entry"); + xmlWriter().writeStartElement("entry"); else - writer.writeStartElement("entry"); + xmlWriter().writeStartElement("entry"); QStringList spans = atom->string().split(","); if (spans.size() == 2) { if (!inTableHeader) - writer.writeStartElement("p"); + xmlWriter().writeStartElement("p"); } if (matchAhead(atom, Atom::ParaLeft)) skipAhead = 1; @@ -1337,10 +1338,10 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, break; case Atom::TableItemRight: if (inTableHeader) - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // else { - writer.writeEndElement(); //

    - writer.writeEndElement(); // + xmlWriter().writeEndElement(); //

    + xmlWriter().writeEndElement(); // } if (matchAhead(atom, Atom::ParaLeft)) skipAhead = 1; @@ -1375,23 +1376,23 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, } break; case Atom::Target: - writer.writeStartElement("p"); + xmlWriter().writeStartElement("p"); writeGuidAttribute(Doc::canonicalTitle(atom->string())); - writer.writeAttribute("outputclass","target"); - writer.writeCharacters(protectEnc(atom->string())); - writer.writeEndElement(); //

    + xmlWriter().writeAttribute("outputclass","target"); + xmlWriter().writeCharacters(protectEnc(atom->string())); + xmlWriter().writeEndElement(); //

    break; case Atom::UnhandledFormat: - writer.writeStartElement("b"); - writer.writeAttribute("outputclass","redFont"); - writer.writeCharacters("<Missing DITAXML>"); - writer.writeEndElement(); // + xmlWriter().writeStartElement("b"); + xmlWriter().writeAttribute("outputclass","redFont"); + xmlWriter().writeCharacters("<Missing DITAXML>"); + xmlWriter().writeEndElement(); // break; case Atom::UnknownCommand: - writer.writeStartElement("b"); - writer.writeAttribute("outputclass","redFont code"); - writer.writeCharacters(protectEnc(atom->string())); - writer.writeEndElement(); // + xmlWriter().writeStartElement("b"); + xmlWriter().writeAttribute("outputclass","redFont code"); + xmlWriter().writeCharacters(protectEnc(atom->string())); + xmlWriter().writeEndElement(); // break; case Atom::QmlText: case Atom::EndQmlText: @@ -1433,51 +1434,44 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark fullTitle = marker->plainFullName(inner); title = rawTitle + " Class Reference"; - generateHeader(inner); - - writer.writeStartElement(CXXCLASS); - writer.writeAttribute("id",cn->guid()); - writer.writeStartElement(APINAME); - writer.writeCharacters(fullTitle); - writer.writeEndElement(); // - + generateHeader(inner, fullTitle); generateBrief(inner, marker); // // not included: - writer.writeStartElement(CXXCLASSDETAIL); - writer.writeStartElement(CXXCLASSDEFINITION); - writer.writeStartElement(CXXCLASSACCESSSPECIFIER); - writer.writeAttribute("value",inner->accessString()); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXCLASSDETAIL); + xmlWriter().writeStartElement(CXXCLASSDEFINITION); + xmlWriter().writeStartElement(CXXCLASSACCESSSPECIFIER); + xmlWriter().writeAttribute("value",inner->accessString()); + xmlWriter().writeEndElement(); // if (cn->isAbstract()) { - writer.writeStartElement(CXXCLASSABSTRACT); - writer.writeAttribute("name","abstract"); - writer.writeAttribute("value","abstract"); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXCLASSABSTRACT); + xmlWriter().writeAttribute("name","abstract"); + xmlWriter().writeAttribute("value","abstract"); + xmlWriter().writeEndElement(); // } writeDerivations(cn, marker); // // not included: writeLocation(cn); - writer.writeEndElement(); // - writer.writeStartElement(APIDESC); + xmlWriter().writeEndElement(); // + xmlWriter().writeStartElement(APIDESC); if (!inner->doc().isEmpty()) { - writer.writeStartElement("p"); - writer.writeAttribute("outputclass","h2"); - writer.writeCharacters("Detailed Description"); - writer.writeEndElement(); //

    + xmlWriter().writeStartElement("p"); + xmlWriter().writeAttribute("outputclass","h2"); + xmlWriter().writeCharacters("Detailed Description"); + xmlWriter().writeEndElement(); //

    generateBody(inner, marker); // generateAlsoList(inner, marker); } - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // // not included: ,
    , or - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // // not included: // not included: @@ -1506,7 +1500,7 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark // not included: - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // } } @@ -1518,15 +1512,15 @@ void DitaXmlGenerator::writeTargetAndHeader(const QString& target, const QString& header, const QString& attribute) { - writer.writeStartElement("p"); + xmlWriter().writeStartElement("p"); writeGuidAttribute(registerRef(target)); - writer.writeAttribute("outputclass","target"); - writer.writeCharacters(header); - writer.writeEndElement(); //

    - writer.writeStartElement("p"); - writer.writeAttribute("outputclass",attribute); - writer.writeCharacters(header); - writer.writeEndElement(); //

    + xmlWriter().writeAttribute("outputclass","target"); + xmlWriter().writeCharacters(header); + xmlWriter().writeEndElement(); //

    + xmlWriter().writeStartElement("p"); + xmlWriter().writeAttribute("outputclass",attribute); + xmlWriter().writeCharacters(header); + xmlWriter().writeEndElement(); //

    } /*! @@ -1534,12 +1528,15 @@ void DitaXmlGenerator::writeTargetAndHeader(const QString& target, */ void DitaXmlGenerator::writeXrefListItem(const QString& link, const QString& text) { - writer.writeStartElement("li"); - writer.writeStartElement("xref"); - writer.writeAttribute("href",link); - writer.writeCharacters(text); - writer.writeEndElement(); // - writer.writeEndElement(); // + qDebug() << "WXLI 1" << link; + xmlWriter().writeStartElement("li"); + xmlWriter().writeStartElement("xref"); + xmlWriter().writeAttribute("href",link); + qDebug() << "WXLI 2"; + xmlWriter().writeCharacters(text); + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // + qDebug() << "WXLI 3"; } /*! @@ -1554,12 +1551,6 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker QString fullTitle = fake->fullTitle(); QString htmlTitle = fullTitle; - /* - NOTE: For now we only handle \page elements. - */ - //if (fake->subType() != Node::Page) - //return; - if (fake->subType() == Node::File && !fake->subTitle().isEmpty()) { subTitleSize = SmallSubTitle; htmlTitle += " (" + fake->subTitle() + ")"; @@ -1569,47 +1560,7 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker htmlTitle = fullTitle; } - QString outputclass; - switch (fake->subType()) { - case Node::Page: - outputclass = "page"; - break; - case Node::Group: - outputclass = "group"; - break; - case Node::Example: - outputclass = "example"; - break; - case Node::HeaderFile: - outputclass = "header"; - break; - case Node::File: - outputclass = "file"; - break; - case Node::Image: - outputclass = "image"; - break; - case Node::Module: - outputclass = "module"; - break; - case Node::ExternalPage: - outputclass = "externalpage"; - break; - case Node::QmlClass: - outputclass = "QML"; - break; - default: - return; - } - - generateHeader(fake); - - writer.writeStartElement("topic"); - writer.writeAttribute("id",fake->guid()); - writer.writeAttribute("outputclass",outputclass); - writer.writeStartElement("title"); - writer.writeCharacters(fullTitle); - writer.writeEndElement(); // + generateHeader(fake, fullTitle); generateBrief(fake, marker); // if (fake->subType() == Node::Module) { @@ -1625,7 +1576,7 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker } else if (fake->subType() == Node::HeaderFile) { generateStatus(fake, marker); - writer.writeStartElement("ul"); + xmlWriter().writeStartElement("ul"); QString membersLink = generateListOfAllMemberFile(fake, marker); if (!membersLink.isEmpty()) { @@ -1646,11 +1597,11 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker writeXrefListItem(compatLink,"Qt 3 support members"); } - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // } if (!fake->doc().isEmpty()) { - writer.writeStartElement("body"); + xmlWriter().writeStartElement("body"); if (fake->subType() == Node::Module) { writeTargetAndHeader("details","Detailed Description","h2"); } @@ -1666,9 +1617,9 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker generateAnnotatedList(fake, marker, groupMembersMap); } - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // } - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // } #if 0 @@ -1732,7 +1683,8 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker while (s != sections.end()) { out() << "\n"; out() << "

    " << protectEnc((*s).name) << "

    \n"; - generateSectionList(*s, fake, marker, CodeMarker::Summary); + generateSection(s->members, fake, marker, CodeMarker::Summary); + generateSectionInheritedList(*s, relative, marker, name_alignment); ++s; } @@ -1862,52 +1814,77 @@ void DitaXmlGenerator::generateBreadCrumbs(const QString& title, \note This does not cover all cases yet. */ -void DitaXmlGenerator::generateHeader(const Node* node) +void DitaXmlGenerator::generateHeader(const Node* node, const QString& name) { - writer.setDevice(out().device()); - writer.setAutoFormatting(true); - writer.setAutoFormattingIndent(4); - writer.writeStartDocument(); - if (!node) return; QString doctype; - QString element; + QString mainElement; + QString nameElement; QString dtd; QString base; QString version; + QString outputclass; + if (node->type() == Node::Class) { - element = "cxxClass"; + mainElement = "cxxClass"; + nameElement = "apiName"; dtd = "dtd/cxxClass.dtd"; version = "0.6.0"; - doctype = ""; } else if (node->type() == Node::Fake) { + mainElement = "topic"; + nameElement = "title"; + dtd = "dtd/topic.dtd"; + doctype = ""; switch (node->subType()) { case Node::Page: + outputclass = "page"; + break; case Node::Group: + outputclass = "group"; + break; case Node::Example: + outputclass = "example"; + break; case Node::HeaderFile: + outputclass = "header"; + break; case Node::File: + outputclass = "file"; + break; case Node::Image: + outputclass = "image"; + break; case Node::Module: + outputclass = "module"; + break; case Node::ExternalPage: + outputclass = "externalpage"; + break; case Node::QmlClass: - element = "topic"; - dtd = "dtd/topic.dtd"; - doctype = ""; + outputclass = "QML"; break; default: - break; + outputclass = "page"; } } - writer.writeDTD(doctype); - writer.writeComment(node->doc().location().fileName()); + xmlWriter().writeDTD(doctype); + xmlWriter().writeComment(node->doc().location().fileName()); + + xmlWriter().writeStartElement(mainElement); + xmlWriter().writeAttribute("id",node->guid()); + if (!outputclass.isEmpty()) + xmlWriter().writeAttribute("outputclass",outputclass); + xmlWriter().writeStartElement(nameElement); + xmlWriter().writeCharacters(name); + xmlWriter().writeEndElement(); // } void DitaXmlGenerator::generateTitle(const QString& title, @@ -1916,16 +1893,22 @@ void DitaXmlGenerator::generateTitle(const QString& title, const Node *relative, CodeMarker *marker) { - if (!title.isEmpty()) - out() << "

    " << protectEnc(title) << "

    \n"; + if (!title.isEmpty()) { + xmlWriter().writeStartElement("p"); + xmlWriter().writeAttribute("outputclass", "h1 title"); + xmlWriter().writeCharacters(protectEnc(title)); + xmlWriter().writeEndElement(); //

    + } if (!subTitle.isEmpty()) { - out() << ""; - else - out() << " class=\"subtitle\">"; + xmlWriter().writeStartElement("p"); + if (subTitleSize == SmallSubTitle) { + xmlWriter().writeAttribute("outputclass", "small-subtitle"); + } + else { + xmlWriter().writeAttribute("outputclass", "subtitle"); + } generateText(subTitle, relative, marker); - out() << "\n"; + xmlWriter().writeEndElement(); //

    } } @@ -1937,9 +1920,9 @@ void DitaXmlGenerator::generateBrief(const Node* node, CodeMarker* marker) Text brief = node->doc().briefText(); if (!brief.isEmpty()) { ++noLinks; - writer.writeStartElement(SHORTDESC); + xmlWriter().writeStartElement(SHORTDESC); generateText(brief, node, marker); - writer.writeEndElement(); // shortdesc + xmlWriter().writeEndElement(); // shortdesc --noLinks; } } @@ -1947,10 +1930,10 @@ void DitaXmlGenerator::generateBrief(const Node* node, CodeMarker* marker) void DitaXmlGenerator::generateIncludes(const InnerNode *inner, CodeMarker *marker) { if (!inner->includes().isEmpty()) { - writer.writeStartElement("pree"); - writer.writeAttribute("outputclass","highlightedcode"); + xmlWriter().writeStartElement("pree"); + xmlWriter().writeAttribute("outputclass","highlightedcode"); writeText(marker->markedUpIncludes(inner->includes()), marker, inner); - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // } } @@ -2154,8 +2137,8 @@ void DitaXmlGenerator::generateTableOfContents(const Node *node, inLink = false; } -QString DitaXmlGenerator::generateListOfAllMemberFile(const InnerNode *inner, - CodeMarker *marker) +QString DitaXmlGenerator::generateListOfAllMemberFile(const InnerNode* inner, + CodeMarker* marker) { QList
    sections; QList
    ::ConstIterator s; @@ -2169,26 +2152,25 @@ QString DitaXmlGenerator::generateListOfAllMemberFile(const InnerNode *inner, QString fileName = fileBase(inner) + "-members." + fileExtension(inner); beginSubPage(inner->location(), fileName); QString title = "List of All Members for " + inner->name(); - generateHeader(inner); + generateHeader(inner, title); + xmlWriter().writeStartElement("body"); generateTitle(title, Text(), SmallSubTitle, inner, marker); out() << "

    This is the complete list of members for "; generateFullName(inner, 0, marker); out() << ", including inherited members.

    \n"; Section section = sections.first(); - generateSectionList(section, 0, marker, CodeMarker::SeparateList); - + generateSection(section.members, 0, marker, CodeMarker::SeparateList); + xmlWriter().writeEndElement(); // endSubPage(); return fileName; } QString DitaXmlGenerator::generateLowStatusMemberFile(const InnerNode* inner, - CodeMarker* marker, - CodeMarker::Status status) + CodeMarker* marker, + CodeMarker::Status status) { - QList
    sections = marker->sections(inner, - CodeMarker::Summary, - status); + QList
    sections = marker->sections(inner,CodeMarker::Summary,status); QMutableListIterator
    j(sections); while (j.hasNext()) { if (j.next().members.size() == 0) @@ -2211,44 +2193,61 @@ QString DitaXmlGenerator::generateLowStatusMemberFile(const InnerNode* inner, } beginSubPage(inner->location(), fileName); - generateHeader(inner); + generateHeader(inner, title); + xmlWriter().writeStartElement("body"); generateTitle(title, Text(), SmallSubTitle, inner, marker); if (status == CodeMarker::Compat) { - out() << "

    The following class members are part of the " - "Qt 3 support layer. " - "They are provided to help you port old code to Qt 4. We advise against " - "using them in new code.

    \n"; + xmlWriter().writeStartElement("p"); + xmlWriter().writeCharacters("

    The following class members are part of the " + "Qt 3 support layer." + " They are provided to help you port old code to Qt 4. " + "We advise against using them in new code."); + xmlWriter().writeEndElement(); //

    } else { - out() << "

    The following class members are obsolete. " - << "They are provided to keep old source code working. " - << "We strongly advise against using them in new code.

    \n"; - } - - out() << "

    • " - << protectEnc(inner->name()) - << " class reference

    \n"; - + xmlWriter().writeStartElement("p"); + xmlWriter().writeCharacters("The following class members are obsolete. " + "They are provided to keep old source code working. " + "We strongly advise against using them in new code."); + xmlWriter().writeEndElement(); //

    + } + xmlWriter().writeStartElement("p"); + xmlWriter().writeStartElement("ul"); + QString text = protectEnc(inner->name()) + " class reference"; + writeXrefListItem(linkForNode(inner,0),text); + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); //

    + for (i = 0; i < sections.size(); ++i) { - out() << "

    " << protectEnc(sections.at(i).name) << "

    \n"; - generateSectionList(sections.at(i), inner, marker, CodeMarker::Summary); + xmlWriter().writeStartElement("p"); + xmlWriter().writeAttribute("outputclass","h2"); + xmlWriter().writeCharacters(protectEnc(sections.at(i).name)); + xmlWriter().writeEndElement(); //

    + generateSection(sections.at(i).members, inner, marker, CodeMarker::Summary); + generateSectionInheritedList(sections.at(i), inner, marker); } sections = marker->sections(inner, CodeMarker::Detailed, status); for (i = 0; i < sections.size(); ++i) { - out() << "
    \n"; - out() << "

    " << protectEnc(sections.at(i).name) << "

    \n"; + xmlWriter().writeStartElement("p"); + xmlWriter().writeAttribute("outputclass","separator"); + xmlWriter().writeEndElement(); //

    + xmlWriter().writeStartElement("p"); + xmlWriter().writeAttribute("outputclass","h2"); + xmlWriter().writeCharacters(protectEnc(sections.at(i).name)); + xmlWriter().writeEndElement(); //

    NodeList::ConstIterator m = sections.at(i).members.begin(); while (m != sections.at(i).members.end()) { - if ((*m)->access() != Node::Private) + if ((*m)->access() != Node::Private) { generateDetailedMember(*m, inner, marker); + } ++m; } } - + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // endSubPage(); return fileName; } @@ -2303,11 +2302,11 @@ void DitaXmlGenerator::generateAnnotatedList(const Node* relative, CodeMarker* marker, const NodeMap& nodeMap) { - writer.writeStartElement("table"); - writer.writeAttribute("outputclass","annotated"); - writer.writeStartElement("tgroup"); - writer.writeAttribute("cols","2"); - writer.writeStartElement("tbody"); + xmlWriter().writeStartElement("table"); + xmlWriter().writeAttribute("outputclass","annotated"); + xmlWriter().writeStartElement("tgroup"); + xmlWriter().writeAttribute("cols","2"); + xmlWriter().writeStartElement("tbody"); int row = 0; foreach (const QString& name, nodeMap.keys()) { @@ -2316,39 +2315,39 @@ void DitaXmlGenerator::generateAnnotatedList(const Node* relative, if (node->status() == Node::Obsolete) continue; - writer.writeStartElement("row"); + xmlWriter().writeStartElement("row"); if (++row % 2 == 1) - writer.writeAttribute("outputclass","odd topAlign"); + xmlWriter().writeAttribute("outputclass","odd topAlign"); else - writer.writeAttribute("outputclass","even topAlign"); - writer.writeStartElement("entry"); - writer.writeStartElement("p"); + xmlWriter().writeAttribute("outputclass","even topAlign"); + xmlWriter().writeStartElement("entry"); + xmlWriter().writeStartElement("p"); generateFullName(node, relative, marker); - writer.writeEndElement(); //

    - writer.writeEndElement(); // + xmlWriter().writeEndElement(); //

    + xmlWriter().writeEndElement(); // if (!(node->type() == Node::Fake)) { Text brief = node->doc().trimmedBriefText(name); if (!brief.isEmpty()) { - writer.writeStartElement("entry"); - writer.writeStartElement("p"); + xmlWriter().writeStartElement("entry"); + xmlWriter().writeStartElement("p"); generateText(brief, node, marker); - writer.writeEndElement(); //

    - writer.writeEndElement(); // + xmlWriter().writeEndElement(); //

    + xmlWriter().writeEndElement(); // } } else { - writer.writeStartElement("entry"); - writer.writeStartElement("p"); - writer.writeCharacters(protectEnc(node->doc().briefText().toString())); - writer.writeEndElement(); //

    - writer.writeEndElement(); // + xmlWriter().writeStartElement("entry"); + xmlWriter().writeStartElement("p"); + xmlWriter().writeCharacters(protectEnc(node->doc().briefText().toString())); + xmlWriter().writeEndElement(); //

    + xmlWriter().writeEndElement(); // } - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // } - writer.writeEndElement(); // - writer.writeEndElement(); // - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // } /*! @@ -2484,27 +2483,27 @@ void DitaXmlGenerator::generateCompactList(const Node* relative, Output the alphabet as a row of links. */ if (includeAlphabet) { - writer.writeStartElement("p"); - writer.writeAttribute("outputclass","centerAlign functionIndex"); - writer.writeStartElement("b"); + xmlWriter().writeStartElement("p"); + xmlWriter().writeAttribute("outputclass","centerAlign functionIndex"); + xmlWriter().writeStartElement("b"); for (int i = 0; i < 26; i++) { QChar ch('a' + i); if (usedParagraphNames.contains(char('a' + i))) { - writer.writeStartElement("xref"); - writer.writeAttribute("href",QString("#%1").arg(ch)); - writer.writeCharacters(QString(ch.toUpper())); - writer.writeEndElement(); // + xmlWriter().writeStartElement("xref"); + xmlWriter().writeAttribute("href",QString("#%1").arg(ch)); + xmlWriter().writeCharacters(QString(ch.toUpper())); + xmlWriter().writeEndElement(); // } } - writer.writeEndElement(); // - writer.writeEndElement(); //

    + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); //

    } /* Output a

    element to contain all the

    elements. */ - writer.writeStartElement("p"); - writer.writeAttribute("outputclass","compactlist flowListDiv"); + xmlWriter().writeStartElement("p"); + xmlWriter().writeAttribute("outputclass","compactlist flowListDiv"); for (int i=0; i 0) { - writer.writeEndElement(); // - writer.writeEndElement(); //
    + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // } - writer.writeStartElement("dl"); + xmlWriter().writeStartElement("dl"); if (++numTableRows % 2 == 1) - writer.writeAttribute("outputclass","flowList odd"); + xmlWriter().writeAttribute("outputclass","flowList odd"); else - writer.writeAttribute("outputclass","flowList even"); - writer.writeStartElement("dlentry"); - writer.writeStartElement("dt"); - writer.writeAttribute("outputclass","alphaChar"); + xmlWriter().writeAttribute("outputclass","flowList even"); + xmlWriter().writeStartElement("dlentry"); + xmlWriter().writeStartElement("dt"); + xmlWriter().writeAttribute("outputclass","alphaChar"); if (includeAlphabet) { QChar c = paragraphName[curParNr][0].toLower(); - writer.writeStartElement("a"); - writer.writeAttribute("name",c); + xmlWriter().writeStartElement("a"); + xmlWriter().writeAttribute("name",c); } - writer.writeStartElement("b"); - writer.writeCharacters(paragraphName[curParNr]); - writer.writeEndElement(); // - writer.writeEndElement(); // + xmlWriter().writeStartElement("b"); + xmlWriter().writeCharacters(paragraphName[curParNr]); + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // } /* Output a
    for the current offset in the current paragraph. */ - writer.writeStartElement("dd"); + xmlWriter().writeStartElement("dd"); if ((curParNr < NumParagraphs) && !paragraphName[curParNr].isEmpty()) { NodeMap::Iterator it; @@ -2555,74 +2554,74 @@ void DitaXmlGenerator::generateCompactList(const Node* relative, Previously, we used generateFullName() for this, but we require some special formatting. */ - writer.writeStartElement("xref"); - writer.writeAttribute("href",linkForNode(it.value(), relative)); + xmlWriter().writeStartElement("xref"); + xmlWriter().writeAttribute("href",linkForNode(it.value(), relative)); QStringList pieces; if (it.value()->subType() == Node::QmlClass) pieces << it.value()->name(); else pieces = fullName(it.value(), relative, marker).split("::"); - writer.writeCharacters(protectEnc(pieces.last())); - writer.writeEndElement(); // + xmlWriter().writeCharacters(protectEnc(pieces.last())); + xmlWriter().writeEndElement(); // if (pieces.size() > 1) { - writer.writeCharacters(" ("); + xmlWriter().writeCharacters(" ("); generateFullName(it.value()->parent(),relative,marker); - writer.writeCharacters(")"); + xmlWriter().writeCharacters(")"); } } - writer.writeEndElement(); //
    + xmlWriter().writeEndElement(); // curParOffset++; } - writer.writeEndElement(); // - writer.writeEndElement(); // - writer.writeEndElement(); //

    + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); //

    } void DitaXmlGenerator::generateFunctionIndex(const Node* relative, CodeMarker* marker) { - writer.writeStartElement("p"); - writer.writeAttribute("outputclass","centerAlign functionIndex"); - writer.writeStartElement("b"); + xmlWriter().writeStartElement("p"); + xmlWriter().writeAttribute("outputclass","centerAlign functionIndex"); + xmlWriter().writeStartElement("b"); for (int i = 0; i < 26; i++) { QChar ch('a' + i); - writer.writeStartElement("xref"); - writer.writeAttribute("href",QString("#%1").arg(ch)); - writer.writeCharacters(QString(ch.toUpper())); - writer.writeEndElement(); // + xmlWriter().writeStartElement("xref"); + xmlWriter().writeAttribute("href",QString("#%1").arg(ch)); + xmlWriter().writeCharacters(QString(ch.toUpper())); + xmlWriter().writeEndElement(); // } - writer.writeEndElement(); // - writer.writeEndElement(); //

    + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); //

    char nextLetter = 'a'; char currentLetter; - writer.writeStartElement("ul"); + xmlWriter().writeStartElement("ul"); QMap::ConstIterator f = funcIndex.begin(); while (f != funcIndex.end()) { - writer.writeStartElement("li"); + xmlWriter().writeStartElement("li"); currentLetter = f.key()[0].unicode(); while (islower(currentLetter) && currentLetter >= nextLetter) { - writer.writeStartElement("p"); + xmlWriter().writeStartElement("p"); writeGuidAttribute(QString(nextLetter)); - writer.writeAttribute("outputclass","target"); - writer.writeCharacters(QString(nextLetter)); - writer.writeEndElement(); //

    + xmlWriter().writeAttribute("outputclass","target"); + xmlWriter().writeCharacters(QString(nextLetter)); + xmlWriter().writeEndElement(); //

    nextLetter++; } - writer.writeCharacters(protectEnc(f.key())); - writer.writeCharacters(":"); + xmlWriter().writeCharacters(protectEnc(f.key())); + xmlWriter().writeCharacters(":"); NodeMap::ConstIterator s = (*f).begin(); while (s != (*f).end()) { generateFullName((*s)->parent(), relative, marker, *s); ++s; } - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // ++f; } - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // } void DitaXmlGenerator::generateLegaleseList(const Node *relative, @@ -2807,24 +2806,24 @@ void DitaXmlGenerator::generateSection(const NodeList& nl, name_alignment = false; } if (name_alignment) { - writer.writeStartElement("table"); - writer.writeAttribute("outputclass","alignedsummary"); - writer.writeStartElement("tgroup"); - writer.writeAttribute("cols","2"); - writer.writeStartElement("tbody"); + xmlWriter().writeStartElement("table"); + xmlWriter().writeAttribute("outputclass","alignedsummary"); + xmlWriter().writeStartElement("tgroup"); + xmlWriter().writeAttribute("cols","2"); + xmlWriter().writeStartElement("tbody"); } else { if (twoColumn) { - writer.writeStartElement("table"); - writer.writeAttribute("outputclass","propsummary"); - writer.writeStartElement("tgroup"); - writer.writeAttribute("cols","1"); - writer.writeStartElement("tbody"); - writer.writeStartElement("row"); - writer.writeStartElement("entry"); - writer.writeAttribute("outputclass","topAlign"); + xmlWriter().writeStartElement("table"); + xmlWriter().writeAttribute("outputclass","propsummary"); + xmlWriter().writeStartElement("tgroup"); + xmlWriter().writeAttribute("cols","1"); + xmlWriter().writeStartElement("tbody"); + xmlWriter().writeStartElement("row"); + xmlWriter().writeStartElement("entry"); + xmlWriter().writeAttribute("outputclass","topAlign"); } - writer.writeStartElement("ul"); + xmlWriter().writeStartElement("ul"); } int i = 0; @@ -2836,144 +2835,78 @@ void DitaXmlGenerator::generateSection(const NodeList& nl, } if (name_alignment) { - writer.writeStartElement("row"); - writer.writeStartElement("entry"); - writer.writeAttribute("outputclass","memItemLeft rightAlign topAlign"); + xmlWriter().writeStartElement("row"); + xmlWriter().writeStartElement("entry"); + xmlWriter().writeAttribute("outputclass","memItemLeft rightAlign topAlign"); } else { if (twoColumn && i == (int) (nl.count() + 1) / 2) { - writer.writeEndElement(); // - writer.writeEndElement(); //
    - writer.writeStartElement("entry"); - writer.writeAttribute("outputclass","topAlign"); - writer.writeStartElement("ul"); + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); //
    + xmlWriter().writeStartElement("entry"); + xmlWriter().writeAttribute("outputclass","topAlign"); + xmlWriter().writeStartElement("ul"); } - writer.writeStartElement("li"); - writer.writeAttribute("outputclass","fn"); + xmlWriter().writeStartElement("li"); + xmlWriter().writeAttribute("outputclass","fn"); } QString marked = getMarkedUpSynopsis(*m, relative, marker, style); writeText(marked, marker, relative, name_alignment); if (name_alignment) { - writer.writeEndElement(); //
    - writer.writeEndElement(); // + xmlWriter().writeEndElement(); //
    + xmlWriter().writeEndElement(); // } else { - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // } i++; ++m; } if (name_alignment) { - writer.writeEndElement(); // - writer.writeEndElement(); // - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // } else { - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // if (twoColumn) { - writer.writeEndElement(); //
    - writer.writeEndElement(); // - writer.writeEndElement(); // - writer.writeEndElement(); // - writer.writeEndElement(); // + xmlWriter().writeEndElement(); //
    + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // } } } } -void DitaXmlGenerator::generateSectionList(const Section& section, - const Node* relative, - CodeMarker* marker, - CodeMarker::SynopsisStyle style) -{ - bool name_alignment = true; - if (!section.members.isEmpty()) { - bool twoColumn = false; - if (style == CodeMarker::SeparateList) { - name_alignment = false; - twoColumn = (section.members.count() >= 16); - } - else if (section.members.first()->type() == Node::Property) { - twoColumn = (section.members.count() >= 5); - name_alignment = false; - } - if (name_alignment) { - out() << "\n"; - } - else { - if (twoColumn) - out() << "
    \n" - << "\n"; - else - out() << "\n"; - i++; - ++m; - } - if (name_alignment) - out() << "
    "; - out() << "
      \n"; - } - - int i = 0; - NodeList::ConstIterator m = section.members.begin(); - while (m != section.members.end()) { - if ((*m)->access() == Node::Private) { - ++m; - continue; - } - - if (name_alignment) { - out() << "
    "; - } - else { - if (twoColumn && i == (int) (section.members.count() + 1) / 2) - out() << "
      \n"; - out() << "
    • "; - } - - QString marked = getMarkedUpSynopsis(*m, relative, marker, style); - writeText(marked, marker, relative, name_alignment); - if (name_alignment) - out() << "
    \n"; - else { - out() << "\n"; - if (twoColumn) - out() << "\n\n"; - } - } - - if (style == CodeMarker::Summary && !section.inherited.isEmpty()) { - out() << "
      \n"; - generateSectionInheritedList(section, relative, marker, name_alignment); - out() << "
    \n"; - } -} - +/*! + Writes the "inherited from" lists. + */ void DitaXmlGenerator::generateSectionInheritedList(const Section& section, const Node* relative, - CodeMarker* marker, - bool nameAlignment) + CodeMarker* marker) { + if (section.inherited.isEmpty()) + return; + xmlWriter().writeStartElement("ul"); QList >::ConstIterator p = section.inherited.begin(); while (p != section.inherited.end()) { - if (nameAlignment) - out() << "
  • "; + xmlWriter().writeStartElement("li"); + xmlWriter().writeAttribute("outputclass","fn"); + QString text = (*p).second + " "; + if ((*p).second == 1) + text += section.singularMember; else - out() << "
  • "; - out() << (*p).second << " "; - if ((*p).second == 1) { - out() << section.singularMember; - } - else { - out() << section.pluralMember; - } - out() << " inherited from " - << protectEnc(marker->plainFullName((*p).first, relative)) - << "
  • \n"; + text += section.pluralMember; + text += " inherited from "; + text += protectEnc(marker->plainFullName((*p).first, relative)) + ""; + xmlWriter().writeCharacters(text); ++p; } + xmlWriter().writeEndElement(); // } /*! @@ -3044,12 +2977,12 @@ void DitaXmlGenerator::writeText(const QString& markedCode, if (src.at(i) == charLangle && src.at(i + 1).unicode() == '@') { if (nameAlignment && !done) {// && (i != 0)) Why was this here? if (!html.isEmpty()) { - writer.writeCharacters(html); + xmlWriter().writeCharacters(html); html.clear(); } - writer.writeEndElement(); // - writer.writeStartElement("entry"); - writer.writeAttribute("outputclass=","memItemRight bottomAlign"); + xmlWriter().writeEndElement(); // + xmlWriter().writeStartElement("entry"); + xmlWriter().writeAttribute("outputclass=","memItemRight bottomAlign"); done = true; } i += 2; @@ -3166,7 +3099,7 @@ void DitaXmlGenerator::writeText(const QString& markedCode, } } if (!html.isEmpty()) - writer.writeCharacters(html); + xmlWriter().writeCharacters(html); } void DitaXmlGenerator::generateLink(const Atom* atom, @@ -3178,33 +3111,33 @@ void DitaXmlGenerator::generateLink(const Atom* atom, if (funcLeftParen.indexIn(atom->string()) != -1 && marker->recognizeLanguage("Cpp")) { // hack for C++: move () outside of link int k = funcLeftParen.pos(1); - writer.writeCharacters(protectEnc(atom->string().left(k))); + xmlWriter().writeCharacters(protectEnc(atom->string().left(k))); if (link.isEmpty()) { if (showBrokenLinks) - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // } else { - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // } inLink = false; - writer.writeCharacters(protectEnc(atom->string().mid(k))); + xmlWriter().writeCharacters(protectEnc(atom->string().mid(k))); } else if (marker->recognizeLanguage("Java")) { // hack for Java: remove () and use when appropriate bool func = atom->string().endsWith("()"); bool tt = (func || atom->string().contains(camelCase)); if (tt) - writer.writeStartElement("tt"); + xmlWriter().writeStartElement("tt"); if (func) { - writer.writeCharacters(protectEnc(atom->string().left(atom->string().length() - 2))); + xmlWriter().writeCharacters(protectEnc(atom->string().left(atom->string().length() - 2))); } else { - writer.writeCharacters(protectEnc(atom->string())); + xmlWriter().writeCharacters(protectEnc(atom->string())); } - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // } else { - writer.writeCharacters(protectEnc(atom->string())); + xmlWriter().writeCharacters(protectEnc(atom->string())); } } @@ -3478,22 +3411,22 @@ void DitaXmlGenerator::generateFullName(const Node* apparentNode, { if (actualNode == 0) actualNode = apparentNode; - writer.writeStartElement("xref"); - writer.writeAttribute("href",linkForNode(actualNode, relative)); + xmlWriter().writeStartElement("xref"); + xmlWriter().writeAttribute("href",linkForNode(actualNode, relative)); if (true || relative == 0 || relative->status() != actualNode->status()) { switch (actualNode->status()) { case Node::Obsolete: - writer.writeAttribute("outputclass","obsolete"); + xmlWriter().writeAttribute("outputclass","obsolete"); break; case Node::Compat: - writer.writeAttribute("outputclass","compat"); + xmlWriter().writeAttribute("outputclass","compat"); break; default: ; } } - writer.writeCharacters(protectEnc(fullName(apparentNode, relative, marker))); - writer.writeEndElement(); // + xmlWriter().writeCharacters(protectEnc(fullName(apparentNode, relative, marker))); + xmlWriter().writeEndElement(); // } void DitaXmlGenerator::generateDetailedMember(const Node* node, @@ -3505,21 +3438,25 @@ void DitaXmlGenerator::generateDetailedMember(const Node* node, if ((node->type() == Node::Enum) && (en = static_cast(node))->flagsType()) { - out() << "

    "; - out() << ""; + xmlWriter().writeStartElement("p"); + writeGuidAttribute(refForNode(node)); + xmlWriter().writeAttribute("outputclass","h3 flags"); + xmlWriter().writeCharacters(refForNode(node)); marked = getMarkedUpSynopsis(en, relative, marker, CodeMarker::Detailed); writeText(marked, marker, relative); - out() << "
    "; + xmlWriter().writeCharacters("\n"); marked = getMarkedUpSynopsis(en->flagsType(),relative,marker,CodeMarker::Detailed); writeText(marked,marker,relative); - out() << "

    \n"; + xmlWriter().writeEndElement(); //

    } else { - out() << "

    "; - out() << ""; - marked = getMarkedUpSynopsis(node,relative,marker,CodeMarker::Detailed); - writeText(marked,marker,relative); - out() << "

    \n"; + xmlWriter().writeStartElement("p"); + writeGuidAttribute(refForNode(node)); + xmlWriter().writeAttribute("outputclass","h3 fn"); + xmlWriter().writeCharacters(refForNode(node)); + marked = getMarkedUpSynopsis(node, relative, marker, CodeMarker::Detailed); + writeText(marked, marker, relative); + xmlWriter().writeEndElement(); //

    } generateStatus(node, marker); @@ -3536,29 +3473,34 @@ void DitaXmlGenerator::generateDetailedMember(const Node* node, section.members += property->resetters(); if (!section.members.isEmpty()) { - out() << "

    Access functions:

    \n"; - generateSectionList(section, node, marker, CodeMarker::Accessors); + xmlWriter().writeStartElement("p"); + xmlWriter().writeCharacters("Access functions:"); + xmlWriter().writeEndElement(); //

    + generateSection(section.members, node, marker, CodeMarker::Accessors); } Section notifiers; notifiers.members += property->notifiers(); if (!notifiers.members.isEmpty()) { - out() << "

    Notifier signal:

    \n"; - //out() << "

    This signal is emitted when the property value is changed.

    \n"; - generateSectionList(notifiers, node, marker, CodeMarker::Accessors); + xmlWriter().writeStartElement("p"); + xmlWriter().writeCharacters("Notifier signal:"); + xmlWriter().writeEndElement(); //

    + generateSection(notifiers.members, node, marker, CodeMarker::Accessors); } } else if (node->type() == Node::Enum) { en = static_cast(node); if (en->flagsType()) { - out() << "

    The " << protectEnc(en->flagsType()->name()) - << " type is a typedef for " - << "QFlags<" - << protectEnc(en->name()) - << ">. It stores an OR combination of " - << protectEnc(en->name()) - << " values.

    \n"; + xmlWriter().writeStartElement("p"); + QString text = "The " + protectEnc(en->flagsType()->name()) + + " type is a typedef for " + + "QFlags<" + + protectEnc(en->name()) + + ">. It stores an OR combination of " + + protectEnc(en->name()) + " values."; + xmlWriter().writeCharacters(text); + xmlWriter().writeEndElement(); //

    } } generateAlsoList(node, marker); @@ -3984,28 +3926,28 @@ void DitaXmlGenerator::beginLink(const QString& link, this->link = link; if (link.isEmpty()) { if (showBrokenLinks) - writer.writeStartElement("i"); + xmlWriter().writeStartElement("i"); } else if (node == 0 || (relative != 0 && node->status() == relative->status())) { - writer.writeStartElement("xref"); - writer.writeAttribute("href",link); + xmlWriter().writeStartElement("xref"); + xmlWriter().writeAttribute("href",link); } else { switch (node->status()) { case Node::Obsolete: - writer.writeStartElement("xref"); - writer.writeAttribute("href",link); - writer.writeAttribute("outputclass","obsolete"); + xmlWriter().writeStartElement("xref"); + xmlWriter().writeAttribute("href",link); + xmlWriter().writeAttribute("outputclass","obsolete"); break; case Node::Compat: - writer.writeStartElement("xref"); - writer.writeAttribute("href",link); - writer.writeAttribute("outputclass","compat"); + xmlWriter().writeStartElement("xref"); + xmlWriter().writeAttribute("href",link); + xmlWriter().writeAttribute("outputclass","compat"); break; default: - writer.writeStartElement("xref"); - writer.writeAttribute("href",link); + xmlWriter().writeStartElement("xref"); + xmlWriter().writeAttribute("href",link); } } inLink = true; @@ -4016,15 +3958,15 @@ void DitaXmlGenerator::endLink() if (inLink) { if (link.isEmpty()) { if (showBrokenLinks) - writer.writeEndElement(); // i + xmlWriter().writeEndElement(); // i } else { if (inObsoleteLink) { - writer.writeStartElement("sup"); - writer.writeCharacters("(obsolete)"); - writer.writeEndElement(); // sup + xmlWriter().writeStartElement("sup"); + xmlWriter().writeCharacters("(obsolete)"); + xmlWriter().writeEndElement(); // sup } - writer.writeEndElement(); // xref + xmlWriter().writeEndElement(); // xref } } inLink = false; @@ -4273,130 +4215,6 @@ void DitaXmlGenerator::generateInstantiatedBy(const ClassNode* cn, } /*! - Generate the element for the given \a node using the \a writer. - Return true if a element was written; otherwise return false. - */ -bool DitaXmlGenerator::generatePageElement(QXmlStreamWriter& writer, - const Node* node, - CodeMarker* marker) const -{ - if (node->pageType() == Node::NoPageType) - return false; - if (node->name().isEmpty()) - return true; - if (node->access() == Node::Private) - return false; - if (!node->isInnerNode()) - return false; - - QString title; - QString rawTitle; - QString fullTitle; - const InnerNode* inner = static_cast(node); - - writer.writeStartElement("page"); - QXmlStreamAttributes attributes; - QString t; - t.setNum(id++); - switch (node->type()) { - case Node::Fake: - { - const FakeNode* fake = static_cast(node); - title = fake->fullTitle(); - break; - } - case Node::Class: - { - title = node->name() + " Class Reference"; - break; - } - case Node::Namespace: - { - rawTitle = marker->plainName(inner); - fullTitle = marker->plainFullName(inner); - title = rawTitle + " Namespace Reference"; - break; - } - default: - title = node->name(); - break; - } - writer.writeAttribute("id",t); - writer.writeStartElement("pageWords"); - writer.writeCharacters(title); - if (!inner->pageKeywords().isEmpty()) { - const QStringList& w = inner->pageKeywords(); - for (int i = 0; i < w.size(); ++i) { - writer.writeCharacters(" "); - writer.writeCharacters(w.at(i).toLocal8Bit().constData()); - } - } - writer.writeEndElement(); - writer.writeStartElement("pageTitle"); - writer.writeCharacters(title); - writer.writeEndElement(); - writer.writeStartElement("pageUrl"); - writer.writeCharacters(PageGenerator::fileName(node)); - writer.writeEndElement(); - writer.writeStartElement("pageType"); - switch (node->pageType()) { - case Node::ApiPage: - writer.writeCharacters("APIPage"); - break; - case Node::ArticlePage: - writer.writeCharacters("Article"); - break; - case Node::ExamplePage: - writer.writeCharacters("Example"); - break; - default: - break; - } - writer.writeEndElement(); - writer.writeEndElement(); - return true; -} - -/*! - Traverse the tree recursively and generate the - elements. - */ -void DitaXmlGenerator::generatePageElements(QXmlStreamWriter& writer, const Node* node, CodeMarker* marker) const -{ - if (generatePageElement(writer, node, marker)) { - - if (node->isInnerNode()) { - const InnerNode *inner = static_cast(node); - - // Recurse to write an element for this child node and all its children. - foreach (const Node *child, inner->childNodes()) - generatePageElements(writer, child, marker); - } - } -} - -/*! - Outputs the file containing the index used for searching the html docs. - */ -void DitaXmlGenerator::generatePageIndex(const QString& fileName, CodeMarker* marker) const -{ - QFile file(fileName); - if (!file.open(QFile::WriteOnly | QFile::Text)) - return ; - - QXmlStreamWriter writer(&file); - writer.setAutoFormatting(true); - writer.writeStartDocument(); - writer.writeStartElement("qtPageIndex"); - - generatePageElements(writer, myTree->root(), marker); - - writer.writeEndElement(); // qtPageIndex - writer.writeEndDocument(); - file.close(); -} - -/*! Return the full qualification of the node \a n, but without the name of \a n itself. e.g. A::B::C */ @@ -4447,31 +4265,31 @@ void DitaXmlGenerator::writeDerivations(const ClassNode* cn, CodeMarker* marker) int index; if (!cn->baseClasses().isEmpty()) { - writer.writeStartElement(CXXCLASSDERIVATIONS); + xmlWriter().writeStartElement(CXXCLASSDERIVATIONS); r = cn->baseClasses().begin(); index = 0; while (r != cn->baseClasses().end()) { - writer.writeStartElement(CXXCLASSDERIVATION); - writer.writeStartElement(CXXCLASSDERIVATIONACCESSSPECIFIER); - writer.writeAttribute("value",(*r).accessString()); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXCLASSDERIVATION); + xmlWriter().writeStartElement(CXXCLASSDERIVATIONACCESSSPECIFIER); + xmlWriter().writeAttribute("value",(*r).accessString()); + xmlWriter().writeEndElement(); // // not included: - writer.writeStartElement(CXXCLASSBASECLASS); - writer.writeAttribute("href",(*r).node->ditaXmlHref()); - writer.writeCharacters(marker->plainFullName((*r).node)); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXCLASSBASECLASS); + xmlWriter().writeAttribute("href",(*r).node->ditaXmlHref()); + xmlWriter().writeCharacters(marker->plainFullName((*r).node)); + xmlWriter().writeEndElement(); // // not included: or - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // // not included: ++r; } - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // } } @@ -4509,21 +4327,21 @@ void DitaXmlGenerator::writeLocation(const Node* n) s2 = CXXVARIABLEDECLARATIONFILE; s3 = CXXVARIABLEDECLARATIONFILELINE; } - writer.writeStartElement(s1); - writer.writeStartElement(s2); - writer.writeAttribute("name","filePath"); - writer.writeAttribute("value",n->location().filePath()); - writer.writeEndElement(); // DeclarationFile> - writer.writeStartElement(s3); - writer.writeAttribute("name","lineNumber"); + xmlWriter().writeStartElement(s1); + xmlWriter().writeStartElement(s2); + xmlWriter().writeAttribute("name","filePath"); + xmlWriter().writeAttribute("value",n->location().filePath()); + xmlWriter().writeEndElement(); // DeclarationFile> + xmlWriter().writeStartElement(s3); + xmlWriter().writeAttribute("name","lineNumber"); QString lineNr; - writer.writeAttribute("value",lineNr.setNum(n->location().lineNo())); - writer.writeEndElement(); // DeclarationFileLine> + xmlWriter().writeAttribute("value",lineNr.setNum(n->location().lineNo())); + xmlWriter().writeEndElement(); // DeclarationFileLine> // not included: , , // and - writer.writeEndElement(); // ApiItemLocation> + xmlWriter().writeEndElement(); // ApiItemLocation> } /*! @@ -4537,88 +4355,88 @@ void DitaXmlGenerator::writeFunctions(const Section& s, while (m != s.members.end()) { if ((*m)->type() == Node::Function) { FunctionNode* fn = const_cast(static_cast(*m)); - writer.writeStartElement(CXXFUNCTION); - writer.writeAttribute("id",fn->guid()); - writer.writeStartElement(APINAME); + xmlWriter().writeStartElement(CXXFUNCTION); + xmlWriter().writeAttribute("id",fn->guid()); + xmlWriter().writeStartElement(APINAME); if (fn->metaness() == FunctionNode::Signal) - writer.writeAttribute("class","signal"); + xmlWriter().writeAttribute("class","signal"); else if (fn->metaness() == FunctionNode::Slot) - writer.writeAttribute("class","slot"); - writer.writeCharacters(fn->name()); - writer.writeEndElement(); // + xmlWriter().writeAttribute("class","slot"); + xmlWriter().writeCharacters(fn->name()); + xmlWriter().writeEndElement(); // generateBrief(fn,marker); // not included: - writer.writeStartElement(CXXFUNCTIONDETAIL); - writer.writeStartElement(CXXFUNCTIONDEFINITION); - writer.writeStartElement(CXXFUNCTIONACCESSSPECIFIER); - writer.writeAttribute("value",fn->accessString()); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXFUNCTIONDETAIL); + xmlWriter().writeStartElement(CXXFUNCTIONDEFINITION); + xmlWriter().writeStartElement(CXXFUNCTIONACCESSSPECIFIER); + xmlWriter().writeAttribute("value",fn->accessString()); + xmlWriter().writeEndElement(); // // not included: if (fn->isStatic()) { - writer.writeStartElement(CXXFUNCTIONSTORAGECLASSSPECIFIERSTATIC); - writer.writeAttribute("name","static"); - writer.writeAttribute("value","static"); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXFUNCTIONSTORAGECLASSSPECIFIERSTATIC); + xmlWriter().writeAttribute("name","static"); + xmlWriter().writeAttribute("value","static"); + xmlWriter().writeEndElement(); // } // not included: , if (fn->isConst()) { - writer.writeStartElement(CXXFUNCTIONCONST); - writer.writeAttribute("name","const"); - writer.writeAttribute("value","const"); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXFUNCTIONCONST); + xmlWriter().writeAttribute("name","const"); + xmlWriter().writeAttribute("value","const"); + xmlWriter().writeEndElement(); // } // not included: // virtualness() != FunctionNode::NonVirtual) { - writer.writeStartElement(CXXFUNCTIONVIRTUAL); - writer.writeAttribute("name","virtual"); - writer.writeAttribute("value","virtual"); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXFUNCTIONVIRTUAL); + xmlWriter().writeAttribute("name","virtual"); + xmlWriter().writeAttribute("value","virtual"); + xmlWriter().writeEndElement(); // if (fn->virtualness() == FunctionNode::PureVirtual) { - writer.writeStartElement(CXXFUNCTIONPUREVIRTUAL); - writer.writeAttribute("name","pure virtual"); - writer.writeAttribute("value","pure virtual"); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXFUNCTIONPUREVIRTUAL); + xmlWriter().writeAttribute("name","pure virtual"); + xmlWriter().writeAttribute("value","pure virtual"); + xmlWriter().writeEndElement(); // } } if (fn->name() == cn->name()) { - writer.writeStartElement(CXXFUNCTIONCONSTRUCTOR); - writer.writeAttribute("name","constructor"); - writer.writeAttribute("value","constructor"); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXFUNCTIONCONSTRUCTOR); + xmlWriter().writeAttribute("name","constructor"); + xmlWriter().writeAttribute("value","constructor"); + xmlWriter().writeEndElement(); // } else if (fn->name()[0] == QChar('~')) { - writer.writeStartElement(CXXFUNCTIONDESTRUCTOR); - writer.writeAttribute("name","destructor"); - writer.writeAttribute("value","destructor"); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXFUNCTIONDESTRUCTOR); + xmlWriter().writeAttribute("name","destructor"); + xmlWriter().writeAttribute("value","destructor"); + xmlWriter().writeEndElement(); // } else { - writer.writeStartElement(CXXFUNCTIONDECLAREDTYPE); - writer.writeCharacters(fn->returnType()); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXFUNCTIONDECLAREDTYPE); + xmlWriter().writeCharacters(fn->returnType()); + xmlWriter().writeEndElement(); // } // not included: QString fq = fullQualification(fn); if (!fq.isEmpty()) { - writer.writeStartElement(CXXFUNCTIONSCOPEDNAME); - writer.writeCharacters(fq); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXFUNCTIONSCOPEDNAME); + xmlWriter().writeCharacters(fq); + xmlWriter().writeEndElement(); // } - writer.writeStartElement(CXXFUNCTIONPROTOTYPE); - writer.writeCharacters(fn->signature(true)); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXFUNCTIONPROTOTYPE); + xmlWriter().writeCharacters(fn->signature(true)); + xmlWriter().writeEndElement(); // QString fnl = fn->signature(false); int idx = fnl.indexOf(' '); @@ -4627,33 +4445,33 @@ void DitaXmlGenerator::writeFunctions(const Section& s, else ++idx; fnl = fn->parent()->name() + "::" + fnl.mid(idx); - writer.writeStartElement(CXXFUNCTIONNAMELOOKUP); - writer.writeCharacters(fnl); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXFUNCTIONNAMELOOKUP); + xmlWriter().writeCharacters(fnl); + xmlWriter().writeEndElement(); // if (fn->isReimp() && fn->reimplementedFrom() != 0) { FunctionNode* rfn = (FunctionNode*)fn->reimplementedFrom(); - writer.writeStartElement(CXXFUNCTIONREIMPLEMENTED); - writer.writeAttribute("href",rfn->ditaXmlHref()); - writer.writeCharacters(marker->plainFullName(rfn)); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXFUNCTIONREIMPLEMENTED); + xmlWriter().writeAttribute("href",rfn->ditaXmlHref()); + xmlWriter().writeCharacters(marker->plainFullName(rfn)); + xmlWriter().writeEndElement(); // } writeParameters(fn,marker); writeLocation(fn); - writer.writeEndElement(); // - writer.writeStartElement(APIDESC); + xmlWriter().writeEndElement(); // + xmlWriter().writeStartElement(APIDESC); if (!fn->doc().isEmpty()) { generateBody(fn, marker); // generateAlsoList(inner, marker); } - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // // not included: ,
    , or - writer.writeEndElement(); // - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // if (fn->metaness() == FunctionNode::Ctor || fn->metaness() == FunctionNode::Dtor || @@ -4671,33 +4489,33 @@ void DitaXmlGenerator::writeParameters(const FunctionNode* fn, CodeMarker* marke { const QList& parameters = fn->parameters(); if (!parameters.isEmpty()) { - writer.writeStartElement(CXXFUNCTIONPARAMETERS); + xmlWriter().writeStartElement(CXXFUNCTIONPARAMETERS); QList::ConstIterator p = parameters.begin(); while (p != parameters.end()) { - writer.writeStartElement(CXXFUNCTIONPARAMETER); - writer.writeStartElement(CXXFUNCTIONPARAMETERDECLAREDTYPE); - writer.writeCharacters((*p).leftType()); + xmlWriter().writeStartElement(CXXFUNCTIONPARAMETER); + xmlWriter().writeStartElement(CXXFUNCTIONPARAMETERDECLAREDTYPE); + xmlWriter().writeCharacters((*p).leftType()); if (!(*p).rightType().isEmpty()) - writer.writeCharacters((*p).rightType()); - writer.writeEndElement(); // - writer.writeStartElement(CXXFUNCTIONPARAMETERDECLARATIONNAME); - writer.writeCharacters((*p).name()); - writer.writeEndElement(); // + xmlWriter().writeCharacters((*p).rightType()); + xmlWriter().writeEndElement(); // + xmlWriter().writeStartElement(CXXFUNCTIONPARAMETERDECLARATIONNAME); + xmlWriter().writeCharacters((*p).name()); + xmlWriter().writeEndElement(); // // not included: if (!(*p).defaultValue().isEmpty()) { - writer.writeStartElement(CXXFUNCTIONPARAMETERDEFAULTVALUE); - writer.writeCharacters((*p).defaultValue()); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXFUNCTIONPARAMETERDEFAULTVALUE); + xmlWriter().writeCharacters((*p).defaultValue()); + xmlWriter().writeEndElement(); // } // not included: - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // ++p; } - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // } } @@ -4712,111 +4530,111 @@ void DitaXmlGenerator::writeEnumerations(const Section& s, while (m != s.members.end()) { if ((*m)->type() == Node::Enum) { const EnumNode* en = static_cast(*m); - writer.writeStartElement(CXXENUMERATION); - writer.writeAttribute("id",en->guid()); - writer.writeStartElement(APINAME); - writer.writeCharacters(en->name()); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXENUMERATION); + xmlWriter().writeAttribute("id",en->guid()); + xmlWriter().writeStartElement(APINAME); + xmlWriter().writeCharacters(en->name()); + xmlWriter().writeEndElement(); // generateBrief(en,marker); // not included - writer.writeStartElement(CXXENUMERATIONDETAIL); - writer.writeStartElement(CXXENUMERATIONDEFINITION); - writer.writeStartElement(CXXENUMERATIONACCESSSPECIFIER); - writer.writeAttribute("value",en->accessString()); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXENUMERATIONDETAIL); + xmlWriter().writeStartElement(CXXENUMERATIONDEFINITION); + xmlWriter().writeStartElement(CXXENUMERATIONACCESSSPECIFIER); + xmlWriter().writeAttribute("value",en->accessString()); + xmlWriter().writeEndElement(); // QString fq = fullQualification(en); if (!fq.isEmpty()) { - writer.writeStartElement(CXXENUMERATIONSCOPEDNAME); - writer.writeCharacters(fq); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXENUMERATIONSCOPEDNAME); + xmlWriter().writeCharacters(fq); + xmlWriter().writeEndElement(); // } const QList& items = en->items(); if (!items.isEmpty()) { - writer.writeStartElement(CXXENUMERATIONPROTOTYPE); - writer.writeCharacters(en->name()); - writer.writeCharacters(" = { "); + xmlWriter().writeStartElement(CXXENUMERATIONPROTOTYPE); + xmlWriter().writeCharacters(en->name()); + xmlWriter().writeCharacters(" = { "); QList::ConstIterator i = items.begin(); while (i != items.end()) { - writer.writeCharacters((*i).name()); + xmlWriter().writeCharacters((*i).name()); if (!(*i).value().isEmpty()) { - writer.writeCharacters(" = "); - writer.writeCharacters((*i).value()); + xmlWriter().writeCharacters(" = "); + xmlWriter().writeCharacters((*i).value()); } ++i; if (i != items.end()) - writer.writeCharacters(", "); + xmlWriter().writeCharacters(", "); } - writer.writeCharacters(" }"); - writer.writeEndElement(); // + xmlWriter().writeCharacters(" }"); + xmlWriter().writeEndElement(); // } - writer.writeStartElement(CXXENUMERATIONNAMELOOKUP); - writer.writeCharacters(en->parent()->name() + "::" + en->name()); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXENUMERATIONNAMELOOKUP); + xmlWriter().writeCharacters(en->parent()->name() + "::" + en->name()); + xmlWriter().writeEndElement(); // // not included: if (!items.isEmpty()) { - writer.writeStartElement(CXXENUMERATORS); + xmlWriter().writeStartElement(CXXENUMERATORS); QList::ConstIterator i = items.begin(); while (i != items.end()) { - writer.writeStartElement(CXXENUMERATOR); - writer.writeStartElement(APINAME); - writer.writeCharacters((*i).name()); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXENUMERATOR); + xmlWriter().writeStartElement(APINAME); + xmlWriter().writeCharacters((*i).name()); + xmlWriter().writeEndElement(); // QString fq = fullQualification(en->parent()); if (!fq.isEmpty()) { - writer.writeStartElement(CXXENUMERATORSCOPEDNAME); - writer.writeCharacters(fq + "::" + (*i).name()); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXENUMERATORSCOPEDNAME); + xmlWriter().writeCharacters(fq + "::" + (*i).name()); + xmlWriter().writeEndElement(); // } - writer.writeStartElement(CXXENUMERATORPROTOTYPE); - writer.writeCharacters((*i).name()); - writer.writeEndElement(); // - writer.writeStartElement(CXXENUMERATORNAMELOOKUP); - writer.writeCharacters(en->parent()->name() + "::" + (*i).name()); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXENUMERATORPROTOTYPE); + xmlWriter().writeCharacters((*i).name()); + xmlWriter().writeEndElement(); // + xmlWriter().writeStartElement(CXXENUMERATORNAMELOOKUP); + xmlWriter().writeCharacters(en->parent()->name() + "::" + (*i).name()); + xmlWriter().writeEndElement(); // if (!(*i).value().isEmpty()) { - writer.writeStartElement(CXXENUMERATORINITIALISER); - writer.writeAttribute("value", (*i).value()); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXENUMERATORINITIALISER); + xmlWriter().writeAttribute("value", (*i).value()); + xmlWriter().writeEndElement(); // } // not included: if (!(*i).text().isEmpty()) { - writer.writeStartElement(APIDESC); + xmlWriter().writeStartElement(APIDESC); generateText((*i).text(), en, marker); - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // } - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // ++i; } - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // } writeLocation(en); - writer.writeEndElement(); // - writer.writeStartElement(APIDESC); + xmlWriter().writeEndElement(); // + xmlWriter().writeStartElement(APIDESC); if (!en->doc().isEmpty()) { generateBody(en, marker); } - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // // not included: ,
    , or - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // // not included: - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // } ++m; } @@ -4833,55 +4651,55 @@ void DitaXmlGenerator::writeTypedefs(const Section& s, while (m != s.members.end()) { if ((*m)->type() == Node::Typedef) { const TypedefNode* tn = static_cast(*m); - writer.writeStartElement(CXXTYPEDEF); - writer.writeAttribute("id",tn->guid()); - writer.writeStartElement(APINAME); - writer.writeCharacters(tn->name()); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXTYPEDEF); + xmlWriter().writeAttribute("id",tn->guid()); + xmlWriter().writeStartElement(APINAME); + xmlWriter().writeCharacters(tn->name()); + xmlWriter().writeEndElement(); // generateBrief(tn,marker); // not included: - writer.writeStartElement(CXXTYPEDEFDETAIL); - writer.writeStartElement(CXXTYPEDEFDEFINITION); - writer.writeStartElement(CXXTYPEDEFACCESSSPECIFIER); - writer.writeAttribute("value",tn->accessString()); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXTYPEDEFDETAIL); + xmlWriter().writeStartElement(CXXTYPEDEFDEFINITION); + xmlWriter().writeStartElement(CXXTYPEDEFACCESSSPECIFIER); + xmlWriter().writeAttribute("value",tn->accessString()); + xmlWriter().writeEndElement(); // // not included: QString fq = fullQualification(tn); if (!fq.isEmpty()) { - writer.writeStartElement(CXXTYPEDEFSCOPEDNAME); - writer.writeCharacters(fq); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXTYPEDEFSCOPEDNAME); + xmlWriter().writeCharacters(fq); + xmlWriter().writeEndElement(); // } // not included: - writer.writeStartElement(CXXTYPEDEFNAMELOOKUP); - writer.writeCharacters(tn->parent()->name() + "::" + tn->name()); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXTYPEDEFNAMELOOKUP); + xmlWriter().writeCharacters(tn->parent()->name() + "::" + tn->name()); + xmlWriter().writeEndElement(); // // not included: writeLocation(tn); - writer.writeEndElement(); // - writer.writeStartElement(APIDESC); + xmlWriter().writeEndElement(); // + xmlWriter().writeStartElement(APIDESC); if (!tn->doc().isEmpty()) { generateBody(tn, marker); } - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // // not included: ,
    , or - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // // not included: - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // } ++m; } @@ -4899,20 +4717,20 @@ void DitaXmlGenerator::writeProperties(const Section& s, while (m != s.members.end()) { if ((*m)->type() == Node::Property) { const PropertyNode* pn = static_cast(*m); - writer.writeStartElement(CXXVARIABLE); - writer.writeAttribute("id",pn->guid()); - writer.writeStartElement(APINAME); - writer.writeCharacters(pn->name()); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXVARIABLE); + xmlWriter().writeAttribute("id",pn->guid()); + xmlWriter().writeStartElement(APINAME); + xmlWriter().writeCharacters(pn->name()); + xmlWriter().writeEndElement(); // generateBrief(pn,marker); // not included: - writer.writeStartElement(CXXVARIABLEDETAIL); - writer.writeStartElement(CXXVARIABLEDEFINITION); - writer.writeStartElement(CXXVARIABLEACCESSSPECIFIER); - writer.writeAttribute("value",pn->accessString()); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXVARIABLEDETAIL); + xmlWriter().writeStartElement(CXXVARIABLEDEFINITION); + xmlWriter().writeStartElement(CXXVARIABLEACCESSSPECIFIER); + xmlWriter().writeAttribute("value",pn->accessString()); + xmlWriter().writeEndElement(); // // not included: , // , @@ -4920,84 +4738,84 @@ void DitaXmlGenerator::writeProperties(const Section& s, // , if (!pn->qualifiedDataType().isEmpty()) { - writer.writeStartElement(CXXVARIABLEDECLAREDTYPE); - writer.writeCharacters(pn->qualifiedDataType()); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXVARIABLEDECLAREDTYPE); + xmlWriter().writeCharacters(pn->qualifiedDataType()); + xmlWriter().writeEndElement(); // } QString fq = fullQualification(pn); if (!fq.isEmpty()) { - writer.writeStartElement(CXXVARIABLESCOPEDNAME); - writer.writeCharacters(fq); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXVARIABLESCOPEDNAME); + xmlWriter().writeCharacters(fq); + xmlWriter().writeEndElement(); // } - writer.writeStartElement(CXXVARIABLEPROTOTYPE); - writer.writeCharacters("Q_PROPERTY("); - writer.writeCharacters(pn->qualifiedDataType()); - writer.writeCharacters(" "); - writer.writeCharacters(pn->name()); + xmlWriter().writeStartElement(CXXVARIABLEPROTOTYPE); + xmlWriter().writeCharacters("Q_PROPERTY("); + xmlWriter().writeCharacters(pn->qualifiedDataType()); + xmlWriter().writeCharacters(" "); + xmlWriter().writeCharacters(pn->name()); writePropertyParameter("READ",pn->getters()); writePropertyParameter("WRITE",pn->setters()); writePropertyParameter("RESET",pn->resetters()); writePropertyParameter("NOTIFY",pn->notifiers()); if (pn->isDesignable() != pn->designableDefault()) { - writer.writeCharacters(" DESIGNABLE "); + xmlWriter().writeCharacters(" DESIGNABLE "); if (!pn->runtimeDesignabilityFunction().isEmpty()) - writer.writeCharacters(pn->runtimeDesignabilityFunction()); + xmlWriter().writeCharacters(pn->runtimeDesignabilityFunction()); else - writer.writeCharacters(pn->isDesignable() ? "true" : "false"); + xmlWriter().writeCharacters(pn->isDesignable() ? "true" : "false"); } if (pn->isScriptable() != pn->scriptableDefault()) { - writer.writeCharacters(" SCRIPTABLE "); + xmlWriter().writeCharacters(" SCRIPTABLE "); if (!pn->runtimeScriptabilityFunction().isEmpty()) - writer.writeCharacters(pn->runtimeScriptabilityFunction()); + xmlWriter().writeCharacters(pn->runtimeScriptabilityFunction()); else - writer.writeCharacters(pn->isScriptable() ? "true" : "false"); + xmlWriter().writeCharacters(pn->isScriptable() ? "true" : "false"); } if (pn->isWritable() != pn->writableDefault()) { - writer.writeCharacters(" STORED "); - writer.writeCharacters(pn->isStored() ? "true" : "false"); + xmlWriter().writeCharacters(" STORED "); + xmlWriter().writeCharacters(pn->isStored() ? "true" : "false"); } if (pn->isUser() != pn->userDefault()) { - writer.writeCharacters(" USER "); - writer.writeCharacters(pn->isUser() ? "true" : "false"); + xmlWriter().writeCharacters(" USER "); + xmlWriter().writeCharacters(pn->isUser() ? "true" : "false"); } if (pn->isConstant()) - writer.writeCharacters(" CONSTANT"); + xmlWriter().writeCharacters(" CONSTANT"); if (pn->isFinal()) - writer.writeCharacters(" FINAL"); - writer.writeCharacters(")"); - writer.writeEndElement(); // + xmlWriter().writeCharacters(" FINAL"); + xmlWriter().writeCharacters(")"); + xmlWriter().writeEndElement(); // - writer.writeStartElement(CXXVARIABLENAMELOOKUP); - writer.writeCharacters(pn->parent()->name() + "::" + pn->name()); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXVARIABLENAMELOOKUP); + xmlWriter().writeCharacters(pn->parent()->name() + "::" + pn->name()); + xmlWriter().writeEndElement(); // if (pn->overriddenFrom() != 0) { PropertyNode* opn = (PropertyNode*)pn->overriddenFrom(); - writer.writeStartElement(CXXVARIABLEREIMPLEMENTED); - writer.writeAttribute("href",opn->ditaXmlHref()); - writer.writeCharacters(marker->plainFullName(opn)); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXVARIABLEREIMPLEMENTED); + xmlWriter().writeAttribute("href",opn->ditaXmlHref()); + xmlWriter().writeCharacters(marker->plainFullName(opn)); + xmlWriter().writeEndElement(); // } writeLocation(pn); - writer.writeEndElement(); // - writer.writeStartElement(APIDESC); + xmlWriter().writeEndElement(); // + xmlWriter().writeStartElement(APIDESC); if (!pn->doc().isEmpty()) { generateBody(pn, marker); } - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // // not included: ,
    , or - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // // not included: - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // } ++m; } @@ -5014,77 +4832,77 @@ void DitaXmlGenerator::writeDataMembers(const Section& s, while (m != s.members.end()) { if ((*m)->type() == Node::Variable) { const VariableNode* vn = static_cast(*m); - writer.writeStartElement(CXXVARIABLE); - writer.writeAttribute("id",vn->guid()); - writer.writeStartElement(APINAME); - writer.writeCharacters(vn->name()); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXVARIABLE); + xmlWriter().writeAttribute("id",vn->guid()); + xmlWriter().writeStartElement(APINAME); + xmlWriter().writeCharacters(vn->name()); + xmlWriter().writeEndElement(); // generateBrief(vn,marker); // not included: - writer.writeStartElement(CXXVARIABLEDETAIL); - writer.writeStartElement(CXXVARIABLEDEFINITION); - writer.writeStartElement(CXXVARIABLEACCESSSPECIFIER); - writer.writeAttribute("value",vn->accessString()); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXVARIABLEDETAIL); + xmlWriter().writeStartElement(CXXVARIABLEDEFINITION); + xmlWriter().writeStartElement(CXXVARIABLEACCESSSPECIFIER); + xmlWriter().writeAttribute("value",vn->accessString()); + xmlWriter().writeEndElement(); // // not included: if (vn->isStatic()) { - writer.writeStartElement(CXXVARIABLESTORAGECLASSSPECIFIERSTATIC); - writer.writeAttribute("name","static"); - writer.writeAttribute("value","static"); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXVARIABLESTORAGECLASSSPECIFIERSTATIC); + xmlWriter().writeAttribute("name","static"); + xmlWriter().writeAttribute("value","static"); + xmlWriter().writeEndElement(); // } // not included: , // , - writer.writeStartElement(CXXVARIABLEDECLAREDTYPE); - writer.writeCharacters(vn->leftType()); + xmlWriter().writeStartElement(CXXVARIABLEDECLAREDTYPE); + xmlWriter().writeCharacters(vn->leftType()); if (!vn->rightType().isEmpty()) - writer.writeCharacters(vn->rightType()); - writer.writeEndElement(); // + xmlWriter().writeCharacters(vn->rightType()); + xmlWriter().writeEndElement(); // QString fq = fullQualification(vn); if (!fq.isEmpty()) { - writer.writeStartElement(CXXVARIABLESCOPEDNAME); - writer.writeCharacters(fq); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXVARIABLESCOPEDNAME); + xmlWriter().writeCharacters(fq); + xmlWriter().writeEndElement(); // } - writer.writeStartElement(CXXVARIABLEPROTOTYPE); - writer.writeCharacters(vn->leftType() + " "); - //writer.writeCharacters(vn->parent()->name() + "::" + vn->name()); - writer.writeCharacters(vn->name()); + xmlWriter().writeStartElement(CXXVARIABLEPROTOTYPE); + xmlWriter().writeCharacters(vn->leftType() + " "); + //xmlWriter().writeCharacters(vn->parent()->name() + "::" + vn->name()); + xmlWriter().writeCharacters(vn->name()); if (!vn->rightType().isEmpty()) - writer.writeCharacters(vn->rightType()); - writer.writeEndElement(); // + xmlWriter().writeCharacters(vn->rightType()); + xmlWriter().writeEndElement(); // - writer.writeStartElement(CXXVARIABLENAMELOOKUP); - writer.writeCharacters(vn->parent()->name() + "::" + vn->name()); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXVARIABLENAMELOOKUP); + xmlWriter().writeCharacters(vn->parent()->name() + "::" + vn->name()); + xmlWriter().writeEndElement(); // // not included: writeLocation(vn); - writer.writeEndElement(); // - writer.writeStartElement(APIDESC); + xmlWriter().writeEndElement(); // + xmlWriter().writeStartElement(APIDESC); if (!vn->doc().isEmpty()) { generateBody(vn, marker); } - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // // not included: ,
    , - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // // not included: - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // } ++m; } @@ -5102,88 +4920,88 @@ void DitaXmlGenerator::writeMacros(const Section& s, if ((*m)->type() == Node::Function) { const FunctionNode* fn = static_cast(*m); if (fn->isMacro()) { - writer.writeStartElement(CXXDEFINE); - writer.writeAttribute("id",fn->guid()); - writer.writeStartElement(APINAME); - writer.writeCharacters(fn->name()); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXDEFINE); + xmlWriter().writeAttribute("id",fn->guid()); + xmlWriter().writeStartElement(APINAME); + xmlWriter().writeCharacters(fn->name()); + xmlWriter().writeEndElement(); // generateBrief(fn,marker); // not included: - writer.writeStartElement(CXXDEFINEDETAIL); - writer.writeStartElement(CXXDEFINEDEFINITION); - writer.writeStartElement(CXXDEFINEACCESSSPECIFIER); - writer.writeAttribute("value",fn->accessString()); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXDEFINEDETAIL); + xmlWriter().writeStartElement(CXXDEFINEDEFINITION); + xmlWriter().writeStartElement(CXXDEFINEACCESSSPECIFIER); + xmlWriter().writeAttribute("value",fn->accessString()); + xmlWriter().writeEndElement(); // - writer.writeStartElement(CXXDEFINEPROTOTYPE); - writer.writeCharacters("#define "); - writer.writeCharacters(fn->name()); + xmlWriter().writeStartElement(CXXDEFINEPROTOTYPE); + xmlWriter().writeCharacters("#define "); + xmlWriter().writeCharacters(fn->name()); if (fn->metaness() == FunctionNode::MacroWithParams) { QStringList params = fn->parameterNames(); if (!params.isEmpty()) { - writer.writeCharacters("("); + xmlWriter().writeCharacters("("); for (int i = 0; i < params.size(); ++i) { if (params[i].isEmpty()) - writer.writeCharacters("..."); + xmlWriter().writeCharacters("..."); else - writer.writeCharacters(params[i]); + xmlWriter().writeCharacters(params[i]); if ((i+1) < params.size()) - writer.writeCharacters(", "); + xmlWriter().writeCharacters(", "); } - writer.writeCharacters(")"); + xmlWriter().writeCharacters(")"); } } - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // - writer.writeStartElement(CXXDEFINENAMELOOKUP); - writer.writeCharacters(fn->name()); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXDEFINENAMELOOKUP); + xmlWriter().writeCharacters(fn->name()); + xmlWriter().writeEndElement(); // if (fn->reimplementedFrom() != 0) { FunctionNode* rfn = (FunctionNode*)fn->reimplementedFrom(); - writer.writeStartElement(CXXDEFINEREIMPLEMENTED); - writer.writeAttribute("href",rfn->ditaXmlHref()); - writer.writeCharacters(marker->plainFullName(rfn)); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXDEFINEREIMPLEMENTED); + xmlWriter().writeAttribute("href",rfn->ditaXmlHref()); + xmlWriter().writeCharacters(marker->plainFullName(rfn)); + xmlWriter().writeEndElement(); // } if (fn->metaness() == FunctionNode::MacroWithParams) { QStringList params = fn->parameterNames(); if (!params.isEmpty()) { - writer.writeStartElement(CXXDEFINEPARAMETERS); + xmlWriter().writeStartElement(CXXDEFINEPARAMETERS); for (int i = 0; i < params.size(); ++i) { - writer.writeStartElement(CXXDEFINEPARAMETER); - writer.writeStartElement(CXXDEFINEPARAMETERDECLARATIONNAME); - writer.writeCharacters(params[i]); - writer.writeEndElement(); // + xmlWriter().writeStartElement(CXXDEFINEPARAMETER); + xmlWriter().writeStartElement(CXXDEFINEPARAMETERDECLARATIONNAME); + xmlWriter().writeCharacters(params[i]); + xmlWriter().writeEndElement(); // // not included: - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // } - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // } } writeLocation(fn); - writer.writeEndElement(); // - writer.writeStartElement(APIDESC); + xmlWriter().writeEndElement(); // + xmlWriter().writeStartElement(APIDESC); if (!fn->doc().isEmpty()) { generateBody(fn, marker); } - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // // not included: ,
    , or - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // // not included: - writer.writeEndElement(); // + xmlWriter().writeEndElement(); // } } ++m; @@ -5199,14 +5017,51 @@ void DitaXmlGenerator::writePropertyParameter(const QString& tag, const NodeList { NodeList::const_iterator n = nlist.begin(); while (n != nlist.end()) { - writer.writeCharacters(" "); - writer.writeCharacters(tag); - writer.writeCharacters(" "); - writer.writeCharacters((*n)->name()); + xmlWriter().writeCharacters(" "); + xmlWriter().writeCharacters(tag); + xmlWriter().writeCharacters(" "); + xmlWriter().writeCharacters((*n)->name()); ++n; } } +/*! + Calls beginSubPage() in the base class to open the file. + Then creates a new XML stream writer using the IO device + from opened file and pushes the XML writer onto a stackj. + Creates the file named \a fileName in the output directory. + Attaches a QTextStream to the created file, which is written + to all over the place using out(). Finally, it sets some + parameters in the XML writer and calls writeStartDocument(). + */ +void DitaXmlGenerator::beginSubPage(const Location& location, + const QString& fileName) +{ + PageGenerator::beginSubPage(location,fileName); + QXmlStreamWriter* writer = new QXmlStreamWriter(out().device()); + xmlWriterStack.push(writer); + writer->setAutoFormatting(true); + writer->setAutoFormattingIndent(4); + writer->writeStartDocument(); +} + +/*! + Calls writeEndDocument() and then pops the XML stream writer + off the stack and deletes it. Then it calls endSubPage() in + the base class to close the device. + */ +void DitaXmlGenerator::endSubPage() +{ + xmlWriter().writeEndDocument(); + delete xmlWriterStack.pop(); + PageGenerator::endSubPage(); +} + +QXmlStreamWriter& DitaXmlGenerator::xmlWriter() +{ + return *xmlWriterStack.top(); +} + QT_END_NAMESPACE #ifdef TO_BE_INCLUDED_IN_API_DESC @@ -5305,27 +5160,19 @@ QT_END_NAMESPACE out() << "

    " << protectEnc(name) << "

    \n"; generateSection(s->reimpMembers, inner, marker, CodeMarker::Summary); } - - if (!s->inherited.isEmpty()) { - out() << "
      \n"; - generateSectionInheritedList(*s, inner, marker, true); - out() << "
    \n"; - } + generateSectionInheritedList(*s, inner, marker, true); } ++s; } if (needOtherSection) { - out() << "

    Additional Inherited Members

    \n" - "
      \n"; - + out() << "

      Additional Inherited Members

      \n"; s = sections.begin(); while (s != sections.end()) { - if (s->members.isEmpty() && !s->inherited.isEmpty()) + if (s->members.isEmpty()) generateSectionInheritedList(*s, inner, marker); ++s; } - out() << "
    \n"; } out() << "\n"; diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index dad1c6f..bd78e93 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -150,7 +150,7 @@ class DitaXmlGenerator : public PageGenerator void generateBreadCrumbs(const QString& title, const Node* node, CodeMarker* marker); - void generateHeader(const Node* node); + void generateHeader(const Node* node, const QString& name); void generateTitle(const QString& title, const Text& subTitle, SubTitleSize subTitleSize, @@ -184,10 +184,7 @@ class DitaXmlGenerator : public PageGenerator void generateFunctionIndex(const Node* relative, CodeMarker* marker); void generateLegaleseList(const Node* relative, CodeMarker* marker); void generateOverviewList(const Node* relative, CodeMarker* marker); - void generateSectionList(const Section& section, - const Node* relative, - CodeMarker* marker, - CodeMarker::SynopsisStyle style); + #ifdef QDOC_QML void generateQmlSummary(const Section& section, const Node* relative, @@ -215,8 +212,7 @@ class DitaXmlGenerator : public PageGenerator CodeMarker::SynopsisStyle style); void generateSectionInheritedList(const Section& section, const Node* relative, - CodeMarker* marker, - bool nameAlignment = false); + CodeMarker* marker); void writeText(const QString& markedCode, CodeMarker* marker, const Node* relative, @@ -262,16 +258,11 @@ class DitaXmlGenerator : public PageGenerator const Node* relative, CodeMarker* marker); void endLink(); - bool generatePageElement(QXmlStreamWriter& writer, - const Node* node, - CodeMarker* marker) const; - void generatePageElements(QXmlStreamWriter& writer, - const Node* node, - CodeMarker* marker) const; - void generatePageIndex(const QString& fileName, - CodeMarker* marker) const; QString writeGuidAttribute(QString text); QString lookupGuid(QString text); + virtual void beginSubPage(const Location& location, const QString& fileName); + virtual void endSubPage(); + QXmlStreamWriter& xmlWriter(); private: QMap refMap; @@ -324,7 +315,8 @@ class DitaXmlGenerator : public PageGenerator NewClassMaps newClassMaps; NewClassMaps newQmlClassMaps; static int id; - QXmlStreamWriter writer; + + QStack xmlWriterStack; }; #define DITAXMLGENERATOR_ADDRESS "address" diff --git a/tools/qdoc3/pagegenerator.h b/tools/qdoc3/pagegenerator.h index 1aa24a1..0fea67a 100644 --- a/tools/qdoc3/pagegenerator.h +++ b/tools/qdoc3/pagegenerator.h @@ -48,14 +48,12 @@ #include #include - #include "generator.h" #include "location.h" QT_BEGIN_NAMESPACE class QTextCodec; - class ClassNode; class InnerNode; class NamespaceNode; @@ -66,16 +64,16 @@ class PageGenerator : public Generator PageGenerator(); ~PageGenerator(); - virtual void generateTree(const Tree *tree, CodeMarker *marker); + virtual void generateTree(const Tree* tree, CodeMarker* marker); protected: - virtual QString fileBase(const Node *node) const; - virtual QString fileExtension(const Node *node) const = 0; - QString fileName(const Node *node) const; + virtual QString fileBase(const Node* node) const; + virtual QString fileExtension(const Node* node) const = 0; + QString fileName(const Node* node) const; QString outFileName(); - void beginSubPage(const Location& location, const QString& fileName); - void endSubPage(); - virtual void generateInnerNode(const InnerNode *node, CodeMarker *marker); + virtual void beginSubPage(const Location& location, const QString& fileName); + virtual void endSubPage(); + virtual void generateInnerNode(const InnerNode* node, CodeMarker* marker); QTextStream& out(); QString naturalLanguage; @@ -89,7 +87,7 @@ class PageGenerator : public Generator QStringRef* par1 = 0, bool debug = false); - private: + protected: QStack outStreamStack; }; -- cgit v0.12 From ecc772100760cd4afafa424b6bf19fb95f8fa82b Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Tue, 14 Sep 2010 14:30:11 +0200 Subject: qdoc: Converted some more html output to xml output. --- tests/auto/qlineedit/tst_qlineedit.cpp | 18 +- tools/qdoc3/ditaxmlgenerator.cpp | 348 ++++++++++++++++++++------------- 2 files changed, 217 insertions(+), 149 deletions(-) diff --git a/tests/auto/qlineedit/tst_qlineedit.cpp b/tests/auto/qlineedit/tst_qlineedit.cpp index bfa9406..93bd447 100644 --- a/tests/auto/qlineedit/tst_qlineedit.cpp +++ b/tests/auto/qlineedit/tst_qlineedit.cpp @@ -3747,15 +3747,15 @@ void tst_QLineEdit::QTBUG697_paletteCurrentColorGroup() void tst_QLineEdit::QTBUG13520_textNotVisible() { LineEdit le; - le.setAlignment( Qt::AlignRight | Qt::AlignVCenter); - le.show(); - QTest::qWaitForWindowShown(&le); - le.setText("01-ST16-01SIL-MPL001wfgsdfgsdgsdfgsdfgsdfgsdfgsdfg"); - le.setCursorPosition(0); - QTest::qWait(100); //just make sure we get he lineedit correcly painted - - QVERIFY(le.cursorRect().center().x() < le.width() / 2); - + le.setAlignment( Qt::AlignRight | Qt::AlignVCenter); + le.show(); + QTest::qWaitForWindowShown(&le); + le.setText("01-ST16-01SIL-MPL001wfgsdfgsdgsdfgsdfgsdfgsdfgsdfg"); + le.setCursorPosition(0); + QTest::qWait(100); //just make sure we get he lineedit correcly painted + + QVERIFY(le.cursorRect().center().x() < le.width() / 2); + } diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index f572cc7..24f3e77 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -371,7 +371,9 @@ static void addLink(const QString &linkTarget, } } - +/*! + The default constructor. + */ DitaXmlGenerator::DitaXmlGenerator() : inLink(false), inContents(false), @@ -390,11 +392,17 @@ DitaXmlGenerator::DitaXmlGenerator() { } +/*! + The destructor has nothing to do. + */ DitaXmlGenerator::~DitaXmlGenerator() { // nothing yet. } +/*! + A lot of internal structures are initialized. + */ void DitaXmlGenerator::initializeGenerator(const Config &config) { static const struct { @@ -491,11 +499,17 @@ void DitaXmlGenerator::initializeGenerator(const Config &config) } +/*! + All this does is call the same function in the base class. + */ void DitaXmlGenerator::terminateGenerator() { Generator::terminateGenerator(); } +/*! + Returns "DITAXML". + */ QString DitaXmlGenerator::format() { return "DITAXML"; @@ -587,7 +601,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, break; case Atom::AutoLink: if ((noLinks > 0) && !inLink && !inContents && !inSectionHeading) { - const Node *node = 0; + const Node* node = 0; QString link = getLink(atom, relative, marker, &node); if (!link.isEmpty()) { beginLink(link, node, relative, marker); @@ -1528,15 +1542,12 @@ void DitaXmlGenerator::writeTargetAndHeader(const QString& target, */ void DitaXmlGenerator::writeXrefListItem(const QString& link, const QString& text) { - qDebug() << "WXLI 1" << link; xmlWriter().writeStartElement("li"); xmlWriter().writeStartElement("xref"); xmlWriter().writeAttribute("href",link); - qDebug() << "WXLI 2"; xmlWriter().writeCharacters(text); xmlWriter().writeEndElement(); // xmlWriter().writeEndElement(); // - qDebug() << "WXLI 3"; } /*! @@ -1622,7 +1633,8 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker xmlWriter().writeEndElement(); // } -#if 0 +#if 0 +zzz /* Generate the TOC for the new doc format. Don't generate a TOC for the home page. @@ -1677,7 +1689,8 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker } #endif -#if 0 +#if 0 +zzz sections = marker->sections(fake, CodeMarker::Summary, CodeMarker::Okay); s = sections.begin(); while (s != sections.end()) { @@ -1713,7 +1726,7 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker #endif /*! - Returns "xml" for this subclass of Generator. + Returns "xml" for this subclass of class Generator. */ QString DitaXmlGenerator::fileExtension(const Node * /* node */) const { @@ -1721,6 +1734,7 @@ QString DitaXmlGenerator::fileExtension(const Node * /* node */) const } /*! + zzz Output breadcrumb list in the html file. */ void DitaXmlGenerator::generateBreadCrumbs(const QString& title, @@ -1809,10 +1823,8 @@ void DitaXmlGenerator::generateBreadCrumbs(const QString& title, } /*! - Outputs an XML file header depending on which kind of DITA + Outputs an XML file header depending on which kind of DITA XML file is being generated. - - \note This does not cover all cases yet. */ void DitaXmlGenerator::generateHeader(const Node* node, const QString& name) { @@ -1887,11 +1899,18 @@ void DitaXmlGenerator::generateHeader(const Node* node, const QString& name) xmlWriter().writeEndElement(); // } +/*! + Writes a \a title as a

    element with an \c {outputclass} + attribute of "h1 title". + + Also generates and writes a \a subTitle as a

    element, + if one is provided, but this probably doesn't work right. + */ void DitaXmlGenerator::generateTitle(const QString& title, - const Text &subTitle, + const Text& subTitle, SubTitleSize subTitleSize, - const Node *relative, - CodeMarker *marker) + const Node* relative, + CodeMarker* marker) { if (!title.isEmpty()) { xmlWriter().writeStartElement("p"); @@ -1913,7 +1932,7 @@ void DitaXmlGenerator::generateTitle(const QString& title, } /*! - Outputs the brief command as a element. + Outputs the \e brief command as a element. */ void DitaXmlGenerator::generateBrief(const Node* node, CodeMarker* marker) { @@ -1927,10 +1946,14 @@ void DitaXmlGenerator::generateBrief(const Node* node, CodeMarker* marker) } } -void DitaXmlGenerator::generateIncludes(const InnerNode *inner, CodeMarker *marker) +/*! + Writes the \c {#include ...} required to include the class + or namespace in a compilation. + */ +void DitaXmlGenerator::generateIncludes(const InnerNode* inner, CodeMarker* marker) { if (!inner->includes().isEmpty()) { - xmlWriter().writeStartElement("pree"); + xmlWriter().writeStartElement("pre"); xmlWriter().writeAttribute("outputclass","highlightedcode"); writeText(marker->markedUpIncludes(inner->includes()), marker, inner); xmlWriter().writeEndElement(); // @@ -1938,13 +1961,15 @@ void DitaXmlGenerator::generateIncludes(const InnerNode *inner, CodeMarker *mark } /*! + zzz Generates a table of contents begining at \a node. + Currently just returns without writing anything. */ -void DitaXmlGenerator::generateTableOfContents(const Node *node, - CodeMarker *marker, - Doc::SectioningUnit sectioningUnit, - int numColumns, - const Node *relative) +void DitaXmlGenerator::generateTableOfContents(const Node* node, + CodeMarker* marker, + Doc::SectioningUnit sectioningUnit, + int numColumns, + const Node* relative) { return; @@ -2023,12 +2048,13 @@ void DitaXmlGenerator::generateTableOfContents(const Node *node, } /*! + zzz Revised for the new doc format. Generates a table of contents begining at \a node. */ -void DitaXmlGenerator::generateTableOfContents(const Node *node, - CodeMarker *marker, - QList

    * sections) +void DitaXmlGenerator::generateTableOfContents(const Node* node, + CodeMarker* marker, + QList
    * sections) { QList toc; if (node->doc().hasTableOfContents()) @@ -2155,9 +2181,11 @@ QString DitaXmlGenerator::generateListOfAllMemberFile(const InnerNode* inner, generateHeader(inner, title); xmlWriter().writeStartElement("body"); generateTitle(title, Text(), SmallSubTitle, inner, marker); - out() << "

    This is the complete list of members for "; + xmlWriter().writeStartElement("p"); + xmlWriter().writeCharacters("This is the complete list of members for "); generateFullName(inner, 0, marker); - out() << ", including inherited members.

    \n"; + xmlWriter().writeCharacters(", including inherited members."); + xmlWriter().writeEndElement(); //

    Section section = sections.first(); generateSection(section.members, 0, marker, CodeMarker::SeparateList); @@ -2200,16 +2228,16 @@ QString DitaXmlGenerator::generateLowStatusMemberFile(const InnerNode* inner, if (status == CodeMarker::Compat) { xmlWriter().writeStartElement("p"); xmlWriter().writeCharacters("

    The following class members are part of the " - "Qt 3 support layer." - " They are provided to help you port old code to Qt 4. " - "We advise against using them in new code."); + "Qt 3 support layer." + " They are provided to help you port old code to Qt 4. " + "We advise against using them in new code."); xmlWriter().writeEndElement(); //

    } else { xmlWriter().writeStartElement("p"); xmlWriter().writeCharacters("The following class members are obsolete. " - "They are provided to keep old source code working. " - "We strongly advise against using them in new code."); + "They are provided to keep old source code working. " + "We strongly advise against using them in new code."); xmlWriter().writeEndElement(); //

    } xmlWriter().writeStartElement("p"); @@ -2252,9 +2280,12 @@ QString DitaXmlGenerator::generateLowStatusMemberFile(const InnerNode* inner, return fileName; } -void DitaXmlGenerator::generateClassHierarchy(const Node *relative, - CodeMarker *marker, - const QMap &classMap) +/*! + Write the XML for the class hierarchy to the current XML stream. + */ +void DitaXmlGenerator::generateClassHierarchy(const Node* relative, + CodeMarker* marker, + const QMap& classMap) { if (classMap.isEmpty()) return; @@ -2262,7 +2293,7 @@ void DitaXmlGenerator::generateClassHierarchy(const Node *relative, NodeMap topLevel; NodeMap::ConstIterator c = classMap.begin(); while (c != classMap.end()) { - const ClassNode *classe = static_cast(*c); + const ClassNode* classe = static_cast(*c); if (classe->baseClasses().isEmpty()) topLevel.insert(classe->name(), classe); ++c; @@ -2271,18 +2302,18 @@ void DitaXmlGenerator::generateClassHierarchy(const Node *relative, QStack stack; stack.push(topLevel); - out() << "
      \n"; + xmlWriter().writeStartElement("ul"); while (!stack.isEmpty()) { if (stack.top().isEmpty()) { stack.pop(); - out() << "
    \n"; + xmlWriter().writeEndElement(); // } else { const ClassNode *child = static_cast(*stack.top().begin()); - out() << "
  • "; + xmlWriter().writeStartElement("li"); generateFullName(child, relative, marker); - out() << "
  • \n"; + xmlWriter().writeEndElement(); // stack.top().erase(stack.top().begin()); NodeMap newTop; @@ -2292,12 +2323,16 @@ void DitaXmlGenerator::generateClassHierarchy(const Node *relative, } if (!newTop.isEmpty()) { stack.push(newTop); - out() << "
      \n"; + xmlWriter().writeStartElement("ul"); } } } } +/*! + Write XML for the contents of the \a nodeMap to the current + XML stream. + */ void DitaXmlGenerator::generateAnnotatedList(const Node* relative, CodeMarker* marker, const NodeMap& nodeMap) @@ -2578,6 +2613,9 @@ void DitaXmlGenerator::generateCompactList(const Node* relative, xmlWriter().writeEndElement(); //

      } +/*! + Write XML for a function index to the current XML stream. + */ void DitaXmlGenerator::generateFunctionIndex(const Node* relative, CodeMarker* marker) { @@ -2624,22 +2662,25 @@ void DitaXmlGenerator::generateFunctionIndex(const Node* relative, xmlWriter().writeEndElement(); //
    } -void DitaXmlGenerator::generateLegaleseList(const Node *relative, - CodeMarker *marker) +/*! + Write the legalese texts as XML to the current XML stream. + */ +void DitaXmlGenerator::generateLegaleseList(const Node* relative, + CodeMarker* marker) { - QMap::ConstIterator it = legaleseTexts.begin(); + QMap::ConstIterator it = legaleseTexts.begin(); while (it != legaleseTexts.end()) { Text text = it.key(); - out() << "
    \n"; + //out() << "
    \n"; generateText(text, relative, marker); - out() << "
      \n"; + xmlWriter().writeStartElement("ul"); do { - out() << "
    • "; + xmlWriter().writeStartElement("li"); generateFullName(it.value(), relative, marker); - out() << "
    • \n"; + xmlWriter().writeEndElement(); // ++it; } while (it != legaleseTexts.end() && it.key() == text); - out() << "
    \n"; + xmlWriter().writeEndElement(); // } } @@ -2674,6 +2715,9 @@ void DitaXmlGenerator::generateQmlItem(const Node* node, writeText(marked, marker, relative); } +/*! + Writher the XML for the overview list to the current XML stream. + */ void DitaXmlGenerator::generateOverviewList(const Node* relative, CodeMarker* /* marker */) { QMap > fakeNodeMap; @@ -2753,42 +2797,60 @@ void DitaXmlGenerator::generateOverviewList(const Node* relative, CodeMarker* /* // pages in that group are listed for completeness. if (!fakeNodeMap.isEmpty()) { - foreach (const QString &groupTitle, groupTitlesMap.keys()) { - const FakeNode *groupNode = groupTitlesMap[groupTitle]; - out() << QString("

    %2

    \n").arg( - linkForNode(groupNode, relative)).arg( - protectEnc(groupNode->fullTitle())); - + foreach (const QString& groupTitle, groupTitlesMap.keys()) { + const FakeNode* groupNode = groupTitlesMap[groupTitle]; + xmlWriter().writeStartElement("p"); + xmlWriter().writeAttribute("outputclass","h3"); + xmlWriter().writeStartElement("xref"); + xmlWriter().writeAttribute("href",linkForNode(groupNode, relative)); + xmlWriter().writeCharacters(protectEnc(groupNode->fullTitle())); + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); //

    if (fakeNodeMap[groupNode].count() == 0) continue; - out() << "
      \n"; - - foreach (const FakeNode *fakeNode, fakeNodeMap[groupNode]) { + xmlWriter().writeStartElement("ul"); + foreach (const FakeNode* fakeNode, fakeNodeMap[groupNode]) { QString title = fakeNode->fullTitle(); if (title.startsWith("The ")) title.remove(0, 4); - out() << "
    • " - << protectEnc(title) << "
    • \n"; + xmlWriter().writeStartElement("li"); + xmlWriter().writeStartElement("xref"); + xmlWriter().writeAttribute("href",linkForNode(fakeNode, relative)); + xmlWriter().writeCharacters(protectEnc(title)); + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // } - out() << "
    \n"; + xmlWriter().writeEndElement(); // } } if (!uncategorizedNodeMap.isEmpty()) { - out() << QString("

    Miscellaneous

    \n"); - out() << "
      \n"; + xmlWriter().writeStartElement("p"); + xmlWriter().writeAttribute("outputclass","h3"); + xmlWriter().writeCharacters("Miscellaneous"); + xmlWriter().writeEndElement(); //

      + xmlWriter().writeStartElement("ul"); foreach (const FakeNode *fakeNode, uncategorizedNodeMap) { QString title = fakeNode->fullTitle(); if (title.startsWith("The ")) title.remove(0, 4); - out() << "
    • " - << protectEnc(title) << "
    • \n"; + xmlWriter().writeStartElement("li"); + xmlWriter().writeStartElement("xref"); + xmlWriter().writeAttribute("href",linkForNode(fakeNode, relative)); + xmlWriter().writeCharacters(protectEnc(title)); + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // } - out() << "
    \n"; + xmlWriter().writeEndElement(); // } } +/*! + Write the XML for a standard section of a page, e.g. + "Public Functions" or "Protected Slots." The section + is written too the current XML stream as a table. + */ void DitaXmlGenerator::generateSection(const NodeList& nl, const Node* relative, CodeMarker* marker, @@ -2882,7 +2944,7 @@ void DitaXmlGenerator::generateSection(const NodeList& nl, } /*! - Writes the "inherited from" lists. + Writes the "inherited from" lists to the current XML stream. */ void DitaXmlGenerator::generateSectionInheritedList(const Section& section, const Node* relative, @@ -2957,6 +3019,10 @@ QString DitaXmlGenerator::getMarkedUpSynopsis(const Node* node, return marked; } +/*! + Renamed from highlightedCode() in the html generator. Writes + the \a markedCode to the current XML stream. + */ void DitaXmlGenerator::writeText(const QString& markedCode, CodeMarker* marker, const Node* relative, @@ -3116,9 +3182,8 @@ void DitaXmlGenerator::generateLink(const Atom* atom, if (showBrokenLinks) xmlWriter().writeEndElement(); // } - else { + else xmlWriter().writeEndElement(); // - } inLink = false; xmlWriter().writeCharacters(protectEnc(atom->string().mid(k))); } @@ -3128,17 +3193,14 @@ void DitaXmlGenerator::generateLink(const Atom* atom, bool tt = (func || atom->string().contains(camelCase)); if (tt) xmlWriter().writeStartElement("tt"); - if (func) { + if (func) xmlWriter().writeCharacters(protectEnc(atom->string().left(atom->string().length() - 2))); - } - else { + else xmlWriter().writeCharacters(protectEnc(atom->string())); - } xmlWriter().writeEndElement(); // } - else { + else xmlWriter().writeCharacters(protectEnc(atom->string())); - } } QString DitaXmlGenerator::cleanRef(const QString& ref) @@ -3215,14 +3277,16 @@ QString DitaXmlGenerator::registerRef(const QString& ref) prevRef = ref; break; } - else if (prevRef == ref) { + else if (prevRef == ref) break; - } clean += "x"; } return clean; } +/*! + Calls protect() with the \a string. Returns the result. + */ QString DitaXmlGenerator::protectEnc(const QString& string) { return protect(string, outputEncoding); @@ -3276,6 +3340,10 @@ QString DitaXmlGenerator::protect(const QString& string, const QString& outputEn #undef APPEND } +/*! + Constructs a file name appropriate for the \a node + and returns the file name. + */ QString DitaXmlGenerator::fileBase(const Node* node) { QString result; @@ -3295,6 +3363,13 @@ QString DitaXmlGenerator::fileBase(const Node* node) return result; } +/*! + Constructs a file name appropriate for the \a node + and returns the file name. If the \a node is not a + fake node, or if it is a fake node but it is neither + an external page node nor an image node, call the + PageGenerator::fileName() function. + */ QString DitaXmlGenerator::fileName(const Node* node) { if (node->type() == Node::Fake) { @@ -3393,15 +3468,11 @@ QString DitaXmlGenerator::linkForNode(const Node* node, const Node* relative) QString DitaXmlGenerator::refForAtom(Atom* atom, const Node* /* node */) { - if (atom->type() == Atom::SectionLeft) { + if (atom->type() == Atom::SectionLeft) return Doc::canonicalTitle(Text::sectionHeading(atom).toString()); - } - else if (atom->type() == Atom::Target) { + if (atom->type() == Atom::Target) return Doc::canonicalTitle(atom->string()); - } - else { - return QString(); - } + return QString(); } void DitaXmlGenerator::generateFullName(const Node* apparentNode, @@ -3422,7 +3493,7 @@ void DitaXmlGenerator::generateFullName(const Node* apparentNode, xmlWriter().writeAttribute("outputclass","compat"); break; default: - ; + break; } } xmlWriter().writeCharacters(protectEnc(fullName(apparentNode, relative, marker))); @@ -3745,7 +3816,6 @@ const Node* DitaXmlGenerator::findNodeForTarget(const QString& target, const QPair DitaXmlGenerator::anchorForNode(const Node* node) { QPair anchorPair; - anchorPair.first = PageGenerator::fileName(node); if (node->type() == Node::Fake) { const FakeNode *fakeNode = static_cast(node); @@ -3765,40 +3835,34 @@ QString DitaXmlGenerator::getLink(const Atom* atom, inObsoleteLink = false; if (atom->string().contains(":") && - (atom->string().startsWith("file:") - || atom->string().startsWith("http:") - || atom->string().startsWith("https:") - || atom->string().startsWith("ftp:") - || atom->string().startsWith("mailto:"))) { - + (atom->string().startsWith("file:") + || atom->string().startsWith("http:") + || atom->string().startsWith("https:") + || atom->string().startsWith("ftp:") + || atom->string().startsWith("mailto:"))) { + link = atom->string(); } else { QStringList path; - if (atom->string().contains('#')) { + if (atom->string().contains('#')) path = atom->string().split('#'); - } - else { + else path.append(atom->string()); - } - - Atom *targetAtom = 0; + Atom* targetAtom = 0; QString first = path.first().trimmed(); - if (first.isEmpty()) { + + if (first.isEmpty()) *node = relative; - } - else if (first.endsWith(".html")) { + else if (first.endsWith(".html")) *node = myTree->root()->findNode(first, Node::Fake); - } else { *node = marker->resolveTarget(first, myTree, relative); - if (!*node) { + if (!*node) *node = myTree->findFakeNodeByTitle(first); - } - if (!*node) { + if (!*node) *node = myTree->findUnambiguousTarget(first, targetAtom); - } } if (*node) { @@ -3807,36 +3871,26 @@ QString DitaXmlGenerator::getLink(const Atom* atom, else path.removeFirst(); } - else { + else *node = relative; - } - if (*node) { - if ((*node)->status() == Node::Obsolete) { - if (relative) { - if (relative->parent() != *node) { - if (relative->status() != Node::Obsolete) { - bool porting = false; - if (relative->type() == Node::Fake) { - const FakeNode* fake = static_cast(relative); - if (fake->title().startsWith("Porting")) - porting = true; - } - QString name = marker->plainFullName(relative); - if (!porting && !name.startsWith("Q3")) { - if (obsoleteLinks) { - relative->doc().location().warning(tr("Link to obsolete item '%1' in %2") - .arg(atom->string()) - .arg(name)); - } - inObsoleteLink = true; - } - } - } + if (*node && (*node)->status() == Node::Obsolete) { + if (relative && (relative->parent() != *node) && + (relative->status() != Node::Obsolete)) { + bool porting = false; + if (relative->type() == Node::Fake) { + const FakeNode* fake = static_cast(relative); + if (fake->title().startsWith("Porting")) + porting = true; } - else { - qDebug() << "Link to Obsolete entity" - << (*node)->name() << "no relative"; + QString name = marker->plainFullName(relative); + if (!porting && !name.startsWith("Q3")) { + if (obsoleteLinks) { + relative->doc().location().warning(tr("Link to obsolete item '%1' in %2") + .arg(atom->string()) + .arg(name)); + } + inObsoleteLink = true; } } } @@ -3958,15 +4012,15 @@ void DitaXmlGenerator::endLink() if (inLink) { if (link.isEmpty()) { if (showBrokenLinks) - xmlWriter().writeEndElement(); // i + xmlWriter().writeEndElement(); // } else { if (inObsoleteLink) { xmlWriter().writeStartElement("sup"); xmlWriter().writeCharacters("(obsolete)"); - xmlWriter().writeEndElement(); // sup + xmlWriter().writeEndElement(); // } - xmlWriter().writeEndElement(); // xref + xmlWriter().writeEndElement(); // } } inLink = false; @@ -3974,6 +4028,7 @@ void DitaXmlGenerator::endLink() } /*! + zzz Generates the summary for the \a section. Only used for sections of QML element documentation. @@ -4017,6 +4072,7 @@ void DitaXmlGenerator::generateQmlSummary(const Section& section, } /*! + zzz Outputs the html detailed documentation for a section on a QML element reference page. */ @@ -4103,6 +4159,7 @@ void DitaXmlGenerator::generateDetailedQmlMember(const Node *node, } /*! + zzz Output the "Inherits" line for the QML element, if there should be one. */ @@ -4153,6 +4210,7 @@ void DitaXmlGenerator::generateQmlInheritedBy(const QmlClassNode* cn, } /*! + zzz text Output the "[Xxx instantiates the C++ class QmlGraphicsXxx]" line for the QML element, if there should be one. @@ -4164,7 +4222,8 @@ void DitaXmlGenerator::generateQmlInstantiates(const QmlClassNode* qcn, { const ClassNode* cn = qcn->classNode(); if (cn && (cn->status() != Node::Internal)) { - out() << "

    "; + xmlWriter().writeStartElement("p"); + xmlWriter().writeAttribute("outputclass","centerAlign"); Text text; text << "["; text << Atom(Atom::LinkNode,CodeMarker::stringForNode(qcn)); @@ -4178,11 +4237,12 @@ void DitaXmlGenerator::generateQmlInstantiates(const QmlClassNode* qcn, text << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK); text << "]"; generateText(text, qcn, marker); - out() << "

    "; + xmlWriter().writeEndElement(); //

    } } /*! + zzz text Output the "[QmlGraphicsXxx is instantiated by QML element Xxx]" line for the class, if there should be one. @@ -4195,7 +4255,8 @@ void DitaXmlGenerator::generateInstantiatedBy(const ClassNode* cn, if (cn && cn->status() != Node::Internal && !cn->qmlElement().isEmpty()) { const Node* n = myTree->root()->findNode(cn->qmlElement(),Node::Fake); if (n && n->subType() == Node::QmlClass) { - out() << "

    "; + xmlWriter().writeStartElement("p"); + xmlWriter().writeAttribute("outputclass","centerAlign"); Text text; text << "["; text << Atom(Atom::LinkNode,CodeMarker::stringForNode(cn)); @@ -4209,7 +4270,7 @@ void DitaXmlGenerator::generateInstantiatedBy(const ClassNode* cn, text << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK); text << "]"; generateText(text, cn, marker); - out() << "

    "; + xmlWriter().writeEndElement(); //

    } } } @@ -5057,6 +5118,12 @@ void DitaXmlGenerator::endSubPage() PageGenerator::endSubPage(); } +/*! + Returns a reference to the XML stream writer currently in use. + There is one XML stream writer open for each XML file being + written, and they are kept on a stack. The one on top of the + stack is the one being written to at the moment. + */ QXmlStreamWriter& DitaXmlGenerator::xmlWriter() { return *xmlWriterStack.top(); @@ -5065,6 +5132,7 @@ QXmlStreamWriter& DitaXmlGenerator::xmlWriter() QT_END_NAMESPACE #ifdef TO_BE_INCLUDED_IN_API_DESC +zzzz Text subtitleText; if (rawTitle != fullTitle) subtitleText << "(" << Atom(Atom::AutoLink, fullTitle) << ")" -- cgit v0.12 From 4b8542e958ebced0b324e64291c6d10d79680021 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 15 Sep 2010 09:03:02 +0200 Subject: qdoc: Converted some more html output to xml output. --- tools/qdoc3/ditaxmlgenerator.cpp | 60 ++++++++++++++-------------------------- 1 file changed, 20 insertions(+), 40 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 24f3e77..90b2f06 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -2684,18 +2684,20 @@ void DitaXmlGenerator::generateLegaleseList(const Node* relative, } } +/*! + Generate the text for the QML item described by \a node + and write it to the current XML stream. + */ void DitaXmlGenerator::generateQmlItem(const Node* node, const Node* relative, CodeMarker* marker, bool summary) { QString marked = marker->markedUpQmlItem(node,summary); - QRegExp templateTag("(<[^@>]*>)"); - if (marked.indexOf(templateTag) != -1) { - QString contents = protectEnc(marked.mid(templateTag.pos(1), - templateTag.cap(1).length())); - marked.replace(templateTag.pos(1), templateTag.cap(1).length(), - contents); + QRegExp tag("(<[^@>]*>)"); + if (marked.indexOf(tag) != -1) { + QString tmp = protectEnc(marked.mid(tag.pos(1), tag.cap(1).length())); + marked.replace(tag.pos(1), tag.cap(1).length(), tmp); } marked.replace(QRegExp("<@param>([a-z]+)_([1-9n])"), "\\1\\2"); @@ -2984,13 +2986,10 @@ QString DitaXmlGenerator::getMarkedUpSynopsis(const Node* node, CodeMarker::SynopsisStyle style) { QString marked = marker->markedUpSynopsis(node, relative, style); - QRegExp templateTag("(<[^@>]*>)"); - if (marked.indexOf(templateTag) != -1) { - QString contents = protectEnc(marked.mid(templateTag.pos(1), - templateTag.cap(1).length())); - marked.replace(templateTag.pos(1), - templateTag.cap(1).length(), - contents); + QRegExp tag("(<[^@>]*>)"); + if (marked.indexOf(tag) != -1) { + QString tmp = protectEnc(marked.mid(tag.pos(1), tag.cap(1).length())); + marked.replace(tag.pos(1), tag.cap(1).length(), tmp); } marked.replace(QRegExp("<@param>([a-z]+)_([1-9n])"), "\\1\\2"); @@ -4028,7 +4027,6 @@ void DitaXmlGenerator::endLink() } /*! - zzz Generates the summary for the \a section. Only used for sections of QML element documentation. @@ -4039,35 +4037,17 @@ void DitaXmlGenerator::generateQmlSummary(const Section& section, CodeMarker* marker) { if (!section.members.isEmpty()) { + xmlWriter().writeStartElement("ul"); NodeList::ConstIterator m; - int count = section.members.size(); - bool twoColumn = false; - if (section.members.first()->type() == Node::QmlProperty) { - twoColumn = (count >= 5); - } - if (twoColumn) - out() << "\n"; - if (++numTableRows % 2 == 1) - out() << ""; - else - out() << ""; - // << "\n
    "; - out() << "
      \n"; - - int row = 0; m = section.members.begin(); while (m != section.members.end()) { - if (twoColumn && row == (int) (count + 1) / 2) - out() << "
      \n"; - out() << "
    • "; + xmlWriter().writeStartElement("li"); + xmlWriter().writeAttribute("outputclass", "fn"); generateQmlItem(*m,relative,marker,true); - out() << "
    • \n"; - row++; + xmlWriter().writeEndElement(); // ++m; } - out() << "
    \n"; - if (twoColumn) - out() << "
    \n"; + xmlWriter().writeEndElement(); // } } @@ -4076,9 +4056,9 @@ void DitaXmlGenerator::generateQmlSummary(const Section& section, Outputs the html detailed documentation for a section on a QML element reference page. */ -void DitaXmlGenerator::generateDetailedQmlMember(const Node *node, - const InnerNode *relative, - CodeMarker *marker) +void DitaXmlGenerator::generateDetailedQmlMember(const Node* node, + const InnerNode* relative, + CodeMarker* marker) { QString marked; const QmlPropertyNode* qpn = 0; -- cgit v0.12 From ed73f806928760ace1d4c7c2a6327875725bcb05 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Sat, 18 Sep 2010 13:37:32 +0200 Subject: qdoc: DITA XML generator now uses
    elements... ...instead of

    elements with the outputclass attribute set to some h value. Also added some missing macros to qt-ditaxml.qdocconf, but there is more to think about here. --- src/corelib/tools/qeasingcurve.cpp | 20 +- tools/qdoc3/ditaxmlgenerator.cpp | 354 +++++++++++++++++++---------------- tools/qdoc3/ditaxmlgenerator.h | 7 + tools/qdoc3/generator.cpp | 72 +++---- tools/qdoc3/generator.h | 3 +- tools/qdoc3/test/qt-ditaxml.qdocconf | 31 +++ 6 files changed, 270 insertions(+), 217 deletions(-) diff --git a/src/corelib/tools/qeasingcurve.cpp b/src/corelib/tools/qeasingcurve.cpp index 7fe9170..aee9356 100644 --- a/src/corelib/tools/qeasingcurve.cpp +++ b/src/corelib/tools/qeasingcurve.cpp @@ -92,14 +92,18 @@ animation.setEasingCurve(QEasingCurve::InOutQuad); \endcode - The ability to set an amplitude, overshoot, or period depends on the QEasingCurve type. Amplitude access - is available to curves that behave as springs such as elastic and bounce curves. Changing the amplitude changes - the height of the curve. Period access is only available to elastic curves and setting a higher period slows - the rate of bounce. Only curves that have "boomerang" behaviors such as the InBack, OutBack, InOutBack, and OutInBack - have overshoot settings. These curves will interpolate beyond the end points and return to the end point, - acting similar to a boomerang. - - The \l{Easing Curves Example} contains samples of QEasingCurve types and lets you change the curve settings. + The ability to set an amplitude, overshoot, or period depends on + the QEasingCurve type. Amplitude access is available to curves + that behave as springs such as elastic and bounce curves. Changing + the amplitude changes the height of the curve. Period access is + only available to elastic curves and setting a higher period slows + the rate of bounce. Only curves that have "boomerang" behaviors + such as the InBack, OutBack, InOutBack, and OutInBack have + overshoot settings. These curves will interpolate beyond the end + points and return to the end point, acting similar to a boomerang. + + The \l{Easing Curves Example} contains samples of QEasingCurve + types and lets you change the curve settings. */ diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 90b2f06..9c70cb5 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -60,6 +60,9 @@ QT_BEGIN_NAMESPACE #define COMMAND_VERSION Doc::alias("version") int DitaXmlGenerator::id = 0; +bool DitaXmlGenerator::inApiDesc = false; +bool DitaXmlGenerator::inSection = false; +bool DitaXmlGenerator::inDetailedDescription = false; #define cxxapi_d_xref Doc::alias("cxxapi-d-xref") #define cxxclass Doc::alias("cxxclass") @@ -623,7 +626,10 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, skipAhead = skipAtoms(atom, Atom::BriefRight); break; } - xmlWriter().writeStartElement(SHORTDESC); + if (inApiDesc) + xmlWriter().writeStartElement("p"); + else + xmlWriter().writeStartElement(SHORTDESC); if (relative->type() == Node::Property || relative->type() == Node::Variable) { QString str; @@ -655,7 +661,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, break; case Atom::BriefRight: if (relative->type() != Node::Fake) { - xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // or

    } break; case Atom::C: @@ -842,19 +848,6 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, generateAnnotatedList(fake, marker, groupMembersMap); } } - else if (atom->string() == "relatedinline") { - const FakeNode *fake = static_cast(relative); - if (fake && !fake->groupMembers().isEmpty()) { - // Reverse the list into the original scan order. - // Should be sorted. But on what? It may not be a - // regular class or page definition. - QList list; - foreach (const Node *node, fake->groupMembers()) - list.prepend(node); - foreach (const Node *node, list) - generateBody(node, marker); - } - } break; case Atom::SinceList: { @@ -1009,10 +1002,6 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, QString text; if (atom->next() != 0) text = atom->next()->string(); - if (atom->type() == Atom::Image) { - xmlWriter().writeStartElement("p"); - xmlWriter().writeAttribute("outputclass","centerAlign"); - } if (fileName.isEmpty()) { xmlWriter().writeStartElement("font"); xmlWriter().writeAttribute("color","red"); @@ -1021,14 +1010,23 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, xmlWriter().writeEndElement(); // } else { - xmlWriter().writeStartElement("img"); - xmlWriter().writeAttribute("src",protectEnc(fileName)); - if (!text.isEmpty()) - xmlWriter().writeAttribute("alt",protectEnc(text)); - xmlWriter().writeEndElement(); // + xmlWriter().writeStartElement("fig"); + xmlWriter().writeStartElement("image"); + xmlWriter().writeAttribute("href",protectEnc(fileName)); + if (atom->type() == Atom::InlineImage) + xmlWriter().writeAttribute("placement","inline"); + else { + xmlWriter().writeAttribute("placement","break"); + xmlWriter().writeAttribute("align","center"); + } + if (!text.isEmpty()) { + xmlWriter().writeStartElement("alt"); + xmlWriter().writeCharacters(protectEnc(text)); + xmlWriter().writeEndElement(); // + } + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // } - if (atom->type() == Atom::Image) - xmlWriter().writeEndElement(); //

    } break; case Atom::ImageText: @@ -1221,7 +1219,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, case Atom::ParaRight: endLink(); if (in_para) { - xmlWriter().writeEndElement(); // in_para = false; } break; @@ -1235,23 +1233,28 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, xmlWriter().writeCharacters(atom->string()); break; case Atom::SectionLeft: - xmlWriter().writeStartElement("p"); + if (inSection || inApiDesc) { + inApiDesc = false; + xmlWriter().writeEndElement(); //
    or + } + inSection = true; + xmlWriter().writeStartElement("section"); writeGuidAttribute(Doc::canonicalTitle(Text::sectionHeading(atom).toString())); - xmlWriter().writeAttribute("outputclass","target"); - xmlWriter().writeCharacters(protectEnc(Text::sectionHeading(atom).toString())); - xmlWriter().writeEndElement(); //

    break; case Atom::SectionRight: - // nothing + if (inSection) { + inSection = false; + xmlWriter().writeEndElement(); //
    + } break; case Atom::SectionHeadingLeft: - xmlWriter().writeStartElement("p"); + xmlWriter().writeStartElement("title"); hx = "h" + QString::number(atom->string().toInt() + hOffset(relative)); xmlWriter().writeAttribute("outputclass",hx); inSectionHeading = true; break; case Atom::SectionHeadingRight: - xmlWriter().writeEndElement(); //

    (see case Atom::SectionHeadingLeft) + xmlWriter().writeEndElement(); // (see case Atom::SectionHeadingLeft) inSectionHeading = false; break; case Atom::SidebarLeft: @@ -1470,20 +1473,10 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark writeLocation(cn); xmlWriter().writeEndElement(); // - xmlWriter().writeStartElement(APIDESC); - if (!inner->doc().isEmpty()) { - xmlWriter().writeStartElement("p"); - xmlWriter().writeAttribute("outputclass","h2"); - xmlWriter().writeCharacters("Detailed Description"); - xmlWriter().writeEndElement(); //

    - generateBody(inner, marker); - // generateAlsoList(inner, marker); - } - - xmlWriter().writeEndElement(); // - - // not included: ,
    , or + writeDetailSections(cn, marker, true, QString("Detailed Description")); + // zzz writeSections() gores here. + // not included: or xmlWriter().writeEndElement(); // @@ -1610,13 +1603,54 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker xmlWriter().writeEndElement(); // } + else if (fake->subType() == Node::QmlClass) { + const QmlClassNode* qml_cn = static_cast(fake); + const ClassNode* cn = qml_cn->classNode(); + generateQmlInherits(qml_cn, marker); + generateQmlInstantiates(qml_cn, marker); + generateBrief(qml_cn, marker); + generateQmlInheritedBy(qml_cn, marker); + sections = marker->qmlSections(qml_cn,CodeMarker::Summary,0); + s = sections.begin(); + while (s != sections.end()) { + writeTargetAndHeader((*s).name,protectEnc((*s).name),"h2"); + generateQmlSummary(*s,fake,marker); + ++s; + } + + writeDetailSections(fake, marker, false, QString("Detailed Description")); + + if (cn) + generateQmlText(cn->doc().body(), cn, marker, fake->name()); + + generateAlsoList(fake, marker); + //out() << "
    \n"; + + sections = marker->qmlSections(qml_cn,CodeMarker::Detailed,0); + s = sections.begin(); + while (s != sections.end()) { + xmlWriter().writeStartElement("p"); + xmlWriter().writeAttribute("outputclass","h2"); + xmlWriter().writeCharacters(protectEnc((*s).name)); + xmlWriter().writeEndElement(); //

    + NodeList::ConstIterator m = (*s).members.begin(); + while (m != (*s).members.end()) { + generateDetailedQmlMember(*m, fake, marker); + //out() << "
    \n"; + ++m; + } + ++s; + } + return; + } if (!fake->doc().isEmpty()) { xmlWriter().writeStartElement("body"); if (fake->subType() == Node::Module) { - writeTargetAndHeader("details","Detailed Description","h2"); + writeDetailSections(fake, marker, false, QString("Detailed Description")); } - generateBody(fake, marker); + else + writeDetailSections(fake, marker, false, QString()); generateAlsoList(fake, marker); if (!fake->groupMembers().isEmpty()) { @@ -1649,44 +1683,6 @@ zzz marker); - else if (fake->subType() == Node::QmlClass) { - const QmlClassNode* qml_cn = static_cast(fake); - const ClassNode* cn = qml_cn->classNode(); - generateQmlInherits(qml_cn, marker); - generateQmlInstantiates(qml_cn, marker); - generateBrief(qml_cn, marker); - generateQmlInheritedBy(qml_cn, marker); - sections = marker->qmlSections(qml_cn,CodeMarker::Summary,0); - s = sections.begin(); - while (s != sections.end()) { - out() << "\n"; - out() << "

    " << protectEnc((*s).name) << "

    \n"; - generateQmlSummary(*s,fake,marker); - ++s; - } - - out() << "\n"; - out() << "

    " << "Detailed Description" << "

    \n"; - generateBody(fake, marker); - if (cn) - generateQmlText(cn->doc().body(), cn, marker, fake->name()); - generateAlsoList(fake, marker); - out() << "
    \n"; - - sections = marker->qmlSections(qml_cn,CodeMarker::Detailed,0); - s = sections.begin(); - while (s != sections.end()) { - out() << "

    " << protectEnc((*s).name) << "

    \n"; - NodeList::ConstIterator m = (*s).members.begin(); - while (m != (*s).members.end()) { - generateDetailedQmlMember(*m, fake, marker); - out() << "
    \n"; - ++m; - } - ++s; - } - return; - } #endif #if 0 @@ -1880,7 +1876,7 @@ void DitaXmlGenerator::generateHeader(const Node* node, const QString& name) outputclass = "externalpage"; break; case Node::QmlClass: - outputclass = "QML"; + outputclass = "QML-class"; break; default: outputclass = "page"; @@ -1889,7 +1885,6 @@ void DitaXmlGenerator::generateHeader(const Node* node, const QString& name) xmlWriter().writeDTD(doctype); xmlWriter().writeComment(node->doc().location().fileName()); - xmlWriter().writeStartElement(mainElement); xmlWriter().writeAttribute("id",node->guid()); if (!outputclass.isEmpty()) @@ -2180,7 +2175,13 @@ QString DitaXmlGenerator::generateListOfAllMemberFile(const InnerNode* inner, QString title = "List of All Members for " + inner->name(); generateHeader(inner, title); xmlWriter().writeStartElement("body"); - generateTitle(title, Text(), SmallSubTitle, inner, marker); + xmlWriter().writeStartElement("section"); + if (!title.isEmpty()) { + xmlWriter().writeStartElement("title"); + xmlWriter().writeAttribute("outputclass", "h1"); + xmlWriter().writeCharacters(protectEnc(title)); + xmlWriter().writeEndElement(); // + } xmlWriter().writeStartElement("p"); xmlWriter().writeCharacters("This is the complete list of members for "); generateFullName(inner, 0, marker); @@ -2189,6 +2190,7 @@ QString DitaXmlGenerator::generateListOfAllMemberFile(const InnerNode* inner, Section section = sections.first(); generateSection(section.members, 0, marker, CodeMarker::SeparateList); + xmlWriter().writeEndElement(); //
    xmlWriter().writeEndElement(); // endSubPage(); return fileName; @@ -2219,52 +2221,64 @@ QString DitaXmlGenerator::generateLowStatusMemberFile(const InnerNode* inner, title = "Obsolete Members for " + inner->name(); fileName = fileBase(inner) + "-obsolete." + fileExtension(inner); } - beginSubPage(inner->location(), fileName); generateHeader(inner, title); xmlWriter().writeStartElement("body"); - generateTitle(title, Text(), SmallSubTitle, inner, marker); + xmlWriter().writeStartElement("section"); + if (!title.isEmpty()) { + xmlWriter().writeStartElement("title"); + xmlWriter().writeAttribute("outputclass", "h1"); + xmlWriter().writeCharacters(protectEnc(title)); + xmlWriter().writeEndElement(); // + } + xmlWriter().writeStartElement("p"); if (status == CodeMarker::Compat) { - xmlWriter().writeStartElement("p"); - xmlWriter().writeCharacters("

    The following class members are part of the " - "Qt 3 support layer." - " They are provided to help you port old code to Qt 4. " + xmlWriter().writeStartElement("b"); + xmlWriter().writeCharacters("The following class members are part of the "); + xmlWriter().writeStartElement("xref"); + xmlWriter().writeAttribute("href","qt3support.html"); + xmlWriter().writeCharacters("Qt 3 support layer"); + xmlWriter().writeEndElement(); // + xmlWriter().writeCharacters("."); + xmlWriter().writeEndElement(); // + xmlWriter().writeCharacters(" They are provided to help you port old code to Qt 4. " "We advise against using them in new code."); - xmlWriter().writeEndElement(); //

    } else { - xmlWriter().writeStartElement("p"); - xmlWriter().writeCharacters("The following class members are obsolete. " - "They are provided to keep old source code working. " + xmlWriter().writeStartElement("b"); + xmlWriter().writeCharacters("The following class members are obsolete."); + xmlWriter().writeEndElement(); // + xmlWriter().writeCharacters("They are provided to keep old source code working. " "We strongly advise against using them in new code."); - xmlWriter().writeEndElement(); //

    } + xmlWriter().writeEndElement(); //

    xmlWriter().writeStartElement("p"); xmlWriter().writeStartElement("ul"); QString text = protectEnc(inner->name()) + " class reference"; writeXrefListItem(linkForNode(inner,0),text); xmlWriter().writeEndElement(); // xmlWriter().writeEndElement(); //

    + xmlWriter().writeEndElement(); //
    for (i = 0; i < sections.size(); ++i) { - xmlWriter().writeStartElement("p"); + xmlWriter().writeStartElement("section"); xmlWriter().writeAttribute("outputclass","h2"); + xmlWriter().writeStartElement("title"); xmlWriter().writeCharacters(protectEnc(sections.at(i).name)); - xmlWriter().writeEndElement(); //

    + xmlWriter().writeEndElement(); // generateSection(sections.at(i).members, inner, marker, CodeMarker::Summary); generateSectionInheritedList(sections.at(i), inner, marker); + xmlWriter().writeEndElement(); //
    } sections = marker->sections(inner, CodeMarker::Detailed, status); for (i = 0; i < sections.size(); ++i) { - xmlWriter().writeStartElement("p"); - xmlWriter().writeAttribute("outputclass","separator"); - xmlWriter().writeEndElement(); //

    - xmlWriter().writeStartElement("p"); + xmlWriter().writeStartElement("section"); + xmlWriter().writeStartElement("title"); xmlWriter().writeAttribute("outputclass","h2"); xmlWriter().writeCharacters(protectEnc(sections.at(i).name)); - xmlWriter().writeEndElement(); //

    + xmlWriter().writeEndElement(); // NodeList::ConstIterator m = sections.at(i).members.begin(); while (m != sections.at(i).members.end()) { @@ -2273,6 +2287,7 @@ QString DitaXmlGenerator::generateLowStatusMemberFile(const InnerNode* inner, } ++m; } + xmlWriter().writeEndElement(); //
    } xmlWriter().writeEndElement(); // xmlWriter().writeEndElement(); // @@ -3511,7 +3526,6 @@ void DitaXmlGenerator::generateDetailedMember(const Node* node, xmlWriter().writeStartElement("p"); writeGuidAttribute(refForNode(node)); xmlWriter().writeAttribute("outputclass","h3 flags"); - xmlWriter().writeCharacters(refForNode(node)); marked = getMarkedUpSynopsis(en, relative, marker, CodeMarker::Detailed); writeText(marked, marker, relative); xmlWriter().writeCharacters("\n"); @@ -3523,7 +3537,6 @@ void DitaXmlGenerator::generateDetailedMember(const Node* node, xmlWriter().writeStartElement("p"); writeGuidAttribute(refForNode(node)); xmlWriter().writeAttribute("outputclass","h3 fn"); - xmlWriter().writeCharacters(refForNode(node)); marked = getMarkedUpSynopsis(node, relative, marker, CodeMarker::Detailed); writeText(marked, marker, relative); xmlWriter().writeEndElement(); //

    @@ -4139,12 +4152,11 @@ void DitaXmlGenerator::generateDetailedQmlMember(const Node* node, } /*! - zzz Output the "Inherits" line for the QML element, if there should be one. */ void DitaXmlGenerator::generateQmlInherits(const QmlClassNode* cn, - CodeMarker* marker) + CodeMarker* marker) { if (cn && !cn->links().empty()) { if (cn->links().contains(Node::InheritsLink)) { @@ -4154,7 +4166,8 @@ void DitaXmlGenerator::generateQmlInherits(const QmlClassNode* cn, const Node* n = myTree->findNode(strList,Node::Fake); if (n && n->subType() == Node::QmlClass) { const QmlClassNode* qcn = static_cast(n); - out() << "

    "; + xmlWriter().writeStartElement("p"); + xmlWriter().writeAttribute("outputclass","centerAlign"); Text text; text << "[Inherits "; text << Atom(Atom::LinkNode,CodeMarker::stringForNode(qcn)); @@ -4163,7 +4176,7 @@ void DitaXmlGenerator::generateQmlInherits(const QmlClassNode* cn, text << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK); text << "]"; generateText(text, cn, marker); - out() << "

    "; + xmlWriter().writeEndElement(); //

    } } } @@ -4174,7 +4187,7 @@ void DitaXmlGenerator::generateQmlInherits(const QmlClassNode* cn, if it is inherited by any other elements. */ void DitaXmlGenerator::generateQmlInheritedBy(const QmlClassNode* cn, - CodeMarker* marker) + CodeMarker* marker) { if (cn) { NodeList subs; @@ -4190,7 +4203,6 @@ void DitaXmlGenerator::generateQmlInheritedBy(const QmlClassNode* cn, } /*! - zzz text Output the "[Xxx instantiates the C++ class QmlGraphicsXxx]" line for the QML element, if there should be one. @@ -4198,7 +4210,7 @@ void DitaXmlGenerator::generateQmlInheritedBy(const QmlClassNode* cn, is set to Node::Internal, do nothing. */ void DitaXmlGenerator::generateQmlInstantiates(const QmlClassNode* qcn, - CodeMarker* marker) + CodeMarker* marker) { const ClassNode* cn = qcn->classNode(); if (cn && (cn->status() != Node::Internal)) { @@ -4222,7 +4234,6 @@ void DitaXmlGenerator::generateQmlInstantiates(const QmlClassNode* qcn, } /*! - zzz text Output the "[QmlGraphicsXxx is instantiated by QML element Xxx]" line for the class, if there should be one. @@ -4500,16 +4511,11 @@ void DitaXmlGenerator::writeFunctions(const Section& s, writeParameters(fn,marker); writeLocation(fn); xmlWriter().writeEndElement(); // - xmlWriter().writeStartElement(APIDESC); - - if (!fn->doc().isEmpty()) { - generateBody(fn, marker); - // generateAlsoList(inner, marker); - } - xmlWriter().writeEndElement(); // + writeDetailSections(fn, marker, true, QString()); + // generateAlsoList(inner, marker); - // not included: ,
    , or + // not included: or xmlWriter().writeEndElement(); // xmlWriter().writeEndElement(); // @@ -4661,15 +4667,10 @@ void DitaXmlGenerator::writeEnumerations(const Section& s, writeLocation(en); xmlWriter().writeEndElement(); // - xmlWriter().writeStartElement(APIDESC); - - if (!en->doc().isEmpty()) { - generateBody(en, marker); - } - xmlWriter().writeEndElement(); // + writeDetailSections(en, marker, true, QString()); - // not included: ,
    , or + // not included: or xmlWriter().writeEndElement(); // @@ -4726,15 +4727,10 @@ void DitaXmlGenerator::writeTypedefs(const Section& s, writeLocation(tn); xmlWriter().writeEndElement(); // - xmlWriter().writeStartElement(APIDESC); - - if (!tn->doc().isEmpty()) { - generateBody(tn, marker); - } - xmlWriter().writeEndElement(); // + writeDetailSections(tn, marker, true, QString()); - // not included: ,
    , or + // not included: or xmlWriter().writeEndElement(); // @@ -4842,15 +4838,10 @@ void DitaXmlGenerator::writeProperties(const Section& s, writeLocation(pn); xmlWriter().writeEndElement(); // - xmlWriter().writeStartElement(APIDESC); - if (!pn->doc().isEmpty()) { - generateBody(pn, marker); - } - - xmlWriter().writeEndElement(); // - - // not included: ,
    , or + writeDetailSections(pn, marker, true, QString()); + + // not included: or xmlWriter().writeEndElement(); // @@ -4929,15 +4920,10 @@ void DitaXmlGenerator::writeDataMembers(const Section& s, writeLocation(vn); xmlWriter().writeEndElement(); // - xmlWriter().writeStartElement(APIDESC); - - if (!vn->doc().isEmpty()) { - generateBody(vn, marker); - } - xmlWriter().writeEndElement(); // + writeDetailSections(vn, marker, true, QString()); - // not included: ,
    , + // not included: or xmlWriter().writeEndElement(); // @@ -5028,15 +5014,10 @@ void DitaXmlGenerator::writeMacros(const Section& s, writeLocation(fn); xmlWriter().writeEndElement(); // - xmlWriter().writeStartElement(APIDESC); - - if (!fn->doc().isEmpty()) { - generateBody(fn, marker); - } - xmlWriter().writeEndElement(); // + writeDetailSections(fn, marker, true, QString()); - // not included: ,
    , or + // not included: or xmlWriter().writeEndElement(); // @@ -5109,6 +5090,55 @@ QXmlStreamWriter& DitaXmlGenerator::xmlWriter() return *xmlWriterStack.top(); } +/*! + Writes the \e {Detailed Description} section(s) for \a node + to the current XML stream using the code \a marker. if the + \a apiDesc flag is true, then the first section of the + sequence of sections written will be an \c {apiDesc>} + element with a \e {spectitle} attribute of \e {Detailed + Description}. Otherwise, the first section will be a + \c {
    } element with a \c {} element of + \e {Detailed Description}. This function calls the + Generator::generateBody() function to write the XML for + the section list. + */ +void DitaXmlGenerator::writeDetailSections(const Node* node, + CodeMarker* marker, + bool apiDesc, + const QString& title) +{ + if (!node->doc().isEmpty()) { + inDetailedDescription = true; + if (apiDesc) { + inApiDesc = true; + xmlWriter().writeStartElement(APIDESC); + xmlWriter().writeAttribute("id",node->guid()); + if (!title.isEmpty()) + xmlWriter().writeAttribute("spectitle",title); + } + else { + inSection = true; + xmlWriter().writeStartElement("section"); + xmlWriter().writeAttribute("id",node->guid()); + if (!title.isEmpty()) { + xmlWriter().writeStartElement("title"); + xmlWriter().writeCharacters(title); + xmlWriter().writeEndElement(); // + } + } + generateBody(node, marker); + if (inApiDesc) { + xmlWriter().writeEndElement(); // + inApiDesc = false; + } + else if (inSection) { + xmlWriter().writeEndElement(); //
    + inSection = false; + } + } + inDetailedDescription = false; +} + QT_END_NAMESPACE #ifdef TO_BE_INCLUDED_IN_API_DESC diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index bd78e93..35c49ae 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -263,6 +263,10 @@ class DitaXmlGenerator : public PageGenerator virtual void beginSubPage(const Location& location, const QString& fileName); virtual void endSubPage(); QXmlStreamWriter& xmlWriter(); + void writeDetailSections(const Node* node, + CodeMarker* marker, + bool apiDesc, + const QString& title); private: QMap refMap; @@ -315,6 +319,9 @@ class DitaXmlGenerator : public PageGenerator NewClassMaps newClassMaps; NewClassMaps newQmlClassMaps; static int id; + static bool inApiDesc; + static bool inSection; + static bool inDetailedDescription; QStack xmlWriterStack; }; diff --git a/tools/qdoc3/generator.cpp b/tools/qdoc3/generator.cpp index 5bd5156..1a41399 100644 --- a/tools/qdoc3/generator.cpp +++ b/tools/qdoc3/generator.cpp @@ -327,6 +327,7 @@ bool Generator::generateText(const Text& text, const Node *relative, CodeMarker *marker) { + bool result = false; if (text.firstAtom() != 0) { int numAtoms = 0; startText(relative, marker); @@ -336,9 +337,9 @@ bool Generator::generateText(const Text& text, true, numAtoms); endText(relative, marker); - return true; + result = true; } - return false; + return result; } #ifdef QDOC_QML @@ -352,24 +353,26 @@ bool Generator::generateQmlText(const Text& text, const QString& /* qmlName */ ) { const Atom* atom = text.firstAtom(); - if (atom == 0) - return false; + bool result = false; - startText(relative, marker); - while (atom) { - if (atom->type() != Atom::QmlText) - atom = atom->next(); - else { - atom = atom->next(); - while (atom && (atom->type() != Atom::EndQmlText)) { - int n = 1 + generateAtom(atom, relative, marker); - while (n-- > 0) - atom = atom->next(); + if (atom != 0) { + startText(relative, marker); + while (atom) { + if (atom->type() != Atom::QmlText) + atom = atom->next(); + else { + atom = atom->next(); + while (atom && (atom->type() != Atom::EndQmlText)) { + int n = 1 + generateAtom(atom, relative, marker); + while (n-- > 0) + atom = atom->next(); + } } } + endText(relative, marker); + result = true; } - endText(relative, marker); - return true; + return result; } #endif @@ -377,14 +380,7 @@ void Generator::generateBody(const Node *node, CodeMarker *marker) { bool quiet = false; - if (node->type() == Node::Function) { -#if 0 - const FunctionNode *func = (const FunctionNode *) node; - if (func->isOverload() && func->metaness() != FunctionNode::Ctor) - generateOverload(node, marker); -#endif - } - else if (node->type() == Node::Fake) { + if (node->type() == Node::Fake) { const FakeNode *fake = static_cast(node); if (fake->subType() == Node::Example) { generateExampleFiles(fake, marker); @@ -501,18 +497,16 @@ void Generator::generateBody(const Node *node, CodeMarker *marker) ++a; } } -/* Something like this return value check should be implemented at some point. */ + /* + Something like this return value check should + be implemented at some point. + */ if (func->status() > Node::Obsolete && func->returnType() == "bool" && func->reimplementedFrom() == 0 && !func->isOverload()) { QString body = func->doc().body().toString(); if (!body.contains("return", Qt::CaseInsensitive)) node->doc().location().warning(tr("Undocumented return value")); } -#if 0 - // Now we put this at the top, before the other text. - if (func->reimplementedFrom() != 0) - generateReimplementedFrom(func, marker); -#endif } } @@ -1091,20 +1085,6 @@ void Generator::generateSince(const Node *node, CodeMarker *marker) } } -/*! - No longer in use. - */ -void Generator::generateOverload(const Node *node, CodeMarker *marker) -{ - Text text; - text << Atom::ParaLeft - << "This function overloads "; - QString t = node->name() + "()"; - text << Atom::AutoLink << t - << Atom::ParaRight; - generateText(text, node, marker); -} - void Generator::generateReimplementedFrom(const FunctionNode *func, CodeMarker *marker) { @@ -1153,8 +1133,8 @@ const Atom *Generator::generateAtomList(const Atom *atom, if (atom->type() == Atom::FormatEndif) { if (generate && numAtoms0 == numAtoms) { - relative->location().warning(tr("Output format %1 not handled") - .arg(format())); + relative->location().warning(tr("Output format %1 not handled %2") + .arg(format()).arg(outFileName())); Atom unhandledFormatAtom(Atom::UnhandledFormat, format()); generateAtomList(&unhandledFormatAtom, relative, diff --git a/tools/qdoc3/generator.h b/tools/qdoc3/generator.h index 326a247..bccfc5d 100644 --- a/tools/qdoc3/generator.h +++ b/tools/qdoc3/generator.h @@ -130,6 +130,8 @@ class Generator const Node *relative, CodeMarker *marker) const; + virtual QString outFileName() { return QString(); } + const QString& outputDir() { return outDir; } QString indent(int level, const QString& markedCode); QString plainCode(const QString& markedCode); @@ -148,7 +150,6 @@ class Generator static void supplementAlsoList(const Node *node, QList &alsoList); private: - void generateOverload(const Node *node, CodeMarker *marker); void generateReimplementedFrom(const FunctionNode *func, CodeMarker *marker); void appendFullName(Text& text, diff --git a/tools/qdoc3/test/qt-ditaxml.qdocconf b/tools/qdoc3/test/qt-ditaxml.qdocconf index 66f30e3..63baead 100644 --- a/tools/qdoc3/test/qt-ditaxml.qdocconf +++ b/tools/qdoc3/test/qt-ditaxml.qdocconf @@ -9,3 +9,34 @@ outputformats = DITAXML generateindex = true url = . +macro.aacute.DITAXML = "á" +macro.Aring.DITAXML = "Å" +macro.aring.DITAXML = "å" +macro.Auml.DITAXML = "Ä" +macro.author = "\\bold{Author:}" +macro.br.DITAXML = " " +macro.BR.DITAXML = " " +macro.copyright.DITAXML = "©" +macro.eacute.DITAXML = "é" +macro.gui = "\\bold" +macro.hr.DITAXML = "
    " +macro.iacute.DITAXML = "í" +macro.key = "\\bold" +macro.menu = "\\bold" +macro.note = "\\bold{Note:}" +macro.oslash.DITAXML = "ø" +macro.ouml.DITAXML = "ö" +macro.QA = "\\e{Qt Assistant}" +macro.QD = "\\e{Qt Designer}" +macro.QL = "\\e{Qt Linguist}" +macro.QQV = "\\e{Qt QML Viewer}" +macro.param = "\\e" +macro.raisedaster.DITAXML = "*" +macro.rarrow.DITAXML = "→" +macro.reg.DITAXML = "®" +macro.return = "Returns" +macro.starslash = "\\c{*/}" +macro.begincomment = "\\c{/*}" +macro.endcomment = "\\c{*/}" +macro.uuml.DITAXML = "ü" +macro.mdash.DITAXML = "—" -- cgit v0.12 From 839938e86dd22601b679c5f33606830850d6df81 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 20 Sep 2010 14:40:42 +0200 Subject: qdoc: DITA XML generator now avoids escaping elements. Still escapes and , for example. --- tools/qdoc3/ditaxmlgenerator.cpp | 191 +++++++++++++++++---------------------- tools/qdoc3/ditaxmlgenerator.h | 1 + 2 files changed, 84 insertions(+), 108 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 9c70cb5..0170644 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -358,19 +358,21 @@ QString DitaXmlGenerator::sinceTitles[] = static bool showBrokenLinks = false; -static void addLink(const QString &linkTarget, - const QStringRef &nestedStuff, - QString *res) +/*! + Appends an element to the current XML stream + with the \a href attribute and the \a text. + */ +void DitaXmlGenerator::addLink(const QString& href, + const QStringRef& text) { - if (!linkTarget.isEmpty()) { - *res += ""; - *res += nestedStuff; - *res += ""; + if (!href.isEmpty()) { + xmlWriter().writeStartElement("xref"); + xmlWriter().writeAttribute("href", href); + xmlWriter().writeCharacters(text.toString()); + xmlWriter().writeEndElement(); // } else { - *res += nestedStuff; + xmlWriter().writeCharacters(text.toString()); } } @@ -2240,14 +2242,14 @@ QString DitaXmlGenerator::generateLowStatusMemberFile(const InnerNode* inner, xmlWriter().writeAttribute("href","qt3support.html"); xmlWriter().writeCharacters("Qt 3 support layer"); xmlWriter().writeEndElement(); // - xmlWriter().writeCharacters("."); + xmlWriter().writeCharacters(". "); xmlWriter().writeEndElement(); // - xmlWriter().writeCharacters(" They are provided to help you port old code to Qt 4. " + xmlWriter().writeCharacters("They are provided to help you port old code to Qt 4. " "We advise against using them in new code."); } else { xmlWriter().writeStartElement("b"); - xmlWriter().writeCharacters("The following class members are obsolete."); + xmlWriter().writeCharacters("The following class members are obsolete. "); xmlWriter().writeEndElement(); // xmlWriter().writeCharacters("They are provided to keep old source code working. " "We strongly advise against using them in new code."); @@ -3050,101 +3052,20 @@ void DitaXmlGenerator::writeText(const QString& markedCode, const QChar charLangle = '<'; const QChar charAt = '@'; - // replace all <@link> tags: "(<@link node=\"([^\"]+)\">).*()" - static const QString linkTag("link"); - bool done = false; - for (int i = 0, n = src.size(); i < n;) { - if (src.at(i) == charLangle && src.at(i + 1).unicode() == '@') { - if (nameAlignment && !done) {// && (i != 0)) Why was this here? - if (!html.isEmpty()) { - xmlWriter().writeCharacters(html); - html.clear(); - } - xmlWriter().writeEndElement(); // - xmlWriter().writeStartElement("entry"); - xmlWriter().writeAttribute("outputclass=","memItemRight bottomAlign"); - done = true; - } - i += 2; - if (parseArg(src, linkTag, &i, n, &arg, &par1)) { - html += ""; - QString link = linkForNode( - CodeMarker::nodeForString(par1.toString()), relative); - addLink(link, arg, &html); - html += ""; - } - else { - html += charLangle; - html += charAt; - } - } - else { - html += src.at(i++); - } - } - - // replace all "(<@(type|headerfile|func)(?: +[^>]*)?>)(.*)()" tags - src = html; - html = QString(); - static const QString typeTags[] = { "type", "headerfile", "func" }; - for (int i = 0, n = src.size(); i < n;) { - if (src.at(i) == charLangle && src.at(i + 1) == charAt) { - i += 2; - bool handled = false; - for (int k = 0; k != 3; ++k) { - if (parseArg(src, typeTags[k], &i, n, &arg, &par1)) { - par1 = QStringRef(); - QString link = linkForNode( - marker->resolveTarget(arg.toString(), myTree, relative), - relative); - addLink(link, arg, &html); - handled = true; - break; - } - } - if (!handled) { - html += charLangle; - html += charAt; - } - } - else { - html += src.at(i++); - } - } - - // replace all - // "<@comment>" -> ""; - // "<@preprocessor>" -> ""; - // "<@string>" -> ""; - // "<@char>" -> ""; - // "" -> "" - src = html; - html = QString(); + /* + First strip out all the extraneous markup. The table + below contains the markup we want to keep. Everything + else that begins with "<@" or "", "", - "<@preprocessor>", "", - "<@string>", "", - "<@char>", "", - "", "", - "","", - "", "", - "", "" - // "<@char>", "", - // "", "", - // "<@func>", "", - // "", "", - // "<@id>", "", - // "", "", - // "<@keyword>", "", - // "", "", - // "<@number>", "", - // "", "", - // "<@op>", "", - // "", "", - // "<@param>", "", - // "", "", - // "<@string>", "", - // "", "", + "<@link ", "<@link ", + "<@type>", "<@type>", + "<@headerfile>", "<@headerfile>", + "<@func>", "<@func>", + "", "", + "", "", + "", "", + "", "" }; for (int i = 0, n = src.size(); i < n;) { if (src.at(i) == charLangle) { @@ -3178,8 +3099,62 @@ void DitaXmlGenerator::writeText(const QString& markedCode, ++i; } } - if (!html.isEmpty()) + + // replace all <@link> tags: "(<@link node=\"([^\"]+)\">).*()" + // replace all "(<@(type|headerfile|func)(?: +[^>]*)?>)(.*)()" tags + src = html; + html = QString(); + static const QString markTags[] = { "link", "type", "headerfile", "func" }; + bool done = false; + for (int i = 0, n = src.size(); i < n;) { + if (src.at(i) == charLangle && src.at(i + 1) == charAt) { + if (nameAlignment && !done) { + if (!html.isEmpty()) { + xmlWriter().writeCharacters(html); + html.clear(); + } + xmlWriter().writeEndElement(); // + xmlWriter().writeStartElement("entry"); + xmlWriter().writeAttribute("outputclass=","memItemRight bottomAlign"); + done = true; + } + i += 2; + bool handled = false; + for (int k = 0; k != 4; ++k) { + if (parseArg(src, markTags[k], &i, n, &arg, &par1)) { + const Node* n = 0; + if (k == 0) { + if (!html.isEmpty()) { + xmlWriter().writeCharacters(html); + html.clear(); + } + n = CodeMarker::nodeForString(par1.toString()); + QString link = linkForNode(n, relative); + addLink(link, arg); + } + else { + if (!html.isEmpty()) { + xmlWriter().writeCharacters(html); + html.clear(); + } + par1 = QStringRef(); + marker->resolveTarget(arg.toString(), myTree, relative); + QString link = linkForNode(n,relative); + addLink(link, arg); + } + handled = true; + break; + } + } + } + else { + html += src.at(i++); + } + } + + if (!html.isEmpty()) { xmlWriter().writeCharacters(html); + } } void DitaXmlGenerator::generateLink(const Atom* atom, diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index 35c49ae..a5346a5 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -267,6 +267,7 @@ class DitaXmlGenerator : public PageGenerator CodeMarker* marker, bool apiDesc, const QString& title); + void addLink(const QString& href, const QStringRef& text); private: QMap refMap; -- cgit v0.12 From 445513153c6c4f80eccf77c33ca38574b5972922 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Tue, 21 Sep 2010 09:35:32 +0200 Subject: qdoc: DITA XML generator now avoids escaping and elements. --- tools/qdoc3/ditaxmlgenerator.cpp | 40 ++++++++++++++++++++++++++++++++++------ 1 file changed, 34 insertions(+), 6 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 0170644..de70d29 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -3010,9 +3010,10 @@ QString DitaXmlGenerator::getMarkedUpSynopsis(const Node* node, } marked.replace(QRegExp("<@param>([a-z]+)_([1-9n])"), "\\1\\2"); +#if 0 marked.replace("<@param>",""); marked.replace("",""); - +#endif if (style == CodeMarker::Summary) { marked.replace("<@name>",""); // was "" marked.replace("",""); // was "" @@ -3023,10 +3024,12 @@ QString DitaXmlGenerator::getMarkedUpSynopsis(const Node* node, extraRegExp.setMinimal(true); marked.replace(extraRegExp,""); } +#if 0 else { marked.replace("<@extra>",""); marked.replace("",""); } +#endif if (style != CodeMarker::Detailed) { marked.replace("<@type>",""); @@ -3062,15 +3065,19 @@ void DitaXmlGenerator::writeText(const QString& markedCode, "<@type>", "<@type>", "<@headerfile>", "<@headerfile>", "<@func>", "<@func>", + "<@param>", "<@param>", + "<@extra>", "<@extra>", "", "", "", "", "", "", - "", "" + "", "", + "", "", + "", "" }; for (int i = 0, n = src.size(); i < n;) { if (src.at(i) == charLangle) { bool handled = false; - for (int k = 0; k != 8; ++k) { + for (int k = 0; k != 12; ++k) { const QString & tag = spanTags[2 * k]; if (tag == QStringRef(&src, i, tag.length())) { html += spanTags[2 * k + 1]; @@ -3104,7 +3111,10 @@ void DitaXmlGenerator::writeText(const QString& markedCode, // replace all "(<@(type|headerfile|func)(?: +[^>]*)?>)(.*)()" tags src = html; html = QString(); - static const QString markTags[] = { "link", "type", "headerfile", "func" }; + static const QString markTags[] = { + // 0 1 2 3 4 5 + "link", "type", "headerfile", "func", "param", "extra" + }; bool done = false; for (int i = 0, n = src.size(); i < n;) { if (src.at(i) == charLangle && src.at(i + 1) == charAt) { @@ -3120,10 +3130,10 @@ void DitaXmlGenerator::writeText(const QString& markedCode, } i += 2; bool handled = false; - for (int k = 0; k != 4; ++k) { + for (int k = 0; k != 6; ++k) { if (parseArg(src, markTags[k], &i, n, &arg, &par1)) { const Node* n = 0; - if (k == 0) { + if (k == 0) { // <@link> if (!html.isEmpty()) { xmlWriter().writeCharacters(html); html.clear(); @@ -3132,6 +3142,24 @@ void DitaXmlGenerator::writeText(const QString& markedCode, QString link = linkForNode(n, relative); addLink(link, arg); } + else if (k == 4) { // <@param> + if (!html.isEmpty()) { + xmlWriter().writeCharacters(html); + html.clear(); + } + xmlWriter().writeStartElement("i"); + xmlWriter().writeCharacters(arg.toString()); + xmlWriter().writeEndElement(); // + } + else if (k == 5) { // <@extra> + if (!html.isEmpty()) { + xmlWriter().writeCharacters(html); + html.clear(); + } + xmlWriter().writeStartElement("tt"); + xmlWriter().writeCharacters(arg.toString()); + xmlWriter().writeEndElement(); // + } else { if (!html.isEmpty()) { xmlWriter().writeCharacters(html); -- cgit v0.12 From 5d1a38fc9e5a8fbbbb78ed8aeb7e328b97781474 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Tue, 21 Sep 2010 13:05:07 +0200 Subject: qdoc: Replaced missing "const" That caused link errors. A const had been erroneously dropped from some fileBase() functions. --- tools/qdoc3/ditaxmlgenerator.cpp | 2 +- tools/qdoc3/ditaxmlgenerator.h | 5 +---- tools/qdoc3/htmlgenerator.cpp | 4 ++-- tools/qdoc3/htmlgenerator.h | 4 ++-- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index de70d29..d25c76c 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -3361,7 +3361,7 @@ QString DitaXmlGenerator::protect(const QString& string, const QString& outputEn Constructs a file name appropriate for the \a node and returns the file name. */ -QString DitaXmlGenerator::fileBase(const Node* node) +QString DitaXmlGenerator::fileBase(const Node* node) const { QString result; result = PageGenerator::fileBase(node); diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index a5346a5..6f99e90 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -231,10 +231,7 @@ class DitaXmlGenerator : public PageGenerator void generateStatus(const Node* node, CodeMarker* marker); QString registerRef(const QString& ref); - QString fileBase(const Node* node); -#if 0 - QString fileBase(const Node* node, const SectionIterator& section); -#endif + QString fileBase(const Node* node) const; QString fileName(const Node* node); void findAllClasses(const InnerNode* node); void findAllFunctions(const InnerNode* node); diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 77e306a..2849325 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -3417,7 +3417,7 @@ QString HtmlGenerator::protect(const QString &string, const QString &outputEncod #undef APPEND } -QString HtmlGenerator::fileBase(const Node *node) +QString HtmlGenerator::fileBase(const Node *node) const { QString result; @@ -3440,7 +3440,7 @@ QString HtmlGenerator::fileBase(const Node *node) #if 0 QString HtmlGenerator::fileBase(const Node *node, - const SectionIterator& section) + const SectionIterator& section) const { QStringList::ConstIterator s = section.sectionNumber().end(); QStringList::ConstIterator b = section.baseNameStack().end(); diff --git a/tools/qdoc3/htmlgenerator.h b/tools/qdoc3/htmlgenerator.h index d885ada..430aca2 100644 --- a/tools/qdoc3/htmlgenerator.h +++ b/tools/qdoc3/htmlgenerator.h @@ -241,9 +241,9 @@ class HtmlGenerator : public PageGenerator void generateStatus(const Node *node, CodeMarker *marker); QString registerRef(const QString& ref); - QString fileBase(const Node *node); + QString fileBase(const Node *node) const; #if 0 - QString fileBase(const Node *node, const SectionIterator& section); + QString fileBase(const Node *node, const SectionIterator& section) const; #endif QString fileName(const Node *node); void findAllClasses(const InnerNode *node); -- cgit v0.12 From 0840b0a1c14093c3dc1cbe16561ae6c8d7096fa9 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Tue, 21 Sep 2010 14:23:11 +0200 Subject: qdoc: YREKA! Now using GUIDs for node href attributes. --- tools/qdoc3/ditaxmlgenerator.cpp | 26 +++++++++++++++++++++----- tools/qdoc3/ditaxmlgenerator.h | 3 ++- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index d25c76c..13d33e8 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -531,6 +531,17 @@ QString DitaXmlGenerator::writeGuidAttribute(QString text) return guid; } + +/*! + Write's the GUID for the \a node to the current XML stream + as an "id" attribute. If the \a node doesn't yet have a GUID, + one is generated. + */ +void DitaXmlGenerator::writeGuidAttribute(Node* node) +{ + xmlWriter().writeAttribute("id",node->guid()); +} + /*! Looks up \a text in the GUID map. If it finds \a text, it returns the associated GUID. Otherwise it inserts @@ -1863,7 +1874,7 @@ void DitaXmlGenerator::generateHeader(const Node* node, const QString& name) outputclass = "example"; break; case Node::HeaderFile: - outputclass = "header"; + outputclass = "headerfile"; break; case Node::File: outputclass = "file"; @@ -3296,6 +3307,8 @@ QString DitaXmlGenerator::registerRef(const QString& ref) } else if (prevRef == ref) break; + else + qDebug() << "PREVREF:" << prevRef; clean += "x"; } return clean; @@ -3470,8 +3483,10 @@ QString DitaXmlGenerator::linkForNode(const Node* node, const Node* relative) return QString(); fn = fileName(node); - link += fn; + link += fn + "#" + node->guid(); + return link; +#if 0 if (!node->isInnerNode() || node->subType() == Node::QmlPropertyGroup) { ref = refForNode(node); if (relative && fn == fileName(relative) && ref == refForNode(relative)) @@ -3481,6 +3496,7 @@ QString DitaXmlGenerator::linkForNode(const Node* node, const Node* relative) link += ref; } return link; +#endif } QString DitaXmlGenerator::refForAtom(Atom* atom, const Node* /* node */) @@ -3517,7 +3533,7 @@ void DitaXmlGenerator::generateFullName(const Node* apparentNode, xmlWriter().writeEndElement(); // } -void DitaXmlGenerator::generateDetailedMember(const Node* node, +void DitaXmlGenerator::generateDetailedMember(Node* node, const InnerNode* relative, CodeMarker* marker) { @@ -3527,7 +3543,7 @@ void DitaXmlGenerator::generateDetailedMember(const Node* node, if ((node->type() == Node::Enum) && (en = static_cast(node))->flagsType()) { xmlWriter().writeStartElement("p"); - writeGuidAttribute(refForNode(node)); + writeGuidAttribute(node); xmlWriter().writeAttribute("outputclass","h3 flags"); marked = getMarkedUpSynopsis(en, relative, marker, CodeMarker::Detailed); writeText(marked, marker, relative); @@ -3538,7 +3554,7 @@ void DitaXmlGenerator::generateDetailedMember(const Node* node, } else { xmlWriter().writeStartElement("p"); - writeGuidAttribute(refForNode(node)); + writeGuidAttribute(node); xmlWriter().writeAttribute("outputclass","h3 fn"); marked = getMarkedUpSynopsis(node, relative, marker, CodeMarker::Detailed); writeText(marked, marker, relative); diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index 6f99e90..6a52441 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -222,7 +222,7 @@ class DitaXmlGenerator : public PageGenerator const Node* relative, CodeMarker* marker, const Node* actualNode = 0); - void generateDetailedMember(const Node* node, + void generateDetailedMember(Node* node, const InnerNode* relative, CodeMarker* marker); void generateLink(const Atom* atom, @@ -256,6 +256,7 @@ class DitaXmlGenerator : public PageGenerator CodeMarker* marker); void endLink(); QString writeGuidAttribute(QString text); + void writeGuidAttribute(Node* node); QString lookupGuid(QString text); virtual void beginSubPage(const Location& location, const QString& fileName); virtual void endSubPage(); -- cgit v0.12 From d10863a6d155f5a57fc30dbaf1229e29eef1ba98 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 22 Sep 2010 10:04:45 +0200 Subject: qdoc: Changed the in the . This is now the first part of the generated documentation for a C++ class rather than the first section of the detailed description. This includes the brief text, the inheritance stuff, the inherited-by stuff, and a few other preamble type texts. --- tools/qdoc3/ditaxmlgenerator.cpp | 134 ++++++++++++++++++++++++++------------- tools/qdoc3/ditaxmlgenerator.h | 12 ++-- 2 files changed, 97 insertions(+), 49 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 13d33e8..3efd98b 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -1443,7 +1443,6 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, void DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* marker) { - QList
    sections; QList
    ::ConstIterator s; const ClassNode* cn = 0; @@ -1487,7 +1486,50 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark writeLocation(cn); xmlWriter().writeEndElement(); // - writeDetailSections(cn, marker, true, QString("Detailed Description")); + xmlWriter().writeStartElement(APIDESC); + xmlWriter().writeAttribute("spectitle",title); + Text brief = cn->doc().briefText(); + if (!brief.isEmpty()) { + xmlWriter().writeStartElement("p"); + generateText(brief, cn, marker); + xmlWriter().writeEndElement(); //

    + } + generateIncludes(cn, marker); + generateStatus(cn, marker); + generateInherits(cn, marker); + generateInheritedBy(cn, marker); + generateThreadSafeness(cn, marker); + generateSince(cn, marker); + + xmlWriter().writeStartElement("ul"); + + QString membersLink = generateListOfAllMemberFile(inner, marker); + if (!membersLink.isEmpty()) { + writeXrefListItem(membersLink,"List of all members, including inherited members"); + } + + QString obsoleteLink = generateLowStatusMemberFile(inner, + marker, + CodeMarker::Obsolete); + if (!obsoleteLink.isEmpty()) { + writeXrefListItem(obsoleteLink,"Obsolete members"); + } + + QString compatLink = generateLowStatusMemberFile(inner, + marker, + CodeMarker::Compat); + if (!compatLink.isEmpty()) { + writeXrefListItem(compatLink,"Qt 3 support members"); + } + + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // + + QList
    summarySections; + summarySections = marker->sections(inner, CodeMarker::Summary, CodeMarker::Okay); + + writeDetailedDescription(cn, marker, false, QString("Detailed Description")); + // zzz writeSections() gores here. // not included: or @@ -1496,9 +1538,10 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark // not included: // not included: - sections = marker->sections(inner, CodeMarker::Detailed, CodeMarker::Okay); - s = sections.begin(); - while (s != sections.end()) { + QList
    detailSections; + detailSections = marker->sections(inner, CodeMarker::Detailed, CodeMarker::Okay); + s = detailSections.begin(); + while (s != detailSections.end()) { if ((*s).name == "Member Function Documentation") { writeFunctions((*s),cn,marker); } @@ -1631,7 +1674,7 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker ++s; } - writeDetailSections(fake, marker, false, QString("Detailed Description")); + writeDetailedDescription(fake, marker, false, QString("Detailed Description")); if (cn) generateQmlText(cn->doc().body(), cn, marker, fake->name()); @@ -1660,10 +1703,10 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker if (!fake->doc().isEmpty()) { xmlWriter().writeStartElement("body"); if (fake->subType() == Node::Module) { - writeDetailSections(fake, marker, false, QString("Detailed Description")); + writeDetailedDescription(fake, marker, false, QString("Detailed Description")); } else - writeDetailSections(fake, marker, false, QString()); + writeDetailedDescription(fake, marker, false, QString()); generateAlsoList(fake, marker); if (!fake->groupMembers().isEmpty()) { @@ -1832,10 +1875,15 @@ void DitaXmlGenerator::generateBreadCrumbs(const QString& title, } /*! - Outputs an XML file header depending on which kind of DITA XML - file is being generated. + Writes an XML file header to the current XML stream. This + depends on which kind of DITA XML file is being generated, + which is determined by the \a node type and subtype and the + \a subpage flag. If the \subpage flag is true, a \c{} + header is written, regardless of the type of \a node. */ -void DitaXmlGenerator::generateHeader(const Node* node, const QString& name) +void DitaXmlGenerator::generateHeader(const Node* node, + const QString& name, + bool subpage) { if (!node) return; @@ -1848,16 +1896,7 @@ void DitaXmlGenerator::generateHeader(const Node* node, const QString& name) QString version; QString outputclass; - if (node->type() == Node::Class) { - mainElement = "cxxClass"; - nameElement = "apiName"; - dtd = "dtd/cxxClass.dtd"; - version = "0.6.0"; - doctype = ""; - } - else if (node->type() == Node::Fake) { + if (node->type() == Node::Fake || subpage) { mainElement = "topic"; nameElement = "title"; dtd = "dtd/topic.dtd"; @@ -1895,6 +1934,15 @@ void DitaXmlGenerator::generateHeader(const Node* node, const QString& name) outputclass = "page"; } } + else if (node->type() == Node::Class) { + mainElement = "cxxClass"; + nameElement = "apiName"; + dtd = "dtd/cxxClass.dtd"; + version = "0.6.0"; + doctype = ""; + } xmlWriter().writeDTD(doctype); xmlWriter().writeComment(node->doc().location().fileName()); @@ -1949,7 +1997,7 @@ void DitaXmlGenerator::generateBrief(const Node* node, CodeMarker* marker) ++noLinks; xmlWriter().writeStartElement(SHORTDESC); generateText(brief, node, marker); - xmlWriter().writeEndElement(); // shortdesc + xmlWriter().writeEndElement(); // --noLinks; } } @@ -2186,7 +2234,7 @@ QString DitaXmlGenerator::generateListOfAllMemberFile(const InnerNode* inner, QString fileName = fileBase(inner) + "-members." + fileExtension(inner); beginSubPage(inner->location(), fileName); QString title = "List of All Members for " + inner->name(); - generateHeader(inner, title); + generateHeader(inner, title, true); xmlWriter().writeStartElement("body"); xmlWriter().writeStartElement("section"); if (!title.isEmpty()) { @@ -2235,7 +2283,7 @@ QString DitaXmlGenerator::generateLowStatusMemberFile(const InnerNode* inner, fileName = fileBase(inner) + "-obsolete." + fileExtension(inner); } beginSubPage(inner->location(), fileName); - generateHeader(inner, title); + generateHeader(inner, title, true); xmlWriter().writeStartElement("body"); xmlWriter().writeStartElement("section"); if (!title.isEmpty()) { @@ -4531,7 +4579,7 @@ void DitaXmlGenerator::writeFunctions(const Section& s, writeLocation(fn); xmlWriter().writeEndElement(); // - writeDetailSections(fn, marker, true, QString()); + writeDetailedDescription(fn, marker, true, QString()); // generateAlsoList(inner, marker); // not included: or @@ -4687,7 +4735,7 @@ void DitaXmlGenerator::writeEnumerations(const Section& s, writeLocation(en); xmlWriter().writeEndElement(); // - writeDetailSections(en, marker, true, QString()); + writeDetailedDescription(en, marker, true, QString()); // not included: or @@ -4747,7 +4795,7 @@ void DitaXmlGenerator::writeTypedefs(const Section& s, writeLocation(tn); xmlWriter().writeEndElement(); // - writeDetailSections(tn, marker, true, QString()); + writeDetailedDescription(tn, marker, true, QString()); // not included: or @@ -4858,7 +4906,7 @@ void DitaXmlGenerator::writeProperties(const Section& s, writeLocation(pn); xmlWriter().writeEndElement(); // - writeDetailSections(pn, marker, true, QString()); + writeDetailedDescription(pn, marker, true, QString()); // not included: or @@ -4940,7 +4988,7 @@ void DitaXmlGenerator::writeDataMembers(const Section& s, writeLocation(vn); xmlWriter().writeEndElement(); // - writeDetailSections(vn, marker, true, QString()); + writeDetailedDescription(vn, marker, true, QString()); // not included: or @@ -5034,7 +5082,7 @@ void DitaXmlGenerator::writeMacros(const Section& s, writeLocation(fn); xmlWriter().writeEndElement(); // - writeDetailSections(fn, marker, true, QString()); + writeDetailedDescription(fn, marker, true, QString()); // not included: or @@ -5110,21 +5158,19 @@ QXmlStreamWriter& DitaXmlGenerator::xmlWriter() } /*! - Writes the \e {Detailed Description} section(s) for \a node - to the current XML stream using the code \a marker. if the - \a apiDesc flag is true, then the first section of the - sequence of sections written will be an \c {apiDesc>} - element with a \e {spectitle} attribute of \e {Detailed - Description}. Otherwise, the first section will be a - \c {
    } element with a \c {} element of - \e {Detailed Description}. This function calls the - Generator::generateBody() function to write the XML for - the section list. + Writes the \e {Detailed Description} section(s) for \a node to the + current XML stream using the code \a marker. if the \a apiDesc flag + is true, then the first section of the sequence of sections written + will be an \c {apiDesc>} element with a \e {spectitle} attribute of + \e {Detailed Description}. Otherwise, the first section will be a + \c {<section>} element with a \c {<title>} element of \e {Detailed + Description}. This function calls the Generator::generateBody() + function to write the XML for the section list. */ -void DitaXmlGenerator::writeDetailSections(const Node* node, - CodeMarker* marker, - bool apiDesc, - const QString& title) +void DitaXmlGenerator::writeDetailedDescription(const Node* node, + CodeMarker* marker, + bool apiDesc, + const QString& title) { if (!node->doc().isEmpty()) { inDetailedDescription = true; diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index 6a52441..5ec4a6c 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -150,7 +150,9 @@ class DitaXmlGenerator : public PageGenerator void generateBreadCrumbs(const QString& title, const Node* node, CodeMarker* marker); - void generateHeader(const Node* node, const QString& name); + void generateHeader(const Node* node, + const QString& name, + bool subpage = false); void generateTitle(const QString& title, const Text& subTitle, SubTitleSize subTitleSize, @@ -261,10 +263,10 @@ class DitaXmlGenerator : public PageGenerator virtual void beginSubPage(const Location& location, const QString& fileName); virtual void endSubPage(); QXmlStreamWriter& xmlWriter(); - void writeDetailSections(const Node* node, - CodeMarker* marker, - bool apiDesc, - const QString& title); + void writeDetailedDescription(const Node* node, + CodeMarker* marker, + bool apiDesc, + const QString& title); void addLink(const QString& href, const QStringRef& text); private: -- cgit v0.12 From 40479a41ce6e51f32c4120f290cbe36b3d7424b0 Mon Sep 17 00:00:00 2001 From: Martin Smith <martin.smith@nokia.com> Date: Wed, 22 Sep 2010 12:57:25 +0200 Subject: qdoc: Added the summary sections to the cxxClass. --- tools/qdoc3/ditaxmlgenerator.cpp | 71 ++++++++++++++++++++++++++++++++++------ 1 file changed, 61 insertions(+), 10 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 3efd98b..02be9fd 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -1525,12 +1525,56 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark xmlWriter().writeEndElement(); // </ul> xmlWriter().writeEndElement(); // </apiDesc> + bool needOtherSection = false; QList<Section> summarySections; summarySections = marker->sections(inner, CodeMarker::Summary, CodeMarker::Okay); - + s = summarySections.begin(); + while (s != summarySections.end()) { + if (s->members.isEmpty() && s->reimpMembers.isEmpty()) { + if (!s->inherited.isEmpty()) + needOtherSection = true; + } + else { + if (!s->members.isEmpty()) { + xmlWriter().writeStartElement("section"); + xmlWriter().writeAttribute("outputclass","h2"); + xmlWriter().writeStartElement("title"); + xmlWriter().writeCharacters(protectEnc((*s).name)); + xmlWriter().writeEndElement(); // + generateSection(s->members, inner, marker, CodeMarker::Summary); + generateSectionInheritedList(*s, inner, marker); + xmlWriter().writeEndElement(); //
    + } + if (!s->reimpMembers.isEmpty()) { + QString name = QString("Reimplemented ") + (*s).name; + xmlWriter().writeStartElement("section"); + xmlWriter().writeAttribute("outputclass","h2"); + xmlWriter().writeStartElement("title"); + xmlWriter().writeCharacters(protectEnc(name)); + xmlWriter().writeEndElement(); // + generateSection(s->reimpMembers, inner, marker, CodeMarker::Summary); + generateSectionInheritedList(*s, inner, marker); + xmlWriter().writeEndElement(); //
    + } + } + ++s; + } + if (needOtherSection) { + xmlWriter().writeStartElement("section"); + xmlWriter().writeAttribute("outputclass","h3"); + xmlWriter().writeStartElement("title"); + xmlWriter().writeCharacters("Additional Inherited Members"); + xmlWriter().writeEndElement(); // + s = summarySections.begin(); + while (s != summarySections.end()) { + if (s->members.isEmpty()) + generateSectionInheritedList(*s, inner, marker); + ++s; + } + } + writeDetailedDescription(cn, marker, false, QString("Detailed Description")); - // zzz writeSections() gores here. // not included: or xmlWriter().writeEndElement(); // @@ -3022,7 +3066,7 @@ void DitaXmlGenerator::generateSection(const NodeList& nl, } /*! - Writes the "inherited from" lists to the current XML stream. + Writes the "inherited from" list to the current XML stream. */ void DitaXmlGenerator::generateSectionInheritedList(const Section& section, const Node* relative, @@ -3031,19 +3075,26 @@ void DitaXmlGenerator::generateSectionInheritedList(const Section& section, if (section.inherited.isEmpty()) return; xmlWriter().writeStartElement("ul"); - QList >::ConstIterator p = section.inherited.begin(); + QList >::ConstIterator p = section.inherited.begin(); while (p != section.inherited.end()) { xmlWriter().writeStartElement("li"); xmlWriter().writeAttribute("outputclass","fn"); - QString text = (*p).second + " "; + QString text; + text.setNum((*p).second); + text += " "; if ((*p).second == 1) text += section.singularMember; else text += section.pluralMember; - text += " inherited from "; - text += protectEnc(marker->plainFullName((*p).first, relative)) + ""; + text += " inherited from "; + xmlWriter().writeCharacters(text); + xmlWriter().writeStartElement("xref"); + text = fileName((*p).first) + "#"; + text += DitaXmlGenerator::cleanRef(section.name.toLower()); + xmlWriter().writeAttribute("href",text); + text = protectEnc(marker->plainFullName((*p).first, relative)); xmlWriter().writeCharacters(text); + xmlWriter().writeEndElement(); // ++p; } xmlWriter().writeEndElement(); // @@ -5177,14 +5228,14 @@ void DitaXmlGenerator::writeDetailedDescription(const Node* node, if (apiDesc) { inApiDesc = true; xmlWriter().writeStartElement(APIDESC); - xmlWriter().writeAttribute("id",node->guid()); + // zzz xmlWriter().writeAttribute("id",node->guid()); if (!title.isEmpty()) xmlWriter().writeAttribute("spectitle",title); } else { inSection = true; xmlWriter().writeStartElement("section"); - xmlWriter().writeAttribute("id",node->guid()); + // zzz xmlWriter().writeAttribute("id",node->guid()); if (!title.isEmpty()) { xmlWriter().writeStartElement("title"); xmlWriter().writeCharacters(title); -- cgit v0.12 From 6cff9860c5390cceee4973fce20798939fae088b Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 22 Sep 2010 13:42:15 +0200 Subject: qdoc: Removed some unused parameters. --- tools/qdoc3/ditaxmlgenerator.cpp | 19 +++++++------------ tools/qdoc3/ditaxmlgenerator.h | 22 ++++++---------------- 2 files changed, 13 insertions(+), 28 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 02be9fd..921fdbc 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -1590,17 +1590,17 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark writeFunctions((*s),cn,marker); } else if ((*s).name == "Member Type Documentation") { - writeEnumerations((*s),cn,marker); - writeTypedefs((*s),cn,marker); + writeEnumerations((*s),marker); + writeTypedefs((*s),marker); } else if ((*s).name == "Member Variable Documentation") { - writeDataMembers((*s),cn,marker); + writeDataMembers((*s),marker); } else if ((*s).name == "Property Documentation") { - writeProperties((*s),cn,marker); + writeProperties((*s),marker); } else if ((*s).name == "Macro Documentation") { - writeMacros((*s),cn,marker); + writeMacros((*s),marker); } ++s; } @@ -4626,7 +4626,7 @@ void DitaXmlGenerator::writeFunctions(const Section& s, xmlWriter().writeCharacters(marker->plainFullName(rfn)); xmlWriter().writeEndElement(); // } - writeParameters(fn,marker); + writeParameters(fn); writeLocation(fn); xmlWriter().writeEndElement(); // @@ -4650,7 +4650,7 @@ void DitaXmlGenerator::writeFunctions(const Section& s, /*! This function writes the element. */ -void DitaXmlGenerator::writeParameters(const FunctionNode* fn, CodeMarker* marker) +void DitaXmlGenerator::writeParameters(const FunctionNode* fn) { const QList& parameters = fn->parameters(); if (!parameters.isEmpty()) { @@ -4688,7 +4688,6 @@ void DitaXmlGenerator::writeParameters(const FunctionNode* fn, CodeMarker* marke This function writes the enum types. */ void DitaXmlGenerator::writeEnumerations(const Section& s, - const ClassNode* cn, CodeMarker* marker) { NodeList::ConstIterator m = s.members.begin(); @@ -4804,7 +4803,6 @@ void DitaXmlGenerator::writeEnumerations(const Section& s, This function writes the output for the \typedef commands. */ void DitaXmlGenerator::writeTypedefs(const Section& s, - const ClassNode* cn, CodeMarker* marker) { NodeList::ConstIterator m = s.members.begin(); @@ -4865,7 +4863,6 @@ void DitaXmlGenerator::writeTypedefs(const Section& s, This is the Q_PROPERTYs. */ void DitaXmlGenerator::writeProperties(const Section& s, - const ClassNode* cn, CodeMarker* marker) { NodeList::ConstIterator m = s.members.begin(); @@ -4975,7 +4972,6 @@ void DitaXmlGenerator::writeProperties(const Section& s, This function outputs the nodes resulting from \variable commands. */ void DitaXmlGenerator::writeDataMembers(const Section& s, - const ClassNode* cn, CodeMarker* marker) { NodeList::ConstIterator m = s.members.begin(); @@ -5057,7 +5053,6 @@ void DitaXmlGenerator::writeDataMembers(const Section& s, This function writes a \macro as a . */ void DitaXmlGenerator::writeMacros(const Section& s, - const ClassNode* cn, CodeMarker* marker) { NodeList::ConstIterator m = s.members.begin(); diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index 5ec4a6c..dd0d56e 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -121,22 +121,12 @@ class DitaXmlGenerator : public PageGenerator void writeFunctions(const Section& s, const ClassNode* cn, CodeMarker* marker); - void writeParameters(const FunctionNode* fn, CodeMarker* marker); - void writeEnumerations(const Section& s, - const ClassNode* cn, - CodeMarker* marker); - void writeTypedefs(const Section& s, - const ClassNode* cn, - CodeMarker* marker); - void writeDataMembers(const Section& s, - const ClassNode* cn, - CodeMarker* marker); - void writeProperties(const Section& s, - const ClassNode* cn, - CodeMarker* marker); - void writeMacros(const Section& s, - const ClassNode* cn, - CodeMarker* marker); + void writeParameters(const FunctionNode* fn); + void writeEnumerations(const Section& s, CodeMarker* marker); + void writeTypedefs(const Section& s, CodeMarker* marker); + void writeDataMembers(const Section& s, CodeMarker* marker); + void writeProperties(const Section& s, CodeMarker* marker); + void writeMacros(const Section& s, CodeMarker* marker); void writePropertyParameter(const QString& tag, const NodeList& nlist); private: -- cgit v0.12 From 4ea898fe70fd7a77a95c87668807f8af8342780b Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 24 Sep 2010 15:30:29 +0200 Subject: qdoc: Corrected many GUIDs. Still more to do here. --- tools/qdoc3/atom.cpp | 1 + tools/qdoc3/atom.h | 1 + tools/qdoc3/ditaxmlgenerator.cpp | 215 +++++++++++++++++++++++++++++---------- tools/qdoc3/ditaxmlgenerator.h | 11 +- tools/qdoc3/pagegenerator.cpp | 17 +++- tools/qdoc3/text.cpp | 4 +- 6 files changed, 189 insertions(+), 60 deletions(-) diff --git a/tools/qdoc3/atom.cpp b/tools/qdoc3/atom.cpp index 6f1602e..d18c3c4 100644 --- a/tools/qdoc3/atom.cpp +++ b/tools/qdoc3/atom.cpp @@ -190,6 +190,7 @@ static const struct { { "FormattingLeft", Atom::FormattingLeft }, { "FormattingRight", Atom::FormattingRight }, { "GeneratedList", Atom::GeneratedList }, + { "GuidLink", Atom::GuidLink}, { "Image", Atom::Image }, { "ImageText", Atom::ImageText }, { "InlineImage", Atom::InlineImage }, diff --git a/tools/qdoc3/atom.h b/tools/qdoc3/atom.h index 70fbae9..13df07b 100644 --- a/tools/qdoc3/atom.h +++ b/tools/qdoc3/atom.h @@ -83,6 +83,7 @@ class Atom FormattingLeft, FormattingRight, GeneratedList, + GuidLink, Image, ImageText, InlineImage, diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 921fdbc..16215cd 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -395,6 +395,7 @@ DitaXmlGenerator::DitaXmlGenerator() noLinks(0), tableColumnCount(0) { + // nothing yet. } /*! @@ -402,7 +403,11 @@ DitaXmlGenerator::DitaXmlGenerator() */ DitaXmlGenerator::~DitaXmlGenerator() { - // nothing yet. + GuidMaps::iterator i = guidMaps.begin(); + while (i != guidMaps.end()) { + delete i.value(); + ++i; + } } /*! @@ -526,7 +531,7 @@ QString DitaXmlGenerator::format() */ QString DitaXmlGenerator::writeGuidAttribute(QString text) { - QString guid = lookupGuid(text); + QString guid = lookupGuid(outFileName(),text); xmlWriter().writeAttribute("id",guid); return guid; } @@ -559,6 +564,41 @@ QString DitaXmlGenerator::lookupGuid(QString text) } /*! + First, look up the GUID map for \a fileName. If there isn't + a GUID map for \a fileName, create one and insert it into + the map of GUID maps. Then look up \a text in that GUID map. + If \a text is found, return the associated GUID. Otherwise, + insert \a text into the GUID map with a new GUID, and return + the new GUID. + */ +QString DitaXmlGenerator::lookupGuid(const QString& fileName, const QString& text) +{ + GuidMap* gm = lookupGuidMap(fileName); + GuidMap::const_iterator i = gm->find(text); + if (i != gm->end()) + return i.value(); + QString guid = QUuid::createUuid().toString(); + gm->insert(text,guid); + return guid; +} + +/*! + Looks up \a fileName in the map of GUID maps. If it finds + \a fileName, it returns a pointer to the associated GUID + map. Otherwise it creates a new GUID map and inserts it + into the map of GUID maps with \a fileName as its key. + */ +GuidMap* DitaXmlGenerator::lookupGuidMap(const QString& fileName) +{ + GuidMaps::const_iterator i = guidMaps.find(fileName); + if (i != guidMaps.end()) + return i.value(); + GuidMap* gm = new GuidMap; + guidMaps.insert(fileName,gm); + return gm; +} + +/*! This is where the DITA XML files are written. \note The file generation is done in the base class, PageGenerator::generateTree(). @@ -688,10 +728,13 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, xmlWriter().writeEndElement(); // sse writeStartElement() above break; case Atom::Code: - xmlWriter().writeStartElement("pre"); - xmlWriter().writeAttribute("outputclass","highlightedcode"); - writeText(trimmedTrailing(atom->string()), marker, relative); - xmlWriter().writeEndElement(); // + { + xmlWriter().writeStartElement("pre"); + xmlWriter().writeAttribute("outputclass","highlightedcode"); + QString chars = trimmedTrailing(atom->string()); + writeText(chars, marker, relative); + xmlWriter().writeEndElement(); // + } break; case Atom::Qml: xmlWriter().writeStartElement("pre"); @@ -1060,14 +1103,27 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, const Node *node = 0; QString myLink = getLink(atom, relative, marker, &node); if (myLink.isEmpty()) { - relative->doc().location().warning(tr("Cannot link to '%1' in %2") + relative->doc().location().warning(tr("Can't link to '%1' in %2") .arg(atom->string()) .arg(marker->plainFullName(relative))); } +#if 0 + else + qDebug() << "MYLINK:" << myLink << outFileName();; +#endif beginLink(myLink, node, relative, marker); skipAhead = 1; } break; + case Atom::GuidLink: + { +#if 0 + qDebug() << "GUID LINK:" << atom->string() << outFileName(); +#endif + beginLink(atom->string(), 0, relative, marker); + skipAhead = 1; + } + break; case Atom::LinkNode: { const Node *node = CodeMarker::nodeForString(atom->string()); @@ -3089,12 +3145,14 @@ void DitaXmlGenerator::generateSectionInheritedList(const Section& section, text += " inherited from "; xmlWriter().writeCharacters(text); xmlWriter().writeStartElement("xref"); + // zzz text = fileName((*p).first) + "#"; text += DitaXmlGenerator::cleanRef(section.name.toLower()); xmlWriter().writeAttribute("href",text); text = protectEnc(marker->plainFullName((*p).first, relative)); xmlWriter().writeCharacters(text); xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // ++p; } xmlWriter().writeEndElement(); // @@ -3406,8 +3464,10 @@ QString DitaXmlGenerator::registerRef(const QString& ref) } else if (prevRef == ref) break; +#if 0 else qDebug() << "PREVREF:" << prevRef; +#endif clean += "x"; } return clean; @@ -3492,28 +3552,10 @@ QString DitaXmlGenerator::fileBase(const Node* node) const return result; } -/*! - Constructs a file name appropriate for the \a node - and returns the file name. If the \a node is not a - fake node, or if it is a fake node but it is neither - an external page node nor an image node, call the - PageGenerator::fileName() function. - */ -QString DitaXmlGenerator::fileName(const Node* node) -{ - if (node->type() == Node::Fake) { - if (static_cast(node)->subType() == Node::ExternalPage) - return node->name(); - if (static_cast(node)->subType() == Node::Image) - return node->name(); - } - return PageGenerator::fileName(node); -} - QString DitaXmlGenerator::refForNode(const Node* node) { const FunctionNode* func; - const TypedefNode* typedeffe; + const TypedefNode* tdn; QString ref; switch (node->type()) { @@ -3525,9 +3567,9 @@ QString DitaXmlGenerator::refForNode(const Node* node) ref = node->name() + "-enum"; break; case Node::Typedef: - typedeffe = static_cast(node); - if (typedeffe->associatedEnum()) { - return refForNode(typedeffe->associatedEnum()); + tdn = static_cast(node); + if (tdn->associatedEnum()) { + return refForNode(tdn->associatedEnum()); } else { ref = node->name() + "-typedef"; @@ -3566,12 +3608,77 @@ QString DitaXmlGenerator::refForNode(const Node* node) return registerRef(ref); } -QString DitaXmlGenerator::linkForNode(const Node* node, const Node* relative) +QString DitaXmlGenerator::guidForNode(const Node* node) { - QString link; - QString fn; QString ref; + switch (node->type()) { + case Node::Namespace: + case Node::Class: + default: + break; + case Node::Enum: + return node->guid(); + case Node::Typedef: + { + const TypedefNode* tdn = static_cast(node); + if (tdn->associatedEnum()) + return guidForNode(tdn->associatedEnum()); + } + return node->guid(); + case Node::Function: + { + const FunctionNode* fn = static_cast(node); + if (fn->associatedProperty()) { + return guidForNode(fn->associatedProperty()); + } + else { + ref = fn->name(); + if (fn->overloadNumber() != 1) { + ref += "-" + QString::number(fn->overloadNumber()); +#if 0 + qDebug() << "guidForNode() overloaded function:" << ref; +#endif + } + } + } + case Node::Fake: + if (node->subType() != Node::QmlPropertyGroup) + break; + case Node::QmlProperty: + case Node::Property: + return node->guid(); + case Node::QmlSignal: + return node->guid(); + case Node::QmlMethod: + return node->guid(); + case Node::Variable: + return node->guid(); + case Node::Target: + return node->guid(); + } + return registerRef(ref); +} + +/*! + Constructs a file name appropriate for the \a node and returns + it. If the \a node is not a fake node, or if it is a fake node but + it is neither an external page node nor an image node, call the + PageGenerator::fileName() function. + */ +QString DitaXmlGenerator::fileName(const Node* node) +{ + if (node->type() == Node::Fake) { + if (static_cast(node)->subType() == Node::ExternalPage) + return node->name(); + if (static_cast(node)->subType() == Node::Image) + return node->name(); + } + return PageGenerator::fileName(node); +} + +QString DitaXmlGenerator::linkForNode(const Node* node, const Node* relative) +{ if (node == 0 || node == relative) return QString(); if (!node->url().isEmpty()) @@ -3581,21 +3688,18 @@ QString DitaXmlGenerator::linkForNode(const Node* node, const Node* relative) if (node->access() == Node::Private) return QString(); - fn = fileName(node); - link += fn + "#" + node->guid(); - return link; + QString fn = fileName(node); + QString link = fn; -#if 0 if (!node->isInnerNode() || node->subType() == Node::QmlPropertyGroup) { - ref = refForNode(node); - if (relative && fn == fileName(relative) && ref == refForNode(relative)) + QString guid = guidForNode(node); + if (relative && fn == fileName(relative) && guid == guidForNode(relative)) { return QString(); - + } link += "#"; - link += ref; + link += guid; } return link; -#endif } QString DitaXmlGenerator::refForAtom(Atom* atom, const Node* /* node */) @@ -3983,26 +4087,33 @@ QString DitaXmlGenerator::getLink(const Atom* atom, Atom* targetAtom = 0; QString first = path.first().trimmed(); - if (first.isEmpty()) + if (first.isEmpty()) { *node = relative; - else if (first.endsWith(".html")) + } + else if (first.endsWith(".html")) { *node = myTree->root()->findNode(first, Node::Fake); + } else { *node = marker->resolveTarget(first, myTree, relative); - if (!*node) + if (!*node) { *node = myTree->findFakeNodeByTitle(first); - if (!*node) + } + if (!*node) { *node = myTree->findUnambiguousTarget(first, targetAtom); + } } if (*node) { - if (!(*node)->url().isEmpty()) + if (!(*node)->url().isEmpty()) { return (*node)->url(); - else + } + else { path.removeFirst(); + } } - else + else { *node = relative; + } if (*node && (*node)->status() == Node::Obsolete) { if (relative && (relative->parent() != *node) && @@ -4075,13 +4186,13 @@ void DitaXmlGenerator::generateStatus(const Node* node, CodeMarker* marker) Atom *targetAtom = 0; if (fakeNode && node->type() == Node::Class) { QString oldName(node->name()); - targetAtom = myTree->findTarget(oldName.replace("3", ""), - fakeNode); + targetAtom = myTree->findTarget(oldName.replace("3",""),fakeNode); } if (targetAtom) { - text << Atom(Atom::Link, linkForNode(fakeNode, node) + "#" + - refForAtom(targetAtom, fakeNode)); + QString fn = fileName(fakeNode); + QString guid = lookupGuid(fn,refForAtom(targetAtom,fakeNode)); + text << Atom(Atom::GuidLink, fn + "#" + guid); } else text << Atom(Atom::Link, "Porting to Qt 4"); diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index dd0d56e..f781290 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -39,10 +39,6 @@ ** ****************************************************************************/ -/* - ditaxmlgenerator.h -*/ - #ifndef DITAXMLGENERATOR_H #define DITAXMLGENERATOR_H @@ -61,7 +57,8 @@ typedef QMap ParentMaps; typedef QMap NodeMap; typedef QMap NewClassMaps; -class HelpProjectWriter; +typedef QMap GuidMap; +typedef QMap GuidMaps; class DitaXmlGenerator : public PageGenerator { @@ -107,6 +104,7 @@ class DitaXmlGenerator : public PageGenerator virtual void generateFakeNode(const FakeNode* fake, CodeMarker* marker); virtual QString fileExtension(const Node* node) const; virtual QString refForNode(const Node* node); + virtual QString guidForNode(const Node* node); virtual QString linkForNode(const Node* node, const Node* relative); virtual QString refForAtom(Atom* atom, const Node* node); @@ -250,6 +248,8 @@ class DitaXmlGenerator : public PageGenerator QString writeGuidAttribute(QString text); void writeGuidAttribute(Node* node); QString lookupGuid(QString text); + QString lookupGuid(const QString& fileName, const QString& text); + GuidMap* lookupGuidMap(const QString& fileName); virtual void beginSubPage(const Location& location, const QString& fileName); virtual void endSubPage(); QXmlStreamWriter& xmlWriter(); @@ -262,6 +262,7 @@ class DitaXmlGenerator : public PageGenerator private: QMap refMap; QMap name2guidMap; + GuidMaps guidMaps; int codeIndent; bool inLink; bool inObsoleteLink; diff --git a/tools/qdoc3/pagegenerator.cpp b/tools/qdoc3/pagegenerator.cpp index 39ee98b..f4c471c 100644 --- a/tools/qdoc3/pagegenerator.cpp +++ b/tools/qdoc3/pagegenerator.cpp @@ -257,7 +257,12 @@ QString PageGenerator::fileBase(const Node *node) const return res; } -QString PageGenerator::fileName(const Node *node) const +/*! + If the \a node has a URL, return the URL as the file name. + Otherwise, construct the file name from the fileBase() and + the fileExtension(), and return the constructed name. + */ +QString PageGenerator::fileName(const Node* node) const { if (!node->url().isEmpty()) return node->url(); @@ -268,9 +273,12 @@ QString PageGenerator::fileName(const Node *node) const return name; } +/*! + Return the current output file name. + */ QString PageGenerator::outFileName() { - return QFileInfo(static_cast(out().device())->fileName()).fileName(); + return QFileInfo(static_cast(out().device())->fileName()).fileName(); } /*! @@ -302,6 +310,11 @@ void PageGenerator::endSubPage() delete outStreamStack.pop(); } +/*! + Used for writing to the current output stream. Returns a + reference to the crrent output stream, which is then used + with the \c {<<} operator for writing. + */ QTextStream &PageGenerator::out() { return *outStreamStack.top(); diff --git a/tools/qdoc3/text.cpp b/tools/qdoc3/text.cpp index 7093a43..11d7edd 100644 --- a/tools/qdoc3/text.cpp +++ b/tools/qdoc3/text.cpp @@ -144,7 +144,9 @@ QString Text::toString() const QString str; const Atom *atom = firstAtom(); while ( atom != 0 ) { - if ( atom->type() == Atom::String || atom->type() == Atom::AutoLink ) + if ( atom->type() == Atom::String || + atom->type() == Atom::AutoLink || + atom->type() == Atom::GuidLink) str += atom->string(); atom = atom->next(); } -- cgit v0.12 From 7d61e1d6d32d93fa5a023caade59f3af4923f2e8 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 27 Sep 2010 12:13:16 +0200 Subject: qdoc: Corrected output for the AutoLink case. Now many more elements are generated correctly. --- tools/qdoc3/ditaxmlgenerator.cpp | 26 +++++++++++++------------- tools/qdoc3/ditaxmlgenerator.h | 2 +- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 16215cd..9652f48 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -392,7 +392,7 @@ DitaXmlGenerator::DitaXmlGenerator() myTree(0), slow(false), obsoleteLinks(false), - noLinks(0), + noLinks(false), tableColumnCount(0) { // nothing yet. @@ -656,7 +656,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, case Atom::AbstractRight: break; case Atom::AutoLink: - if ((noLinks > 0) && !inLink && !inContents && !inSectionHeading) { + if (!noLinks && !inLink && !inContents && !inSectionHeading) { const Node* node = 0; QString link = getLink(atom, relative, marker, &node); if (!link.isEmpty()) { @@ -681,8 +681,10 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, } if (inApiDesc) xmlWriter().writeStartElement("p"); - else + else { + noLinks = true; xmlWriter().writeStartElement(SHORTDESC); + } if (relative->type() == Node::Property || relative->type() == Node::Variable) { QString str; @@ -715,6 +717,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, case Atom::BriefRight: if (relative->type() != Node::Fake) { xmlWriter().writeEndElement(); // or

    + noLinks = false; } break; case Atom::C: @@ -1126,7 +1129,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, break; case Atom::LinkNode: { - const Node *node = CodeMarker::nodeForString(atom->string()); + const Node* node = CodeMarker::nodeForString(atom->string()); beginLink(linkForNode(node, relative), node, relative, marker); skipAhead = 1; } @@ -2094,11 +2097,11 @@ void DitaXmlGenerator::generateBrief(const Node* node, CodeMarker* marker) { Text brief = node->doc().briefText(); if (!brief.isEmpty()) { - ++noLinks; + noLinks = true; xmlWriter().writeStartElement(SHORTDESC); generateText(brief, node, marker); xmlWriter().writeEndElement(); // - --noLinks; + noLinks = false; } } @@ -3610,8 +3613,6 @@ QString DitaXmlGenerator::refForNode(const Node* node) QString DitaXmlGenerator::guidForNode(const Node* node) { - QString ref; - switch (node->type()) { case Node::Namespace: case Node::Class: @@ -3633,14 +3634,13 @@ QString DitaXmlGenerator::guidForNode(const Node* node) return guidForNode(fn->associatedProperty()); } else { - ref = fn->name(); + QString ref = fn->name(); if (fn->overloadNumber() != 1) { ref += "-" + QString::number(fn->overloadNumber()); -#if 0 - qDebug() << "guidForNode() overloaded function:" << ref; -#endif + //qDebug() << "guidForNode() overloaded function:" << outFileName() << ref; } } + return fn->guid(); } case Node::Fake: if (node->subType() != Node::QmlPropertyGroup) @@ -3657,7 +3657,7 @@ QString DitaXmlGenerator::guidForNode(const Node* node) case Node::Target: return node->guid(); } - return registerRef(ref); + return QString(); } /*! diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index f781290..484ff2f 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -291,7 +291,7 @@ class DitaXmlGenerator : public PageGenerator const Tree* myTree; bool slow; bool obsoleteLinks; - int noLinks; + bool noLinks; int tableColumnCount; QMap moduleClassMap; QMap moduleNamespaceMap; -- cgit v0.12 From 6461147a04f7c230c000d2de8fbbbe336b0f8345 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 27 Sep 2010 15:00:42 +0200 Subject: qdoc: Added outputclass attribute for class summary sections. --- tools/qdoc3/ditaxmlgenerator.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 9652f48..ce140af 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -1594,9 +1594,11 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark needOtherSection = true; } else { + QString attr; if (!s->members.isEmpty()) { xmlWriter().writeStartElement("section"); - xmlWriter().writeAttribute("outputclass","h2"); + attr = "h2 " + cleanRef((*s).name).toLower(); + xmlWriter().writeAttribute("outputclass",attr); xmlWriter().writeStartElement("title"); xmlWriter().writeCharacters(protectEnc((*s).name)); xmlWriter().writeEndElement(); // @@ -1606,8 +1608,9 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark } if (!s->reimpMembers.isEmpty()) { QString name = QString("Reimplemented ") + (*s).name; + attr = "h2 " + cleanRef(name).toLower(); xmlWriter().writeStartElement("section"); - xmlWriter().writeAttribute("outputclass","h2"); + xmlWriter().writeAttribute("outputclass",attr); xmlWriter().writeStartElement("title"); xmlWriter().writeCharacters(protectEnc(name)); xmlWriter().writeEndElement(); // @@ -1620,7 +1623,7 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark } if (needOtherSection) { xmlWriter().writeStartElement("section"); - xmlWriter().writeAttribute("outputclass","h3"); + xmlWriter().writeAttribute("outputclass","h3 additional-inherited-members"); xmlWriter().writeStartElement("title"); xmlWriter().writeCharacters("Additional Inherited Members"); xmlWriter().writeEndElement(); // -- cgit v0.12 From 0385fc6ae80a324feb8e8c19e015e4a485bb56d1 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 29 Sep 2010 11:52:03 +0200 Subject: qdoc: Added outputclass attribute for sections and titles. --- tools/qdoc3/ditaxmlgenerator.cpp | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index ce140af..c3b6fab 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -1312,6 +1312,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, inSection = true; xmlWriter().writeStartElement("section"); writeGuidAttribute(Doc::canonicalTitle(Text::sectionHeading(atom).toString())); + xmlWriter().writeAttribute("outputclass","details"); break; case Atom::SectionRight: if (inSection) { @@ -1597,9 +1598,10 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark QString attr; if (!s->members.isEmpty()) { xmlWriter().writeStartElement("section"); - attr = "h2 " + cleanRef((*s).name).toLower(); + attr = cleanRef((*s).name).toLower() + " redundant"; xmlWriter().writeAttribute("outputclass",attr); xmlWriter().writeStartElement("title"); + xmlWriter().writeAttribute("outputclass","h2"); xmlWriter().writeCharacters(protectEnc((*s).name)); xmlWriter().writeEndElement(); // generateSection(s->members, inner, marker, CodeMarker::Summary); @@ -1608,10 +1610,11 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark } if (!s->reimpMembers.isEmpty()) { QString name = QString("Reimplemented ") + (*s).name; - attr = "h2 " + cleanRef(name).toLower(); + attr = cleanRef(name).toLower() + " redundant"; xmlWriter().writeStartElement("section"); xmlWriter().writeAttribute("outputclass",attr); xmlWriter().writeStartElement("title"); + xmlWriter().writeAttribute("outputclass","h2"); xmlWriter().writeCharacters(protectEnc(name)); xmlWriter().writeEndElement(); // generateSection(s->reimpMembers, inner, marker, CodeMarker::Summary); @@ -1623,8 +1626,9 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark } if (needOtherSection) { xmlWriter().writeStartElement("section"); - xmlWriter().writeAttribute("outputclass","h3 additional-inherited-members"); + xmlWriter().writeAttribute("outputclass","additional-inherited-members redundant"); xmlWriter().writeStartElement("title"); + xmlWriter().writeAttribute("outputclass","h3"); xmlWriter().writeCharacters("Additional Inherited Members"); xmlWriter().writeEndElement(); // s = summarySections.begin(); @@ -2430,8 +2434,8 @@ QString DitaXmlGenerator::generateLowStatusMemberFile(const InnerNode* inner, for (i = 0; i < sections.size(); ++i) { xmlWriter().writeStartElement("section"); - xmlWriter().writeAttribute("outputclass","h2"); xmlWriter().writeStartElement("title"); + xmlWriter().writeAttribute("outputclass","h2"); xmlWriter().writeCharacters(protectEnc(sections.at(i).name)); xmlWriter().writeEndElement(); // generateSection(sections.at(i).members, inner, marker, CodeMarker::Summary); @@ -5337,19 +5341,29 @@ void DitaXmlGenerator::writeDetailedDescription(const Node* node, if (apiDesc) { inApiDesc = true; xmlWriter().writeStartElement(APIDESC); - // zzz xmlWriter().writeAttribute("id",node->guid()); - if (!title.isEmpty()) + if (!title.isEmpty()) { + writeGuidAttribute(title); xmlWriter().writeAttribute("spectitle",title); + } + else + writeGuidAttribute("Detailed Description"); + xmlWriter().writeAttribute("outputclass","details"); } else { inSection = true; xmlWriter().writeStartElement("section"); - // zzz xmlWriter().writeAttribute("id",node->guid()); if (!title.isEmpty()) { + writeGuidAttribute(title); + xmlWriter().writeAttribute("outputclass","details"); xmlWriter().writeStartElement("title"); + xmlWriter().writeAttribute("outputclass","h2"); xmlWriter().writeCharacters(title); xmlWriter().writeEndElement(); // } + else { + writeGuidAttribute("Detailed Description"); + xmlWriter().writeAttribute("outputclass","details"); + } } generateBody(node, marker); if (inApiDesc) { -- cgit v0.12 From 03ac8b6a7bfc0ef819cf2155e338252ca9fb77af Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Thu, 30 Sep 2010 12:13:57 +0200 Subject: qdoc: Added missing
    ; added "span" infor temporarily. There is an empty
    at the start of some xml files generated from qdoc files, but I don't think I can get rid of it. --- src/gui/widgets/qscrollbar.cpp | 39 +++++++++++++++---------------- tools/qdoc3/ditaxmlgenerator.cpp | 50 +++++++++++++++++++++++++--------------- 2 files changed, 51 insertions(+), 38 deletions(-) diff --git a/src/gui/widgets/qscrollbar.cpp b/src/gui/widgets/qscrollbar.cpp index 4ee9f27..a07e2cb 100644 --- a/src/gui/widgets/qscrollbar.cpp +++ b/src/gui/widgets/qscrollbar.cpp @@ -82,21 +82,21 @@ QT_BEGIN_NAMESPACE needs. \table - \row \i \image qscrollbar-picture.png - \i Scroll bars typically include four separate controls: a slider, + \row \o \image qscrollbar-picture.png + \o Scroll bars typically include four separate controls: a slider, scroll arrows, and a page control. \list - \i a. The slider provides a way to quickly go to any part of the + \o a. The slider provides a way to quickly go to any part of the document, but does not support accurate navigation within large documents. - \i b. The scroll arrows are push buttons which can be used to accurately + \o b. The scroll arrows are push buttons which can be used to accurately navigate to a particular place in a document. For a vertical scroll bar connected to a text editor, these typically move the current position one "line" up or down, and adjust the position of the slider by a small amount. In editors and list boxes a "line" might mean one line of text; in an image viewer it might mean 20 pixels. - \i c. The page control is the area over which the slider is dragged (the + \o c. The page control is the area over which the slider is dragged (the scroll bar's background). Clicking here moves the scroll bar towards the click by one "page". This value is usually the same as the length of the slider. @@ -134,13 +134,12 @@ QT_BEGIN_NAMESPACE value of 80. This would give us a scroll bar with five "pages". \table - \row \i \inlineimage qscrollbar-values.png - \i The relationship between a document length, the range of values used + \row \o \inlineimage qscrollbar-values.png + \o The relationship between a document length, the range of values used in a scroll bar, and the page step is simple in many common situations. The scroll bar's range of values is determined by subtracting a chosen page step from some value representing the length of the document. In such cases, the following equation is useful: - \e{document length} = maximum() - minimum() + pageStep(). \endtable @@ -153,18 +152,18 @@ QT_BEGIN_NAMESPACE ScrollBar inherits a comprehensive set of signals from QAbstractSlider: \list - \i \l{QAbstractSlider::valueChanged()}{valueChanged()} is emitted when the + \o \l{QAbstractSlider::valueChanged()}{valueChanged()} is emitted when the scroll bar's value has changed. The tracking() determines whether this signal is emitted during user interaction. - \i \l{QAbstractSlider::rangeChanged()}{rangeChanged()} is emitted when the + \o \l{QAbstractSlider::rangeChanged()}{rangeChanged()} is emitted when the scroll bar's range of values has changed. - \i \l{QAbstractSlider::sliderPressed()}{sliderPressed()} is emitted when + \o \l{QAbstractSlider::sliderPressed()}{sliderPressed()} is emitted when the user starts to drag the slider. - \i \l{QAbstractSlider::sliderMoved()}{sliderMoved()} is emitted when the user + \o \l{QAbstractSlider::sliderMoved()}{sliderMoved()} is emitted when the user drags the slider. - \i \l{QAbstractSlider::sliderReleased()}{sliderReleased()} is emitted when + \o \l{QAbstractSlider::sliderReleased()}{sliderReleased()} is emitted when the user releases the slider. - \i \l{QAbstractSlider::actionTriggered()}{actionTriggered()} is emitted + \o \l{QAbstractSlider::actionTriggered()}{actionTriggered()} is emitted when the scroll bar is changed by user interaction or via the \l{QAbstractSlider::triggerAction()}{triggerAction()} function. \endlist @@ -173,12 +172,12 @@ QT_BEGIN_NAMESPACE default focusPolicy() of Qt::NoFocus. Use setFocusPolicy() to enable keyboard interaction with the scroll bar: \list - \i Left/Right move a horizontal scroll bar by one single step. - \i Up/Down move a vertical scroll bar by one single step. - \i PageUp moves up one page. - \i PageDown moves down one page. - \i Home moves to the start (mininum). - \i End moves to the end (maximum). + \o Left/Right move a horizontal scroll bar by one single step. + \o Up/Down move a vertical scroll bar by one single step. + \o PageUp moves up one page. + \o PageDown moves down one page. + \o Home moves to the start (mininum). + \o End moves to the end (maximum). \endlist The slider itself can be controlled by using the diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index c3b6fab..2ee7a45 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -679,7 +679,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, skipAhead = skipAtoms(atom, Atom::BriefRight); break; } - if (inApiDesc) + if (inApiDesc || inSection) xmlWriter().writeStartElement("p"); else { noLinks = true; @@ -1358,27 +1358,37 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, tableColumnCount = 0; } const Atom* t = atom->next(); - while ((t->type() != Atom::TableHeaderRight) && - (t->type() != Atom::TableRowRight) && - (t->type() != Atom::TableRight)) { - if (t->type() == Atom::TableItemLeft) - ++tableColumnCount; + while (t->type() == Atom::TableHeaderLeft) { + int count = 0; + t = t->next(); + while (t->type() != Atom::TableHeaderRight) { + if (t->type() == Atom::TableItemLeft) + ++count; + t = t->next(); + } + if (count > tableColumnCount) + tableColumnCount = count; t = t->next(); } xmlWriter().writeStartElement("tgroup"); xmlWriter().writeAttribute("cols",QString::number(tableColumnCount)); + inTableHeader = false; + inTableBody = false; } break; case Atom::TableRight: xmlWriter().writeEndElement(); // xmlWriter().writeEndElement(); // xmlWriter().writeEndElement(); // + inTableHeader = false; + inTableBody = false; tableColumnCount = 0; break; case Atom::TableHeaderLeft: xmlWriter().writeStartElement("thead"); + xmlWriter().writeAttribute("valign","top"); xmlWriter().writeStartElement("row"); - xmlWriter().writeAttribute("outputclass","qt-style topAlign"); + xmlWriter().writeAttribute("valign","top"); inTableHeader = true; inTableBody = false; break; @@ -1387,7 +1397,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, if (matchAhead(atom, Atom::TableHeaderLeft)) { skipAhead = 1; xmlWriter().writeStartElement("row"); - xmlWriter().writeAttribute("outputclass","qt-style topAlign"); + xmlWriter().writeAttribute("valign","top"); } else { xmlWriter().writeEndElement(); // @@ -1402,25 +1412,28 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, xmlWriter().writeStartElement("tbody"); } xmlWriter().writeStartElement("row"); + xmlWriter().writeAttribute("valign","top"); if (++numTableRows % 2 == 1) - xmlWriter().writeAttribute("outputclass","odd topAlign"); + xmlWriter().writeAttribute("outputclass","odd"); else - xmlWriter().writeAttribute("outputclass","even topAlign"); + xmlWriter().writeAttribute("outputclass","even"); break; case Atom::TableRowRight: - xmlWriter().writeEndElement(); // \n"; + xmlWriter().writeEndElement(); // break; case Atom::TableItemLeft: { - if (inTableHeader) - xmlWriter().writeStartElement("entry"); - else - xmlWriter().writeStartElement("entry"); - + xmlWriter().writeStartElement("entry"); QStringList spans = atom->string().split(","); if (spans.size() == 2) { + if (inTableHeader || + (spans[0].toInt() != 1) || + (spans[1].toInt() != 1)) { + QString s = "span(" + spans[0] + "," + spans[1] + ")"; + xmlWriter().writeAttribute("outputclass",s); + } if (!inTableHeader) - xmlWriter().writeStartElement("p"); + xmlWriter().writeStartElement("p"); } if (matchAhead(atom, Atom::ParaLeft)) skipAhead = 1; @@ -1439,7 +1452,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, case Atom::TableOfContents: { int numColumns = 1; - const Node *node = relative; + const Node* node = relative; Doc::SectioningUnit sectioningUnit = Doc::Section4; QStringList params = atom->string().split(","); @@ -1637,6 +1650,7 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark generateSectionInheritedList(*s, inner, marker); ++s; } + xmlWriter().writeEndElement(); //
    } writeDetailedDescription(cn, marker, false, QString("Detailed Description")); -- cgit v0.12 From c0608b2ca1468e1bb1ba6eec835118b459240cc5 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 1 Oct 2010 15:02:00 +0200 Subject: qdoc: More complete QML elements. Still missing some links for QML basic types. --- tools/qdoc3/ditaxmlgenerator.cpp | 158 ++++++++++++++++++++------------------- 1 file changed, 82 insertions(+), 76 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 2ee7a45..0291054 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -638,6 +638,33 @@ void DitaXmlGenerator::startText(const Node* /* relative */, sectionNumber.clear(); } +static int countTableColumns(const Atom* t) +{ + int result = 0; + if (t->type() == Atom::TableHeaderLeft) { + while (t->type() == Atom::TableHeaderLeft) { + int count = 0; + t = t->next(); + while (t->type() != Atom::TableHeaderRight) { + if (t->type() == Atom::TableItemLeft) + ++count; + t = t->next(); + } + if (count > result) + result = count; + t = t->next(); + } + } + else if (t->type() == Atom::TableRowLeft) { + while (t->type() != Atom::TableRowRight) { + if (t->type() == Atom::TableItemLeft) + ++result; + t = t->next(); + } + } + return result; +} + /*! Generate html from an instance of Atom. */ @@ -1357,19 +1384,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, qDebug() << "ERROR: Nested tables!"; tableColumnCount = 0; } - const Atom* t = atom->next(); - while (t->type() == Atom::TableHeaderLeft) { - int count = 0; - t = t->next(); - while (t->type() != Atom::TableHeaderRight) { - if (t->type() == Atom::TableItemLeft) - ++count; - t = t->next(); - } - if (count > tableColumnCount) - tableColumnCount = count; - t = t->next(); - } + tableColumnCount = countTableColumns(atom->next()); xmlWriter().writeStartElement("tgroup"); xmlWriter().writeAttribute("cols",QString::number(tableColumnCount)); inTableHeader = false; @@ -1793,8 +1808,15 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker sections = marker->qmlSections(qml_cn,CodeMarker::Summary,0); s = sections.begin(); while (s != sections.end()) { - writeTargetAndHeader((*s).name,protectEnc((*s).name),"h2"); + xmlWriter().writeStartElement("section"); + QString attr = cleanRef((*s).name).toLower(); + xmlWriter().writeAttribute("outputclass",attr); + xmlWriter().writeStartElement("title"); + xmlWriter().writeAttribute("outputclass","h2"); + xmlWriter().writeCharacters(protectEnc((*s).name)); + xmlWriter().writeEndElement(); // generateQmlSummary(*s,fake,marker); + xmlWriter().writeEndElement(); //
    ++s; } @@ -1809,15 +1831,21 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker sections = marker->qmlSections(qml_cn,CodeMarker::Detailed,0); s = sections.begin(); while (s != sections.end()) { - xmlWriter().writeStartElement("p"); - xmlWriter().writeAttribute("outputclass","h2"); - xmlWriter().writeCharacters(protectEnc((*s).name)); - xmlWriter().writeEndElement(); //

    - NodeList::ConstIterator m = (*s).members.begin(); - while (m != (*s).members.end()) { - generateDetailedQmlMember(*m, fake, marker); - //out() << "
    \n"; - ++m; + if (!s->members.isEmpty()) { + QString attr; + xmlWriter().writeStartElement("section"); + attr = cleanRef((*s).name).toLower(); + xmlWriter().writeAttribute("outputclass",attr); + xmlWriter().writeStartElement("title"); + xmlWriter().writeAttribute("outputclass","h2"); + xmlWriter().writeCharacters(protectEnc((*s).name)); + xmlWriter().writeEndElement(); // + NodeList::ConstIterator m = (*s).members.begin(); + while (m != (*s).members.end()) { + generateDetailedQmlMember(*m, fake, marker); + ++m; + } + xmlWriter().writeEndElement(); //
    } ++s; } @@ -3317,7 +3345,7 @@ void DitaXmlGenerator::writeText(const QString& markedCode, } xmlWriter().writeEndElement(); // xmlWriter().writeStartElement("entry"); - xmlWriter().writeAttribute("outputclass=","memItemRight bottomAlign"); + xmlWriter().writeAttribute("outputclass","memItemRight bottomAlign"); done = true; } i += 2; @@ -4324,81 +4352,59 @@ void DitaXmlGenerator::generateDetailedQmlMember(const Node* node, CodeMarker* marker) { QString marked; - const QmlPropertyNode* qpn = 0; - out() << "
    "; + QmlPropertyNode* qpn = 0; if (node->subType() == Node::QmlPropertyGroup) { const QmlPropGroupNode* qpgn = static_cast(node); NodeList::ConstIterator p = qpgn->childNodes().begin(); - out() << "
    "; - out() << ""; - + xmlWriter().writeStartElement("ul"); while (p != qpgn->childNodes().end()) { if ((*p)->type() == Node::QmlProperty) { qpn = static_cast(*p); - - if (++numTableRows % 2 == 1) - out() << ""; - else - out() << ""; - - out() << ""; + xmlWriter().writeEndElement(); // } ++p; } - out() << "

    "; - //out() << "

    "; // old - out() << ""; + xmlWriter().writeStartElement("li"); + writeGuidAttribute(qpn); + QString attr; if (!qpn->isWritable(myTree)) - out() << "read-only"; - if (qpgn->isDefault()) - out() << "default"; + attr = "read-only"; + if (qpgn->isDefault()) { + if (!attr.isEmpty()) + attr += " "; + attr += "default"; + } + if (!attr.isEmpty()) + xmlWriter().writeAttribute("outputclass",attr); generateQmlItem(qpn, relative, marker, false); - out() << "
    "; - out() << "
    "; + xmlWriter().writeEndElement(); // } else if (node->type() == Node::QmlSignal) { - const FunctionNode* qsn = static_cast(node); - out() << "
    "; - out() << ""; - //out() << ""; - if (++numTableRows % 2 == 1) - out() << ""; - else - out() << ""; - out() << ""; - out() << "

    "; - out() << ""; - marked = getMarkedUpSynopsis(qsn, relative, marker, CodeMarker::Detailed); + Node* n = const_cast(node); + xmlWriter().writeStartElement("ul"); + xmlWriter().writeStartElement("li"); + writeGuidAttribute(n); + marked = getMarkedUpSynopsis(n, relative, marker, CodeMarker::Detailed); writeText(marked, marker, relative); - //generateQmlItem(qsn,relative,marker,false); - out() << "

    "; - out() << "
    "; + generateQmlItem(n, relative, marker, false); + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // } else if (node->type() == Node::QmlMethod) { - const FunctionNode* qmn = static_cast(node); - out() << "
    "; - out() << ""; - //out() << ""; - if (++numTableRows % 2 == 1) - out() << ""; - else - out() << ""; - out() << ""; - out() << "

    "; - out() << ""; - marked = getMarkedUpSynopsis(qmn, relative, marker, CodeMarker::Detailed); + Node* n = const_cast(node); + xmlWriter().writeStartElement("ul"); + xmlWriter().writeStartElement("li"); + writeGuidAttribute(n); + marked = getMarkedUpSynopsis(n, relative, marker, CodeMarker::Detailed); writeText(marked, marker, relative); - out() << "

    "; - out() << "
    "; + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // } - out() << "
    "; generateStatus(node, marker); generateBody(node, marker); generateThreadSafeness(node, marker); generateSince(node, marker); generateAlsoList(node, marker); - out() << "
    "; - out() << "
    "; } /*! -- cgit v0.12 From c86449e2e45b67662b652d58e95e0ca7c99782fd Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 1 Oct 2010 15:18:40 +0200 Subject: qdoc: Removed extraneous call to generateQmlItem(). --- tools/qdoc3/ditaxmlgenerator.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 0291054..3fb90d2 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -4386,7 +4386,6 @@ void DitaXmlGenerator::generateDetailedQmlMember(const Node* node, writeGuidAttribute(n); marked = getMarkedUpSynopsis(n, relative, marker, CodeMarker::Detailed); writeText(marked, marker, relative); - generateQmlItem(n, relative, marker, false); xmlWriter().writeEndElement(); // xmlWriter().writeEndElement(); // } -- cgit v0.12 From 77a701d8657118d2c611d521a95dad42a845b42b Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 4 Oct 2010 10:50:41 +0200 Subject: qdoc: Changed type names to links to types. This wasn't happeneiung everywhere that it should have been, especially for QML basic types. --- tools/qdoc3/ditaxmlgenerator.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 3fb90d2..2d8eec2 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -3386,9 +3386,22 @@ void DitaXmlGenerator::writeText(const QString& markedCode, html.clear(); } par1 = QStringRef(); - marker->resolveTarget(arg.toString(), myTree, relative); - QString link = linkForNode(n,relative); - addLink(link, arg); + QString link; + n = marker->resolveTarget(arg.toString(), myTree, relative); + if (n && n->subType() == Node::QmlBasicType) { + if (relative && relative->subType() == Node::QmlClass) { + link = linkForNode(n,relative); + addLink(link, arg); + } + else { + link = arg.toString(); + } + } + else { + // (zzz) Is this correct for all cases? + link = linkForNode(n,relative); + addLink(link, arg); + } } handled = true; break; -- cgit v0.12 From edbe8f8f8c284b4cac52ff1e97a2065dc4f89d74 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 4 Oct 2010 13:14:22 +0200 Subject: qdoc: Outputting each namespace as a element. Still missing nested classes. --- tools/qdoc3/ditaxmlgenerator.cpp | 164 +++++++++++++++++++++++++++++++++++++-- tools/qdoc3/ditaxmlgenerator.h | 2 +- 2 files changed, 159 insertions(+), 7 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 2d8eec2..2b90d8e 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -1534,16 +1534,160 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark QList
    ::ConstIterator s; const ClassNode* cn = 0; - const NamespaceNode* namespasse = 0; + const NamespaceNode* nsn = 0; QString title; QString rawTitle; QString fullTitle; if (inner->type() == Node::Namespace) { - namespasse = const_cast(static_cast(inner)); + nsn = const_cast(static_cast(inner)); rawTitle = marker->plainName(inner); fullTitle = marker->plainFullName(inner); title = rawTitle + " Namespace"; + + /* + Note: Because the C++ specialization we are using + has no element, we are using the + element with an outputclass attribute + set to "namespace" . + */ + generateHeader(inner, fullTitle); + generateBrief(inner, marker); // + + // not included: + + xmlWriter().writeStartElement(CXXCLASSDETAIL); + xmlWriter().writeStartElement(CXXCLASSDEFINITION); + writeLocation(nsn); + xmlWriter().writeEndElement(); // + + xmlWriter().writeStartElement(APIDESC); + xmlWriter().writeAttribute("spectitle",title); + Text brief = nsn->doc().briefText(); + if (!brief.isEmpty()) { + xmlWriter().writeStartElement("p"); + generateText(brief, nsn, marker); + xmlWriter().writeEndElement(); //

    + } + generateIncludes(nsn, marker); + generateStatus(nsn, marker); + generateThreadSafeness(nsn, marker); + generateSince(nsn, marker); + + xmlWriter().writeStartElement("ul"); + + QString membersLink = generateListOfAllMemberFile(inner, marker); + if (!membersLink.isEmpty()) { + writeXrefListItem(membersLink,"List of all members, including inherited members"); + } + + QString obsoleteLink = generateLowStatusMemberFile(inner, + marker, + CodeMarker::Obsolete); + if (!obsoleteLink.isEmpty()) { + writeXrefListItem(obsoleteLink,"Obsolete members"); + } + + QString compatLink = generateLowStatusMemberFile(inner, + marker, + CodeMarker::Compat); + if (!compatLink.isEmpty()) { + writeXrefListItem(compatLink,"Qt 3 support members"); + } + + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // + + bool needOtherSection = false; + QList
    summarySections; + summarySections = marker->sections(inner, CodeMarker::Summary, CodeMarker::Okay); + s = summarySections.begin(); + while (s != summarySections.end()) { + if (s->members.isEmpty() && s->reimpMembers.isEmpty()) { + if (!s->inherited.isEmpty()) + needOtherSection = true; + } + else { + QString attr; + if (!s->members.isEmpty()) { + xmlWriter().writeStartElement("section"); + attr = cleanRef((*s).name).toLower() + " redundant"; + xmlWriter().writeAttribute("outputclass",attr); + xmlWriter().writeStartElement("title"); + xmlWriter().writeAttribute("outputclass","h2"); + xmlWriter().writeCharacters(protectEnc((*s).name)); + xmlWriter().writeEndElement(); // + generateSection(s->members, inner, marker, CodeMarker::Summary); + generateSectionInheritedList(*s, inner, marker); + xmlWriter().writeEndElement(); //
    + } + if (!s->reimpMembers.isEmpty()) { + QString name = QString("Reimplemented ") + (*s).name; + attr = cleanRef(name).toLower() + " redundant"; + xmlWriter().writeStartElement("section"); + xmlWriter().writeAttribute("outputclass",attr); + xmlWriter().writeStartElement("title"); + xmlWriter().writeAttribute("outputclass","h2"); + xmlWriter().writeCharacters(protectEnc(name)); + xmlWriter().writeEndElement(); // + generateSection(s->reimpMembers, inner, marker, CodeMarker::Summary); + generateSectionInheritedList(*s, inner, marker); + xmlWriter().writeEndElement(); //
    + } + } + ++s; + } + if (needOtherSection) { + xmlWriter().writeStartElement("section"); + xmlWriter().writeAttribute("outputclass","additional-inherited-members redundant"); + xmlWriter().writeStartElement("title"); + xmlWriter().writeAttribute("outputclass","h3"); + xmlWriter().writeCharacters("Additional Inherited Members"); + xmlWriter().writeEndElement(); // + s = summarySections.begin(); + while (s != summarySections.end()) { + if (s->members.isEmpty()) + generateSectionInheritedList(*s, inner, marker); + ++s; + } + xmlWriter().writeEndElement(); //
    + } + + writeDetailedDescription(nsn, marker, false, QString("Detailed Description")); + + // not included: or + + xmlWriter().writeEndElement(); // + + // not included: + // not included: + + QList
    detailSections; + detailSections = marker->sections(inner, CodeMarker::Detailed, CodeMarker::Okay); + s = detailSections.begin(); + while (s != detailSections.end()) { + if ((*s).name == "Function Documentation") { + writeFunctions((*s),nsn,marker); + } + else if ((*s).name == "Type Documentation") { + writeEnumerations((*s),marker); + writeTypedefs((*s),marker); + } + else if ((*s).name == "Variable Documentation") { + writeDataMembers((*s),marker); + } + else if ((*s).name == "Property Documentation") { + writeProperties((*s),marker); + } + else if ((*s).name == "Macro Documentation") { + writeMacros((*s),marker); + } + ++s; + } + + // not included: + + xmlWriter().writeEndElement(); // } else if (inner->type() == Node::Class) { cn = const_cast(static_cast(inner)); @@ -1826,7 +1970,6 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker generateQmlText(cn->doc().body(), cn, marker, fake->name()); generateAlsoList(fake, marker); - //out() << "
    \n"; sections = marker->qmlSections(qml_cn,CodeMarker::Detailed,0); s = sections.begin(); @@ -2095,6 +2238,16 @@ void DitaXmlGenerator::generateHeader(const Node* node, " PUBLIC \"-//NOKIA//DTD DITA C++ API Class Reference Type v" + version + "//EN\" \"" + dtd + "\">"; } + else if (node->type() == Node::Namespace) { + mainElement = "cxxClass"; + nameElement = "apiName"; + dtd = "dtd/cxxClass.dtd"; + version = "0.6.0"; + doctype = ""; + outputclass = "namespace"; + } xmlWriter().writeDTD(doctype); xmlWriter().writeComment(node->doc().location().fileName()); @@ -2899,7 +3052,6 @@ void DitaXmlGenerator::generateLegaleseList(const Node* relative, QMap::ConstIterator it = legaleseTexts.begin(); while (it != legaleseTexts.end()) { Text text = it.key(); - //out() << "
    \n"; generateText(text, relative, marker); xmlWriter().writeStartElement("ul"); do { @@ -4668,7 +4820,7 @@ void DitaXmlGenerator::writeLocation(const Node* n) Write the elements. */ void DitaXmlGenerator::writeFunctions(const Section& s, - const ClassNode* cn, + const Node* n, CodeMarker* marker) { NodeList::ConstIterator m = s.members.begin(); @@ -4728,7 +4880,7 @@ void DitaXmlGenerator::writeFunctions(const Section& s, } } - if (fn->name() == cn->name()) { + if (fn->name() == n->name()) { xmlWriter().writeStartElement(CXXFUNCTIONCONSTRUCTOR); xmlWriter().writeAttribute("name","constructor"); xmlWriter().writeAttribute("value","constructor"); diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index 484ff2f..746bbe9 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -117,7 +117,7 @@ class DitaXmlGenerator : public PageGenerator void writeDerivations(const ClassNode* cn, CodeMarker* marker); void writeLocation(const Node* n); void writeFunctions(const Section& s, - const ClassNode* cn, + const Node* n, CodeMarker* marker); void writeParameters(const FunctionNode* fn); void writeEnumerations(const Section& s, CodeMarker* marker); -- cgit v0.12 From 9b6be16181d0e17f61551d3d231f1a997fdcd9e1 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Tue, 5 Oct 2010 15:16:41 +0200 Subject: qdoc: Added the remaining names bits. Needs careful proofreading of results. --- tools/qdoc3/ditaxmlgenerator.cpp | 228 +++++++-------------------------------- tools/qdoc3/ditaxmlgenerator.h | 3 + 2 files changed, 40 insertions(+), 191 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 2b90d8e..6ec8934 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -1654,9 +1654,6 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark } writeDetailedDescription(nsn, marker, false, QString("Detailed Description")); - - // not included: or - xmlWriter().writeEndElement(); // // not included: @@ -1666,6 +1663,15 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark detailSections = marker->sections(inner, CodeMarker::Detailed, CodeMarker::Okay); s = detailSections.begin(); while (s != detailSections.end()) { + if ((*s).name == "Classes") { + writeNestedClasses((*s),nsn,marker); + break; + } + ++s; + } + + s = detailSections.begin(); + while (s != detailSections.end()) { if ((*s).name == "Function Documentation") { writeFunctions((*s),nsn,marker); } @@ -1673,20 +1679,14 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark writeEnumerations((*s),marker); writeTypedefs((*s),marker); } - else if ((*s).name == "Variable Documentation") { - writeDataMembers((*s),marker); - } - else if ((*s).name == "Property Documentation") { - writeProperties((*s),marker); + else if ((*s).name == "Namespaces") { + qDebug() << "Nested namespaces" << outFileName(); } else if ((*s).name == "Macro Documentation") { writeMacros((*s),marker); } ++s; } - - // not included: - xmlWriter().writeEndElement(); // } else if (inner->type() == Node::Class) { @@ -4773,7 +4773,7 @@ void DitaXmlGenerator::writeDerivations(const ClassNode* cn, CodeMarker* marker) void DitaXmlGenerator::writeLocation(const Node* n) { QString s1, s2, s3; - if (n->type() == Node::Class) { + if (n->type() == Node::Class || n->type() == Node::Namespace) { s1 = CXXCLASSAPIITEMLOCATION; s2 = CXXCLASSDECLARATIONFILE; s3 = CXXCLASSDECLARATIONFILELINE; @@ -5562,186 +5562,32 @@ void DitaXmlGenerator::writeDetailedDescription(const Node* node, inDetailedDescription = false; } -QT_END_NAMESPACE - -#ifdef TO_BE_INCLUDED_IN_API_DESC -zzzz - Text subtitleText; - if (rawTitle != fullTitle) - subtitleText << "(" << Atom(Atom::AutoLink, fullTitle) << ")" - << Atom(Atom::LineBreak); - - QString shortVersion; - shortVersion = project + " " + shortVersion + ": "; - shortVersion = myTree->version(); - if (shortVersion.count(QChar('.')) == 2) - shortVersion.truncate(shortVersion.lastIndexOf(QChar('.'))); - if (!shortVersion.isEmpty()) { - if (project == "QSA") - shortVersion = "QSA " + shortVersion + ": "; - else - shortVersion = "Qt " + shortVersion + ": "; - } - - out() << " " << shortVersion << protectEnc(title) << "\n"; - -#if 0 - out() << QString(postHeader).replace("\\" + COMMAND_VERSION, myTree->version()); - generateBreadCrumbs(title,node,marker); - out() << QString(postPostHeader).replace("\\" + COMMAND_VERSION, myTree->version()); -#endif - - sections = marker->sections(inner, CodeMarker::Summary, CodeMarker::Okay); - generateTableOfContents(inner,marker,§ions); - generateTitle(title, subtitleText, SmallSubTitle, inner, marker); - - if (cn && !cn->qmlElement().isEmpty()) { - generateInstantiatedBy(cn,marker); - } +/*! + Write the nested class elements. + */ +void DitaXmlGenerator::writeNestedClasses(const Section& s, + const Node* n, + CodeMarker* marker) +{ + if (s.members.isEmpty()) + return; + xmlWriter().writeStartElement("cxxClassNested"); + xmlWriter().writeStartElement("cxxClassNestedDetail"); - generateBrief(inner, marker); - generateIncludes(inner, marker); - generateStatus(inner, marker); - if (cn) { - generateInherits(cn, marker); - generateInheritedBy(cn, marker); - } - generateThreadSafeness(inner, marker); - generateSince(inner, marker); - - out() << "
      \n"; - - QString membersLink = generateListOfAllMemberFile(inner, marker); - if (!membersLink.isEmpty()) - out() << "
    • " - << "List of all members, including inherited members
    • \n"; - - QString obsoleteLink = generateLowStatusMemberFile(inner, - marker, - CodeMarker::Obsolete); - if (!obsoleteLink.isEmpty()) - out() << "
    • " - << "Obsolete members
    • \n"; - - QString compatLink = generateLowStatusMemberFile(inner, - marker, - CodeMarker::Compat); - if (!compatLink.isEmpty()) - out() << "
    • " - << "Qt 3 support members
    • \n"; - - out() << "
    \n"; - - bool needOtherSection = false; - - /* - sections is built above for the call to generateTableOfContents(). - */ - s = sections.begin(); - while (s != sections.end()) { - if (s->members.isEmpty() && s->reimpMembers.isEmpty()) { - if (!s->inherited.isEmpty()) - needOtherSection = true; - } - else { - if (!s->members.isEmpty()) { - out() << "
    \n"; - out() << "\n"; - out() << "

    " << protectEnc((*s).name) << "

    \n"; - generateSection(s->members, inner, marker, CodeMarker::Summary); - } - if (!s->reimpMembers.isEmpty()) { - QString name = QString("Reimplemented ") + (*s).name; - out() << "
    \n"; - out() << "\n"; - out() << "

    " << protectEnc(name) << "

    \n"; - generateSection(s->reimpMembers, inner, marker, CodeMarker::Summary); - } - generateSectionInheritedList(*s, inner, marker, true); - } - ++s; - } - - if (needOtherSection) { - out() << "

    Additional Inherited Members

    \n"; - s = sections.begin(); - while (s != sections.end()) { - if (s->members.isEmpty()) - generateSectionInheritedList(*s, inner, marker); - ++s; + NodeList::ConstIterator m = s.members.begin(); + while (m != s.members.end()) { + if ((*m)->type() == Node::Class) { + xmlWriter().writeStartElement("cxxClassNestedClass"); + QString link = linkForNode((*m), n); + xmlWriter().writeAttribute("href", link); + QString name = n->name() + "::" + (*m)->name(); + xmlWriter().writeCharacters(name); + xmlWriter().writeEndElement(); // } + ++m; } + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // +} - out() << "\n"; - - if (!inner->doc().isEmpty()) { - out() << "
    \n" - << "
    \n" // QTBUG-9504 - << "

    " << "Detailed Description" << "

    \n"; - generateBody(inner, marker); - out() << "
    \n"; // QTBUG-9504 - generateAlsoList(inner, marker); - } - - sections = marker->sections(inner, CodeMarker::Detailed, CodeMarker::Okay); - s = sections.begin(); - while (s != sections.end()) { - out() << "
    \n"; - if (!(*s).divClass.isEmpty()) - out() << "
    \n"; // QTBUG-9504 - out() << "

    " << protectEnc((*s).name) << "

    \n"; - - NodeList::ConstIterator m = (*s).members.begin(); - while (m != (*s).members.end()) { - if ((*m)->access() != Node::Private) { // ### check necessary? - if ((*m)->type() != Node::Class) - generateDetailedMember(*m, inner, marker); - else { - out() << "

    class "; - generateFullName(*m, inner, marker); - out() << "

    "; - generateBrief(*m, marker, inner); - } - - QStringList names; - names << (*m)->name(); - if ((*m)->type() == Node::Function) { - const FunctionNode *func = reinterpret_cast(*m); - if (func->metaness() == FunctionNode::Ctor || - func->metaness() == FunctionNode::Dtor || - func->overloadNumber() != 1) - names.clear(); - } - else if ((*m)->type() == Node::Property) { - const PropertyNode *prop = reinterpret_cast(*m); - if (!prop->getters().isEmpty() && - !names.contains(prop->getters().first()->name())) - names << prop->getters().first()->name(); - if (!prop->setters().isEmpty()) - names << prop->setters().first()->name(); - if (!prop->resetters().isEmpty()) - names << prop->resetters().first()->name(); - } - else if ((*m)->type() == Node::Enum) { - const EnumNode *enume = reinterpret_cast(*m); - if (enume->flagsType()) - names << enume->flagsType()->name(); - - foreach (const QString &enumName, - enume->doc().enumItemNames().toSet() - - enume->doc().omitEnumItemNames().toSet()) - names << plainCode(marker->markedUpEnumValue(enumName, - enume)); - } - } - ++m; - } - if (!(*s).divClass.isEmpty()) - out() << "
    \n"; // QTBUG-9504 - ++s; - } -#endif // TO_BE_INCLUDED_IN_API_DESC +QT_END_NAMESPACE diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index 746bbe9..cf26274 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -119,6 +119,9 @@ class DitaXmlGenerator : public PageGenerator void writeFunctions(const Section& s, const Node* n, CodeMarker* marker); + void writeNestedClasses(const Section& s, + const Node* n, + CodeMarker* marker); void writeParameters(const FunctionNode* fn); void writeEnumerations(const Section& s, CodeMarker* marker); void writeTypedefs(const Section& s, CodeMarker* marker); -- cgit v0.12 From f6b489885b75001b373c3aa2d3c7f1bd33520c06 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 6 Oct 2010 10:30:21 +0200 Subject: qdoc: Cleaned up a lot of redundant table stuff. Now just uses
      for redundant lists. --- tools/qdoc3/ditaxmlgenerator.cpp | 96 +++------------------------------------- tools/qdoc3/ditaxmlgenerator.h | 3 +- 2 files changed, 8 insertions(+), 91 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 6ec8934..5458b7c 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -3238,90 +3238,19 @@ void DitaXmlGenerator::generateSection(const NodeList& nl, CodeMarker* marker, CodeMarker::SynopsisStyle style) { - bool name_alignment = true; if (!nl.isEmpty()) { - bool twoColumn = false; - if (style == CodeMarker::SeparateList) { - name_alignment = false; - twoColumn = (nl.count() >= 16); - } - else if (nl.first()->type() == Node::Property) { - twoColumn = (nl.count() >= 5); - name_alignment = false; - } - if (name_alignment) { - xmlWriter().writeStartElement("table"); - xmlWriter().writeAttribute("outputclass","alignedsummary"); - xmlWriter().writeStartElement("tgroup"); - xmlWriter().writeAttribute("cols","2"); - xmlWriter().writeStartElement("tbody"); - } - else { - if (twoColumn) { - xmlWriter().writeStartElement("table"); - xmlWriter().writeAttribute("outputclass","propsummary"); - xmlWriter().writeStartElement("tgroup"); - xmlWriter().writeAttribute("cols","1"); - xmlWriter().writeStartElement("tbody"); - xmlWriter().writeStartElement("row"); - xmlWriter().writeStartElement("entry"); - xmlWriter().writeAttribute("outputclass","topAlign"); - } - xmlWriter().writeStartElement("ul"); - } - - int i = 0; + xmlWriter().writeStartElement("ul"); NodeList::ConstIterator m = nl.begin(); while (m != nl.end()) { - if ((*m)->access() == Node::Private) { - ++m; - continue; - } - - if (name_alignment) { - xmlWriter().writeStartElement("row"); - xmlWriter().writeStartElement("entry"); - xmlWriter().writeAttribute("outputclass","memItemLeft rightAlign topAlign"); - } - else { - if (twoColumn && i == (int) (nl.count() + 1) / 2) { - xmlWriter().writeEndElement(); //
    - xmlWriter().writeEndElement(); // - xmlWriter().writeStartElement("entry"); - xmlWriter().writeAttribute("outputclass","topAlign"); - xmlWriter().writeStartElement("ul"); - } + if ((*m)->access() != Node::Private) { xmlWriter().writeStartElement("li"); - xmlWriter().writeAttribute("outputclass","fn"); - } - - QString marked = getMarkedUpSynopsis(*m, relative, marker, style); - writeText(marked, marker, relative, name_alignment); - if (name_alignment) { - xmlWriter().writeEndElement(); // - xmlWriter().writeEndElement(); // - } - else { + QString marked = getMarkedUpSynopsis(*m, relative, marker, style); + writeText(marked, marker, relative); xmlWriter().writeEndElement(); // } - i++; ++m; } - if (name_alignment) { - xmlWriter().writeEndElement(); // - xmlWriter().writeEndElement(); // - xmlWriter().writeEndElement(); // - } - else { - xmlWriter().writeEndElement(); // - if (twoColumn) { - xmlWriter().writeEndElement(); // - xmlWriter().writeEndElement(); // - xmlWriter().writeEndElement(); // - xmlWriter().writeEndElement(); // - xmlWriter().writeEndElement(); // - } - } + xmlWriter().writeEndElement(); // } } @@ -3416,8 +3345,7 @@ QString DitaXmlGenerator::getMarkedUpSynopsis(const Node* node, */ void DitaXmlGenerator::writeText(const QString& markedCode, CodeMarker* marker, - const Node* relative, - bool nameAlignment) + const Node* relative) { QString src = markedCode; QString html; @@ -3487,19 +3415,9 @@ void DitaXmlGenerator::writeText(const QString& markedCode, // 0 1 2 3 4 5 "link", "type", "headerfile", "func", "param", "extra" }; - bool done = false; + for (int i = 0, n = src.size(); i < n;) { if (src.at(i) == charLangle && src.at(i + 1) == charAt) { - if (nameAlignment && !done) { - if (!html.isEmpty()) { - xmlWriter().writeCharacters(html); - html.clear(); - } - xmlWriter().writeEndElement(); // - xmlWriter().writeStartElement("entry"); - xmlWriter().writeAttribute("outputclass","memItemRight bottomAlign"); - done = true; - } i += 2; bool handled = false; for (int k = 0; k != 6; ++k) { diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index cf26274..8bd9406 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -208,8 +208,7 @@ class DitaXmlGenerator : public PageGenerator CodeMarker* marker); void writeText(const QString& markedCode, CodeMarker* marker, - const Node* relative, - bool nameAlignment = false); + const Node* relative); void generateFullName(const Node* apparentNode, const Node* relative, -- cgit v0.12 From 94cae67da50d68f70d728a7fb231de89d47263db Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 6 Oct 2010 12:32:34 +0200 Subject: qdoc: Cleaned up a lot of unneeded outputclass attributes. --- tools/qdoc3/ditaxmlgenerator.cpp | 30 +++--------------------------- tools/qdoc3/ditaxmlgenerator.h | 4 +--- 2 files changed, 4 insertions(+), 30 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 5458b7c..9e41a00 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -1178,10 +1178,6 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, xmlWriter().writeStartElement("simpletable"); xmlWriter().writeAttribute("outputclass","valuelist"); xmlWriter().writeStartElement("sthead"); - if (++numTableRows % 2 == 1) - xmlWriter().writeAttribute("outputclass","odd"); - else - xmlWriter().writeAttribute("outputclass","even"); xmlWriter().writeStartElement("stentry"); xmlWriter().writeCharacters("Constant"); xmlWriter().writeEndElement(); // @@ -1234,14 +1230,12 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, else { // (atom->string() == ATOM_LIST_VALUE) xmlWriter().writeStartElement("strow"); xmlWriter().writeStartElement("stentry"); - xmlWriter().writeAttribute("outputclass","topAlign"); xmlWriter().writeStartElement("tt"); xmlWriter().writeCharacters(protectEnc(plainCode(marker->markedUpEnumValue(atom->next()->string(), relative)))); xmlWriter().writeEndElement(); //
    xmlWriter().writeEndElement(); // xmlWriter().writeStartElement("stentry"); - xmlWriter().writeAttribute("outputclass","topAlign"); QString itemValue; if (relative->type() == Node::Enum) { @@ -1271,7 +1265,6 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, if (threeColumnEnumValueTable) { xmlWriter().writeEndElement(); // xmlWriter().writeStartElement("stentry"); - xmlWriter().writeAttribute("outputclass","topAlign"); if (matchAhead(atom, Atom::ListItemRight)) xmlWriter().writeCharacters(" "); } @@ -1378,7 +1371,6 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, in_para = false; } xmlWriter().writeStartElement("table"); - xmlWriter().writeAttribute("outputclass","generic"); numTableRows = 0; if (tableColumnCount != 0) { qDebug() << "ERROR: Nested tables!"; @@ -1428,10 +1420,6 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, } xmlWriter().writeStartElement("row"); xmlWriter().writeAttribute("valign","top"); - if (++numTableRows % 2 == 1) - xmlWriter().writeAttribute("outputclass","odd"); - else - xmlWriter().writeAttribute("outputclass","even"); break; case Atom::TableRowRight: xmlWriter().writeEndElement(); // @@ -1664,7 +1652,7 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark s = detailSections.begin(); while (s != detailSections.end()) { if ((*s).name == "Classes") { - writeNestedClasses((*s),nsn,marker); + writeNestedClasses((*s),nsn); break; } ++s; @@ -2724,7 +2712,6 @@ void DitaXmlGenerator::generateAnnotatedList(const Node* relative, xmlWriter().writeAttribute("cols","2"); xmlWriter().writeStartElement("tbody"); - int row = 0; foreach (const QString& name, nodeMap.keys()) { const Node* node = nodeMap[name]; @@ -2732,10 +2719,6 @@ void DitaXmlGenerator::generateAnnotatedList(const Node* relative, continue; xmlWriter().writeStartElement("row"); - if (++row % 2 == 1) - xmlWriter().writeAttribute("outputclass","odd topAlign"); - else - xmlWriter().writeAttribute("outputclass","even topAlign"); xmlWriter().writeStartElement("entry"); xmlWriter().writeStartElement("p"); generateFullName(node, relative, marker); @@ -2919,7 +2902,7 @@ void DitaXmlGenerator::generateCompactList(const Node* relative, Output a

    element to contain all the

    elements. */ xmlWriter().writeStartElement("p"); - xmlWriter().writeAttribute("outputclass","compactlist flowListDiv"); + xmlWriter().writeAttribute("outputclass","compactlist"); for (int i=0; i } xmlWriter().writeStartElement("dl"); - if (++numTableRows % 2 == 1) - xmlWriter().writeAttribute("outputclass","flowList odd"); - else - xmlWriter().writeAttribute("outputclass","flowList even"); xmlWriter().writeStartElement("dlentry"); xmlWriter().writeStartElement("dt"); xmlWriter().writeAttribute("outputclass","alphaChar"); @@ -3267,7 +3246,6 @@ void DitaXmlGenerator::generateSectionInheritedList(const Section& section, QList >::ConstIterator p = section.inherited.begin(); while (p != section.inherited.end()) { xmlWriter().writeStartElement("li"); - xmlWriter().writeAttribute("outputclass","fn"); QString text; text.setNum((*p).second); text += " "; @@ -4416,7 +4394,6 @@ void DitaXmlGenerator::generateQmlSummary(const Section& section, m = section.members.begin(); while (m != section.members.end()) { xmlWriter().writeStartElement("li"); - xmlWriter().writeAttribute("outputclass", "fn"); generateQmlItem(*m,relative,marker,true); xmlWriter().writeEndElement(); // ++m; @@ -5484,8 +5461,7 @@ void DitaXmlGenerator::writeDetailedDescription(const Node* node, Write the nested class elements. */ void DitaXmlGenerator::writeNestedClasses(const Section& s, - const Node* n, - CodeMarker* marker) + const Node* n) { if (s.members.isEmpty()) return; diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index 8bd9406..c0cb0db 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -119,9 +119,7 @@ class DitaXmlGenerator : public PageGenerator void writeFunctions(const Section& s, const Node* n, CodeMarker* marker); - void writeNestedClasses(const Section& s, - const Node* n, - CodeMarker* marker); + void writeNestedClasses(const Section& s, const Node* n); void writeParameters(const FunctionNode* fn); void writeEnumerations(const Section& s, CodeMarker* marker); void writeTypedefs(const Section& s, CodeMarker* marker); -- cgit v0.12 From e4f69ae9bd749db3defababa226b4d28051558ce Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 13 Oct 2010 10:18:41 +0200 Subject: qdoc: Fix const problem. --- tools/qdoc3/ditaxmlgenerator.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 9e41a00..ec82344 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -4412,7 +4412,7 @@ void DitaXmlGenerator::generateDetailedQmlMember(const Node* node, CodeMarker* marker) { QString marked; - QmlPropertyNode* qpn = 0; + const QmlPropertyNode* qpn = 0; if (node->subType() == Node::QmlPropertyGroup) { const QmlPropGroupNode* qpgn = static_cast(node); NodeList::ConstIterator p = qpgn->childNodes().begin(); @@ -4421,7 +4421,7 @@ void DitaXmlGenerator::generateDetailedQmlMember(const Node* node, if ((*p)->type() == Node::QmlProperty) { qpn = static_cast(*p); xmlWriter().writeStartElement("li"); - writeGuidAttribute(qpn); + writeGuidAttribute((Node*)qpn); QString attr; if (!qpn->isWritable(myTree)) attr = "read-only"; -- cgit v0.12 From d32706acebf37bd1e93e1c045cb46c7898ffed19 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Thu, 14 Oct 2010 13:11:03 +0200 Subject: qdoc: Fixed bug where cpp and h files not copied for examples. --- tools/qdoc3/ditaxmlgenerator.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index ec82344..9715b9d 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -47,6 +47,7 @@ #include "codeparser.h" #include "ditaxmlgenerator.h" #include "node.h" +#include "quoter.h" #include "separator.h" #include "tree.h" #include @@ -1983,7 +1984,19 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker return; } - if (!fake->doc().isEmpty()) { + if (fake->doc().isEmpty()) { + if (fake->subType() == Node::File) { + xmlWriter().writeStartElement("body"); + Text text; + Quoter quoter; + Doc::quoteFromFile(fake->doc().location(), quoter, fake->name()); + QString code = quoter.quoteTo(fake->location(), "", ""); + text << Atom(Atom::Code, code); + generateText(text, fake, marker); + xmlWriter().writeEndElement(); // + } + } + else { xmlWriter().writeStartElement("body"); if (fake->subType() == Node::Module) { writeDetailedDescription(fake, marker, false, QString("Detailed Description")); @@ -2000,7 +2013,6 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker } generateAnnotatedList(fake, marker, groupMembersMap); } - xmlWriter().writeEndElement(); // } xmlWriter().writeEndElement(); // -- cgit v0.12 From e7d0747e31fbf0226a7cb639ca52f984cdd8d3ea Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Thu, 14 Oct 2010 14:09:08 +0200 Subject: qdoc: Included file path as small-subtitle for example source files. --- tools/qdoc3/ditaxmlgenerator.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 9715b9d..b9ceb0a 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -1986,11 +1986,17 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker if (fake->doc().isEmpty()) { if (fake->subType() == Node::File) { - xmlWriter().writeStartElement("body"); Text text; Quoter quoter; + xmlWriter().writeStartElement("body"); + xmlWriter().writeStartElement("p"); + xmlWriter().writeAttribute("outputclass", "small-subtitle"); + text << fake->subTitle(); + generateText(text, fake, marker); + xmlWriter().writeEndElement(); //

    Doc::quoteFromFile(fake->doc().location(), quoter, fake->name()); QString code = quoter.quoteTo(fake->location(), "", ""); + text.clear(); text << Atom(Atom::Code, code); generateText(text, fake, marker); xmlWriter().writeEndElement(); // -- cgit v0.12 From 101148b86d356295b559c60c304714e8a07aafd6 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 15 Oct 2010 13:35:56 +0200 Subject: qdoc: Fixed invalid element nesting in some elements. --- tools/qdoc3/ditaxmlgenerator.cpp | 67 ++++++++++++++++++++++++---------------- 1 file changed, 41 insertions(+), 26 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index b9ceb0a..42f6d1d 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -1895,49 +1895,66 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker generateHeader(fake, fullTitle); generateBrief(fake, marker); // + xmlWriter().writeStartElement("body"); if (fake->subType() == Node::Module) { generateStatus(fake, marker); if (moduleNamespaceMap.contains(fake->name())) { - writeTargetAndHeader("namespaces","Namespaces","h2"); + xmlWriter().writeStartElement("section"); + xmlWriter().writeAttribute("outputclass","namespaces"); + xmlWriter().writeStartElement("ttitle"); + xmlWriter().writeAttribute("outputclass","h2"); + xmlWriter().writeCharacters("Namespaces"); + xmlWriter().writeEndElement(); // generateAnnotatedList(fake, marker, moduleNamespaceMap[fake->name()]); + xmlWriter().writeEndElement(); //
    } if (moduleClassMap.contains(fake->name())) { - writeTargetAndHeader("classes","Classes","h2"); + xmlWriter().writeStartElement("section"); + xmlWriter().writeAttribute("outputclass","classes"); + xmlWriter().writeStartElement("title"); + xmlWriter().writeAttribute("outputclass","h2"); + xmlWriter().writeCharacters("Classes"); + xmlWriter().writeEndElement(); // generateAnnotatedList(fake, marker, moduleClassMap[fake->name()]); + xmlWriter().writeEndElement(); //
    } } else if (fake->subType() == Node::HeaderFile) { generateStatus(fake, marker); - xmlWriter().writeStartElement("ul"); - QString membersLink = generateListOfAllMemberFile(fake, marker); - if (!membersLink.isEmpty()) { - writeXrefListItem(membersLink,"List of all members, including inherited members"); - } - QString obsoleteLink = generateLowStatusMemberFile(fake, marker, CodeMarker::Obsolete); - if (!obsoleteLink.isEmpty()) { - writeXrefListItem(obsoleteLink,"Obsolete members"); - } - QString compatLink = generateLowStatusMemberFile(fake, marker, CodeMarker::Compat); - if (!compatLink.isEmpty()) { - writeXrefListItem(compatLink,"Qt 3 support members"); - } - xmlWriter().writeEndElement(); // + if (!membersLink.isEmpty() || !obsoleteLink.isEmpty() || !compatLink.isEmpty()) { + xmlWriter().writeStartElement("section"); + xmlWriter().writeAttribute("outputclass","member-lists"); + xmlWriter().writeStartElement("ul"); + if (!membersLink.isEmpty()) { + writeXrefListItem(membersLink,"List of all members, including inherited members"); + } + if (!obsoleteLink.isEmpty()) { + writeXrefListItem(obsoleteLink,"Obsolete members"); + } + if (!compatLink.isEmpty()) { + writeXrefListItem(compatLink,"Qt 3 support members"); + } + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); //
    + } } else if (fake->subType() == Node::QmlClass) { const QmlClassNode* qml_cn = static_cast(fake); const ClassNode* cn = qml_cn->classNode(); - generateQmlInherits(qml_cn, marker); + xmlWriter().writeStartElement("section"); + xmlWriter().writeAttribute("outputclass","apidesc"); generateQmlInstantiates(qml_cn, marker); - generateBrief(qml_cn, marker); + generateQmlInherits(qml_cn, marker); generateQmlInheritedBy(qml_cn, marker); + xmlWriter().writeEndElement(); //
    sections = marker->qmlSections(qml_cn,CodeMarker::Summary,0); s = sections.begin(); while (s != sections.end()) { @@ -1981,6 +1998,7 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker } ++s; } + xmlWriter().writeEndElement(); // return; } @@ -1988,7 +2006,6 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker if (fake->subType() == Node::File) { Text text; Quoter quoter; - xmlWriter().writeStartElement("body"); xmlWriter().writeStartElement("p"); xmlWriter().writeAttribute("outputclass", "small-subtitle"); text << fake->subTitle(); @@ -1999,11 +2016,9 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker text.clear(); text << Atom(Atom::Code, code); generateText(text, fake, marker); - xmlWriter().writeEndElement(); // } } else { - xmlWriter().writeStartElement("body"); if (fake->subType() == Node::Module) { writeDetailedDescription(fake, marker, false, QString("Detailed Description")); } @@ -2019,8 +2034,8 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker } generateAnnotatedList(fake, marker, groupMembersMap); } - xmlWriter().writeEndElement(); // } + xmlWriter().writeEndElement(); // xmlWriter().writeEndElement(); // } @@ -2219,13 +2234,13 @@ void DitaXmlGenerator::generateHeader(const Node* node, case Node::File: outputclass = "file"; break; - case Node::Image: + case Node::Image: // not used outputclass = "image"; break; case Node::Module: outputclass = "module"; break; - case Node::ExternalPage: + case Node::ExternalPage: // not used outputclass = "externalpage"; break; case Node::QmlClass: @@ -2261,9 +2276,9 @@ void DitaXmlGenerator::generateHeader(const Node* node, xmlWriter().writeAttribute("id",node->guid()); if (!outputclass.isEmpty()) xmlWriter().writeAttribute("outputclass",outputclass); - xmlWriter().writeStartElement(nameElement); + xmlWriter().writeStartElement(nameElement); // or <apiName> xmlWriter().writeCharacters(name); - xmlWriter().writeEndElement(); // <nameElement> + xmlWriter().writeEndElement(); // or } /*! -- cgit v0.12 From 410f203fd3542af182a6fe4406cc5094b65a90f8 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 18 Oct 2010 13:22:40 +0200 Subject: qdoc: Changed GUIDs from "{xxxxxx}" to "id-xxxxxxx". --- tools/qdoc3/ditaxmlgenerator.cpp | 25 ++++--------------------- tools/qdoc3/ditaxmlgenerator.h | 3 --- tools/qdoc3/htmlgenerator.cpp | 1 + tools/qdoc3/node.cpp | 16 +++++++++------- tools/qdoc3/node.h | 5 ++--- 5 files changed, 16 insertions(+), 34 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 42f6d1d..9108d7b 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -559,7 +559,8 @@ QString DitaXmlGenerator::lookupGuid(QString text) QMap::const_iterator i = name2guidMap.find(text); if (i != name2guidMap.end()) return i.value(); - QString guid = QUuid::createUuid().toString(); + QString t = QUuid::createUuid().toString(); + QString guid = "id-" + t.mid(1,t.length()-2); name2guidMap.insert(text,guid); return guid; } @@ -578,7 +579,8 @@ QString DitaXmlGenerator::lookupGuid(const QString& fileName, const QString& tex GuidMap::const_iterator i = gm->find(text); if (i != gm->end()) return i.value(); - QString guid = QUuid::createUuid().toString(); + QString t = QUuid::createUuid().toString(); + QString guid = "id-" + t.mid(1,t.length()-2); gm->insert(text,guid); return guid; } @@ -1840,25 +1842,6 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark } /*! - Write a paragraph for the \a target and a poaragraph for - the \a header. Use the \a attribute for the \a header. - */ -void DitaXmlGenerator::writeTargetAndHeader(const QString& target, - const QString& header, - const QString& attribute) -{ - xmlWriter().writeStartElement("p"); - writeGuidAttribute(registerRef(target)); - xmlWriter().writeAttribute("outputclass","target"); - xmlWriter().writeCharacters(header); - xmlWriter().writeEndElement(); //

    - xmlWriter().writeStartElement("p"); - xmlWriter().writeAttribute("outputclass",attribute); - xmlWriter().writeCharacters(header); - xmlWriter().writeEndElement(); //

    -} - -/*! Write a list item for a \a link with the given \a text. */ void DitaXmlGenerator::writeXrefListItem(const QString& link, const QString& text) diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index c0cb0db..e564f58 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -108,9 +108,6 @@ class DitaXmlGenerator : public PageGenerator virtual QString linkForNode(const Node* node, const Node* relative); virtual QString refForAtom(Atom* atom, const Node* node); - void writeTargetAndHeader(const QString& target, - const QString& header, - const QString& attribute); void writeXrefListItem(const QString& link, const QString& text); QString fullQualification(const Node* n); diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 726196f..19b86e0 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -56,6 +56,7 @@ #include #include #include +#include QT_BEGIN_NAMESPACE diff --git a/tools/qdoc3/node.cpp b/tools/qdoc3/node.cpp index ce53b86..f4736f3 100644 --- a/tools/qdoc3/node.cpp +++ b/tools/qdoc3/node.cpp @@ -46,6 +46,7 @@ #include "node.h" #include "tree.h" #include "codemarker.h" +#include #include QT_BEGIN_NAMESPACE @@ -103,7 +104,6 @@ Node::Node(Type type, InnerNode *parent, const QString& name) { if (par) par->addChild(this); - //uuid = QUuid::createUuid(); } /*! @@ -270,14 +270,16 @@ QString Node::fileBase() const } /*! - Returns this node's Universally Unique IDentifier. - If its UUID has not yet been created, it is created - first. + Returns this node's Universally Unique IDentifier as a + QString. Creates the UUID first, if it has not been created. */ -QUuid Node::guid() const +QString Node::guid() const { - if (uuid.isNull()) - uuid = QUuid::createUuid(); + if (uuid.isEmpty()) { + QUuid quuid = QUuid::createUuid(); + QString t = quuid.toString(); + uuid = "id-" + t.mid(1,t.length()-2); + } return uuid; } diff --git a/tools/qdoc3/node.h b/tools/qdoc3/node.h index 40b78ef..0b493ee 100644 --- a/tools/qdoc3/node.h +++ b/tools/qdoc3/node.h @@ -55,7 +55,6 @@ #include "doc.h" #include "location.h" #include "text.h" -#include QT_BEGIN_NAMESPACE @@ -191,7 +190,7 @@ class Node void clearRelated() { rel = 0; } virtual QString fileBase() const; - QUuid guid() const; + QString guid() const; QString ditaXmlHref(); QString extractClassName(const QString &string) const; @@ -223,7 +222,7 @@ class Node QString u; QString sinc; QString tpl; - mutable QUuid uuid; + mutable QString uuid; }; class FunctionNode; -- cgit v0.12 From 8f3e9dc22c5d4d72984473139d2c9a382c79b963 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 18 Oct 2010 14:35:04 +0200 Subject: qdoc: Added extraneous enum Definition File elements Removed bread crumb generator from DITA XML generator. --- tools/qdoc3/ditaxmlgenerator.cpp | 168 +++++---------------------------------- tools/qdoc3/ditaxmlgenerator.h | 3 - 2 files changed, 21 insertions(+), 150 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 9108d7b..b69f511 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -2022,60 +2022,6 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker xmlWriter().writeEndElement(); // } -#if 0 -zzz - /* - Generate the TOC for the new doc format. - Don't generate a TOC for the home page. - */ - if (fake->name() != QString("index.html")) - generateTableOfContents(fake,marker,0); - - generateTitle(fullTitle, - Text() << fake->subTitle(), - subTitleSize, - fake, - marker); - - -#endif - -#if 0 -zzz - sections = marker->sections(fake, CodeMarker::Summary, CodeMarker::Okay); - s = sections.begin(); - while (s != sections.end()) { - out() << "\n"; - out() << "

    " << protectEnc((*s).name) << "

    \n"; - generateSection(s->members, fake, marker, CodeMarker::Summary); - generateSectionInheritedList(*s, relative, marker, name_alignment); - ++s; - } - - Text brief = fake->doc().briefText(); - if (fake->subType() == Node::Module && !brief.isEmpty()) { - out() << "\n"; - out() << "
    \n"; // QTBUG-9504 - out() << "

    " << "Detailed Description" << "

    \n"; - } - else - out() << "
    \n"; // QTBUG-9504 - - sections = marker->sections(fake, CodeMarker::Detailed, CodeMarker::Okay); - s = sections.begin(); - while (s != sections.end()) { - out() << "
    \n"; - out() << "

    " << protectEnc((*s).name) << "

    \n"; - - NodeList::ConstIterator m = (*s).members.begin(); - while (m != (*s).members.end()) { - generateDetailedMember(*m, fake, marker); - ++m; - } - ++s; - } -#endif - /*! Returns "xml" for this subclass of class Generator. */ @@ -2085,95 +2031,6 @@ QString DitaXmlGenerator::fileExtension(const Node * /* node */) const } /*! - zzz - Output breadcrumb list in the html file. - */ -void DitaXmlGenerator::generateBreadCrumbs(const QString& title, - const Node *node, - CodeMarker *marker) -{ - Text breadcrumb; - if (node->type() == Node::Class) { - const ClassNode* cn = static_cast(node); - QString name = node->moduleName(); - out() << "
  • All Modules
  • "; - if (!name.isEmpty()) { - out() << "
  • "; - breadcrumb << Atom(Atom::AutoLink,name); - generateText(breadcrumb, node, marker); - out() << "
  • \n"; - } - breadcrumb.clear(); - if (!cn->name().isEmpty()) { - out() << "
  • "; - breadcrumb << Atom(Atom::AutoLink,cn->name()); - generateText(breadcrumb, 0, marker); - out() << "
  • \n"; - } - } - else if (node->type() == Node::Fake) { - const FakeNode* fn = static_cast(node); - if (node->subType() == Node::Module) { - out() << "
  • All Modules
  • "; - QString name = node->name(); - if (!name.isEmpty()) { - out() << "
  • "; - breadcrumb << Atom(Atom::AutoLink,name); - generateText(breadcrumb, 0, marker); - out() << "
  • \n"; - } - } - else if (node->subType() == Node::Group) { - if (fn->name() == QString("modules")) - out() << "
  • All Modules
  • "; - else { - out() << "
  • name() << "\">" << title - << "
  • "; - } - } - else if (node->subType() == Node::Page) { - if (fn->name() == QString("examples.html")) { - out() << "
  • Examples
  • "; - } - else if (fn->name().startsWith("examples-")) { - out() << "
  • Examples
  • "; - out() << "
  • name() << "\">" << title - << "
  • "; - } - else if (fn->name() == QString("namespaces.html")) { - out() << "
  • All Namespaces
  • "; - } - else { - out() << "
  • name() << "\">" << title - << "
  • "; - } - } - else if (node->subType() == Node::QmlClass) { - out() << "
  • QML Elements
  • "; - out() << "
  • name() << "\">" << title - << "
  • "; - } - else if (node->subType() == Node::Example) { - out() << "
  • Examples
  • "; - QStringList sl = fn->name().split('/'); - QString name = "examples-" + sl.at(0) + ".html"; - QString t = CodeParser::titleFromName(name); - out() << "
  • " - << t << "
  • "; - out() << "
  • " - << title << "
  • "; - } - } - else if (node->type() == Node::Namespace) { - const NamespaceNode* nsn = static_cast(node); - out() << "
  • All Namespaces
  • "; - out() << "
  • " << title - << "
  • "; - } -} - -/*! Writes an XML file header to the current XML stream. This depends on which kind of DITA XML file is being generated, which is determined by the \a node type and subtype and the @@ -4683,7 +4540,7 @@ void DitaXmlGenerator::writeDerivations(const ClassNode* cn, CodeMarker* marker) */ void DitaXmlGenerator::writeLocation(const Node* n) { - QString s1, s2, s3; + QString s1, s2, s3, s4, s5, s6; if (n->type() == Node::Class || n->type() == Node::Namespace) { s1 = CXXCLASSAPIITEMLOCATION; s2 = CXXCLASSDECLARATIONFILE; @@ -4698,6 +4555,9 @@ void DitaXmlGenerator::writeLocation(const Node* n) s1 = CXXENUMERATIONAPIITEMLOCATION; s2 = CXXENUMERATIONDECLARATIONFILE; s3 = CXXENUMERATIONDECLARATIONFILELINE; + s4 = CXXENUMERATIONDEFINITIONFILE; + s5 = CXXENUMERATIONDEFINITIONFILELINESTART; + s6 = CXXENUMERATIONDEFINITIONFILELINEEND; } else if (n->type() == Node::Typedef) { s1 = CXXTYPEDEFAPIITEMLOCATION; @@ -4720,9 +4580,23 @@ void DitaXmlGenerator::writeLocation(const Node* n) QString lineNr; xmlWriter().writeAttribute("value",lineNr.setNum(n->location().lineNo())); xmlWriter().writeEndElement(); // DeclarationFileLine> - - // not included: , , - // and + if (!s4.isEmpty()) { // zzz This stuff is temporary, I think. + xmlWriter().writeStartElement(s4); + xmlWriter().writeAttribute("name","filePath"); + xmlWriter().writeAttribute("value",n->location().filePath()); + xmlWriter().writeEndElement(); // DefinitionFile> + xmlWriter().writeStartElement(s5); + xmlWriter().writeAttribute("name","lineNumber"); + xmlWriter().writeAttribute("value",lineNr.setNum(n->location().lineNo())); + xmlWriter().writeEndElement(); // DefinitionFileLineStart> + xmlWriter().writeStartElement(s6); + xmlWriter().writeAttribute("name","lineNumber"); + xmlWriter().writeAttribute("value",lineNr.setNum(n->location().lineNo())); + xmlWriter().writeEndElement(); // DefinitionFileLineEnd> + } + + // not included: , , + // and xmlWriter().writeEndElement(); // ApiItemLocation> } diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index e564f58..30c398b 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -133,9 +133,6 @@ class DitaXmlGenerator : public PageGenerator const Node* relative, CodeMarker* marker, const Atom* atom = 0); - void generateBreadCrumbs(const QString& title, - const Node* node, - CodeMarker* marker); void generateHeader(const Node* node, const QString& name, bool subpage = false); -- cgit v0.12 From c004bfbfcdb5110ae1545e013ca555a9f4b75337 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 18 Oct 2010 15:26:33 +0200 Subject: qdoc: Fixed

    inside of

    for legalese text. --- tools/qdoc3/ditaxmlgenerator.cpp | 22 ++++++++++++++++------ tools/qdoc3/ditaxmlgenerator.h | 1 + 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index b69f511..27f36ff 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -64,6 +64,7 @@ int DitaXmlGenerator::id = 0; bool DitaXmlGenerator::inApiDesc = false; bool DitaXmlGenerator::inSection = false; bool DitaXmlGenerator::inDetailedDescription = false; +bool DitaXmlGenerator::inLegaleseText = false; #define cxxapi_d_xref Doc::alias("cxxapi-d-xref") #define cxxclass Doc::alias("cxxclass") @@ -1122,11 +1123,10 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, // nothing break; case Atom::LegaleseLeft: - xmlWriter().writeStartElement("p"); - xmlWriter().writeAttribute("outputclass","legalese"); + inLegaleseText = true; break; case Atom::LegaleseRight: - xmlWriter().writeEndElement(); //

    + inLegaleseText = false; break; case Atom::LineBreak: xmlWriter().writeEmptyElement("br"); @@ -1309,6 +1309,8 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, break; case Atom::ParaLeft: xmlWriter().writeStartElement("p"); + if (inLegaleseText) + xmlWriter().writeAttribute("outputclass","legalese"); in_para = true; break; case Atom::ParaRight: @@ -4547,9 +4549,17 @@ void DitaXmlGenerator::writeLocation(const Node* n) s3 = CXXCLASSDECLARATIONFILELINE; } else if (n->type() == Node::Function) { - s1 = CXXFUNCTIONAPIITEMLOCATION; - s2 = CXXFUNCTIONDECLARATIONFILE; - s3 = CXXFUNCTIONDECLARATIONFILELINE; + FunctionNode* fn = const_cast(static_cast(n)); + if (fn->isMacro()) { + s1 = CXXDEFINEAPIITEMLOCATION; + s2 = CXXDEFINEDECLARATIONFILE; + s3 = CXXDEFINEDECLARATIONFILELINE; + } + else { + s1 = CXXFUNCTIONAPIITEMLOCATION; + s2 = CXXFUNCTIONDECLARATIONFILE; + s3 = CXXFUNCTIONDECLARATIONFILELINE; + } } else if (n->type() == Node::Enum) { s1 = CXXENUMERATIONAPIITEMLOCATION; diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index 30c398b..0a9fc4a 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -308,6 +308,7 @@ class DitaXmlGenerator : public PageGenerator static bool inApiDesc; static bool inSection; static bool inDetailedDescription; + static bool inLegaleseText; QStack xmlWriterStack; }; -- cgit v0.12 From c0836f9101f48c3c37ea477c66c49fd3dc08dfb5 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 20 Oct 2010 12:36:14 +0200 Subject: qdoc: Fixed some DITA XML validation errors. --- tools/qdoc3/ditaxmlgenerator.cpp | 66 ++++++++++--------- tools/qdoc3/doc.cpp | 4 +- tools/qdoc3/doc.h | 2 +- tools/qdoc3/text.cpp | 136 ++++++++++++++++++++------------------- tools/qdoc3/text.h | 2 +- 5 files changed, 108 insertions(+), 102 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 27f36ff..668d6ed 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -337,8 +337,6 @@ bool DitaXmlGenerator::inLegaleseText = false; #define APIMAP Doc::alias("apiMap") #define APIITEMREF Doc::alias("apiItemRef") -#define SHORTDESC Doc::alias("shortdesc") - QString DitaXmlGenerator::sinceTitles[] = { " New Namespaces", @@ -677,7 +675,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, CodeMarker *marker) { int skipAhead = 0; - QString hx; + QString hx, str; static bool in_para = false; QString guid, hc; @@ -710,30 +708,20 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, skipAhead = skipAtoms(atom, Atom::BriefRight); break; } - if (inApiDesc || inSection) + if (inApiDesc || inSection) { xmlWriter().writeStartElement("p"); + xmlWriter().writeAttribute("outputclass","brief"); + } else { noLinks = true; - xmlWriter().writeStartElement(SHORTDESC); + xmlWriter().writeStartElement("shortdesc"); } if (relative->type() == Node::Property || relative->type() == Node::Variable) { - QString str; - atom = atom->next(); - while (atom != 0 && atom->type() != Atom::BriefRight) { - if (atom->type() == Atom::String || - atom->type() == Atom::AutoLink) - str += atom->string(); - skipAhead++; - atom = atom->next(); - } - str[0] = str[0].toLower(); - if (str.right(1) == ".") - str.truncate(str.length() - 1); xmlWriter().writeCharacters("This "); if (relative->type() == Node::Property) xmlWriter().writeCharacters("property"); - else + else if (relative->type() == Node::Variable) xmlWriter().writeCharacters("variable"); QStringList words = str.split(" "); if (!(words.first() == "contains" || words.first() == "specifies" @@ -742,14 +730,27 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, xmlWriter().writeCharacters(" holds "); else xmlWriter().writeCharacters(" "); + } + if (noLinks) { + atom = atom->next(); + while (atom != 0 && atom->type() != Atom::BriefRight) { + if (atom->type() == Atom::String || + atom->type() == Atom::AutoLink) + str += atom->string(); + skipAhead++; + atom = atom->next(); + } + str[0] = str[0].toLower(); + if (str.right(1) == ".") + str.truncate(str.length() - 1); + str[0] = str[0].toUpper(); xmlWriter().writeCharacters(str + "."); } break; case Atom::BriefRight: - if (relative->type() != Node::Fake) { + if (relative->type() != Node::Fake) xmlWriter().writeEndElement(); // or

    - noLinks = false; - } + noLinks = false; break; case Atom::C: xmlWriter().writeStartElement(formattingLeftMap()[ATOM_FORMATTING_TELETYPE]); @@ -1141,8 +1142,13 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, .arg(marker->plainFullName(relative))); } #if 0 - else - qDebug() << "MYLINK:" << myLink << outFileName();; + else if (noLinks) { + //xmlWriter().writeCharacters(atom->string()); + qDebug() << "MYLINK:" << myLink << outFileName() << atom->string(); + } + else { + beginLink(myLink, node, relative, marker); + } #endif beginLink(myLink, node, relative, marker); skipAhead = 1; @@ -1556,7 +1562,7 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark xmlWriter().writeStartElement(APIDESC); xmlWriter().writeAttribute("spectitle",title); - Text brief = nsn->doc().briefText(); + Text brief = nsn->doc().briefText(); // zzz if (!brief.isEmpty()) { xmlWriter().writeStartElement("p"); generateText(brief, nsn, marker); @@ -1713,7 +1719,7 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark xmlWriter().writeStartElement(APIDESC); xmlWriter().writeAttribute("spectitle",title); - Text brief = cn->doc().briefText(); + Text brief = cn->doc().briefText(); // zzz if (!brief.isEmpty()) { xmlWriter().writeStartElement("p"); generateText(brief, cn, marker); @@ -2107,7 +2113,7 @@ void DitaXmlGenerator::generateHeader(const Node* node, dtd = "dtd/cxxClass.dtd"; version = "0.6.0"; doctype = ""; outputclass = "namespace"; } @@ -2160,13 +2166,9 @@ void DitaXmlGenerator::generateTitle(const QString& title, */ void DitaXmlGenerator::generateBrief(const Node* node, CodeMarker* marker) { - Text brief = node->doc().briefText(); + Text brief = node->doc().briefText(true); // zzz if (!brief.isEmpty()) { - noLinks = true; - xmlWriter().writeStartElement(SHORTDESC); generateText(brief, node, marker); - xmlWriter().writeEndElement(); // - noLinks = false; } } @@ -2613,7 +2615,7 @@ void DitaXmlGenerator::generateAnnotatedList(const Node* relative, else { xmlWriter().writeStartElement("entry"); xmlWriter().writeStartElement("p"); - xmlWriter().writeCharacters(protectEnc(node->doc().briefText().toString())); + xmlWriter().writeCharacters(protectEnc(node->doc().briefText().toString())); // zzz xmlWriter().writeEndElement(); //

    xmlWriter().writeEndElement(); // } diff --git a/tools/qdoc3/doc.cpp b/tools/qdoc3/doc.cpp index 280f055..5adb282 100644 --- a/tools/qdoc3/doc.cpp +++ b/tools/qdoc3/doc.cpp @@ -2621,9 +2621,9 @@ const Text& Doc::body() const return priv == 0 ? dummy : priv->text; } -Text Doc::briefText() const +Text Doc::briefText(bool inclusive) const { - return body().subText(Atom::BriefLeft, Atom::BriefRight); + return body().subText(Atom::BriefLeft, Atom::BriefRight, 0, inclusive); } Text Doc::trimmedBriefText(const QString &className) const diff --git a/tools/qdoc3/doc.h b/tools/qdoc3/doc.h index 3e76456..cf93151 100644 --- a/tools/qdoc3/doc.h +++ b/tools/qdoc3/doc.h @@ -100,7 +100,7 @@ class Doc bool isEmpty() const; const QString& source() const; const Text& body() const; - Text briefText() const; + Text briefText(bool inclusive = false) const; Text trimmedBriefText(const QString &className) const; Text legaleseText() const; const QString& baseName() const; diff --git a/tools/qdoc3/text.cpp b/tools/qdoc3/text.cpp index 11d7edd..ecec5eb 100644 --- a/tools/qdoc3/text.cpp +++ b/tools/qdoc3/text.cpp @@ -60,10 +60,10 @@ Text::Text(const QString &str) operator<<(str); } -Text::Text( const Text& text ) +Text::Text(const Text& text) : first(0), last(0) { - operator=( text ); + operator=(text); } Text::~Text() @@ -71,41 +71,41 @@ Text::~Text() clear(); } -Text& Text::operator=( const Text& text ) +Text& Text::operator=(const Text& text) { - if ( this != &text ) { + if (this != &text) { clear(); - operator<<( text ); + operator<<(text); } return *this; } -Text& Text::operator<<( Atom::Type atomType ) +Text& Text::operator<<(Atom::Type atomType) { - return operator<<( Atom(atomType) ); + return operator<<(Atom(atomType)); } -Text& Text::operator<<( const QString& string ) +Text& Text::operator<<(const QString& string) { - return operator<<( Atom(Atom::String, string) ); + return operator<<(Atom(Atom::String, string)); } -Text& Text::operator<<( const Atom& atom ) +Text& Text::operator<<(const Atom& atom) { - if ( first == 0 ) { - first = new Atom( atom.type(), atom.string() ); + if (first == 0) { + first = new Atom(atom.type(), atom.string()); last = first; } else { - last = new Atom( last, atom.type(), atom.string() ); + last = new Atom(last, atom.type(), atom.string()); } return *this; } -Text& Text::operator<<( const Text& text ) +Text& Text::operator<<(const Text& text) { - const Atom *atom = text.firstAtom(); - while ( atom != 0 ) { - operator<<( *atom ); + const Atom* atom = text.firstAtom(); + while (atom != 0) { + operator<<(*atom); atom = atom->next(); } return *this; @@ -113,10 +113,10 @@ Text& Text::operator<<( const Text& text ) void Text::stripFirstAtom() { - if ( first != 0 ) { - if ( first == last ) + if (first != 0) { + if (first == last) last = 0; - Atom *oldFirst = first; + Atom* oldFirst = first; first = first->next(); delete oldFirst; } @@ -124,16 +124,16 @@ void Text::stripFirstAtom() void Text::stripLastAtom() { - if ( last != 0 ) { - Atom *oldLast = last; - if ( first == last ) { + if (last != 0) { + Atom* oldLast = last; + if (first == last) { first = 0; last = 0; } else { last = first; - while ( last->next() != oldLast ) + while (last->next() != oldLast) last = last->next(); - last->setNext( 0 ); + last->setNext(0); } delete oldLast; } @@ -142,9 +142,9 @@ void Text::stripLastAtom() QString Text::toString() const { QString str; - const Atom *atom = firstAtom(); - while ( atom != 0 ) { - if ( atom->type() == Atom::String || + const Atom* atom = firstAtom(); + while (atom != 0) { + if (atom->type() == Atom::String || atom->type() == Atom::AutoLink || atom->type() == Atom::GuidLink) str += atom->string(); @@ -153,50 +153,54 @@ QString Text::toString() const return str; } -Text Text::subText( Atom::Type left, Atom::Type right, const Atom *from ) const +Text Text::subText(Atom::Type left, Atom::Type right, const Atom* from, bool inclusive) const { - const Atom *begin = from ? from : firstAtom(); - const Atom *end; + const Atom* begin = from ? from : firstAtom(); + const Atom* end; - while ( begin != 0 && begin->type() != left ) - begin = begin->next(); - if ( begin != 0 ) + while (begin != 0 && begin->type() != left) begin = begin->next(); + if (begin != 0) { + if (!inclusive) + begin = begin->next(); + } end = begin; - while ( end != 0 && end->type() != right ) + while (end != 0 && end->type() != right) end = end->next(); - if ( end == 0 ) + if (end == 0) begin = 0; - return subText( begin, end ); + else if (inclusive) + end = end->next(); + return subText(begin, end); } -Text Text::sectionHeading(const Atom *sectionLeft) +Text Text::sectionHeading(const Atom* sectionLeft) { - if ( sectionLeft != 0 ) { - const Atom *begin = sectionLeft; - while ( begin != 0 && begin->type() != Atom::SectionHeadingLeft ) + if (sectionLeft != 0) { + const Atom* begin = sectionLeft; + while (begin != 0 && begin->type() != Atom::SectionHeadingLeft) begin = begin->next(); - if ( begin != 0 ) + if (begin != 0) begin = begin->next(); - const Atom *end = begin; - while ( end != 0 && end->type() != Atom::SectionHeadingRight ) + const Atom* end = begin; + while (end != 0 && end->type() != Atom::SectionHeadingRight) end = end->next(); - if ( end != 0 ) - return subText( begin, end ); + if (end != 0) + return subText(begin, end); } return Text(); } -const Atom *Text::sectionHeadingAtom(const Atom *sectionLeft) +const Atom* Text::sectionHeadingAtom(const Atom* sectionLeft) { - if ( sectionLeft != 0 ) { - const Atom *begin = sectionLeft; - while ( begin != 0 && begin->type() != Atom::SectionHeadingLeft ) + if (sectionLeft != 0) { + const Atom* begin = sectionLeft; + while (begin != 0 && begin->type() != Atom::SectionHeadingLeft) begin = begin->next(); - if ( begin != 0 ) + if (begin != 0) begin = begin->next(); return begin; @@ -206,25 +210,25 @@ const Atom *Text::sectionHeadingAtom(const Atom *sectionLeft) void Text::dump() const { - const Atom *atom = firstAtom(); - while ( atom != 0 ) { + const Atom* atom = firstAtom(); + while (atom != 0) { QString str = atom->string(); - str.replace( "\\", "\\\\" ); - str.replace( "\"", "\\\"" ); - str.replace( "\n", "\\n" ); - str.replace( QRegExp("[^\x20-\x7e]"), "?" ); - if ( !str.isEmpty() ) + str.replace("\\", "\\\\"); + str.replace("\"", "\\\""); + str.replace("\n", "\\n"); + str.replace(QRegExp("[^\x20-\x7e]"), "?"); + if (!str.isEmpty()) str = " \"" + str + "\""; - fprintf(stderr, " %-15s%s\n", atom->typeString().toLatin1().data(), str.toLatin1().data() ); + fprintf(stderr, " %-15s%s\n", atom->typeString().toLatin1().data(), str.toLatin1().data()); atom = atom->next(); } } -Text Text::subText( const Atom *begin, const Atom *end ) +Text Text::subText(const Atom* begin, const Atom* end) { Text text; - if ( begin != 0 ) { - while ( begin != end ) { + if (begin != 0) { + while (begin != end) { text << *begin; begin = begin->next(); } @@ -234,8 +238,8 @@ Text Text::subText( const Atom *begin, const Atom *end ) void Text::clear() { - while ( first != 0 ) { - Atom *atom = first; + while (first != 0) { + Atom* atom = first; first = first->next(); delete atom; } @@ -250,8 +254,8 @@ int Text::compare(const Text &text1, const Text &text2) if (text2.isEmpty()) return 1; - const Atom *atom1 = text1.firstAtom(); - const Atom *atom2 = text2.firstAtom(); + const Atom* atom1 = text1.firstAtom(); + const Atom* atom2 = text2.firstAtom(); for (;;) { if (atom1->type() != atom2->type()) diff --git a/tools/qdoc3/text.h b/tools/qdoc3/text.h index 879f6da..93428ed 100644 --- a/tools/qdoc3/text.h +++ b/tools/qdoc3/text.h @@ -73,7 +73,7 @@ class Text QString toString() const; const Atom *firstAtom() const { return first; } const Atom *lastAtom() const { return last; } - Text subText(Atom::Type left, Atom::Type right, const Atom *from = 0) const; + Text subText(Atom::Type left, Atom::Type right, const Atom *from = 0, bool inclusive = false) const; void dump() const; void clear(); -- cgit v0.12 From 2ec8af79c81caf960c54913d0a57c89b74606b34 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 20 Oct 2010 13:40:49 +0200 Subject: qdoc: Fixed some DITA XML validation errors. --- tools/qdoc3/ditaxmlgenerator.cpp | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 668d6ed..062a023 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -1403,6 +1403,19 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, tableColumnCount = 0; break; case Atom::TableHeaderLeft: + if (inTableBody) { + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // + inTableHeader = false; + inTableBody = false; + tableColumnCount = 0; + xmlWriter().writeStartElement("table"); + numTableRows = 0; + tableColumnCount = countTableColumns(atom); + xmlWriter().writeStartElement("tgroup"); + xmlWriter().writeAttribute("cols",QString::number(tableColumnCount)); + } xmlWriter().writeStartElement("thead"); xmlWriter().writeAttribute("valign","top"); xmlWriter().writeStartElement("row"); @@ -1446,8 +1459,6 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, QString s = "span(" + spans[0] + "," + spans[1] + ")"; xmlWriter().writeAttribute("outputclass",s); } - if (!inTableHeader) - xmlWriter().writeStartElement("p"); } if (matchAhead(atom, Atom::ParaLeft)) skipAhead = 1; @@ -1457,7 +1468,6 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, if (inTableHeader) xmlWriter().writeEndElement(); // else { - xmlWriter().writeEndElement(); //

    xmlWriter().writeEndElement(); // } if (matchAhead(atom, Atom::ParaLeft)) @@ -1493,10 +1503,14 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, } break; case Atom::Target: + if (in_para) { + xmlWriter().writeEndElement(); //

    + in_para = false; + } xmlWriter().writeStartElement("p"); writeGuidAttribute(Doc::canonicalTitle(atom->string())); xmlWriter().writeAttribute("outputclass","target"); - xmlWriter().writeCharacters(protectEnc(atom->string())); + //xmlWriter().writeCharacters(protectEnc(atom->string())); xmlWriter().writeEndElement(); //

    break; case Atom::UnhandledFormat: -- cgit v0.12 From 0df0141ac041fdd65564908f233c29da0fd5c067 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 20 Oct 2010 14:02:22 +0200 Subject: doc: Moved some table headers to be before the rows. --- src/gui/painting/qpainter.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 7fed7e4..9afb62f 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -1113,14 +1113,14 @@ void QPainterPrivate::updateState(QPainterState *newState) the range of available patterns. \table - \row - \o \inlineimage qpainter-vectordeformation.png - \o \inlineimage qpainter-gradients.png - \o \inlineimage qpainter-pathstroking.png \header \o \l {demos/deform}{Vector Deformation} \o \l {demos/gradients}{Gradients} \o \l {demos/pathstroke}{Path Stroking} + \row + \o \inlineimage qpainter-vectordeformation.png + \o \inlineimage qpainter-gradients.png + \o \inlineimage qpainter-pathstroking.png \endtable @@ -1193,13 +1193,13 @@ void QPainterPrivate::updateState(QPainterState *newState) coordinate transformations. \table + \header + \o nop \o rotate() \o scale() \o translate() \row \o \inlineimage qpainter-clock.png \o \inlineimage qpainter-rotation.png \o \inlineimage qpainter-scale.png \o \inlineimage qpainter-translation.png - \header - \o nop \o rotate() \o scale() \o translate() \endtable The most commonly used transformations are scaling, rotation, -- cgit v0.12 From 4f91ec092e62f03cc68cde4d6a070d3caa8c657d Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 20 Oct 2010 14:42:43 +0200 Subject: doc: Moved some table headers before the rows. --- src/gui/painting/qpainterpath.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp index ffd0d5c..d96c9b7 100644 --- a/src/gui/painting/qpainterpath.cpp +++ b/src/gui/painting/qpainterpath.cpp @@ -240,12 +240,12 @@ static void qt_debug_path(const QPainterPath &path) provides two methods for filling paths: \table - \row - \o \inlineimage qt-fillrule-oddeven.png - \o \inlineimage qt-fillrule-winding.png \header \o Qt::OddEvenFill \o Qt::WindingFill + \row + \o \inlineimage qt-fillrule-oddeven.png + \o \inlineimage qt-fillrule-winding.png \endtable See the Qt::FillRule documentation for the definition of the @@ -315,12 +315,12 @@ static void qt_debug_path(const QPainterPath &path) QPainterPath to draw text. \table - \row - \o \inlineimage qpainterpath-example.png - \o \inlineimage qpainterpath-demo.png \header \o \l {painting/painterpaths}{Painter Paths Example} \o \l {demos/deform}{Vector Deformation Demo} + \row + \o \inlineimage qpainterpath-example.png + \o \inlineimage qpainterpath-demo.png \endtable \sa QPainterPathStroker, QPainter, QRegion, {Painter Paths Example} @@ -1244,12 +1244,12 @@ Qt::FillRule QPainterPath::fillRule() const fillRule. Qt provides two methods for filling paths: \table - \row - \o \inlineimage qt-fillrule-oddeven.png - \o \inlineimage qt-fillrule-winding.png \header \o Qt::OddEvenFill (default) \o Qt::WindingFill + \row + \o \inlineimage qt-fillrule-oddeven.png + \o \inlineimage qt-fillrule-winding.png \endtable \sa fillRule() -- cgit v0.12 From e3d8c3b9ca03a90be0b5032f195acfb4d0ce7bb4 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 20 Oct 2010 14:43:18 +0200 Subject: qdoc: Fixed some DITA XML validation errors. --- tools/qdoc3/ditaxmlgenerator.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 062a023..2d719cf 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -1333,6 +1333,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, xmlWriter().writeEndElement(); // break; case Atom::RawString: + qDebug() << "RAW:" << atom->string(); xmlWriter().writeCharacters(atom->string()); break; case Atom::SectionLeft: @@ -2597,6 +2598,8 @@ void DitaXmlGenerator::generateAnnotatedList(const Node* relative, CodeMarker* marker, const NodeMap& nodeMap) { + if (nodeMap.isEmpty()) + return; xmlWriter().writeStartElement("table"); xmlWriter().writeAttribute("outputclass","annotated"); xmlWriter().writeStartElement("tgroup"); -- cgit v0.12 From 1a0394398bbb7bb03356a5b06582f99d412366f6 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 20 Oct 2010 14:49:54 +0200 Subject: qdoc: Fixed some DITA XML validation errors. --- tools/qdoc3/ditaxmlgenerator.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 2d719cf..2e5652c 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -1094,11 +1094,11 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, if (atom->next() != 0) text = atom->next()->string(); if (fileName.isEmpty()) { - xmlWriter().writeStartElement("font"); - xmlWriter().writeAttribute("color","red"); + xmlWriter().writeStartElement("p"); + xmlWriter().writeAttribute("outputclass","error"); xmlWriter().writeCharacters("[Missing image: "); xmlWriter().writeCharacters(protectEnc(atom->string())); - xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); //

    } else { xmlWriter().writeStartElement("fig"); @@ -1333,7 +1333,6 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, xmlWriter().writeEndElement(); // break; case Atom::RawString: - qDebug() << "RAW:" << atom->string(); xmlWriter().writeCharacters(atom->string()); break; case Atom::SectionLeft: -- cgit v0.12 From b55cb6f7801dadc2b442589d9584f8946ac00a52 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 22 Oct 2010 13:48:21 +0200 Subject: doc: Moved some table headers ahead of the rows. --- src/gui/image/qimage.cpp | 8 ++++---- src/gui/painting/qbrush.cpp | 8 ++++---- src/gui/painting/qcolor.cpp | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 1157b93..2bb0897 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -513,12 +513,12 @@ bool QImageData::checkForAlphaPixels() const function. For example: \table + \header + \o {2,1}32-bit \row \o \inlineimage qimage-32bit_scaled.png \o \snippet doc/src/snippets/code/src_gui_image_qimage.cpp 0 - \header - \o {2,1}32-bit \endtable In case of a 8-bit and monchrome images, the pixel value is only @@ -534,12 +534,12 @@ bool QImageData::checkForAlphaPixels() const example: \table + \header + \o {2,1} 8-bit \row \o \inlineimage qimage-8bit_scaled.png \o \snippet doc/src/snippets/code/src_gui_image_qimage.cpp 1 - \header - \o {2,1} 8-bit \endtable QImage also provide the scanLine() function which returns a diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp index d0788c7..55e5ca4 100644 --- a/src/gui/painting/qbrush.cpp +++ b/src/gui/painting/qbrush.cpp @@ -1208,14 +1208,14 @@ QDataStream &operator>>(QDataStream &s, QBrush &b) Each of the types is represented by a subclass of QGradient: \table - \row - \o \inlineimage qgradient-linear.png - \o \inlineimage qgradient-radial.png - \o \inlineimage qgradient-conical.png \header \o QLinearGradient \o QRadialGradient \o QConicalGradient + \row + \o \inlineimage qgradient-linear.png + \o \inlineimage qgradient-radial.png + \o \inlineimage qgradient-conical.png \endtable The colors in a gradient are defined using stop points of the diff --git a/src/gui/painting/qcolor.cpp b/src/gui/painting/qcolor.cpp index 37d7fa3..b2ce69c 100644 --- a/src/gui/painting/qcolor.cpp +++ b/src/gui/painting/qcolor.cpp @@ -78,12 +78,12 @@ QT_BEGIN_NAMESPACE names. \table + \header + \o RGB \o HSV \o CMYK \row \o \inlineimage qcolor-rgb.png \o \inlineimage qcolor-hsv.png \o \inlineimage qcolor-cmyk.png - \header - \o RGB \o HSV \o CMYK \endtable The QColor constructor creates the color based on RGB values. To -- cgit v0.12 From b8ea919c8b77ef6b6e980dda12e9e907ab39653c Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 22 Oct 2010 13:49:27 +0200 Subject: qdoc: Output the \headerfile as a . --- tools/qdoc3/ditaxmlgenerator.cpp | 455 +++++++++++++++++++++++++-------------- tools/qdoc3/ditaxmlgenerator.h | 1 + 2 files changed, 299 insertions(+), 157 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 2e5652c..42fa40a 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -286,57 +286,6 @@ bool DitaXmlGenerator::inLegaleseText = false; #define CXXVARIABLESTORAGECLASSSPECIFIERSTATIC Doc::alias("cxxVariableStorageClassSpecifierStatic") #define CXXVARIABLEVOLATILE Doc::alias("cxxVariableVolatile") -#define APIREF Doc::alias("apiRef") -#define APINAME Doc::alias("apiName") -#define APIDETAIL Doc::alias("apiDetail") -#define APISYNTAX Doc::alias("apiSyntax") -#define APISYNTAXTEXT Doc::alias("apiSyntaxText") -#define APISYNTAXITEM Doc::alias("apiSyntaxItem") -#define APIDEF Doc::alias("apiDef") -#define APIQUALIFIER Doc::alias("apiQualifier") -#define APIRELATION Doc::alias("apiRelation") -#define APITYPE Doc::alias("apiType") -#define APIARRAY Doc::alias("apiArray") -#define APIDATA Doc::alias("apiData") -#define APIDEFNOTE Doc::alias("apiDefNote") -#define APIDEFITEM Doc::alias("apiDefItem") -#define APIITEMNAME Doc::alias("apiItemName") -#define APIDESC Doc::alias("apiDesc") -#define APIIMPL Doc::alias("apiImpl") - -#define APIPACKAGE Doc::alias("apiPackage") - -#define APICLASSIFIER Doc::alias("apiClassifier") -#define APICLASSIFIERDETAIL Doc::alias("apiClassifierDetail") -#define APICLASSIFIERDEF Doc::alias("apiClassifierDef") -#define APICLASSIFIERMEMBER Doc::alias("apiClassifierMember") -#define APIOTHERCLASSIFIER Doc::alias("apiOtherClassifier") -#define APIBASECLASSIFIER Doc::alias("apiBaseClassifier") - -#define APIOPERATION Doc::alias("apiOperation") -#define APIOPERATIONDETAIL Doc::alias("apiOperationDetail") -#define APIOPERATIONDEF Doc::alias("apiOperationDef") -#define APIRETURN Doc::alias("apiReturn") -#define APIPARAM Doc::alias("apiParam") -#define APIEVENT Doc::alias("apiEvent") -#define APIOPERATIONDEFITEM Doc::alias("apiOperationDefItem") -#define APIOPERATIONCLASSIFIER Doc::alias("apiOperationClassifier") -#define APICONSTRUCTORDEF Doc::alias("apiConstructorDef") - -#define APIVALUE Doc::alias("apiValue") -#define APIVALUEDETAIL Doc::alias("apiValueDetail") -#define APIVALUEDEF Doc::alias("apiValueDef") -#define APIVALUEMEMBER Doc::alias("apiValueMember") -#define APIVALUECLASSIFIER Doc::alias("apiValueClassifier") - -#define APIclassifier Doc::alias("apiclassifier") -#define APIoperation Doc::alias("apioperation") -#define APIpackage Doc::alias("apipackage") -#define APIvalue Doc::alias("apivalue") - -#define APIMAP Doc::alias("apiMap") -#define APIITEMREF Doc::alias("apiItemRef") - QString DitaXmlGenerator::sinceTitles[] = { " New Namespaces", @@ -1094,11 +1043,11 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, if (atom->next() != 0) text = atom->next()->string(); if (fileName.isEmpty()) { - xmlWriter().writeStartElement("p"); + xmlWriter().writeStartElement("b"); xmlWriter().writeAttribute("outputclass","error"); xmlWriter().writeCharacters("[Missing image: "); xmlWriter().writeCharacters(protectEnc(atom->string())); - xmlWriter().writeEndElement(); //

    + xmlWriter().writeEndElement(); // } else { xmlWriter().writeStartElement("fig"); @@ -1515,7 +1464,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, break; case Atom::UnhandledFormat: xmlWriter().writeStartElement("b"); - xmlWriter().writeAttribute("outputclass","redFont"); + xmlWriter().writeAttribute("outputclass","error"); xmlWriter().writeCharacters("<Missing DITAXML>"); xmlWriter().writeEndElement(); // break; @@ -1546,14 +1495,11 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark { QList
    ::ConstIterator s; - const ClassNode* cn = 0; - const NamespaceNode* nsn = 0; - QString title; QString rawTitle; QString fullTitle; if (inner->type() == Node::Namespace) { - nsn = const_cast(static_cast(inner)); + const NamespaceNode* nsn = const_cast(static_cast(inner)); rawTitle = marker->plainName(inner); fullTitle = marker->plainFullName(inner); title = rawTitle + " Namespace"; @@ -1574,7 +1520,7 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark writeLocation(nsn); xmlWriter().writeEndElement(); // - xmlWriter().writeStartElement(APIDESC); + xmlWriter().writeStartElement("apiDesc"); xmlWriter().writeAttribute("spectitle",title); Text brief = nsn->doc().briefText(); // zzz if (!brief.isEmpty()) { @@ -1586,29 +1532,6 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark generateStatus(nsn, marker); generateThreadSafeness(nsn, marker); generateSince(nsn, marker); - - xmlWriter().writeStartElement("ul"); - - QString membersLink = generateListOfAllMemberFile(inner, marker); - if (!membersLink.isEmpty()) { - writeXrefListItem(membersLink,"List of all members, including inherited members"); - } - - QString obsoleteLink = generateLowStatusMemberFile(inner, - marker, - CodeMarker::Obsolete); - if (!obsoleteLink.isEmpty()) { - writeXrefListItem(obsoleteLink,"Obsolete members"); - } - - QString compatLink = generateLowStatusMemberFile(inner, - marker, - CodeMarker::Compat); - if (!compatLink.isEmpty()) { - writeXrefListItem(compatLink,"Qt 3 support members"); - } - - xmlWriter().writeEndElement(); // xmlWriter().writeEndElement(); // bool needOtherSection = false; @@ -1700,10 +1623,31 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark } ++s; } +#if 0 + QString membersLink = generateListOfAllMemberFile(inner, marker); + QString obsoleteLink = generateLowStatusMemberFile(inner, + marker, + CodeMarker::Obsolete); + QString compatLink = generateLowStatusMemberFile(inner, + marker, + CodeMarker::Compat); + if (!membersLink.isEmpty() || + !obsoleteLink.isEmpty() || + !compatLink.isEmpty()) { + xmlWriter().writeStartElement("ul"); + if (!membersLink.isEmpty()) + writeXrefListItem(membersLink,"List of all members, including inherited members"); + if (!obsoleteLink.isEmpty()) + writeXrefListItem(obsoleteLink,"Obsolete members"); + if (!compatLink.isEmpty()) + writeXrefListItem(compatLink,"Qt 3 support members"); + xmlWriter().writeEndElement(); // + } +#endif xmlWriter().writeEndElement(); // } else if (inner->type() == Node::Class) { - cn = const_cast(static_cast(inner)); + const ClassNode* cn = const_cast(static_cast(inner)); rawTitle = marker->plainName(inner); fullTitle = marker->plainFullName(inner); title = rawTitle + " Class Reference"; @@ -1731,7 +1675,7 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark writeLocation(cn); xmlWriter().writeEndElement(); // - xmlWriter().writeStartElement(APIDESC); + xmlWriter().writeStartElement("apiDesc"); xmlWriter().writeAttribute("spectitle",title); Text brief = cn->doc().briefText(); // zzz if (!brief.isEmpty()) { @@ -1745,29 +1689,6 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark generateInheritedBy(cn, marker); generateThreadSafeness(cn, marker); generateSince(cn, marker); - - xmlWriter().writeStartElement("ul"); - - QString membersLink = generateListOfAllMemberFile(inner, marker); - if (!membersLink.isEmpty()) { - writeXrefListItem(membersLink,"List of all members, including inherited members"); - } - - QString obsoleteLink = generateLowStatusMemberFile(inner, - marker, - CodeMarker::Obsolete); - if (!obsoleteLink.isEmpty()) { - writeXrefListItem(obsoleteLink,"Obsolete members"); - } - - QString compatLink = generateLowStatusMemberFile(inner, - marker, - CodeMarker::Compat); - if (!compatLink.isEmpty()) { - writeXrefListItem(compatLink,"Qt 3 support members"); - } - - xmlWriter().writeEndElement(); // xmlWriter().writeEndElement(); // bool needOtherSection = false; @@ -1859,6 +1780,168 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark // not included: +#if 0 + QString membersLink = generateListOfAllMemberFile(inner, marker); + QString obsoleteLink = generateLowStatusMemberFile(inner, + marker, + CodeMarker::Obsolete); + QString compatLink = generateLowStatusMemberFile(inner, + marker, + CodeMarker::Compat); + if (!membersLink.isEmpty() || + !obsoleteLink.isEmpty() || + !compatLink.isEmpty()) { + xmlWriter().writeStartElement("ul"); + if (!membersLink.isEmpty()) + writeXrefListItem(membersLink,"List of all members, including inherited members"); + if (!obsoleteLink.isEmpty()) + writeXrefListItem(obsoleteLink,"Obsolete members"); + if (!compatLink.isEmpty()) + writeXrefListItem(compatLink,"Qt 3 support members"); + xmlWriter().writeEndElement(); // + } +#endif + xmlWriter().writeEndElement(); // + } + else if ((inner->type() == Node::Fake) && (inner->subType() == Node::HeaderFile)) { + const FakeNode* fn = const_cast(static_cast(inner)); + rawTitle = marker->plainName(inner); + fullTitle = marker->plainFullName(inner); + title = rawTitle; + + /* + Note: Because the C++ specialization we are using + has no element, we are using the + element with an outputclass attribute + set to "headerfile" . + */ + generateHeader(inner, fullTitle); + generateBrief(inner, marker); // + xmlWriter().writeStartElement(CXXCLASSDETAIL); + xmlWriter().writeStartElement("apiDesc"); + xmlWriter().writeAttribute("spectitle",title); + Text brief = fn->doc().briefText(); // zzz + if (!brief.isEmpty()) { + xmlWriter().writeStartElement("p"); + generateText(brief, fn, marker); + xmlWriter().writeEndElement(); //

    + } + generateIncludes(fn, marker); + generateStatus(fn, marker); + generateThreadSafeness(fn, marker); + generateSince(fn, marker); + xmlWriter().writeEndElement(); // + + bool needOtherSection = false; + QList
    summarySections; + summarySections = marker->sections(inner, CodeMarker::Summary, CodeMarker::Okay); + s = summarySections.begin(); + while (s != summarySections.end()) { + if (s->members.isEmpty() && s->reimpMembers.isEmpty()) { + if (!s->inherited.isEmpty()) + needOtherSection = true; + } + else { + QString attr; + if (!s->members.isEmpty()) { + xmlWriter().writeStartElement("section"); + attr = cleanRef((*s).name).toLower() + " redundant"; + xmlWriter().writeAttribute("outputclass",attr); + xmlWriter().writeStartElement("title"); + xmlWriter().writeAttribute("outputclass","h2"); + xmlWriter().writeCharacters(protectEnc((*s).name)); + xmlWriter().writeEndElement(); // + generateSection(s->members, inner, marker, CodeMarker::Summary); + generateSectionInheritedList(*s, inner, marker); + xmlWriter().writeEndElement(); //
    + } + if (!s->reimpMembers.isEmpty()) { + QString name = QString("Reimplemented ") + (*s).name; + attr = cleanRef(name).toLower() + " redundant"; + xmlWriter().writeStartElement("section"); + xmlWriter().writeAttribute("outputclass",attr); + xmlWriter().writeStartElement("title"); + xmlWriter().writeAttribute("outputclass","h2"); + xmlWriter().writeCharacters(protectEnc(name)); + xmlWriter().writeEndElement(); // + generateSection(s->reimpMembers, inner, marker, CodeMarker::Summary); + generateSectionInheritedList(*s, inner, marker); + xmlWriter().writeEndElement(); //
    + } + } + ++s; + } + if (needOtherSection) { + xmlWriter().writeStartElement("section"); + xmlWriter().writeAttribute("outputclass","additional-inherited-members redundant"); + xmlWriter().writeStartElement("title"); + xmlWriter().writeAttribute("outputclass","h3"); + xmlWriter().writeCharacters("Additional Inherited Members"); + xmlWriter().writeEndElement(); // + s = summarySections.begin(); + while (s != summarySections.end()) { + if (s->members.isEmpty()) + generateSectionInheritedList(*s, inner, marker); + ++s; + } + xmlWriter().writeEndElement(); //
    + } + + writeDetailedDescription(fn, marker, false, QString("Detailed Description")); + xmlWriter().writeEndElement(); // + + // not included: + // not included: + + QList
    detailSections; + detailSections = marker->sections(inner, CodeMarker::Detailed, CodeMarker::Okay); + s = detailSections.begin(); + while (s != detailSections.end()) { + if ((*s).name == "Classes") { + writeNestedClasses((*s),fn); + break; + } + ++s; + } + + s = detailSections.begin(); + while (s != detailSections.end()) { + if ((*s).name == "Function Documentation") { + writeFunctions((*s),fn,marker); + } + else if ((*s).name == "Type Documentation") { + writeEnumerations((*s),marker); + writeTypedefs((*s),marker); + } + else if ((*s).name == "Namespaces") { + qDebug() << "Nested namespaces" << outFileName(); + } + else if ((*s).name == "Macro Documentation") { + writeMacros((*s),marker); + } + ++s; + } +#if 0 + QString membersLink = generateListOfAllMemberFile(inner, marker); + QString obsoleteLink = generateLowStatusMemberFile(inner, + marker, + CodeMarker::Obsolete); + QString compatLink = generateLowStatusMemberFile(inner, + marker, + CodeMarker::Compat); + if (!membersLink.isEmpty() || + !obsoleteLink.isEmpty() || + !compatLink.isEmpty()) { + xmlWriter().writeStartElement("ul"); + if (!membersLink.isEmpty()) + writeXrefListItem(membersLink,"List of all members, including inherited members"); + if (!obsoleteLink.isEmpty()) + writeXrefListItem(obsoleteLink,"Obsolete members"); + if (!compatLink.isEmpty()) + writeXrefListItem(compatLink,"Qt 3 support members"); + xmlWriter().writeEndElement(); // + } +#endif xmlWriter().writeEndElement(); // } } @@ -1906,7 +1989,7 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker if (moduleNamespaceMap.contains(fake->name())) { xmlWriter().writeStartElement("section"); xmlWriter().writeAttribute("outputclass","namespaces"); - xmlWriter().writeStartElement("ttitle"); + xmlWriter().writeStartElement("title"); xmlWriter().writeAttribute("outputclass","h2"); xmlWriter().writeCharacters("Namespaces"); xmlWriter().writeEndElement(); // @@ -1924,6 +2007,7 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker xmlWriter().writeEndElement(); //
    } } +#if 0 else if (fake->subType() == Node::HeaderFile) { generateStatus(fake, marker); QString membersLink = generateListOfAllMemberFile(fake, marker); @@ -1951,11 +2035,12 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker xmlWriter().writeEndElement(); //
    } } +#endif else if (fake->subType() == Node::QmlClass) { const QmlClassNode* qml_cn = static_cast(fake); const ClassNode* cn = qml_cn->classNode(); xmlWriter().writeStartElement("section"); - xmlWriter().writeAttribute("outputclass","apidesc"); + xmlWriter().writeAttribute("outputclass","apiDesc"); generateQmlInstantiates(qml_cn, marker); generateQmlInherits(qml_cn, marker); generateQmlInheritedBy(qml_cn, marker); @@ -2074,45 +2159,7 @@ void DitaXmlGenerator::generateHeader(const Node* node, QString version; QString outputclass; - if (node->type() == Node::Fake || subpage) { - mainElement = "topic"; - nameElement = "title"; - dtd = "dtd/topic.dtd"; - doctype = ""; - switch (node->subType()) { - case Node::Page: - outputclass = "page"; - break; - case Node::Group: - outputclass = "group"; - break; - case Node::Example: - outputclass = "example"; - break; - case Node::HeaderFile: - outputclass = "headerfile"; - break; - case Node::File: - outputclass = "file"; - break; - case Node::Image: // not used - outputclass = "image"; - break; - case Node::Module: - outputclass = "module"; - break; - case Node::ExternalPage: // not used - outputclass = "externalpage"; - break; - case Node::QmlClass: - outputclass = "QML-class"; - break; - default: - outputclass = "page"; - } - } - else if (node->type() == Node::Class) { + if (node->type() == Node::Class) { mainElement = "cxxClass"; nameElement = "apiName"; dtd = "dtd/cxxClass.dtd"; @@ -2131,6 +2178,53 @@ void DitaXmlGenerator::generateHeader(const Node* node, version + "//EN\" \"" + dtd + "\">"; outputclass = "namespace"; } + else if (node->type() == Node::Fake || subpage) { + if (node->subType() == Node::HeaderFile) { + mainElement = "cxxClass"; + nameElement = "apiName"; + dtd = "dtd/cxxClass.dtd"; + version = "0.6.0"; + doctype = ""; + outputclass = "headerfile"; + } + else { + mainElement = "topic"; + nameElement = "title"; + dtd = "dtd/topic.dtd"; + doctype = ""; + switch (node->subType()) { + case Node::Page: + outputclass = "page"; + break; + case Node::Group: + outputclass = "group"; + break; + case Node::Example: + outputclass = "example"; + break; + case Node::File: + outputclass = "file"; + break; + case Node::Image: // not used + outputclass = "image"; + break; + case Node::Module: + outputclass = "module"; + break; + case Node::ExternalPage: // not used + outputclass = "externalpage"; + break; + case Node::QmlClass: + outputclass = "QML-class"; + break; + default: + outputclass = "page"; + } + } + } xmlWriter().writeDTD(doctype); xmlWriter().writeComment(node->doc().location().fileName()); @@ -2441,6 +2535,7 @@ QString DitaXmlGenerator::generateListOfAllMemberFile(const InnerNode* inner, return fileName; } +#if 0 QString DitaXmlGenerator::generateLowStatusMemberFile(const InnerNode* inner, CodeMarker* marker, CodeMarker::Status status) @@ -2539,6 +2634,7 @@ QString DitaXmlGenerator::generateLowStatusMemberFile(const InnerNode* inner, endSubPage(); return fileName; } +#endif /*! Write the XML for the class hierarchy to the current XML stream. @@ -4642,7 +4738,7 @@ void DitaXmlGenerator::writeFunctions(const Section& s, FunctionNode* fn = const_cast(static_cast(*m)); xmlWriter().writeStartElement(CXXFUNCTION); xmlWriter().writeAttribute("id",fn->guid()); - xmlWriter().writeStartElement(APINAME); + xmlWriter().writeStartElement("apiName"); if (fn->metaness() == FunctionNode::Signal) xmlWriter().writeAttribute("class","signal"); else if (fn->metaness() == FunctionNode::Slot) @@ -4811,7 +4907,7 @@ void DitaXmlGenerator::writeEnumerations(const Section& s, const EnumNode* en = static_cast(*m); xmlWriter().writeStartElement(CXXENUMERATION); xmlWriter().writeAttribute("id",en->guid()); - xmlWriter().writeStartElement(APINAME); + xmlWriter().writeStartElement("apiName"); xmlWriter().writeCharacters(en->name()); xmlWriter().writeEndElement(); // generateBrief(en,marker); @@ -4861,7 +4957,7 @@ void DitaXmlGenerator::writeEnumerations(const Section& s, QList::ConstIterator i = items.begin(); while (i != items.end()) { xmlWriter().writeStartElement(CXXENUMERATOR); - xmlWriter().writeStartElement(APINAME); + xmlWriter().writeStartElement("apiName"); xmlWriter().writeCharacters((*i).name()); xmlWriter().writeEndElement(); // @@ -4887,7 +4983,7 @@ void DitaXmlGenerator::writeEnumerations(const Section& s, // not included: if (!(*i).text().isEmpty()) { - xmlWriter().writeStartElement(APIDESC); + xmlWriter().writeStartElement("apiDesc"); generateText((*i).text(), en, marker); xmlWriter().writeEndElement(); // } @@ -4926,7 +5022,7 @@ void DitaXmlGenerator::writeTypedefs(const Section& s, const TypedefNode* tn = static_cast(*m); xmlWriter().writeStartElement(CXXTYPEDEF); xmlWriter().writeAttribute("id",tn->guid()); - xmlWriter().writeStartElement(APINAME); + xmlWriter().writeStartElement("apiName"); xmlWriter().writeCharacters(tn->name()); xmlWriter().writeEndElement(); // generateBrief(tn,marker); @@ -4986,7 +5082,7 @@ void DitaXmlGenerator::writeProperties(const Section& s, const PropertyNode* pn = static_cast(*m); xmlWriter().writeStartElement(CXXVARIABLE); xmlWriter().writeAttribute("id",pn->guid()); - xmlWriter().writeStartElement(APINAME); + xmlWriter().writeStartElement("apiName"); xmlWriter().writeCharacters(pn->name()); xmlWriter().writeEndElement(); // generateBrief(pn,marker); @@ -5095,7 +5191,7 @@ void DitaXmlGenerator::writeDataMembers(const Section& s, const VariableNode* vn = static_cast(*m); xmlWriter().writeStartElement(CXXVARIABLE); xmlWriter().writeAttribute("id",vn->guid()); - xmlWriter().writeStartElement(APINAME); + xmlWriter().writeStartElement("apiName"); xmlWriter().writeCharacters(vn->name()); xmlWriter().writeEndElement(); // generateBrief(vn,marker); @@ -5177,7 +5273,7 @@ void DitaXmlGenerator::writeMacros(const Section& s, if (fn->isMacro()) { xmlWriter().writeStartElement(CXXDEFINE); xmlWriter().writeAttribute("id",fn->guid()); - xmlWriter().writeStartElement(APINAME); + xmlWriter().writeStartElement("apiName"); xmlWriter().writeCharacters(fn->name()); xmlWriter().writeEndElement(); // generateBrief(fn,marker); @@ -5337,7 +5433,7 @@ void DitaXmlGenerator::writeDetailedDescription(const Node* node, inDetailedDescription = true; if (apiDesc) { inApiDesc = true; - xmlWriter().writeStartElement(APIDESC); + xmlWriter().writeStartElement("apiDesc"); if (!title.isEmpty()) { writeGuidAttribute(title); xmlWriter().writeAttribute("spectitle",title); @@ -5402,4 +5498,49 @@ void DitaXmlGenerator::writeNestedClasses(const Section& s, xmlWriter().writeEndElement(); // } +/*! + Recursive writing of DITA XML files from the root \a node. + */ +void +DitaXmlGenerator::generateInnerNode(const InnerNode* node, CodeMarker* marker) +{ + if (!node->url().isNull()) + return; + + if (node->type() == Node::Fake) { + const FakeNode *fakeNode = static_cast(node); + if (fakeNode->subType() == Node::ExternalPage) + return; + if (fakeNode->subType() == Node::Image) + return; + if (fakeNode->subType() == Node::QmlPropertyGroup) + return; + if (fakeNode->subType() == Node::Page) { + if (node->count() > 0) + qDebug("PAGE %s HAS CHILDREN", qPrintable(fakeNode->title())); + } + } + + if (node->parent() != 0) { + beginSubPage(node->location(), fileName(node)); + if (node->type() == Node::Namespace || node->type() == Node::Class) { + generateClassLikeNode(node, marker); + } + else if (node->type() == Node::Fake) { + if (node->subType() == Node::HeaderFile) + generateClassLikeNode(node, marker); + else + generateFakeNode(static_cast(node), marker); + } + endSubPage(); + } + + NodeList::ConstIterator c = node->childNodes().begin(); + while (c != node->childNodes().end()) { + if ((*c)->isInnerNode() && (*c)->access() != Node::Private) + generateInnerNode((const InnerNode*) *c, marker); + ++c; + } +} + QT_END_NAMESPACE diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index 0a9fc4a..b457061 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -246,6 +246,7 @@ class DitaXmlGenerator : public PageGenerator GuidMap* lookupGuidMap(const QString& fileName); virtual void beginSubPage(const Location& location, const QString& fileName); virtual void endSubPage(); + virtual void generateInnerNode(const InnerNode* node, CodeMarker* marker); QXmlStreamWriter& xmlWriter(); void writeDetailedDescription(const Node* node, CodeMarker* marker, -- cgit v0.12 From 68d0073707e8c3e3d7a5f93b5cf8ba9d02e2a468 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Sat, 23 Oct 2010 11:00:46 +0200 Subject: qdoc: Output the \qmlclass as a . Still more work to do here to make the detail sections correct. --- tools/qdoc3/ditaxmlgenerator.cpp | 155 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 151 insertions(+), 4 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 42fa40a..8ae109d 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -1944,8 +1944,146 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark #endif xmlWriter().writeEndElement(); // } + else if ((inner->type() == Node::Fake) && (inner->subType() == Node::QmlClass)) { + const QmlClassNode* qcn = const_cast(static_cast(inner)); + const ClassNode* cn = qcn->classNode(); + rawTitle = marker->plainName(inner); + fullTitle = marker->plainFullName(inner); + title = rawTitle + " Element Reference"; + //QString fullTitle = fake->fullTitle(); + //QString htmlTitle = fullTitle; + + generateHeader(inner, fullTitle); + generateBrief(inner, marker); // + + // not included: + + xmlWriter().writeStartElement(CXXCLASSDETAIL); + xmlWriter().writeStartElement("apiDesc"); + xmlWriter().writeAttribute("spectitle",title); + Text brief = qcn->doc().briefText(); // zzz + if (!brief.isEmpty()) { + xmlWriter().writeStartElement("p"); + generateText(brief, qcn, marker); + xmlWriter().writeEndElement(); //

    + } + generateQmlInstantiates(qcn, marker); + generateQmlInherits(qcn, marker); + generateQmlInheritedBy(qcn, marker); + generateSince(qcn, marker); + xmlWriter().writeEndElement(); // + + QList
    summarySections; + summarySections = marker->qmlSections(qcn,CodeMarker::Summary,0); + s = summarySections.begin(); + while (s != summarySections.end()) { + QString attr; + if (!s->members.isEmpty()) { + xmlWriter().writeStartElement("section"); + attr = cleanRef((*s).name).toLower() + " redundant"; + xmlWriter().writeAttribute("outputclass",attr); + xmlWriter().writeStartElement("title"); + xmlWriter().writeAttribute("outputclass","h2"); + xmlWriter().writeCharacters(protectEnc((*s).name)); + xmlWriter().writeEndElement(); // + generateQmlSummary(*s,qcn,marker); + //generateSection(s->members, inner, marker, CodeMarker::Summary); + //generateSectionInheritedList(*s, inner, marker); + xmlWriter().writeEndElement(); //
    + } + if (!s->reimpMembers.isEmpty()) { + qDebug() << "GOT HEAH!"; + QString name = QString("Reimplemented ") + (*s).name; + attr = cleanRef(name).toLower() + " redundant"; + xmlWriter().writeStartElement("section"); + xmlWriter().writeAttribute("outputclass",attr); + xmlWriter().writeStartElement("title"); + xmlWriter().writeAttribute("outputclass","h2"); + xmlWriter().writeCharacters(protectEnc(name)); + xmlWriter().writeEndElement(); // + generateSection(s->reimpMembers, inner, marker, CodeMarker::Summary); + generateSectionInheritedList(*s, inner, marker); + xmlWriter().writeEndElement(); //
    + } + ++s; + } + + writeDetailedDescription(qcn, marker, false, QString("Detailed Description")); + if (cn) + generateQmlText(cn->doc().body(), cn, marker, qcn->name()); + + QList
    detailSections; + detailSections = marker->qmlSections(qcn,CodeMarker::Detailed,0); + s = detailSections.begin(); + while (s != detailSections.end()) { + if (!s->members.isEmpty()) { + QString attr; + xmlWriter().writeStartElement("section"); + attr = cleanRef((*s).name).toLower(); + xmlWriter().writeAttribute("outputclass",attr); + xmlWriter().writeStartElement("title"); + xmlWriter().writeAttribute("outputclass","h2"); + xmlWriter().writeCharacters(protectEnc((*s).name)); + xmlWriter().writeEndElement(); // + NodeList::ConstIterator m = (*s).members.begin(); + while (m != (*s).members.end()) { + generateDetailedQmlMember(*m, qcn, marker); + ++m; + } + xmlWriter().writeEndElement(); //
    + } + ++s; + } + + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // + } } + +#if 0 + while (s != detailSections.end()) { + if ((*s).name == "Member Function Documentation") { + writeFunctions((*s),qcn,marker); + } + else if ((*s).name == "Member Type Documentation") { + writeEnumerations((*s),marker); + writeTypedefs((*s),marker); + } + else if ((*s).name == "Member Variable Documentation") { + writeDataMembers((*s),marker); + } + else if ((*s).name == "Property Documentation") { + writeProperties((*s),marker); + } + else if ((*s).name == "Macro Documentation") { + writeMacros((*s),marker); + } + ++s; + } +#endif +#if 0 + QString membersLink = generateListOfAllMemberFile(inner, marker); + QString obsoleteLink = generateLowStatusMemberFile(inner, + marker, + CodeMarker::Obsolete); + QString compatLink = generateLowStatusMemberFile(inner, + marker, + CodeMarker::Compat); + if (!membersLink.isEmpty() || + !obsoleteLink.isEmpty() || + !compatLink.isEmpty()) { + xmlWriter().writeStartElement("ul"); + if (!membersLink.isEmpty()) + writeXrefListItem(membersLink,"List of all members, including inherited members"); + if (!obsoleteLink.isEmpty()) + writeXrefListItem(obsoleteLink,"Obsolete members"); + if (!compatLink.isEmpty()) + writeXrefListItem(compatLink,"Qt 3 support members"); + xmlWriter().writeEndElement(); // + } +#endif + /*! Write a list item for a \a link with the given \a text. */ @@ -2035,7 +2173,6 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker xmlWriter().writeEndElement(); //
    } } -#endif else if (fake->subType() == Node::QmlClass) { const QmlClassNode* qml_cn = static_cast(fake); const ClassNode* cn = qml_cn->classNode(); @@ -2091,6 +2228,7 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker xmlWriter().writeEndElement(); // return; } +#endif if (fake->doc().isEmpty()) { if (fake->subType() == Node::File) { @@ -2189,6 +2327,16 @@ void DitaXmlGenerator::generateHeader(const Node* node, version + "//EN\" \"" + dtd + "\">"; outputclass = "headerfile"; } + else if (node->subType() == Node::QmlClass) { + mainElement = "cxxClass"; + nameElement = "apiName"; + dtd = "dtd/cxxClass.dtd"; + version = "0.6.0"; + doctype = ""; + outputclass = "QML-class"; + } else { mainElement = "topic"; nameElement = "title"; @@ -2217,9 +2365,6 @@ void DitaXmlGenerator::generateHeader(const Node* node, case Node::ExternalPage: // not used outputclass = "externalpage"; break; - case Node::QmlClass: - outputclass = "QML-class"; - break; default: outputclass = "page"; } @@ -5529,6 +5674,8 @@ DitaXmlGenerator::generateInnerNode(const InnerNode* node, CodeMarker* marker) else if (node->type() == Node::Fake) { if (node->subType() == Node::HeaderFile) generateClassLikeNode(node, marker); + else if (node->subType() == Node::QmlClass) + generateClassLikeNode(node, marker); else generateFakeNode(static_cast(node), marker); } -- cgit v0.12 From af7346651038054b1cc72e2475a01315fbc9966e Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 25 Oct 2010 09:46:48 +0200 Subject: doc: Moved a \target that was in the wrong place. --- doc/src/widgets-and-layouts/stylesheet.qdoc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/doc/src/widgets-and-layouts/stylesheet.qdoc b/doc/src/widgets-and-layouts/stylesheet.qdoc index 6343e6a..e02e8c2 100644 --- a/doc/src/widgets-and-layouts/stylesheet.qdoc +++ b/doc/src/widgets-and-layouts/stylesheet.qdoc @@ -2091,8 +2091,7 @@ \row - \o \bold{\c messagebox-text- \target messagebox-text-interaction-flags-prop - \BR \c interaction-flags}* + \o \bold{\c messagebox-text-interaction-flags*} \target messagebox-text-interaction-flags-prop \o \l{#Number}{Number} \o The interaction behavior for text in a message box. Possible values are based on Qt::TextInteractionFlags. -- cgit v0.12 From 89df9c49f89a66feef720bcc81fba84c5632552f Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 25 Oct 2010 09:47:58 +0200 Subject: qdoc: Fixed some DITA XML validation errors. --- tools/qdoc3/ditaxmlgenerator.cpp | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 8ae109d..3397033 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -1276,10 +1276,10 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, } break; case Atom::QuotationLeft: - xmlWriter().writeStartElement("blockquote"); + xmlWriter().writeStartElement("lq"); break; case Atom::QuotationRight: - xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // break; case Atom::RawString: xmlWriter().writeCharacters(atom->string()); @@ -1991,20 +1991,6 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark //generateSectionInheritedList(*s, inner, marker); xmlWriter().writeEndElement(); //
    } - if (!s->reimpMembers.isEmpty()) { - qDebug() << "GOT HEAH!"; - QString name = QString("Reimplemented ") + (*s).name; - attr = cleanRef(name).toLower() + " redundant"; - xmlWriter().writeStartElement("section"); - xmlWriter().writeAttribute("outputclass",attr); - xmlWriter().writeStartElement("title"); - xmlWriter().writeAttribute("outputclass","h2"); - xmlWriter().writeCharacters(protectEnc(name)); - xmlWriter().writeEndElement(); // - generateSection(s->reimpMembers, inner, marker, CodeMarker::Summary); - generateSectionInheritedList(*s, inner, marker); - xmlWriter().writeEndElement(); //
    - } ++s; } @@ -2018,6 +2004,7 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark while (s != detailSections.end()) { if (!s->members.isEmpty()) { QString attr; + inSection = true; xmlWriter().writeStartElement("section"); attr = cleanRef((*s).name).toLower(); xmlWriter().writeAttribute("outputclass",attr); @@ -2031,6 +2018,7 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark ++m; } xmlWriter().writeEndElement(); //
    + inSection = false; } ++s; } -- cgit v0.12 From b0d64717d2c541976dc5524e4100c62f060e206f Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 25 Oct 2010 11:07:37 +0200 Subject: doc: Changed a table into 3 tables to eliminate a \raw. --- src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc b/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc index 0335d46..2be8e5e 100644 --- a/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc +++ b/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc @@ -103,8 +103,8 @@ The following locations are searched for plugins: \table - \header \o Linux/Unix (X11) \o Windows - \row \o{1,3} + \header \o Linux/Unix (X11) + \row \o \list \o \c{.mozilla/plugins} in the user's home directory \o \c{.netscape/plugins} in the user's home directory @@ -134,19 +134,20 @@ \o \c{$QTWEBKIT_PLUGIN_PATH} \endlist \endlist + \endtable - \o + \table + \header \o Windows + \row \o \list \o The user's \c{Application Data\Mozilla\plugins} directory \o Standard system locations of plugins for Quicktime, Flash, etc. \endlist + \endtable - \row - \raw HTML - Mac OS X - \endraw - \row - \o + \table + \header \o Mac OS X + \row \o \list \o \c{Library/Internet Plug-Ins} in the user's home directory \o The system \c{/Library/Internet Plug-Ins} directory -- cgit v0.12 From db88727a7dbf46e773745a7e22da6cf1e91611a8 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 25 Oct 2010 11:19:51 +0200 Subject: doc: Changed a \section in a \table into a \header. --- src/corelib/tools/qstring.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index d8dab43..74eb7d4 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -646,10 +646,12 @@ const QString::Null QString::null = { }; class.) \table 100 % - \row + \header \o \section1 Note for C Programmers + \row + \o Due to C++'s type system and the fact that QString is \l{implicitly shared}, QStrings may be treated like \c{int}s or other basic types. For example: -- cgit v0.12 From 7e11ffb60b2c1259b1d43f99147db53c0f004f25 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 25 Oct 2010 11:32:49 +0200 Subject: doc: Removed illegal \section1. --- src/corelib/tools/qstring.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index 74eb7d4..8083aee 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -647,8 +647,7 @@ const QString::Null QString::null = { }; \table 100 % \header - \o - \section1 Note for C Programmers + \o Note for C Programmers \row \o -- cgit v0.12 From cbcaa64e3ff7ad8293c95df938901694b3f472bd Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 25 Oct 2010 12:30:07 +0200 Subject: doc: Moved many \target commands that were in the wrong place. --- doc/src/widgets-and-layouts/stylesheet.qdoc | 62 +++++++++++++---------------- 1 file changed, 27 insertions(+), 35 deletions(-) diff --git a/doc/src/widgets-and-layouts/stylesheet.qdoc b/doc/src/widgets-and-layouts/stylesheet.qdoc index e02e8c2..b35232e 100644 --- a/doc/src/widgets-and-layouts/stylesheet.qdoc +++ b/doc/src/widgets-and-layouts/stylesheet.qdoc @@ -1995,7 +1995,7 @@ \l{#bottom-prop}{bottom}. \row - \o \bold{\c lineedit-password- \BR \c character}* \target lineedit-password-character-prop + \o \bold{\c lineedit-password-character*} \target lineedit-password-character-prop \o \l{#Number}{Number} \o The QLineEdit password character as a Unicode number. @@ -2152,7 +2152,7 @@ See also \l{#min-height-prop}{min-height}. \row - \o \bold{\c opacity}* \target opacity-prop + \o \bold{\c opacity*} \target opacity-prop \o \l{#Number}{Number} \o The opacity for a widget. Possible values are from 0 (transparent) to 255 (opaque). For the moment, this is @@ -2248,7 +2248,7 @@ \l{#bottom-prop}{bottom}. \row - \o \bold{\c selection-background-color}* \target selection-background-color-prop + \o \bold{\c selection-background-color*} \target selection-background-color-prop \o \l{#Brush}{Brush} \BR \o The background of selected text or items. @@ -2267,7 +2267,7 @@ \l{Qt Style Sheets Reference#background-prop}{background}. \row - \o \bold{\c selection-color}* \target selection-color-prop + \o \bold{\c selection-color*} \target selection-color-prop \o \l{#Brush}{Brush} \BR \o The foreground of selected text or items. @@ -2287,8 +2287,7 @@ and \l{#color-prop}{color}. \row - \o \bold{\c show-decoration- \target show-decoration-selected-prop - \BR \c selected}* + \o \bold{\c show-decoration-selected*} \target show-decoration-selected-prop \o \l{#Boolean}{Boolean} \o Controls whether selections in a QListView cover the entire row or just the extent of the text. @@ -2303,7 +2302,7 @@ \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 73 \row - \o \bold{\c spacing}* \target spacing-prop + \o \bold{\c spacing*} \target spacing-prop \o \l{#Length}{Length} \o Internal spacing in the widget. @@ -2321,7 +2320,7 @@ \l{#margin-prop}{margin}. \row - \o \bold{\c subcontrol-origin}* \target subcontrol-origin-prop + \o \bold{\c subcontrol-origin*} \target subcontrol-origin-prop \o \l{#Origin}{Origin} \o The origin rectangle of the \l subcontrol within the parent element. @@ -2337,7 +2336,7 @@ \l{Qt Style Sheets Reference#subcontrol-position-prop}{subcontrol-position}. \row - \o \bold{\c subcontrol-position}* \target subcontrol-position-prop + \o \bold{\c subcontrol-position*} \target subcontrol-position-prop \o \l{#Alignment}{Alignment} \o The alignment of the \l subcontrol within the origin rectangle specified by \l{Qt Style Sheets Reference#subcontrol-origin-prop} @@ -2705,8 +2704,7 @@ \o Shorthand border property. \row - \o \bold{Border \target Border Image - Image} + \o \bold{Border Image} \target Border Image \o \c none \BR | \l{Url} \l{Number}\{4\} \BR (\c stretch | \c repeat){0,2} \o A border image is an image that is composed of nine parts @@ -2722,8 +2720,7 @@ {CSS3 Draft Specification} for details. \row - \o \bold{Border \target Border Style - Style} + \o \bold{Border Style} \target Border Style \o \c dashed \BR | \c dot-dash \BR | \c dot-dot-dash \BR @@ -2740,8 +2737,7 @@ {CSS3 Draft Specification} for details. \row - \o \bold{Box \target Box Colors - Colors} + \o \bold{Box Colors} \target Box Colors \o \l{#Brush}{Brush}\{1,4\} \o One to four occurrences of \l{#Brush}{Brush}, specifying the top, right, bottom, and left edges of a box, respectively. If @@ -2756,8 +2752,7 @@ \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 82 \row - \o \bold{Box \target Box Lengths - Lengths} + \o \bold{Box Lengths} \target Box Lengths \o \l{#Length}{Length}\{1,4\} \o One to four occurrences of \l{#Length}{Length}, specifying the top, right, bottom, and left edges of a box, @@ -2772,14 +2767,14 @@ \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 83 \row - \o \bold Brush \target Brush + \o \bold{Brush} \target Brush \o \l{#Color}{Color} \BR | \l{Gradient} \BR | \l{PaletteRole} \o Specifies a Color or a Gradient or an entry in the Palette. \row - \o \bold Color \target Color + \o \bold{Color} \target Color \o \tt{rgb(\e{r}, \e{g}, \e{b})} \BR | \tt{rgba(\e{r}, \e{g}, \e{b}, \e{a})} \BR | \tt{hsv(\e{h}, \e{s}, \e{v})} \BR @@ -2802,27 +2797,24 @@ \l{http://www.w3.org/TR/CSS21/syndata.html#color-units}{here}. \row - \o \bold Font \target Font + \o \bold{Font} \target Font \o (\l{#Font Style}{Font Style} | \l{#Font Weight}{Font Weight}){0,2} \l{#Font Size}{Font Size} String \o Shorthand font property. \row - \o \bold{Font \target Font Size - Size} + \o \bold{Font Size} \target Font Size \o \l{Length} \o The size of a font. \row - \o \bold{Font \target Font Style - Style} + \o \bold{Font Style} \target Font Style \o \c normal \BR | \c italic \BR | \c oblique \o The style of a font. \row - \o \bold{Font \target Font Weight - Weight} + \o \bold{Font Weight} \target Font Weight \o \c normal \BR | \c bold \BR | \c 100 \BR @@ -2832,7 +2824,7 @@ \o The weight of a font. \row - \o \bold Gradient \target Gradient + \o \bold{Gradient} \target Gradient \o \c qlineargradient \BR | \c qradialgradient \BR | \c qconicalgradient @@ -2862,7 +2854,7 @@ \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 85 \row - \o \bold Icon \target Icon + \o \bold{Icon} \target Icon \o (\l{#Url}{Url} (\c disabled | \c active | \c normal | \c selected)? (\c on | \c off)? )* \o A list of url, QIcon::Mode and QIcon::State. @@ -2871,7 +2863,7 @@ \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 86 \row - \o \bold Length \target Length + \o \bold{Length} \target Length \o \l{#Number}{Number} (\c px | \c pt | \c em | \c ex)? \o A number followed by a measurement unit. The CSS standard recommends that user agents must @@ -2889,13 +2881,13 @@ \endlist \row - \o \bold Number \target Number + \o \bold{Number} \target Number \o A decimal integer or a real number \o Examples: \c 0, \c 18, \c +127, \c -255, \c 12.34, \c -.5, \c 0009. \row - \o \bold Origin \target Origin + \o \bold{Origin} \target Origin \o \c margin \BR | \c border \BR | \c padding \BR @@ -2915,7 +2907,7 @@ See also \l{The Box Model}. \row - \o \bold PaletteRole \target PaletteRole + \o \bold{PaletteRole} \target PaletteRole \o \c alternate-base \BR | \c base \BR | \c bright-text \BR @@ -2940,7 +2932,7 @@ \snippet doc/src/snippets/code/doc_src_stylesheet.qdoc 87 \row - \o \bold Radius \target Radius + \o \bold{Radius} \target Radius \o \l{#Length}{Length}\{1, 2\} \o One or two occurrences of \l{#Length}{Length}. If only one length is specified, it is used as the radius of the quarter circle @@ -2949,7 +2941,7 @@ ellipse, whereas the second length is the vertical radius. \row - \o \bold Repeat \target Repeat + \o \bold{Repeat} \target Repeat \o \c repeat-x \BR | \c repeat-y \BR | \c repeat \BR @@ -2964,7 +2956,7 @@ \endlist \row - \o \bold Url \target Url + \o \bold{Url} \target Url \o \tt{url(\e{filename})} \o \tt{\e{filename}} is the name of a file on the local disk or stored using \l{the Qt Resource System}. Setting an -- cgit v0.12 From 766b23e722743c0b99c03cf4a035b5b20cb8a88f Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 25 Oct 2010 12:30:50 +0200 Subject: qdoc: Fixed some DITA XML validation errors. --- tools/qdoc3/ditaxmlgenerator.cpp | 11 +++++++++++ tools/qdoc3/ditaxmlgenerator.h | 2 +- tools/qdoc3/generator.h | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 3397033..e1aa519 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -1282,7 +1282,10 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, xmlWriter().writeEndElement(); // break; case Atom::RawString: + xmlWriter().writeStartElement("pre"); + xmlWriter().writeAttribute("outputclass","raw-html"); xmlWriter().writeCharacters(atom->string()); + xmlWriter().writeEndElement(); // break; case Atom::SectionLeft: if (inSection || inApiDesc) { @@ -5678,4 +5681,12 @@ DitaXmlGenerator::generateInnerNode(const InnerNode* node, CodeMarker* marker) } } +/*! + Returns true if \a format is "XML" or "HTML" . + */ +bool DitaXmlGenerator::canHandleFormat(const QString& format) +{ + return (format == "HTML") || (format == this->format()); +} + QT_END_NAMESPACE diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index b457061..afa77bb 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -88,6 +88,7 @@ class DitaXmlGenerator : public PageGenerator virtual void initializeGenerator(const Config& config); virtual void terminateGenerator(); virtual QString format(); + virtual bool canHandleFormat(const QString& format); virtual void generateTree(const Tree* tree, CodeMarker* marker); QString protectEnc(const QString& string); @@ -326,4 +327,3 @@ class DitaXmlGenerator : public PageGenerator QT_END_NAMESPACE #endif - diff --git a/tools/qdoc3/generator.h b/tools/qdoc3/generator.h index bccfc5d..26d5269 100644 --- a/tools/qdoc3/generator.h +++ b/tools/qdoc3/generator.h @@ -114,7 +114,7 @@ class Generator void generateThreadSafeness(const Node *node, CodeMarker *marker); void generateSince(const Node *node, CodeMarker *marker); void generateStatus(const Node *node, CodeMarker *marker); - const Atom *generateAtomList(const Atom *atom, + const Atom* generateAtomList(const Atom *atom, const Node *relative, CodeMarker *marker, bool generate, -- cgit v0.12 From cd3d9ea937a77c5caad276ac279e550ae74b60d6 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 25 Oct 2010 13:18:14 +0200 Subject: doc: Fixed some DITA XML validation errors. --- doc/src/internationalization/linguist-manual.qdoc | 2 +- doc/src/platforms/emb-qvfb.qdoc | 1 - tools/qdoc3/ditaxmlgenerator.cpp | 14 ++++++++++---- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/doc/src/internationalization/linguist-manual.qdoc b/doc/src/internationalization/linguist-manual.qdoc index 57b98b8..baf37b0 100644 --- a/doc/src/internationalization/linguist-manual.qdoc +++ b/doc/src/internationalization/linguist-manual.qdoc @@ -95,7 +95,7 @@ \o A single phrase may need to be translated into several different forms depending on context, e.g. \e open in English - might become \e{\ouml\c{}ffnen}, "open file", or \e aufbauen, + might become \e{\ouml}\e{ffnen}, "open file", or \e aufbauen, "open internet connection", in German. \o Keyboard accelerators may need to be changed but without diff --git a/doc/src/platforms/emb-qvfb.qdoc b/doc/src/platforms/emb-qvfb.qdoc index 4be2f64..78bdd73 100644 --- a/doc/src/platforms/emb-qvfb.qdoc +++ b/doc/src/platforms/emb-qvfb.qdoc @@ -197,7 +197,6 @@ for the button are redrawn from the activated skin. \row - \row \o \image qt-embedded-clamshellphone-closed.png The ClamshellPhone Skin (closed) \o diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index e1aa519..bb2e817 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -1282,10 +1282,16 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, xmlWriter().writeEndElement(); // break; case Atom::RawString: - xmlWriter().writeStartElement("pre"); - xmlWriter().writeAttribute("outputclass","raw-html"); - xmlWriter().writeCharacters(atom->string()); - xmlWriter().writeEndElement(); // + if (atom->string() == " ") + break; + if (atom->string().startsWith("&")) + xmlWriter().writeCharacters(atom->string()); + else { + xmlWriter().writeStartElement("pre"); + xmlWriter().writeAttribute("outputclass","raw-html"); + xmlWriter().writeCharacters(atom->string()); + xmlWriter().writeEndElement(); // + } break; case Atom::SectionLeft: if (inSection || inApiDesc) { -- cgit v0.12 From 7f8bb137427160070c3461fc161199f82d4731e4 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Tue, 26 Oct 2010 10:30:58 +0200 Subject: doc: Fixed some DITA XML validation errors. Also fixed a bug in qdoc3 for html generation. --- tools/qdoc3/atom.h | 64 ++++++++++++++++++++-------------------- tools/qdoc3/ditaxmlgenerator.cpp | 4 +-- tools/qdoc3/doc.cpp | 2 +- 3 files changed, 34 insertions(+), 36 deletions(-) diff --git a/tools/qdoc3/atom.h b/tools/qdoc3/atom.h index 13df07b..4639711 100644 --- a/tools/qdoc3/atom.h +++ b/tools/qdoc3/atom.h @@ -56,20 +56,20 @@ class Atom { public: enum Type { - AbstractLeft, - AbstractRight, + AbstractLeft, // 00 + AbstractRight, AnnotatedList, AutoLink, - BaseName, + BaseName, BriefLeft, - BriefRight, + BriefRight, C, - CaptionLeft, + CaptionLeft, CaptionRight, - Code, - CodeBad, - CodeNew, - CodeOld, + Code, // 10 + CodeBad, + CodeNew, + CodeOld, CodeQuoteArgument, CodeQuoteCommand, #ifdef QDOC_QML @@ -77,59 +77,59 @@ class Atom #endif FootnoteLeft, FootnoteRight, - FormatElse, - FormatEndif, + FormatElse, + FormatEndif, // 20 FormatIf, FormattingLeft, FormattingRight, GeneratedList, GuidLink, - Image, + Image, ImageText, InlineImage, LegaleseLeft, - LegaleseRight, - LineBreak, - Link, + LegaleseRight, // 30 + LineBreak, + Link, LinkNode, - ListLeft, + ListLeft, ListItemNumber, - ListTagLeft, - ListTagRight, - ListItemLeft, - ListItemRight, - ListRight, - Nop, + ListTagLeft, // 36 + ListTagRight, // 37 + ListItemLeft, // 38 + ListItemRight, // 39 + ListRight, // 40 + Nop, ParaLeft, - ParaRight, + ParaRight, #ifdef QDOC_QML Qml, QmlText, #endif - QuotationLeft, + QuotationLeft, QuotationRight, RawString, - SectionLeft, + SectionLeft, // 49 SectionRight, SectionHeadingLeft, SectionHeadingRight, - SidebarLeft, + SidebarLeft, SidebarRight, SinceList, SnippetCommand, SnippetIdentifier, SnippetLocation, - String, - TableLeft, - TableRight, + String, // 59 + TableLeft, // 60 + TableRight, TableHeaderLeft, TableHeaderRight, TableRowLeft, - TableRowRight, - TableItemLeft, + TableRowRight, + TableItemLeft, TableItemRight, TableOfContents, - Target, + Target, // 69 UnhandledFormat, UnknownCommand, Last = UnknownCommand diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index bb2e817..542960d 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -1157,7 +1157,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, xmlWriter().writeStartElement("stentry"); xmlWriter().writeCharacters("Value"); xmlWriter().writeEndElement(); // - xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // } } else { @@ -1223,8 +1223,6 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, if (threeColumnEnumValueTable) { xmlWriter().writeEndElement(); // xmlWriter().writeStartElement("stentry"); - if (matchAhead(atom, Atom::ListItemRight)) - xmlWriter().writeCharacters(" "); } } else { diff --git a/tools/qdoc3/doc.cpp b/tools/qdoc3/doc.cpp index 5adb282..4b1bec8 100644 --- a/tools/qdoc3/doc.cpp +++ b/tools/qdoc3/doc.cpp @@ -1682,7 +1682,7 @@ bool DocParser::closeCommand(int endCmd) void DocParser::startSection(Doc::SectioningUnit unit, int cmd) { - leavePara(); + leaveValueList(); if (currentSectioningUnit == Doc::Book) { #if 0 -- cgit v0.12 From b65b6ac831ddfae4b9c08d26e5087d98ce9c0f2e Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 27 Oct 2010 10:05:30 +0200 Subject: doc: Fixed some DITA XML validation errors. These were in the compact list. --- tools/qdoc3/ditaxmlgenerator.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 542960d..30d1d74 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -3006,24 +3006,24 @@ void DitaXmlGenerator::generateCompactList(const Node* relative, int curParNr = 0; int curParOffset = 0; + QMap cmap; /* Output the alphabet as a row of links. */ if (includeAlphabet) { xmlWriter().writeStartElement("p"); - xmlWriter().writeAttribute("outputclass","centerAlign functionIndex"); - xmlWriter().writeStartElement("b"); + xmlWriter().writeAttribute("outputclass","alphabet"); for (int i = 0; i < 26; i++) { QChar ch('a' + i); if (usedParagraphNames.contains(char('a' + i))) { xmlWriter().writeStartElement("xref"); - xmlWriter().writeAttribute("href",QString("#%1").arg(ch)); + QString guid = lookupGuid(outFileName(),QString(ch)); + xmlWriter().writeAttribute("href",QString("#%1").arg(guid)); xmlWriter().writeCharacters(QString(ch.toUpper())); xmlWriter().writeEndElement(); // } } - xmlWriter().writeEndElement(); // xmlWriter().writeEndElement(); //

    } @@ -3051,15 +3051,12 @@ void DitaXmlGenerator::generateCompactList(const Node* relative, xmlWriter().writeStartElement("dl"); xmlWriter().writeStartElement("dlentry"); xmlWriter().writeStartElement("dt"); - xmlWriter().writeAttribute("outputclass","alphaChar"); if (includeAlphabet) { QChar c = paragraphName[curParNr][0].toLower(); - xmlWriter().writeStartElement("a"); - xmlWriter().writeAttribute("name",c); + writeGuidAttribute(QString(c)); } - xmlWriter().writeStartElement("b"); + xmlWriter().writeAttribute("outputclass","sublist-header"); xmlWriter().writeCharacters(paragraphName[curParNr]); - xmlWriter().writeEndElement(); // xmlWriter().writeEndElement(); // } -- cgit v0.12 From 7ee572661f9de00b7b1bf0f24b0145e06077553f Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 27 Oct 2010 10:44:07 +0200 Subject: doc: Fixed some DITA XML validation errors. No links in the text. --- tools/qdoc3/ditaxmlgenerator.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 30d1d74..edb8677 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -1090,16 +1090,15 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, .arg(atom->string()) .arg(marker->plainFullName(relative))); } -#if 0 - else if (noLinks) { - //xmlWriter().writeCharacters(atom->string()); - qDebug() << "MYLINK:" << myLink << outFileName() << atom->string(); + else if (!inSectionHeading) { + beginLink(myLink, node, relative, marker); } +#if 0 else { - beginLink(myLink, node, relative, marker); + //xmlWriter().writeCharacters(atom->string()); + //qDebug() << "MYLINK:" << myLink << outFileName() << atom->string(); } -#endif - beginLink(myLink, node, relative, marker); +#endif skipAhead = 1; } break; -- cgit v0.12 From 6a018c73d24594e7a78829e7607133f39eb33fd9 Mon Sep 17 00:00:00 2001 From: Martin Smith <martin.smith@nokia.com> Date: Wed, 27 Oct 2010 10:54:59 +0200 Subject: doc: Fixed some DITA XML validation errors. No <br> elements allowed. --- tools/qdoc3/ditaxmlgenerator.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index edb8677..2cbbfd5 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -1021,7 +1021,6 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, xmlWriter().writeEndElement(); // </p> generateSection(nlist, 0, marker, CodeMarker::Summary); - xmlWriter().writeEmptyElement("br"); ++pmap; } } @@ -1079,7 +1078,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, inLegaleseText = false; break; case Atom::LineBreak: - xmlWriter().writeEmptyElement("br"); + //xmlWriter().writeEmptyElement("br"); break; case Atom::Link: { -- cgit v0.12 From 9b83b7708f02779d0d0405fd05468f03e32de133 Mon Sep 17 00:00:00 2001 From: Martin Smith <martin.smith@nokia.com> Date: Wed, 27 Oct 2010 12:45:17 +0200 Subject: doc: Removed an illegal character. --- doc/src/snippets/code/doc_src_lgpl.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/snippets/code/doc_src_lgpl.qdoc b/doc/src/snippets/code/doc_src_lgpl.qdoc index 8f21642..36b8294 100644 --- a/doc/src/snippets/code/doc_src_lgpl.qdoc +++ b/doc/src/snippets/code/doc_src_lgpl.qdoc @@ -96,7 +96,7 @@ modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. - + Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a -- cgit v0.12 From a57e16bcc728cd71ab4b8b2b86fe25a9b36078e5 Mon Sep 17 00:00:00 2001 From: Martin Smith <martin.smith@nokia.com> Date: Wed, 27 Oct 2010 12:46:12 +0200 Subject: qdoc: Fixed some DITA XML validation errors. --- tools/qdoc3/ditaxmlgenerator.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 2cbbfd5..a47a956 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -2801,6 +2801,8 @@ void DitaXmlGenerator::generateClassHierarchy(const Node* relative, if (stack.top().isEmpty()) { stack.pop(); xmlWriter().writeEndElement(); // </ul> + if (!stack.isEmpty()) + xmlWriter().writeEndElement(); // </li> } else { const ClassNode *child = @@ -2817,6 +2819,7 @@ void DitaXmlGenerator::generateClassHierarchy(const Node* relative, } if (!newTop.isEmpty()) { stack.push(newTop); + xmlWriter().writeStartElement("li"); xmlWriter().writeStartElement("ul"); } } -- cgit v0.12 From ac8d82a85369424830b7b8cf9d568e25bfa791e7 Mon Sep 17 00:00:00 2001 From: Martin Smith <martin.smith@nokia.com> Date: Wed, 27 Oct 2010 12:56:09 +0200 Subject: doc: Removed some illegal characters. --- doc/src/snippets/code/doc_src_lgpl.qdoc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/doc/src/snippets/code/doc_src_lgpl.qdoc b/doc/src/snippets/code/doc_src_lgpl.qdoc index 36b8294..e532406 100644 --- a/doc/src/snippets/code/doc_src_lgpl.qdoc +++ b/doc/src/snippets/code/doc_src_lgpl.qdoc @@ -199,7 +199,7 @@ Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. - + 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 @@ -257,7 +257,7 @@ instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. - + Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. @@ -308,7 +308,7 @@ Library will still fall under Section 6.) distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. - + 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work @@ -370,7 +370,7 @@ restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. - + 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined @@ -388,7 +388,7 @@ permitted, and provided that you do these two things: where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any +0the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, @@ -411,7 +411,7 @@ subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. - + 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or @@ -463,7 +463,7 @@ conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. - + 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is @@ -497,7 +497,7 @@ SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS - + How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest -- cgit v0.12 From 649ff059fbb8a3a288dbb112edb65e8f9f4e29cb Mon Sep 17 00:00:00 2001 From: Martin Smith <martin.smith@nokia.com> Date: Wed, 27 Oct 2010 13:12:17 +0200 Subject: doc: Removed an illegal char and some empty \row commands. --- doc/src/platforms/compiler-notes.qdoc | 3 --- doc/src/snippets/code/doc_src_lgpl.qdoc | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/doc/src/platforms/compiler-notes.qdoc b/doc/src/platforms/compiler-notes.qdoc index 5ff3112..316b635 100644 --- a/doc/src/platforms/compiler-notes.qdoc +++ b/doc/src/platforms/compiler-notes.qdoc @@ -55,14 +55,11 @@ \header \o \o Concurrent \o XmlPatterns \o WebKit(*) \o CLucene \o Phonon \row \o g++ 3.3 \o \o \bold{X} \o \o \bold{X} \o \bold{X} \row \o g++ 3.4 and up \o \bold{X} \o \bold{X} \o \bold{X} \o \bold{X} \o \bold{X} - \row \row \o SunCC 5.5 \o \o \o \o \bold{X} \o \bold{X} - \row \row \o aCC series 3 \o \o \o \o \bold{X} \o \bold{X} \row \o aCC series 6 \o \bold{X} \o \bold{X} \o \bold{X} \o \bold{X} \o \bold{X} \row \o xlC 6 \o \o \o \o \bold{X} \o \bold{X} \row \o Intel CC 10 \o \bold{X} \o \bold{X} \o \bold{X} \o \bold{X} \o \bold{X} - \row \row \o MSVC 2003 \o \bold{X} \o \bold{X} \o \o \bold{X} \o \bold{X} \row \o MSVC 2005 and up \o \bold{X} \o \bold{X} \o \bold{X} \o \bold{X} \o \bold{X} \endtable diff --git a/doc/src/snippets/code/doc_src_lgpl.qdoc b/doc/src/snippets/code/doc_src_lgpl.qdoc index e532406..fa155fc 100644 --- a/doc/src/snippets/code/doc_src_lgpl.qdoc +++ b/doc/src/snippets/code/doc_src_lgpl.qdoc @@ -152,7 +152,7 @@ modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. - + GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION -- cgit v0.12 From 14dd3da129e26872296435814694a3251ef5e52f Mon Sep 17 00:00:00 2001 From: Martin Smith <martin.smith@nokia.com> Date: Thu, 28 Oct 2010 12:36:57 +0200 Subject: qdoc: Fixed some DITA XML validation errors. Fixed some \table problems as well. --- doc/src/getting-started/installation.qdoc | 11 ++++++----- tools/qdoc3/ditaxmlgenerator.cpp | 24 ++++++++++++++++++------ 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/doc/src/getting-started/installation.qdoc b/doc/src/getting-started/installation.qdoc index c6e79d9..fdb88f5 100644 --- a/doc/src/getting-started/installation.qdoc +++ b/doc/src/getting-started/installation.qdoc @@ -990,9 +990,9 @@ applications using Qt for Symbian can start right away. Qt from its source code, you will also need to install the development packages for these libraries for your system. - \table 90% - \header \o Name \o Library \o Notes \o Configuration options \o Minimum working version \raw HTML + <table class="generic"> + <thead><tr class="qt-style topAlign"><th>Name</th><th>Library</th><th>Notes</th><th>Configuration options</th><th>Minimum working version <tr id="OptionalColor"> <td> XRender </td><td> libXrender </td><td> X Rendering Extension; used for anti-aliasing</td> <td><tt>-xrender</tt> or auto-detected</td><td>0.9.0</td> @@ -1039,9 +1039,9 @@ applications using Qt for Symbian can start right away. </tr><tr id="PthreadColor"> <td> pthread </td><td> libpthread </td><td> Multithreading</td> <td></td><td>2.3.5</td> - </tr> + </tr></th></tr></thead> + </table> \endraw - \endtable \note You must compile with XRender support to get alpha transparency support for pixmaps and images. @@ -1129,8 +1129,9 @@ applications using Qt for Symbian can start right away. {Windows Mobile 6 Professional/Standard} \endlist + \bold{Note:} \table - \row \bold{Note:} + \row \o \list 1 \o Currently, there is only compile support for Windows CE 5.0 diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index a47a956..581335a 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -653,10 +653,10 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, case Atom::BaseName: break; case Atom::BriefLeft: - if (relative->type() == Node::Fake) { - skipAhead = skipAtoms(atom, Atom::BriefRight); - break; - } + //if (relative->type() == Node::Fake) { + //skipAhead = skipAtoms(atom, Atom::BriefRight); + //break; + //} if (inApiDesc || inSection) { xmlWriter().writeStartElement("p"); xmlWriter().writeAttribute("outputclass","brief"); @@ -697,8 +697,8 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, } break; case Atom::BriefRight: - if (relative->type() != Node::Fake) - xmlWriter().writeEndElement(); // </shortdesc> or </p> + // if (relative->type() != Node::Fake) + xmlWriter().writeEndElement(); // </shortdesc> or </p> noLinks = false; break; case Atom::C: @@ -2413,6 +2413,18 @@ void DitaXmlGenerator::generateTitle(const QString& title, void DitaXmlGenerator::generateBrief(const Node* node, CodeMarker* marker) { Text brief = node->doc().briefText(true); // zzz + if (outFileName() == "requirements-x11.xml") { + if (brief.isEmpty()) + qDebug() << "EMPTY BRIEF"; + else { + qDebug() << "NON-EMPTY BRIEF"; + Atom* a = brief.firstAtom(); + while (a != 0) { + qDebug() << " " << a->type() << a->typeString() << a->string(); + a = a->next(); + } + } + } if (!brief.isEmpty()) { generateText(brief, node, marker); } -- cgit v0.12 From dafb371f89c14f99082289feba66fa21b28ecd37 Mon Sep 17 00:00:00 2001 From: Martin Smith <martin.smith@nokia.com> Date: Thu, 28 Oct 2010 15:15:27 +0200 Subject: qdoc: Fixed some DITA XML validation errors. The obsolete and Qt3 support files no longer exist, so all the references to them had to be cleaned up, and the elements that were formerly in those files had to be included in the class, namespace, or header file with the appropriate outputclass attr. --- tools/qdoc3/ditaxmlgenerator.cpp | 315 +++++++++------------------------------ tools/qdoc3/ditaxmlgenerator.h | 26 +++- 2 files changed, 89 insertions(+), 252 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 581335a..fa0aa43 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -1628,27 +1628,9 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark } ++s; } -#if 0 - QString membersLink = generateListOfAllMemberFile(inner, marker); - QString obsoleteLink = generateLowStatusMemberFile(inner, - marker, - CodeMarker::Obsolete); - QString compatLink = generateLowStatusMemberFile(inner, - marker, - CodeMarker::Compat); - if (!membersLink.isEmpty() || - !obsoleteLink.isEmpty() || - !compatLink.isEmpty()) { - xmlWriter().writeStartElement("ul"); - if (!membersLink.isEmpty()) - writeXrefListItem(membersLink,"List of all members, including inherited members"); - if (!obsoleteLink.isEmpty()) - writeXrefListItem(obsoleteLink,"Obsolete members"); - if (!compatLink.isEmpty()) - writeXrefListItem(compatLink,"Qt 3 support members"); - xmlWriter().writeEndElement(); // </ul> - } -#endif + + generateLowStatusMembers(inner,marker,CodeMarker::Obsolete); + generateLowStatusMembers(inner,marker,CodeMarker::Compat); xmlWriter().writeEndElement(); // </cxxClass> } else if (inner->type() == Node::Class) { @@ -1783,29 +1765,8 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark ++s; } - // not included: <cxxClassInherits> - -#if 0 - QString membersLink = generateListOfAllMemberFile(inner, marker); - QString obsoleteLink = generateLowStatusMemberFile(inner, - marker, - CodeMarker::Obsolete); - QString compatLink = generateLowStatusMemberFile(inner, - marker, - CodeMarker::Compat); - if (!membersLink.isEmpty() || - !obsoleteLink.isEmpty() || - !compatLink.isEmpty()) { - xmlWriter().writeStartElement("ul"); - if (!membersLink.isEmpty()) - writeXrefListItem(membersLink,"List of all members, including inherited members"); - if (!obsoleteLink.isEmpty()) - writeXrefListItem(obsoleteLink,"Obsolete members"); - if (!compatLink.isEmpty()) - writeXrefListItem(compatLink,"Qt 3 support members"); - xmlWriter().writeEndElement(); // </ul> - } -#endif + generateLowStatusMembers(inner,marker,CodeMarker::Obsolete); + generateLowStatusMembers(inner,marker,CodeMarker::Compat); xmlWriter().writeEndElement(); // </cxxClass> } else if ((inner->type() == Node::Fake) && (inner->subType() == Node::HeaderFile)) { @@ -1926,27 +1887,8 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark } ++s; } -#if 0 - QString membersLink = generateListOfAllMemberFile(inner, marker); - QString obsoleteLink = generateLowStatusMemberFile(inner, - marker, - CodeMarker::Obsolete); - QString compatLink = generateLowStatusMemberFile(inner, - marker, - CodeMarker::Compat); - if (!membersLink.isEmpty() || - !obsoleteLink.isEmpty() || - !compatLink.isEmpty()) { - xmlWriter().writeStartElement("ul"); - if (!membersLink.isEmpty()) - writeXrefListItem(membersLink,"List of all members, including inherited members"); - if (!obsoleteLink.isEmpty()) - writeXrefListItem(obsoleteLink,"Obsolete members"); - if (!compatLink.isEmpty()) - writeXrefListItem(compatLink,"Qt 3 support members"); - xmlWriter().writeEndElement(); // </ul> - } -#endif + generateLowStatusMembers(inner,marker,CodeMarker::Obsolete); + generateLowStatusMembers(inner,marker,CodeMarker::Compat); xmlWriter().writeEndElement(); // </cxxClass> } else if ((inner->type() == Node::Fake) && (inner->subType() == Node::QmlClass)) { @@ -2138,90 +2080,6 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker xmlWriter().writeEndElement(); // </section> } } -#if 0 - else if (fake->subType() == Node::HeaderFile) { - generateStatus(fake, marker); - QString membersLink = generateListOfAllMemberFile(fake, marker); - QString obsoleteLink = generateLowStatusMemberFile(fake, - marker, - CodeMarker::Obsolete); - QString compatLink = generateLowStatusMemberFile(fake, - marker, - CodeMarker::Compat); - - if (!membersLink.isEmpty() || !obsoleteLink.isEmpty() || !compatLink.isEmpty()) { - xmlWriter().writeStartElement("section"); - xmlWriter().writeAttribute("outputclass","member-lists"); - xmlWriter().writeStartElement("ul"); - if (!membersLink.isEmpty()) { - writeXrefListItem(membersLink,"List of all members, including inherited members"); - } - if (!obsoleteLink.isEmpty()) { - writeXrefListItem(obsoleteLink,"Obsolete members"); - } - if (!compatLink.isEmpty()) { - writeXrefListItem(compatLink,"Qt 3 support members"); - } - xmlWriter().writeEndElement(); // </ul> - xmlWriter().writeEndElement(); // </section> - } - } - else if (fake->subType() == Node::QmlClass) { - const QmlClassNode* qml_cn = static_cast<const QmlClassNode*>(fake); - const ClassNode* cn = qml_cn->classNode(); - xmlWriter().writeStartElement("section"); - xmlWriter().writeAttribute("outputclass","apiDesc"); - generateQmlInstantiates(qml_cn, marker); - generateQmlInherits(qml_cn, marker); - generateQmlInheritedBy(qml_cn, marker); - xmlWriter().writeEndElement(); // </section> - sections = marker->qmlSections(qml_cn,CodeMarker::Summary,0); - s = sections.begin(); - while (s != sections.end()) { - xmlWriter().writeStartElement("section"); - QString attr = cleanRef((*s).name).toLower(); - xmlWriter().writeAttribute("outputclass",attr); - xmlWriter().writeStartElement("title"); - xmlWriter().writeAttribute("outputclass","h2"); - xmlWriter().writeCharacters(protectEnc((*s).name)); - xmlWriter().writeEndElement(); // - generateQmlSummary(*s,fake,marker); - xmlWriter().writeEndElement(); //
    - ++s; - } - - writeDetailedDescription(fake, marker, false, QString("Detailed Description")); - - if (cn) - generateQmlText(cn->doc().body(), cn, marker, fake->name()); - - generateAlsoList(fake, marker); - - sections = marker->qmlSections(qml_cn,CodeMarker::Detailed,0); - s = sections.begin(); - while (s != sections.end()) { - if (!s->members.isEmpty()) { - QString attr; - xmlWriter().writeStartElement("section"); - attr = cleanRef((*s).name).toLower(); - xmlWriter().writeAttribute("outputclass",attr); - xmlWriter().writeStartElement("title"); - xmlWriter().writeAttribute("outputclass","h2"); - xmlWriter().writeCharacters(protectEnc((*s).name)); - xmlWriter().writeEndElement(); // - NodeList::ConstIterator m = (*s).members.begin(); - while (m != (*s).members.end()) { - generateDetailedQmlMember(*m, fake, marker); - ++m; - } - xmlWriter().writeEndElement(); //
    - } - ++s; - } - xmlWriter().writeEndElement(); // - return; - } -#endif if (fake->doc().isEmpty()) { if (fake->subType() == Node::File) { @@ -2685,106 +2543,48 @@ QString DitaXmlGenerator::generateListOfAllMemberFile(const InnerNode* inner, return fileName; } -#if 0 -QString DitaXmlGenerator::generateLowStatusMemberFile(const InnerNode* inner, - CodeMarker* marker, - CodeMarker::Status status) +void DitaXmlGenerator::generateLowStatusMembers(const InnerNode* inner, + CodeMarker* marker, + CodeMarker::Status status) { - QList
    sections = marker->sections(inner,CodeMarker::Summary,status); + QString attribute; + if (status == CodeMarker::Compat) + attribute = "Qt3-support"; + else if (status == CodeMarker::Obsolete) + attribute = "obsolete"; + else + return; + + QList
    sections = marker->sections(inner, CodeMarker::Detailed, status); QMutableListIterator
    j(sections); while (j.hasNext()) { if (j.next().members.size() == 0) j.remove(); } if (sections.isEmpty()) - return QString(); - - int i; - QString title; - QString fileName; - - if (status == CodeMarker::Compat) { - title = "Qt 3 Support Members for " + inner->name(); - fileName = fileBase(inner) + "-qt3." + fileExtension(inner); - } - else { - title = "Obsolete Members for " + inner->name(); - fileName = fileBase(inner) + "-obsolete." + fileExtension(inner); - } - beginSubPage(inner->location(), fileName); - generateHeader(inner, title, true); - xmlWriter().writeStartElement("body"); - xmlWriter().writeStartElement("section"); - if (!title.isEmpty()) { - xmlWriter().writeStartElement("title"); - xmlWriter().writeAttribute("outputclass", "h1"); - xmlWriter().writeCharacters(protectEnc(title)); - xmlWriter().writeEndElement(); // - } - - xmlWriter().writeStartElement("p"); - if (status == CodeMarker::Compat) { - xmlWriter().writeStartElement("b"); - xmlWriter().writeCharacters("The following class members are part of the "); - xmlWriter().writeStartElement("xref"); - xmlWriter().writeAttribute("href","qt3support.html"); - xmlWriter().writeCharacters("Qt 3 support layer"); - xmlWriter().writeEndElement(); // - xmlWriter().writeCharacters(". "); - xmlWriter().writeEndElement(); // - xmlWriter().writeCharacters("They are provided to help you port old code to Qt 4. " - "We advise against using them in new code."); - } - else { - xmlWriter().writeStartElement("b"); - xmlWriter().writeCharacters("The following class members are obsolete. "); - xmlWriter().writeEndElement(); // - xmlWriter().writeCharacters("They are provided to keep old source code working. " - "We strongly advise against using them in new code."); - } - xmlWriter().writeEndElement(); //

    - xmlWriter().writeStartElement("p"); - xmlWriter().writeStartElement("ul"); - QString text = protectEnc(inner->name()) + " class reference"; - writeXrefListItem(linkForNode(inner,0),text); - xmlWriter().writeEndElement(); // - xmlWriter().writeEndElement(); //

    - xmlWriter().writeEndElement(); //
    - - for (i = 0; i < sections.size(); ++i) { - xmlWriter().writeStartElement("section"); - xmlWriter().writeStartElement("title"); - xmlWriter().writeAttribute("outputclass","h2"); - xmlWriter().writeCharacters(protectEnc(sections.at(i).name)); - xmlWriter().writeEndElement(); // - generateSection(sections.at(i).members, inner, marker, CodeMarker::Summary); - generateSectionInheritedList(sections.at(i), inner, marker); - xmlWriter().writeEndElement(); //
    - } - - sections = marker->sections(inner, CodeMarker::Detailed, status); - for (i = 0; i < sections.size(); ++i) { - xmlWriter().writeStartElement("section"); - xmlWriter().writeStartElement("title"); - xmlWriter().writeAttribute("outputclass","h2"); - xmlWriter().writeCharacters(protectEnc(sections.at(i).name)); - xmlWriter().writeEndElement(); // + return; - NodeList::ConstIterator m = sections.at(i).members.begin(); - while (m != sections.at(i).members.end()) { - if ((*m)->access() != Node::Private) { - generateDetailedMember(*m, inner, marker); - } - ++m; + QList
    ::ConstIterator s = sections.begin(); + while (s != sections.end()) { + if ((*s).name == "Member Function Documentation") { + writeFunctions((*s),inner,marker,attribute); + } + else if ((*s).name == "Member Type Documentation") { + writeEnumerations((*s),marker,attribute); + writeTypedefs((*s),marker,attribute); + } + else if ((*s).name == "Member Variable Documentation") { + writeDataMembers((*s),marker,attribute); } - xmlWriter().writeEndElement(); //
    + else if ((*s).name == "Property Documentation") { + writeProperties((*s),marker,attribute); + } + else if ((*s).name == "Macro Documentation") { + writeMacros((*s),marker,attribute); + } + ++s; } - xmlWriter().writeEndElement(); // - xmlWriter().writeEndElement(); // - endSubPage(); - return fileName; } -#endif /*! Write the XML for the class hierarchy to the current XML stream. @@ -3789,6 +3589,7 @@ QString DitaXmlGenerator::fileBase(const Node* node) const { QString result; result = PageGenerator::fileBase(node); +#if 0 if (!node->isInnerNode()) { switch (node->status()) { case Node::Compat: @@ -3801,6 +3602,7 @@ QString DitaXmlGenerator::fileBase(const Node* node) const ; } } +#endif return result; } @@ -3969,6 +3771,7 @@ void DitaXmlGenerator::generateFullName(const Node* apparentNode, actualNode = apparentNode; xmlWriter().writeStartElement("xref"); xmlWriter().writeAttribute("href",linkForNode(actualNode, relative)); +#if 0 if (true || relative == 0 || relative->status() != actualNode->status()) { switch (actualNode->status()) { case Node::Obsolete: @@ -3981,6 +3784,7 @@ void DitaXmlGenerator::generateFullName(const Node* apparentNode, break; } } +#endif xmlWriter().writeCharacters(protectEnc(fullName(apparentNode, relative, marker))); xmlWriter().writeEndElement(); // } @@ -4482,12 +4286,12 @@ void DitaXmlGenerator::beginLink(const QString& link, case Node::Obsolete: xmlWriter().writeStartElement("xref"); xmlWriter().writeAttribute("href",link); - xmlWriter().writeAttribute("outputclass","obsolete"); + //xmlWriter().writeAttribute("outputclass","obsolete"); break; case Node::Compat: xmlWriter().writeStartElement("xref"); xmlWriter().writeAttribute("href",link); - xmlWriter().writeAttribute("outputclass","compat"); + //xmlWriter().writeAttribute("outputclass","compat"); break; default: xmlWriter().writeStartElement("xref"); @@ -4880,7 +4684,8 @@ void DitaXmlGenerator::writeLocation(const Node* n) */ void DitaXmlGenerator::writeFunctions(const Section& s, const Node* n, - CodeMarker* marker) + CodeMarker* marker, + const QString& attribute) { NodeList::ConstIterator m = s.members.begin(); while (m != s.members.end()) { @@ -4888,6 +4693,8 @@ void DitaXmlGenerator::writeFunctions(const Section& s, FunctionNode* fn = const_cast(static_cast(*m)); xmlWriter().writeStartElement(CXXFUNCTION); xmlWriter().writeAttribute("id",fn->guid()); + if (!attribute.isEmpty()) + xmlWriter().writeAttribute("outputclass",attribute); xmlWriter().writeStartElement("apiName"); if (fn->metaness() == FunctionNode::Signal) xmlWriter().writeAttribute("class","signal"); @@ -5049,7 +4856,8 @@ void DitaXmlGenerator::writeParameters(const FunctionNode* fn) This function writes the enum types. */ void DitaXmlGenerator::writeEnumerations(const Section& s, - CodeMarker* marker) + CodeMarker* marker, + const QString& attribute) { NodeList::ConstIterator m = s.members.begin(); while (m != s.members.end()) { @@ -5057,6 +4865,8 @@ void DitaXmlGenerator::writeEnumerations(const Section& s, const EnumNode* en = static_cast(*m); xmlWriter().writeStartElement(CXXENUMERATION); xmlWriter().writeAttribute("id",en->guid()); + if (!attribute.isEmpty()) + xmlWriter().writeAttribute("outputclass",attribute); xmlWriter().writeStartElement("apiName"); xmlWriter().writeCharacters(en->name()); xmlWriter().writeEndElement(); // @@ -5164,7 +4974,9 @@ void DitaXmlGenerator::writeEnumerations(const Section& s, This function writes the output for the \typedef commands. */ void DitaXmlGenerator::writeTypedefs(const Section& s, - CodeMarker* marker) + CodeMarker* marker, + const QString& attribute) + { NodeList::ConstIterator m = s.members.begin(); while (m != s.members.end()) { @@ -5172,6 +4984,8 @@ void DitaXmlGenerator::writeTypedefs(const Section& s, const TypedefNode* tn = static_cast(*m); xmlWriter().writeStartElement(CXXTYPEDEF); xmlWriter().writeAttribute("id",tn->guid()); + if (!attribute.isEmpty()) + xmlWriter().writeAttribute("outputclass",attribute); xmlWriter().writeStartElement("apiName"); xmlWriter().writeCharacters(tn->name()); xmlWriter().writeEndElement(); // @@ -5224,7 +5038,8 @@ void DitaXmlGenerator::writeTypedefs(const Section& s, This is the Q_PROPERTYs. */ void DitaXmlGenerator::writeProperties(const Section& s, - CodeMarker* marker) + CodeMarker* marker, + const QString& attribute) { NodeList::ConstIterator m = s.members.begin(); while (m != s.members.end()) { @@ -5232,6 +5047,8 @@ void DitaXmlGenerator::writeProperties(const Section& s, const PropertyNode* pn = static_cast(*m); xmlWriter().writeStartElement(CXXVARIABLE); xmlWriter().writeAttribute("id",pn->guid()); + if (!attribute.isEmpty()) + xmlWriter().writeAttribute("outputclass",attribute); xmlWriter().writeStartElement("apiName"); xmlWriter().writeCharacters(pn->name()); xmlWriter().writeEndElement(); // @@ -5333,7 +5150,8 @@ void DitaXmlGenerator::writeProperties(const Section& s, This function outputs the nodes resulting from \variable commands. */ void DitaXmlGenerator::writeDataMembers(const Section& s, - CodeMarker* marker) + CodeMarker* marker, + const QString& attribute) { NodeList::ConstIterator m = s.members.begin(); while (m != s.members.end()) { @@ -5341,6 +5159,8 @@ void DitaXmlGenerator::writeDataMembers(const Section& s, const VariableNode* vn = static_cast(*m); xmlWriter().writeStartElement(CXXVARIABLE); xmlWriter().writeAttribute("id",vn->guid()); + if (!attribute.isEmpty()) + xmlWriter().writeAttribute("outputclass",attribute); xmlWriter().writeStartElement("apiName"); xmlWriter().writeCharacters(vn->name()); xmlWriter().writeEndElement(); // @@ -5414,7 +5234,8 @@ void DitaXmlGenerator::writeDataMembers(const Section& s, This function writes a \macro as a . */ void DitaXmlGenerator::writeMacros(const Section& s, - CodeMarker* marker) + CodeMarker* marker, + const QString& attribute) { NodeList::ConstIterator m = s.members.begin(); while (m != s.members.end()) { @@ -5423,6 +5244,8 @@ void DitaXmlGenerator::writeMacros(const Section& s, if (fn->isMacro()) { xmlWriter().writeStartElement(CXXDEFINE); xmlWriter().writeAttribute("id",fn->guid()); + if (!attribute.isEmpty()) + xmlWriter().writeAttribute("outputclass",attribute); xmlWriter().writeStartElement("apiName"); xmlWriter().writeCharacters(fn->name()); xmlWriter().writeEndElement(); // diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index afa77bb..aa8ca77 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -116,14 +116,25 @@ class DitaXmlGenerator : public PageGenerator void writeLocation(const Node* n); void writeFunctions(const Section& s, const Node* n, - CodeMarker* marker); + CodeMarker* marker, + const QString& attribute = QString()); void writeNestedClasses(const Section& s, const Node* n); void writeParameters(const FunctionNode* fn); - void writeEnumerations(const Section& s, CodeMarker* marker); - void writeTypedefs(const Section& s, CodeMarker* marker); - void writeDataMembers(const Section& s, CodeMarker* marker); - void writeProperties(const Section& s, CodeMarker* marker); - void writeMacros(const Section& s, CodeMarker* marker); + void writeEnumerations(const Section& s, + CodeMarker* marker, + const QString& attribute = QString()); + void writeTypedefs(const Section& s, + CodeMarker* marker, + const QString& attribute = QString()); + void writeDataMembers(const Section& s, + CodeMarker* marker, + const QString& attribute = QString()); + void writeProperties(const Section& s, + CodeMarker* marker, + const QString& attribute = QString()); + void writeMacros(const Section& s, + CodeMarker* marker, + const QString& attribute = QString()); void writePropertyParameter(const QString& tag, const NodeList& nlist); private: @@ -153,6 +164,9 @@ class DitaXmlGenerator : public PageGenerator CodeMarker* marker, QList
    * sections = 0); QString generateListOfAllMemberFile(const InnerNode* inner, CodeMarker* marker); + void generateLowStatusMembers(const InnerNode* inner, + CodeMarker* marker, + CodeMarker::Status status); QString generateLowStatusMemberFile(const InnerNode* inner, CodeMarker* marker, CodeMarker::Status status); -- cgit v0.12 From 08ab82e447a0cac0a48daf900c57127c2ee534d2 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 29 Oct 2010 12:34:53 +0200 Subject: qdoc: Don't put classes that have empty doc in hierarchy. --- tools/qdoc3/ditaxmlgenerator.cpp | 17 +++-------------- tools/qdoc3/htmlgenerator.cpp | 2 +- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index fa0aa43..a885f29 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -2271,18 +2271,6 @@ void DitaXmlGenerator::generateTitle(const QString& title, void DitaXmlGenerator::generateBrief(const Node* node, CodeMarker* marker) { Text brief = node->doc().briefText(true); // zzz - if (outFileName() == "requirements-x11.xml") { - if (brief.isEmpty()) - qDebug() << "EMPTY BRIEF"; - else { - qDebug() << "NON-EMPTY BRIEF"; - Atom* a = brief.firstAtom(); - while (a != 0) { - qDebug() << " " << a->type() << a->typeString() << a->string(); - a = a->next(); - } - } - } if (!brief.isEmpty()) { generateText(brief, node, marker); } @@ -2626,7 +2614,7 @@ void DitaXmlGenerator::generateClassHierarchy(const Node* relative, NodeMap newTop; foreach (const RelatedClass &d, child->derivedClasses()) { - if (d.access != Node::Private) + if (d.access != Node::Private && !d.node->doc().isEmpty()) newTop.insert(d.node->name(), d.node); } if (!newTop.isEmpty()) { @@ -4587,7 +4575,8 @@ void DitaXmlGenerator::writeDerivations(const ClassNode* cn, CodeMarker* marker) // not included: xmlWriter().writeStartElement(CXXCLASSBASECLASS); - xmlWriter().writeAttribute("href",(*r).node->ditaXmlHref()); + QString attr = fileName((*r).node) + "#" + (*r).node->guid(); + xmlWriter().writeAttribute("href",attr); xmlWriter().writeCharacters(marker->plainFullName((*r).node)); xmlWriter().writeEndElement(); // diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 19b86e0..9ce8522 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -2424,7 +2424,7 @@ void HtmlGenerator::generateClassHierarchy(const Node *relative, NodeMap newTop; foreach (const RelatedClass &d, child->derivedClasses()) { - if (d.access != Node::Private) + if (d.access != Node::Private && !d.node->doc().isEmpty()) newTop.insert(d.node->name(), d.node); } if (!newTop.isEmpty()) { -- cgit v0.12 From 5fdbfcaa0ebda0b2062d962734546309c6d2247c Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 1 Nov 2010 08:25:03 +0100 Subject: doc: Corrections to linking errors detected by the DITA XML generator.. --- doc/src/examples/svgalib.qdoc | 5 ++--- doc/src/platforms/emb-accel.qdoc | 4 ++-- doc/src/porting/porting4-modifiedvirtual.qdocinc | 2 +- src/qt3support/network/q3dns.cpp | 27 ++++++++++++++++-------- 4 files changed, 23 insertions(+), 15 deletions(-) diff --git a/doc/src/examples/svgalib.qdoc b/doc/src/examples/svgalib.qdoc index 3e3e4d5..f733058 100644 --- a/doc/src/examples/svgalib.qdoc +++ b/doc/src/examples/svgalib.qdoc @@ -322,9 +322,8 @@ \snippet examples/qws/svgalib/svgalibsurface.h 0 We can implement most of the pure virtual functions inherited from - QWSWindowSurface as trivial inline functions, except the - \l {QWindowSurface::}{scroll()} function that actually makes use - of some hardware acceleration: + QWSWindowSurface as trivial inline functions, except the scroll() + function that actually makes use of some hardware acceleration: \snippet examples/qws/svgalib/svgalibsurface.cpp 0 diff --git a/doc/src/platforms/emb-accel.qdoc b/doc/src/platforms/emb-accel.qdoc index c8854f7..77447de 100644 --- a/doc/src/platforms/emb-accel.qdoc +++ b/doc/src/platforms/emb-accel.qdoc @@ -117,8 +117,8 @@ \section1 Step 4: Make the Window Surface Aware of Your Paint Device - Derive from the QWSWindowSurface class and reimplement its \l - {QWSWindowSurface::}{paintDevice()} function. Make this function + Derive from the QWSWindowSurface class and reimplement its + paintDevice() function. Make this function return a pointer to your custom raster paint device. \section1 Step 5: Enable Creation of an Instance of Your Window Surface diff --git a/doc/src/porting/porting4-modifiedvirtual.qdocinc b/doc/src/porting/porting4-modifiedvirtual.qdocinc index 1164238..332543f 100644 --- a/doc/src/porting/porting4-modifiedvirtual.qdocinc +++ b/doc/src/porting/porting4-modifiedvirtual.qdocinc @@ -10,7 +10,7 @@ \row \o bool QMacMime::canConvert(const char *, int) \o bool QMacMime::canConvert(const QString &, int) \row \o QValueList QMacMime::convertFromMime(QByteArray, const char *, int) \o QList QMacMime::convertFromMime(QByteArray, const QString &, int) \row \o QByteArray QMacMime::convertToMime(QValueList data, const char *, int) \o QByteArray QMacMime::convertToMime(QList data, const QString &, int) -\row \o const char * QMacMime::convertorName() \o QString QMacMime::convertorName() +\row \o const char * QMacMime::convertorName( ) \o QString QMacMime::convertorName( ) \row \o int QMacMime::flavorFor(const char *) \o int QMacMime::flavorFor(const QString &) \row \o const char * QMacMime::mimeFor(int) \o QString QMacMime::mimeFor(int) \row \o QMetaObject * QObject::metaObject() const \o const QMetaObject * QObject::metaObject() const diff --git a/src/qt3support/network/q3dns.cpp b/src/qt3support/network/q3dns.cpp index e0e9909..cc39566 100644 --- a/src/qt3support/network/q3dns.cpp +++ b/src/qt3support/network/q3dns.cpp @@ -2009,15 +2009,20 @@ Q3ValueList Q3Dns::addresses() const \class Q3Dns::MailServer \brief The Q3Dns::MailServer class is described in Q3Dns::mailServers(). - \internal +*/ + + +/*! \fn Q3Dns::MailServer::MailServer(const QString& n, Q_UINT16 p) + The constructor sets the public data members name and priority. + \a n is the name and \a p is the priority. */ /*! Returns a list of mail servers if the record type is \c Mx. The class Q3Dns::MailServer contains the following public variables: \list - \i QString Q3Dns::MailServer::name - \i Q_UINT16 Q3Dns::MailServer::priority + \o QString Q3Dns::MailServer::name + \o Q_UINT16 Q3Dns::MailServer::priority \endlist Note that if you want to iterate over the list, you should iterate @@ -2048,22 +2053,26 @@ Q3ValueList Q3Dns::mailServers() const return result; } - /*! \class Q3Dns::Server \brief The Q3Dns::Server class is described in Q3Dns::servers(). - \internal +*/ + +/*! \fn Q3Dns::Server::Server(const QString& n, Q_UINT16 p, Q_UINT16 w, Q_UINT16 po) + The constructor sets the public data members name, priority, + weight, and port. \a n is the name, \a p is the priority, + \a w is the weight, and \a po is the port. */ /*! Returns a list of servers if the record type is \c Srv. The class Q3Dns::Server contains the following public variables: \list - \i QString Q3Dns::Server::name - \i Q_UINT16 Q3Dns::Server::priority - \i Q_UINT16 Q3Dns::Server::weight - \i Q_UINT16 Q3Dns::Server::port + \o QString Q3Dns::Server::name + \o Q_UINT16 Q3Dns::Server::priority + \o Q_UINT16 Q3Dns::Server::weight + \o Q_UINT16 Q3Dns::Server::port \endlist Note that if you want to iterate over the list, you should iterate -- cgit v0.12 From d5d44eb800f1c0be15d49521cf991a1c9466cb78 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 1 Nov 2010 12:04:32 +0100 Subject: doc: Corrections to linking errors in the docs. --- src/gui/dialogs/qpagesetupdialog.cpp | 8 ++++---- src/qt3support/tools/q3memarray.qdoc | 4 ++-- src/qt3support/tools/q3ptrlist.qdoc | 3 ++- tools/qdoc3/ditaxmlgenerator.cpp | 15 +++++++++------ tools/qdoc3/htmlgenerator.cpp | 1 + tools/qdoc3/node.cpp | 15 +++++++++++++++ tools/qdoc3/node.h | 2 ++ 7 files changed, 35 insertions(+), 13 deletions(-) diff --git a/src/gui/dialogs/qpagesetupdialog.cpp b/src/gui/dialogs/qpagesetupdialog.cpp index 5d77de1..141a687 100644 --- a/src/gui/dialogs/qpagesetupdialog.cpp +++ b/src/gui/dialogs/qpagesetupdialog.cpp @@ -104,10 +104,10 @@ class QPageSetupDialogPrivate : public QAbstractPageSetupDialogPrivate This value is obsolete and does nothing since Qt 4.5: - \value DontUseSheet In previous versions of Qt, exec() the page setup dialog - would create a sheet by default if the dialog was given a parent. - This is no longer supported in Qt 4.5. If you want to use sheets, use - QPageSetupDialog::open() instead. + \value DontUseSheet In previous versions of QDialog::exec() the + page setup dialog would create a sheet by default if the dialog + was given a parent. This is no longer supported from Qt 4.5. If + you want to use sheets, use QPageSetupDialog::open() instead. \omitvalue None \omitvalue OwnsPrinter diff --git a/src/qt3support/tools/q3memarray.qdoc b/src/qt3support/tools/q3memarray.qdoc index 13b1c2f..fdf0411 100644 --- a/src/qt3support/tools/q3memarray.qdoc +++ b/src/qt3support/tools/q3memarray.qdoc @@ -221,8 +221,8 @@ New elements are not initialized. - \a optim is either Q3GArray::MemOptim (the default) or - Q3GArray::SpeedOptim. When optimizing for speed rather than memory + \a optim is either \c MemOptim (the default) or + \c SpeedOptim. When optimizing for speed rather than memory consumption, the array uses a smart grow and shrink algorithm that might allocate more memory than is actually needed for \a size elements. This speeds up subsequent resize operations, for example diff --git a/src/qt3support/tools/q3ptrlist.qdoc b/src/qt3support/tools/q3ptrlist.qdoc index 294e4ba..cbba1b7 100644 --- a/src/qt3support/tools/q3ptrlist.qdoc +++ b/src/qt3support/tools/q3ptrlist.qdoc @@ -93,7 +93,8 @@ also holds pointers to the next and previous list items. The functions currentNode(), removeNode(), and takeNode() operate directly on the Q3LNode, but they should be used with care. The - data component of the node is available through Q3LNode::getData(). + data component of the node is available through Q3LNode's getData() + function. The Q3StrList class is a list of \c char*. It reimplements newItem(), deleteItem() and compareItems(). (But diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index a885f29..4bc08a3 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -2907,7 +2907,7 @@ void DitaXmlGenerator::generateFunctionIndex(const Node* relative, CodeMarker* marker) { xmlWriter().writeStartElement("p"); - xmlWriter().writeAttribute("outputclass","centerAlign functionIndex"); + xmlWriter().writeAttribute("outputclass","function-index"); xmlWriter().writeStartElement("b"); for (int i = 0; i < 26; i++) { QChar ch('a' + i); @@ -3980,6 +3980,7 @@ void DitaXmlGenerator::findAllFunctions(const InnerNode* node) else if ((*c)->type() == Node::Function) { const FunctionNode* func = static_cast(*c); if ((func->status() > Node::Obsolete) && + !func->isInternal() && (func->metaness() != FunctionNode::Ctor) && (func->metaness() != FunctionNode::Dtor)) { funcIndex[(*c)->name()].insert(myTree->fullDocumentName((*c)->parent()), *c); @@ -4776,12 +4777,14 @@ void DitaXmlGenerator::writeFunctions(const Section& s, xmlWriter().writeCharacters(fnl); xmlWriter().writeEndElement(); // - if (fn->isReimp() && fn->reimplementedFrom() != 0) { + if (!fn->isInternal() && fn->isReimp() && fn->reimplementedFrom() != 0) { FunctionNode* rfn = (FunctionNode*)fn->reimplementedFrom(); - xmlWriter().writeStartElement(CXXFUNCTIONREIMPLEMENTED); - xmlWriter().writeAttribute("href",rfn->ditaXmlHref()); - xmlWriter().writeCharacters(marker->plainFullName(rfn)); - xmlWriter().writeEndElement(); // + if (rfn && !rfn->isInternal()) { + xmlWriter().writeStartElement(CXXFUNCTIONREIMPLEMENTED); + xmlWriter().writeAttribute("href",rfn->ditaXmlHref()); + xmlWriter().writeCharacters(marker->plainFullName(rfn)); + xmlWriter().writeEndElement(); // + } } writeParameters(fn); writeLocation(fn); diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 9ce8522..c247be8 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -3807,6 +3807,7 @@ void HtmlGenerator::findAllFunctions(const InnerNode *node) else if ((*c)->type() == Node::Function) { const FunctionNode *func = static_cast(*c); if ((func->status() > Node::Obsolete) && + !func->isInternal() && (func->metaness() != FunctionNode::Ctor) && (func->metaness() != FunctionNode::Dtor)) { funcIndex[(*c)->name()].insert(myTree->fullDocumentName((*c)->parent()), *c); diff --git a/tools/qdoc3/node.cpp b/tools/qdoc3/node.cpp index f4736f3..d787bc9 100644 --- a/tools/qdoc3/node.cpp +++ b/tools/qdoc3/node.cpp @@ -1364,6 +1364,21 @@ QString FunctionNode::signature(bool values) const } /*! + Returns true if the node's status is Internal, or if its + parent is a class with internal status. + */ +bool FunctionNode::isInternal() const +{ + if (status() == Internal) + return true; + if (parent() && parent()->status() == Internal) + return true; + if (relates() && relates()->status() == Internal) + return true; + return false; +} + +/*! Print some debugging stuff. */ void FunctionNode::debug() const diff --git a/tools/qdoc3/node.h b/tools/qdoc3/node.h index 0b493ee..69f3ba5 100644 --- a/tools/qdoc3/node.h +++ b/tools/qdoc3/node.h @@ -164,6 +164,7 @@ class Node virtual bool isReimp() const { return false; } virtual bool isFunction() const { return false; } virtual bool isQmlNode() const { return false; } + virtual bool isInternal() const { return false; } Type type() const { return typ; } virtual SubType subType() const { return NoSubType; } InnerNode* parent() const { return par; } @@ -636,6 +637,7 @@ class FunctionNode : public LeafNode virtual bool isQmlNode() const { return ((type() == QmlSignal) || (type() == QmlMethod)); } + virtual bool isInternal() const; void debug() const; -- cgit v0.12 From b2793a9b7f14508be5cf14bb19127e886b8f1492 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Thu, 4 Nov 2010 13:26:25 +0100 Subject: qdoc: Added the element to the This contains the next, previous, and start links for pages that have them. Task-number: QTBUG-14980 --- tools/qdoc3/ditaxmlgenerator.cpp | 59 ++++++++++++++++++++++++++++++++++++++-- tools/qdoc3/ditaxmlgenerator.h | 2 ++ 2 files changed, 59 insertions(+), 2 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 4bc08a3..b69e731 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -2036,7 +2036,7 @@ void DitaXmlGenerator::writeXrefListItem(const QString& link, const QString& tex Generate the html page for a qdoc file that doesn't map to an underlying c++ file. */ -void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) +void DitaXmlGenerator::generateFakeNode(const FakeNode* fake, CodeMarker* marker) { SubTitleSize subTitleSize = LargeSubTitle; QList
    sections; @@ -2054,7 +2054,6 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker } generateHeader(fake, fullTitle); - generateBrief(fake, marker); // xmlWriter().writeStartElement("body"); if (fake->subType() == Node::Module) { @@ -2115,10 +2114,65 @@ void DitaXmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker } } xmlWriter().writeEndElement(); // + writeRelatedLinks(fake, marker); xmlWriter().writeEndElement(); // } /*! + This function writes a \e{} element inside a + \e{} element. + + \sa writeRelatedLinks() + */ +void DitaXmlGenerator::writeLink(const Node* node, + const QString& text, + const QString& role) +{ + if (node) { + QString link = fileName(node) + "#" + node->guid(); + xmlWriter().writeStartElement("link"); + xmlWriter().writeAttribute("href", link); + xmlWriter().writeAttribute("role", role); + xmlWriter().writeStartElement("linktext"); + xmlWriter().writeCharacters(text); + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // + } +} + +/*! + This function writes a \e{} element, which + contains the \c{next}, \c{previous}, and \c{start} + links for topic pages that have them. Note that the + value of the \e role attribute is \c{parent} for the + \c{start} link. + */ +void DitaXmlGenerator::writeRelatedLinks(const FakeNode* node, CodeMarker* marker) +{ + const Node* linkNode = 0; + QPair linkPair; + if (node && !node->links().empty()) { + xmlWriter().writeStartElement("related-links"); + if (node->links().contains(Node::PreviousLink)) { + linkPair = node->links()[Node::PreviousLink]; + linkNode = findNodeForTarget(linkPair.first, node, marker); + writeLink(linkNode, linkPair.second, "previous"); + } + if (node->links().contains(Node::NextLink)) { + linkPair = node->links()[Node::NextLink]; + linkNode = findNodeForTarget(linkPair.first, node, marker); + writeLink(linkNode, linkPair.second, "next"); + } + if (node->links().contains(Node::StartLink)) { + linkPair = node->links()[Node::StartLink]; + linkNode = findNodeForTarget(linkPair.first, node, marker); + writeLink(linkNode, linkPair.second, "parent"); + } + xmlWriter().writeEndElement(); // + } +} + +/*! Returns "xml" for this subclass of class Generator. */ QString DitaXmlGenerator::fileExtension(const Node * /* node */) const @@ -2231,6 +2285,7 @@ void DitaXmlGenerator::generateHeader(const Node* node, xmlWriter().writeStartElement(nameElement); // or <apiName> xmlWriter().writeCharacters(name); xmlWriter().writeEndElement(); // or + } /*! diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index aa8ca77..de949c2 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -136,6 +136,8 @@ class DitaXmlGenerator : public PageGenerator CodeMarker* marker, const QString& attribute = QString()); void writePropertyParameter(const QString& tag, const NodeList& nlist); + void writeRelatedLinks(const FakeNode* fake, CodeMarker* marker); + void writeLink(const Node* node, const QString& tex, const QString& role); private: enum SubTitleSize { SmallSubTitle, LargeSubTitle }; -- cgit v0.12 From e2cffa74190833621d82697325d5cbbbb2aaec85 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 5 Nov 2010 12:12:31 +0100 Subject: qdoc: First pass at generating a map. Some files are missing, and I don't know if the syntax is complete. But it's a start. Task-number: QTBUG-14981 --- tools/qdoc3/ditaxmlgenerator.cpp | 29 ++++++++++++++++++++++++++++- tools/qdoc3/ditaxmlgenerator.h | 1 + tools/qdoc3/pagegenerator.cpp | 7 +++---- 3 files changed, 32 insertions(+), 5 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index b69e731..bf7bd07 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -574,6 +574,7 @@ void DitaXmlGenerator::generateTree(const Tree *tree, CodeMarker *marker) findAllSince(tree->root()); PageGenerator::generateTree(tree, marker); + writeDitaMap(); } void DitaXmlGenerator::startText(const Node* /* relative */, @@ -2285,7 +2286,6 @@ void DitaXmlGenerator::generateHeader(const Node* node, xmlWriter().writeStartElement(nameElement); // or <apiName> xmlWriter().writeCharacters(name); xmlWriter().writeEndElement(); // or - } /*! @@ -5573,4 +5573,31 @@ bool DitaXmlGenerator::canHandleFormat(const QString& format) return (format == "HTML") || (format == this->format()); } +void DitaXmlGenerator::writeDitaMap() +{ + beginSubPage(Location(),"qt-dita-map.xml"); + + QString doctype; + doctype = ""; + + xmlWriter().writeDTD(doctype); + xmlWriter().writeStartElement("cxxAPIMap"); + xmlWriter().writeAttribute("id","Qt-DITA-Map"); + xmlWriter().writeAttribute("title","Qt DITA Map"); + xmlWriter().writeStartElement("topicmeta"); + xmlWriter().writeStartElement("shortdesc"); + xmlWriter().writeCharacters("The top level map for the Qt documentation"); + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // + GuidMaps::iterator i = guidMaps.begin(); + while (i != guidMaps.end()) { + xmlWriter().writeStartElement("topicref"); + xmlWriter().writeAttribute("href",i.key()); + xmlWriter().writeAttribute("type","topic"); + xmlWriter().writeEndElement(); // + ++i; + } + endSubPage(); +} + QT_END_NAMESPACE diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index de949c2..6324204 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -270,6 +270,7 @@ class DitaXmlGenerator : public PageGenerator bool apiDesc, const QString& title); void addLink(const QString& href, const QStringRef& text); + void writeDitaMap(); private: QMap refMap; diff --git a/tools/qdoc3/pagegenerator.cpp b/tools/qdoc3/pagegenerator.cpp index 6ba562c..ca98faa 100644 --- a/tools/qdoc3/pagegenerator.cpp +++ b/tools/qdoc3/pagegenerator.cpp @@ -289,11 +289,10 @@ QString PageGenerator::outFileName() void PageGenerator::beginSubPage(const Location& location, const QString& fileName) { - QFile *outFile = new QFile(outputDir() + "/" + fileName); + QFile* outFile = new QFile(outputDir() + "/" + fileName); if (!outFile->open(QFile::WriteOnly)) - location.fatal(tr("Cannot open output file '%1'") - .arg(outFile->fileName())); - QTextStream *out = new QTextStream(outFile); + location.fatal(tr("Cannot open output file '%1'").arg(outFile->fileName())); + QTextStream* out = new QTextStream(outFile); out->setCodec(outputCodec); outStreamStack.push(out); } -- cgit v0.12 From 8481135dfc7f19424ab9d94d5da986861e6f9c4f Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Sun, 7 Nov 2010 11:37:03 +0100 Subject: qdoc: Second pass at generating a map. All the files are there now. It outputs each element as a . We might want to output the entries for C++ classes, namespaces, and QML classes differently. But the validator is able to use this map to validate everything, and there are no errors. So until we get further instructions, this is it. Task-number: QTBUG-14981 --- tools/qdoc3/ditaxmlgenerator.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index bf7bd07..d275af2 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -5404,6 +5404,7 @@ void DitaXmlGenerator::beginSubPage(const Location& location, const QString& fileName) { PageGenerator::beginSubPage(location,fileName); + (void) lookupGuidMap(fileName); QXmlStreamWriter* writer = new QXmlStreamWriter(out().device()); xmlWriterStack.push(writer); writer->setAutoFormatting(true); -- cgit v0.12 From 2e71fd324eaab8ba08fd748a3dd1c8025a38da2a Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Tue, 9 Nov 2010 10:24:24 +0100 Subject: qdoc: Removed unused code. --- tools/qdoc3/ditaxmlgenerator.cpp | 113 --------------------------------------- tools/qdoc3/ditaxmlgenerator.h | 6 --- 2 files changed, 119 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index d275af2..e2b3ca1 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -1977,49 +1977,6 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark } -#if 0 - while (s != detailSections.end()) { - if ((*s).name == "Member Function Documentation") { - writeFunctions((*s),qcn,marker); - } - else if ((*s).name == "Member Type Documentation") { - writeEnumerations((*s),marker); - writeTypedefs((*s),marker); - } - else if ((*s).name == "Member Variable Documentation") { - writeDataMembers((*s),marker); - } - else if ((*s).name == "Property Documentation") { - writeProperties((*s),marker); - } - else if ((*s).name == "Macro Documentation") { - writeMacros((*s),marker); - } - ++s; - } -#endif -#if 0 - QString membersLink = generateListOfAllMemberFile(inner, marker); - QString obsoleteLink = generateLowStatusMemberFile(inner, - marker, - CodeMarker::Obsolete); - QString compatLink = generateLowStatusMemberFile(inner, - marker, - CodeMarker::Compat); - if (!membersLink.isEmpty() || - !obsoleteLink.isEmpty() || - !compatLink.isEmpty()) { - xmlWriter().writeStartElement("ul"); - if (!membersLink.isEmpty()) - writeXrefListItem(membersLink,"List of all members, including inherited members"); - if (!obsoleteLink.isEmpty()) - writeXrefListItem(obsoleteLink,"Obsolete members"); - if (!compatLink.isEmpty()) - writeXrefListItem(compatLink,"Qt 3 support members"); - xmlWriter().writeEndElement(); // - } -#endif - /*! Write a list item for a \a link with the given \a text. */ @@ -2289,38 +2246,6 @@ void DitaXmlGenerator::generateHeader(const Node* node, } /*! - Writes a \a title as a

    element with an \c {outputclass} - attribute of "h1 title". - - Also generates and writes a \a subTitle as a

    element, - if one is provided, but this probably doesn't work right. - */ -void DitaXmlGenerator::generateTitle(const QString& title, - const Text& subTitle, - SubTitleSize subTitleSize, - const Node* relative, - CodeMarker* marker) -{ - if (!title.isEmpty()) { - xmlWriter().writeStartElement("p"); - xmlWriter().writeAttribute("outputclass", "h1 title"); - xmlWriter().writeCharacters(protectEnc(title)); - xmlWriter().writeEndElement(); //

    - } - if (!subTitle.isEmpty()) { - xmlWriter().writeStartElement("p"); - if (subTitleSize == SmallSubTitle) { - xmlWriter().writeAttribute("outputclass", "small-subtitle"); - } - else { - xmlWriter().writeAttribute("outputclass", "subtitle"); - } - generateText(subTitle, relative, marker); - xmlWriter().writeEndElement(); //

    - } -} - -/*! Outputs the \e brief command as a element. */ void DitaXmlGenerator::generateBrief(const Node* node, CodeMarker* marker) @@ -2548,44 +2473,6 @@ void DitaXmlGenerator::generateTableOfContents(const Node* node, inLink = false; } -QString DitaXmlGenerator::generateListOfAllMemberFile(const InnerNode* inner, - CodeMarker* marker) -{ - QList
    sections; - QList
    ::ConstIterator s; - - sections = marker->sections(inner, - CodeMarker::SeparateList, - CodeMarker::Okay); - if (sections.isEmpty()) - return QString(); - - QString fileName = fileBase(inner) + "-members." + fileExtension(inner); - beginSubPage(inner->location(), fileName); - QString title = "List of All Members for " + inner->name(); - generateHeader(inner, title, true); - xmlWriter().writeStartElement("body"); - xmlWriter().writeStartElement("section"); - if (!title.isEmpty()) { - xmlWriter().writeStartElement("title"); - xmlWriter().writeAttribute("outputclass", "h1"); - xmlWriter().writeCharacters(protectEnc(title)); - xmlWriter().writeEndElement(); // - } - xmlWriter().writeStartElement("p"); - xmlWriter().writeCharacters("This is the complete list of members for "); - generateFullName(inner, 0, marker); - xmlWriter().writeCharacters(", including inherited members."); - xmlWriter().writeEndElement(); //

    - - Section section = sections.first(); - generateSection(section.members, 0, marker, CodeMarker::SeparateList); - xmlWriter().writeEndElement(); //
    - xmlWriter().writeEndElement(); // - endSubPage(); - return fileName; -} - void DitaXmlGenerator::generateLowStatusMembers(const InnerNode* inner, CodeMarker* marker, CodeMarker::Status status) diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index 6324204..29ec546 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -150,11 +150,6 @@ class DitaXmlGenerator : public PageGenerator void generateHeader(const Node* node, const QString& name, bool subpage = false); - void generateTitle(const QString& title, - const Text& subTitle, - SubTitleSize subTitleSize, - const Node* relative, - CodeMarker* marker); void generateBrief(const Node* node, CodeMarker* marker); void generateIncludes(const InnerNode* inner, CodeMarker* marker); void generateTableOfContents(const Node* node, @@ -165,7 +160,6 @@ class DitaXmlGenerator : public PageGenerator void generateTableOfContents(const Node* node, CodeMarker* marker, QList
    * sections = 0); - QString generateListOfAllMemberFile(const InnerNode* inner, CodeMarker* marker); void generateLowStatusMembers(const InnerNode* inner, CodeMarker* marker, CodeMarker::Status status); -- cgit v0.12 From 2f5fe525c5d9ac142571c39c215386675ee79899 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Tue, 9 Nov 2010 13:47:56 +0100 Subject: Qt Commercial Edition Information about the license and features of the Commercial Edition.

    Information about the license and features of the Commercial Edition.

    Qt can be used to develop closed source software if you obtain a commercial license.

    If you want to develop Free or Open Source software for release using a recognized Open Source license, you can use the Open Source Versions of Qt.

    The table below summarizes the differences between the two commercial editions:

    Please see the list of supported platforms for up-to-date information about the various platforms and compilers that Qt supports.

    On the Qt web site, you can find a Qt Licensing Overview and information on Qt License Pricing for commercial editions of Qt and other Qt-related products.

    To purchase, please visit the online order form.

    For further information and assistance, please contact Qt sales.

    Web: http://qt.nokia.com/contact.

    Phone, U.S&#x2e; office (for North America): 1-650-813-1676.

    Phone, Norway office (for the rest of the world): +47 21 60 48 00.

    --- tools/qdoc3/ditaxmlgenerator.cpp | 64 +++++++--------------------------------- tools/qdoc3/ditaxmlgenerator.h | 5 +--- 2 files changed, 11 insertions(+), 58 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index e2b3ca1..00ec8fd 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -639,7 +639,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, const Node* node = 0; QString link = getLink(atom, relative, marker, &node); if (!link.isEmpty()) { - beginLink(link, node, relative, marker); + beginLink(link); generateLink(atom, relative, marker); endLink(); } @@ -1091,7 +1091,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, .arg(marker->plainFullName(relative))); } else if (!inSectionHeading) { - beginLink(myLink, node, relative, marker); + beginLink(myLink); } #if 0 else { @@ -1107,14 +1107,14 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, #if 0 qDebug() << "GUID LINK:" << atom->string() << outFileName(); #endif - beginLink(atom->string(), 0, relative, marker); + beginLink(atom->string()); skipAhead = 1; } break; case Atom::LinkNode: { const Node* node = CodeMarker::nodeForString(atom->string()); - beginLink(linkForNode(node, relative), node, relative, marker); + beginLink(linkForNode(node, relative)); skipAhead = 1; } break; @@ -1476,7 +1476,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, break; case Atom::UnknownCommand: xmlWriter().writeStartElement("b"); - xmlWriter().writeAttribute("outputclass","redFont code"); + xmlWriter().writeAttribute("outputclass","error unknown-command"); xmlWriter().writeCharacters(protectEnc(atom->string())); xmlWriter().writeEndElement(); // break; @@ -3701,20 +3701,6 @@ void DitaXmlGenerator::generateFullName(const Node* apparentNode, actualNode = apparentNode; xmlWriter().writeStartElement("xref"); xmlWriter().writeAttribute("href",linkForNode(actualNode, relative)); -#if 0 - if (true || relative == 0 || relative->status() != actualNode->status()) { - switch (actualNode->status()) { - case Node::Obsolete: - xmlWriter().writeAttribute("outputclass","obsolete"); - break; - case Node::Compat: - xmlWriter().writeAttribute("outputclass","compat"); - break; - default: - break; - } - } -#endif xmlWriter().writeCharacters(protectEnc(fullName(apparentNode, relative, marker))); xmlWriter().writeEndElement(); // } @@ -4194,41 +4180,13 @@ void DitaXmlGenerator::generateStatus(const Node* node, CodeMarker* marker) } } -void DitaXmlGenerator::beginLink(const QString& link, - const Node* node, - const Node* relative, - CodeMarker* marker) +void DitaXmlGenerator::beginLink(const QString& link) { - Q_UNUSED(marker) - Q_UNUSED(relative) - this->link = link; - if (link.isEmpty()) { - if (showBrokenLinks) - xmlWriter().writeStartElement("i"); - } - else if (node == 0 || (relative != 0 && - node->status() == relative->status())) { - xmlWriter().writeStartElement("xref"); - xmlWriter().writeAttribute("href",link); - } - else { - switch (node->status()) { - case Node::Obsolete: - xmlWriter().writeStartElement("xref"); - xmlWriter().writeAttribute("href",link); - //xmlWriter().writeAttribute("outputclass","obsolete"); - break; - case Node::Compat: - xmlWriter().writeStartElement("xref"); - xmlWriter().writeAttribute("href",link); - //xmlWriter().writeAttribute("outputclass","compat"); - break; - default: - xmlWriter().writeStartElement("xref"); - xmlWriter().writeAttribute("href",link); - } - } + if (link.isEmpty()) + return; + xmlWriter().writeStartElement("xref"); + xmlWriter().writeAttribute("href",link); inLink = true; } @@ -4356,7 +4314,6 @@ void DitaXmlGenerator::generateQmlInherits(const QmlClassNode* cn, if (n && n->subType() == Node::QmlClass) { const QmlClassNode* qcn = static_cast(n); xmlWriter().writeStartElement("p"); - xmlWriter().writeAttribute("outputclass","centerAlign"); Text text; text << "[Inherits "; text << Atom(Atom::LinkNode,CodeMarker::stringForNode(qcn)); @@ -4404,7 +4361,6 @@ void DitaXmlGenerator::generateQmlInstantiates(const QmlClassNode* qcn, const ClassNode* cn = qcn->classNode(); if (cn && (cn->status() != Node::Internal)) { xmlWriter().writeStartElement("p"); - xmlWriter().writeAttribute("outputclass","centerAlign"); Text text; text << "["; text << Atom(Atom::LinkNode,CodeMarker::stringForNode(qcn)); diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index 29ec546..427264c 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -245,10 +245,7 @@ class DitaXmlGenerator : public PageGenerator #ifdef GENERATE_MAC_REFS void generateMacRef(const Node* node, CodeMarker* marker); #endif - void beginLink(const QString& link, - const Node* node, - const Node* relative, - CodeMarker* marker); + void beginLink(const QString& link); void endLink(); QString writeGuidAttribute(QString text); void writeGuidAttribute(Node* node); -- cgit v0.12 From 6d111857f094e4c5f2ed3e297c5ec25c16a2a06c Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 10 Nov 2010 13:27:10 +0100 Subject: qdoc: Removed unused code. --- tools/qdoc3/ditaxmlgenerator.cpp | 75 ---------------------------------------- tools/qdoc3/ditaxmlgenerator.h | 3 -- 2 files changed, 78 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 00ec8fd..90f2997 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -3705,81 +3705,6 @@ void DitaXmlGenerator::generateFullName(const Node* apparentNode, xmlWriter().writeEndElement(); // } -void DitaXmlGenerator::generateDetailedMember(Node* node, - const InnerNode* relative, - CodeMarker* marker) -{ - QString marked; - const EnumNode* en; - - if ((node->type() == Node::Enum) && - (en = static_cast(node))->flagsType()) { - xmlWriter().writeStartElement("p"); - writeGuidAttribute(node); - xmlWriter().writeAttribute("outputclass","h3 flags"); - marked = getMarkedUpSynopsis(en, relative, marker, CodeMarker::Detailed); - writeText(marked, marker, relative); - xmlWriter().writeCharacters("\n"); - marked = getMarkedUpSynopsis(en->flagsType(),relative,marker,CodeMarker::Detailed); - writeText(marked,marker,relative); - xmlWriter().writeEndElement(); //

    - } - else { - xmlWriter().writeStartElement("p"); - writeGuidAttribute(node); - xmlWriter().writeAttribute("outputclass","h3 fn"); - marked = getMarkedUpSynopsis(node, relative, marker, CodeMarker::Detailed); - writeText(marked, marker, relative); - xmlWriter().writeEndElement(); //

    - } - - generateStatus(node, marker); - generateBody(node, marker); - generateThreadSafeness(node, marker); - generateSince(node, marker); - - if (node->type() == Node::Property) { - const PropertyNode *property = static_cast(node); - Section section; - - section.members += property->getters(); - section.members += property->setters(); - section.members += property->resetters(); - - if (!section.members.isEmpty()) { - xmlWriter().writeStartElement("p"); - xmlWriter().writeCharacters("Access functions:"); - xmlWriter().writeEndElement(); //

    - generateSection(section.members, node, marker, CodeMarker::Accessors); - } - - Section notifiers; - notifiers.members += property->notifiers(); - - if (!notifiers.members.isEmpty()) { - xmlWriter().writeStartElement("p"); - xmlWriter().writeCharacters("Notifier signal:"); - xmlWriter().writeEndElement(); //

    - generateSection(notifiers.members, node, marker, CodeMarker::Accessors); - } - } - else if (node->type() == Node::Enum) { - en = static_cast(node); - if (en->flagsType()) { - xmlWriter().writeStartElement("p"); - QString text = "The " + protectEnc(en->flagsType()->name()) + - " type is a typedef for " + - "QFlags<" + - protectEnc(en->name()) + - ">. It stores an OR combination of " + - protectEnc(en->name()) + " values."; - xmlWriter().writeCharacters(text); - xmlWriter().writeEndElement(); //

    - } - } - generateAlsoList(node, marker); -} - void DitaXmlGenerator::findAllClasses(const InnerNode* node) { NodeList::const_iterator c = node->childNodes().constBegin(); diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index 427264c..b13fa49 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -217,9 +217,6 @@ class DitaXmlGenerator : public PageGenerator const Node* relative, CodeMarker* marker, const Node* actualNode = 0); - void generateDetailedMember(Node* node, - const InnerNode* relative, - CodeMarker* marker); void generateLink(const Atom* atom, const Node* relative, CodeMarker* marker); -- cgit v0.12 From 8256a4dfe14b214f517d35178e70f2613131ae99 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 10 Nov 2010 14:10:31 +0100 Subject: qdoc: Changed some outputclass attributes. --- tools/qdoc3/ditaxmlgenerator.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 90f2997..aace05a 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -4239,6 +4239,7 @@ void DitaXmlGenerator::generateQmlInherits(const QmlClassNode* cn, if (n && n->subType() == Node::QmlClass) { const QmlClassNode* qcn = static_cast(n); xmlWriter().writeStartElement("p"); + xmlWriter().writeAttribute("outputclass","inherits"); Text text; text << "[Inherits "; text << Atom(Atom::LinkNode,CodeMarker::stringForNode(qcn)); @@ -4286,6 +4287,7 @@ void DitaXmlGenerator::generateQmlInstantiates(const QmlClassNode* qcn, const ClassNode* cn = qcn->classNode(); if (cn && (cn->status() != Node::Internal)) { xmlWriter().writeStartElement("p"); + xmlWriter().writeAttribute("outputclass","instantiates"); Text text; text << "["; text << Atom(Atom::LinkNode,CodeMarker::stringForNode(qcn)); @@ -4311,13 +4313,13 @@ void DitaXmlGenerator::generateQmlInstantiates(const QmlClassNode* qcn, is set to Node::Internal, do nothing. */ void DitaXmlGenerator::generateInstantiatedBy(const ClassNode* cn, - CodeMarker* marker) + CodeMarker* marker) { if (cn && cn->status() != Node::Internal && !cn->qmlElement().isEmpty()) { const Node* n = myTree->root()->findNode(cn->qmlElement(),Node::Fake); if (n && n->subType() == Node::QmlClass) { xmlWriter().writeStartElement("p"); - xmlWriter().writeAttribute("outputclass","centerAlign"); + xmlWriter().writeAttribute("outputclass","instantiated-by"); Text text; text << "["; text << Atom(Atom::LinkNode,CodeMarker::stringForNode(cn)); -- cgit v0.12 From 466953c0504ec8d84115af4723d6039b21a98ed1 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 10 Nov 2010 14:14:35 +0100 Subject: Removed obsolete files. Apparently, these files are no longer used, being duplicates of those in doc/src/template. --- tools/qdoc3/test/scripts/functions.js | 60 -- tools/qdoc3/test/scripts/jquery.js | 152 ----- tools/qdoc3/test/style/style.css | 1051 --------------------------------- tools/qdoc3/test/style/style_ie6.css | 54 -- tools/qdoc3/test/style/style_ie7.css | 19 - tools/qdoc3/test/style/style_ie8.css | 0 6 files changed, 1336 deletions(-) delete mode 100644 tools/qdoc3/test/scripts/functions.js delete mode 100644 tools/qdoc3/test/scripts/jquery.js delete mode 100644 tools/qdoc3/test/style/style.css delete mode 100644 tools/qdoc3/test/style/style_ie6.css delete mode 100644 tools/qdoc3/test/style/style_ie7.css delete mode 100644 tools/qdoc3/test/style/style_ie8.css diff --git a/tools/qdoc3/test/scripts/functions.js b/tools/qdoc3/test/scripts/functions.js deleted file mode 100644 index 0135427..0000000 --- a/tools/qdoc3/test/scripts/functions.js +++ /dev/null @@ -1,60 +0,0 @@ - -/* START non link areas where cursor should change to pointing hand */ -$('.t_button').mouseover(function() { - $('.t_button').css('cursor','pointer'); - /*document.getElementById(this.id).style.cursor='pointer';*/ -}); - -/* END non link areas */ -$('#smallA').click(function() { - $('.content .heading,.content h1, .content h2, .content h3, .content p, .content li, .content table').css('font-size','smaller'); - $('.t_button').removeClass('active') - $(this).addClass('active') -}); - -$('#medA').click(function() { - $('.content .heading').css('font','600 16px/1 Arial'); - $('.content h1').css('font','600 18px/1.2 Arial'); - $('.content h2').css('font','600 16px/1.2 Arial'); - $('.content h3').css('font','600 14px/1.2 Arial'); - $('.content p').css('font','13px/20px Verdana'); - $('.content li').css('font','400 13px/1 Verdana'); - $('.content li').css('line-height','14px'); - $('.content table').css('font','13px/1.2 Verdana'); - $('.content .heading').css('font','600 16px/1 Arial'); - $('.content .indexboxcont li').css('font','600 13px/1 Verdana'); - $('.t_button').removeClass('active') - $(this).addClass('active') -}); - -$('#bigA').click(function() { - $('.content .heading,.content h1, .content h2, .content h3, .content p, .content li, .content table').css('font-size','large'); - $('.content .heading,.content h1, .content h2, .content h3, .content p, .content li, .content table').css('line-height','25px'); - $('.t_button').removeClass('active') - $(this).addClass('active') -}); - -function doSearch(str){ - -if (str.length>3) - { - alert('start search'); - // document.getElementById("refWrapper").innerHTML=""; - return; - } - else - return; - -// var url="indexSearch.php"; -// url=url+"?q="+str; - // url=url+"&sid="+Math.random(); - // var url="http://localhost:8983/solr/select?"; - // url=url+"&q="+str; - // url=url+"&fq=&start=0&rows=10&fl=&qt=&wt=&explainOther=&hl.fl="; - - // $.get(url, function(data){ - // alert(data); - // document.getElementById("refWrapper").innerHTML=data; - //}); - -} \ No newline at end of file diff --git a/tools/qdoc3/test/scripts/jquery.js b/tools/qdoc3/test/scripts/jquery.js deleted file mode 100644 index 0c7294c..0000000 --- a/tools/qdoc3/test/scripts/jquery.js +++ /dev/null @@ -1,152 +0,0 @@ -/*! - * jQuery JavaScript Library v1.4.1 - * http://jquery.com/ - * - * Copyright 2010, John Resig - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * Includes Sizzle.js - * http://sizzlejs.com/ - * Copyright 2010, The Dojo Foundation - * Released under the MIT, BSD, and GPL Licenses. - * - * Date: Mon Jan 25 19:43:33 2010 -0500 - */ -(function(z,v){function la(){if(!c.isReady){try{r.documentElement.doScroll("left")}catch(a){setTimeout(la,1);return}c.ready()}}function Ma(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function X(a,b,d,f,e,i){var j=a.length;if(typeof b==="object"){for(var n in b)X(a,n,b[n],f,e,d);return a}if(d!==v){f=!i&&f&&c.isFunction(d);for(n=0;n-1){i=j.data;i.beforeFilter&&i.beforeFilter[a.type]&&!i.beforeFilter[a.type](a)||f.push(j.selector)}else delete x[o]}i=c(a.target).closest(f, -a.currentTarget);m=0;for(s=i.length;m)[^>]*$|^#([\w-]+)$/,Qa=/^.[^:#\[\.,]*$/,Ra=/\S/,Sa=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,Ta=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,O=navigator.userAgent, -va=false,P=[],L,$=Object.prototype.toString,aa=Object.prototype.hasOwnProperty,ba=Array.prototype.push,Q=Array.prototype.slice,wa=Array.prototype.indexOf;c.fn=c.prototype={init:function(a,b){var d,f;if(!a)return this;if(a.nodeType){this.context=this[0]=a;this.length=1;return this}if(typeof a==="string")if((d=Pa.exec(a))&&(d[1]||!b))if(d[1]){f=b?b.ownerDocument||b:r;if(a=Ta.exec(a))if(c.isPlainObject(b)){a=[r.createElement(a[1])];c.fn.attr.call(a,b,true)}else a=[f.createElement(a[1])];else{a=ra([d[1]], -[f]);a=(a.cacheable?a.fragment.cloneNode(true):a.fragment).childNodes}}else{if(b=r.getElementById(d[2])){if(b.id!==d[2])return S.find(a);this.length=1;this[0]=b}this.context=r;this.selector=a;return this}else if(!b&&/^\w+$/.test(a)){this.selector=a;this.context=r;a=r.getElementsByTagName(a)}else return!b||b.jquery?(b||S).find(a):c(b).find(a);else if(c.isFunction(a))return S.ready(a);if(a.selector!==v){this.selector=a.selector;this.context=a.context}return c.isArray(a)?this.setArray(a):c.makeArray(a, -this)},selector:"",jquery:"1.4.1",length:0,size:function(){return this.length},toArray:function(){return Q.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this.slice(a)[0]:this[a]},pushStack:function(a,b,d){a=c(a||null);a.prevObject=this;a.context=this.context;if(b==="find")a.selector=this.selector+(this.selector?" ":"")+d;else if(b)a.selector=this.selector+"."+b+"("+d+")";return a},setArray:function(a){this.length=0;ba.apply(this,a);return this},each:function(a,b){return c.each(this, -a,b)},ready:function(a){c.bindReady();if(c.isReady)a.call(r,c);else P&&P.push(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(Q.apply(this,arguments),"slice",Q.call(arguments).join(","))},map:function(a){return this.pushStack(c.map(this,function(b,d){return a.call(b,d,b)}))},end:function(){return this.prevObject||c(null)},push:ba,sort:[].sort,splice:[].splice}; -c.fn.init.prototype=c.fn;c.extend=c.fn.extend=function(){var a=arguments[0]||{},b=1,d=arguments.length,f=false,e,i,j,n;if(typeof a==="boolean"){f=a;a=arguments[1]||{};b=2}if(typeof a!=="object"&&!c.isFunction(a))a={};if(d===b){a=this;--b}for(;b
    a";var e=d.getElementsByTagName("*"),i=d.getElementsByTagName("a")[0];if(!(!e||!e.length||!i)){c.support= -{leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(i.getAttribute("style")),hrefNormalized:i.getAttribute("href")==="/a",opacity:/^0.55$/.test(i.style.opacity),cssFloat:!!i.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:r.createElement("select").appendChild(r.createElement("option")).selected,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null}; -b.type="text/javascript";try{b.appendChild(r.createTextNode("window."+f+"=1;"))}catch(j){}a.insertBefore(b,a.firstChild);if(z[f]){c.support.scriptEval=true;delete z[f]}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function n(){c.support.noCloneEvent=false;d.detachEvent("onclick",n)});d.cloneNode(true).fireEvent("onclick")}d=r.createElement("div");d.innerHTML="";a=r.createDocumentFragment();a.appendChild(d.firstChild); -c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var n=r.createElement("div");n.style.width=n.style.paddingLeft="1px";r.body.appendChild(n);c.boxModel=c.support.boxModel=n.offsetWidth===2;r.body.removeChild(n).style.display="none"});a=function(n){var o=r.createElement("div");n="on"+n;var m=n in o;if(!m){o.setAttribute(n,"return;");m=typeof o[n]==="function"}return m};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=e=i=null}})();c.props= -{"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var G="jQuery"+J(),Ua=0,xa={},Va={};c.extend({cache:{},expando:G,noData:{embed:true,object:true,applet:true},data:function(a,b,d){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==z?xa:a;var f=a[G],e=c.cache;if(!b&&!f)return null;f||(f=++Ua);if(typeof b==="object"){a[G]=f;e=e[f]=c.extend(true, -{},b)}else e=e[f]?e[f]:typeof d==="undefined"?Va:(e[f]={});if(d!==v){a[G]=f;e[b]=d}return typeof b==="string"?e[b]:e}},removeData:function(a,b){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==z?xa:a;var d=a[G],f=c.cache,e=f[d];if(b){if(e){delete e[b];c.isEmptyObject(e)&&c.removeData(a)}}else{try{delete a[G]}catch(i){a.removeAttribute&&a.removeAttribute(G)}delete f[d]}}}});c.fn.extend({data:function(a,b){if(typeof a==="undefined"&&this.length)return c.data(this[0]);else if(typeof a==="object")return this.each(function(){c.data(this, -a)});var d=a.split(".");d[1]=d[1]?"."+d[1]:"";if(b===v){var f=this.triggerHandler("getData"+d[1]+"!",[d[0]]);if(f===v&&this.length)f=c.data(this[0],a);return f===v&&d[1]?this.data(d[0]):f}else return this.trigger("setData"+d[1]+"!",[d[0],b]).each(function(){c.data(this,a,b)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var f=c.data(a,b);if(!d)return f||[];if(!f||c.isArray(d))f=c.data(a,b,c.makeArray(d));else f.push(d); -return f}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),f=d.shift();if(f==="inprogress")f=d.shift();if(f){b==="fx"&&d.unshift("inprogress");f.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b===v)return c.queue(this[0],a);return this.each(function(){var d=c.queue(this,a,b);a==="fx"&&d[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this,a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]|| -a:a;b=b||"fx";return this.queue(b,function(){var d=this;setTimeout(function(){c.dequeue(d,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var ya=/[\n\t]/g,ca=/\s+/,Wa=/\r/g,Xa=/href|src|style/,Ya=/(button|input)/i,Za=/(button|input|object|select|textarea)/i,$a=/^(a|area)$/i,za=/radio|checkbox/;c.fn.extend({attr:function(a,b){return X(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this,a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(o){var m= -c(this);m.addClass(a.call(this,o,m.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(ca),d=0,f=this.length;d-1)return true;return false},val:function(a){if(a===v){var b=this[0];if(b){if(c.nodeName(b,"option"))return(b.attributes.value|| -{}).specified?b.value:b.text;if(c.nodeName(b,"select")){var d=b.selectedIndex,f=[],e=b.options;b=b.type==="select-one";if(d<0)return null;var i=b?d:0;for(d=b?d+1:e.length;i=0;else if(c.nodeName(this,"select")){var x=c.makeArray(s);c("option",this).each(function(){this.selected=c.inArray(c(this).val(),x)>=0});if(!x.length)this.selectedIndex=-1}else this.value=s}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(a,b,d,f){if(!a||a.nodeType===3||a.nodeType===8)return v;if(f&&b in c.attrFn)return c(a)[b](d); -f=a.nodeType!==1||!c.isXMLDoc(a);var e=d!==v;b=f&&c.props[b]||b;if(a.nodeType===1){var i=Xa.test(b);if(b in a&&f&&!i){if(e){b==="type"&&Ya.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed");a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&b.specified?b.value:Za.test(a.nodeName)||$a.test(a.nodeName)&&a.href?0:v;return a[b]}if(!c.support.style&&f&&b==="style"){if(e)a.style.cssText= -""+d;return a.style.cssText}e&&a.setAttribute(b,""+d);a=!c.support.hrefNormalized&&f&&i?a.getAttribute(b,2):a.getAttribute(b);return a===null?v:a}return c.style(a,b,d)}});var ab=function(a){return a.replace(/[^\w\s\.\|`]/g,function(b){return"\\"+b})};c.event={add:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){if(a.setInterval&&a!==z&&!a.frameElement)a=z;if(!d.guid)d.guid=c.guid++;if(f!==v){d=c.proxy(d);d.data=f}var e=c.data(a,"events")||c.data(a,"events",{}),i=c.data(a,"handle"),j;if(!i){j= -function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(j.elem,arguments):v};i=c.data(a,"handle",j)}if(i){i.elem=a;b=b.split(/\s+/);for(var n,o=0;n=b[o++];){var m=n.split(".");n=m.shift();if(o>1){d=c.proxy(d);if(f!==v)d.data=f}d.type=m.slice(0).sort().join(".");var s=e[n],x=this.special[n]||{};if(!s){s=e[n]={};if(!x.setup||x.setup.call(a,f,m,d)===false)if(a.addEventListener)a.addEventListener(n,i,false);else a.attachEvent&&a.attachEvent("on"+n,i)}if(x.add)if((m=x.add.call(a, -d,f,m,s))&&c.isFunction(m)){m.guid=m.guid||d.guid;m.data=m.data||d.data;m.type=m.type||d.type;d=m}s[d.guid]=d;this.global[n]=true}a=null}}},global:{},remove:function(a,b,d){if(!(a.nodeType===3||a.nodeType===8)){var f=c.data(a,"events"),e,i,j;if(f){if(b===v||typeof b==="string"&&b.charAt(0)===".")for(i in f)this.remove(a,i+(b||""));else{if(b.type){d=b.handler;b=b.type}b=b.split(/\s+/);for(var n=0;i=b[n++];){var o=i.split(".");i=o.shift();var m=!o.length,s=c.map(o.slice(0).sort(),ab);s=new RegExp("(^|\\.)"+ -s.join("\\.(?:.*\\.)?")+"(\\.|$)");var x=this.special[i]||{};if(f[i]){if(d){j=f[i][d.guid];delete f[i][d.guid]}else for(var A in f[i])if(m||s.test(f[i][A].type))delete f[i][A];x.remove&&x.remove.call(a,o,j);for(e in f[i])break;if(!e){if(!x.teardown||x.teardown.call(a,o)===false)if(a.removeEventListener)a.removeEventListener(i,c.data(a,"handle"),false);else a.detachEvent&&a.detachEvent("on"+i,c.data(a,"handle"));e=null;delete f[i]}}}}for(e in f)break;if(!e){if(A=c.data(a,"handle"))A.elem=null;c.removeData(a, -"events");c.removeData(a,"handle")}}}},trigger:function(a,b,d,f){var e=a.type||a;if(!f){a=typeof a==="object"?a[G]?a:c.extend(c.Event(e),a):c.Event(e);if(e.indexOf("!")>=0){a.type=e=e.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();this.global[e]&&c.each(c.cache,function(){this.events&&this.events[e]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===8)return v;a.result=v;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(f=c.data(d,"handle"))&&f.apply(d, -b);f=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+e]&&d["on"+e].apply(d,b)===false)a.result=false}catch(i){}if(!a.isPropagationStopped()&&f)c.event.trigger(a,b,f,true);else if(!a.isDefaultPrevented()){d=a.target;var j;if(!(c.nodeName(d,"a")&&e==="click")&&!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()])){try{if(d[e]){if(j=d["on"+e])d["on"+e]=null;this.triggered=true;d[e]()}}catch(n){}if(j)d["on"+e]=j;this.triggered=false}}},handle:function(a){var b, -d;a=arguments[0]=c.event.fix(a||z.event);a.currentTarget=this;d=a.type.split(".");a.type=d.shift();b=!d.length&&!a.exclusive;var f=new RegExp("(^|\\.)"+d.slice(0).sort().join("\\.(?:.*\\.)?")+"(\\.|$)");d=(c.data(this,"events")||{})[a.type];for(var e in d){var i=d[e];if(b||f.test(i.type)){a.handler=i;a.data=i.data;i=i.apply(this,arguments);if(i!==v){a.result=i;if(i===false){a.preventDefault();a.stopPropagation()}}if(a.isImmediatePropagationStopped())break}}return a.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "), -fix:function(a){if(a[G])return a;var b=a;a=c.Event(b);for(var d=this.props.length,f;d;){f=this.props[--d];a[f]=b[f]}if(!a.target)a.target=a.srcElement||r;if(a.target.nodeType===3)a.target=a.target.parentNode;if(!a.relatedTarget&&a.fromElement)a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement;if(a.pageX==null&&a.clientX!=null){b=r.documentElement;d=r.body;a.pageX=a.clientX+(b&&b.scrollLeft||d&&d.scrollLeft||0)-(b&&b.clientLeft||d&&d.clientLeft||0);a.pageY=a.clientY+(b&&b.scrollTop|| -d&&d.scrollTop||0)-(b&&b.clientTop||d&&d.clientTop||0)}if(!a.which&&(a.charCode||a.charCode===0?a.charCode:a.keyCode))a.which=a.charCode||a.keyCode;if(!a.metaKey&&a.ctrlKey)a.metaKey=a.ctrlKey;if(!a.which&&a.button!==v)a.which=a.button&1?1:a.button&2?3:a.button&4?2:0;return a},guid:1E8,proxy:c.proxy,special:{ready:{setup:c.bindReady,teardown:c.noop},live:{add:function(a,b){c.extend(a,b||{});a.guid+=b.selector+b.live;b.liveProxy=a;c.event.add(this,b.live,na,b)},remove:function(a){if(a.length){var b= -0,d=new RegExp("(^|\\.)"+a[0]+"(\\.|$)");c.each(c.data(this,"events").live||{},function(){d.test(this.type)&&b++});b<1&&c.event.remove(this,a[0],na)}},special:{}},beforeunload:{setup:function(a,b,d){if(this.setInterval)this.onbeforeunload=d;return false},teardown:function(a,b){if(this.onbeforeunload===b)this.onbeforeunload=null}}}};c.Event=function(a){if(!this.preventDefault)return new c.Event(a);if(a&&a.type){this.originalEvent=a;this.type=a.type}else this.type=a;this.timeStamp=J();this[G]=true}; -c.Event.prototype={preventDefault:function(){this.isDefaultPrevented=Z;var a=this.originalEvent;if(a){a.preventDefault&&a.preventDefault();a.returnValue=false}},stopPropagation:function(){this.isPropagationStopped=Z;var a=this.originalEvent;if(a){a.stopPropagation&&a.stopPropagation();a.cancelBubble=true}},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=Z;this.stopPropagation()},isDefaultPrevented:Y,isPropagationStopped:Y,isImmediatePropagationStopped:Y};var Aa=function(a){for(var b= -a.relatedTarget;b&&b!==this;)try{b=b.parentNode}catch(d){break}if(b!==this){a.type=a.data;c.event.handle.apply(this,arguments)}},Ba=function(a){a.type=a.data;c.event.handle.apply(this,arguments)};c.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){c.event.special[a]={setup:function(d){c.event.add(this,b,d&&d.selector?Ba:Aa,a)},teardown:function(d){c.event.remove(this,b,d&&d.selector?Ba:Aa)}}});if(!c.support.submitBubbles)c.event.special.submit={setup:function(a,b,d){if(this.nodeName.toLowerCase()!== -"form"){c.event.add(this,"click.specialSubmit."+d.guid,function(f){var e=f.target,i=e.type;if((i==="submit"||i==="image")&&c(e).closest("form").length)return ma("submit",this,arguments)});c.event.add(this,"keypress.specialSubmit."+d.guid,function(f){var e=f.target,i=e.type;if((i==="text"||i==="password")&&c(e).closest("form").length&&f.keyCode===13)return ma("submit",this,arguments)})}else return false},remove:function(a,b){c.event.remove(this,"click.specialSubmit"+(b?"."+b.guid:""));c.event.remove(this, -"keypress.specialSubmit"+(b?"."+b.guid:""))}};if(!c.support.changeBubbles){var da=/textarea|input|select/i;function Ca(a){var b=a.type,d=a.value;if(b==="radio"||b==="checkbox")d=a.checked;else if(b==="select-multiple")d=a.selectedIndex>-1?c.map(a.options,function(f){return f.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d}function ea(a,b){var d=a.target,f,e;if(!(!da.test(d.nodeName)||d.readOnly)){f=c.data(d,"_change_data");e=Ca(d);if(a.type!=="focusout"|| -d.type!=="radio")c.data(d,"_change_data",e);if(!(f===v||e===f))if(f!=null||e){a.type="change";return c.event.trigger(a,b,d)}}}c.event.special.change={filters:{focusout:ea,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return ea.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return ea.call(this,a)},beforeactivate:function(a){a= -a.target;a.nodeName.toLowerCase()==="input"&&a.type==="radio"&&c.data(a,"_change_data",Ca(a))}},setup:function(a,b,d){for(var f in T)c.event.add(this,f+".specialChange."+d.guid,T[f]);return da.test(this.nodeName)},remove:function(a,b){for(var d in T)c.event.remove(this,d+".specialChange"+(b?"."+b.guid:""),T[d]);return da.test(this.nodeName)}};var T=c.event.special.change.filters}r.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(f){f=c.event.fix(f);f.type=b;return c.event.handle.call(this, -f)}c.event.special[b]={setup:function(){this.addEventListener(a,d,true)},teardown:function(){this.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,f,e){if(typeof d==="object"){for(var i in d)this[b](i,f,d[i],e);return this}if(c.isFunction(f)){e=f;f=v}var j=b==="one"?c.proxy(e,function(n){c(this).unbind(n,j);return e.apply(this,arguments)}):e;return d==="unload"&&b!=="one"?this.one(d,f,e):this.each(function(){c.event.add(this,d,j,f)})}});c.fn.extend({unbind:function(a, -b){if(typeof a==="object"&&!a.preventDefault){for(var d in a)this.unbind(d,a[d]);return this}return this.each(function(){c.event.remove(this,a,b)})},trigger:function(a,b){return this.each(function(){c.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0]){a=c.Event(a);a.preventDefault();a.stopPropagation();c.event.trigger(a,b,this[0]);return a.result}},toggle:function(a){for(var b=arguments,d=1;d0){y=t;break}}t=t[g]}l[q]=y}}}var f=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,e=0,i=Object.prototype.toString,j=false,n=true;[0,0].sort(function(){n=false;return 0});var o=function(g,h,k,l){k=k||[];var q=h=h||r;if(h.nodeType!==1&&h.nodeType!==9)return[];if(!g|| -typeof g!=="string")return k;for(var p=[],u,t,y,R,H=true,M=w(h),I=g;(f.exec(""),u=f.exec(I))!==null;){I=u[3];p.push(u[1]);if(u[2]){R=u[3];break}}if(p.length>1&&s.exec(g))if(p.length===2&&m.relative[p[0]])t=fa(p[0]+p[1],h);else for(t=m.relative[p[0]]?[h]:o(p.shift(),h);p.length;){g=p.shift();if(m.relative[g])g+=p.shift();t=fa(g,t)}else{if(!l&&p.length>1&&h.nodeType===9&&!M&&m.match.ID.test(p[0])&&!m.match.ID.test(p[p.length-1])){u=o.find(p.shift(),h,M);h=u.expr?o.filter(u.expr,u.set)[0]:u.set[0]}if(h){u= -l?{expr:p.pop(),set:A(l)}:o.find(p.pop(),p.length===1&&(p[0]==="~"||p[0]==="+")&&h.parentNode?h.parentNode:h,M);t=u.expr?o.filter(u.expr,u.set):u.set;if(p.length>0)y=A(t);else H=false;for(;p.length;){var D=p.pop();u=D;if(m.relative[D])u=p.pop();else D="";if(u==null)u=h;m.relative[D](y,u,M)}}else y=[]}y||(y=t);y||o.error(D||g);if(i.call(y)==="[object Array]")if(H)if(h&&h.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&E(h,y[g])))k.push(t[g])}else for(g=0;y[g]!=null;g++)y[g]&& -y[g].nodeType===1&&k.push(t[g]);else k.push.apply(k,y);else A(y,k);if(R){o(R,q,k,l);o.uniqueSort(k)}return k};o.uniqueSort=function(g){if(C){j=n;g.sort(C);if(j)for(var h=1;h":function(g,h){var k=typeof h==="string";if(k&&!/\W/.test(h)){h=h.toLowerCase();for(var l=0,q=g.length;l=0))k||l.push(u);else if(k)h[p]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()},CHILD:function(g){if(g[1]==="nth"){var h=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&& -"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=h[1]+(h[2]||1)-0;g[3]=h[3]-0}g[0]=e++;return g},ATTR:function(g,h,k,l,q,p){h=g[1].replace(/\\/g,"");if(!p&&m.attrMap[h])g[1]=m.attrMap[h];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,h,k,l,q){if(g[1]==="not")if((f.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=o(g[3],null,null,h);else{g=o.filter(g[3],h,k,true^q);k||l.push.apply(l,g);return false}else if(m.match.POS.test(g[0])||m.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true); -return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled===true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,h,k){return!!o(k[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)},text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"=== -g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"===g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}},setFilters:{first:function(g,h){return h===0},last:function(g,h,k,l){return h===l.length-1},even:function(g,h){return h%2=== -0},odd:function(g,h){return h%2===1},lt:function(g,h,k){return hk[3]-0},nth:function(g,h,k){return k[3]-0===h},eq:function(g,h,k){return k[3]-0===h}},filter:{PSEUDO:function(g,h,k,l){var q=h[1],p=m.filters[q];if(p)return p(g,k,h,l);else if(q==="contains")return(g.textContent||g.innerText||a([g])||"").indexOf(h[3])>=0;else if(q==="not"){h=h[3];k=0;for(l=h.length;k= -0}},ID:function(g,h){return g.nodeType===1&&g.getAttribute("id")===h},TAG:function(g,h){return h==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===h},CLASS:function(g,h){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(h)>-1},ATTR:function(g,h){var k=h[1];g=m.attrHandle[k]?m.attrHandle[k](g):g[k]!=null?g[k]:g.getAttribute(k);k=g+"";var l=h[2];h=h[4];return g==null?l==="!=":l==="="?k===h:l==="*="?k.indexOf(h)>=0:l==="~="?(" "+k+" ").indexOf(h)>=0:!h?k&&g!==false:l==="!="?k!==h:l==="^="? -k.indexOf(h)===0:l==="$="?k.substr(k.length-h.length)===h:l==="|="?k===h||k.substr(0,h.length+1)===h+"-":false},POS:function(g,h,k,l){var q=m.setFilters[h[2]];if(q)return q(g,k,h,l)}}},s=m.match.POS;for(var x in m.match){m.match[x]=new RegExp(m.match[x].source+/(?![^\[]*\])(?![^\(]*\))/.source);m.leftMatch[x]=new RegExp(/(^(?:.|\r|\n)*?)/.source+m.match[x].source.replace(/\\(\d+)/g,function(g,h){return"\\"+(h-0+1)}))}var A=function(g,h){g=Array.prototype.slice.call(g,0);if(h){h.push.apply(h,g);return h}return g}; -try{Array.prototype.slice.call(r.documentElement.childNodes,0)}catch(B){A=function(g,h){h=h||[];if(i.call(g)==="[object Array]")Array.prototype.push.apply(h,g);else if(typeof g.length==="number")for(var k=0,l=g.length;k";var k=r.documentElement;k.insertBefore(g,k.firstChild);if(r.getElementById(h)){m.find.ID=function(l,q,p){if(typeof q.getElementById!=="undefined"&&!p)return(q=q.getElementById(l[1]))?q.id===l[1]||typeof q.getAttributeNode!=="undefined"&&q.getAttributeNode("id").nodeValue===l[1]?[q]:v:[]};m.filter.ID=function(l,q){var p=typeof l.getAttributeNode!=="undefined"&&l.getAttributeNode("id"); -return l.nodeType===1&&p&&p.nodeValue===q}}k.removeChild(g);k=g=null})();(function(){var g=r.createElement("div");g.appendChild(r.createComment(""));if(g.getElementsByTagName("*").length>0)m.find.TAG=function(h,k){k=k.getElementsByTagName(h[1]);if(h[1]==="*"){h=[];for(var l=0;k[l];l++)k[l].nodeType===1&&h.push(k[l]);k=h}return k};g.innerHTML="";if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")m.attrHandle.href=function(h){return h.getAttribute("href", -2)};g=null})();r.querySelectorAll&&function(){var g=o,h=r.createElement("div");h.innerHTML="

    ";if(!(h.querySelectorAll&&h.querySelectorAll(".TEST").length===0)){o=function(l,q,p,u){q=q||r;if(!u&&q.nodeType===9&&!w(q))try{return A(q.querySelectorAll(l),p)}catch(t){}return g(l,q,p,u)};for(var k in g)o[k]=g[k];h=null}}();(function(){var g=r.createElement("div");g.innerHTML="
    ";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length=== -0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){m.order.splice(1,0,"CLASS");m.find.CLASS=function(h,k,l){if(typeof k.getElementsByClassName!=="undefined"&&!l)return k.getElementsByClassName(h[1])};g=null}}})();var E=r.compareDocumentPosition?function(g,h){return g.compareDocumentPosition(h)&16}:function(g,h){return g!==h&&(g.contains?g.contains(h):true)},w=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false},fa=function(g,h){var k=[], -l="",q;for(h=h.nodeType?[h]:h;q=m.match.PSEUDO.exec(g);){l+=q[0];g=g.replace(m.match.PSEUDO,"")}g=m.relative[g]?g+"*":g;q=0;for(var p=h.length;q=0===d})};c.fn.extend({find:function(a){for(var b=this.pushStack("","find",a),d=0,f=0,e=this.length;f0)for(var i=d;i0},closest:function(a,b){if(c.isArray(a)){var d=[],f=this[0],e,i={},j;if(f&&a.length){e=0;for(var n=a.length;e --1:c(f).is(e)){d.push({selector:j,elem:f});delete i[j]}}f=f.parentNode}}return d}var o=c.expr.match.POS.test(a)?c(a,b||this.context):null;return this.map(function(m,s){for(;s&&s.ownerDocument&&s!==b;){if(o?o.index(s)>-1:c(s).is(a))return s;s=s.parentNode}return null})},index:function(a){if(!a||typeof a==="string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){a=typeof a==="string"?c(a,b||this.context):c.makeArray(a);b=c.merge(this.get(), -a);return this.pushStack(pa(a[0])||pa(b[0])?b:c.unique(b))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode",d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")}, -nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,b){c.fn[a]=function(d,f){var e=c.map(this,b,d);bb.test(a)||(f=d);if(f&&typeof f==="string")e=c.filter(f,e);e=this.length>1?c.unique(e): -e;if((this.length>1||db.test(f))&&cb.test(a))e=e.reverse();return this.pushStack(e,a,Q.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return c.find.matches(a,b)},dir:function(a,b,d){var f=[];for(a=a[b];a&&a.nodeType!==9&&(d===v||a.nodeType!==1||!c(a).is(d));){a.nodeType===1&&f.push(a);a=a[b]}return f},nth:function(a,b,d){b=b||1;for(var f=0;a;a=a[d])if(a.nodeType===1&&++f===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!== -b&&d.push(a);return d}});var Fa=/ jQuery\d+="(?:\d+|null)"/g,V=/^\s+/,Ga=/(<([\w:]+)[^>]*?)\/>/g,eb=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,Ha=/<([\w:]+)/,fb=/"},F={option:[1,""],legend:[1,"
    ","
    "],thead:[1,"","
    "],tr:[2,"","
    "],td:[3,"","
    "], -col:[2,"","
    "],area:[1,"",""],_default:[0,"",""]};F.optgroup=F.option;F.tbody=F.tfoot=F.colgroup=F.caption=F.thead;F.th=F.td;if(!c.support.htmlSerialize)F._default=[1,"div
    ","
    "];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d=c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==v)return this.empty().append((this[0]&&this[0].ownerDocument||r).createTextNode(a));return c.getText(this)}, -wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this},wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length? -d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments, -false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&& -!c.isXMLDoc(this)){var d=this.outerHTML,f=this.ownerDocument;if(!d){d=f.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(Fa,"").replace(V,"")],f)[0]}else return this.cloneNode(true)});if(a===true){qa(this,b);qa(this.find("*"),b.find("*"))}return b},html:function(a){if(a===v)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Fa,""):null;else if(typeof a==="string"&&!/\n"; - out() << " \n"; - - - // Adding syntax highlighter // future release - - // Setting some additional style sheet related details depending on configuration (e.g. Online/Creator) - - switch (application) { - case Online: - // Adding style and js for small windows - out() << " \n"; - out() << " "; - out() << " \n"; - out() << " \n"; - // Browser spec styles - out() << " \n"; - out() << "\n"; - out() << "\n"; - out() << "\n"; - - out() << "\n"; - // CheckEmptyAndLoadList activating search - out() << "\n"; - break; - case Creator: - out() << "\n"; - out() << "\n"; // offline narrow - break; - default: - out() << "\n"; - out() << "\n"; - break; - } + + // Include style sheet and script links. + out() << headerStyles; + out() << headerScripts; + out() << endHeader; #ifdef GENERATE_MAC_REFS if (mainPage) generateMacRef(node, marker); #endif - switch (application) { - case Online: - out() << QString(postHeader).replace("\\" + COMMAND_VERSION, myTree->version()); - generateBreadCrumbs(title,node,marker); - out() << QString(postPostHeader).replace("\\" + COMMAND_VERSION, myTree->version()); - break; - case Creator: - out() << QString(creatorPostHeader).replace("\\" + COMMAND_VERSION, myTree->version()); - generateBreadCrumbs(title,node,marker); - out() << QString(creatorPostPostHeader).replace("\\" + COMMAND_VERSION, myTree->version()); - break; - default: // default -- not used except if one forgets to set any of the above settings to true - out() << QString(creatorPostHeader).replace("\\" + COMMAND_VERSION, myTree->version()); - generateBreadCrumbs(title,node,marker); - out() << QString(creatorPostPostHeader).replace("\\" + COMMAND_VERSION, myTree->version()); - break; - } + out() << QString(postHeader).replace("\\" + COMMAND_VERSION, myTree->version()); + generateBreadCrumbs(title,node,marker); + out() << QString(postPostHeader).replace("\\" + COMMAND_VERSION, myTree->version()); - navigationLinks.clear(); + navigationLinks.clear(); if (node && !node->links().empty()) { QPair linkPair; @@ -1960,30 +1900,8 @@ void HtmlGenerator::generateFooter(const Node *node) out() << QString(footer).replace("\\" + COMMAND_VERSION, myTree->version()) << QString(address).replace("\\" + COMMAND_VERSION, myTree->version()); - switch (application) { - case Online: - out() << " \n"; - out() << " \n"; - out() << "\n"; - break; - case Creator: - out() << "\n"; - break; - default: - out() << "\n"; - } - out() << "\n"; + out() << "\n"; + out() << "\n"; } void HtmlGenerator::generateBrief(const Node *node, CodeMarker *marker, diff --git a/tools/qdoc3/htmlgenerator.h b/tools/qdoc3/htmlgenerator.h index d885ada..1b3de9e 100644 --- a/tools/qdoc3/htmlgenerator.h +++ b/tools/qdoc3/htmlgenerator.h @@ -95,10 +95,6 @@ class HtmlGenerator : public PageGenerator LastSinceType }; - enum Application { - Online, - Creator}; - public: HtmlGenerator(); ~HtmlGenerator(); @@ -301,11 +297,13 @@ class HtmlGenerator : public PageGenerator bool inTableHeader; int numTableRows; bool threeColumnEnumValueTable; - Application application; QString link; QStringList sectionNumber; QRegExp funcLeftParen; QString style; + QString headerScripts; + QString headerStyles; + QString endHeader; QString postHeader; QString postPostHeader; QString creatorPostHeader; @@ -350,9 +348,6 @@ class HtmlGenerator : public PageGenerator #define HTMLGENERATOR_POSTPOSTHEADER "postpostheader" #define HTMLGENERATOR_CREATORPOSTHEADER "postheader" #define HTMLGENERATOR_CREATORPOSTPOSTHEADER "postpostheader" -#define HTMLGENERATOR_STYLE "style" -#define HTMLGENERATOR_STYLESHEETS "stylesheets" -#define HTMLGENERATOR_CUSTOMHEADELEMENTS "customheadelements" QT_END_NAMESPACE diff --git a/tools/qdoc3/main.cpp b/tools/qdoc3/main.cpp index 2bfe38e..85b23e9 100644 --- a/tools/qdoc3/main.cpp +++ b/tools/qdoc3/main.cpp @@ -105,7 +105,6 @@ static bool showInternal = false; static bool obsoleteLinks = false; static QStringList defines; static QHash trees; -static QString appArg; // application /*! Find the Tree for language \a lang and return a pointer to it. @@ -193,24 +192,6 @@ static void processQdocconfFile(const QString &fileName) config.load(fileName); /* - Set the application to which qdoc will create the output. - The two applications are: - - creator: additional formatting for viewing in - the Creator application. - - online: full-featured online version with search and - links to Qt topics - */ - if (appArg.isEmpty()) { - qDebug() << "Warning: Application flag not specified on" - << "command line. Options are -creator (default)" - << "and -online."; - appArg = "creator"; - } - config.setStringList(CONFIG_APPLICATION, QStringList(appArg)); - - /* Add the defines to the configuration variables. */ QStringList defs = defines + config.getStringList(CONFIG_DEFINES); @@ -481,10 +462,6 @@ int main(int argc, char **argv) else if (opt == "-obsoletelinks") { obsoleteLinks = true; } - else if (opt == "-creator") - appArg = "creator"; - else if (opt == "-online") - appArg = "online"; else { qdocFiles.append(opt); } diff --git a/tools/qdoc3/test/qt-api-only.qdocconf b/tools/qdoc3/test/qt-api-only.qdocconf index cdd7a7c..36637d2 100644 --- a/tools/qdoc3/test/qt-api-only.qdocconf +++ b/tools/qdoc3/test/qt-api-only.qdocconf @@ -1,34 +1,2 @@ include(qt-build-docs.qdocconf) - -# Ensures that the generated index contains a URL that can be used by the -# tools documentation (assistant.qdocconf, designer.qdocconf, linguist.qdocconf, -# qmake.qdocconf). - -url = ./ - -# Ensures that the documentation for the tools is not included in the generated -# .qhp file. - -qhp.Qt.excluded += $QT_SOURCE_TREE/doc/src/development/assistant-manual.qdoc \ - $QT_SOURCE_TREE/doc/src/examples/simpletextviewer.qdoc \ - $QT_SOURCE_TREE/doc/src/development/designer-manual.qdoc \ - $QT_SOURCE_TREE/doc/src/examples/calculatorbuilder.qdoc \ - $QT_SOURCE_TREE/doc/src/examples/calculatorform.qdoc \ - $QT_SOURCE_TREE/doc/src/examples/customwidgetplugin.qdoc \ - $QT_SOURCE_TREE/doc/src/examples/taskmenuextension.qdoc \ - $QT_SOURCE_TREE/doc/src/examples/containerextension.qdoc \ - $QT_SOURCE_TREE/doc/src/examples/worldtimeclockbuilder.qdoc \ - $QT_SOURCE_TREE/doc/src/examples/worldtimeclockplugin.qdoc \ - $QT_SOURCE_TREE/doc/src/internationalization/linguist-manual.qdoc \ - $QT_SOURCE_TREE/doc/src/examples/hellotr.qdoc \ - $QT_SOURCE_TREE/doc/src/examples/arrowpad.qdoc \ - $QT_SOURCE_TREE/doc/src/examples/trollprint.qdoc \ - $QT_SOURCE_TREE/doc/src/development/qmake-manual.qdoc - -# Remove the QML documentation from the Qt-only documentation. - -excludedirs += $QT_SOURCE_TREE/src/imports - -outputdir = $QT_BUILD_TREE/doc-build/html-qt -tagfile = $QT_BUILD_TREE/doc-build/html-qt/qt.tags -base = file:$QT_BUILD_TREE/doc-build/html-qt +include(qt-project-api-only.qdocconf) diff --git a/tools/qdoc3/test/qt-build-docs-online.qdocconf b/tools/qdoc3/test/qt-build-docs-online.qdocconf new file mode 100644 index 0000000..2962845 --- /dev/null +++ b/tools/qdoc3/test/qt-build-docs-online.qdocconf @@ -0,0 +1,2 @@ +include(qt-project.qdocconf) +include(qt-html-templates-online.qdocconf) diff --git a/tools/qdoc3/test/qt-build-docs.qdocconf b/tools/qdoc3/test/qt-build-docs.qdocconf index dcabeb4..4dbe1cd 100644 --- a/tools/qdoc3/test/qt-build-docs.qdocconf +++ b/tools/qdoc3/test/qt-build-docs.qdocconf @@ -1,147 +1,2 @@ -include(compat.qdocconf) -include(macros.qdocconf) -include(qt-cpp-ignore.qdocconf) +include(qt-project.qdocconf) include(qt-html-templates.qdocconf) -include(qt-defines.qdocconf) - -project = Qt -description = Qt Reference Documentation -url = http://qt.nokia.com/doc/4.7 - -sourceencoding = UTF-8 -outputencoding = UTF-8 -naturallanguage = en_US - -qhp.projects = Qt - -qhp.Qt.file = qt.qhp -qhp.Qt.namespace = com.trolltech.qt.471 -qhp.Qt.virtualFolder = qdoc -qhp.Qt.indexTitle = Qt Reference Documentation -qhp.Qt.indexRoot = - -# Files not referenced in any qdoc file (last four are needed by qtdemo) -# See also extraimages.HTML -qhp.Qt.extraFiles = index.html \ - images/bg_l.png \ - images/bg_l_blank.png \ - images/bg_ll_blank.png \ - images/bg_ul_blank.png \ - images/header_bg.png \ - images/bg_r.png \ - images/box_bg.png \ - images/breadcrumb.png \ - images/bullet_gt.png \ - images/bullet_dn.png \ - images/bullet_sq.png \ - images/bullet_up.png \ - images/arrow_down.png \ - images/feedbackground.png \ - images/horBar.png \ - images/page.png \ - images/page_bg.png \ - images/sprites-combined.png \ - images/spinner.gif \ - images/stylesheet-coffee-plastique.png \ - images/taskmenuextension-example.png \ - images/coloreditorfactoryimage.png \ - images/dynamiclayouts-example.png \ - scripts/functions.js \ - scripts/jquery.js \ - scripts/narrow.js \ - scripts/superfish.js \ - style/narrow.css \ - style/superfish.css \ - style/style_ie6.css \ - style/style_ie7.css \ - style/style_ie8.css \ - style/style.css - - - -qhp.Qt.filterAttributes = qt 4.7.1 qtrefdoc -qhp.Qt.customFilters.Qt.name = Qt 4.7.1 -qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.1 -qhp.Qt.subprojects = classes overviews examples -qhp.Qt.subprojects.classes.title = Classes -qhp.Qt.subprojects.classes.indexTitle = Qt's Classes -qhp.Qt.subprojects.classes.selectors = class fake:headerfile -qhp.Qt.subprojects.classes.sortPages = true -qhp.Qt.subprojects.overviews.title = Overviews -qhp.Qt.subprojects.overviews.indexTitle = All Overviews and HOWTOs -qhp.Qt.subprojects.overviews.selectors = fake:page,group,module -qhp.Qt.subprojects.examples.title = Tutorials and Examples -qhp.Qt.subprojects.examples.indexTitle = Qt Examples -qhp.Qt.subprojects.examples.selectors = fake:example - -language = Cpp - -headerdirs = $QT_SOURCE_TREE/src \ - $QT_SOURCE_TREE/extensions/activeqt \ - $QT_SOURCE_TREE/tools/assistant/lib \ - $QT_SOURCE_TREE/tools/assistant/compat/lib \ - $QT_SOURCE_TREE/tools/designer/src/uitools \ - $QT_SOURCE_TREE/tools/designer/src/lib/extension \ - $QT_SOURCE_TREE/tools/designer/src/lib/sdk \ - $QT_SOURCE_TREE/tools/designer/src/lib/uilib \ - $QT_SOURCE_TREE/tools/qtestlib/src \ - $QT_SOURCE_TREE/tools/qdbus/src -sourcedirs = $QT_SOURCE_TREE/src \ - $QT_SOURCE_TREE/doc/src \ - $QT_SOURCE_TREE/extensions/activeqt \ - $QT_SOURCE_TREE/tools/assistant/lib \ - $QT_SOURCE_TREE/tools/assistant/compat/lib \ - $QT_SOURCE_TREE/tools/designer/src/uitools \ - $QT_SOURCE_TREE/tools/designer/src/lib/extension \ - $QT_SOURCE_TREE/tools/designer/src/lib/sdk \ - $QT_SOURCE_TREE/tools/designer/src/lib/uilib \ - $QT_SOURCE_TREE/tools/qtestlib/src \ - $QT_SOURCE_TREE/tools/qdbus - -excludedirs = $QT_SOURCE_TREE/src/3rdparty/clucene \ - $QT_SOURCE_TREE/src/3rdparty/des \ - $QT_SOURCE_TREE/src/3rdparty/freetype \ - $QT_SOURCE_TREE/src/3rdparty/harfbuzz \ - $QT_SOURCE_TREE/src/3rdparty/kdebase \ - $QT_SOURCE_TREE/src/3rdparty/libconninet \ - $QT_SOURCE_TREE/src/3rdparty/libjpeg \ - $QT_SOURCE_TREE/src/3rdparty/libmng \ - $QT_SOURCE_TREE/src/3rdparty/libpng \ - $QT_SOURCE_TREE/src/3rdparty/libtiff \ - $QT_SOURCE_TREE/src/3rdparty/md4 \ - $QT_SOURCE_TREE/src/3rdparty/md5 \ - $QT_SOURCE_TREE/src/3rdparty/patches \ - $QT_SOURCE_TREE/src/3rdparty/sha1 \ - $QT_SOURCE_TREE/src/3rdparty/sqlite \ - $QT_SOURCE_TREE/src/3rdparty/webkit/JavaScriptCore \ - $QT_SOURCE_TREE/src/3rdparty/webkit/WebCore \ - $QT_SOURCE_TREE/src/3rdparty/wintab \ - $QT_SOURCE_TREE/src/3rdparty/zlib \ - $QT_SOURCE_TREE/src/3rdparty/phonon/gstreamer \ - $QT_SOURCE_TREE/src/3rdparty/phonon/ds9 \ - $QT_SOURCE_TREE/src/3rdparty/phonon/qt7 \ - $QT_SOURCE_TREE/src/3rdparty/phonon/mmf \ - $QT_SOURCE_TREE/src/3rdparty/phonon/waveout \ - $QT_SOURCE_TREE/doc/src/snippets \ - $QT_SOURCE_TREE/doc/src/ja_JP \ - $QT_SOURCE_TREE/doc/src/zh_CN - -sources.fileextensions = "*.cpp *.qdoc *.mm" -examples.fileextensions = "*.cpp *.h *.js *.xq *.svg *.xml *.ui *.qhp *.qhcp *.qml" -examples.imageextensions = "*.png" - -exampledirs = $QT_SOURCE_TREE/doc/src \ - $QT_SOURCE_TREE/examples \ - $QT_SOURCE_TREE/examples/tutorials \ - $QT_SOURCE_TREE \ - $QT_SOURCE_TREE/qmake/examples \ - $QT_SOURCE_TREE/src/3rdparty/webkit/WebKit/qt/docs -imagedirs = $QT_SOURCE_TREE/doc/src/images \ - $QT_SOURCE_TREE/examples \ - $QT_SOURCE_TREE/doc/src/declarative/pics \ - $QT_SOURCE_TREE/doc/src/template/images -outputdir = $QT_BUILD_TREE/doc/html -tagfile = $QT_BUILD_TREE/doc/html/qt.tags -base = file:$QT_BUILD_TREE/doc/html - -HTML.generatemacrefs = "true" diff --git a/tools/qdoc3/test/qt-defines.qdocconf b/tools/qdoc3/test/qt-defines.qdocconf index 51ee0d3..bf7fd08 100644 --- a/tools/qdoc3/test/qt-defines.qdocconf +++ b/tools/qdoc3/test/qt-defines.qdocconf @@ -15,48 +15,3 @@ defines = Q_QDOC \ versionsym = QT_VERSION_STR codeindent = 1 - -# Files not referenced in any qdoc file (last four needed by qtdemo) -# See also qhp.Qt.extraFiles -extraimages.HTML = qt-logo \ - trolltech-logo \ - bg_l.png \ - bg_l_blank.png \ - bg_ll_blank.png \ - bg_ul_blank.png \ - header_bg.png \ - bg_r.png \ - box_bg.png \ - breadcrumb.png \ - bullet_gt.png \ - bullet_dn.png \ - bullet_sq.png \ - bullet_up.png \ - arrow_down.png \ - feedbackground.png \ - horBar.png \ - page.png \ - page_bg.png \ - sprites-combined.png \ - spinner.gif \ - stylesheet-coffee-plastique.png \ - taskmenuextension-example.png \ - coloreditorfactoryimage.png \ - dynamiclayouts-example.png - -# This stuff is used by the new doc format. -scriptdirs = $QT_SOURCE_TREE/doc/src/template/scripts -styledirs = $QT_SOURCE_TREE/doc/src/template/style - -scripts.HTML = functions.js \ - narrow.js \ - superfish.js \ - jquery.js - -styles.HTML = style.css \ - narrow.css \ - superfish.css \ - superfish_skin.css \ - style_ie6.css \ - style_ie7.css \ - style_ie8.css diff --git a/tools/qdoc3/test/qt-html-default-styles.qdocconf b/tools/qdoc3/test/qt-html-default-styles.qdocconf new file mode 100644 index 0000000..103f1e0 --- /dev/null +++ b/tools/qdoc3/test/qt-html-default-styles.qdocconf @@ -0,0 +1,51 @@ +# Define the location of the templates to use. Style sheets and scripts are +# specified relative to the template directory and will be copied into +# subdirectories of the output directory. + +HTML.templatedir = $QT_SOURCE_TREE/doc/src/template + +HTML.stylesheets = style/style.css + +HTML.scripts = scripts/functions.js \ + scripts/narrow.js \ + + +# Files not referenced in any qdoc file (last four needed by qtdemo) +# See also qhp.Qt.extraFiles +extraimages.HTML = qt-logo \ + trolltech-logo \ + bg_l.png \ + bg_l_blank.png \ + bg_ll_blank.png \ + bg_ul_blank.png \ + header_bg.png \ + bg_r.png \ + box_bg.png \ + breadcrumb.png \ + bullet_gt.png \ + bullet_dn.png \ + bullet_sq.png \ + bullet_up.png \ + arrow_down.png \ + feedbackground.png \ + horBar.png \ + page.png \ + page_bg.png \ + sprites-combined.png \ + spinner.gif \ + stylesheet-coffee-plastique.png \ + taskmenuextension-example.png \ + coloreditorfactoryimage.png \ + dynamiclayouts-example.png + +# Include the style sheets and scripts used. + +HTML.headerstyles = \ + " \n" \ + " \n" + +HTML.headerscripts = + +HTML.endheader = \ + "\n" \ + "\n" diff --git a/tools/qdoc3/test/qt-html-online-styles.qdocconf b/tools/qdoc3/test/qt-html-online-styles.qdocconf new file mode 100644 index 0000000..06f8964 --- /dev/null +++ b/tools/qdoc3/test/qt-html-online-styles.qdocconf @@ -0,0 +1,77 @@ +# Define the location of the templates to use. Style sheets and scripts are +# specified relative to the template directory and will be copied into +# subdirectories of the output directory. + +HTML.templatedir = $QT_SOURCE_TREE/doc/src/template + +HTML.stylesheets = style/narrow.css \ + style/style.css \ + style/style_ie6.css \ + style/style_ie7.css \ + style/style_ie8.css \ + style/superfish.css + +# Adding jquery and functions - providing online tools and search features +HTML.scripts = scripts/functions.js \ + scripts/narrow.js \ + scripts/superfish.js \ + scripts/jquery.js + + +# Files not referenced in any qdoc file (last four needed by qtdemo) +# See also qhp.Qt.extraFiles +extraimages.HTML = qt-logo \ + trolltech-logo \ + bg_l.png \ + bg_l_blank.png \ + bg_ll_blank.png \ + bg_ul_blank.png \ + header_bg.png \ + bg_r.png \ + box_bg.png \ + breadcrumb.png \ + bullet_gt.png \ + bullet_dn.png \ + bullet_sq.png \ + bullet_up.png \ + arrow_down.png \ + feedbackground.png \ + horBar.png \ + page.png \ + page_bg.png \ + sprites-combined.png \ + spinner.gif \ + stylesheet-coffee-plastique.png \ + taskmenuextension-example.png \ + coloreditorfactoryimage.png \ + dynamiclayouts-example.png + +# Include the style sheets and scripts used. + +HTML.headerstyles = \ + " \n" \ + " \n" \ + " \n" \ + " \n" \ + " \n" \ + " \n" \ + "\n" \ + "\n" \ + "\n\n" + +HTML.headerscripts = \ + "\n" \ + "\n\n" + +HTML.endheader = \ + "\n" \ + "\n" diff --git a/tools/qdoc3/test/qt-html-templates-online.qdocconf b/tools/qdoc3/test/qt-html-templates-online.qdocconf new file mode 100644 index 0000000..64f99ad --- /dev/null +++ b/tools/qdoc3/test/qt-html-templates-online.qdocconf @@ -0,0 +1,198 @@ +include(qt-html-online-styles.qdocconf) + +HTML.postheader = \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + " Home
    \n" \ + " Qt Reference Documentation\n" \ + "
    \n" \ + "
    \n" \ + " \n" \ + "
    \n" \ + "
    \n" \ + " \n" \ + "
    \n" \ + " \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + " \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + " Search index:
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + " \n" \ + "
    \n" \ + " Close \n" \ + "

    All | API | Articles | Examples

    \n" \ + "

     results:

    \n" \ + "
      \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "

    \n" \ + " API Lookup

    \n" \ + "
    \n" \ + " \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "

    \n" \ + " Qt Topics

    \n" \ + " \n" \ + "
    \n" \ + "
    \n" \ + "

    \n" \ + " Examples

    \n" \ + "
    \n" \ + " \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "
      \n" \ + "
    • Home
    • \n" \ + " \n" + +HTML.postpostheader = \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + " \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" + +HTML.footer = \ + "
    \n" \ + " [+] Documentation Feedback
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + " \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "

    \n" \ + " © 2008-2010 Nokia Corporation and/or its\n" \ + " subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation \n" \ + " in Finland and/or other countries worldwide.

    \n" \ + "

    \n" \ + " All other trademarks are property of their respective owners. Privacy Policy

    \n" \ + "
    \n" \ + "

    \n" \ + " Licensees holding valid Qt Commercial licenses may use this document in accordance with the" \ + " Qt Commercial License Agreement provided with the Software or, alternatively, in accordance" \ + " with the terms contained in a written agreement between you and Nokia.

    \n" \ + "

    \n" \ + " Alternatively, this document may be used under the terms of the GNU\n" \ + " Free Documentation License version 1.3\n" \ + " as published by the Free Software Foundation.

    \n" \ + "
    \n" \ + "
    \n" \ + "
    X
    \n" \ + "
    \n" \ + "

    Thank you for giving your feedback.

    Make sure it is related to this specific page. For more general bugs and \n" \ + " requests, please use the Qt Bug Tracker.

    \n" \ + "

    \n" \ + "

    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "\n" \ + " \n" \ + " \n" diff --git a/tools/qdoc3/test/qt-html-templates.qdocconf b/tools/qdoc3/test/qt-html-templates.qdocconf index 698164d..5a2058a 100644 --- a/tools/qdoc3/test/qt-html-templates.qdocconf +++ b/tools/qdoc3/test/qt-html-templates.qdocconf @@ -1,186 +1,48 @@ -HTML.stylesheets = style/style.css \ - style/OfflineStyle.css \ - style/style_ie7.css \ - style/style_ie8.css \ - style/style_ie6.css +include(qt-html-default-styles.qdocconf) -HTML.postheader = "
    \n" \ - "
    \n" \ - "
    \n" \ - " Home
    \n" \ - " Qt Reference Documentation\n" \ - "
    \n" \ - "
    \n" \ - " \n" \ - "
    \n" \ - "
    \n" \ - " \n" \ - "
    \n" \ - " \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - " \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - " Search index:
    \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - " \n" \ - "
    \n" \ - " Close \n" \ - "

    All | API | Articles | Examples

    \n" \ - "

     results:

    \n" \ - "
      \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - "

    \n" \ - " API Lookup

    \n" \ - "
    \n" \ - " \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - "

    \n" \ - " Qt Topics

    \n" \ - " \n" \ - "
    \n" \ - "
    \n" \ - "

    \n" \ - " Examples

    \n" \ - "
    \n" \ - " \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - "
      \n" \ - "
    • Home
    • \n" \ - " \n" +HTML.postheader = \ + "
      \n" \ + "
      \n" \ + "
      \n" \ + " Home\n" \ + "
      \n" \ + " Qt Reference Documentation\n" \ + "
      \n" \ + "
      \n" \ + "
      \n" \ + "
      \n" \ + "
        \n" \ + "
      • Home
      • \n" \ + " \n" -HTML.postpostheader = "
      \n" \ - "
      \n" \ - "
      \n" \ - " \n" \ - "
      \n" \ - "
      \n" \ - "
      \n" +HTML.postpostheader = \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" -HTML.footer = "" \ - "
    \n" \ - " [+] Documentation Feedback
    \n" \ - "
    \n" \ - "
    \n" \ - " \n" \ - "
    \n" \ - " \n" \ - "
    \n" \ - " \n" \ - "
    \n" \ - "

    \n" \ - " © 2008-2010 Nokia Corporation and/or its\n" \ - " subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation \n" \ - " in Finland and/or other countries worldwide.

    \n" \ - "

    \n" \ - " All other trademarks are property of their respective owners. Privacy Policy

    \n" \ - "
    \n" \ - "

    \n" \ - " Licensees holding valid Qt Commercial licenses may use this document in accordance with the" \ - " Qt Commercial License Agreement provided with the Software or, alternatively, in accordance" \ - " with the terms contained in a written agreement between you and Nokia.

    \n" \ - "

    \n" \ - " Alternatively, this document may be used under the terms of the GNU\n" \ - " Free Documentation License version 1.3\n" \ - " as published by the Free Software Foundation.

    \n" \ - "
    \n" \ - "
    \n" \ - "
    X
    \n" \ - "
    \n" \ - "

    Thank you for giving your feedback.

    Make sure it is related to this specific page. For more general bugs and \n" \ - " requests, please use the Qt Bug Tracker.

    \n" \ - "

    \n" \ - "

    \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ No newline at end of file +HTML.footer = \ + "
    \n" \ + " \n" \ + "
    \n" \ + " \n" \ + "
    \n" \ + "

    \n" \ + " © 2008-2010 Nokia Corporation and/or its\n" \ + " subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation \n" \ + " in Finland and/or other countries worldwide.

    \n" \ + "

    \n" \ + " All other trademarks are property of their respective owners. Privacy Policy

    \n" \ + "
    \n" \ + "

    \n" \ + " Licensees holding valid Qt Commercial licenses may use this document in accordance with the" \ + " Qt Commercial License Agreement provided with the Software or, alternatively, in accordance" \ + " with the terms contained in a written agreement between you and Nokia.

    \n" \ + "

    \n" \ + " Alternatively, this document may be used under the terms of the GNU\n" \ + " Free Documentation License version 1.3\n" \ + " as published by the Free Software Foundation.

    \n" \ + "
    \n" \ diff --git a/tools/qdoc3/test/qt-html-templates_ja_JP-online.qdocconf b/tools/qdoc3/test/qt-html-templates_ja_JP-online.qdocconf new file mode 100644 index 0000000..fa15d90 --- /dev/null +++ b/tools/qdoc3/test/qt-html-templates_ja_JP-online.qdocconf @@ -0,0 +1,176 @@ +include(qt-html-online-styles.qdocconf) + +HTML.postheader = \ +"
    \n" \ + "
    \n" \ + "
    \n" \ + " Home
    \n" \ + " Qt Reference Documentation\n" \ + "
    \n" \ + "
    \n" \ + " \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + " \n" \ + "
    \n" \ + "
    \n" \ + " \n" \ + "
    \n" \ + " \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + " \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + " Search index:
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + " \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "

    \n" \ + " API Lookup

    \n" \ + "
    \n" \ + " \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "

    \n" \ + " Qt Topics

    \n" \ + "
    \n" \ + " \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "

    \n" \ + " Examples

    \n" \ + "
    \n" \ + " \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "
      \n" \ + "
    • Home
    • \n" \ + " \n" + +HTML.postpostheader = \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + " \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" + +HTML.footer = \ + " \n" \ + "
    \n" \ + " [+] Documentation Feedback
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + " \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "

    \n" \ + " © 2008-2010 Nokia Corporation and/or its\n" \ + " subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation \n" \ + " in Finland and/or other countries worldwide.

    \n" \ + "

    \n" \ + " All other trademarks are property of their respective owners. Privacy Policy

    \n" \ + "
    \n" \ + "

    \n" \ + " Licensees holding valid Qt Commercial licenses may use this document in accordance with the" \ + " Qt Commercial License Agreement provided with the Software or, alternatively, in accordance" \ + " with the terms contained in a written agreement between you and Nokia.

    \n" \ + "

    \n" \ + " Alternatively, this document may be used under the terms of the GNU\n" \ + " Free Documentation License version 1.3\n" \ + " as published by the Free Software Foundation.

    \n" \ + "
    \n" \ + "
    \n" \ + "
    X
    \n" \ + "
    \n" \ + "

    \n" \ + "

    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" diff --git a/tools/qdoc3/test/qt-html-templates_ja_JP.qdocconf b/tools/qdoc3/test/qt-html-templates_ja_JP.qdocconf index da20766..18ed5c1 100644 --- a/tools/qdoc3/test/qt-html-templates_ja_JP.qdocconf +++ b/tools/qdoc3/test/qt-html-templates_ja_JP.qdocconf @@ -1,177 +1,63 @@ -HTML.stylesheets = style/style.css \ - style/OfflineStyle.css \ - style/style_ie7.css \ - style/style_ie8.css \ - style/style_ie6.css - -HTML.postheader = "
    \n" \ - "
    \n" \ - "
    \n" \ - " Home
    \n" \ - " Qt Reference Documentation\n" \ - "
    \n" \ - "
    \n" \ - " \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - " \n" \ - "
    \n" \ - "
    \n" \ - " \n" \ - "
    \n" \ - " \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - " \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - " Search index:
    \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - " \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - "

    \n" \ - " API Lookup

    \n" \ - "
    \n" \ - " \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - "

    \n" \ - " Qt Topics

    \n" \ - "
    \n" \ - " \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - "

    \n" \ - " Examples

    \n" \ - "
    \n" \ - " \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - "
      \n" \ - "
    • Home
    • \n" \ - " \n" +include(qt-html-default-styles.qdocconf) -HTML.postpostheader = "
    \n" \ - "
    \n" \ - "
    \n" \ - " \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" +HTML.postheader = \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "
      \n" \ + "
    • Home
    • \n" \ + " \n" -HTML.footer = " \n" \ - "
      \n" \ - " [+] Documentation Feedback
      \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - " \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - "

    \n" \ - " © 2008-2010 Nokia Corporation and/or its\n" \ - " subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation \n" \ - " in Finland and/or other countries worldwide.

    \n" \ - "

    \n" \ - " All other trademarks are property of their respective owners. Privacy Policy

    \n" \ - "
    \n" \ - "

    \n" \ - " Licensees holding valid Qt Commercial licenses may use this document in accordance with the" \ - " Qt Commercial License Agreement provided with the Software or, alternatively, in accordance" \ - " with the terms contained in a written agreement between you and Nokia.

    \n" \ - "

    \n" \ - " Alternatively, this document may be used under the terms of the GNU\n" \ - " Free Documentation License version 1.3\n" \ - " as published by the Free Software Foundation.

    \n" \ - "
    \n" \ - "
    \n" \ - "
    X
    \n" \ - "
    \n" \ - "

    \n" \ - "

    \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" +HTML.postpostheader = \ + " \n" \ + "
    \n" \ + "
    \n" \ + " \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" + +HTML.footer = \ + " \n" \ + "
    \n" \ + " [+] Documentation Feedback
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + " \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "

    \n" \ + " © 2008-2010 Nokia Corporation and/or its\n" \ + " subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation \n" \ + " in Finland and/or other countries worldwide.

    \n" \ + "

    \n" \ + " All other trademarks are property of their respective owners. Privacy Policy

    \n" \ + "
    \n" \ + "

    \n" \ + " Licensees holding valid Qt Commercial licenses may use this document in accordance with the" \ + " Qt Commercial License Agreement provided with the Software or, alternatively, in accordance" \ + " with the terms contained in a written agreement between you and Nokia.

    \n" \ + "

    \n" \ + " Alternatively, this document may be used under the terms of the GNU\n" \ + " Free Documentation License version 1.3\n" \ + " as published by the Free Software Foundation.

    \n" \ + "
    \n" \ + "
    \n" \ + "
    X
    \n" \ + "
    \n" \ + "

    \n" \ + "

    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" diff --git a/tools/qdoc3/test/qt-html-templates_zh_CN-online.qdocconf b/tools/qdoc3/test/qt-html-templates_zh_CN-online.qdocconf new file mode 100644 index 0000000..285ec27 --- /dev/null +++ b/tools/qdoc3/test/qt-html-templates_zh_CN-online.qdocconf @@ -0,0 +1,176 @@ +include(qt-html-online-styles.qdocconf) + +HTML.postheader = \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + " Home
    \n" \ + " Qt Reference Documentation\n" \ + "
    \n" \ + "
    \n" \ + " \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + " \n" \ + "
    \n" \ + "
    \n" \ + " \n" \ + "
    \n" \ + " \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + " \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + " Search index:
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + " \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "

    \n" \ + " API Lookup

    \n" \ + "
    \n" \ + " \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "

    \n" \ + " Qt Topics

    \n" \ + "
    \n" \ + " \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "

    \n" \ + " Examples

    \n" \ + "
    \n" \ + " \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "
      \n" \ + "
    • Home
    • \n" \ + " \n" + +HTML.postpostheader = \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + " \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" + +HTML.footer = \ + " \n" \ + "
    \n" \ + " [+] Documentation Feedback
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + " \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "

    \n" \ + " © 2008-2010 Nokia Corporation and/or its\n" \ + " subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation \n" \ + " in Finland and/or other countries worldwide.

    \n" \ + "

    \n" \ + " All other trademarks are property of their respective owners. Privacy Policy

    \n" \ + "
    \n" \ + "

    \n" \ + " Licensees holding valid Qt Commercial licenses may use this document in accordance with the" \ + " Qt Commercial License Agreement provided with the Software or, alternatively, in accordance" \ + " with the terms contained in a written agreement between you and Nokia.

    \n" \ + "

    \n" \ + " Alternatively, this document may be used under the terms of the GNU\n" \ + " Free Documentation License version 1.3\n" \ + " as published by the Free Software Foundation.

    \n" \ + "
    \n" \ + "
    \n" \ + "
    X
    \n" \ + "
    \n" \ + "

    \n" \ + "

    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" diff --git a/tools/qdoc3/test/qt-html-templates_zh_CN.qdocconf b/tools/qdoc3/test/qt-html-templates_zh_CN.qdocconf index 5c4bfa9..7773aa6 100644 --- a/tools/qdoc3/test/qt-html-templates_zh_CN.qdocconf +++ b/tools/qdoc3/test/qt-html-templates_zh_CN.qdocconf @@ -1,177 +1,176 @@ -HTML.stylesheets = style/style.css \ - style/OfflineStyle.css \ - style/style_ie7.css \ - style/style_ie8.css \ - style/style_ie6.css +include(qt-html-default-styles.qdocconf) -HTML.postheader = "
    \n" \ - "
    \n" \ - "
    \n" \ - " Home
    \n" \ - " Qt Reference Documentation\n" \ - "
    \n" \ - "
    \n" \ - " \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - " \n" \ - "
    \n" \ - "
    \n" \ - " \n" \ - "
    \n" \ - " \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - " \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - " Search index:
    \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - " \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - "

    \n" \ - " API Lookup

    \n" \ - "
    \n" \ - " \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - "

    \n" \ - " Qt Topics

    \n" \ - "
    \n" \ - " \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - "

    \n" \ - " Examples

    \n" \ - "
    \n" \ - " \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - " \n" \ + "
    \n" \ + "
    \n" \ + " \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" -HTML.footer = " \n" \ - "
    \n" \ - " [+] Documentation Feedback
    \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - " \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - "

    \n" \ - " © 2008-2010 Nokia Corporation and/or its\n" \ - " subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation \n" \ - " in Finland and/or other countries worldwide.

    \n" \ - "

    \n" \ - " All other trademarks are property of their respective owners. Privacy Policy

    \n" \ - "
    \n" \ - "

    \n" \ - " Licensees holding valid Qt Commercial licenses may use this document in accordance with the" \ - " Qt Commercial License Agreement provided with the Software or, alternatively, in accordance" \ - " with the terms contained in a written agreement between you and Nokia.

    \n" \ - "

    \n" \ - " Alternatively, this document may be used under the terms of the GNU\n" \ - " Free Documentation License version 1.3\n" \ - " as published by the Free Software Foundation.

    \n" \ - "
    \n" \ - "
    \n" \ - "
    X
    \n" \ - "
    \n" \ - "

    \n" \ - "

    \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" \ - "
    \n" +HTML.footer = \ + " \n" \ + "
    \n" \ + " [+] Documentation Feedback
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + " \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "

    \n" \ + " © 2008-2010 Nokia Corporation and/or its\n" \ + " subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation \n" \ + " in Finland and/or other countries worldwide.

    \n" \ + "

    \n" \ + " All other trademarks are property of their respective owners. Privacy Policy

    \n" \ + "
    \n" \ + "

    \n" \ + " Licensees holding valid Qt Commercial licenses may use this document in accordance with the" \ + " Qt Commercial License Agreement provided with the Software or, alternatively, in accordance" \ + " with the terms contained in a written agreement between you and Nokia.

    \n" \ + "

    \n" \ + " Alternatively, this document may be used under the terms of the GNU\n" \ + " Free Documentation License version 1.3\n" \ + " as published by the Free Software Foundation.

    \n" \ + "
    \n" \ + "
    \n" \ + "
    X
    \n" \ + "
    \n" \ + "

    \n" \ + "

    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" \ + "
    \n" diff --git a/tools/qdoc3/test/qt-project-api-only.qdocconf b/tools/qdoc3/test/qt-project-api-only.qdocconf new file mode 100644 index 0000000..4a91601 --- /dev/null +++ b/tools/qdoc3/test/qt-project-api-only.qdocconf @@ -0,0 +1,32 @@ +# Ensures that the generated index contains a URL that can be used by the +# tools documentation (assistant.qdocconf, designer.qdocconf, linguist.qdocconf, +# qmake.qdocconf). + +url = ./ + +# Ensures that the documentation for the tools is not included in the generated +# .qhp file. + +qhp.Qt.excluded += $QT_SOURCE_TREE/doc/src/development/assistant-manual.qdoc \ + $QT_SOURCE_TREE/doc/src/examples/simpletextviewer.qdoc \ + $QT_SOURCE_TREE/doc/src/development/designer-manual.qdoc \ + $QT_SOURCE_TREE/doc/src/examples/calculatorbuilder.qdoc \ + $QT_SOURCE_TREE/doc/src/examples/calculatorform.qdoc \ + $QT_SOURCE_TREE/doc/src/examples/customwidgetplugin.qdoc \ + $QT_SOURCE_TREE/doc/src/examples/taskmenuextension.qdoc \ + $QT_SOURCE_TREE/doc/src/examples/containerextension.qdoc \ + $QT_SOURCE_TREE/doc/src/examples/worldtimeclockbuilder.qdoc \ + $QT_SOURCE_TREE/doc/src/examples/worldtimeclockplugin.qdoc \ + $QT_SOURCE_TREE/doc/src/internationalization/linguist-manual.qdoc \ + $QT_SOURCE_TREE/doc/src/examples/hellotr.qdoc \ + $QT_SOURCE_TREE/doc/src/examples/arrowpad.qdoc \ + $QT_SOURCE_TREE/doc/src/examples/trollprint.qdoc \ + $QT_SOURCE_TREE/doc/src/development/qmake-manual.qdoc + +# Remove the QML documentation from the Qt-only documentation. + +excludedirs += $QT_SOURCE_TREE/src/imports + +outputdir = $QT_BUILD_TREE/doc-build/html-qt +tagfile = $QT_BUILD_TREE/doc-build/html-qt/qt.tags +base = file:$QT_BUILD_TREE/doc-build/html-qt diff --git a/tools/qdoc3/test/qt-project.qdocconf b/tools/qdoc3/test/qt-project.qdocconf new file mode 100644 index 0000000..7531b76 --- /dev/null +++ b/tools/qdoc3/test/qt-project.qdocconf @@ -0,0 +1,146 @@ +include(compat.qdocconf) +include(macros.qdocconf) +include(qt-cpp-ignore.qdocconf) +include(qt-defines.qdocconf) + +project = Qt +description = Qt Reference Documentation +url = http://qt.nokia.com/doc/4.7 + +sourceencoding = UTF-8 +outputencoding = UTF-8 +naturallanguage = en_US + +qhp.projects = Qt + +qhp.Qt.file = qt.qhp +qhp.Qt.namespace = com.trolltech.qt.471 +qhp.Qt.virtualFolder = qdoc +qhp.Qt.indexTitle = Qt Reference Documentation +qhp.Qt.indexRoot = + +# Files not referenced in any qdoc file (last four are needed by qtdemo) +# See also extraimages.HTML +qhp.Qt.extraFiles = index.html \ + images/bg_l.png \ + images/bg_l_blank.png \ + images/bg_ll_blank.png \ + images/bg_ul_blank.png \ + images/header_bg.png \ + images/bg_r.png \ + images/box_bg.png \ + images/breadcrumb.png \ + images/bullet_gt.png \ + images/bullet_dn.png \ + images/bullet_sq.png \ + images/bullet_up.png \ + images/arrow_down.png \ + images/feedbackground.png \ + images/horBar.png \ + images/page.png \ + images/page_bg.png \ + images/sprites-combined.png \ + images/spinner.gif \ + images/stylesheet-coffee-plastique.png \ + images/taskmenuextension-example.png \ + images/coloreditorfactoryimage.png \ + images/dynamiclayouts-example.png \ + scripts/functions.js \ + scripts/jquery.js \ + scripts/narrow.js \ + scripts/superfish.js \ + style/narrow.css \ + style/superfish.css \ + style/style_ie6.css \ + style/style_ie7.css \ + style/style_ie8.css \ + style/style.css + + + +qhp.Qt.filterAttributes = qt 4.7.1 qtrefdoc +qhp.Qt.customFilters.Qt.name = Qt 4.7.1 +qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.1 +qhp.Qt.subprojects = classes overviews examples +qhp.Qt.subprojects.classes.title = Classes +qhp.Qt.subprojects.classes.indexTitle = Qt's Classes +qhp.Qt.subprojects.classes.selectors = class fake:headerfile +qhp.Qt.subprojects.classes.sortPages = true +qhp.Qt.subprojects.overviews.title = Overviews +qhp.Qt.subprojects.overviews.indexTitle = All Overviews and HOWTOs +qhp.Qt.subprojects.overviews.selectors = fake:page,group,module +qhp.Qt.subprojects.examples.title = Tutorials and Examples +qhp.Qt.subprojects.examples.indexTitle = Qt Examples +qhp.Qt.subprojects.examples.selectors = fake:example + +language = Cpp + +headerdirs = $QT_SOURCE_TREE/src \ + $QT_SOURCE_TREE/extensions/activeqt \ + $QT_SOURCE_TREE/tools/assistant/lib \ + $QT_SOURCE_TREE/tools/assistant/compat/lib \ + $QT_SOURCE_TREE/tools/designer/src/uitools \ + $QT_SOURCE_TREE/tools/designer/src/lib/extension \ + $QT_SOURCE_TREE/tools/designer/src/lib/sdk \ + $QT_SOURCE_TREE/tools/designer/src/lib/uilib \ + $QT_SOURCE_TREE/tools/qtestlib/src \ + $QT_SOURCE_TREE/tools/qdbus/src +sourcedirs = $QT_SOURCE_TREE/src \ + $QT_SOURCE_TREE/doc/src \ + $QT_SOURCE_TREE/extensions/activeqt \ + $QT_SOURCE_TREE/tools/assistant/lib \ + $QT_SOURCE_TREE/tools/assistant/compat/lib \ + $QT_SOURCE_TREE/tools/designer/src/uitools \ + $QT_SOURCE_TREE/tools/designer/src/lib/extension \ + $QT_SOURCE_TREE/tools/designer/src/lib/sdk \ + $QT_SOURCE_TREE/tools/designer/src/lib/uilib \ + $QT_SOURCE_TREE/tools/qtestlib/src \ + $QT_SOURCE_TREE/tools/qdbus + +excludedirs = $QT_SOURCE_TREE/src/3rdparty/clucene \ + $QT_SOURCE_TREE/src/3rdparty/des \ + $QT_SOURCE_TREE/src/3rdparty/freetype \ + $QT_SOURCE_TREE/src/3rdparty/harfbuzz \ + $QT_SOURCE_TREE/src/3rdparty/kdebase \ + $QT_SOURCE_TREE/src/3rdparty/libconninet \ + $QT_SOURCE_TREE/src/3rdparty/libjpeg \ + $QT_SOURCE_TREE/src/3rdparty/libmng \ + $QT_SOURCE_TREE/src/3rdparty/libpng \ + $QT_SOURCE_TREE/src/3rdparty/libtiff \ + $QT_SOURCE_TREE/src/3rdparty/md4 \ + $QT_SOURCE_TREE/src/3rdparty/md5 \ + $QT_SOURCE_TREE/src/3rdparty/patches \ + $QT_SOURCE_TREE/src/3rdparty/sha1 \ + $QT_SOURCE_TREE/src/3rdparty/sqlite \ + $QT_SOURCE_TREE/src/3rdparty/webkit/JavaScriptCore \ + $QT_SOURCE_TREE/src/3rdparty/webkit/WebCore \ + $QT_SOURCE_TREE/src/3rdparty/wintab \ + $QT_SOURCE_TREE/src/3rdparty/zlib \ + $QT_SOURCE_TREE/src/3rdparty/phonon/gstreamer \ + $QT_SOURCE_TREE/src/3rdparty/phonon/ds9 \ + $QT_SOURCE_TREE/src/3rdparty/phonon/qt7 \ + $QT_SOURCE_TREE/src/3rdparty/phonon/mmf \ + $QT_SOURCE_TREE/src/3rdparty/phonon/waveout \ + $QT_SOURCE_TREE/doc/src/snippets \ + $QT_SOURCE_TREE/doc/src/ja_JP \ + $QT_SOURCE_TREE/doc/src/zh_CN + +sources.fileextensions = "*.cpp *.qdoc *.mm" +examples.fileextensions = "*.cpp *.h *.js *.xq *.svg *.xml *.ui *.qhp *.qhcp *.qml" +examples.imageextensions = "*.png" + +exampledirs = $QT_SOURCE_TREE/doc/src \ + $QT_SOURCE_TREE/examples \ + $QT_SOURCE_TREE/examples/tutorials \ + $QT_SOURCE_TREE \ + $QT_SOURCE_TREE/qmake/examples \ + $QT_SOURCE_TREE/src/3rdparty/webkit/WebKit/qt/docs +imagedirs = $QT_SOURCE_TREE/doc/src/images \ + $QT_SOURCE_TREE/examples \ + $QT_SOURCE_TREE/doc/src/declarative/pics \ + $QT_SOURCE_TREE/doc/src/template/images +outputdir = $QT_BUILD_TREE/doc/html +tagfile = $QT_BUILD_TREE/doc/html/qt.tags +base = file:$QT_BUILD_TREE/doc/html + +HTML.generatemacrefs = "true" diff --git a/tools/qdoc3/test/qt.qdocconf b/tools/qdoc3/test/qt.qdocconf deleted file mode 100644 index ea97205..0000000 --- a/tools/qdoc3/test/qt.qdocconf +++ /dev/null @@ -1,147 +0,0 @@ -include(compat.qdocconf) -include(macros.qdocconf) -include(qt-cpp-ignore.qdocconf) -include(qt-html-templates.qdocconf) -include(qt-defines.qdocconf) - -project = Qt -versionsym = -version = %VERSION% -description = Qt Reference Documentation -url = http://qt.nokia.com/doc/4.7 - -sourceencoding = UTF-8 -outputencoding = UTF-8 -naturallanguage = en_US - -qhp.projects = Qt - -qhp.Qt.file = qt.qhp -qhp.Qt.namespace = com.trolltech.qt.471 -qhp.Qt.virtualFolder = qdoc -qhp.Qt.indexTitle = Qt Reference Documentation -qhp.Qt.indexRoot = - -# Files not referenced in any qdoc file (last four are needed by qtdemo) -# See also extraimages.HTML -qhp.Qt.extraFiles = index.html \ - images/bg_l.png \ - images/bg_l_blank.png \ - images/bg_ll_blank.png \ - images/bg_ul_blank.png \ - images/header_bg.png \ - images/bg_r.png \ - images/box_bg.png \ - images/breadcrumb.png \ - images/bullet_gt.png \ - images/bullet_dn.png \ - images/bullet_sq.png \ - images/bullet_up.png \ - images/arrow_down.png \ - images/feedbackground.png \ - images/horBar.png \ - images/page.png \ - images/page_bg.png \ - images/sprites-combined.png \ - images/spinner.gif \ - images/stylesheet-coffee-plastique.png \ - images/taskmenuextension-example.png \ - images/coloreditorfactoryimage.png \ - images/dynamiclayouts-example.png \ - scripts/functions.js \ - scripts/jquery.js \ - scripts/narrow.js \ - scripts/superfish.js \ - style/narrow.css \ - style/superfish.css \ - style/style_ie6.css \ - style/style_ie7.css \ - style/style_ie8.css \ - style/style.css - -qhp.Qt.filterAttributes = qt 4.7.1 qtrefdoc -qhp.Qt.customFilters.Qt.name = Qt 4.7.1 -qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.1 -qhp.Qt.subprojects = classes overviews examples -qhp.Qt.subprojects.classes.title = Classes -qhp.Qt.subprojects.classes.indexTitle = Qt's Classes -qhp.Qt.subprojects.classes.selectors = class fake:headerfile -qhp.Qt.subprojects.classes.sortPages = true -qhp.Qt.subprojects.overviews.title = Overviews -qhp.Qt.subprojects.overviews.indexTitle = All Overviews and HOWTOs -qhp.Qt.subprojects.overviews.selectors = fake:page,group,module -qhp.Qt.subprojects.examples.title = Tutorials and Examples -qhp.Qt.subprojects.examples.indexTitle = Qt Examples -qhp.Qt.subprojects.examples.selectors = fake:example - -language = Cpp - -headerdirs = $QTDIR/src \ - $QTDIR/extensions/activeqt \ - $QTDIR/tools/assistant/lib \ - $QTDIR/tools/assistant/compat/lib \ - $QTDIR/tools/designer/src/uitools \ - $QTDIR/tools/designer/src/lib/extension \ - $QTDIR/tools/designer/src/lib/sdk \ - $QTDIR/tools/designer/src/lib/uilib \ - $QTDIR/tools/qtestlib/src \ - $QTDIR/tools/qdbus/src -sourcedirs = $QTDIR/src \ - $QTDIR/doc/src \ - $QTDIR/extensions/activeqt \ - $QTDIR/tools/assistant/lib \ - $QTDIR/tools/assistant/compat/lib \ - $QTDIR/tools/designer/src/uitools \ - $QTDIR/tools/designer/src/lib/extension \ - $QTDIR/tools/designer/src/lib/sdk \ - $QTDIR/tools/designer/src/lib/uilib \ - $QTDIR/tools/qtestlib/src \ - $QTDIR/tools/qdbus - -excludedirs = $QTDIR/src/3rdparty/clucene \ - $QTDIR/src/3rdparty/des \ - $QTDIR/src/3rdparty/freetype \ - $QTDIR/src/3rdparty/harfbuzz \ - $QTDIR/src/3rdparty/kdebase \ - $QTDIR/src/3rdparty/libconninet \ - $QTDIR/src/3rdparty/libjpeg \ - $QTDIR/src/3rdparty/libmng \ - $QTDIR/src/3rdparty/libpng \ - $QTDIR/src/3rdparty/libtiff \ - $QTDIR/src/3rdparty/md4 \ - $QTDIR/src/3rdparty/md5 \ - $QTDIR/src/3rdparty/patches \ - $QTDIR/src/3rdparty/sha1 \ - $QTDIR/src/3rdparty/sqlite \ - $QTDIR/src/3rdparty/webkit/JavaScriptCore \ - $QTDIR/src/3rdparty/webkit/WebCore \ - $QTDIR/src/3rdparty/wintab \ - $QTDIR/src/3rdparty/zlib \ - $QTDIR/src/3rdparty/phonon/gstreamer \ - $QTDIR/src/3rdparty/phonon/ds9 \ - $QTDIR/src/3rdparty/phonon/qt7 \ - $QTDIR/src/3rdparty/phonon/mmf \ - $QTDIR/src/3rdparty/phonon/waveout \ - $QTDIR/doc/src/snippets \ - $QTDIR/doc/src/ja_JP \ - $QTDIR/doc/src/zh_CN - -sources.fileextensions = "*.cpp *.qdoc *.mm" -examples.fileextensions = "*.cpp *.h *.js *.xq *.svg *.xml *.ui *.qhp *.qhcp *.qml" -examples.imageextensions = "*.png" - -exampledirs = $QTDIR/doc/src \ - $QTDIR/examples \ - $QTDIR/examples/tutorials \ - $QTDIR \ - $QTDIR/qmake/examples \ - $QTDIR/src/3rdparty/webkit/WebKit/qt/docs -imagedirs = $QTDIR/doc/src/images \ - $QTDIR/examples \ - $QTDIR/doc/src/declarative/pics \ - $QTDIR/doc/src/template/images -outputdir = $QTDIR/doc/html -tagfile = $QTDIR/doc/html/qt.tags -base = file:$QTDIR/doc/html - -HTML.generatemacrefs = "true" diff --git a/tools/qdoc3/test/qt_ja_JP.qdocconf b/tools/qdoc3/test/qt_ja_JP.qdocconf deleted file mode 100644 index 32bba06..0000000 --- a/tools/qdoc3/test/qt_ja_JP.qdocconf +++ /dev/null @@ -1,118 +0,0 @@ -include(compat.qdocconf) -include(macros.qdocconf) -include(qt-cpp-ignore.qdocconf) -include(qt-html-templates_ja_JP.qdocconf) -include(qt-defines.qdocconf) - -project = Qt -versionsym = -version = %VERSION% -description = Qt リファレンスドキュメント -url = http://qt.nokia.com/doc/ja_JP/4.7 - -sourceencoding = UTF-8 -outputencoding = UTF-8 -naturallanguage = ja - -indexes = $QTDIR/doc/html/qt.index - -qhp.projects = Qt - -qhp.Qt.file = qt.qhp -qhp.Qt.namespace = com.trolltech.qt.471 -qhp.Qt.virtualFolder = qdoc -qhp.Qt.title = Qt -qhp.Qt.indexTitle = Qt -qhp.Qt.selectors = fake:example - -qhp.Qt.filterAttributes = qt 4.7.1 qtrefdoc ja_JP -qhp.Qt.customFilters.Qt.name = Qt 4.7.1 -qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.1 - -# Files not referenced in any qdoc file (last four are needed by qtdemo) -# See also extraimages.HTML -qhp.Qt.extraFiles = index.html \ - images/bg_l.png \ - images/bg_l_blank.png \ - images/bg_ll_blank.png \ - images/bg_ul_blank.png \ - images/header_bg.png \ - images/bg_r.png \ - images/box_bg.png \ - images/breadcrumb.png \ - images/bullet_gt.png \ - images/bullet_dn.png \ - images/bullet_sq.png \ - images/bullet_up.png \ - images/arrow_down.png \ - images/feedbackground.png \ - images/horBar.png \ - images/page.png \ - images/page_bg.png \ - images/sprites-combined.png \ - images/spinner.gif \ - images/stylesheet-coffee-plastique.png \ - images/taskmenuextension-example.png \ - images/coloreditorfactoryimage.png \ - images/dynamiclayouts-example.png \ - scripts/functions.js \ - scripts/jquery.js \ - scripts/narrow.js \ - scripts/superfish.js \ - style/narrow.css \ - style/superfish.css \ - style/style_ie6.css \ - style/style_ie7.css \ - style/style_ie8.css \ - style/style.css - -language = Cpp - -sourcedirs = $QTDIR/doc/src/ja_JP - -excludedirs = $QTDIR/src/3rdparty/clucene \ - $QTDIR/src/3rdparty/des \ - $QTDIR/src/3rdparty/freetype \ - $QTDIR/src/3rdparty/harfbuzz \ - $QTDIR/src/3rdparty/kdebase \ - $QTDIR/src/3rdparty/libjpeg \ - $QTDIR/src/3rdparty/libmng \ - $QTDIR/src/3rdparty/libpng \ - $QTDIR/src/3rdparty/libtiff \ - $QTDIR/src/3rdparty/md4 \ - $QTDIR/src/3rdparty/md5 \ - $QTDIR/src/3rdparty/patches \ - $QTDIR/src/3rdparty/sha1 \ - $QTDIR/src/3rdparty/sqlite \ - $QTDIR/src/3rdparty/webkit/JavaScriptCore \ - $QTDIR/src/3rdparty/webkit/WebCore \ - $QTDIR/src/3rdparty/wintab \ - $QTDIR/src/3rdparty/zlib \ - $QTDIR/doc/src/snippets \ - $QTDIR/doc/src/zh_CN \ - $QTDIR/src/3rdparty/phonon/gstreamer \ - $QTDIR/src/3rdparty/phonon/ds9 \ - $QTDIR/src/3rdparty/phonon/qt7 \ - $QTDIR/src/3rdparty/phonon/mmf \ - $QTDIR/src/3rdparty/phonon/waveout - -sources.fileextensions = "*.cpp *.qdoc *.mm" -examples.fileextensions = "*.cpp *.h *.js *.xq *.svg *.xml *.ui *.qhp *.qhcp" -examples.imageextensions = "*.png" - -exampledirs = $QTDIR/doc/src \ - $QTDIR/examples/ja_JP \ - $QTDIR/examples \ - $QTDIR/examples/tutorials \ - $QTDIR \ - $QTDIR/qmake/examples \ - $QTDIR/src/3rdparty/webkit/WebKit/qt/docs -imagedirs = $QTDIR/doc/src/ja_JP/images \ - $QTDIR/doc/src/images \ - $QTDIR/examples \ - $QTDIR/doc/src/template/images -outputdir = $QTDIR/doc/html_ja_JP -tagfile = $QTDIR/doc/html_ja_JP/qt.tags -base = file:$QTDIR/doc/html_ja_JP - -HTML.generatemacrefs = "true" diff --git a/tools/qdoc3/test/qt_zh_CN.qdocconf b/tools/qdoc3/test/qt_zh_CN.qdocconf deleted file mode 100644 index 40d3d5a..0000000 --- a/tools/qdoc3/test/qt_zh_CN.qdocconf +++ /dev/null @@ -1,116 +0,0 @@ -include(compat.qdocconf) -include(macros.qdocconf) -include(qt-cpp-ignore.qdocconf) -include(qt-html-templates_zh_CN.qdocconf) -include(qt-defines.qdocconf) - -project = Qt -versionsym = -version = %VERSION% -description = Qt Reference Documentation -url = http://qt.nokia.com/doc/zh_CN/4.7 - -sourceencoding = UTF-8 -outputencoding = UTF-8 -naturallanguage = zh-Hans - -indexes = $QTDIR/doc/html/qt.index - -qhp.projects = Qt - -qhp.Qt.file = qt.qhp -qhp.Qt.namespace = com.trolltech.qt.471 -qhp.Qt.virtualFolder = qdoc -qhp.Qt.title = 教程 -qhp.Qt.indexTitle = 教程 -qhp.Qt.selectors = fake:example - -qhp.Qt.filterAttributes = qt 4.7.1 qtrefdoc zh_CN -qhp.Qt.customFilters.Qt.name = Qt 4.7.1 -qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.1 - -# Files not referenced in any qdoc file (last four are needed by qtdemo) -# See also extraimages.HTML -qhp.Qt.extraFiles = index.html \ - images/bg_l.png \ - images/bg_l_blank.png \ - images/bg_ll_blank.png \ - images/bg_ul_blank.png \ - images/header_bg.png \ - images/bg_r.png \ - images/box_bg.png \ - images/breadcrumb.png \ - images/bullet_gt.png \ - images/bullet_dn.png \ - images/bullet_sq.png \ - images/bullet_up.png \ - images/arrow_down.png \ - images/feedbackground.png \ - images/horBar.png \ - images/page.png \ - images/page_bg.png \ - images/sprites-combined.png \ - images/spinner.gif \ - images/stylesheet-coffee-plastique.png \ - images/taskmenuextension-example.png \ - images/coloreditorfactoryimage.png \ - images/dynamiclayouts-example.png \ - scripts/functions.js \ - scripts/jquery.js \ - scripts/narrow.js \ - scripts/superfish.js \ - style/narrow.css \ - style/superfish.css \ - style/style_ie6.css \ - style/style_ie7.css \ - style/style_ie8.css \ - style/style.css - -language = Cpp - -sourcedirs = $QTDIR/doc/src/zh_CN - -excludedirs = $QTDIR/src/3rdparty/clucene \ - $QTDIR/src/3rdparty/des \ - $QTDIR/src/3rdparty/freetype \ - $QTDIR/src/3rdparty/harfbuzz \ - $QTDIR/src/3rdparty/kdebase \ - $QTDIR/src/3rdparty/libjpeg \ - $QTDIR/src/3rdparty/libmng \ - $QTDIR/src/3rdparty/libpng \ - $QTDIR/src/3rdparty/libtiff \ - $QTDIR/src/3rdparty/md4 \ - $QTDIR/src/3rdparty/md5 \ - $QTDIR/src/3rdparty/patches \ - $QTDIR/src/3rdparty/sha1 \ - $QTDIR/src/3rdparty/sqlite \ - $QTDIR/src/3rdparty/webkit/JavaScriptCore \ - $QTDIR/src/3rdparty/webkit/WebCore \ - $QTDIR/src/3rdparty/wintab \ - $QTDIR/src/3rdparty/zlib \ - $QTDIR/doc/src/snippets \ - $QTDIR/doc/src/ja_JP \ - $QTDIR/src/3rdparty/phonon/gstreamer \ - $QTDIR/src/3rdparty/phonon/ds9 \ - $QTDIR/src/3rdparty/phonon/qt7 \ - $QTDIR/src/3rdparty/phonon/mmf \ - $QTDIR/src/3rdparty/phonon/waveout - -sources.fileextensions = "*.cpp *.qdoc *.mm" -examples.fileextensions = "*.cpp *.h *.js *.xq *.svg *.xml *.ui *.qhp *.qhcp" -examples.imageextensions = "*.png" - -exampledirs = $QTDIR/doc/src \ - $QTDIR/examples \ - $QTDIR/examples/tutorials \ - $QTDIR \ - $QTDIR/qmake/examples \ - $QTDIR/src/3rdparty/webkit/WebKit/qt/docs -imagedirs = $QTDIR/doc/src/images \ - $QTDIR/examples \ - $QTDIR/doc/src/template/images -outputdir = $QTDIR/doc/html_zh_CN -tagfile = $QTDIR/doc/html_zh_CN/qt.tags -base = file:$QTDIR/doc/html_zh_CN - -HTML.generatemacrefs = "true" -- cgit v0.12 From 8657a92378ebf878c394944956af38905decbd0a Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 18 Nov 2010 19:26:01 +0100 Subject: Moved style-specific declarations. Removed script declarations. --- tools/qdoc3/test/qt-html-default-styles.qdocconf | 7 ++-- tools/qdoc3/test/qt-html-templates-online.qdocconf | 38 +++++++++++++++++++++ tools/qdoc3/test/qt-html-templates.qdocconf | 29 ++++++++++++++++ tools/qdoc3/test/qt-project.qdocconf | 39 ---------------------- 4 files changed, 70 insertions(+), 43 deletions(-) diff --git a/tools/qdoc3/test/qt-html-default-styles.qdocconf b/tools/qdoc3/test/qt-html-default-styles.qdocconf index 103f1e0..30c28cb 100644 --- a/tools/qdoc3/test/qt-html-default-styles.qdocconf +++ b/tools/qdoc3/test/qt-html-default-styles.qdocconf @@ -4,11 +4,10 @@ HTML.templatedir = $QT_SOURCE_TREE/doc/src/template -HTML.stylesheets = style/style.css - -HTML.scripts = scripts/functions.js \ - scripts/narrow.js \ +HTML.stylesheets = style/style.css \ + style/narrow.css +HTML.scripts = # Files not referenced in any qdoc file (last four needed by qtdemo) # See also qhp.Qt.extraFiles diff --git a/tools/qdoc3/test/qt-html-templates-online.qdocconf b/tools/qdoc3/test/qt-html-templates-online.qdocconf index 64f99ad..7ed8c90 100644 --- a/tools/qdoc3/test/qt-html-templates-online.qdocconf +++ b/tools/qdoc3/test/qt-html-templates-online.qdocconf @@ -196,3 +196,41 @@ HTML.footer = \ " var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);\n" \ " })();\n" \ " \n" + + +# Files not referenced in any qdoc file (last four are needed by qtdemo) +# See also extraimages.HTML +qhp.Qt.extraFiles = index.html \ + images/bg_l.png \ + images/bg_l_blank.png \ + images/bg_ll_blank.png \ + images/bg_ul_blank.png \ + images/header_bg.png \ + images/bg_r.png \ + images/box_bg.png \ + images/breadcrumb.png \ + images/bullet_gt.png \ + images/bullet_dn.png \ + images/bullet_sq.png \ + images/bullet_up.png \ + images/arrow_down.png \ + images/feedbackground.png \ + images/horBar.png \ + images/page.png \ + images/page_bg.png \ + images/sprites-combined.png \ + images/spinner.gif \ + images/stylesheet-coffee-plastique.png \ + images/taskmenuextension-example.png \ + images/coloreditorfactoryimage.png \ + images/dynamiclayouts-example.png \ + scripts/functions.js \ + scripts/jquery.js \ + scripts/narrow.js \ + scripts/superfish.js \ + style/narrow.css \ + style/superfish.css \ + style/style_ie6.css \ + style/style_ie7.css \ + style/style_ie8.css \ + style/style.css diff --git a/tools/qdoc3/test/qt-html-templates.qdocconf b/tools/qdoc3/test/qt-html-templates.qdocconf index 5a2058a..bbd1b21 100644 --- a/tools/qdoc3/test/qt-html-templates.qdocconf +++ b/tools/qdoc3/test/qt-html-templates.qdocconf @@ -46,3 +46,32 @@ HTML.footer = \ " Free Documentation License version 1.3\n" \ " as published by the Free Software Foundation.

    \n" \ "
    \n" \ + +# Files not referenced in any qdoc file (last four are needed by qtdemo) +# See also extraimages.HTML +qhp.Qt.extraFiles = index.html \ + images/bg_l.png \ + images/bg_l_blank.png \ + images/bg_ll_blank.png \ + images/bg_ul_blank.png \ + images/header_bg.png \ + images/bg_r.png \ + images/box_bg.png \ + images/breadcrumb.png \ + images/bullet_gt.png \ + images/bullet_dn.png \ + images/bullet_sq.png \ + images/bullet_up.png \ + images/arrow_down.png \ + images/feedbackground.png \ + images/horBar.png \ + images/page.png \ + images/page_bg.png \ + images/sprites-combined.png \ + images/spinner.gif \ + images/stylesheet-coffee-plastique.png \ + images/taskmenuextension-example.png \ + images/coloreditorfactoryimage.png \ + images/dynamiclayouts-example.png \ + style/narrow.css \ + style/style.css diff --git a/tools/qdoc3/test/qt-project.qdocconf b/tools/qdoc3/test/qt-project.qdocconf index 7531b76..be2a227 100644 --- a/tools/qdoc3/test/qt-project.qdocconf +++ b/tools/qdoc3/test/qt-project.qdocconf @@ -19,45 +19,6 @@ qhp.Qt.virtualFolder = qdoc qhp.Qt.indexTitle = Qt Reference Documentation qhp.Qt.indexRoot = -# Files not referenced in any qdoc file (last four are needed by qtdemo) -# See also extraimages.HTML -qhp.Qt.extraFiles = index.html \ - images/bg_l.png \ - images/bg_l_blank.png \ - images/bg_ll_blank.png \ - images/bg_ul_blank.png \ - images/header_bg.png \ - images/bg_r.png \ - images/box_bg.png \ - images/breadcrumb.png \ - images/bullet_gt.png \ - images/bullet_dn.png \ - images/bullet_sq.png \ - images/bullet_up.png \ - images/arrow_down.png \ - images/feedbackground.png \ - images/horBar.png \ - images/page.png \ - images/page_bg.png \ - images/sprites-combined.png \ - images/spinner.gif \ - images/stylesheet-coffee-plastique.png \ - images/taskmenuextension-example.png \ - images/coloreditorfactoryimage.png \ - images/dynamiclayouts-example.png \ - scripts/functions.js \ - scripts/jquery.js \ - scripts/narrow.js \ - scripts/superfish.js \ - style/narrow.css \ - style/superfish.css \ - style/style_ie6.css \ - style/style_ie7.css \ - style/style_ie8.css \ - style/style.css - - - qhp.Qt.filterAttributes = qt 4.7.1 qtrefdoc qhp.Qt.customFilters.Qt.name = Qt 4.7.1 qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.1 -- cgit v0.12 From c5d942a039b924b0179a9845cce2e4660905f2f8 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 19 Nov 2010 13:22:11 +0100 Subject: qdoc: Replaced all "#location" with "file.xml#location" --- tools/qdoc3/ditaxmlgenerator.cpp | 39 +++++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index aace05a..d4285a8 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -976,8 +976,8 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, s = sections.constBegin(); while (s != sections.constEnd()) { if (!(*s).members.isEmpty()) { - writeXrefListItem(QString("#" + Doc::canonicalTitle((*s).name)), - (*s).name); + QString li = outFileName() + "#" + Doc::canonicalTitle((*s).name); + writeXrefListItem(li, (*s).name); } ++s; } @@ -2762,7 +2762,8 @@ void DitaXmlGenerator::generateCompactList(const Node* relative, if (usedParagraphNames.contains(char('a' + i))) { xmlWriter().writeStartElement("xref"); QString guid = lookupGuid(outFileName(),QString(ch)); - xmlWriter().writeAttribute("href",QString("#%1").arg(guid)); + QString attr = outFileName() + QString("#%1").arg(guid); + xmlWriter().writeAttribute("href", attr); xmlWriter().writeCharacters(QString(ch.toUpper())); xmlWriter().writeEndElement(); // } @@ -2849,16 +2850,17 @@ void DitaXmlGenerator::generateFunctionIndex(const Node* relative, CodeMarker* marker) { xmlWriter().writeStartElement("p"); - xmlWriter().writeAttribute("outputclass","function-index"); - xmlWriter().writeStartElement("b"); + xmlWriter().writeAttribute("outputclass","alphabet"); for (int i = 0; i < 26; i++) { QChar ch('a' + i); xmlWriter().writeStartElement("xref"); - xmlWriter().writeAttribute("href",QString("#%1").arg(ch)); + QString guid = lookupGuid(outFileName(),QString(ch)); + QString attr = outFileName() + QString("#%1").arg(guid); + xmlWriter().writeAttribute("href", attr); xmlWriter().writeCharacters(QString(ch.toUpper())); xmlWriter().writeEndElement(); // + } - xmlWriter().writeEndElement(); // xmlWriter().writeEndElement(); //

    char nextLetter = 'a'; @@ -3700,7 +3702,8 @@ void DitaXmlGenerator::generateFullName(const Node* apparentNode, if (actualNode == 0) actualNode = apparentNode; xmlWriter().writeStartElement("xref"); - xmlWriter().writeAttribute("href",linkForNode(actualNode, relative)); + QString href = linkForNode(actualNode, relative); + xmlWriter().writeAttribute("href",href); xmlWriter().writeCharacters(protectEnc(fullName(apparentNode, relative, marker))); xmlWriter().writeEndElement(); // } @@ -4042,10 +4045,26 @@ QString DitaXmlGenerator::getLink(const Atom* atom, link = linkForNode(*node, relative); if (*node && (*node)->subType() == Node::Image) link = "images/used-in-examples/" + link; - if (targetAtom) - link += "#" + refForAtom(targetAtom, *node); + if (targetAtom) { + if (link.isEmpty()) + link = outFileName(); + QString guid = lookupGuid(link,refForAtom(targetAtom,*node)); + link += "#" + guid; + } +#if 0 + else if (link.isEmpty() && *node) { + link = outFileName() + "#" + (*node)->guid(); + } +#endif + else if (!link.isEmpty() && *node && link.endsWith(".xml")) { + link += "#" + (*node)->guid(); + } } } + if (!link.isEmpty() && link[0] == '#') { + link.prepend(outFileName()); + qDebug() << "LOCAL LINK:" << link; + } return link; } -- cgit v0.12 From 771337bb2c286343ac912a32101fc7d418ef8a7c Mon Sep 17 00:00:00 2001 From: David Boddie Date: Fri, 19 Nov 2010 15:40:40 +0100 Subject: Removed unused files and functionality from qdoc3. Many of the generators were unused. The old QSA and Qt Script parsers were unused. We no longer use DCF files for Qt Assistant. We no longer generate Qt Jambi documentation, and qdoc3 was not used for much of that process, making some of the relevant files obsolete. --- tools/qdoc3/bookgenerator.cpp | 64 --- tools/qdoc3/bookgenerator.h | 64 --- tools/qdoc3/cpptoqsconverter.cpp | 415 ----------------- tools/qdoc3/cpptoqsconverter.h | 88 ---- tools/qdoc3/dcfsection.cpp | 111 ----- tools/qdoc3/dcfsection.h | 94 ---- tools/qdoc3/htmlgenerator.cpp | 132 +----- tools/qdoc3/htmlgenerator.h | 11 - tools/qdoc3/jambiapiparser.cpp | 546 ---------------------- tools/qdoc3/jambiapiparser.h | 99 ---- tools/qdoc3/javacodemarker.cpp | 203 -------- tools/qdoc3/javacodemarker.h | 83 ---- tools/qdoc3/javadocgenerator.cpp | 454 ------------------ tools/qdoc3/javadocgenerator.h | 95 ---- tools/qdoc3/linguistgenerator.cpp | 245 ---------- tools/qdoc3/linguistgenerator.h | 85 ---- tools/qdoc3/loutgenerator.cpp | 63 --- tools/qdoc3/loutgenerator.h | 67 --- tools/qdoc3/main.cpp | 26 +- tools/qdoc3/mangenerator.cpp | 228 --------- tools/qdoc3/mangenerator.h | 79 ---- tools/qdoc3/qdoc3.pro | 26 -- tools/qdoc3/qsakernelparser.cpp | 186 -------- tools/qdoc3/qsakernelparser.h | 77 ---- tools/qdoc3/qscodemarker.cpp | 378 --------------- tools/qdoc3/qscodemarker.h | 79 ---- tools/qdoc3/qscodeparser.cpp | 944 -------------------------------------- tools/qdoc3/qscodeparser.h | 128 ------ tools/qdoc3/sgmlgenerator.cpp | 63 --- tools/qdoc3/sgmlgenerator.h | 67 --- 30 files changed, 3 insertions(+), 5197 deletions(-) delete mode 100644 tools/qdoc3/bookgenerator.cpp delete mode 100644 tools/qdoc3/bookgenerator.h delete mode 100644 tools/qdoc3/cpptoqsconverter.cpp delete mode 100644 tools/qdoc3/cpptoqsconverter.h delete mode 100644 tools/qdoc3/dcfsection.cpp delete mode 100644 tools/qdoc3/dcfsection.h delete mode 100644 tools/qdoc3/jambiapiparser.cpp delete mode 100644 tools/qdoc3/jambiapiparser.h delete mode 100644 tools/qdoc3/javacodemarker.cpp delete mode 100644 tools/qdoc3/javacodemarker.h delete mode 100644 tools/qdoc3/javadocgenerator.cpp delete mode 100644 tools/qdoc3/javadocgenerator.h delete mode 100644 tools/qdoc3/linguistgenerator.cpp delete mode 100644 tools/qdoc3/linguistgenerator.h delete mode 100644 tools/qdoc3/loutgenerator.cpp delete mode 100644 tools/qdoc3/loutgenerator.h delete mode 100644 tools/qdoc3/mangenerator.cpp delete mode 100644 tools/qdoc3/mangenerator.h delete mode 100644 tools/qdoc3/qsakernelparser.cpp delete mode 100644 tools/qdoc3/qsakernelparser.h delete mode 100644 tools/qdoc3/qscodemarker.cpp delete mode 100644 tools/qdoc3/qscodemarker.h delete mode 100644 tools/qdoc3/qscodeparser.cpp delete mode 100644 tools/qdoc3/qscodeparser.h delete mode 100644 tools/qdoc3/sgmlgenerator.cpp delete mode 100644 tools/qdoc3/sgmlgenerator.h diff --git a/tools/qdoc3/bookgenerator.cpp b/tools/qdoc3/bookgenerator.cpp deleted file mode 100644 index bbcdd11..0000000 --- a/tools/qdoc3/bookgenerator.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - bookgenerator.cpp -*/ - -#include "bookgenerator.h" - -QT_BEGIN_NAMESPACE - -BookGenerator::BookGenerator() -{ -} - -BookGenerator::~BookGenerator() -{ -} - -void BookGenerator::generateTree( const Tree *tree, CodeMarker *marker ) -{ - Q_UNUSED( tree ) - Q_UNUSED( marker ) -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/bookgenerator.h b/tools/qdoc3/bookgenerator.h deleted file mode 100644 index 69b65fc..0000000 --- a/tools/qdoc3/bookgenerator.h +++ /dev/null @@ -1,64 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - bookgenerator.h -*/ - -#ifndef BOOKGENERATOR_H -#define BOOKGENERATOR_H - -#include "generator.h" - -QT_BEGIN_NAMESPACE - -class BookGenerator : public Generator -{ -public: - BookGenerator(); - ~BookGenerator(); - - virtual void generateTree( const Tree *tree, CodeMarker *marker ); -}; - -QT_END_NAMESPACE - -#endif diff --git a/tools/qdoc3/cpptoqsconverter.cpp b/tools/qdoc3/cpptoqsconverter.cpp deleted file mode 100644 index 1a44c16..0000000 --- a/tools/qdoc3/cpptoqsconverter.cpp +++ /dev/null @@ -1,415 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - cpptoqsconverter.cpp -*/ - -#include "config.h" -#include "cpptoqsconverter.h" - -QT_BEGIN_NAMESPACE - -#define CONFIG_QUICK "quick" -#define CONFIG_INDENTSIZE "indentsize" - -void setTabSize( int size ); -void setIndentSize( int size ); -int columnForIndex( const QString& t, int index ); -int indentForBottomLine( const QStringList& program, QChar typedIn ); - -static QString balancedParens = "(?:[^()]+|\\([^()]*\\))*"; - -QRegExp CppToQsConverter::qClassRegExp; -QRegExp CppToQsConverter::addressOperatorRegExp; -QRegExp CppToQsConverter::gulbrandsenRegExp; -int CppToQsConverter::tabSize; - -ClassNode *CppToQsConverter::findClassNode( Tree *qsTree, - const QString& qtName ) -{ - ClassNode *classe = (ClassNode *) qsTree->findNode( QStringList(qtName), Node::Class ); - if ( classe == 0 ) - classe = (ClassNode *) qsTree->findNode( QStringList(qtName.mid(1)), Node::Class ); - return classe; -} - -QString CppToQsConverter::convertedDataType( Tree *qsTree, - const QString& leftType, - const QString& /* rightType */ ) -{ - QString s = leftType; - - if ( s.startsWith("const ") ) - s = s.mid( 6 ); - while ( s.endsWith("*") || s.endsWith("&") || s.endsWith(" ") ) - s.truncate( s.length() - 1 ); - - switch ( s[0].unicode() ) { - case 'Q': - if ( s == "QCString" ) { - return "String"; - } else { - Node *node = findClassNode( qsTree, s ); - if ( node == 0 ) { - return ""; - } else { - return node->name(); - } - } - break; - case 'b': - if ( s == "bool" ) - return "Boolean"; - break; - case 'c': - if ( s == "char" ) { - if ( leftType == "const char *" ) { - return "String"; - } else { - return "Number"; - } - } - break; - case 'd': - if ( s == "double" ) - return "Number"; - break; - case 'f': - if ( s == "float" ) - return "Number"; - case 'i': - if ( s == "int" ) - return "Number"; - break; - case 'l': - if ( s == "long" || s == "long int" || s == "long long" || - s == "long long int" || s == "long double" ) - return "Number"; - break; - case 's': - if ( s == "short" || s == "short int" || s == "signed char" || - s == "signed short" || s == "signed short int" || s == "signed" || - s == "signed int" || s == "signed long" || s == "signed long int" ) - return "Number"; - break; - case 'u': - if ( s == "uchar" || s == "unsigned" || s == "unsigned char" || - s == "ushort" || s == "unsigned short" || - s == "unsigned short int" || s == "uint" || s == "unsigned int" || - s == "ulong" || s == "unsigned long" || s == "unsigned long int" ) - return "Number"; - break; - case 'v': - if ( s == "void" ) - return ""; - } - return s; -} - -QString CppToQsConverter::convertedCode( Tree *qsTree, const QString& code, - const QSet& classesWithNoQ ) -{ - QString result; - QStringList program; - QStringList comments; - int programWidth = 0; - - QStringList originalLines = code.split("\n"); - QStringList::ConstIterator ol = originalLines.begin(); - while ( ol != originalLines.end() ) { - QString code = (*ol).trimmed(); - QString comment; - - int slashSlash = code.indexOf( "//" ); - if ( slashSlash != -1 ) { - comment = code.mid( slashSlash ); - code.truncate( slashSlash ); - code = code.trimmed(); - } - - code = convertCodeLine( qsTree, program, code, classesWithNoQ ); - program.append( code ); - - comment = convertComment( qsTree, comment, classesWithNoQ ); - comments.append( comment ); - - int n = indentForBottomLine( program, QChar::Null ); - for ( int i = 0; i < n; i++ ) - program.last().prepend( " " ); - - int width = columnForIndex( program.last(), program.last().length() ); - if ( !comment.isEmpty() && width > programWidth ) - programWidth = width; - ++ol; - } - - programWidth = ( (programWidth + (tabSize - 1) + 2) / tabSize ) * tabSize; - - QStringList::ConstIterator p = program.begin(); - QStringList::ConstIterator c = comments.begin(); - while ( c != comments.end() ) { - if ( c != comments.begin() ) - result += "\n"; - - if ( (*p).trimmed().isEmpty() ) { - if ( !(*c).isEmpty() ) - result += *p; - } else { - result += *p; - if ( !(*c).isEmpty() ) { - int i = columnForIndex( *p, (*p).length() ); - while ( i++ < programWidth ) - result += " "; - } - } - result += *c; - ++p; - ++c; - } - return result; -} - -void CppToQsConverter::initialize( const Config& config ) -{ - qClassRegExp.setPattern( "\\bQ([A-Z][A-Za-z]+)\\b" ); - addressOperatorRegExp.setPattern( "([(\\s])[*&]([a-zA-Z])" ); - gulbrandsenRegExp.setPattern( "\\b::\\b|->" ); - - tabSize = config.getInt( CONFIG_TABSIZE ); - setTabSize( tabSize ); - - int size = config.getInt( CONFIG_QUICK + Config::dot + CONFIG_INDENTSIZE ); - if ( size > 0 ) - setIndentSize( size ); -} - -void CppToQsConverter::terminate() -{ -} - -QString CppToQsConverter::convertCodeLine( Tree *qsTree, - const QStringList& program, - const QString& code, - const QSet& classesWithNoQ ) -{ - static QString dataTypeFmt = - "(?!return)(?:const\\b\\s*)?[A-Za-z_]+(?:\\s*[*&])?"; - static QRegExp funcPrototypeRegExp( - "(" + dataTypeFmt + ")\\s*\\b([A-Z][a-zA-Z_0-9]*::)?" - "([a-z][a-zA-Z_0-9]*)\\(([^);]*)(\\)?)(?:\\s*const)?" ); - static QRegExp paramRegExp( - "^\\s*(" + dataTypeFmt + ")\\s*\\b([a-z][a-zA-Z_0-9]*)\\s*(,)?\\s*" ); - static QRegExp uninitVarRegExp( - "(" + dataTypeFmt + ")\\s*\\b([a-z][a-zA-Z_0-9]*);" ); - static QRegExp eqVarRegExp( - dataTypeFmt + "\\s*\\b([a-z][a-zA-Z_0-9]*)\\s*=(\\s*)(.*)" ); - static QRegExp ctorVarRegExp( - "(" + dataTypeFmt + ")\\s*\\b([a-z][a-zA-Z_0-9]*)\\((.*)\\);" ); - static QRegExp qdebugRegExp( - "q(?:Debug|Warning|Fatal)\\(\\s*(\"(?:\\\\.|[^\"])*\")\\s*" - "(?:,\\s*(\\S(?:[^,]*\\S)?))?\\s*\\);" ); - static QRegExp coutRegExp( "c(?:out|err)\\b(.*);" ); - static QRegExp lshiftRegExp( "\\s*<<\\s*" ); - static QRegExp endlRegExp( "^endl$" ); - - if ( code.isEmpty() || code == "{" || code == "}" ) - return code; - - QString result; - - if ( funcPrototypeRegExp.exactMatch(code) ) { - QString returnType = funcPrototypeRegExp.cap( 1 ); - QString className = funcPrototypeRegExp.cap( 2 ); - QString funcName = funcPrototypeRegExp.cap( 3 ); - QString params = funcPrototypeRegExp.cap( 4 ).trimmed(); - bool toBeContinued = funcPrototypeRegExp.cap( 5 ).isEmpty(); - // ### unused - Q_UNUSED(toBeContinued); - - className.replace( "::", "." ); - - result = "function " + className + funcName + "("; - - if ( !params.isEmpty() && params != "void" ) { - result += " "; - int i = funcPrototypeRegExp.pos( 4 ); - while ( (i = paramRegExp.indexIn(code, i, - QRegExp::CaretAtOffset)) != -1 ) { - QString dataType = paramRegExp.cap( 1 ); - QString paramName = paramRegExp.cap( 2 ); - QString comma = paramRegExp.cap( 3 ); - - result += paramName + " : " + - convertedDataType( qsTree, dataType ); - if ( comma.isEmpty() ) - break; - result += ", "; - i += paramRegExp.matchedLength(); - } - result += " "; - } - - result += ")"; - returnType = convertedDataType( qsTree, returnType ); - if ( !returnType.isEmpty() ) - result += " : " + returnType; - } else if ( uninitVarRegExp.exactMatch(code) ) { - QString dataType = uninitVarRegExp.cap( 1 ); - QString varName = uninitVarRegExp.cap( 2 ); - - result = "var " + varName; - dataType = convertedDataType( qsTree, dataType ); - if ( !dataType.isEmpty() ) - result += " : " + dataType; - result += ";"; - } else if ( eqVarRegExp.exactMatch(code) ) { - QString varName = eqVarRegExp.cap( 1 ); - QString value = eqVarRegExp.cap( 3 ); - - value = convertExpr( qsTree, value, classesWithNoQ ); - result += "var " + varName + " = " + value; - } else if ( ctorVarRegExp.exactMatch(code) ) { - QString dataType = ctorVarRegExp.cap( 1 ); - QString varName = ctorVarRegExp.cap( 2 ); - QString value = ctorVarRegExp.cap( 3 ).trimmed(); - - result += "var " + varName + " = "; - - dataType = convertedDataType( qsTree, dataType ); - value = convertExpr( qsTree, value, classesWithNoQ ); - - if ( dataType.isEmpty() || dataType == "String" ) { - if ( value.contains(",") ) { - result += "..."; - } else { - result += value; - } - } else { - result += "new " + dataType; - if ( !value.isEmpty() ) - result += "( " + value + " )"; - } - result += ";"; - } else if ( qdebugRegExp.exactMatch(code) ) { - QString fmt = qdebugRegExp.cap( 1 ); - QString arg1 = qdebugRegExp.cap( 2 ); - - result += "println "; - int i = 0; - while ( i < (int) fmt.length() ) { - if ( fmt[i] == '%' ) { - int percent = i; - i++; - while ( i < (int) fmt.length() && - QString("diouxXeEfFgGaAcsCSpn%\"").indexOf(fmt[i]) == -1 ) - i++; - if ( fmt[i] == '%' ) { - result += fmt[i++]; - } else if ( fmt[i] != '"' ) { - if ( percent == 1 ) { - result.truncate( result.length() - 1 ); - } else { - result += "\" + "; - } - i++; - if ( arg1.endsWith(".latin1()") ) - arg1.truncate( arg1.length() - 9 ); - result += arg1; - if ( i == (int) fmt.length() - 1 ) { - i++; - } else { - result += " + \""; - } - } - } else { - result += fmt[i++]; - } - } - result += ";"; - } else if ( coutRegExp.exactMatch(code) && - program.filter("var cout").isEmpty() ) { - QStringList args = coutRegExp.cap(1).split(lshiftRegExp); - args.replaceInStrings( endlRegExp, "\"\\n\"" ); - if ( args.last() == "\"\\n\"" ) { - args.erase( args.end() - 1 ); - if ( args.isEmpty() ) - args << "\"\""; - result += "println "; - } else { - result += "print "; - } - result += args.join( " + " ) + ";"; - } else { - result = convertExpr( qsTree, code, classesWithNoQ ); - } - return result; -} - -QString CppToQsConverter::convertComment( Tree * /* qsTree */, - const QString& comment, - const QSet& classesWithNoQ ) - -{ - QString result = comment; - - result.replace( "TRUE", "true" ); - result.replace( "FALSE", "false" ); - result.replace( addressOperatorRegExp, "\\1\\2" ); - result.replace( gulbrandsenRegExp, "." ); - - int i = 0; - while ( (i = result.indexOf(qClassRegExp, i)) != -1 ) { - if ( classesWithNoQ.contains(qClassRegExp.cap(1)) ) - result.remove( i, 1 ); - i++; - } - return result; -} - -QString CppToQsConverter::convertExpr( Tree *qsTree, const QString& expr, - const QSet& classesWithNoQ ) -{ - // suboptimal - return convertComment( qsTree, expr, classesWithNoQ ); -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/cpptoqsconverter.h b/tools/qdoc3/cpptoqsconverter.h deleted file mode 100644 index 001091b..0000000 --- a/tools/qdoc3/cpptoqsconverter.h +++ /dev/null @@ -1,88 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - cpptoqsconverter.h -*/ - -#ifndef CPPTOQSCONVERTER_H -#define CPPTOQSCONVERTER_H - -#include - -#include "tree.h" - -QT_BEGIN_NAMESPACE - -class CppToQsConverter -{ -public: - CppToQsConverter() { } - - ClassNode *findClassNode( Tree *qsTree, const QString& qtName ); - QString convertedDataType( Tree *qsTree, const QString& leftType, - const QString& rightType = "" ); - QString convertedCode( Tree *qsTree, const QString& code, - const QSet& classesWithNoQ ); - - static void initialize( const Config& config ); - static void terminate(); - -private: - void clearState(); - QString convertCodeLine( Tree *qsTree, const QStringList& program, - const QString& code, - const QSet& classesWithNoQ ); - QString convertComment( Tree *qsTree, const QString& comment, - const QSet& classesWithNoQ ); - QString convertExpr( Tree *qsTree, const QString& expr, - const QSet& classesWithNoQ ); - void updateDelimDepths( const QString& code ); - - static QRegExp qClassRegExp; - static QRegExp addressOperatorRegExp; - static QRegExp gulbrandsenRegExp; - static int tabSize; -}; - -QT_END_NAMESPACE - -#endif diff --git a/tools/qdoc3/dcfsection.cpp b/tools/qdoc3/dcfsection.cpp deleted file mode 100644 index ea10dbf..0000000 --- a/tools/qdoc3/dcfsection.cpp +++ /dev/null @@ -1,111 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include - -#include "dcfsection.h" -#include "htmlgenerator.h" - -QT_BEGIN_NAMESPACE - -void appendDcfSubSection( DcfSection *dcfSect, const DcfSection& sub ) -{ - dcfSect->subsections.append( sub ); -} - -void appendDcfSubSections( DcfSection *dcfSect, const QList& subs ) -{ - dcfSect->subsections += subs; -} - -void generateDcfSubSections( QString indent, QTextStream& out, const DcfSection& sect ) -{ - QList::const_iterator ss = sect.subsections.constBegin(); - while ( ss != sect.subsections.constEnd() ) { - out << indent << "
    \n"; - } else { - out << ">\n"; - QString indentIndent = indent + " "; - QList >::const_iterator k = (*ss).keywords.constBegin(); - while ( k != (*ss).keywords.constEnd() ) { - out << indentIndent << "" - << HtmlGenerator::protect((*k).first) << "\n"; - ++k; - } - - generateDcfSubSections( indentIndent, out, *ss ); - out << indent << "
    \n"; - } - ++ss; - } - out.flush(); -} - -void generateDcfSections( const DcfSection& rootSect, const QString& fileName, - const QString& /* category */ ) -{ - QFile file(fileName); - if (!file.open(QFile::WriteOnly | QFile::Text)) - return ; - - QTextStream out(&file); - - QString icon = QFileInfo(fileName).baseName() + ".png"; - - out << "\n"; - out << "\n"; - - generateDcfSubSections( "", out, rootSect ); - - out << "\n"; - out.flush(); -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/dcfsection.h b/tools/qdoc3/dcfsection.h deleted file mode 100644 index 0318511..0000000 --- a/tools/qdoc3/dcfsection.h +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef DCFSECTION_H -#define DCFSECTION_H - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -class QTextStream; - -struct DcfSection -{ - QString title; - QString ref; - QList > keywords; - QList subsections; -}; - -inline bool operator<( const DcfSection& s1, const DcfSection& s2 ) { - QString title1 = s1.title; - QString title2 = s2.title; - - // cheat with Q3 classes - if (title1.startsWith("Q3")) - title1.insert(1, '~'); - if (title2.startsWith("Q3")) - title2.insert(1, '~'); - - int delta = title1.toLower().compare( title2.toLower() ); - if ( delta == 0 ) { - delta = title1.compare( title2 ); - if ( delta == 0 ) - delta = s1.ref.localeAwareCompare( s2.ref ); - } - return delta < 0; -} - -inline bool operator>( const DcfSection& s1, const DcfSection& s2 ) { return s2 < s1; } -inline bool operator<=( const DcfSection& s1, const DcfSection& s2 ) { return !( s2 < s1 ); } -inline bool operator>=( const DcfSection& s1, const DcfSection& s2 ) { return !( s1 < s2 ); } -inline bool operator==( const DcfSection& s1, const DcfSection& s2 ) { return &s1 == &s2; } -inline bool operator!=( const DcfSection& s1, const DcfSection& s2 ) { return !( s1 == s2 ); } - -void appendDcfSubSection(DcfSection *dcfSect, const DcfSection &sub); -void appendDcfSubSections(DcfSection *dcfSect, const QList &subs); -void generateDcfSubSections(QString indent, QTextStream &out, const DcfSection §); -void generateDcfSections(const DcfSection &rootSect, const QString& fileName, - const QString& category ); - -QT_END_NAMESPACE - -#endif diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 3f35f76..0cd534e 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -355,7 +355,7 @@ QString HtmlGenerator::format() } /*! - This is where the HTML and DCF files are written. + This is where the HTML files are written. \note The HTML file generation is done in the base class, PageGenerator::generateTree(). */ @@ -380,43 +380,6 @@ void HtmlGenerator::generateTree(const Tree *tree, CodeMarker *marker) PageGenerator::generateTree(tree, marker); - dcfClassesRoot.ref = "classes.html"; - dcfClassesRoot.title = "Classes"; - qSort(dcfClassesRoot.subsections); - - dcfOverviewsRoot.ref = "overviews.html"; - dcfOverviewsRoot.title = "Overviews"; - qSort(dcfOverviewsRoot.subsections); - - dcfExamplesRoot.ref = "examples.html"; - dcfExamplesRoot.title = "Tutorial & Examples"; - qSort(dcfExamplesRoot.subsections); - - DcfSection qtRoot; - appendDcfSubSection(&qtRoot, dcfClassesRoot); - appendDcfSubSection(&qtRoot, dcfOverviewsRoot); - appendDcfSubSection(&qtRoot, dcfExamplesRoot); - - generateDcf(project.toLower().simplified().replace(" ", "-"), - "index.html", - projectDescription, qtRoot); - generateDcf("designer", - "designer-manual.html", - "Qt Designer Manual", - dcfDesignerRoot); - generateDcf("linguist", - "linguist-manual.html", - "Qt Linguist Manual", - dcfLinguistRoot); - generateDcf("assistant", - "assistant-manual.html", - "Qt Assistant Manual", - dcfAssistantRoot); - generateDcf("qmake", - "qmake-manual.html", - "qmake Manual", - dcfQmakeRoot); - QString fileBase = project.toLower().simplified().replace(" ", "-"); generateIndex(fileBase, projectUrl, projectDescription); generatePageIndex(outputDir() + "/" + fileBase + ".pageindex", marker); @@ -1253,11 +1216,6 @@ void HtmlGenerator::generateClassLikeNode(const InnerNode *inner, title = rawTitle + " Class Reference"; } - DcfSection classSection; - classSection.title = title; - classSection.ref = linkForNode(inner, 0); - classSection.keywords += qMakePair(inner->name(), classSection.ref); - Text subtitleText; if (rawTitle != fullTitle) subtitleText << "(" << Atom(Atom::AutoLink, fullTitle) << ")" @@ -1420,8 +1378,6 @@ void HtmlGenerator::generateClassLikeNode(const InnerNode *inner, names << plainCode(marker->markedUpEnumValue(enumName, enume)); } - foreach (const QString &name, names) - classSection.keywords += qMakePair(name,linkForNode(*m,0)); } ++m; } @@ -1430,27 +1386,6 @@ void HtmlGenerator::generateClassLikeNode(const InnerNode *inner, ++s; } generateFooter(inner); - - if (!membersLink.isEmpty()) { - DcfSection membersSection; - membersSection.title = "List of all members"; - membersSection.ref = membersLink; - appendDcfSubSection(&classSection, membersSection); - } - if (!obsoleteLink.isEmpty()) { - DcfSection obsoleteSection; - obsoleteSection.title = "Obsolete members"; - obsoleteSection.ref = obsoleteLink; - appendDcfSubSection(&classSection, obsoleteSection); - } - if (!compatLink.isEmpty()) { - DcfSection compatSection; - compatSection.title = "Qt 3 support members"; - compatSection.ref = compatLink; - appendDcfSubSection(&classSection, compatSection); - } - - appendDcfSubSection(&dcfClassesRoot, classSection); } /*! @@ -1460,9 +1395,6 @@ void HtmlGenerator::generateClassLikeNode(const InnerNode *inner, void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) { SubTitleSize subTitleSize = LargeSubTitle; - DcfSection fakeSection; - fakeSection.title = fake->fullTitle(); - fakeSection.ref = linkForNode(fake, 0); QList
    sections; QList
    ::const_iterator s; @@ -1542,25 +1474,6 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) << "Qt 3 support members\n"; out() << "\n"; - - if (!membersLink.isEmpty()) { - DcfSection membersSection; - membersSection.title = "List of all members"; - membersSection.ref = membersLink; - appendDcfSubSection(&fakeSection, membersSection); - } - if (!obsoleteLink.isEmpty()) { - DcfSection obsoleteSection; - obsoleteSection.title = "Obsolete members"; - obsoleteSection.ref = obsoleteLink; - appendDcfSubSection(&fakeSection, obsoleteSection); - } - if (!compatLink.isEmpty()) { - DcfSection compatSection; - compatSection.title = "Qt 3 support members"; - compatSection.ref = compatLink; - appendDcfSubSection(&fakeSection, compatSection); - } } #ifdef QDOC_QML else if (fake->subType() == Node::QmlClass) { @@ -1603,8 +1516,6 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) while (m != (*s).members.end()) { generateDetailedQmlMember(*m, fake, marker); out() << "
    \n"; - fakeSection.keywords += qMakePair((*m)->name(), - linkForNode(*m,0)); ++m; } ++s; @@ -1649,8 +1560,6 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) generateAnnotatedList(fake, marker, groupMembersMap); } - fakeSection.keywords += qMakePair(fakeSection.title, fakeSection.ref); - sections = marker->sections(fake, CodeMarker::Detailed, CodeMarker::Okay); s = sections.begin(); while (s != sections.end()) { @@ -1660,35 +1569,11 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) NodeList::ConstIterator m = (*s).members.begin(); while (m != (*s).members.end()) { generateDetailedMember(*m, fake, marker); - fakeSection.keywords += qMakePair((*m)->name(), linkForNode(*m, 0)); ++m; } ++s; } generateFooter(fake); - - if (fake->subType() == Node::Example) { - appendDcfSubSection(&dcfExamplesRoot, fakeSection); - } - else if (fake->subType() != Node::File) { - QString contentsPage = fake->links().value(Node::ContentsLink).first; - - if (contentsPage == "Qt Designer Manual") { - appendDcfSubSection(&dcfDesignerRoot, fakeSection); - } - else if (contentsPage == "Qt Linguist Manual") { - appendDcfSubSection(&dcfLinguistRoot, fakeSection); - } - else if (contentsPage == "Qt Assistant Manual") { - appendDcfSubSection(&dcfAssistantRoot, fakeSection); - } - else if (contentsPage == "qmake Manual") { - appendDcfSubSection(&dcfQmakeRoot, fakeSection); - } - else { - appendDcfSubSection(&dcfOverviewsRoot, fakeSection); - } - } } /*! @@ -3464,10 +3349,7 @@ QString HtmlGenerator::linkForNode(const Node *node, const Node *relative) fn = fileName(node); /* if (!node->url().isEmpty()) return fn;*/ -#if 0 - // ### reintroduce this test, without breaking .dcf files - if (fn != outFileName()) -#endif + link += fn; if (!node->isInnerNode() || node->subType() == Node::QmlPropertyGroup) { @@ -3959,16 +3841,6 @@ QString HtmlGenerator::getLink(const Atom *atom, return link; } -void HtmlGenerator::generateDcf(const QString &fileBase, - const QString &startPage, - const QString &title, - DcfSection &dcfRoot) -{ - dcfRoot.ref = startPage; - dcfRoot.title = title; - generateDcfSections(dcfRoot, outputDir() + "/" + fileBase + ".dcf", fileBase + "/reference"); -} - void HtmlGenerator::generateIndex(const QString &fileBase, const QString &url, const QString &title) diff --git a/tools/qdoc3/htmlgenerator.h b/tools/qdoc3/htmlgenerator.h index 1b3de9e..c0a4ce8 100644 --- a/tools/qdoc3/htmlgenerator.h +++ b/tools/qdoc3/htmlgenerator.h @@ -52,7 +52,6 @@ #include "codemarker.h" #include "config.h" -#include "dcfsection.h" #include "pagegenerator.h" QT_BEGIN_NAMESPACE @@ -253,9 +252,6 @@ class HtmlGenerator : public PageGenerator const Node *relative, CodeMarker *marker, const Node** node); - virtual void generateDcf(const QString &fileBase, - const QString &startPage, - const QString &title, DcfSection &dcfRoot); virtual void generateIndex(const QString &fileBase, const QString &url, const QString &title); @@ -282,13 +278,6 @@ class HtmlGenerator : public PageGenerator #endif QMap refMap; int codeIndent; - DcfSection dcfClassesRoot; - DcfSection dcfOverviewsRoot; - DcfSection dcfExamplesRoot; - DcfSection dcfDesignerRoot; - DcfSection dcfLinguistRoot; - DcfSection dcfAssistantRoot; - DcfSection dcfQmakeRoot; HelpProjectWriter *helpProjectWriter; bool inLink; bool inObsoleteLink; diff --git a/tools/qdoc3/jambiapiparser.cpp b/tools/qdoc3/jambiapiparser.cpp deleted file mode 100644 index 23f2716..0000000 --- a/tools/qdoc3/jambiapiparser.cpp +++ /dev/null @@ -1,546 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - jambiapiparser.cpp -*/ - -#include "cppcodeparser.h" -#include "jambiapiparser.h" -#include "node.h" -#include "tree.h" - -QT_BEGIN_NAMESPACE - -static const char USED_INTERNALLY[] = ""; - -static Text textWithFixedBrief(const Text &text, const Text &beforeBrief, - const Text &afterBrief) -{ - Text result; - - const Atom *atom = text.firstAtom(); - while (atom) { - if (atom->type() == Atom::BriefLeft) { - result << Atom::ParaLeft << beforeBrief; - } else if (atom->type() == Atom::BriefRight) { - result << afterBrief << Atom::ParaRight; - } else { - result << *atom; - } - atom = atom->next(); - } - - return result; -} - -static void setPass1JambifiedDoc(Node *javaNode, const Node *cppNode, const QString &qName = "") -{ - Doc newDoc(cppNode->doc()); - - if (javaNode->type() == Node::Function) { - const FunctionNode *javaFunc = static_cast(javaNode); - if (cppNode->type() == Node::Function) { - const FunctionNode *cppFunc = static_cast(cppNode); - if (const PropertyNode *property = cppFunc->associatedProperty()) { - newDoc = property->doc(); - Text text(newDoc.body()); - - Node *mutableCppNode = const_cast(cppNode); - if (property->getters().contains(mutableCppNode)) { - text = textWithFixedBrief(text, Text("Returns "), Text(".")); - } else if (property->setters().contains(mutableCppNode)) { - Text afterBrief; - if (javaFunc->parameterNames().count() == 1 - && !javaFunc->parameterNames().first().isEmpty()) { - afterBrief << " to " - << Atom(Atom::FormattingLeft, ATOM_FORMATTING_PARAMETER) - << javaFunc->parameterNames().first() - << Atom(Atom::FormattingRight, ATOM_FORMATTING_PARAMETER); - } - afterBrief << "."; - text = textWithFixedBrief(text, Text("Sets "), afterBrief); - } else if (property->resetters().contains(mutableCppNode)) { - text = textWithFixedBrief(text, Text("Resets "), Text(".")); - } - - newDoc.setBody(text); - } else { - QStringList javaParams = javaFunc->parameterNames(); - QStringList cppParams = cppFunc->parameterNames(); - newDoc.renameParameters(cppParams, javaParams); - - if (cppNode->access() == Node::Private) { - Text text; - text << Atom::ParaLeft; - if (cppFunc->reimplementedFrom()) { - text << "This function is reimplemented for internal reasons."; - } else { - text << USED_INTERNALLY; - } - text << Atom::ParaRight; - newDoc.setBody(text); - } - } - } else if (cppNode->type() == Node::Variable) { - Text text(newDoc.body()); - - if (qName == "variablegetter") { - text = textWithFixedBrief(text, Text("Returns "), Text(".")); - } else if (qName == "variablesetter") { - Text afterBrief; - if (javaFunc->parameterNames().count() == 1 - && !javaFunc->parameterNames().first().isEmpty()) { - afterBrief << " to " - << Atom(Atom::FormattingLeft, ATOM_FORMATTING_PARAMETER) - << javaFunc->parameterNames().first() - << Atom(Atom::FormattingRight, ATOM_FORMATTING_PARAMETER); - } - afterBrief << "."; - text = textWithFixedBrief(text, Text("Sets "), afterBrief); - } - - newDoc.setBody(text); - } - } else { // ### enum value names? - - } - - javaNode->setDoc(newDoc, true); -} - -static void setStatus(Node *javaNode, const Node *cppNode) -{ - if (cppNode->status() == Node::Compat) { - javaNode->setStatus(Node::Obsolete); - } else { - javaNode->setStatus(cppNode->status()); - } -} - -static Text findEnumText(Node *javaEnum, const QString &enumItemName) -{ - const Text &body = javaEnum->doc().body(); - const Atom *atom = body.firstAtom(); - while (atom) { - if (atom->type() == Atom::ListTagLeft && atom->string() == ATOM_LIST_VALUE) { - atom = atom->next(); - if (atom) { - // ### paras? - if (atom->string() == enumItemName) - return body.subText(Atom::ListItemLeft, Atom::ListItemRight, atom); - } - } else { - atom = atom->next(); - } - } - return Text(); -} - -JambiApiParser::JambiApiParser(Tree *cppTree) - : cppTre(cppTree), javaTre(0), metJapiTag(false) -{ -} - -JambiApiParser::~JambiApiParser() -{ -} - -void JambiApiParser::initializeParser(const Config &config) -{ - CodeParser::initializeParser(config); -} - -void JambiApiParser::terminateParser() -{ - CodeParser::terminateParser(); -} - -QString JambiApiParser::language() -{ - return "Java"; -} - -QString JambiApiParser::sourceFileNameFilter() -{ - return "*.japi"; -} - -void JambiApiParser::parseSourceFile(const Location &location, const QString &filePath, Tree *tree) -{ - javaTre = tree; - metJapiTag = false; - - QXmlSimpleReader reader; - reader.setContentHandler(this); - reader.setErrorHandler(this); - - QFile file(filePath); - if (!file.open(QFile::ReadOnly)) { - location.warning(tr("Cannot open JAPI file '%1'").arg(filePath)); - return; - } - - japiLocation = Location(filePath); - QXmlInputSource xmlSource(&file); - reader.parse(xmlSource); -} - -void JambiApiParser::doneParsingSourceFiles(Tree * /* tree */) -{ - /* - Also import the overview documents. - */ - foreach (Node *cppNode, cppTre->root()->childNodes()) { - if (cppNode->type() == Node::Fake) { - FakeNode *cppFake = static_cast(cppNode); - if (cppFake->subType() == Node::Page) { - FakeNode *javaFake = new FakeNode(javaTre->root(), - cppFake->name(), - cppFake->subType()); - javaFake->setModuleName("com.trolltech.qt"); // ### hard-coded - javaFake->setTitle(cppFake->title()); - javaFake->setSubTitle(cppFake->subTitle()); - setStatus(javaFake, cppFake); - setPass1JambifiedDoc(javaFake, cppFake); - } - } - } - - /* - Fix the docs. - */ - if (javaTre) { - javaTre->resolveInheritance(); - jambifyDocsPass2(javaTre->root()); - javaTre = 0; - } -} - -bool JambiApiParser::startElement(const QString & /* namespaceURI */, - const QString & /* localName */, - const QString &qName, - const QXmlAttributes &attributes) -{ - if (!metJapiTag && qName != "japi") { - // ### The file is not a JAPI file. - return true; - } - metJapiTag = true; - - EnumNode *javaEnum = 0; - EnumNode *cppEnum = 0; - InnerNode *javaParent = javaTre->root(); - InnerNode *cppParent = cppTre->root(); - - for (int i = 0; i < classAndEnumStack.count(); ++i) { - const ClassOrEnumInfo &info = classAndEnumStack.at(i); - if (info.cppNode) { - if (info.cppNode->type() == Node::Enum) { - Q_ASSERT(info.javaNode->type() == Node::Enum); - javaEnum = static_cast(info.javaNode); - cppEnum = static_cast(info.cppNode); - } else { - Q_ASSERT(info.javaNode->type() == Node::Class - || info.javaNode->type() == Node::Namespace); - javaParent = static_cast(info.javaNode); - cppParent = static_cast(info.cppNode); - } - } - } - - if (qName == "class" || qName == "enum") { - Node::Type type = (qName == "class") ? Node::Class : Node::Enum; - - QString javaExtends = attributes.value("java-extends"); - QString javaImplements = attributes.value("javaimplements"); - - ClassOrEnumInfo info; - info.tag = qName; - info.javaName = attributes.value("java"); - info.cppName = attributes.value("cpp"); - info.cppNode = cppTre->findNode(info.cppName.split("::"), type, cppParent); - if (!info.cppNode && type == Node::Class) { - type = Node::Namespace; - info.cppNode = cppTre->findNode(info.cppName.split("::"), type, cppParent); - } - - if (!info.cppNode) { - japiLocation.warning(tr("Cannot find C++ class or enum '%1'").arg(info.cppName)); - } else { - if (qName == "class") { - ClassNode *javaClass = new ClassNode(javaParent, info.javaName); - javaClass->setModuleName(attributes.value("package")); - if (!javaExtends.isEmpty()) - javaTre->addBaseClass(javaClass, Node::Public, javaExtends.split('.'), - javaExtends); - if (!javaImplements.isEmpty()) - javaTre->addBaseClass(javaClass, Node::Public, javaImplements.split('.'), - javaExtends); - - info.javaNode = javaClass; - } else { - info.javaNode = new EnumNode(javaParent, info.javaName); - } - info.javaNode->setLocation(japiLocation); - setStatus(info.javaNode, info.cppNode); - - setPass1JambifiedDoc(info.javaNode, info.cppNode); - } - classAndEnumStack.push(info); - } else if (qName == "method" || qName == "signal") { - QString javaSignature = attributes.value("java"); - if (javaSignature.startsWith("private")) - return true; - - QString cppSignature = attributes.value("cpp"); - - CppCodeParser cppParser; - const FunctionNode *cppNode = cppParser.findFunctionNode(cppSignature, cppTre, - cppParent, - true /* fuzzy */); - if (!cppNode) { - bool quiet = false; - - /* - Default constructors sometimes don't exist in C++. - */ - if (!quiet && javaSignature == "public " + javaParent->name() + "()") - quiet = true; - - if (!quiet) - japiLocation.warning(tr("Cannot find C++ function '%1' ('%2')") - .arg(cppSignature).arg(cppParent->name())); - } - - FunctionNode *javaNode; - if (makeFunctionNode(javaParent, javaSignature, &javaNode)) { - javaNode->setLocation(japiLocation); - if (qName == "signal") - javaNode->setMetaness(FunctionNode::Signal); - - if (cppNode) { - setStatus(javaNode, cppNode); - - int overloadNo = cppNode->parameters().count() - javaNode->parameters().count() + 1; - if (overloadNo == 1) { - setPass1JambifiedDoc(javaNode, cppNode); - } else { - Text text; - - text << Atom::ParaLeft << "Equivalent to " - << Atom(Atom::Link, javaNode->name() + "()") - << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK) - << javaNode->name() - << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK) - << "("; - - for (int i = 0; i < cppNode->parameters().count(); ++i) { - if (i > 0) - text << ", "; - if (i < javaNode->parameters().count()) { - text << Atom(Atom::FormattingLeft, ATOM_FORMATTING_PARAMETER) - << javaNode->parameters().at(i).name() - << Atom(Atom::FormattingRight, ATOM_FORMATTING_PARAMETER); - } else { - // ### convert to Java - text << cppNode->parameters().at(i).defaultValue(); - } - } - - text << ")."; - - Doc doc; - doc.setBody(text); - javaNode->setDoc(doc, true); - } - javaNode->setOverload(overloadNo > 1); - } - } - } else if (qName == "variablesetter" || qName == "variablegetter") { - QString javaSignature = attributes.value("java"); - if (javaSignature.startsWith("private")) - return true; - - QString cppVariable = attributes.value("cpp"); - - VariableNode *cppNode = static_cast(cppParent->findNode(cppVariable, - Node::Variable)); - FunctionNode *javaNode; - if (makeFunctionNode(javaParent, javaSignature, &javaNode)) { - javaNode->setLocation(japiLocation); - - if (!cppNode) { -#if 0 - japiLocation.warning(tr("Cannot find C++ variable '%1' ('%2')") - .arg(cppVariable).arg(cppParent->name())); -#endif - javaNode->setDoc(Doc(japiLocation, japiLocation, - USED_INTERNALLY, - QSet()), true); - } else { - setPass1JambifiedDoc(javaNode, cppNode, qName); - setStatus(javaNode, cppNode); - } - } - } else if (qName == "enum-value") { - QString javaName = attributes.value("java"); - QString cppName = attributes.value("cpp"); - QString value = attributes.value("value"); - - if (javaEnum) { - EnumItem item(javaName, value, findEnumText(javaEnum, javaName)); - javaEnum->addItem(item); - } - } - - return true; -} - -bool JambiApiParser::endElement(const QString & /* namespaceURI */, - const QString & /* localName */, - const QString &qName) -{ - if (qName == "class" || qName == "enum") - classAndEnumStack.pop(); - return true; -} - -bool JambiApiParser::fatalError(const QXmlParseException &exception) -{ - japiLocation.setLineNo(exception.lineNumber()); - japiLocation.setColumnNo(exception.columnNumber()); - japiLocation.warning(tr("Syntax error in JAPI file (%1)").arg(exception.message())); - return true; -} - -void JambiApiParser::jambifyDocsPass2(Node *node) -{ - const Doc &doc = node->doc(); - if (!doc.isEmpty()) { - if (node->type() == Node::Enum) { - Doc newDoc(doc); - newDoc.simplifyEnumDoc(); - node->setDoc(newDoc, true); - } - } - - if (node->isInnerNode()) { - InnerNode *innerNode = static_cast(node); - foreach (Node *child, innerNode->childNodes()) - jambifyDocsPass2(child); - } -} - -bool JambiApiParser::makeFunctionNode(InnerNode *parent, const QString &synopsis, - FunctionNode **funcPtr) -{ - Node::Access access = Node::Public; - FunctionNode::Metaness metaness = FunctionNode::Plain; - bool final = false; - bool statique = false; - - QString mySynopsis = synopsis.simplified(); - int oldLen; - do { - oldLen = mySynopsis.length(); - - if (mySynopsis.startsWith("public ")) { - mySynopsis.remove(0, 7); - access = Node::Public; - } - if (mySynopsis.startsWith("protected ")) { - mySynopsis.remove(0, 10); - access = Node::Protected; - } - if (mySynopsis.startsWith("private ")) { - mySynopsis.remove(0, 8); - access = Node::Private; - } - if (mySynopsis.startsWith("native ")) { - mySynopsis.remove(0, 7); - metaness = FunctionNode::Native; - } - if (mySynopsis.startsWith("final ")) { - mySynopsis.remove(0, 6); - final = true; - } - if (mySynopsis.startsWith("static ")) { - mySynopsis.remove(0, 7); - statique = true; - } - } while (oldLen != mySynopsis.length()); - - // method or constructor - QRegExp funcRegExp("(?:(.*) )?([A-Za-z_0-9]+)\\((.*)\\)"); - if (!funcRegExp.exactMatch(mySynopsis)) - return false; - - QString retType = funcRegExp.cap(1); - QString funcName = funcRegExp.cap(2); - QStringList params = funcRegExp.cap(3).split(","); - - FunctionNode *func = new FunctionNode(parent, funcName); - func->setReturnType(retType); - func->setAccess(access); - func->setStatic(statique); - func->setConst(final); - func->setMetaness(metaness); - - QRegExp paramRegExp(" ?([^ ].*) ([A-Za-z_0-9]+) ?"); - - foreach (const QString ¶m, params) { - if (paramRegExp.exactMatch(param)) { - func->addParameter(Parameter(paramRegExp.cap(1), "", paramRegExp.cap(2))); - } else { - // problem - } - } - - if (funcPtr) { - *funcPtr = func; - } else if (!parent) { - delete func; - } - return true; -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/jambiapiparser.h b/tools/qdoc3/jambiapiparser.h deleted file mode 100644 index ecfaab5..0000000 --- a/tools/qdoc3/jambiapiparser.h +++ /dev/null @@ -1,99 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - jambiapiparser.h -*/ - -#ifndef JAMBIAPIPARSER_H -#define JAMBIAPIPARSER_H - -#include -#include - -#include "codeparser.h" - -QT_BEGIN_NAMESPACE - -struct ClassOrEnumInfo -{ - QString tag; - QString javaName; - QString cppName; - Node *javaNode; - Node *cppNode; - - ClassOrEnumInfo() : javaNode(0), cppNode(0) {} -}; - -class JambiApiParser : public CodeParser, private QXmlDefaultHandler -{ -public: - JambiApiParser(Tree *cppTree); - ~JambiApiParser(); - - void initializeParser(const Config &config); - void terminateParser(); - QString language(); - QString sourceFileNameFilter(); - void parseSourceFile(const Location &location, const QString &filePath, Tree *tree); - virtual void doneParsingSourceFiles(Tree *tree); - -private: - bool startElement(const QString &namespaceURI, const QString &localName, - const QString &qName, const QXmlAttributes &attributes); - bool endElement(const QString &namespaceURI, const QString &localName, - const QString &qName); - bool fatalError(const QXmlParseException &exception); - void jambifyDocsPass2(Node *node); - bool makeFunctionNode(InnerNode *parent, const QString &synopsis, FunctionNode **funcPtr); - - Tree *cppTre; - Tree *javaTre; - - bool metJapiTag; - Location japiLocation; - QStack classAndEnumStack; -}; - -QT_END_NAMESPACE - -#endif diff --git a/tools/qdoc3/javacodemarker.cpp b/tools/qdoc3/javacodemarker.cpp deleted file mode 100644 index c9a8f60..0000000 --- a/tools/qdoc3/javacodemarker.cpp +++ /dev/null @@ -1,203 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - javacodemarker.cpp -*/ - -#include "javacodemarker.h" -#include "node.h" -#include "text.h" -#include "tree.h" - -QT_BEGIN_NAMESPACE - -JavaCodeMarker::JavaCodeMarker() -{ -} - -JavaCodeMarker::~JavaCodeMarker() -{ -} - -bool JavaCodeMarker::recognizeCode( const QString& /* code */ ) -{ - return true; -} - -bool JavaCodeMarker::recognizeExtension( const QString& ext ) -{ - return ext == "java"; -} - -bool JavaCodeMarker::recognizeLanguage( const QString& lang ) -{ - return lang == "Java"; -} - -QString JavaCodeMarker::plainName( const Node *node ) -{ - return node->name(); -} - -QString JavaCodeMarker::plainFullName( const Node *node, const Node * /* relative */ ) -{ - if (!node) - return QString(); - - QString fullName; - for ( ;; ) { - fullName.prepend( plainName(node) ); - if ( node->parent() && node->parent()->name().isEmpty() ) - break; - node = node->parent(); - if (!node) - break; - fullName.prepend("."); - } - return fullName; -} - -QString JavaCodeMarker::markedUpCode( const QString& code, - const Node * /* relative */, - const QString& /* dirPath */ ) -{ - return protect( code ); -} - -QString JavaCodeMarker::markedUpSynopsis(const Node * /* node */, - const Node * /* relative */, - SynopsisStyle /* style */) -{ - return QString(); -} - -QString JavaCodeMarker::markedUpName( const Node *node ) -{ - return linkTag(node, taggedNode(node)); -} - -QString JavaCodeMarker::markedUpFullName(const Node *node, const Node * /* relative */ ) -{ - QString fullName; - for ( ;; ) { - fullName.prepend( markedUpName(node) ); - if ( node->parent()->name().isEmpty() ) - break; - node = node->parent(); - fullName.prepend( "." ); - } - return fullName; -} - -QString JavaCodeMarker::markedUpEnumValue(const QString &enumValue, - const Node * /* relative */) -{ - return protect(enumValue); -} - -QString JavaCodeMarker::markedUpIncludes( const QStringList& /* includes */ ) -{ - return QString(); -} - -QString JavaCodeMarker::functionBeginRegExp( const QString& /* funcName */) -{ - return "^x$"; // ### invalid regexp -} - -QString JavaCodeMarker::functionEndRegExp( const QString& /* funcName */ ) -{ - return "^}"; -} - -QList
    JavaCodeMarker::sections(const InnerNode * /* inner */, SynopsisStyle /* style */, - Status /* status */) -{ - return QList
    (); -} - -const Node *JavaCodeMarker::resolveTarget(const QString &target, - const Tree *tree, - const Node *relative, - const Node* /* self */) -{ - if (target.endsWith("()")) { - const FunctionNode *func; - QString funcName = target; - funcName.chop(2); - - QStringList path = funcName.split('.'); - if ((func = tree->findFunctionNode(path, relative, Tree::SearchBaseClasses))) - return func; - } else if (target.contains("#")) { - int hashAt = target.indexOf("#"); - QString link = target.left(hashAt); - QString ref = target.mid(hashAt + 1); - const Node *node; - if (link.isEmpty()) { - node = relative; - } else { - QStringList path(link); - node = tree->findNode(path, tree->root(), Tree::SearchBaseClasses); - } - if (node && node->isInnerNode()) { - const Atom *atom = node->doc().body().firstAtom(); - while (atom) { - if (atom->type() == Atom::Target && atom->string() == ref) { - Node *parentNode = const_cast(node); - return new TargetNode(static_cast(parentNode), - ref); - } - atom = atom->next(); - } - } - } else { - QStringList path = target.split('.'); - const Node *node; - if ((node = tree->findNode(path, relative, - Tree::SearchBaseClasses | Tree::SearchEnumValues))) - return node; - } - return 0; -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/javacodemarker.h b/tools/qdoc3/javacodemarker.h deleted file mode 100644 index c2aabc0..0000000 --- a/tools/qdoc3/javacodemarker.h +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - javacodemarker.h -*/ - -#ifndef JAVACODEMARKER_H -#define JAVACODEMARKER_H - -#include "codemarker.h" - -QT_BEGIN_NAMESPACE - -class JavaCodeMarker : public CodeMarker -{ -public: - JavaCodeMarker(); - ~JavaCodeMarker(); - - bool recognizeCode( const QString& code ); - bool recognizeExtension( const QString& ext ); - bool recognizeLanguage( const QString& lang ); - QString plainName(const Node *node); - QString plainFullName(const Node *node, const Node *relative); - QString markedUpCode( const QString& code, const Node *relative, - const QString& dirPath ); - QString markedUpSynopsis( const Node *node, const Node *relative, - SynopsisStyle style ); - QString markedUpName( const Node *node ); - QString markedUpFullName( const Node *node, const Node *relative ); - QString markedUpEnumValue(const QString &enumValue, const Node *relative); - QString markedUpIncludes( const QStringList& includes ); - QList
    sections(const InnerNode *innerNode, SynopsisStyle style, Status status); - QString functionBeginRegExp( const QString& funcName ); - QString functionEndRegExp( const QString& funcName ); - const Node* resolveTarget( const QString& target, - const Tree* tree, - const Node* relative, - const Node* self = 0 ); -}; - -QT_END_NAMESPACE - -#endif diff --git a/tools/qdoc3/javadocgenerator.cpp b/tools/qdoc3/javadocgenerator.cpp deleted file mode 100644 index eb9c1c9..0000000 --- a/tools/qdoc3/javadocgenerator.cpp +++ /dev/null @@ -1,454 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "javadocgenerator.h" - -QT_BEGIN_NAMESPACE - -enum JavaSignatureSyntax { - GeneratedJdocFile, - JavadocRef, - SlotSignature -}; - -static QString javaSignature(const FunctionNode *func, JavaSignatureSyntax syntax, - int maxParams = 65535) -{ - maxParams = qMin(maxParams, func->parameters().count()); - - QString result; - - if (syntax == GeneratedJdocFile) { - if (func->access() == Node::Public) { - result += "public "; - } else if (func->access() == Node::Protected) { - result += "protected "; - } else { - result += "private "; - } - - if (func->metaness() == FunctionNode::Native) - result += "native "; - - if (func->isConst()) - result += "final "; - - // ### func->metaness() == FunctionNode::Abstract - - if (func->isStatic()) - result += "static "; - - if (!func->returnType().isEmpty()) { - result += func->returnType(); - result += ' '; - } - } - - if (syntax == SlotSignature) { - result += "void mySlot"; - } else { - result += func->name(); - } - result += '('; - for (int i = 0; i < maxParams; ++i) { - if (i != 0) - result += ", "; - result += func->parameters().at(i).leftType(); - if (syntax != JavadocRef) { - result += ' '; - result += func->parameters().at(i).name(); - } - } - result += ')'; - - return result; -} - -static QString packageName(const Node *node) -{ - while (node && node->type() != Node::Class && node->type() != Node::Fake) - node = node->parent(); - if (!node) - return QString(); - return node->moduleName(); -} - -JavadocGenerator::JavadocGenerator() - : oldDevice(0), currentDepth(0) -{ -} - -JavadocGenerator::~JavadocGenerator() -{ -} - -void JavadocGenerator::initializeGenerator(const Config &config) -{ - HtmlGenerator::initializeGenerator(config); - - formattingLeftMap().insert(ATOM_FORMATTING_PARAMETER, - formattingLeftMap().value(ATOM_FORMATTING_TELETYPE)); - formattingRightMap().insert(ATOM_FORMATTING_PARAMETER, - formattingRightMap().value(ATOM_FORMATTING_TELETYPE)); -} - -void JavadocGenerator::terminateGenerator() -{ - HtmlGenerator::terminateGenerator(); -} - -QString JavadocGenerator::format() -{ - return "javadoc"; -} - -void JavadocGenerator::generateTree(const Tree *tree, CodeMarker *marker) -{ - HtmlGenerator::generateTree(tree, marker); -} - -QString JavadocGenerator::fileExtension(const Node *node) const -{ - if (node->type() == Node::Fake) { - return "html"; - } else { - return "jdoc"; - } -} - -QString JavadocGenerator::typeString(const Node *node) -{ - if (node->type() == Node::Function) { - const FunctionNode *func = static_cast(node); - return func->metaness() == FunctionNode::Signal ? "signal" : "method"; - } else { - return HtmlGenerator::typeString(node); - } -} - -QString JavadocGenerator::imageFileName(const Node *relative, const QString& fileBase) -{ - QString result = HtmlGenerator::imageFileName(relative, fileBase); - if (!result.isEmpty()) { - QString package = packageName(relative); - int numSubPackages = package.count('.') - 2; - while (numSubPackages > 0) { - result.prepend("%2E%2E/"); // javadoc 1.5.0_06 chokes on '../' - --numSubPackages; - } - } - return result; -} - -static int textDepth = 0; - -void JavadocGenerator::startText(const Node *relative, CodeMarker *marker) -{ - if (textDepth++ == 0 && relative->type() != Node::Fake) { - Q_ASSERT(!oldDevice); - oldDevice = out().device(); - Q_ASSERT(oldDevice); - out().setString(&buffer); - } - HtmlGenerator::startText(relative, marker); -} - -void JavadocGenerator::endText(const Node *relative, CodeMarker *marker) -{ - HtmlGenerator::endText(relative, marker); - if (--textDepth == 0 && relative->type() != Node::Fake) { - Q_ASSERT(oldDevice); - out().setDevice(oldDevice); - oldDevice = 0; - - /* - Need to escape XML metacharacters in .jdoc files. - */ - buffer.replace("*/", "*<!-- noop -->/"); - buffer.replace("&", "&"); - buffer.replace("\"", """); - buffer.replace("<", "<"); - buffer.replace(">", ">"); - out() << buffer; - buffer.clear(); - } -} - -int JavadocGenerator::generateAtom(const Atom *atom, const Node *relative, CodeMarker *marker) -{ - return HtmlGenerator::generateAtom(atom, relative, marker); -} - -void JavadocGenerator::generateClassLikeNode(const InnerNode *inner, CodeMarker *marker) -{ - generateIndent(); - out() << "name()) << "\""; - generateDoc(inner, marker); - out() << ">\n"; - - ++currentDepth; - foreach (Node *node, inner->childNodes()) { - if (node->isInnerNode()) { - generateClassLikeNode(static_cast(node), marker); - } else { - if (node->type() == Node::Enum) { - EnumNode *enume = static_cast(node); - - generateIndent(); - out() << "name()) << "\""; - generateDoc(node, marker); - out() << ">\n"; - - ++currentDepth; - const QList &items = enume->items(); - for (int i = 0; i < items.count(); ++i) { - const EnumItem &item = items.at(i); - generateIndent(); - out() << "\n"; - } - --currentDepth; - - out() << "\n"; - } else if (node->type() == Node::Function) { - FunctionNode *func = static_cast(node); - generateIndent(); - out() << (func->metaness() == FunctionNode::Signal ? "\n"; - } - } - } - --currentDepth; - - generateIndent(); - out() << "\n"; -} - -void JavadocGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) -{ - HtmlGenerator::generateFakeNode(fake, marker); -} - -bool JavadocGenerator::generateText(const Text& text, const Node *relative, CodeMarker *marker) -{ - HtmlGenerator::generateText(text, relative, marker); - return true; -} - -void JavadocGenerator::generateBody(const Node *node, CodeMarker *marker) -{ - generateText(node->doc().body(), node, marker); -} - -void JavadocGenerator::generateAlsoList( const Node *node, CodeMarker *marker ) -{ - QList alsoList = node->doc().alsoList(); - supplementAlsoList(node, alsoList); - - if (node->type() == Node::Fake - || (node->type() == Node::Function - && static_cast(node)->metaness() == FunctionNode::Signal)) { - Text text; - - if (!alsoList.isEmpty()) { - text << Atom(Atom::ListLeft, ATOM_LIST_TAG) - << Atom(Atom::ListTagLeft, ATOM_LIST_TAG) - << Atom(Atom::FormattingLeft, ATOM_FORMATTING_BOLD) - << "See Also:" - << Atom(Atom::FormattingRight, ATOM_FORMATTING_BOLD) - << Atom(Atom::ListTagRight, ATOM_LIST_TAG) - << Atom(Atom::ListItemLeft, ATOM_LIST_TAG); - - for (int i = 0; i < alsoList.count(); ++i) { - if (i != 0) - text << ", "; - text << alsoList.at(i); - } - text << Atom(Atom::ListItemRight, ATOM_LIST_TAG) - << Atom(Atom::ListRight, ATOM_LIST_TAG); - } - - generateText(text, node, marker); - } else { - foreach (const Text &text, alsoList) { - out() << "\n@see "; - generateText(text, node, marker); - } - } -} - -QString JavadocGenerator::refForNode( const Node *node ) -{ - if (node->type() == Node::Function) - return javaSignature(static_cast(node), JavadocRef); - - return HtmlGenerator::refForNode(node); -} - -QString JavadocGenerator::linkForNode( const Node *node, const Node *relative ) -{ - // ### EVIL, relative should never be null - if (!relative) - relative = node; - - if (packageName(node).isEmpty()) { - // ### jasmin: Fixme - return QString(); - } - - QString result; - if (node->type() == Node::Fake) { - result = node->name(); - } else { - if (!node->isInnerNode()) { - result = linkForNode(node->parent(), relative) + "#" + refForNode(node); - } else { - result = node->name() + ".html"; - } - } - - QStringList nodePackage = packageName(node).split("."); - QStringList relativePackage = packageName(relative).split("."); - if (nodePackage == QStringList(QString()) || relativePackage == QStringList(QString())) { - qWarning("I'm in trouble [%s][%s]", qPrintable(node->name()), qPrintable(relative->name())); - return QString(); - } - - int i = nodePackage.count() - 1; - while (nodePackage.value(i) != relativePackage.value(i)) { - result.prepend(nodePackage.at(i) + "/"); - --i; - } - - ++i; - while (i < relativePackage.count()) { - result.prepend("%2E%2E/"); // javadoc 1.5.0_06 chokes on '../' - ++i; - } - - return result; -} - -QString JavadocGenerator::refForAtom(Atom *atom, const Node *node) -{ - return HtmlGenerator::refForAtom(atom, node); -} - -/* - Neutralize dumb functions called from HtmlGenerator. -*/ -void JavadocGenerator::generateDcf(const QString & /* fileBase */, const QString & /* startPage */, - const QString & /* title */, DcfSection & /* dcfRoot */) -{ -} - -void JavadocGenerator::generateIndex(const QString & /* fileBase */, const QString & /* url */, - const QString & /* title */) -{ -} - -void JavadocGenerator::generateIndent() -{ - for (int i = 0; i < currentDepth; ++i) - out() << " "; -} - -void JavadocGenerator::generateDoc(const Node *node, CodeMarker *marker) -{ - const Text &text = node->doc().body(); - if (!text.isEmpty()) { - out() << " doc=\"/**\n"; - Generator::generateStatus(node, marker); - generateText(text, node, marker); - if (node && node->type() == Node::Function) { - const FunctionNode *func = static_cast(node); - if (func->metaness() == FunctionNode::Signal) { - QStringList slotSignatures; - for (int i = func->parameters().count(); i >= 0; --i) - slotSignatures += javaSignature(func, SlotSignature, i); - - Text text; - - text << Atom(Atom::ListLeft, ATOM_LIST_TAG) - << Atom(Atom::ListTagLeft, ATOM_LIST_TAG) - << Atom(Atom::FormattingLeft, ATOM_FORMATTING_BOLD); - - if (slotSignatures.count() == 1) { - text << "Compatible Slot Signature:"; - } else { - text << "Compatible Slot Signatures:"; - } - - text << Atom(Atom::FormattingRight, ATOM_FORMATTING_BOLD) - << Atom(Atom::ListTagRight, ATOM_LIST_TAG); - - for (int i = 0; i < slotSignatures.count(); ++i) { - text << Atom(Atom::ListItemLeft, ATOM_LIST_TAG) - << Atom(Atom::C, marker->markedUpCode(slotSignatures.at(i), 0, "")) - << Atom(Atom::ListItemRight, ATOM_LIST_TAG); - } - text << Atom(Atom::ListRight, ATOM_LIST_TAG); - generateText(text, node, marker); - } - } - if (node) - generateAlsoList(node, marker); - out() << " */\""; - } -} - -void JavadocGenerator::generateEnumItemDoc(const Text &text, const Node *node, CodeMarker *marker) -{ - out() << " doc=\"/**\n"; - if (text.isEmpty()) { - out() << "Internal."; - } else { - generateText(text, node, marker); - } - out() << " */\""; -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/javadocgenerator.h b/tools/qdoc3/javadocgenerator.h deleted file mode 100644 index b485502..0000000 --- a/tools/qdoc3/javadocgenerator.h +++ /dev/null @@ -1,95 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef JAVADOCGENERATOR_H -#define JAVADOCGENERATOR_H - -#include "htmlgenerator.h" - -QT_BEGIN_NAMESPACE - -class JavadocGenerator : public HtmlGenerator -{ -public: - JavadocGenerator(); - ~JavadocGenerator(); - - void initializeGenerator(const Config &config); - void terminateGenerator(); - QString format(); - bool canHandleFormat(const QString &format) { return format == "HTML" || format == "javadoc"; } - void generateTree(const Tree *tree, CodeMarker *marker); - QString typeString(const Node *node); - QString imageFileName(const Node *relative, const QString &fileBase); - -protected: - QString fileExtension(const Node *node) const; - void startText( const Node *relative, CodeMarker *marker ); - void endText( const Node *relative, CodeMarker *marker ); - int generateAtom( const Atom *atom, const Node *relative, CodeMarker *marker ); - void generateClassLikeNode(const InnerNode *inner, CodeMarker *marker); - void generateFakeNode( const FakeNode *fake, CodeMarker *marker ); - - bool generateText( const Text& text, const Node *relative, CodeMarker *marker ); - void generateBody( const Node *node, CodeMarker *marker ); - void generateAlsoList( const Node *node, CodeMarker *marker ); - - QString refForNode( const Node *node ); - QString linkForNode( const Node *node, const Node *relative ); - QString refForAtom(Atom *atom, const Node *node); - -private: - void generateDcf(const QString &fileBase, const QString &startPage, - const QString &title, DcfSection &dcfRoot); - void generateIndex(const QString &fileBase, const QString &url, - const QString &title); - void generateIndent(); - void generateDoc(const Node *node, CodeMarker *marker); - void generateEnumItemDoc(const Text &text, const Node *node, CodeMarker *marker); - - QString buffer; - QIODevice *oldDevice; - int currentDepth; -}; - -QT_END_NAMESPACE - -#endif diff --git a/tools/qdoc3/linguistgenerator.cpp b/tools/qdoc3/linguistgenerator.cpp deleted file mode 100644 index 702f0fb..0000000 --- a/tools/qdoc3/linguistgenerator.cpp +++ /dev/null @@ -1,245 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - linguistgenerator.cpp -*/ - -#include "codemarker.h" -#include "pagegenerator.h" -#include "linguistgenerator.h" -#include "node.h" -#include "separator.h" -#include "tree.h" -#include - -#include -#include - -QT_BEGIN_NAMESPACE - -#define COMMAND_VERSION Doc::alias("version") - -LinguistGenerator::LinguistGenerator() - : PageGenerator() -{ -} - -LinguistGenerator::~LinguistGenerator() -{ -} - -void LinguistGenerator::initializeGenerator(const Config &config) -{ - Generator::initializeGenerator(config); -} - -void LinguistGenerator::terminateGenerator() -{ - PageGenerator::terminateGenerator(); -} - -QString LinguistGenerator::format() -{ - return "Linguist"; -} - -QString LinguistGenerator::fileExtension(const Node * /* node */) const -{ - return "ts"; -} - -void LinguistGenerator::generateClassLikeNode(const InnerNode *inner, CodeMarker *marker) -{ - out().setCodec("UTF-8"); - - QDomDocument document("TS"); - QDomElement documentElement = document.createElement("TS"); - documentElement.setAttribute("version", "1.1"); - - QList contextElements = generateIndexSections(document, inner, marker); - foreach (const QDomElement &element, contextElements) - documentElement.appendChild(element); - - QDomProcessingInstruction process = document.createProcessingInstruction( - "xml", QString("version=\"1.0\" encoding=\"%1\"").arg("UTF-8")); - document.appendChild(process); - document.appendChild(documentElement); - - out() << document; - out().flush(); -} - -void LinguistGenerator::generateFakeNode( const FakeNode *fake, CodeMarker *marker ) -{ - out().setCodec("utf-8"); - - QDomDocument document("TS"); - QDomElement documentElement = document.createElement("TS"); - documentElement.setAttribute("version", "1.1"); - - QList contextElements = generateIndexSections(document, fake, marker); - foreach (const QDomElement &element, contextElements) - documentElement.appendChild(element); - - QDomProcessingInstruction process = document.createProcessingInstruction( - "xml", QString("version=\"1.0\" encoding=\"%1\"").arg("utf-8")); - document.appendChild(process); - document.appendChild(documentElement); - - out() << document; - out().flush(); -} - -QList LinguistGenerator::generateIndexSections( - QDomDocument &document, const Node *node, CodeMarker *marker) -{ - QList contexts; - - if (node->isInnerNode()) { - const InnerNode *inner = static_cast(node); - - foreach (const Node *child, inner->childNodes()) { - // Recurse to generate a DOM element for this child node and all - // its children. - contexts += generateIndexSections(document, child, marker); - } -/* - foreach (const Node *child, inner->relatedNodes()) { - QDomElement childElement = generateIndexSections(document, child, marker); - element.appendChild(childElement); - } -*/ - } - - // Add documentation to this node if it exists. - if (!node->doc().isEmpty()) { - - QString nodeName = fullName(node); - QString signature; - - if (node->type() == Node::Function) { - QStringList pieces; - const FunctionNode *functionNode = static_cast(node); - foreach (const Parameter ¶meter, functionNode->parameters()) { - QString typeString = parameter.leftType() + parameter.rightType(); - if (typeString.split(" ").size() > 1) - pieces.append(typeString + parameter.name()); - else - pieces.append(typeString + " " + parameter.name()); - } - signature = "(" + pieces.join(", ") + ")"; - } - - QDomElement contextElement = document.createElement("context"); - QDomElement nameElement = document.createElement("name"); - nameElement.appendChild(document.createTextNode(nodeName + signature)); - contextElement.appendChild(nameElement); - - QDomElement messageElement = document.createElement("message"); - contextElement.appendChild(messageElement); - - QDomElement sourceElement = document.createElement("source"); - QString sourceText = simplified(node->doc().source()); - if (!signature.isEmpty() && signature != "()" && !sourceText.contains("\\fn")) - sourceText.prepend(QString("\\fn %1%2\n").arg(nodeName).arg(signature)); - sourceElement.appendChild(document.createTextNode(sourceText)); - messageElement.appendChild(sourceElement); - - QDomElement translationElement = document.createElement("translation"); - translationElement.setAttribute("type", "unfinished"); - messageElement.appendChild(translationElement); - - QDomElement locationElement = document.createElement("location"); - locationElement.setAttribute("filename", node->doc().location().filePath()); - locationElement.setAttribute("line", node->doc().location().lineNo()); - messageElement.appendChild(locationElement); - - contexts.append(contextElement); - } - - return contexts; -} - -QString LinguistGenerator::fullName(const Node *node) const -{ - if (!node) - return ""; - else if (node->parent() && !node->parent()->name().isEmpty()) - return fullName(node->parent()) + "::" + node->name(); - else - return node->name(); -} - -QString LinguistGenerator::simplified(const QString &text) const -{ - QStringList lines = text.split("\n"); - - while (lines.size() > 0 && lines.first().trimmed().isEmpty()) - lines.pop_front(); - - while (lines.size() > 0 && lines.last().trimmed().isEmpty()) - lines.pop_back(); - - int min = 0; - bool set = false; - foreach (const QString &line, lines) { - int j = 0; - while (j < line.length()) { - if (line[j] != ' ') - break; - ++j; - } - if (j < line.length()) { - if (!set) { - min = j; - set = true; - } else - min = qMin(min, j); - } - } - for (int i = 0; i < lines.size(); ++i) - lines[i] = lines[i].mid(min); - - return lines.join("\n"); -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/linguistgenerator.h b/tools/qdoc3/linguistgenerator.h deleted file mode 100644 index 979db02..0000000 --- a/tools/qdoc3/linguistgenerator.h +++ /dev/null @@ -1,85 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - LinguistGenerator.h -*/ - -#ifndef LINGUISTGENERATOR_H -#define LINGUISTGENERATOR_H - -#include -#include -#include - -#include "codemarker.h" -#include "config.h" -#include "pagegenerator.h" - -QT_BEGIN_NAMESPACE - -class LinguistGenerator : public PageGenerator -{ -public: - LinguistGenerator(); - ~LinguistGenerator(); - - virtual void initializeGenerator( const Config& config ); - virtual void terminateGenerator(); - virtual QString format(); - -protected: - virtual void generateClassLikeNode(const InnerNode *inner, - CodeMarker *marker); - virtual void generateFakeNode( const FakeNode *fake, CodeMarker *marker ); - virtual QString fileExtension(const Node *node) const; - - QList generateIndexSections(QDomDocument &document, - const Node *node, CodeMarker *marker); - virtual QString fullName(const Node *node) const; - -private: - QString simplified(const QString &text) const; -}; - -QT_END_NAMESPACE - -#endif diff --git a/tools/qdoc3/loutgenerator.cpp b/tools/qdoc3/loutgenerator.cpp deleted file mode 100644 index caf98e8..0000000 --- a/tools/qdoc3/loutgenerator.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - loutgenerator.cpp -*/ - -#include "loutgenerator.h" - -QT_BEGIN_NAMESPACE - -LoutGenerator::LoutGenerator() -{ -} - -LoutGenerator::~LoutGenerator() -{ -} - -QString LoutGenerator::format() -{ - return "lout"; -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/loutgenerator.h b/tools/qdoc3/loutgenerator.h deleted file mode 100644 index 484d38f..0000000 --- a/tools/qdoc3/loutgenerator.h +++ /dev/null @@ -1,67 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - loutgenerator.h -*/ - -#ifndef LOUTGENERATOR_H -#define LOUTGENERATOR_H - -#include "bookgenerator.h" - -QT_BEGIN_NAMESPACE - -class LoutGenerator : public BookGenerator -{ -public: - LoutGenerator(); - ~LoutGenerator(); - - virtual QString format(); - -protected: - // ### -}; - -QT_END_NAMESPACE - -#endif diff --git a/tools/qdoc3/main.cpp b/tools/qdoc3/main.cpp index 85b23e9..7459e40 100644 --- a/tools/qdoc3/main.cpp +++ b/tools/qdoc3/main.cpp @@ -51,22 +51,11 @@ #include "config.h" #include "cppcodemarker.h" #include "cppcodeparser.h" -#include "cpptoqsconverter.h" #include "doc.h" #include "htmlgenerator.h" -#include "jambiapiparser.h" -#include "javacodemarker.h" -#include "javadocgenerator.h" -#include "linguistgenerator.h" -#include "loutgenerator.h" -#include "mangenerator.h" #include "plaincodemarker.h" #include "polyarchiveextractor.h" #include "polyuncompressor.h" -#include "qsakernelparser.h" -#include "qscodemarker.h" -#include "qscodeparser.h" -#include "sgmlgenerator.h" #include "webxmlgenerator.h" #include "ditaxmlgenerator.h" #include "tokenizer.h" @@ -210,7 +199,6 @@ static void processQdocconfFile(const QString &fileName) Location::initialize(config); Tokenizer::initialize(config); Doc::initialize(config); - CppToQsConverter::initialize(config); CodeMarker::initialize(config); CodeParser::initialize(config); Generator::initialize(config); @@ -355,7 +343,6 @@ static void processQdocconfFile(const QString &fileName) Generator::terminate(); CodeParser::terminate(); CodeMarker::terminate(); - CppToQsConverter::terminate(); Doc::terminate(); Tokenizer::terminate(); Location::terminate(); @@ -408,25 +395,14 @@ int main(int argc, char **argv) CppCodeParser cppParser; Tree *cppTree = treeForLanguage(cppParser.language()); - QsCodeParser qsParser(cppTree); - QsaKernelParser qsaKernelParser(cppTree); - JambiApiParser jambiParser(cppTree); - /* - Create code markers for plain text, C++, Java, and qs. + Create code markers for plain text and C++. */ PlainCodeMarker plainMarker; CppCodeMarker cppMarker; - JavaCodeMarker javaMarker; - QsCodeMarker qsMarker; ApiGenerator apiGenerator; HtmlGenerator htmlGenerator; - JavadocGenerator javadocGenerator; - LinguistGenerator linguistGenerator; - LoutGenerator loutGenerator; - ManGenerator manGenerator; - SgmlGenerator smglGenerator; WebXMLGenerator webxmlGenerator; DitaXmlGenerator ditaxmlGenerator; diff --git a/tools/qdoc3/mangenerator.cpp b/tools/qdoc3/mangenerator.cpp deleted file mode 100644 index 1e85b73..0000000 --- a/tools/qdoc3/mangenerator.cpp +++ /dev/null @@ -1,228 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - mangenerator.cpp -*/ - -#include -#include - -#include "mangenerator.h" -#include "node.h" -#include "tree.h" - -QT_BEGIN_NAMESPACE - -ManGenerator::ManGenerator() -{ - date = QDate::currentDate().toString( "d MMMM yyyy" ); -} - -ManGenerator::~ManGenerator() -{ -} - -QString ManGenerator::format() -{ - return "man"; -} - -int ManGenerator::generateAtom( const Atom *atom, const Node * /* relative */, - CodeMarker * /* marker */ ) -{ -#if 0 - switch ( atom->type() ) { - case Atom::AbstractBegin: - break; - case Atom::AbstractEnd: - break; - case Atom::Alias: - break; - case Atom::AliasArg: - break; - case Atom::BaseName: - break; - case Atom::BriefBegin: - break; - case Atom::BriefEnd: - break; - case Atom::C: - break; - case Atom::CaptionBegin: - break; - case Atom::CaptionEnd: - break; - case Atom::CitationBegin: - break; - case Atom::CitationEnd: - break; - case Atom::Code: - break; - case Atom::FootnoteBegin: - break; - case Atom::FootnoteEnd: - break; - case Atom::FormatBegin: - break; - case Atom::FormatEnd: - break; - case Atom::GeneratedList: - break; - case Atom::Image: - break; - case Atom::ImageText: - break; - case Atom::Link: - break; - case Atom::LinkNode: - break; - case Atom::ListBegin: - break; - case Atom::ListItemNumber: - break; - case Atom::ListItemBegin: - out() << ".IP " << atom->string() << ".\n"; - break; - case Atom::ListItemEnd: - break; - case Atom::ListEnd: - break; - case Atom::Nop: - break; - case Atom::ParaBegin: - out() << ".PP\n"; - break; - case Atom::ParaEnd: - out() << "\n"; - break; - case Atom::RawFormat: - break; - case Atom::RawString: - break; - case Atom::SectionBegin: - break; - case Atom::SectionEnd: - break; - case Atom::SectionHeadingBegin: - break; - case Atom::SectionHeadingEnd: - break; - case Atom::SidebarBegin: - break; - case Atom::SidebarEnd: - break; - case Atom::String: - out() << protectTextLine( atom->string() ); - break; - case Atom::TableBegin: - break; - case Atom::TableEnd: - break; - case Atom::TableOfContents: - break; - case Atom::Target: - break; - case Atom::UnknownCommand: - ; - } -#endif - unknownAtom( atom ); - return 0; -} - -void ManGenerator::generateClassLikeNode( const InnerNode *classe, - CodeMarker *marker ) -{ - generateHeader( classe->name() ); - out() << ".SH NAME\n" - << classe->name() << "\n" - << ".SH SYNOPSYS\n"; - generateBody( classe, marker ); - generateFooter(); -} - -void ManGenerator::generateFakeNode( const FakeNode *fake, CodeMarker *marker ) -{ - generateHeader( "foo" ); - generateBody( fake, marker ); - generateFooter(); -} - -QString ManGenerator::fileExtension(const Node * /* node */) const -{ - return "3qt"; -} - -void ManGenerator::generateHeader( const QString& name ) -{ - out() << ".TH " << protectArg( name ) - << " " << protectArg( "3qt" ) - << " " << protectArg( date ) - << " " << protectArg( "Nokia Corporation and/or its subsidiary(-ies)" ) - << " " << protectArg( "Qt Toolkit" ) << "\n"; -} - -void ManGenerator::generateFooter() -{ -} - -QString ManGenerator::protectArg( const QString& str ) -{ - for ( int i = 0; i < (int) str.length(); i++ ) { - if ( str[i] == ' ' || str[i].isSpace() ) { - QString quoted = str; - quoted.replace( "\"", "\"\"" ); - return "\"" + quoted + "\""; - } - } - return str; -} - -QString ManGenerator::protectTextLine( const QString& str ) -{ - QString t = str; - if ( t.startsWith(".") || t.startsWith("'") ) - t.prepend( "\\&" ); - return t; -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/mangenerator.h b/tools/qdoc3/mangenerator.h deleted file mode 100644 index 0fca342..0000000 --- a/tools/qdoc3/mangenerator.h +++ /dev/null @@ -1,79 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - mangenerator.h -*/ - -#ifndef MANGENERATOR_H -#define MANGENERATOR_H - -#include "pagegenerator.h" - -QT_BEGIN_NAMESPACE - -class ManGenerator : public PageGenerator -{ -public: - ManGenerator(); - ~ManGenerator(); - - virtual QString format(); - -protected: - virtual int generateAtom( const Atom *atom, const Node *relative, - CodeMarker *marker ); - virtual void generateClassLikeNode(const InnerNode *node, CodeMarker *marker); - virtual void generateFakeNode( const FakeNode *fake, CodeMarker *marker ); - virtual QString fileExtension(const Node *node) const; - -private: - void generateHeader( const QString& name ); - void generateFooter(); - QString protectArg( const QString& str ); - QString protectTextLine( const QString& str ); - - QString date; -}; - -QT_END_NAMESPACE - -#endif diff --git a/tools/qdoc3/qdoc3.pro b/tools/qdoc3/qdoc3.pro index d47e066..9b76d97 100644 --- a/tools/qdoc3/qdoc3.pro +++ b/tools/qdoc3/qdoc3.pro @@ -27,7 +27,6 @@ CONFIG -= app_bundle HEADERS += apigenerator.h \ archiveextractor.h \ atom.h \ - bookgenerator.h \ ccodeparser.h \ codechunk.h \ codemarker.h \ @@ -36,33 +35,21 @@ HEADERS += apigenerator.h \ config.h \ cppcodemarker.h \ cppcodeparser.h \ - cpptoqsconverter.h \ - dcfsection.h \ ditaxmlgenerator.h \ doc.h \ editdistance.h \ generator.h \ helpprojectwriter.h \ htmlgenerator.h \ - jambiapiparser.h \ - javacodemarker.h \ - javadocgenerator.h \ - linguistgenerator.h \ location.h \ - loutgenerator.h \ - mangenerator.h \ node.h \ openedlist.h \ pagegenerator.h \ plaincodemarker.h \ polyarchiveextractor.h \ polyuncompressor.h \ - qsakernelparser.h \ - qscodemarker.h \ - qscodeparser.h \ quoter.h \ separator.h \ - sgmlgenerator.h \ text.h \ tokenizer.h \ tr.h \ @@ -72,7 +59,6 @@ HEADERS += apigenerator.h \ SOURCES += apigenerator.cpp \ archiveextractor.cpp \ atom.cpp \ - bookgenerator.cpp \ ccodeparser.cpp \ codechunk.cpp \ codemarker.cpp \ @@ -81,21 +67,13 @@ SOURCES += apigenerator.cpp \ config.cpp \ cppcodemarker.cpp \ cppcodeparser.cpp \ - cpptoqsconverter.cpp \ - dcfsection.cpp \ ditaxmlgenerator.cpp \ doc.cpp \ editdistance.cpp \ generator.cpp \ helpprojectwriter.cpp \ htmlgenerator.cpp \ - jambiapiparser.cpp \ - javacodemarker.cpp \ - javadocgenerator.cpp \ - linguistgenerator.cpp \ location.cpp \ - loutgenerator.cpp \ - mangenerator.cpp \ main.cpp \ node.cpp \ openedlist.cpp \ @@ -103,12 +81,8 @@ SOURCES += apigenerator.cpp \ plaincodemarker.cpp \ polyarchiveextractor.cpp \ polyuncompressor.cpp \ - qsakernelparser.cpp \ - qscodemarker.cpp \ - qscodeparser.cpp \ quoter.cpp \ separator.cpp \ - sgmlgenerator.cpp \ text.cpp \ tokenizer.cpp \ tree.cpp \ diff --git a/tools/qdoc3/qsakernelparser.cpp b/tools/qdoc3/qsakernelparser.cpp deleted file mode 100644 index 8f12eda..0000000 --- a/tools/qdoc3/qsakernelparser.cpp +++ /dev/null @@ -1,186 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include - -#include "qsakernelparser.h" -#include "tokenizer.h" -#include "tree.h" - -QT_BEGIN_NAMESPACE - -QsaKernelParser::QsaKernelParser( Tree *cppTree ) - : cppTre( cppTree ) -{ -} - -QsaKernelParser::~QsaKernelParser() -{ -} - -QString QsaKernelParser::language() -{ - return "QSA Kernel C++"; -} - -QString QsaKernelParser::sourceFileNameFilter() -{ - return "*.cpp"; -} - -void QsaKernelParser::parseSourceFile( const Location& location, - const QString& filePath, - Tree * /* tree */ ) -{ - QFile in(filePath); - if (!in.open(QIODevice::ReadOnly)) { - location.error( tr("Cannot open QSA kernel file '%1'").arg(filePath) ); - return; - } - - Location fileLocation( filePath ); - Tokenizer fileTokenizer( fileLocation, in ); - tokenizer = &fileTokenizer; - readToken(); - - QString ident; - QString className; - int delimDepth = 0; - - while ( tok != Tok_Eoi ) { - if ( tok == Tok_Ident ) { - ident = tokenizer->lexeme(); - readToken(); - if ( tok == Tok_Gulbrandsen && tokenizer->braceDepth() == 0 && - tokenizer->parenDepth() == 0 ) { - className = ident; - } else if ( ident.startsWith("add") && ident.endsWith("Member") && - tok == Tok_LeftParen ) { - bool isProperty = ident.endsWith( "VariableMember" ); - bool isStatic = ident.startsWith( "addStatic" ); - bool isWritable = !isStatic; - - readToken(); - if ( tok == Tok_String ) { - QString member = tokenizer->lexeme(); - member = member.mid( 1, member.length() - 2 ); - - readToken(); - if ( tok == Tok_Comma ) - readToken(); - if ( tok == Tok_Ident && tokenizer->lexeme() == "QSMember" ) - readToken(); - if ( tok == Tok_LeftParen ) { - delimDepth++; - readToken(); - } - - while ( tok != Tok_Eoi && tok != Tok_RightParen && - tok != Tok_Semicolon ) { - if ( tok == Tok_Ident ) { - ident = tokenizer->lexeme(); - if ( ident == "Custom" ) { - isProperty = true; - } else if ( ident == "AttributeNonWritable" ) { - isWritable = false; - } else if ( ident == "AttributeStatic" ) { - isStatic = true; - } - } - readToken(); - } - - ClassNode *classe = - (ClassNode *) cppTre->findNode( QStringList(className), - Node::Class ); - if ( classe == 0 ) { - classe = new ClassNode( cppTre->root(), className ); - classe->setLocation( tokenizer->location() ); - } - - if ( isProperty ) { - PropertyNode *property = new PropertyNode(classe, member); - property->setLocation( tokenizer->location() ); - property->setDataType( "Object" ); -#if 0 - property->setGetter( member ); - if ( isWritable ) { - QString setter = member; - setter[0] = setter[0].toUpper(); - setter.prepend( "set" ); - property->setSetter( setter ); - } -#endif - } else { - FunctionNode *func = new FunctionNode( classe, member ); - func->setLocation( tokenizer->location() ); - func->setAccess( FunctionNode::Public ); - func->setMetaness( FunctionNode::Slot ); - if ( member == "toLocaleString" || - member == "toString" ) { - func->setReturnType( "QString" ); - } else if ( member == "valueOf" ) { - func->setReturnType( "Object" ); - } else { - func->setReturnType( "Object" ); - func->addParameter( Parameter("...") ); - } - func->setStatic( false ); // ### - } - } - } - } else { - readToken(); - } - } - in.close(); -} - -void QsaKernelParser::doneParsingSourceFiles( Tree * /* tree */ ) -{ -} - -void QsaKernelParser::readToken() -{ - tok = tokenizer->getToken(); -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/qsakernelparser.h b/tools/qdoc3/qsakernelparser.h deleted file mode 100644 index 9ac84fb..0000000 --- a/tools/qdoc3/qsakernelparser.h +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - qsakernelparser.h -*/ - -#ifndef QSAKERNELPARSER_H -#define QSAKERNELPARSER_H - -#include "codeparser.h" - -QT_BEGIN_NAMESPACE - -class Tokenizer; - -class QsaKernelParser : public CodeParser -{ -public: - QsaKernelParser( Tree *cppTree ); - ~QsaKernelParser(); - - virtual QString language(); - virtual QString sourceFileNameFilter(); - virtual void parseSourceFile( const Location& location, - const QString& filePath, Tree *tree ); - virtual void doneParsingSourceFiles( Tree *tree ); - -private: - void readToken(); - - Tree *cppTre; - Tokenizer *tokenizer; - int tok; -}; - -QT_END_NAMESPACE - -#endif diff --git a/tools/qdoc3/qscodemarker.cpp b/tools/qdoc3/qscodemarker.cpp deleted file mode 100644 index 2ee5d99..0000000 --- a/tools/qdoc3/qscodemarker.cpp +++ /dev/null @@ -1,378 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - qscodemarker.cpp -*/ - -#include "node.h" -#include "qscodemarker.h" - -QT_BEGIN_NAMESPACE - -QsCodeMarker::QsCodeMarker() -{ -} - -QsCodeMarker::~QsCodeMarker() -{ -} - -bool QsCodeMarker::recognizeCode( const QString& /* code */ ) -{ - return true; -} - -bool QsCodeMarker::recognizeExtension( const QString& ext ) -{ - return ext == "js" || ext == "qs"; -} - -bool QsCodeMarker::recognizeLanguage( const QString& lang ) -{ - return lang == "JavaScript" || lang == "Qt Script"; -} - -QString QsCodeMarker::plainName( const Node *node ) -{ - QString name = node->name(); - if ( node->type() == Node::Function ) - name += "()"; - return name; -} - -QString QsCodeMarker::plainFullName( const Node *node, const Node * /* relative */ ) -{ - QString fullName; - for ( ;; ) { - fullName.prepend( plainName(node) ); - if ( node->parent()->name().isEmpty() ) - break; - node = node->parent(); - fullName.prepend("."); - } - return fullName; -} - -QString QsCodeMarker::markedUpCode( const QString& code, - const Node * /* relative */, - const QString& /* dirPath */ ) -{ - return protect( code ); -} - -QString QsCodeMarker::markedUpSynopsis( const Node *node, - const Node * /* relative */, - SynopsisStyle style ) -{ - QString synopsis; - QStringList extras; - QString name; - - name = taggedNode( node ); - if ( style != Detailed ) - name = linkTag( node, name ); - name = "<@name>" + name + ""; - - if ( style == Detailed && !node->parent()->name().isEmpty() && - node->type() != Node::Enum ) - name.prepend( taggedNode(node->parent()) + "." ); - - switch ( node->type() ) { - case Node::Class: - synopsis = "class " + name; - break; - case Node::Function: - { - const FunctionNode *func = (const FunctionNode *) node; - - synopsis = name; - - if ( style == SeparateList ) { - synopsis += "()"; - } else { - synopsis += " ("; - if ( !func->parameters().isEmpty() ) { - synopsis += " "; - int numOptional = 0; - QList::ConstIterator p = func->parameters().begin(); - while ( p != func->parameters().end() ) { - if ( !(*p).defaultValue().isEmpty() ) { - if ( p == func->parameters().begin() ) { - synopsis += "[ "; - } else { - synopsis += " [ , "; - } - numOptional++; - } else { - if ( p != func->parameters().begin() ) - synopsis += ", "; - } - if ( !(*p).name().isEmpty() ) - synopsis += "<@param>" + protect( (*p).name() ) + - " : "; - synopsis += protect( (*p).leftType() ); - ++p; - } - for ( int i = 0; i < numOptional; i++ ) - synopsis += " ]"; - synopsis += " "; - } - synopsis += ")"; - } - - if ( style != SeparateList && !func->returnType().isEmpty() ) - synopsis += " : " + protect( func->returnType() ); - - if ( style == Detailed && func->metaness() == FunctionNode::Signal ) - extras << "[signal]"; - } - break; - case Node::Property: - { - const PropertyNode *property = (const PropertyNode *) node; - - synopsis = name; - if ( style != SeparateList ) - synopsis += " : " + property->dataType(); - if ( style == Detailed && property->setters().isEmpty() ) - extras << "[read only]"; - } - break; - case Node::Enum: - { - /* - The letters A to F and X (upper- and lower-case) can - appear in a hexadecimal constant (e.g. 0x3F). - */ - QRegExp letterRegExp( "[G-WYZg-wyz_]" ); - const EnumNode *enume = (const EnumNode *) node; - - synopsis = name; - if ( style == Summary && !enume->items().isEmpty() ) { - synopsis += " : "; - QString comma; - QList::ConstIterator it = enume->items().begin(); - while ( it != enume->items().end() ) { - if ( enume->itemAccess((*it).name()) == Node::Public ) { - synopsis += comma; - synopsis += (*it).name(); - if ( (*it).value().indexOf(letterRegExp) != -1 ) - synopsis += " = " + (*it).value(); - comma = ", "; - } - ++it; - } - } - } - break; - case Node::Namespace: - case Node::Typedef: - default: - synopsis = name; - } - - if ( style == Summary ) { - if ( node->status() == Node::Preliminary ) { - extras << "(preliminary)"; - } else if ( node->status() == Node::Deprecated ) { - extras << "(deprecated)"; - } else if ( node->status() == Node::Obsolete ) { - extras << "(obsolete)"; - } - } - - QString extra; - if ( !extras.isEmpty() ) - extra = "<@extra>" + extras.join(" ") + ""; - return synopsis + extra; -} - -QString QsCodeMarker::markedUpName( const Node *node ) -{ - QString name = linkTag( node, taggedNode(node) ); - if ( node->type() == Node::Function ) - name += "()"; - return name; -} - -QString QsCodeMarker::markedUpFullName( const Node *node, - const Node * /* relative */ ) -{ - QString fullName; - for ( ;; ) { - fullName.prepend( markedUpName(node) ); - if ( node->parent()->name().isEmpty() ) - break; - node = node->parent(); - fullName.prepend( "<@op>." ); - } - return fullName; -} - -QString QsCodeMarker::markedUpEnumValue(const QString & /* enumValue */, - const Node * /* relative */) -{ - return QString(); -} - -QString QsCodeMarker::markedUpIncludes( const QStringList& /* includes */ ) -{ - return QString(); -} - -QString QsCodeMarker::functionBeginRegExp( const QString& funcName ) -{ - return "^function[ \t].*\\b" + QRegExp::escape( funcName ); -} - -QString QsCodeMarker::functionEndRegExp( const QString& /* funcName */ ) -{ - return "^}"; -} - -QList
    QsCodeMarker::sections( const InnerNode *inner, SynopsisStyle style, Status status ) -{ - QList
    sections; - - if (inner->type() != Node::Class) - return sections; - - const ClassNode *classe = static_cast(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"); - - QStack stack; - stack.push( classe ); - - while ( !stack.isEmpty() ) { - const ClassNode *ancestorClass = stack.pop(); - - NodeList::ConstIterator c = ancestorClass->childNodes().begin(); - while ( c != ancestorClass->childNodes().end() ) { - if ( (*c)->access() == Node::Public ) { - if ( (*c)->type() == Node::Enum ) { - insert( enums, *c, style, status ); - } else if ( (*c)->type() == Node::Function ) { - const FunctionNode *func = (const FunctionNode *) *c; - if ( func->metaness() == FunctionNode::Signal ) { - insert( signalz, *c, style, status ); - } else { - insert( functions, *c, style, status ); - } - } else if ( (*c)->type() == Node::Property ) { - const PropertyNode *property = - (const PropertyNode *) *c; - if ( property->setters().isEmpty() ) { - insert( readOnlyProperties, *c, style, status ); - } else { - insert( writableProperties, *c, style, status ); - } - } - } - ++c; - } - - QList::ConstIterator r = ancestorClass->baseClasses().begin(); - while ( r != ancestorClass->baseClasses().end() ) { - stack.prepend( (*r).node ); - ++r; - } - } - append( sections, enums ); - append( sections, writableProperties ); - append( sections, readOnlyProperties ); - append( sections, functions ); - append( sections, signalz ); - } else if ( style == Detailed ) { - 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() ) { - if ( (*c)->access() == Node::Public ) { - if ( (*c)->type() == Node::Enum ) { - insert( enums, *c, style, status ); - } else if ( (*c)->type() == Node::Function ) { - insert( functionsAndSignals, *c, style, status ); - } else if ( (*c)->type() == Node::Property ) { - insert( properties, *c, style, status ); - } - } - ++c; - } - append( sections, enums ); - append( sections, properties ); - append( sections, functionsAndSignals ); - } else { // ( style == SeparateList ) - FastSection all(classe, "", "", "member", "members"); - - QStack stack; - stack.push( classe ); - - while ( !stack.isEmpty() ) { - const ClassNode *ancestorClass = stack.pop(); - - NodeList::ConstIterator c = ancestorClass->childNodes().begin(); - while ( c != ancestorClass->childNodes().end() ) { - if ( (*c)->access() == Node::Public ) - insert( all, *c, style, status ); - ++c; - } - - QList::ConstIterator r = ancestorClass->baseClasses().begin(); - while ( r != ancestorClass->baseClasses().end() ) { - stack.prepend( (*r).node ); - ++r; - } - } - append( sections, all ); - } - return sections; -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/qscodemarker.h b/tools/qdoc3/qscodemarker.h deleted file mode 100644 index c6a177f..0000000 --- a/tools/qdoc3/qscodemarker.h +++ /dev/null @@ -1,79 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - qscodemarker.h -*/ - -#ifndef QSCODEMARKER_H -#define QSCODEMARKER_H - -#include "codemarker.h" - -QT_BEGIN_NAMESPACE - -class QsCodeMarker : public CodeMarker -{ -public: - QsCodeMarker(); - ~QsCodeMarker(); - - bool recognizeCode( const QString& code ); - bool recognizeExtension( const QString& ext ); - bool recognizeLanguage( const QString& lang ); - QString plainName(const Node *node); - QString plainFullName(const Node *node, const Node *relative); - QString markedUpCode( const QString& code, const Node *relative, - const QString& dirPath ); - QString markedUpSynopsis( const Node *node, const Node *relative, - SynopsisStyle style ); - QString markedUpName( const Node *node ); - QString markedUpFullName( const Node *node, const Node *relative ); - QString markedUpEnumValue(const QString &enumValue, const Node *relative); - QString markedUpIncludes( const QStringList& includes ); - QList
    sections(const InnerNode *innerNode, SynopsisStyle style, Status status); - QString functionBeginRegExp( const QString& funcName ); - QString functionEndRegExp( const QString& funcName ); -}; - -QT_END_NAMESPACE - -#endif diff --git a/tools/qdoc3/qscodeparser.cpp b/tools/qdoc3/qscodeparser.cpp deleted file mode 100644 index 3b8bc1a..0000000 --- a/tools/qdoc3/qscodeparser.cpp +++ /dev/null @@ -1,944 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - qscodeparser.cpp -*/ - -#include -#include - -#include "config.h" -#include "qscodeparser.h" -#include "text.h" -#include "tokenizer.h" -#include "tree.h" - -QT_BEGIN_NAMESPACE - -#define CONFIG_QUICK "quick" -#define CONFIG_REPLACES "replaces" - -#define COMMAND_BRIEF Doc::alias( "brief") -#define COMMAND_CODE Doc::alias( "code") -#define COMMAND_ENDCODE Doc::alias( "endcode") -#define COMMAND_ENDQUICKCODE Doc::alias( "endquickcode") -#define COMMAND_FILE Doc::alias( "file") -#define COMMAND_GROUP Doc::alias( "group") -#define COMMAND_MODULE Doc::alias( "module") -#define COMMAND_PAGE Doc::alias( "page") -#define COMMAND_QUICKCLASS Doc::alias( "quickclass") -#define COMMAND_QUICKCODE Doc::alias( "quickcode") -#define COMMAND_QUICKENUM Doc::alias( "quickenum") -#define COMMAND_QUICKFN Doc::alias( "quickfn") -#define COMMAND_QUICKIFY Doc::alias( "quickify") -#define COMMAND_QUICKPROPERTY Doc::alias( "quickproperty") -#define COMMAND_PROTECTED Doc::alias( "protected") -#define COMMAND_REPLACE Doc::alias( "replace") - -static QString balancedParens = "(?:[^()]+|\\([^()]*\\))*"; - -QsCodeParser::QsCodeParser(Tree *cppTree) - : cppTre(cppTree), qsTre(0), replaceRegExp("/(.+)/([^/]*)/") -{ -} - -QsCodeParser::~QsCodeParser() -{ -} - -void QsCodeParser::initializeParser(const Config& config) -{ - CppCodeParser::initializeParser(config); - - nodeTypeMap.insert(COMMAND_QUICKCLASS, Node::Class); - nodeTypeMap.insert(COMMAND_QUICKENUM, Node::Enum); - nodeTypeMap.insert(COMMAND_QUICKPROPERTY, Node::Property); - nodeTypeMap.insert(COMMAND_QUICKFN, Node::Function); - - QString quickDotReplaces = CONFIG_QUICK + Config::dot + CONFIG_REPLACES; - QStringList replaces = config.getStringList(quickDotReplaces); - QStringList::ConstIterator r = replaces.begin(); - while (r != replaces.end()) { - if (replaceRegExp.exactMatch(*r)) { - QRegExp before(replaceRegExp.cap(1)); - before.setMinimal(true); - QString after = replaceRegExp.cap(2); - - if (before.isValid()) { - replaceBefores << before; - replaceAfters << after; - } - else { - config.lastLocation().warning( - tr("Invalid regular expression '%1'") - .arg(before.pattern())); - } - } - else { - config.lastLocation().warning(tr("Bad syntax in '%1'") - .arg(quickDotReplaces)); - } - ++r; - } -} - -void QsCodeParser::terminateParser() -{ - nodeTypeMap.clear(); - classesWithNoQuickDoc.clear(); - replaceBefores.clear(); - replaceAfters.clear(); - CppCodeParser::terminateParser(); -} - -QString QsCodeParser::language() -{ - return "Qt Script"; -} - -QString QsCodeParser::headerFileNameFilter() -{ - return "*"; -} - -QString QsCodeParser::sourceFileNameFilter() -{ - return "*.qs *.qsd"; -} - -void QsCodeParser::parseHeaderFile(const Location& location, - const QString& filePath, - Tree *tree) -{ - qsTre = tree; - - QFile in(filePath); - if (!in.open(QIODevice::ReadOnly)) { - location.error(tr("Cannot open Qt Script class list '%1'") - .arg(filePath)); - return; - } - - Location fileLocation(filePath); - Tokenizer fileTokenizer(fileLocation, in); - int tok = fileTokenizer.getToken(); - while (tok != Tok_Eoi) { - if (tok == Tok_Ident) { - ClassNode *quickClass = new ClassNode(qsTre->root(), - fileTokenizer.lexeme()); - quickClass->setLocation(fileTokenizer.location()); - } - else { - fileTokenizer.location().error(tr("Unexpected token '%1' in Qt" - " Script class list") - .arg(fileTokenizer.lexeme())); - break; - } - tok = fileTokenizer.getToken(); - } - in.close(); -} - -void QsCodeParser::parseSourceFile(const Location& location, - const QString& filePath, - Tree *tree) -{ - qsTre = tree; - CppCodeParser::parseSourceFile(location, filePath, tree); -} - -void QsCodeParser::doneParsingHeaderFiles(Tree *tree) -{ - NodeList::ConstIterator c = tree->root()->childNodes().begin(); - while (c != tree->root()->childNodes().end()) { - if ((*c)->type() == Node::Class) - quickifyClass((ClassNode *) *c); - ++c; - } - cppTre->root()->deleteChildren(); // save memory - tree->resolveInheritance(); - tree->resolveProperties(); -} - -void QsCodeParser::doneParsingSourceFiles(Tree *tree) -{ - tree->root()->normalizeOverloads(); - - NodeList::ConstIterator c = tree->root()->childNodes().begin(); - while (c != tree->root()->childNodes().end()) { - if ((*c)->type() == Node::Class) { - QMap::ConstIterator cwnqd = - classesWithNoQuickDoc.find((*c)->name()); - if (cwnqd != classesWithNoQuickDoc.end()) { - (*cwnqd)->location().warning(tr("No '\\%1' documentation for" - " class '%2'") - .arg(COMMAND_QUICKCLASS) - .arg(cwnqd.key())); - (*cwnqd)->setDoc(Doc(), true); - } - } - ++c; - } - - // ### check which enum types are used -} - -FunctionNode *QsCodeParser::findFunctionNode(const QString& synopsis, - Tree *tree) -{ - QStringList parentPath; - FunctionNode *clone; - FunctionNode *func = 0; - - if (makeFunctionNode(synopsis, &parentPath, &clone)) { - func = tree->findFunctionNode(parentPath, clone); - delete clone; - } - return func; -} - -QSet QsCodeParser::topicCommands() -{ - return QSet() << COMMAND_FILE << COMMAND_GROUP << COMMAND_MODULE - << COMMAND_PAGE << COMMAND_QUICKCLASS - << COMMAND_QUICKENUM << COMMAND_QUICKFN - << COMMAND_QUICKPROPERTY; -} - -Node *QsCodeParser::processTopicCommand(const Doc& doc, - const QString& command, - const QString& arg) -{ - if (command == COMMAND_QUICKFN) { - QStringList parentPath; - FunctionNode *quickFunc = 0; - FunctionNode *clone; - - if (makeFunctionNode(arg, &parentPath, &clone)) { - FunctionNode *kernelFunc = findKernelFunction(parentPath, - clone->name()); - if (kernelFunc != 0) - kernelFunc->setAccess(Node::Private); - - quickFunc = qsTre->findFunctionNode(parentPath, clone); - if (quickFunc == 0 && kernelFunc != 0) { - quickFunc = new FunctionNode(kernelFunc->parent(), - kernelFunc->name()); - quickFunc->setLocation(kernelFunc->location()); - quickFunc->setReturnType(clone->returnType()); - quickFunc->setParameters(clone->parameters()); - } - - if (quickFunc == 0) { - doc.location().warning(tr("Cannot find '%1' specified with '\\%2'") - .arg(arg).arg(command)); - } - else { - quickFunc->setAccess(Node::Public); - QStringList qtParams = quickFunc->parameterNames(); - quickFunc->borrowParameterNames(clone); - QStringList quickParams = quickFunc->parameterNames(); - setQuickDoc(quickFunc, doc, qtParams, quickParams); - } - delete clone; - } - else { - doc.location().warning(tr("Cannot find '%1' specified with '\\%2'") - .arg(arg).arg(command)); - } - return 0; - } - else if (nodeTypeMap.contains(command)) { - QStringList subArgs = arg.split(" "); - QString dataType; - - if (subArgs.count() == 3 && subArgs[1] == ":") { - dataType = subArgs[2]; - } - else if (subArgs.count() != 1) { - doc.location().warning(tr("Invalid syntax in '\\%1'") - .arg(command)); - } - - QStringList path = subArgs[0].split("."); - Node *quickNode = qsTre->findNode(path, nodeTypeMap[command]); - if (quickNode == 0) { - doc.location().warning(tr("Cannot find '%1' specified with '\\%2'") - .arg(arg).arg(command)); - } - else { - setQuickDoc(quickNode, doc); - if (quickNode->type() == Node::Class) { - classesWithNoQuickDoc.remove(quickNode->name()); - if (doc.briefText().isEmpty()) - doc.location().warning(tr("Missing '\\%1' for class '%2'") - .arg(COMMAND_BRIEF) - .arg(quickNode->name())); - } - else if (quickNode->type() == Node::Property) { - PropertyNode *quickProperty = (PropertyNode *) quickNode; - if (quickProperty->dataType() == "Object") { - if (dataType.isEmpty()) { - doc.location().warning(tr("Missing data type in '\\%1'" - " (assuming 'Object')") - .arg(command)); - } - else { - quickProperty->setDataType(dataType); - } - } - else if (dataType != quickProperty->dataType()) { - doc.location().warning(tr("Ignored contradictory data type" - " in '\\%1'") - .arg(command)); - } - } - } - return 0; - } - else { - return CppCodeParser::processTopicCommand(doc, command, arg); - } -} - -QSet QsCodeParser::otherMetaCommands() -{ - return commonMetaCommands() << COMMAND_ENDQUICKCODE << COMMAND_QUICKCODE - << COMMAND_QUICKIFY << COMMAND_REPLACE; -} - -void QsCodeParser::processOtherMetaCommand(const Doc& doc, - const QString& command, - const QString& arg, - Node *node) -{ - if (command == COMMAND_PROTECTED) { - doc.location().warning(tr("Cannot use '\\%1' in %2") - .arg(COMMAND_PROTECTED).arg(language())); - } - else { - CppCodeParser::processOtherMetaCommand(doc,command,arg,node); - } -} - -ClassNode *QsCodeParser::tryClass(const QString& className) -{ - return (ClassNode*) cppTre->findNode(QStringList(className),Node::Class); -} - -FunctionNode *QsCodeParser::findKernelFunction(const QStringList& parentPath, - const QString& name) -{ - FunctionNode clone(0, name); - clone.setReturnType("Object"); - clone.addParameter(Parameter("...")); - return qsTre->findFunctionNode(parentPath, &clone); -} - -void QsCodeParser::extractRegExp(const QRegExp& regExp, - QString& source, - const Doc& doc) -{ - QRegExp blankLineRegExp( - "[ \t]*(?:\n(?:[ \t]*\n)+[ \t]*|[ \n\t]*\\\\code|" - "\\\\endcode[ \n\t]*)"); - QStringList paras = source.trimmed().split(blankLineRegExp); - paras = paras.filter(regExp); - if (paras.count() == 0) { - doc.location().warning(tr("Cannot find regular expression '%1'") - .arg(regExp.pattern())); - } - else if (paras.count() > 1) { - doc.location().warning(tr("Regular rexpression '%1' matches multiple" - "times").arg(regExp.pattern())); - } - else { - source = paras.first() + "\n\n"; - } -} - -void QsCodeParser::extractTarget(const QString& target, - QString& source, - const Doc& doc) -{ - QRegExp targetRegExp( - "(\\\\target\\s+(\\S+)[^\n]*\n" - "(?:(?!\\s*\\\\code)[^\n]+\n|\\s*\\\\code.*\\\\endcode\\s*\n)*)" - "(?:\\s*\n|[^\n]*$)"); - targetRegExp.setMinimal(true); - - int pos = 0; - while ((pos = source.indexOf(targetRegExp, pos)) != -1) { - if (targetRegExp.cap(2) == target) { - source = targetRegExp.cap(1) + "\n\n"; - return; - } - pos += targetRegExp.matchedLength(); - } - doc.location().warning(tr("Cannot find target '%1'").arg(target)); -} - -void QsCodeParser::renameParameters(QString& source, - const Doc& /* doc */, - const QStringList& qtParams, - const QStringList& quickParams) -{ - QRegExp paramRegExp("(\\\\a\\s*\\{?\\s*)([A-Za-z0-9_]+)"); - - int pos = 0; - while ((pos = paramRegExp.indexIn(source, pos)) != -1) { - pos += paramRegExp.cap(1).length(); - QString before = paramRegExp.cap(2); - int index = qtParams.indexOf(before); - if (index != -1) { - QString after = quickParams[index]; - source.replace(pos, before.size(), after); - } - } -} - -void QsCodeParser::applyReplacementList(QString& source, const Doc& doc) -{ - QStringList args = doc.metaCommandArgs(COMMAND_REPLACE); - QStringList::ConstIterator a = args.begin(); - while (a != args.end()) { - if (replaceRegExp.exactMatch(*a)) { - QRegExp before(replaceRegExp.cap(1)); - before.setMinimal(true); - QString after = replaceRegExp.cap(2); - - if (before.isValid()) { - int oldLen = source.size(); - source.replace(before, after); - - // this condition is sufficient but not necessary - if (oldLen == source.size() && !source.contains(after)) - doc.location().warning( - tr("Regular expression '%1' did not match anything") - .arg(before.pattern())); - } - else { - doc.location().warning( - tr("Invalid regular expression '%1'") - .arg(before.pattern())); - } - } - else { - doc.location().warning(tr("Bad syntax in '\\%1'") - .arg(COMMAND_REPLACE)); - } - ++a; - } - - QRegExp codeRegExp("\\\\" + COMMAND_CODE + "(.*)\\\\" + COMMAND_ENDCODE); - codeRegExp.setMinimal(true); - - QRegExp quickcodeRegExp( - "\\\\" + COMMAND_QUICKCODE + "(.*)\\\\" + COMMAND_ENDQUICKCODE); - quickcodeRegExp.setMinimal(true); - - int quickcodePos = doc.source().indexOf(quickcodeRegExp); - if (quickcodePos != -1) { - int codePos = source.indexOf(codeRegExp); - if (codePos == -1) { - doc.location().warning( - tr("Cannot find any '\\%1' snippet corresponding to '\\%2'") - .arg(COMMAND_CODE).arg(COMMAND_QUICKCODE)); - } - else { - source.replace(codeRegExp.pos(1), codeRegExp.cap(1).length(), - quickcodeRegExp.cap(1)); - codePos = codeRegExp.pos(1) + quickcodeRegExp.cap(1).length(); - - if (doc.source().indexOf(quickcodeRegExp, quickcodePos + 1) != -1) { - doc.location().warning( - tr("Cannot use '\\%1' twice in a row") - .arg(COMMAND_QUICKCODE)); - } - else if (source.indexOf(codeRegExp, codePos + 1) != -1) { - doc.location().warning(tr("Ambiguous '\\%1'") - .arg(COMMAND_QUICKCODE)); - } - } - } -} - -void QsCodeParser::quickifyClass(ClassNode *quickClass) -{ - QString qtClassName = quickClass->name(); - QString bare = quickClass->name(); - if (bare != "Qt" && bare != "Object") { - if (bare.startsWith("Q")) { - bare = bare.mid(1); - } - else { - qtClassName.prepend("Q"); - classesWithNoQ.insert(bare); - } - } - - ClassNode *qtClass = 0; - ClassNode *wrapperClass = 0; - - if ((wrapperClass = tryClass("Quick" + bare)) != 0 || - (wrapperClass = tryClass("QS" + bare + "Class")) != 0) { - qtClass = tryClass(qtClassName); - if (qtClass == 0) { - qtClass = wrapperClass; - wrapperClass = 0; - } - } - else if ((wrapperClass = tryClass("Quick" + bare + "Ptr")) != 0) { - QRegExp ptrToQtType("(Q[A-Za-z0-9_]+)\\s*\\*"); - FunctionNode *ctor = - wrapperClass->findFunctionNode(wrapperClass->name()); - if (ctor != 0 && !ctor->parameters().isEmpty() && - ptrToQtType.exactMatch(ctor->parameters().first().leftType())) - qtClassName = ptrToQtType.cap(1); - qtClass = tryClass(qtClassName); - } - else { - wrapperClass = tryClass("Q" + bare + "Ptr"); - if (wrapperClass == 0) - wrapperClass = tryClass("Quick" + bare + "Interface"); - qtClass = tryClass(qtClassName); - } - - if (qtClass == 0) { - if (wrapperClass == 0) { - quickClass->location().warning(tr("Cannot find Qt class '%1'") - .arg(qtClassName)); - } - else { - quickClass->location().warning(tr("Cannot find Qt class '%1'" - " wrapped by '%2'") - .arg(qtClassName) - .arg(wrapperClass->name())); - } - return; - } - - QList::ConstIterator r = qtClass->baseClasses().begin(); - while (r != qtClass->baseClasses().end()) { - ClassNode *quickBaseClass = cpp2qs.findClassNode(qsTre, - (*r).node->name()); - if (quickBaseClass) - quickClass->addBaseClass((*r).access, quickBaseClass); - ++r; - } - if (quickClass->baseClasses().isEmpty() && quickClass->name() != "Object") - quickClass->addBaseClass(Node::Public, - cpp2qs.findClassNode(qsTre,"Object")); - - QSet funcBlackList; - QSet propertyBlackList; - - NodeList children; - if (wrapperClass != 0) { - children = wrapperClass->childNodes(); - - funcBlackList.insert(wrapperClass->name()); - funcBlackList.insert("~" + wrapperClass->name()); - } - children += qtClass->childNodes(); - - for (int pass = 0; pass < 2; pass++) { - NodeList::ConstIterator c = children.begin(); - while (c != children.end()) { - if ((*c)->access() != Node::Private && - (*c)->status() == Node::Commendable) { - if (pass == 0) { - if ((*c)->type() == Node::Enum) { - EnumNode *enume = (EnumNode *) *c; - quickifyEnum(quickClass, enume); - } - else if ((*c)->type() == Node::Property) { - if (!propertyBlackList.contains((*c)->name())) { - PropertyNode *property = (PropertyNode *) *c; - quickifyProperty(quickClass, qtClass, property); - if (!property->getters().isEmpty()) - funcBlackList.insert(property->getters().first()->name()); - if (!property->setters().isEmpty()) - funcBlackList.insert(property->setters().first()->name()); - if (!property->resetters().isEmpty()) - funcBlackList.insert(property->resetters().first()->name()); - propertyBlackList.insert(property->name()); - } - } - } - else if ((*c)->type() == Node::Function) { - FunctionNode *func = (FunctionNode *) *c; - quickifyFunction(quickClass, qtClass, func, - funcBlackList.contains((*c)->name()) && - func->parameters().count() < 2); - } - } - ++c; - } - } - setQtDoc(quickClass, qtClass->doc()); - classesWithNoQuickDoc.insert(quickClass->name(), quickClass); -} - -void QsCodeParser::quickifyEnum(ClassNode *quickClass, EnumNode *enume) -{ - EnumNode *quickEnum = new EnumNode(quickClass, enume->name()); - quickEnum->setLocation(enume->location()); -#if 0 // ### not yet - quickEnum->setAccess(Node::Protected); -#endif - - QList::ConstIterator it = enume->items().begin(); - while (it != enume->items().end()) { - QString name = (*it).name(); - QString value = (*it).value(); - quickEnum->addItem(EnumItem(name, value)); - ++it; - } - setQtDoc(quickEnum, enume->doc()); -} - -void QsCodeParser::quickifyFunction(ClassNode *quickClass, ClassNode *qtClass, - FunctionNode *func, bool onBlackList) -{ - if (func->metaness() == FunctionNode::Dtor) - return; - - FunctionNode *kernelFunc = findKernelFunction( - QStringList() << quickClass->name(), func->name()); - - QString quickName = func->name(); - if (func->metaness() == FunctionNode::Ctor) - quickName = quickClass->name(); - FunctionNode *quickFunc = new FunctionNode(quickClass, quickName); - quickFunc->setLocation(func->location()); - - if (onBlackList) { - quickFunc->setAccess(Node::Protected); - } - else { - if (kernelFunc != 0 && func->numOverloads() == 1 && - (func->parameters().count() == 0 || - func->parameters().last().defaultValue().isEmpty())) { - kernelFunc->setAccess(Node::Private); - } - else { - if (func->metaness() == FunctionNode::Plain) - quickFunc->setAccess(Node::Protected); - } - } - - quickFunc->setReturnType(cpp2qs.convertedDataType(qsTre, - func->returnType())); - if (func->metaness() != FunctionNode::Slot) - quickFunc->setMetaness(func->metaness()); - quickFunc->setVirtualness(FunctionNode::ImpureVirtual); - quickFunc->setOverload(func->isOverload()); - - QList::ConstIterator q = func->parameters().begin(); - while (q != func->parameters().end()) { - QString dataType = cpp2qs.convertedDataType(qsTre, (*q).leftType(), - (*q).rightType()); - if (dataType.isEmpty()) { - dataType = "UNKNOWN"; - quickFunc->setAccess(Node::Private); - } - Parameter param(dataType, "", (*q).name(), - (*q).defaultValue().isEmpty() ? "" : "undefined"); - quickFunc->addParameter(param); - ++q; - } - - if (func->doc().isEmpty()) { - if (func->parent() != (InnerNode *) qtClass) { - func = qtClass->findFunctionNode(func); - if (func != 0) - setQtDoc(quickFunc, func->doc()); - } - } - else { - setQtDoc(quickFunc, func->doc()); - } -} - -void QsCodeParser::quickifyProperty(ClassNode *quickClass, - ClassNode * /* qtClass */, - PropertyNode *property) -{ - PropertyNode *quickProperty = new PropertyNode(quickClass, - property->name()); - quickProperty->setLocation(property->location()); - quickProperty->setDataType(cpp2qs.convertedDataType(qsTre, - property->dataType())); -#if 0 - quickProperty->setGetter(property->getter()); - quickProperty->setSetter(property->setter()); - quickProperty->setResetter(property->resetter()); -#endif - quickProperty->setStored(property->isStored()); - quickProperty->setDesignable(property->isDesignable()); - - setQtDoc(quickProperty, property->doc()); -} - -QString QsCodeParser::quickifiedDoc(const QString& source) -{ - QString result; - int i = 0; - - while (i < (int) source.length()) { - if (leftWordBoundary(source, i)) { - if (source[i] == 'Q') { - if (source[i + 1] == 'C' && source.mid(i, 8) == "QCString") { - i += 2; - } - else { - int end = i + 1; - while (isWord(source[end])) - ++end; - if (!classesWithNoQ.contains( - source.mid(i + 1, end - (i + 1)))) - result += "Q"; - i++; - } - } - else if (source[i] == 'T' && source.mid(i, 4) == "TRUE" && - rightWordBoundary(source, i + 4)) { - result += "\\c{true}"; - i += 4; - } - else if (source[i] == 'F' && source.mid(i, 5) == "FALSE" && - rightWordBoundary(source, i + 5)) { - result += "\\c{false}"; - i += 5; - } - else if (source[i] == 'c' && source.mid(i, 6) == "const ") { - i += 6; - } - else { - result += source[i++]; - } - } - else if ((source[i] == ':' && source[i + 1] == ':') || - (source[i] == '-' && source[i + 1] == '>')) { - result += '.'; - i += 2; - } - else if (source[i] == '\\') { - // ### make independent of the command name - if (source.mid(i, 5) == "\\code") { - do { - result += source[i++]; - } while (source[i - 1] != '\n'); - - int begin = i; - int end = source.indexOf("\\endcode", i); - if (end != -1) { - QString code = source.mid(begin, end - begin); - result += cpp2qs.convertedCode(qsTre, code, - classesWithNoQ); - i = end; - } - } - else { - result += source[i++]; - } - } - else { - result += source[i++]; - } - } - - QList::ConstIterator b = replaceBefores.begin(); - QStringList::ConstIterator a = replaceAfters.begin(); - while (a != replaceAfters.end()) { - result.replace(*b, *a); - ++b; - ++a; - } - return result; -} - -void QsCodeParser::setQtDoc(Node *quickNode, const Doc& doc) -{ - if (!doc.isEmpty()) { - Doc quickDoc(doc.location(), doc.location(), - quickifiedDoc(doc.source()), - CppCodeParser::topicCommands() + - CppCodeParser::otherMetaCommands()); - quickNode->setDoc(quickDoc, true); - } -} - -void QsCodeParser::setQuickDoc(Node *quickNode, - const Doc& doc, - const QStringList& qtParams, - const QStringList& quickParams) -{ - QRegExp quickifyCommand("\\\\" + COMMAND_QUICKIFY + "([^\n]*)(?:\n|$)"); - - if (quickNode->type() == Node::Function) { - FunctionNode *quickFunc = (FunctionNode *) quickNode; - quickFunc->setOverload(false); - } - - if (doc.metaCommandsUsed().contains(COMMAND_QUICKIFY)) { - QString source = doc.source(); - int pos = source.indexOf(quickifyCommand); - if (pos != -1) { - QString quickifiedSource = quickNode->doc().source(); - if (!qtParams.isEmpty() && qtParams != quickParams) - renameParameters(quickifiedSource, doc, qtParams, - quickParams); - applyReplacementList(quickifiedSource, doc); - - do { - QString extract = quickifiedSource; - QString arg = quickifyCommand.cap(1).simplified(); - if (!arg.isEmpty()) { - if (arg.startsWith("/") && arg.endsWith("/") && - arg.length() > 2) { - QString pattern = arg.mid(1, arg.length() - 2); - extractRegExp(QRegExp(pattern), extract, doc); - } - else { - extractTarget(arg, extract, doc); - } - } - source.replace(pos, quickifyCommand.matchedLength(), extract); - pos += extract.length(); - } while ((pos = source.indexOf(quickifyCommand, pos)) != -1); - - QRegExp quickcodeRegExp( - "\\\\" + COMMAND_QUICKCODE + "(.*)\\\\" + - COMMAND_ENDQUICKCODE); - quickcodeRegExp.setMinimal(true); - source.replace(quickcodeRegExp, ""); - } - - Doc quickDoc(doc.location(), - doc.location(), - source, - (CppCodeParser::topicCommands() + topicCommands() + - CppCodeParser::otherMetaCommands()) << COMMAND_REPLACE); - quickNode->setDoc(quickDoc, true); - processOtherMetaCommands(quickDoc, quickNode); - } - else { - quickNode->setDoc(doc, true); - processOtherMetaCommands(doc, quickNode); - } -} - -bool QsCodeParser::makeFunctionNode(const QString& synopsis, - QStringList *parentPathPtr, - FunctionNode **funcPtr) -{ - QRegExp funcRegExp( - "\\s*([A-Za-z0-9_]+)\\.([A-Za-z0-9_]+)\\s*\\((" + - balancedParens + - ")\\)(?:\\s*:\\s*([A-Za-z0-9_]+))?\\s*"); - QRegExp paramRegExp( - "\\s*(\\[)?\\s*(?:([A-Za-z0-9_]+)\\s*:\\s*)?" - "([A-Za-z0-9_]+|\\.\\.\\.)\\s*(\\[)?[\\s\\]]*"); - - if (!funcRegExp.exactMatch(synopsis)) - return false; - - ClassNode *classe = (ClassNode*) - qsTre->findNode(QStringList(funcRegExp.cap(1)),Node::Class); - if (classe == 0) - return false; - - FunctionNode *clone = new FunctionNode(0, funcRegExp.cap(2)); - bool optional = false; - - QString paramStr = funcRegExp.cap(3); - QStringList params = paramStr.split(","); - QStringList::ConstIterator p = params.begin(); - while (p != params.end()) { - if (paramRegExp.exactMatch(*p)) { - if (!paramRegExp.cap(1).isEmpty()) - optional = true; - clone->addParameter(Parameter(paramRegExp.cap(3), - "", - paramRegExp.cap(2), - optional ? "undefined" : "")); - if (!paramRegExp.cap(4).isEmpty()) - optional = true; - } - else { - delete clone; - return false; - } - ++p; - } - QString returnType = funcRegExp.cap(4); - if (!returnType.isEmpty()) - clone->setReturnType(returnType); - if (parentPathPtr != 0) - *parentPathPtr = QStringList() << classe->name(); - if (funcPtr != 0) { - *funcPtr = clone; - } - else { - delete clone; - } - return true; -} - -bool QsCodeParser::isWord(QChar ch) -{ - return ch.isLetterOrNumber() || ch == QChar('_'); -} - -bool QsCodeParser::leftWordBoundary(const QString& str, int pos) -{ - return !isWord(str[pos - 1]) && isWord(str[pos]); -} - -bool QsCodeParser::rightWordBoundary(const QString& str, int pos) -{ - return isWord(str[pos - 1]) && !isWord(str[pos]); -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/qscodeparser.h b/tools/qdoc3/qscodeparser.h deleted file mode 100644 index 28924d7..0000000 --- a/tools/qdoc3/qscodeparser.h +++ /dev/null @@ -1,128 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - qscodeparser.h -*/ - -#ifndef QSCODEPARSER_H -#define QSCODEPARSER_H - -#include "cppcodeparser.h" -#include "cpptoqsconverter.h" - -QT_BEGIN_NAMESPACE - -class QsCodeParser : public CppCodeParser -{ - public: - QsCodeParser(Tree *cppTree); - ~QsCodeParser(); - - virtual void initializeParser(const Config& config); - virtual void terminateParser(); - virtual QString language(); - virtual QString headerFileNameFilter(); - virtual QString sourceFileNameFilter(); - virtual void parseHeaderFile(const Location& location, - const QString& filePath, Tree *tree); - virtual void parseSourceFile(const Location& location, - const QString& filePath, Tree *tree); - virtual void doneParsingHeaderFiles(Tree *tree); - virtual void doneParsingSourceFiles(Tree *tree); - - FunctionNode *findFunctionNode(const QString& synopsis, Tree *tree); - - protected: - virtual QSet topicCommands(); - virtual Node *processTopicCommand(const Doc& doc, const QString& command, - const QString& arg); - virtual QSet otherMetaCommands(); - virtual void processOtherMetaCommand(const Doc& doc, - const QString& command, - const QString& arg, Node *node); - - private: - ClassNode *tryClass(const QString& className); - FunctionNode *findKernelFunction(const QStringList& parentPath, - const QString& name); - void extractRegExp(const QRegExp& regExp, QString& source, - const Doc& doc); - void extractTarget(const QString& target, QString& source, - const Doc& doc); - void renameParameters(QString& source, const Doc& doc, - const QStringList& qtNames, - const QStringList& quickNames); - void applyReplacementList(QString& source, const Doc& doc); - void quickifyClass(ClassNode *quickClass); - void quickifyEnum(ClassNode *quickClass, EnumNode *enume); - void quickifyFunction(ClassNode *quickClass, ClassNode *qtClass, - FunctionNode *func, bool onBlackList); - void quickifyProperty(ClassNode *quickClass, ClassNode *qtClass, - PropertyNode *property); - QString quickifiedDoc(const QString& source); - void setQtDoc(Node *quickNode, const Doc& doc); - void setQuickDoc(Node *quickNode, const Doc& doc, - const QStringList& qtParams = QStringList(), - const QStringList& quickParams = QStringList()); - bool makeFunctionNode(const QString& synopsis, QStringList *parentPathPtr, - FunctionNode **funcPtr); - - static bool isWord(QChar ch); - static bool leftWordBoundary(const QString& str, int pos); - static bool rightWordBoundary(const QString& str, int pos); - - QMap nodeTypeMap; - QMap classesWithNoQuickDoc; - QList replaceBefores; - QStringList replaceAfters; - QSet classesWithNoQ; - Tree* cppTre; - Tree* qsTre; - QRegExp replaceRegExp; - CppToQsConverter cpp2qs; - - static int tabSize; -}; - -QT_END_NAMESPACE - -#endif diff --git a/tools/qdoc3/sgmlgenerator.cpp b/tools/qdoc3/sgmlgenerator.cpp deleted file mode 100644 index 1858028..0000000 --- a/tools/qdoc3/sgmlgenerator.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - sgmlgenerator.cpp -*/ - -#include "sgmlgenerator.h" - -QT_BEGIN_NAMESPACE - -SgmlGenerator::SgmlGenerator() -{ -} - -SgmlGenerator::~SgmlGenerator() -{ -} - -QString SgmlGenerator::format() -{ - return "SGML"; -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/sgmlgenerator.h b/tools/qdoc3/sgmlgenerator.h deleted file mode 100644 index ef1f07f..0000000 --- a/tools/qdoc3/sgmlgenerator.h +++ /dev/null @@ -1,67 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - sgmlgenerator.h -*/ - -#ifndef SGMLGENERATOR_H -#define SGMLGENERATOR_H - -#include "bookgenerator.h" - -QT_BEGIN_NAMESPACE - -class SgmlGenerator : public BookGenerator -{ -public: - SgmlGenerator(); - ~SgmlGenerator(); - - virtual QString format(); - -protected: - // ### -}; - -QT_END_NAMESPACE - -#endif -- cgit v0.12 From 5d2eaa50cb1a95f370d7db7413c112e85c83c66d Mon Sep 17 00:00:00 2001 From: David Boddie Date: Fri, 19 Nov 2010 19:01:29 +0100 Subject: Further simplifications to qdoc3. Removed the unused ApiGenerator class. Removed archive and uncompression support not used in Qt. Removed the unused WebXML generator used to dump documentation as XML for an ancient documentation Web project. --- tools/qdoc3/JAVATODO.txt | 28 - tools/qdoc3/TODO.txt | 9 - tools/qdoc3/apigenerator.cpp | 150 ----- tools/qdoc3/apigenerator.h | 65 -- tools/qdoc3/archiveextractor.cpp | 108 --- tools/qdoc3/archiveextractor.h | 78 --- tools/qdoc3/config.cpp | 72 +- tools/qdoc3/generator.cpp | 29 - tools/qdoc3/main.cpp | 24 - tools/qdoc3/polyarchiveextractor.cpp | 94 --- tools/qdoc3/polyarchiveextractor.h | 70 -- tools/qdoc3/polyuncompressor.cpp | 109 ---- tools/qdoc3/polyuncompressor.h | 71 -- tools/qdoc3/qdoc3.pro | 18 +- tools/qdoc3/uncompressor.cpp | 108 --- tools/qdoc3/uncompressor.h | 79 --- tools/qdoc3/webxmlgenerator.cpp | 1195 ---------------------------------- tools/qdoc3/webxmlgenerator.h | 127 ---- 18 files changed, 5 insertions(+), 2429 deletions(-) delete mode 100644 tools/qdoc3/JAVATODO.txt delete mode 100644 tools/qdoc3/apigenerator.cpp delete mode 100644 tools/qdoc3/apigenerator.h delete mode 100644 tools/qdoc3/archiveextractor.cpp delete mode 100644 tools/qdoc3/archiveextractor.h delete mode 100644 tools/qdoc3/polyarchiveextractor.cpp delete mode 100644 tools/qdoc3/polyarchiveextractor.h delete mode 100644 tools/qdoc3/polyuncompressor.cpp delete mode 100644 tools/qdoc3/polyuncompressor.h delete mode 100644 tools/qdoc3/uncompressor.cpp delete mode 100644 tools/qdoc3/uncompressor.h delete mode 100644 tools/qdoc3/webxmlgenerator.cpp delete mode 100644 tools/qdoc3/webxmlgenerator.h diff --git a/tools/qdoc3/JAVATODO.txt b/tools/qdoc3/JAVATODO.txt deleted file mode 100644 index 911b7a5..0000000 --- a/tools/qdoc3/JAVATODO.txt +++ /dev/null @@ -1,28 +0,0 @@ - * index page on "O" and downwards? - * flag types, e.g. QTextStream::NumberFlags - * example references qt.nokia.com/doc etc. - - * fix enum value table (e.g. QCoreApplication.Encoding.html) - * check reimplementation of interface functions (e.g. QWidget::widthMM()) - * handle '::' in doc, e.g. in QAbstractEventDispatcher's detailed desc - * make sure default constructor logic doesn't interfere with default params (e.g. QAbstractEventDispatcher ctors) - * document default constructor provided for Java (e.g.?) - * document "protected QAbstractEventDispatcher(QtObject.QPrivateConstructor p)" and the like - * memory-managed, type - - * replace QString with String, etc. - * nested classes - * enum_1 - - * fix stylesheet - * no link to class itself - * support \ifjava - * add // C++ - * support Java-only /*! ... */ comments - - * links to property names have to be fixed - * example: version 1 in QStyleOptionFrame - * example: foo -> isFoo() - - * lowercase, and remove final stop, in \brief texts for variables and properties - * omit "see alsos" that don't work instead of showing them as broken links diff --git a/tools/qdoc3/TODO.txt b/tools/qdoc3/TODO.txt index 6deeb06..9bf4a28 100644 --- a/tools/qdoc3/TODO.txt +++ b/tools/qdoc3/TODO.txt @@ -10,8 +10,6 @@ * Don't turn X11 and similar names into links. * Added automatic links from getters to setters and vice versa. * Support \module and show which module each class is from. - * Use bullet list for the list of all functions, now that - Assistant handles these gracefully. * Fix occasional crash caused by misuse of const_cast(). * Provide clearer error messages when resolves fail. @@ -55,12 +53,9 @@ MUST HAVES: * Provide a "List of all properties" page. * expand QObjectList -> QList - * make \macro work (?) * warning for unnamed parameters in property access functions * \center...\endcenter - * warning for undocumented enum values - LINKS: * explanation following nonstandard wording warning @@ -74,8 +69,6 @@ LINKS: * implement \sidebar - * implement qbook - * implement \legalesefile * show in which module each class is @@ -92,5 +85,3 @@ NICE FEATURES: OTHER: * make qdoc run faster * make sure \headerfile works even if specified after \relates - - * use qtstyle.css instead of inline style for each page diff --git a/tools/qdoc3/apigenerator.cpp b/tools/qdoc3/apigenerator.cpp deleted file mode 100644 index 41c89c7..0000000 --- a/tools/qdoc3/apigenerator.cpp +++ /dev/null @@ -1,150 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include - -#include "apigenerator.h" -#include "codemarker.h" -#include "tree.h" - -QT_BEGIN_NAMESPACE - -static QString indentStr(int indent) -{ - QString str; - str.fill(QLatin1Char(' '), indent * 4); - return str; -} - -static bool lessThanName(Node *node1, Node *node2) -{ - return node1->name() < node2->name(); -} - -QString ApiGenerator::format() -{ - return QLatin1String("API"); -} - -void ApiGenerator::generateTree(const Tree *tree, CodeMarker *marker) -{ - QFile outFile(QLatin1String("api")); - outFile.open(QIODevice::WriteOnly); - - out.setDevice(&outFile); - generateNode(tree->root(), marker); - out.flush(); -} - -void ApiGenerator::generateNode(const Node *node, CodeMarker *marker, int indent) -{ - if (node->access() == Node::Private) - return; - - switch (node->type()) { - case Node::Namespace: - if (!node->name().isEmpty()) { - out << indentStr(indent) << "Namespace: " << node->name() << "\n"; - ++indent; - } - break; - case Node::Class: - { - const ClassNode *classe = static_cast(node); - out << indentStr(indent) << "Class: " << node->name(); - foreach (const RelatedClass &baseClass, classe->baseClasses()) { - if (baseClass.access == Node::Public) - out << " inherits " << baseClass.dataTypeWithTemplateArgs; - } - out << "\n"; - ++indent; - } - break; - case Node::Enum: - { - const EnumNode *enume = static_cast(node); - out << indentStr(indent) << "Enum: " << node->name() << "\n"; - ++indent; - - QStringList enumNames; - foreach (const EnumItem &item, enume->items()) - enumNames << item.name(); - qSort(enumNames); - - foreach (const QString &name, enumNames) - out << indentStr(indent) << "Enum value: " << name << "\n"; - } - break; - case Node::Typedef: - out << indentStr(indent) << "Typedef: " << node->name() << "\n"; - ++indent; - break; - case Node::Function: - { - out << indentStr(indent) << "Function: " - << plainCode(marker->markedUpSynopsis(node, 0, CodeMarker::Detailed)) << "\n"; - ++indent; - } - break; - case Node::Property: - { - const PropertyNode *property = static_cast(node); - out << indentStr(indent) << "Property: " << property->name() - << " type " << property->dataType() << "\n"; - ++indent; - } - break; - default: - ; - } - - if (node->isInnerNode()) { - const InnerNode *inner = static_cast(node); - NodeList nodes = inner->childNodes(); - qSort(nodes.begin(), nodes.end(), lessThanName); - foreach (const Node *child, nodes) - generateNode(child, marker, indent); - } - - out.flush(); -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/apigenerator.h b/tools/qdoc3/apigenerator.h deleted file mode 100644 index fefef5d..0000000 --- a/tools/qdoc3/apigenerator.h +++ /dev/null @@ -1,65 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef APIGENERATOR_H -#define APIGENERATOR_H - -#include - -#include "generator.h" - -QT_BEGIN_NAMESPACE - -class ApiGenerator : public Generator -{ -public: - QString format(); - void generateTree(const Tree *tree, CodeMarker *marker); - -private: - void generateNode(const Node *node, CodeMarker *marker, int indent = 0); - - QTextStream out; -}; - -QT_END_NAMESPACE - -#endif diff --git a/tools/qdoc3/archiveextractor.cpp b/tools/qdoc3/archiveextractor.cpp deleted file mode 100644 index 6d3d736..0000000 --- a/tools/qdoc3/archiveextractor.cpp +++ /dev/null @@ -1,108 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - archiveextractor.cpp -*/ - -#include "archiveextractor.h" - -QT_BEGIN_NAMESPACE - -QList ArchiveExtractor::extractors; - -/*! - \class ArchiveExtractor - - \brief The ArchiveExtractor class is a base class for classes that - know how to unpack a certain kind of archive file. - - The archive extractor contains a list of the filename extensions - of the files that the archive extractor knows how to unpack. - - It maintains a static list of all the instances of ArchiveExtractor - that have been created. It also has a static function for searching - that list to find the archive extracter for a file with a certain - extension. - */ - -/*! - The constructor takes a list of filename extensions, which it - copies and saves internally. This archive extractor is prepended - to the static list. - */ -ArchiveExtractor::ArchiveExtractor( const QStringList& extensions ) - : fileExts( extensions ) -{ - extractors.prepend( this ); -} - -/*! - The destructor deletes all the filename extensions. - */ -ArchiveExtractor::~ArchiveExtractor() -{ - extractors.removeAll( this ); -} - -/*! - This function searches the static list of archive extractors - to find the first one that can handle \a fileName. If it finds - an acceptable extractor, it returns a pointer to it. Otherwise - it returns null. - */ -ArchiveExtractor* -ArchiveExtractor::extractorForFileName( const QString& fileName ) -{ - int dot = -1; - while ( (dot = fileName.indexOf(QLatin1Char('.'), dot + 1)) != -1 ) { - QString ext = fileName.mid( dot + 1 ); - QList::ConstIterator e = extractors.begin(); - while ( e != extractors.end() ) { - if ( (*e)->fileExtensions().contains(ext) ) - return *e; - ++e; - } - } - return 0; -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/archiveextractor.h b/tools/qdoc3/archiveextractor.h deleted file mode 100644 index 678945a..0000000 --- a/tools/qdoc3/archiveextractor.h +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - archiveextractor.h -*/ - -#ifndef ARCHIVEEXTRACTOR_H -#define ARCHIVEEXTRACTOR_H - -#include - -#include "location.h" - -QT_BEGIN_NAMESPACE - -class ArchiveExtractor -{ -public: - ArchiveExtractor( const QStringList& extensions ); - virtual ~ArchiveExtractor(); - - virtual void extractArchive( const Location& location, - const QString& filePath, - const QString& outputDir ) = 0; - - static ArchiveExtractor *extractorForFileName( const QString& fileName ); - -protected: - const QStringList& fileExtensions() { return fileExts; } - -private: - QStringList fileExts; - - static QList extractors; -}; - -QT_END_NAMESPACE - -#endif diff --git a/tools/qdoc3/config.cpp b/tools/qdoc3/config.cpp index 4d1c378..0146a26 100644 --- a/tools/qdoc3/config.cpp +++ b/tools/qdoc3/config.cpp @@ -49,9 +49,7 @@ #include #include -#include "archiveextractor.h" #include "config.h" -#include "uncompressor.h" #include QT_BEGIN_NAMESPACE @@ -150,7 +148,6 @@ QStringList MetaStack::getExpanded(const Location& location) } QT_STATIC_CONST_IMPL QString Config::dot = QLatin1String("."); -QMap Config::uncompressedFiles; QMap Config::extractedDirs; int Config::numInstances; @@ -178,30 +175,9 @@ Config::Config(const QString& programName) } /*! - The destructor deletes all the temporary files and - directories it built. */ Config::~Config() { - if (--numInstances == 0) { - QMap::ConstIterator f = uncompressedFiles.begin(); - while (f != uncompressedFiles.end()) { - QDir().remove(*f); - ++f; - } - uncompressedFiles.clear(); - - QMap::ConstIterator d = extractedDirs.begin(); - while (d != extractedDirs.end()) { - removeDirContents(*d); - QDir dir(*d); - QString name = dir.dirName(); - dir.cdUp(); - dir.rmdir(name); - ++d; - } - extractedDirs.clear(); - } } /*! @@ -456,62 +432,18 @@ QString Config::findFile(const Location& location, QStringList::ConstIterator c = components.begin(); for (;;) { bool isArchive = (c != components.end() - 1); - ArchiveExtractor *extractor = 0; QString userFriendly = *c; - if (isArchive) { - extractor = ArchiveExtractor::extractorForFileName(userFriendly); - } - - if (extractor == 0) { - Uncompressor *uncompressor = - Uncompressor::uncompressorForFileName(userFriendly); - if (uncompressor != 0) { - QString fileNameWithCorrectExtension = - uncompressor->uncompressedFilePath( - fileInfo.filePath()); - QString uncompressed = uncompressedFiles[fileInfo.filePath()]; - if (uncompressed.isEmpty()) { - uncompressed = - QTemporaryFile(fileInfo.filePath()).fileName(); - uncompressor->uncompressFile(location, - fileInfo.filePath(), - uncompressed); - uncompressedFiles[fileInfo.filePath()] = uncompressed; - } - fileInfo.setFile(uncompressed); - - if (isArchive) { - extractor = ArchiveExtractor::extractorForFileName( - fileNameWithCorrectExtension); - } - else { - userFriendly = fileNameWithCorrectExtension; - } - } - } userFriendlyFilePath += userFriendly; if (isArchive) { - if (extractor == 0) - location.fatal(tr("Unknown archive type '%1'") - .arg(userFriendlyFilePath)); QString extracted = extractedDirs[fileInfo.filePath()]; - if (extracted.isEmpty()) { - extracted = QTemporaryFile(fileInfo.filePath()).fileName(); - if (!QDir().mkdir(extracted)) - location.fatal(tr("Cannot create temporary directory '%1'") - .arg(extracted)); - extractor->extractArchive(location, fileInfo.filePath(), - extracted); - extractedDirs[fileInfo.filePath()] = extracted; - } ++c; fileInfo.setFile(QDir(extracted), *c); } - else { + else break; - } + userFriendlyFilePath += "?"; } return fileInfo.filePath(); diff --git a/tools/qdoc3/generator.cpp b/tools/qdoc3/generator.cpp index c0efd76..74e966a 100644 --- a/tools/qdoc3/generator.cpp +++ b/tools/qdoc3/generator.cpp @@ -674,35 +674,6 @@ void Generator::generateExampleFiles(const FakeNode *fake, CodeMarker *marker) generateFileList(fake, marker, Node::Image, QString("Images:")); } -#if 0 - QList::ConstIterator g = generators.begin(); - while (g != generators.end()) { - if (outputFormats.contains((*g)->format())) { - (*g)->initializeGenerator(config); - QStringList extraImages = - config.getStringList(CONFIG_EXTRAIMAGES+Config::dot+(*g)->format()); - QStringList::ConstIterator e = extraImages.begin(); - while (e != extraImages.end()) { - QString userFriendlyFilePath; - QString filePath = Config::findFile(config.lastLocation(), - imageFiles, - imageDirs, - *e, - imgFileExts[(*g)->format()], - userFriendlyFilePath); - if (!filePath.isEmpty()) - Config::copyFile(config.lastLocation(), - filePath, - userFriendlyFilePath, - (*g)->outputDir() + - "/images"); - ++e; - } - } - ++g; - } -#endif - QString Generator::indent(int level, const QString& markedCode) { if (level == 0) diff --git a/tools/qdoc3/main.cpp b/tools/qdoc3/main.cpp index 7459e40..768c5eb 100644 --- a/tools/qdoc3/main.cpp +++ b/tools/qdoc3/main.cpp @@ -45,7 +45,6 @@ #include #include -#include "apigenerator.h" #include "codemarker.h" #include "codeparser.h" #include "config.h" @@ -54,9 +53,6 @@ #include "doc.h" #include "htmlgenerator.h" #include "plaincodemarker.h" -#include "polyarchiveextractor.h" -#include "polyuncompressor.h" -#include "webxmlgenerator.h" #include "ditaxmlgenerator.h" #include "tokenizer.h" #include "tree.h" @@ -369,24 +365,6 @@ int main(int argc, char **argv) #ifndef QT_BOOTSTRAPPED QCoreApplication app(argc, argv); #endif - QString cf = "qsauncompress \1 \2"; - PolyArchiveExtractor qsaExtractor(QStringList() << "qsa",cf); - cf = "tar -C \2 -xf \1"; - PolyArchiveExtractor tarExtractor(QStringList() << "tar",cf); - cf = "tar -C \2 -Zxf \1"; - PolyArchiveExtractor tazExtractor(QStringList() << "taz",cf); - cf = "tar -C \2 -jxf \1"; - PolyArchiveExtractor tbz2Extractor(QStringList() << "tbz" << "tbz2",cf); - cf = "tar -C \2 -zxf \1"; - PolyArchiveExtractor tgzExtractor(QStringList() << "tgz",cf); - cf = "unzip \1 -d \2"; - PolyArchiveExtractor zipExtractor(QStringList() << "zip",cf); - cf = "bunzip2 -c \1 > \2"; - PolyUncompressor bz2Uncompressor(QStringList() << "bz" << "bz2",cf); - cf = "gunzip -c \1 > \2"; - PolyUncompressor gzAndZUncompressor(QStringList() << "gz" << "z" << "Z",cf); - cf = "unzip -c \1 > \2"; - PolyUncompressor zipUncompressor(QStringList() << "zip",cf); /* Create code parsers for the languages to be parsed, @@ -401,9 +379,7 @@ int main(int argc, char **argv) PlainCodeMarker plainMarker; CppCodeMarker cppMarker; - ApiGenerator apiGenerator; HtmlGenerator htmlGenerator; - WebXMLGenerator webxmlGenerator; DitaXmlGenerator ditaxmlGenerator; QStringList qdocFiles; diff --git a/tools/qdoc3/polyarchiveextractor.cpp b/tools/qdoc3/polyarchiveextractor.cpp deleted file mode 100644 index b2574ab..0000000 --- a/tools/qdoc3/polyarchiveextractor.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - polyarchiveextractor.cpp -*/ - -#include "command.h" -#include "polyarchiveextractor.h" - -QT_BEGIN_NAMESPACE - -/*! - \class PolyArchiveExtractor - - \brief The PolyArchiveExtractor class is a class for unpacking - archive files. - - This subclass of ArchiveExtractor contains a parameterized - command for doing the archive extraction. - - It has an extractArchive() function you call to do the - actual archive extraction. - */ - -/*! - The constructor takes the list of filename \a extensions, - which it passes to the base class, and the \a commandFormat, - which it stores locally. The \a commandFormat is a command - template string. - */ -PolyArchiveExtractor::PolyArchiveExtractor( const QStringList& extensions, - const QString& commandFormat ) - : ArchiveExtractor( extensions ), cmd( commandFormat ) -{ -} - -/*! - The destructor doesn't have to do anything. - */ -PolyArchiveExtractor::~PolyArchiveExtractor() -{ -} - -/*! - Call this function to do the actual archive extraction. It calls - the executeCommand() function to do the work. That's all it does. - */ -void PolyArchiveExtractor::extractArchive( const Location& location, - const QString& filePath, - const QString& outputDir ) -{ - executeCommand( location, cmd, QStringList() << filePath << outputDir ); -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/polyarchiveextractor.h b/tools/qdoc3/polyarchiveextractor.h deleted file mode 100644 index 7ed0f62..0000000 --- a/tools/qdoc3/polyarchiveextractor.h +++ /dev/null @@ -1,70 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - polyarchiveextractor.h -*/ - -#ifndef POLYARCHIVEEXTRACTOR_H -#define POLYARCHIVEEXTRACTOR_H - -#include "archiveextractor.h" - -QT_BEGIN_NAMESPACE - -class PolyArchiveExtractor : public ArchiveExtractor -{ - public: - PolyArchiveExtractor(const QStringList& extensions, - const QString& commandFormat); - ~PolyArchiveExtractor(); - - virtual void extractArchive(const Location& location, - const QString& filePath, - const QString& outputDir); - - private: - QString cmd; -}; - -QT_END_NAMESPACE - -#endif diff --git a/tools/qdoc3/polyuncompressor.cpp b/tools/qdoc3/polyuncompressor.cpp deleted file mode 100644 index 97b5e0d..0000000 --- a/tools/qdoc3/polyuncompressor.cpp +++ /dev/null @@ -1,109 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "command.h" -#include "polyuncompressor.h" - -QT_BEGIN_NAMESPACE - -/*! - \class PolyUncompressor - - \brief The PolyUncompressor class is a class for uncompressing - compressed files. - - This subclass of Uncompressor contains a parameterized - command for doing the uncompression - - It has an uncompressFile() function you call to do the - actual uncompression. - */ - -/*! - The constructor takes the list of filename \a extensions, - which it passes to the base class, and the \a commandFormat, - which it stores locally. The \a commandFormat is a command - template string. - */ -PolyUncompressor::PolyUncompressor( const QStringList& extensions, - const QString& commandFormat ) - : Uncompressor( extensions ), cmd( commandFormat ) -{ -} - -/*! - The destructor doesn't have to do anything. - */ -PolyUncompressor::~PolyUncompressor() -{ -} - -/*! - From \a filePath, derive a file path for the uncompressed - file and return it. If it can't figure out what the file - path should be, it just concatenates ".out" to the - \a filePath and returns that. - */ -QString PolyUncompressor::uncompressedFilePath( const QString& filePath ) -{ - QStringList::ConstIterator e = fileExtensions().begin(); - while ( e != fileExtensions().end() ) { - QString dotExt = "." + *e; - if ( filePath.endsWith(dotExt) ) - return filePath.left( filePath.length() - dotExt.length() ); - ++e; - } - return filePath + ".out"; // doesn't really matter -} - -/*! - Call this function to do the actual uncompressing. It calls - the executeCommand() function to do the work. That's all it does. - */ -void PolyUncompressor::uncompressFile( const Location& location, - const QString& filePath, - const QString& outputFilePath ) -{ - executeCommand( location, cmd, - QStringList() << filePath << outputFilePath ); -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/polyuncompressor.h b/tools/qdoc3/polyuncompressor.h deleted file mode 100644 index e12f475..0000000 --- a/tools/qdoc3/polyuncompressor.h +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - polyuncompressor.h -*/ - -#ifndef POLYUNCOMPRESSOR_H -#define POLYUNCOMPRESSOR_H - -#include "uncompressor.h" - -QT_BEGIN_NAMESPACE - -class PolyUncompressor : public Uncompressor -{ - public: - PolyUncompressor(const QStringList& extensions, - const QString& commandFormat); - ~PolyUncompressor(); - - virtual QString uncompressedFilePath(const QString& filePath); - virtual void uncompressFile(const Location& location, - const QString& filePath, - const QString& outputFilePath); - - private: - QString cmd; -}; - -QT_END_NAMESPACE - -#endif diff --git a/tools/qdoc3/qdoc3.pro b/tools/qdoc3/qdoc3.pro index 9b76d97..77c95f8 100644 --- a/tools/qdoc3/qdoc3.pro +++ b/tools/qdoc3/qdoc3.pro @@ -24,9 +24,7 @@ build_all:!build_pass { } CONFIG -= app_bundle -HEADERS += apigenerator.h \ - archiveextractor.h \ - atom.h \ +HEADERS += atom.h \ ccodeparser.h \ codechunk.h \ codemarker.h \ @@ -46,19 +44,13 @@ HEADERS += apigenerator.h \ openedlist.h \ pagegenerator.h \ plaincodemarker.h \ - polyarchiveextractor.h \ - polyuncompressor.h \ quoter.h \ separator.h \ text.h \ tokenizer.h \ tr.h \ - tree.h \ - uncompressor.h \ - webxmlgenerator.h -SOURCES += apigenerator.cpp \ - archiveextractor.cpp \ - atom.cpp \ + tree.h +SOURCES += atom.cpp \ ccodeparser.cpp \ codechunk.cpp \ codemarker.cpp \ @@ -79,15 +71,11 @@ SOURCES += apigenerator.cpp \ openedlist.cpp \ pagegenerator.cpp \ plaincodemarker.cpp \ - polyarchiveextractor.cpp \ - polyuncompressor.cpp \ quoter.cpp \ separator.cpp \ text.cpp \ tokenizer.cpp \ tree.cpp \ - uncompressor.cpp \ - webxmlgenerator.cpp \ yyindent.cpp ### Documentation for qdoc3 ### diff --git a/tools/qdoc3/uncompressor.cpp b/tools/qdoc3/uncompressor.cpp deleted file mode 100644 index afb88e6..0000000 --- a/tools/qdoc3/uncompressor.cpp +++ /dev/null @@ -1,108 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - uncompressor.cpp -*/ - -#include "uncompressor.h" - -QT_BEGIN_NAMESPACE - -QList Uncompressor::uncompressors; - - -/*! - \class Uncompressor - - \brief The Uncompressor class is a base class for classes that - know how to uncompress a certain kind of compressed file. - - The uncompressor contains a list of the filename extensions - of the file types that the uncompressor knows how to uncompress. - - It maintains a static list of all the instances of Uncompressor - that have been created. It also has a static function for searching - that list to find the uncompressor to use for uncompressing a file - with a certain extension. - */ - -/*! - The constructor takes a list of filename extensions, which it - copies and saves internally. This uncompressor is prepended - to the stack list. - */ -Uncompressor::Uncompressor( const QStringList& extensions ) - : fileExts( extensions ) -{ - uncompressors.prepend( this ); -} - -/*! - The destructor deletes all the filename extensions. - */ -Uncompressor::~Uncompressor() -{ - uncompressors.removeAll( this ); -} - -/*! - This function searches the static list of uncompressors to find the - first one that can handle \a fileName. If it finds an acceptable - uncompressor, it returns a pointer to it. Otherwise it returns null. -*/ -Uncompressor* -Uncompressor::uncompressorForFileName( const QString& fileName ) -{ - int dot = -1; - while ( (dot = fileName.indexOf(".", dot + 1)) != -1 ) { - QString ext = fileName.mid( dot + 1 ); - QList::ConstIterator u = uncompressors.begin(); - while ( u != uncompressors.end() ) { - if ( (*u)->fileExtensions().contains(ext) ) - return *u; - ++u; - } - } - return 0; -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/uncompressor.h b/tools/qdoc3/uncompressor.h deleted file mode 100644 index cae675f..0000000 --- a/tools/qdoc3/uncompressor.h +++ /dev/null @@ -1,79 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - uncompressor.h -*/ - -#ifndef UNCOMPRESSOR_H -#define UNCOMPRESSOR_H - -#include - -#include "location.h" - -QT_BEGIN_NAMESPACE - -class Uncompressor -{ -public: - Uncompressor( const QStringList& extensions ); - virtual ~Uncompressor(); - - virtual QString uncompressedFilePath( const QString& filePath ) = 0; - virtual void uncompressFile( const Location& location, - const QString& filePath, - const QString& outputFilePath ) = 0; - - static Uncompressor *uncompressorForFileName( const QString& fileName ); - -protected: - const QStringList& fileExtensions() const { return fileExts; } - -private: - QStringList fileExts; - - static QList uncompressors; -}; - -QT_END_NAMESPACE - -#endif diff --git a/tools/qdoc3/webxmlgenerator.cpp b/tools/qdoc3/webxmlgenerator.cpp deleted file mode 100644 index 6020b1b..0000000 --- a/tools/qdoc3/webxmlgenerator.cpp +++ /dev/null @@ -1,1195 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - webxmlgenerator.cpp -*/ - -#include "codemarker.h" -#include "pagegenerator.h" -#include "webxmlgenerator.h" -#include "node.h" -#include "separator.h" -#include "tree.h" - -#include - -QT_BEGIN_NAMESPACE - -#define COMMAND_VERSION Doc::alias("version") - -WebXMLGenerator::WebXMLGenerator() - : PageGenerator() -{ -} - -WebXMLGenerator::~WebXMLGenerator() -{ -} - -void WebXMLGenerator::initializeGenerator(const Config &config) -{ - Generator::initializeGenerator(config); - - project = config.getString(CONFIG_PROJECT); - - projectDescription = config.getString(CONFIG_DESCRIPTION); - if (projectDescription.isEmpty() && !project.isEmpty()) - projectDescription = project + " Reference Documentation"; - - projectUrl = config.getString(CONFIG_URL); - - generateIndex = config.getBool(CONFIG_GENERATEINDEX); -} - -void WebXMLGenerator::terminateGenerator() -{ - PageGenerator::terminateGenerator(); -} - -QString WebXMLGenerator::format() -{ - return "WebXML"; -} - -QString WebXMLGenerator::fileExtension(const Node * /* node */) const -{ - return "xml"; -} - -void WebXMLGenerator::generateTree(const Tree *tree, CodeMarker *marker) -{ - tre = tree; - moduleClassMap.clear(); - moduleNamespaceMap.clear(); - serviceClasses.clear(); - findAllClasses(tree->root()); - findAllNamespaces(tree->root()); - - PageGenerator::generateTree(tree, marker); - - if (generateIndex) - tre->generateIndex(outputDir() + "/" + project.toLower() + ".index", - projectUrl, projectDescription, false); -} - -void WebXMLGenerator::startText(const Node *relative, CodeMarker *marker) -{ - inLink = false; - inContents = false; - inSectionHeading = false; - numTableRows = 0; - sectionNumber.clear(); - PageGenerator::startText(relative, marker); -} - -int WebXMLGenerator::generateAtom(QXmlStreamWriter &writer, const Atom *atom, - const Node *relative, CodeMarker *marker) -{ - Q_UNUSED(writer); - - int skipAhead = 0; - - switch (atom->type()) { - default: - PageGenerator::generateAtom(atom, relative, marker); - } - return skipAhead; -} - -void WebXMLGenerator::generateClassLikeNode(const InnerNode *inner, - CodeMarker *marker) -{ - QByteArray data; - QXmlStreamWriter writer(&data); - writer.setAutoFormatting(true); - writer.writeStartDocument(); - writer.writeStartElement("WebXML"); - writer.writeStartElement("document"); - - generateIndexSections(writer, inner, marker); - - writer.writeEndElement(); // document - writer.writeEndElement(); // WebXML - writer.writeEndDocument(); - - out() << data; - out().flush(); -} - -void WebXMLGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) -{ - QByteArray data; - QXmlStreamWriter writer(&data); - writer.setAutoFormatting(true); - writer.writeStartDocument(); - writer.writeStartElement("WebXML"); - writer.writeStartElement("document"); - - generateIndexSections(writer, fake, marker); - - writer.writeEndElement(); // document - writer.writeEndElement(); // WebXML - writer.writeEndDocument(); - - out() << data; - out().flush(); -} - -void WebXMLGenerator::generateIndexSections(QXmlStreamWriter &writer, - const Node *node, CodeMarker *marker) -{ - if (tre->generateIndexSection(writer, node, true)) { - - // Add documentation to this node if it exists. - writer.writeStartElement("description"); - writer.writeAttribute("path", node->doc().location().filePath()); - writer.writeAttribute("line", QString::number(node->doc().location().lineNo())); - writer.writeAttribute("column", QString::number(node->doc().location().columnNo())); - - if (node->type() == Node::Fake) { - - const FakeNode *fake = static_cast(node); - - generateRelations(writer, node, marker); - - if (fake->subType() == Node::Module) { - writer.writeStartElement("generatedlist"); - writer.writeAttribute("contents", "classesbymodule"); - - if (moduleNamespaceMap.contains(fake->name())) { - writer.writeStartElement("section"); - writer.writeStartElement("heading"); - writer.writeAttribute("level", "1"); - writer.writeCharacters("Namespaces"); - writer.writeEndElement(); // heading - generateAnnotatedList(writer, fake, marker, moduleNamespaceMap[fake->name()]); - writer.writeEndElement(); // section - } - if (moduleClassMap.contains(fake->name())) { - writer.writeStartElement("section"); - writer.writeStartElement("heading"); - writer.writeAttribute("level", "1"); - writer.writeCharacters("Classes"); - writer.writeEndElement(); // heading - generateAnnotatedList(writer, fake, marker, moduleClassMap[fake->name()]); - writer.writeEndElement(); // section - } - - writer.writeEndElement(); // generatedlist - } - } - - startText(node, marker); - - const Atom *atom = node->doc().body().firstAtom(); - while (atom) - atom = addAtomElements(writer, atom, node, marker); - - QList alsoList = node->doc().alsoList(); - supplementAlsoList(node, alsoList); - - if (!alsoList.isEmpty()) { - writer.writeStartElement("see-also"); - for (int i = 0; i < alsoList.size(); ++i) { - const Atom *atom = alsoList.at(i).firstAtom(); - while (atom) - atom = addAtomElements(writer, atom, node, marker); - } - writer.writeEndElement(); // see-also - } - - writer.writeEndElement(); // description - - if (node->isInnerNode()) { - const InnerNode *inner = static_cast(node); - - // Recurse to generate an element for this child node and all its children. - foreach (const Node *child, inner->childNodes()) - generateIndexSections(writer, child, marker); - - writer.writeStartElement("related"); - if (inner->relatedNodes().size() > 0) { - foreach (const Node *child, inner->relatedNodes()) - generateIndexSections(writer, child, marker); - } - writer.writeEndElement(); // related - } - writer.writeEndElement(); - } -} - -void WebXMLGenerator::generateInnerNode(const InnerNode *node, CodeMarker *marker) -{ - if (!node->url().isNull()) - return; - - if (node->type() == Node::Fake) { - const FakeNode *fakeNode = static_cast(node); - if (fakeNode->subType() == Node::ExternalPage) - return; - } - - if ( node->parent() != 0 ) { - beginSubPage( node->location(), fileName(node) ); - if ( node->type() == Node::Namespace || node->type() == Node::Class) { - generateClassLikeNode(node, marker); - } else if ( node->type() == Node::Fake ) { - generateFakeNode(static_cast(node), marker); - } - endSubPage(); - } - - NodeList::ConstIterator c = node->childNodes().begin(); - while ( c != node->childNodes().end() ) { - if ((*c)->isInnerNode() && ( - (*c)->access() != Node::Private || (*c)->status() == Node::Internal)) - generateInnerNode( (const InnerNode *) *c, marker ); - ++c; - } -} - -const Atom *WebXMLGenerator::addAtomElements(QXmlStreamWriter &writer, - const Atom *atom, const Node *relative, CodeMarker *marker) -{ - switch (atom->type()) { - case Atom::AbstractLeft: - case Atom::AbstractRight: - break; - case Atom::AutoLink: - if (!inLink && !inSectionHeading) { - const Node *node = findNode(atom, relative, marker); - if (node) { - startLink(writer, atom, node, relative); - if (inLink) { - writer.writeCharacters(atom->string()); - writer.writeEndElement(); // link - inLink = false; - } - } else - writer.writeCharacters(atom->string()); - } else - writer.writeCharacters(atom->string()); - break; - case Atom::BaseName: - break; - case Atom::BriefLeft: - - writer.writeStartElement("brief"); - switch (relative->type()) { - case Node::Property: - writer.writeCharacters("This property"); - break; - case Node::Variable: - writer.writeCharacters("This variable"); - break; - default: - break; - } - if (relative->type() == Node::Property || relative->type() == Node::Variable) { - QString str; - const Atom *a = atom->next(); - while (a != 0 && a->type() != Atom::BriefRight) { - if (a->type() == Atom::String || a->type() == Atom::AutoLink) - str += a->string(); - a = a->next(); - } - str[0] = str[0].toLower(); - if (str.right(1) == ".") - str.chop(1); - - QStringList words = str.split(" "); - if (!(words.first() == "contains" || words.first() == "specifies" - || words.first() == "describes" || words.first() == "defines" - || words.first() == "holds" || words.first() == "determines")) - writer.writeCharacters(" holds "); - else - writer.writeCharacters(" "); - } - break; - - case Atom::BriefRight: - if (relative->type() == Node::Property || relative->type() == Node::Variable) - writer.writeCharacters("."); - - writer.writeEndElement(); // brief - break; - - case Atom::C: - writer.writeStartElement("teletype"); - if (inLink) - writer.writeAttribute("type", "normal"); - else - writer.writeAttribute("type", "highlighted"); - - writer.writeCharacters(plainCode(atom->string())); - writer.writeEndElement(); // teletype - break; - - case Atom::Code: - writer.writeTextElement("code", trimmedTrailing(plainCode(atom->string()))); - break; - -#ifdef QDOC_QML - case Atom::Qml: - writer.writeTextElement("qml", trimmedTrailing(plainCode(atom->string()))); -#endif - - case Atom::CodeBad: - writer.writeTextElement("badcode", trimmedTrailing(plainCode(atom->string()))); - break; - - case Atom::CodeNew: - writer.writeTextElement("para", "you can rewrite it as"); - writer.writeTextElement("newcode", trimmedTrailing(plainCode(atom->string()))); - break; - - case Atom::CodeOld: - writer.writeTextElement("para", "For example, if you have code like"); - writer.writeTextElement("oldcode", trimmedTrailing(plainCode(atom->string()))); - break; - - case Atom::CodeQuoteArgument: - if (quoteCommand == "dots") { - writer.writeAttribute("indent", atom->string()); - writer.writeCharacters("..."); - } else - writer.writeCharacters(atom->string()); - writer.writeEndElement(); // code - break; - - case Atom::CodeQuoteCommand: - quoteCommand = atom->string(); - writer.writeStartElement(quoteCommand); - break; - - case Atom::FootnoteLeft: - writer.writeStartElement("footnote"); - break; - - case Atom::FootnoteRight: - writer.writeEndElement(); // footnote - break; -/* - case Atom::FormatElse: - writer.writeStartElement("else"); - writer.writeEndElement(); // else - break; -*/ - case Atom::FormatEndif: - writer.writeEndElement(); // raw - break; - case Atom::FormatIf: - writer.writeStartElement("raw"); - writer.writeAttribute("format", atom->string()); - break; - case Atom::FormattingLeft: - { - if (atom->string() == ATOM_FORMATTING_BOLD) - writer.writeStartElement("bold"); - else if (atom->string() == ATOM_FORMATTING_ITALIC) - writer.writeStartElement("italic"); - else if (atom->string() == ATOM_FORMATTING_UNDERLINE) - writer.writeStartElement("underline"); - else if (atom->string() == ATOM_FORMATTING_SUBSCRIPT) - writer.writeStartElement("subscript"); - else if (atom->string() == ATOM_FORMATTING_SUPERSCRIPT) - writer.writeStartElement("superscript"); - else if (atom->string() == ATOM_FORMATTING_TELETYPE) - writer.writeStartElement("teletype"); - else if (atom->string() == ATOM_FORMATTING_PARAMETER) - writer.writeStartElement("argument"); - else if (atom->string() == ATOM_FORMATTING_INDEX) - writer.writeStartElement("index"); - } - break; -/* out() << formattingLeftMap()[atom->string()]; - if ( atom->string() == ATOM_FORMATTING_PARAMETER ) { - if ( atom->next() != 0 && atom->next()->type() == Atom::String ) { - QRegExp subscriptRegExp( "([a-z]+)_([0-9n])" ); - if ( subscriptRegExp.exactMatch(atom->next()->string()) ) { - out() << subscriptRegExp.cap( 1 ) << "" - << subscriptRegExp.cap( 2 ) << ""; - skipAhead = 1; - } - } - }*/ - case Atom::FormattingRight: - { - if (atom->string() == ATOM_FORMATTING_BOLD) - writer.writeEndElement(); - else if (atom->string() == ATOM_FORMATTING_ITALIC) - writer.writeEndElement(); - else if (atom->string() == ATOM_FORMATTING_UNDERLINE) - writer.writeEndElement(); - else if (atom->string() == ATOM_FORMATTING_SUBSCRIPT) - writer.writeEndElement(); - else if (atom->string() == ATOM_FORMATTING_SUPERSCRIPT) - writer.writeEndElement(); - else if (atom->string() == ATOM_FORMATTING_TELETYPE) - writer.writeEndElement(); - else if (atom->string() == ATOM_FORMATTING_PARAMETER) - writer.writeEndElement(); - else if (atom->string() == ATOM_FORMATTING_INDEX) - writer.writeEndElement(); - } - if (inLink) { - writer.writeEndElement(); // link - inLink = false; - } - break; -/* if ( atom->string() == ATOM_FORMATTING_LINK ) { - if (inLink) { - if ( link.isEmpty() ) { - if (showBrokenLinks) - out() << ""; - } else { - out() << ""; - } - } - inLink = false; - } else { - out() << formattingRightMap()[atom->string()]; - }*/ - case Atom::GeneratedList: - writer.writeStartElement("generatedlist"); - writer.writeAttribute("contents", atom->string()); - writer.writeEndElement(); // generatedlist -/* - if (atom->string() == "annotatedclasses") { - generateAnnotatedList(relative, marker, nonCompatClasses); - } else if (atom->string() == "classes") { - generateCompactList(relative, marker, nonCompatClasses); - } else if (atom->string().contains("classesbymodule")) { - QString arg = atom->string().trimmed(); - QString moduleName = atom->string().mid(atom->string().indexOf( - "classesbymodule") + 15).trimmed(); - if (moduleClassMap.contains(moduleName)) - generateAnnotatedList(relative, marker, moduleClassMap[moduleName]); - } else if (atom->string().contains("classesbyedition")) { - QString arg = atom->string().trimmed(); - QString editionName = atom->string().mid(atom->string().indexOf( - "classesbyedition") + 16).trimmed(); - if (editionModuleMap.contains(editionName)) { - QMap editionClasses; - foreach (const QString &moduleName, editionModuleMap[editionName]) { - if (moduleClassMap.contains(moduleName)) - editionClasses.unite(moduleClassMap[moduleName]); - } - generateAnnotatedList(relative, marker, editionClasses); - } - } else if (atom->string() == "classhierarchy") { - generateClassHierarchy(relative, marker, nonCompatClasses); - } else if (atom->string() == "compatclasses") { - generateCompactList(relative, marker, compatClasses); - } else if (atom->string() == "functionindex") { - generateFunctionIndex(relative, marker); - } else if (atom->string() == "legalese") { - generateLegaleseList(relative, marker); - } else if (atom->string() == "mainclasses") { - generateCompactList(relative, marker, mainClasses); - } else if (atom->string() == "services") { - generateCompactList(relative, marker, serviceClasses); - } else if (atom->string() == "overviews") { - generateOverviewList(relative, marker); - } else if (atom->string() == "namespaces") { - generateAnnotatedList(relative, marker, namespaceIndex); - } else if (atom->string() == "related") { - const FakeNode *fake = static_cast(relative); - if (fake && !fake->groupMembers().isEmpty()) { - QMap groupMembersMap; - foreach (Node *node, fake->groupMembers()) { - if (node->type() == Node::Fake) - groupMembersMap[fullName(node, relative, marker)] = node; - } - generateAnnotatedList(fake, marker, groupMembersMap); - } - } else if (atom->string() == "relatedinline") { - const FakeNode *fake = static_cast(relative); - if (fake && !fake->groupMembers().isEmpty()) { - // Reverse the list into the original scan order. - // Should be sorted. But on what? It may not be a - // regular class or page definition. - QList list; - foreach (const Node *node, fake->groupMembers()) - list.prepend(node); - foreach (const Node *node, list) - generateBody(node, marker ); - } - } - break; -*/ - break; - case Atom::Image: - writer.writeStartElement("image"); - writer.writeAttribute("href", imageFileName(relative, atom->string())); - writer.writeEndElement(); // image - break; - - case Atom::InlineImage: - writer.writeStartElement("inlineimage"); - writer.writeAttribute("href", imageFileName(relative, atom->string())); - writer.writeEndElement(); // inlineimage - break; - - case Atom::ImageText: - break; - - case Atom::LegaleseLeft: - writer.writeStartElement("legalese"); - break; - - case Atom::LegaleseRight: - writer.writeEndElement(); // legalese - break; - - case Atom::Link: - case Atom::LinkNode: - if (!inLink) { - const Node *node = findNode(atom, relative, marker); - if (node) - startLink(writer, atom, node, relative); - } - break; - - case Atom::ListLeft: - writer.writeStartElement("list"); - - if (atom->string() == ATOM_LIST_BULLET) - writer.writeAttribute("type", "bullet"); - else if (atom->string() == ATOM_LIST_TAG) - writer.writeAttribute("type", "definition"); - else if (atom->string() == ATOM_LIST_VALUE) - writer.writeAttribute("type", "enum"); - else { - writer.writeAttribute("type", "ordered"); - if (atom->string() == ATOM_LIST_UPPERALPHA) - writer.writeAttribute("start", "A"); - else if (atom->string() == ATOM_LIST_LOWERALPHA) - writer.writeAttribute("start", "a"); - else if (atom->string() == ATOM_LIST_UPPERROMAN) - writer.writeAttribute("start", "I"); - else if (atom->string() == ATOM_LIST_LOWERROMAN) - writer.writeAttribute("start", "i"); - else // (atom->string() == ATOM_LIST_NUMERIC) - writer.writeAttribute("start", "1"); - } - break; - - case Atom::ListItemNumber: - break; - - case Atom::ListTagLeft: - { - writer.writeStartElement("definition"); - - writer.writeTextElement("term", plainCode( - marker->markedUpEnumValue(atom->next()->string(), relative))); - } - break; - - case Atom::ListTagRight: - writer.writeEndElement(); // definition - break; - - case Atom::ListItemLeft: - writer.writeStartElement("item"); - break; - - case Atom::ListItemRight: - writer.writeEndElement(); // item - break; - - case Atom::ListRight: - writer.writeEndElement(); // list - break; - - case Atom::Nop: - break; - - case Atom::ParaLeft: - writer.writeStartElement("para"); - break; - - case Atom::ParaRight: - writer.writeEndElement(); // para - break; - - case Atom::QuotationLeft: - writer.writeStartElement("quote"); - break; - - case Atom::QuotationRight: - writer.writeEndElement(); // quote - break; - - case Atom::RawString: - writer.writeCharacters(atom->string()); - break; - - case Atom::SectionLeft: - writer.writeStartElement("section"); - writer.writeAttribute("id", Doc::canonicalTitle(Text::sectionHeading(atom).toString())); - break; - - case Atom::SectionRight: - writer.writeEndElement(); // section - break; - - case Atom::SectionHeadingLeft: - writer.writeStartElement("heading"); - writer.writeAttribute("level", atom->string()); // + hOffset(relative) - inSectionHeading = true; - break; - - case Atom::SectionHeadingRight: - writer.writeEndElement(); // heading - inSectionHeading = false; - break; - - case Atom::SidebarLeft: - case Atom::SidebarRight: - break; - - case Atom::SnippetCommand: - writer.writeStartElement(atom->string()); - break; - - case Atom::SnippetIdentifier: - writer.writeAttribute("identifier", atom->string()); - writer.writeEndElement(); // snippet - break; - - case Atom::SnippetLocation: - writer.writeAttribute("location", atom->string()); - break; - - case Atom::String: - writer.writeCharacters(atom->string()); - break; - - case Atom::TableLeft: - writer.writeStartElement("table"); - if (atom->string().contains("%")) - writer.writeAttribute("width", atom->string()); - break; - - case Atom::TableRight: - writer.writeEndElement(); // table - break; - - case Atom::TableHeaderLeft: - writer.writeStartElement("header"); - break; - - case Atom::TableHeaderRight: - writer.writeEndElement(); // header - break; - - case Atom::TableRowLeft: - writer.writeStartElement("row"); - break; - - case Atom::TableRowRight: - writer.writeEndElement(); // row - break; - - case Atom::TableItemLeft: - { - writer.writeStartElement("item"); - QStringList spans = atom->string().split(","); - if (spans.size() == 2) { - if (spans.at(0) != "1") - writer.writeAttribute("colspan", spans.at(0).trimmed()); - if (spans.at(1) != "1") - writer.writeAttribute("rowspan", spans.at(1).trimmed()); - } - } - break; - - case Atom::TableItemRight: - writer.writeEndElement(); // item - break; - - case Atom::TableOfContents: - writer.writeStartElement("tableofcontents"); - writer.writeAttribute("details", atom->string()); - { - int numColumns = 1; - const Node *node = relative; - - Doc::SectioningUnit sectioningUnit = Doc::Section4; - QStringList params = atom->string().split(","); - QString columnText = params.at(0); - QStringList pieces = columnText.split(" ", QString::SkipEmptyParts); - if (pieces.size() >= 2) { - columnText = pieces.at(0); - pieces.pop_front(); - QString path = pieces.join(" ").trimmed(); - node = findNode(path, relative, marker); - if (node) - writer.writeAttribute("href", fileName(node)); - } - - if (params.size() == 2) { - numColumns = qMax(columnText.toInt(), numColumns); - sectioningUnit = (Doc::SectioningUnit)params.at(1).toInt(); - writer.writeAttribute("columns", QString::number(numColumns)); - writer.writeAttribute("unit", QString::number(sectioningUnit)); - } - - if (node) - generateTableOfContents(writer, node, sectioningUnit, numColumns, - relative); - } - writer.writeEndElement(); // tableofcontents - break; - - case Atom::Target: - writer.writeStartElement("target"); - writer.writeAttribute("name", Doc::canonicalTitle(atom->string())); - writer.writeEndElement(); // target - break; - - case Atom::UnhandledFormat: - case Atom::UnknownCommand: - writer.writeCharacters(atom->typeString()); - break; - default: - break; - } - - if (atom) - return atom->next(); - - return 0; -} -/* - QDomElement atomElement = document.createElement(atom->typeString().toLower()); - QDomText atomValue = document.createTextNode(atom->string()); - atomElement.appendChild(atomValue); - descriptionElement.appendChild(atomElement); -*/ - -/* - ### Warning: findNode() is a modified version of HtmlGenerator::getLink(). -*/ -const Node *WebXMLGenerator::findNode(const Atom *atom, const Node *relative, CodeMarker *marker) -{ - return findNode(atom->string(), relative, marker); -} - -const Node *WebXMLGenerator::findNode(const QString &title, const Node *relative, CodeMarker *marker) -{ - QString link; - if (title.contains(":") && - (title.startsWith("file:") - || title.startsWith("http:") - || title.startsWith("https:") - || title.startsWith("ftp:") - || title.startsWith("mailto:"))) { - - return 0; - } else if (title.count('@') == 1) { - return 0; - } else { - QStringList path; - if (title.contains('#')) { - path = title.split('#'); - } else { - path.append(title); - } - - const Node *node = 0; - Atom *targetAtom = 0; - - QString first = path.first().trimmed(); - if (first.isEmpty()) { - node = relative; - } else if (first.endsWith(".html")) { - node = tre->root()->findNode(first, Node::Fake); - } else { - node = marker->resolveTarget(first, tre, relative); - if (!node) - node = tre->findFakeNodeByTitle(first); - if (!node) - node = tre->findUnambiguousTarget(first, targetAtom); - } - - if (node) { - if (!node->url().isEmpty()) - return node; - else - path.removeFirst(); - } else { - return 0; - } - - while (!path.isEmpty()) { - targetAtom = tre->findTarget(path.first(), node); - if (targetAtom == 0) - break; - path.removeFirst(); - } -/* We would ideally treat targets as nodes to be consistent. - if (targetAtom && node && node->isInnerNode()) { - Node *parentNode = const_cast(node); - node = new TargetNode(static_cast(parentNode), first); - } -*/ - return node; - } - return 0; -} - -void WebXMLGenerator::startLink(QXmlStreamWriter &writer, const Atom *atom, - const Node *node, const Node *relative) -{ - QString location = tre->fullDocumentLocation(node); - if (!location.isEmpty()) { - writer.writeStartElement("link"); - writer.writeAttribute("raw", atom->string()); - if (atom->string().contains("#") || node == relative) { - QString target = atom->string().split("#").last(); - Atom *targetAtom = tre->findTarget(target, node); - if (targetAtom) - location += "#" + Doc::canonicalTitle(target); - } - writer.writeAttribute("href", location); - QString type = targetType(node); - writer.writeAttribute("type", type); - switch (node->type()) { - case Node::Enum: - writer.writeAttribute("enum", tre->fullDocumentName(node)); - break; - case Node::Fake: - writer.writeAttribute("page", tre->fullDocumentName(node)); - break; - case Node::Property: - { - const PropertyNode *propertyNode = static_cast(node); - if (propertyNode->getters().size() > 0) - writer.writeAttribute("getter", tre->fullDocumentName(propertyNode->getters()[0])); - } - default: - ; - } - inLink = true; - } -} - -QString WebXMLGenerator::targetType(const Node *node) -{ - switch (node->type()) { - case Node::Namespace: - return "namespace"; - break; - case Node::Class: - return "class"; - break; - case Node::Fake: - return "page"; - break; - case Node::Enum: - return "enum"; - break; - case Node::Typedef: - return "typedef"; - break; - case Node::Property: - return "property"; - break; - case Node::Function: - return "function"; - break; - case Node::Variable: - return "variable"; - break; - case Node::Target: - return "target"; - break; - default: - return ""; - } - return ""; -} - -void WebXMLGenerator::generateRelations(QXmlStreamWriter &writer, const Node *node, CodeMarker *marker) -{ - if (node && !node->links().empty()) { - QPair linkPair; - QPair anchorPair; - const Node *linkNode; - - foreach (Node::LinkType relation, node->links().keys()) { - - linkPair = node->links()[relation]; - linkNode = findNode(linkPair.first, node, marker); - - if (!linkNode) - linkNode = node; - - if (linkNode == node) - anchorPair = linkPair; - else - anchorPair = anchorForNode(linkNode); - - writer.writeStartElement("relation"); - writer.writeAttribute("href", anchorPair.first); - writer.writeAttribute("type", targetType(linkNode)); - - switch (relation) { - case Node::StartLink: - writer.writeAttribute("meta", "start"); - break; - case Node::NextLink: - writer.writeAttribute("meta", "next"); - break; - case Node::PreviousLink: - writer.writeAttribute("meta", "previous"); - break; - case Node::ContentsLink: - writer.writeAttribute("meta", "contents"); - break; - case Node::IndexLink: - writer.writeAttribute("meta", "index"); - break; - default: - writer.writeAttribute("meta", ""); - } - writer.writeAttribute("description", anchorPair.second); - writer.writeEndElement(); // link - } - } -} - -// Classes adapted from HtmlGenerator. - -void WebXMLGenerator::generateTableOfContents(QXmlStreamWriter &writer, const Node *node, - Doc::SectioningUnit sectioningUnit, - int numColumns, const Node *relative) - -{ - if (!node->doc().hasTableOfContents()) - return; - QList toc = node->doc().tableOfContents(); - if (toc.isEmpty()) - return; - - QString nodeName = ""; - if (node != relative) - nodeName = node->name(); - - QStringList sectionNumber; - int columnSize = 0; - - if (numColumns > 1) { - writer.writeStartElement("table"); - writer.writeAttribute("width", "100%"); - writer.writeStartElement("row"); - writer.writeStartElement("item"); - writer.writeAttribute("width", QString::number((100 + numColumns - 1) / numColumns) + "%"); - } - - // disable nested links in table of contents - inContents = true; - inLink = true; - - for (int i = 0; i < toc.size(); ++i) { - Atom *atom = toc.at(i); - - int nextLevel = atom->string().toInt(); - if (nextLevel > (int)sectioningUnit) - continue; - - if (sectionNumber.size() < nextLevel) { - do { - writer.writeStartElement("list"); - sectionNumber.append("1"); - } while (sectionNumber.size() < nextLevel); - } else { - while (sectionNumber.size() > nextLevel) { - writer.writeEndElement(); - sectionNumber.removeLast(); - } - sectionNumber.last() = QString::number(sectionNumber.last().toInt() + 1); - } - Text headingText = Text::sectionHeading(atom); - - if (sectionNumber.size() == 1 && columnSize > toc.size() / numColumns) { - writer.writeEndElement(); // list - writer.writeEndElement(); // item - writer.writeStartElement("item"); - writer.writeAttribute("width", QString::number((100 + numColumns - 1) / numColumns) + "%"); - writer.writeStartElement("list"); - columnSize = 0; - } - - writer.writeStartElement("item"); - writer.writeStartElement("para"); - writer.writeStartElement("link"); - writer.writeAttribute("href", nodeName + "#" + Doc::canonicalTitle(headingText.toString())); - writer.writeAttribute("type", "page"); - writer.writeCharacters(headingText.toString()); - writer.writeEndElement(); // link - writer.writeEndElement(); // para - writer.writeEndElement(); // item - - ++columnSize; - } - while (!sectionNumber.isEmpty()) { - writer.writeEndElement(); // list - sectionNumber.removeLast(); - } - - if (numColumns > 1) { - writer.writeEndElement(); // item - writer.writeEndElement(); // row - writer.writeEndElement(); // table - } - - inContents = false; - inLink = false; -} - -void WebXMLGenerator::generateAnnotatedList(QXmlStreamWriter &writer, - const Node *relative, CodeMarker *marker, const QMap &nodeMap) -{ - writer.writeStartElement("table"); - writer.writeAttribute("width", "100%"); - - foreach (QString name, nodeMap.keys()) { - const Node *node = nodeMap[name]; - - writer.writeStartElement("row"); - writer.writeStartElement("heading"); - generateFullName(writer, node, relative, marker); - writer.writeEndElement(); // heading - - writer.writeStartElement("item"); - writer.writeCharacters(node->doc().briefText().toString()); - writer.writeEndElement(); // item - writer.writeEndElement(); // row - } - writer.writeEndElement(); // table -} - -void WebXMLGenerator::generateFullName(QXmlStreamWriter &writer, - const Node *apparentNode, const Node *relative, CodeMarker *marker, - const Node *actualNode) -{ - if ( actualNode == 0 ) - actualNode = apparentNode; - writer.writeStartElement("link"); - writer.writeAttribute("href", tre->fullDocumentLocation(actualNode)); - writer.writeAttribute("type", targetType(actualNode)); - writer.writeCharacters(fullName(apparentNode, relative, marker)); - writer.writeEndElement(); // link -} - -// Classes copied (and slightly adapted) from the HtmlGenerator. These need -// refactoring into a common ancestor class. - -void WebXMLGenerator::findAllClasses(const InnerNode *node) -{ - NodeList::const_iterator c = node->childNodes().constBegin(); - while (c != node->childNodes().constEnd()) { - if ((*c)->access() != Node::Private && (*c)->url().isEmpty()) { - if ((*c)->type() == Node::Class && !(*c)->doc().isEmpty()) { - QString className = (*c)->name(); - if ((*c)->parent() && (*c)->parent()->type() == Node::Namespace && - !(*c)->parent()->name().isEmpty()) - className = (*c)->parent()->name()+"::"+className; - - QString moduleName = (*c)->moduleName(); - if (!moduleName.isEmpty()) - moduleClassMap[moduleName].insert((*c)->name(), *c); - - QString serviceName = - (static_cast(*c))->serviceName(); - if (!serviceName.isEmpty()) - serviceClasses.insert(serviceName, *c); - } else if ((*c)->isInnerNode()) { - findAllClasses(static_cast(*c)); - } - } - ++c; - } -} - -void WebXMLGenerator::findAllNamespaces(const InnerNode *node) -{ - NodeList::ConstIterator c = node->childNodes().begin(); - while (c != node->childNodes().end()) { - if ((*c)->access() != Node::Private) { - if ((*c)->isInnerNode() && (*c)->url().isEmpty()) { - findAllNamespaces(static_cast(*c)); - if ((*c)->type() == Node::Namespace) { - const NamespaceNode *nspace = static_cast(*c); - // Ensure that the namespace's name is not empty (the root - // namespace has no name). - if (!nspace->name().isEmpty()) { - namespaceIndex.insert(nspace->name(), *c); - QString moduleName = (*c)->moduleName(); - if (!moduleName.isEmpty()) - moduleNamespaceMap[moduleName].insert((*c)->name(), *c); - } - } - } - } - ++c; - } -} - -const QPair WebXMLGenerator::anchorForNode(const Node *node) -{ - QPair anchorPair; - - anchorPair.first = PageGenerator::fileName(node); - if (node->type() == Node::Fake) { - const FakeNode *fakeNode = static_cast(node); - anchorPair.second = fakeNode->title(); - } - - return anchorPair; -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/webxmlgenerator.h b/tools/qdoc3/webxmlgenerator.h deleted file mode 100644 index 071896a..0000000 --- a/tools/qdoc3/webxmlgenerator.h +++ /dev/null @@ -1,127 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - WebXMLGenerator.h -*/ - -#ifndef WEBXMLGENERATOR_H -#define WEBXMLGENERATOR_H - -#include - -#include "codemarker.h" -#include "config.h" -#include "pagegenerator.h" - -QT_BEGIN_NAMESPACE - -class QXmlStreamReader; -class QXmlStreamWriter; - -class WebXMLGenerator : public PageGenerator -{ -public: - WebXMLGenerator(); - ~WebXMLGenerator(); - - virtual void initializeGenerator(const Config &config); - virtual void terminateGenerator(); - virtual QString format(); - virtual void generateTree(const Tree *tree, CodeMarker *marker); - -protected: - virtual void startText( const Node *relative, CodeMarker *marker ); - virtual int generateAtom(QXmlStreamWriter &writer, const Atom *atom, - const Node *relative, CodeMarker *marker ); - virtual void generateClassLikeNode(const InnerNode *inner, CodeMarker *marker); - virtual void generateFakeNode(const FakeNode *fake, CodeMarker *marker); - virtual QString fileExtension(const Node *node) const; - - virtual const Atom *addAtomElements(QXmlStreamWriter &writer, const Atom *atom, - const Node *relative, CodeMarker *marker); - virtual void generateIndexSections(QXmlStreamWriter &writer, const Node *node, - CodeMarker *marker); - virtual void generateInnerNode( const InnerNode *node, CodeMarker *marker ); - -private: - const QPair anchorForNode(const Node *node); - void findAllClasses(const InnerNode *node); - void findAllNamespaces(const InnerNode *node); - const Node *findNode(const Atom *atom, const Node *relative, CodeMarker *marker); - const Node *findNode(const QString &title, const Node *relative, CodeMarker *marker); - void generateAnnotatedList(QXmlStreamWriter &writer, const Node *relative, - CodeMarker *marker, const QMap &nodeMap); - void generateFullName(QXmlStreamWriter &writer, const Node *apparentNode, - const Node *relative, CodeMarker *marker, - const Node *actualNode = 0); - void generateRelations(QXmlStreamWriter &writer, const Node *node, CodeMarker *marker); - void generateTableOfContents(QXmlStreamWriter &writer, const Node *node, - Doc::SectioningUnit sectioningUnit, - int numColumns, const Node *relative); - void startLink(QXmlStreamWriter &writer, const Atom *atom, const Node *node, - const Node *relative); - QString targetType(const Node *node); - - const Tree *tre; - bool generateIndex; - bool inLink; - bool inContents; - bool inSectionHeading; - bool inTableHeader; - int numTableRows; - bool threeColumnEnumValueTable; - QMap > moduleClassMap; - QMap > moduleNamespaceMap; - QMap namespaceIndex; - QMap serviceClasses; - QString link; - QString project; - QString projectDescription; - QString projectUrl; - QString quoteCommand; - QStringList sectionNumber; -}; - -QT_END_NAMESPACE - -#endif -- cgit v0.12 From c9ff1b8851b166b786864ee7bbe0eceb0220660e Mon Sep 17 00:00:00 2001 From: David Boddie Date: Fri, 19 Nov 2010 19:04:03 +0100 Subject: Updated code comments. --- tools/qdoc3/quoter.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tools/qdoc3/quoter.cpp b/tools/qdoc3/quoter.cpp index b8055a7..6dc7894 100644 --- a/tools/qdoc3/quoter.cpp +++ b/tools/qdoc3/quoter.cpp @@ -41,7 +41,6 @@ #include #include -#include #include "quoter.h" @@ -123,9 +122,9 @@ Quoter::Quoter() /* We're going to hard code these delimiters: * C++, Qt, Qt Script, Java: //! [] - * .pro files: + * .pro, .py files: #! [] - * .xq, .xml, .html files: + * .html, .qrc, .ui, .xq, .xml files: */ commentHash["pro"] = "#!"; -- cgit v0.12 From 6a5aebd47fca17663074c323795e37f3581154c2 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Fri, 19 Nov 2010 19:04:23 +0100 Subject: Improved translation support, using the application object if possible. --- tools/qdoc3/tr.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tools/qdoc3/tr.h b/tools/qdoc3/tr.h index 4d601e9..4ba7aa4 100644 --- a/tools/qdoc3/tr.h +++ b/tools/qdoc3/tr.h @@ -46,14 +46,26 @@ #ifndef TR_H #define TR_H +#ifndef QT_BOOTSTRAPPED +# include "qcoreapplication.h" +#endif + #include QT_BEGIN_NAMESPACE -inline QString tr( const char *sourceText, const char * /* comment */ = 0 ) +#if defined(QT_BOOTSTRAPPED) || defined(QT_NO_TRANSLATION) +inline QString tr(const char *sourceText, const char *comment = 0) { + Q_UNUSED(comment); return QString( QLatin1String(sourceText) ); } +#else +inline QString tr(const char *sourceText, const char *comment = 0) +{ + return QCoreApplication::instance()->translate("", sourceText, comment); +} +#endif QT_END_NAMESPACE -- cgit v0.12 From 93093b972cae3c1362c5d443ed8288b4694b2735 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Fri, 19 Nov 2010 19:57:38 +0100 Subject: Removed the unused C code parser. --- tools/qdoc3/ccodeparser.cpp | 73 --------------------------------------------- tools/qdoc3/ccodeparser.h | 66 ---------------------------------------- tools/qdoc3/qdoc3.pro | 2 -- 3 files changed, 141 deletions(-) delete mode 100644 tools/qdoc3/ccodeparser.cpp delete mode 100644 tools/qdoc3/ccodeparser.h diff --git a/tools/qdoc3/ccodeparser.cpp b/tools/qdoc3/ccodeparser.cpp deleted file mode 100644 index 48aa539..0000000 --- a/tools/qdoc3/ccodeparser.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - ccodeparser.cpp -*/ - -#include "ccodeparser.h" - -QT_BEGIN_NAMESPACE - -CCodeParser::CCodeParser() -{ -} - -CCodeParser::~CCodeParser() -{ -} - -QString CCodeParser::language() -{ - return QLatin1String("C"); -} - -QString CCodeParser::headerFileNameFilter() -{ - return QLatin1String("*.ch *.h"); -} - -QString CCodeParser::sourceFileNameFilter() -{ - return QLatin1String("*.c"); -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/ccodeparser.h b/tools/qdoc3/ccodeparser.h deleted file mode 100644 index 1771fc9..0000000 --- a/tools/qdoc3/ccodeparser.h +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - ccodeparser.h -*/ - -#ifndef CCODEPARSER_H -#define CCODEPARSER_H - -#include "cppcodeparser.h" - -QT_BEGIN_NAMESPACE - -class CCodeParser : public CppCodeParser -{ -public: - CCodeParser(); - ~CCodeParser(); - - virtual QString language(); - virtual QString headerFileNameFilter(); - virtual QString sourceFileNameFilter(); -}; - -QT_END_NAMESPACE - -#endif diff --git a/tools/qdoc3/qdoc3.pro b/tools/qdoc3/qdoc3.pro index 77c95f8..074fdf6 100644 --- a/tools/qdoc3/qdoc3.pro +++ b/tools/qdoc3/qdoc3.pro @@ -25,7 +25,6 @@ build_all:!build_pass { CONFIG -= app_bundle HEADERS += atom.h \ - ccodeparser.h \ codechunk.h \ codemarker.h \ codeparser.h \ @@ -51,7 +50,6 @@ HEADERS += atom.h \ tr.h \ tree.h SOURCES += atom.cpp \ - ccodeparser.cpp \ codechunk.cpp \ codemarker.cpp \ codeparser.cpp \ -- cgit v0.12 From 035a1416bbe95771649da7e3bfb3ed5c19ab4524 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Fri, 19 Nov 2010 20:15:14 +0100 Subject: Removed unused functions. --- tools/qdoc3/command.cpp | 103 ------------------------------------------------ tools/qdoc3/command.h | 60 ---------------------------- tools/qdoc3/qdoc3.pro | 2 - 3 files changed, 165 deletions(-) delete mode 100644 tools/qdoc3/command.cpp delete mode 100644 tools/qdoc3/command.h diff --git a/tools/qdoc3/command.cpp b/tools/qdoc3/command.cpp deleted file mode 100644 index b78ad07..0000000 --- a/tools/qdoc3/command.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - command.cpp -*/ - -#include - -#include "command.h" - -#include - -QT_BEGIN_NAMESPACE - -void executeCommand(const Location& location, - const QString& format, - const QStringList& args) -{ - QString actualCommand; - for (int i = 0; i < (int) format.length(); i++) { - int ch = format[i].unicode(); - if (ch > 0 && ch < 8) { - actualCommand += args[ch - 1]; - } - else { - actualCommand += format[i]; - } - } - - QString toolName = actualCommand; - int space = toolName.indexOf(QLatin1Char(' ')); - if (space != -1) - toolName.truncate(space); - -#ifdef QT_BOOTSTRAPPED - int status = system(qPrintable(actualCommand)); - int exitCode = WEXITSTATUS(status); - if (status == -1 || exitCode != EXIT_SUCCESS) - location.fatal(QString("Error executing '$1': $2").arg(toolName).arg(exitCode)); -#else - QProcess process; - process.start(QLatin1String("sh"), - QStringList() << QLatin1String("-c") << actualCommand); - process.waitForFinished(); - - if (process.exitCode() == 127) - location.fatal(tr("Couldn't launch the '%1' tool") - .arg(toolName), - tr("Make sure the tool is installed and in the" - " path.")); - - QString errors = QString::fromLocal8Bit(process.readAllStandardError()); - while (errors.endsWith(QLatin1Char('\n'))) - errors.truncate(errors.length() - 1); - if (!errors.isEmpty()) - location.fatal(tr("The '%1' tool encountered some problems") - .arg(toolName), - tr("The tool was invoked like this:\n%1\n" - "It emitted these errors:\n%2") - .arg(actualCommand).arg(errors)); -#endif -} - -QT_END_NAMESPACE diff --git a/tools/qdoc3/command.h b/tools/qdoc3/command.h deleted file mode 100644 index 2346aff..0000000 --- a/tools/qdoc3/command.h +++ /dev/null @@ -1,60 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the tools applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - command.h -*/ - -#ifndef COMMAND_H -#define COMMAND_H - -#include - -#include "location.h" - -QT_BEGIN_NAMESPACE - -void executeCommand( const Location& location, const QString& commandFormat, - const QStringList& args ); - -QT_END_NAMESPACE - -#endif diff --git a/tools/qdoc3/qdoc3.pro b/tools/qdoc3/qdoc3.pro index 074fdf6..c9b05d2 100644 --- a/tools/qdoc3/qdoc3.pro +++ b/tools/qdoc3/qdoc3.pro @@ -28,7 +28,6 @@ HEADERS += atom.h \ codechunk.h \ codemarker.h \ codeparser.h \ - command.h \ config.h \ cppcodemarker.h \ cppcodeparser.h \ @@ -53,7 +52,6 @@ SOURCES += atom.cpp \ codechunk.cpp \ codemarker.cpp \ codeparser.cpp \ - command.cpp \ config.cpp \ cppcodemarker.cpp \ cppcodeparser.cpp \ -- cgit v0.12 From d468fe4ca99561e9e575edc0e9d99080e93d91a3 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Mon, 22 Nov 2010 17:08:00 +0100 Subject: Removed unused code. --- tools/qdoc3/codemarker.cpp | 1 - tools/qdoc3/cppcodemarker.cpp | 15 -------- tools/qdoc3/cppcodeparser.cpp | 10 ----- tools/qdoc3/doc.cpp | 23 ------------ tools/qdoc3/generator.cpp | 14 +------ tools/qdoc3/htmlgenerator.cpp | 86 ------------------------------------------- tools/qdoc3/location.cpp | 4 -- tools/qdoc3/node.cpp | 5 --- tools/qdoc3/tree.cpp | 16 +------- 9 files changed, 2 insertions(+), 172 deletions(-) diff --git a/tools/qdoc3/codemarker.cpp b/tools/qdoc3/codemarker.cpp index ec86ae3..f1b6346 100644 --- a/tools/qdoc3/codemarker.cpp +++ b/tools/qdoc3/codemarker.cpp @@ -40,7 +40,6 @@ ****************************************************************************/ #include -#include #include "codemarker.h" #include "config.h" #include "node.h" diff --git a/tools/qdoc3/cppcodemarker.cpp b/tools/qdoc3/cppcodemarker.cpp index 3615a84..576d103 100644 --- a/tools/qdoc3/cppcodemarker.cpp +++ b/tools/qdoc3/cppcodemarker.cpp @@ -455,21 +455,6 @@ QString CppCodeMarker::functionEndRegExp(const QString& /* funcName */) return "^\\}$"; } -#if 0 - FastSection privateReimpFuncs(classe, - "Private Reimplemented Functions", - "private reimplemented function", - "private reimplemented functions"); - FastSection protectedReimpFuncs(classe, - "Protected Reimplemented Functions", - "protected reimplemented function", - "protected reimplemented functions"); - FastSection publicReimpFuncs(classe, - "Public Reimplemented Functions", - "public reimplemented function", - "public reimplemented functions"); -#endif - QList
    CppCodeMarker::sections(const InnerNode *inner, SynopsisStyle style, Status status) diff --git a/tools/qdoc3/cppcodeparser.cpp b/tools/qdoc3/cppcodeparser.cpp index a120e45..8e891b8 100644 --- a/tools/qdoc3/cppcodeparser.cpp +++ b/tools/qdoc3/cppcodeparser.cpp @@ -966,16 +966,6 @@ void CppCodeParser::processOtherMetaCommand(const Doc& doc, .arg(COMMAND_REIMP).arg(node->name())); } -#if 0 - // Reimplemented functions now reported in separate sections. - /* - Note: Setting the access to Private hides the documentation, - but setting the status to Internal makes the node available - in the XML output when the WebXMLGenerator is used. - */ - func->setAccess(Node::Private); - func->setStatus(Node::Internal); -#endif func->setReimp(true); } else { diff --git a/tools/qdoc3/doc.cpp b/tools/qdoc3/doc.cpp index 280f055..be16c59 100644 --- a/tools/qdoc3/doc.cpp +++ b/tools/qdoc3/doc.cpp @@ -1685,13 +1685,6 @@ void DocParser::startSection(Doc::SectioningUnit unit, int cmd) leavePara(); if (currentSectioningUnit == Doc::Book) { -#if 0 - // mws didn't think this was necessary. - if (unit > Doc::Section1) - location().warning(tr("Unexpected '\\%1' without '\\%2'") - .arg(cmdName(cmd)) - .arg(cmdName(CMD_SECTION1))); -#endif currentSectioningUnit = (Doc::SectioningUnit) (unit - 1); priv->constructExtra(); priv->extra->sectioningUnit = currentSectioningUnit; @@ -1866,9 +1859,6 @@ void DocParser::enterPara(Atom::Type leftType, pendingParaRightType = rightType; pendingParaString = string; if ( -#if 0 - leftType == Atom::BriefLeft || -#endif leftType == Atom::SectionHeadingLeft) { paraState = InsideSingleLinePara; } @@ -2273,12 +2263,6 @@ QString DocParser::getCode(int cmd, CodeMarker *marker) QString DocParser::getUnmarkedCode(int cmd) { QString code = getUntilEnd(cmd); -#if 0 - int indent = indentLevel(code); - if (indent < minIndent) - minIndent = indent; - code = unindent(minIndent, code); -#endif return code; } @@ -3043,13 +3027,6 @@ QString Doc::canonicalTitle(const QString &title) result += QLatin1Char('-'); dashAppended = true; } -#if 0 - // This was screwing things up. - else { - result += title[i]; - lastAlnum = result.size(); - } -#endif } result.truncate(lastAlnum); return result; diff --git a/tools/qdoc3/generator.cpp b/tools/qdoc3/generator.cpp index 74e966a..0f2454e 100644 --- a/tools/qdoc3/generator.cpp +++ b/tools/qdoc3/generator.cpp @@ -383,14 +383,7 @@ void Generator::generateBody(const Node *node, CodeMarker *marker) { bool quiet = false; - if (node->type() == Node::Function) { -#if 0 - const FunctionNode *func = (const FunctionNode *) node; - if (func->isOverload() && func->metaness() != FunctionNode::Ctor) - generateOverload(node, marker); -#endif - } - else if (node->type() == Node::Fake) { + if (node->type() == Node::Fake) { const FakeNode *fake = static_cast(node); if (fake->subType() == Node::Example) generateExampleFiles(fake, marker); @@ -510,11 +503,6 @@ void Generator::generateBody(const Node *node, CodeMarker *marker) if (!body.contains("return", Qt::CaseInsensitive)) node->doc().location().warning(tr("Undocumented return value")); } -#if 0 - // Now we put this at the top, before the other text. - if (func->reimplementedFrom() != 0) - generateReimplementedFrom(func, marker); -#endif } } diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 0cd534e..4faab50 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -63,10 +63,6 @@ QT_BEGIN_NAMESPACE int HtmlGenerator::id = 0; bool HtmlGenerator::debugging_on = false; -#if 0 -QString HtmlGenerator::divNavTop = "
    "; -#endif - QString HtmlGenerator::divNavTop = ""; QString HtmlGenerator::sinceTitles[] = @@ -1020,26 +1016,8 @@ int HtmlGenerator::generateAtom(const Atom *atom, out() << atom->string(); break; case Atom::SectionLeft: -#if 0 - { - int nextLevel = atom->string().toInt(); - if (sectionNumber.size() < nextLevel) { - do { - sectionNumber.append("1"); - } while (sectionNumber.size() < nextLevel); - } - else { - while (sectionNumber.size() > nextLevel) { - sectionNumber.removeLast(); - } - sectionNumber.last() = QString::number(sectionNumber.last().toInt() + 1); - } - out() << "" << divNavTop << "\n"; - } -#else out() << "" << divNavTop << "\n"; -#endif break; case Atom::SectionRight: break; @@ -2022,39 +2000,6 @@ void HtmlGenerator::generateTableOfContents(const Node *node, inLink = false; } -#if 0 -void HtmlGenerator::generateNavigationBar(const NavigationBar& bar, - const Node *node, - CodeMarker *marker) -{ - if (bar.prev.begin() != 0 || bar.current.begin() != 0 || - bar.next.begin() != 0) { - out() << "

    "; - if (bar.prev.begin() != 0) { -#if 0 - out() << "[Prev: "; - generateText(section.previousHeading(), node, marker); - out() << "]\n"; -#endif - } - if (fake->name() != QString("index.html")) { - if (bar.current.begin() != 0) { - out() << "[Home]\n"; - } - if (bar.next.begin() != 0) { - out() << "[Next: "; - generateText(Text::sectionHeading(bar.next.begin()), node, marker); - out() << "]\n"; - } - out() << "

    \n"; - } - } -} -#endif - QString HtmlGenerator::generateListOfAllMemberFile(const InnerNode *inner, CodeMarker *marker) { @@ -3237,29 +3182,6 @@ QString HtmlGenerator::fileBase(const Node *node) return result; } -#if 0 -QString HtmlGenerator::fileBase(const Node *node, - const SectionIterator& section) -{ - QStringList::ConstIterator s = section.sectionNumber().end(); - QStringList::ConstIterator b = section.baseNameStack().end(); - - QString suffix; - QString base = fileBase(node); - - while (s != section.sectionNumber().begin()) { - --s; - --b; - if (!(*b).isEmpty()) { - base = *b; - break; - } - suffix.prepend("-" + *s); - } - return base + suffix; -} -#endif - QString HtmlGenerator::fileName(const Node *node) { if (node->type() == Node::Fake) { @@ -3813,14 +3735,6 @@ QString HtmlGenerator::getLink(const Atom *atom, << (*node)->name() << "no relative"; } } -#if 0 - else if ((*node)->status() == Node::Deprecated) { - qDebug() << "Link to Deprecated entity"; - } - else if ((*node)->status() == Node::Internal) { - qDebug() << "Link to Internal entity"; - } -#endif } while (!path.isEmpty()) { diff --git a/tools/qdoc3/location.cpp b/tools/qdoc3/location.cpp index dee87d1..1257a45 100644 --- a/tools/qdoc3/location.cpp +++ b/tools/qdoc3/location.cpp @@ -390,10 +390,6 @@ QString Location::top() const if (lineNo() >= 1) { str += QLatin1Char(':'); str += QString::number(lineNo()); -#if 0 - if (columnNo() >= 1) - str += ":" + QString::number(columnNo()); -#endif } if (etc()) str += QLatin1String(" (etc.)"); diff --git a/tools/qdoc3/node.cpp b/tools/qdoc3/node.cpp index 41f90d5..e043f5d 100644 --- a/tools/qdoc3/node.cpp +++ b/tools/qdoc3/node.cpp @@ -1545,11 +1545,6 @@ void QmlClassNode::clear() */ QString QmlClassNode::fileBase() const { -#if 0 - if (Node::fileBase() == "item") - qDebug() << "FILEBASE: qmlitem" << name(); - return "qml_" + Node::fileBase(); -#endif return Node::fileBase(); } diff --git a/tools/qdoc3/tree.cpp b/tools/qdoc3/tree.cpp index 540ffa9..9946f0b 100644 --- a/tools/qdoc3/tree.cpp +++ b/tools/qdoc3/tree.cpp @@ -591,12 +591,6 @@ void Tree::resolveGroups() if (fake && fake->subType() == Node::Group) { fake->addGroupMember(i.value()); } -#if 0 - else { - if (prevGroup != i.key()) - i.value()->doc().location().warning(tr("No such group '%1'").arg(i.key())); - } -#endif prevGroup = i.key(); } @@ -1986,15 +1980,7 @@ QString Tree::fullDocumentLocation(const Node *node) const else parentName = fullDocumentLocation(node->parent()); } -#if 0 - if (node->type() == Node::QmlProperty) { - qDebug() << "Node::QmlProperty:" << node->name() - << "parentName:" << parentName; - if (parentNode) - qDebug() << "PARENT NODE" << parentNode->type() - << parentNode->subType() << parentNode->name(); - } -#endif + switch (node->type()) { case Node::Class: case Node::Namespace: -- cgit v0.12 From 9830ef3b28502285a9c99ce07985668ad16a636a Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 24 Nov 2010 15:08:20 +0100 Subject: Removed unused code. --- tools/qdoc3/codemarker.h | 7 --- tools/qdoc3/codeparser.cpp | 3 +- tools/qdoc3/ditaxmlgenerator.h | 3 -- tools/qdoc3/htmlgenerator.cpp | 112 ----------------------------------------- tools/qdoc3/htmlgenerator.h | 25 --------- 5 files changed, 1 insertion(+), 149 deletions(-) diff --git a/tools/qdoc3/codemarker.h b/tools/qdoc3/codemarker.h index f17b28e..029ddb9 100644 --- a/tools/qdoc3/codemarker.h +++ b/tools/qdoc3/codemarker.h @@ -107,13 +107,6 @@ struct FastSection }; -#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/codeparser.cpp b/tools/qdoc3/codeparser.cpp index 65d9572..ed8b54e 100644 --- a/tools/qdoc3/codeparser.cpp +++ b/tools/qdoc3/codeparser.cpp @@ -47,7 +47,6 @@ #include "node.h" #include "tree.h" #include "config.h" -#include QT_BEGIN_NAMESPACE @@ -99,7 +98,7 @@ void CodeParser::initializeParser(const Config& config) } /*! - Teerminating a code parser is trivial. + Terminating a code parser is trivial. */ void CodeParser::terminateParser() { diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index 446f735..36bd990 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -234,9 +234,6 @@ class DitaXmlGenerator : public PageGenerator QString registerRef(const QString& ref); QString fileBase(const Node *node); -#if 0 - QString fileBase(const Node *node, const SectionIterator& section); -#endif QString fileName(const Node *node); void findAllClasses(const InnerNode *node); void findAllFunctions(const InnerNode *node); diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 4faab50..74db762 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -1116,33 +1116,6 @@ int HtmlGenerator::generateAtom(const Atom *atom, skipAhead = 1; break; case Atom::TableOfContents: - { - int numColumns = 1; - const Node *node = relative; - - Doc::SectioningUnit sectioningUnit = Doc::Section4; - QStringList params = atom->string().split(","); - QString columnText = params.at(0); - QStringList pieces = columnText.split(" ", QString::SkipEmptyParts); - if (pieces.size() >= 2) { - columnText = pieces.at(0); - pieces.pop_front(); - QString path = pieces.join(" ").trimmed(); - node = findNodeForTarget(path, relative, marker, atom); - } - - if (params.size() == 2) { - numColumns = qMax(columnText.toInt(), numColumns); - sectioningUnit = (Doc::SectioningUnit)params.at(1).toInt(); - } - - if (node) - generateTableOfContents(node, - marker, - sectioningUnit, - numColumns, - relative); - } break; case Atom::Target: out() << "string()) << "\">"; @@ -1799,91 +1772,6 @@ void HtmlGenerator::generateIncludes(const InnerNode *inner, CodeMarker *marker) } /*! - Generates a table of contents beginning at \a node. - */ -void HtmlGenerator::generateTableOfContents(const Node *node, - CodeMarker *marker, - Doc::SectioningUnit sectioningUnit, - int numColumns, - const Node *relative) - -{ - return; - if (!node->doc().hasTableOfContents()) - return; - QList toc = node->doc().tableOfContents(); - if (toc.isEmpty()) - return; - - QString nodeName = ""; - if (node != relative) - nodeName = node->name(); - - QStringList sectionNumber; - int columnSize = 0; - - QString tdTag; - if (numColumns > 1) { - tdTag = ""; /* width=\"" + QString::number((100 + numColumns - 1) / numColumns) + "%\">";*/ - out() << "\n" - << tdTag << "\n"; - } - - // disable nested links in table of contents - inContents = true; - inLink = true; - - for (int i = 0; i < toc.size(); ++i) { - Atom *atom = toc.at(i); - - int nextLevel = atom->string().toInt(); - if (nextLevel > (int)sectioningUnit) - continue; - - if (sectionNumber.size() < nextLevel) { - do { - out() << "
      "; - sectionNumber.append("1"); - } while (sectionNumber.size() < nextLevel); - } - else { - while (sectionNumber.size() > nextLevel) { - out() << "
    \n"; - sectionNumber.removeLast(); - } - sectionNumber.last() = QString::number(sectionNumber.last().toInt() + 1); - } - int numAtoms; - Text headingText = Text::sectionHeading(atom); - - if (sectionNumber.size() == 1 && columnSize > toc.size() / numColumns) { - out() << "" << tdTag << "\n"; - sectionNumber.removeLast(); - } - - if (numColumns > 1) - out() << "
    \n"; - - inContents = false; - inLink = false; -} - -/*! Revised for the new doc format. Generates a table of contents beginning at \a node. */ diff --git a/tools/qdoc3/htmlgenerator.h b/tools/qdoc3/htmlgenerator.h index c0a4ce8..547cf2f 100644 --- a/tools/qdoc3/htmlgenerator.h +++ b/tools/qdoc3/htmlgenerator.h @@ -56,15 +56,6 @@ QT_BEGIN_NAMESPACE -#if 0 -struct NavigationBar -{ - SectionIterator prev; - SectionIterator current; - SectionIterator next; -}; -#endif - typedef QMultiMap NodeMultiMap; typedef QMap NewSinceMaps; typedef QMap ParentMaps; @@ -150,16 +141,6 @@ class HtmlGenerator : public PageGenerator CodeMarker *marker, const Node *relative = 0); void generateIncludes(const InnerNode *inner, CodeMarker *marker); -#if 0 - void generateNavigationBar(const NavigationBar& bar, - const Node *node, - CodeMarker *marker); -#endif - void generateTableOfContents(const Node *node, - CodeMarker *marker, - Doc::SectioningUnit sectioningUnit, - int numColumns, - const Node *relative = 0); void generateTableOfContents(const Node *node, CodeMarker *marker, QList
    * sections = 0); @@ -237,9 +218,6 @@ class HtmlGenerator : public PageGenerator QString registerRef(const QString& ref); QString fileBase(const Node *node); -#if 0 - QString fileBase(const Node *node, const SectionIterator& section); -#endif QString fileName(const Node *node); void findAllClasses(const InnerNode *node); void findAllFunctions(const InnerNode *node); @@ -273,9 +251,6 @@ class HtmlGenerator : public PageGenerator CodeMarker* marker) const; void generateExtractionMark(const Node *node, ExtractionMarkType markType); -#if 0 - NavigationBar currentNavigationBar; -#endif QMap refMap; int codeIndent; HelpProjectWriter *helpProjectWriter; -- cgit v0.12 From f79dfe06afe9aae34e064b5668cc3429f659dd16 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 24 Nov 2010 19:31:06 +0100 Subject: Added the version number to the configuration and fixed the generator. Now the version number should appear in the documentation again. --- tools/qdoc3/htmlgenerator.cpp | 4 +--- tools/qdoc3/test/qt-project.qdocconf | 5 ++++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 74db762..b095f23 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -1618,12 +1618,10 @@ void HtmlGenerator::generateHeader(const QString& title, out() << QString("\n").arg(naturalLanguage); out() << "\n"; out() << " \n"; - QString shortVersion; - shortVersion = project + " " + shortVersion + ": "; if (node && !node->doc().location().isEmpty()) out() << "\n"; - shortVersion = myTree->version(); + QString shortVersion = myTree->version(); if (shortVersion.count(QChar('.')) == 2) shortVersion.truncate(shortVersion.lastIndexOf(QChar('.'))); if (!shortVersion.isEmpty()) { diff --git a/tools/qdoc3/test/qt-project.qdocconf b/tools/qdoc3/test/qt-project.qdocconf index be2a227..135fbbb 100644 --- a/tools/qdoc3/test/qt-project.qdocconf +++ b/tools/qdoc3/test/qt-project.qdocconf @@ -6,6 +6,7 @@ include(qt-defines.qdocconf) project = Qt description = Qt Reference Documentation url = http://qt.nokia.com/doc/4.7 +version = 4.7.1 sourceencoding = UTF-8 outputencoding = UTF-8 @@ -86,7 +87,9 @@ excludedirs = $QT_SOURCE_TREE/src/3rdparty/clucene \ $QT_SOURCE_TREE/doc/src/ja_JP \ $QT_SOURCE_TREE/doc/src/zh_CN -sources.fileextensions = "*.cpp *.qdoc *.mm" +sources.fileextensions = "*.c++ *.cc *.cpp *.cxx *.mm *.qml *.qdoc" +headers.fileextensions = "*.ch *.h *.h++ *.hh *.hpp *.hxx" + examples.fileextensions = "*.cpp *.h *.js *.xq *.svg *.xml *.ui *.qhp *.qhcp *.qml" examples.imageextensions = "*.png" -- cgit v0.12 From 9529188304b47d3fdb39cec52ad233f37a477f2f Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 24 Nov 2010 19:33:21 +0100 Subject: Refactored use of parsers to parse files based on their types. The full range of file types is specified in the configuration file. Each parser is asked if it handles each file. The pure documentation parser conceptually handles qdoc files, but it uses the same code as the C++ parser. --- tools/qdoc3/codeparser.cpp | 38 ++++++++- tools/qdoc3/codeparser.h | 6 +- tools/qdoc3/config.cpp | 6 +- tools/qdoc3/config.h | 1 - tools/qdoc3/cppcodeparser.cpp | 9 +- tools/qdoc3/cppcodeparser.h | 4 +- tools/qdoc3/main.cpp | 74 +++++++++------- tools/qdoc3/puredocparser.cpp | 63 ++++++++++++++ tools/qdoc3/puredocparser.h | 72 ++++++++++++++++ tools/qdoc3/qdoc3.pro | 11 +++ tools/qdoc3/qmlcodeparser.cpp | 168 +++++++++++++++++++++++++++++++++++++ tools/qdoc3/qmlcodeparser.h | 90 ++++++++++++++++++++ tools/qdoc3/qmlvisitor.cpp | 191 ++++++++++++++++++++++++++++++++++++++++++ tools/qdoc3/qmlvisitor.h | 83 ++++++++++++++++++ 14 files changed, 769 insertions(+), 47 deletions(-) create mode 100644 tools/qdoc3/puredocparser.cpp create mode 100644 tools/qdoc3/puredocparser.h create mode 100644 tools/qdoc3/qmlcodeparser.cpp create mode 100644 tools/qdoc3/qmlcodeparser.h create mode 100644 tools/qdoc3/qmlvisitor.cpp create mode 100644 tools/qdoc3/qmlvisitor.h diff --git a/tools/qdoc3/codeparser.cpp b/tools/qdoc3/codeparser.cpp index ed8b54e..3652758 100644 --- a/tools/qdoc3/codeparser.cpp +++ b/tools/qdoc3/codeparser.cpp @@ -105,7 +105,7 @@ void CodeParser::terminateParser() // nothing. } -QString CodeParser::headerFileNameFilter() +QStringList CodeParser::headerFileNameFilter() { return sourceFileNameFilter(); } @@ -158,6 +158,42 @@ CodeParser *CodeParser::parserForLanguage(const QString& language) return 0; } +CodeParser *CodeParser::parserForHeaderFile(const QString &filePath) +{ + QString fileName = QFileInfo(filePath).fileName(); + + QList::ConstIterator p = parsers.begin(); + while (p != parsers.end()) { + + QStringList headerPatterns = (*p)->headerFileNameFilter(); + foreach (QString pattern, headerPatterns) { + QRegExp re(pattern, Qt::CaseInsensitive, QRegExp::Wildcard); + if (re.exactMatch(fileName)) + return *p; + } + ++p; + } + return 0; +} + +CodeParser *CodeParser::parserForSourceFile(const QString &filePath) +{ + QString fileName = QFileInfo(filePath).fileName(); + + QList::ConstIterator p = parsers.begin(); + while (p != parsers.end()) { + + QStringList sourcePatterns = (*p)->sourceFileNameFilter(); + foreach (QString pattern, sourcePatterns) { + QRegExp re(pattern, Qt::CaseInsensitive, QRegExp::Wildcard); + if (re.exactMatch(fileName)) + return *p; + } + ++p; + } + return 0; +} + /*! Returns the set of strings representing the common metacommands. */ diff --git a/tools/qdoc3/codeparser.h b/tools/qdoc3/codeparser.h index ebba601..2d11ee0 100644 --- a/tools/qdoc3/codeparser.h +++ b/tools/qdoc3/codeparser.h @@ -66,8 +66,8 @@ class CodeParser virtual void initializeParser(const Config& config); virtual void terminateParser(); virtual QString language() = 0; - virtual QString headerFileNameFilter(); - virtual QString sourceFileNameFilter() = 0; + virtual QStringList headerFileNameFilter(); + virtual QStringList sourceFileNameFilter() = 0; virtual void parseHeaderFile(const Location& location, const QString& filePath, Tree *tree); virtual void parseSourceFile(const Location& location, @@ -78,6 +78,8 @@ class CodeParser static void initialize(const Config& config); static void terminate(); static CodeParser *parserForLanguage(const QString& language); + static CodeParser *parserForHeaderFile(const QString &filePath); + static CodeParser *parserForSourceFile(const QString &filePath); static const QString titleFromName(const QString& name); protected: diff --git a/tools/qdoc3/config.cpp b/tools/qdoc3/config.cpp index 0146a26..c2ab559 100644 --- a/tools/qdoc3/config.cpp +++ b/tools/qdoc3/config.cpp @@ -359,16 +359,12 @@ QSet Config::subVars(const QString& var) const */ QStringList Config::getAllFiles(const QString &filesVar, const QString &dirsVar, - const QString &defaultNameFilter, const QSet &excludedDirs) { QStringList result = getStringList(filesVar); QStringList dirs = getStringList(dirsVar); - QString nameFilter = getString(filesVar + dot + - QLatin1String(CONFIG_FILEEXTENSIONS)); - if (nameFilter.isEmpty()) - nameFilter = defaultNameFilter; + QString nameFilter = getString(filesVar + dot + QLatin1String(CONFIG_FILEEXTENSIONS)); QStringList::ConstIterator d = dirs.begin(); while (d != dirs.end()) { diff --git a/tools/qdoc3/config.h b/tools/qdoc3/config.h index f089a70..bc36f3d 100644 --- a/tools/qdoc3/config.h +++ b/tools/qdoc3/config.h @@ -76,7 +76,6 @@ class Config QSet subVars(const QString& var) const; QStringList getAllFiles(const QString& filesVar, const QString& dirsVar, - const QString& defaultNameFilter, const QSet &excludedDirs = QSet()); static QStringList getFilesHere(const QString& dir, diff --git a/tools/qdoc3/cppcodeparser.cpp b/tools/qdoc3/cppcodeparser.cpp index 8e891b8..fce2553 100644 --- a/tools/qdoc3/cppcodeparser.cpp +++ b/tools/qdoc3/cppcodeparser.cpp @@ -47,7 +47,6 @@ #include #include -#include #include "codechunk.h" #include "config.h" @@ -258,18 +257,18 @@ QString CppCodeParser::language() /*! Returns a list of extensions for header files. */ -QString CppCodeParser::headerFileNameFilter() +QStringList CppCodeParser::headerFileNameFilter() { - return "*.ch *.h *.h++ *.hh *.hpp *.hxx"; + return QStringList() << "*.ch" << "*.h" << "*.h++" << "*.hh" << "*.hpp" << "*.hxx"; } /*! Returns a list of extensions for source files, i.e. not header files. */ -QString CppCodeParser::sourceFileNameFilter() +QStringList CppCodeParser::sourceFileNameFilter() { - return "*.c++ *.cc *.cpp *.cxx"; + return QStringList() << "*.c++" << "*.cc" << "*.cpp" << "*.cxx" << "*.mm"; } /*! diff --git a/tools/qdoc3/cppcodeparser.h b/tools/qdoc3/cppcodeparser.h index 55d9ddf..64e9119 100644 --- a/tools/qdoc3/cppcodeparser.h +++ b/tools/qdoc3/cppcodeparser.h @@ -69,8 +69,8 @@ class CppCodeParser : public CodeParser virtual void initializeParser(const Config& config); virtual void terminateParser(); virtual QString language(); - virtual QString headerFileNameFilter(); - virtual QString sourceFileNameFilter(); + virtual QStringList headerFileNameFilter(); + virtual QStringList sourceFileNameFilter(); virtual void parseHeaderFile(const Location& location, const QString& filePath, Tree *tree); diff --git a/tools/qdoc3/main.cpp b/tools/qdoc3/main.cpp index 768c5eb..2d3f034 100644 --- a/tools/qdoc3/main.cpp +++ b/tools/qdoc3/main.cpp @@ -50,10 +50,12 @@ #include "config.h" #include "cppcodemarker.h" #include "cppcodeparser.h" +#include "ditaxmlgenerator.h" #include "doc.h" #include "htmlgenerator.h" #include "plaincodemarker.h" -#include "ditaxmlgenerator.h" +#include "puredocparser.h" +#include "qmlcodeparser.h" #include "tokenizer.h" #include "tree.h" #include @@ -235,14 +237,6 @@ static void processQdocconfFile(const QString &fileName) tree->setVersion(config.getString(CONFIG_VERSION)); /* - There must be a code parser for the source code language, e.g. C++. - If there isn't one, give up. - */ - CodeParser *codeParser = CodeParser::parserForLanguage(lang); - if (codeParser == 0) - config.lastLocation().fatal(tr("Cannot parse programming language '%1'").arg(lang)); - - /* By default, the only output format is HTML. */ QSet outputFormats = config.getStringSet(CONFIG_OUTPUTFORMATS); @@ -257,52 +251,69 @@ static void processQdocconfFile(const QString &fileName) langLocation.fatal(tr("Cannot output documentation for programming language '%1'").arg(lang)); /* - Read some XML indexes. What are they??? + Read some XML indexes containing definitions from other documentation sets. */ QStringList indexFiles = config.getStringList(CONFIG_INDEXES); tree->readIndexes(indexFiles); - + /* - Get all the header files: "*.ch *.h *.h++ *.hh *.hpp *.hxx" - Put them in a set. + Read the list of excluded directories. */ QSet excludedDirs; QStringList excludedDirsList = config.getStringList(CONFIG_EXCLUDEDIRS); foreach (const QString &excludeDir, excludedDirsList) excludedDirs.insert(QDir::fromNativeSeparators(excludeDir)); - QSet headers = QSet::fromList( - config.getAllFiles(CONFIG_HEADERS, CONFIG_HEADERDIRS, - codeParser->headerFileNameFilter(), - excludedDirs)); /* - Parse each header file in the set and add it to the big tree. + Get all the header files: "*.ch *.h *.h++ *.hh *.hpp *.hxx" + Put them in a set. */ - QSet::ConstIterator h = headers.begin(); - while (h != headers.end()) { - codeParser->parseHeaderFile(config.location(), *h, tree); - ++h; - } - codeParser->doneParsingHeaderFiles(tree); + QSet headers = QSet::fromList( + config.getAllFiles(CONFIG_HEADERS, CONFIG_HEADERDIRS, excludedDirs)); /* Get all the source text files: "*.cpp *.qdoc *.mm" Put them in a set. */ QSet sources = QSet::fromList( - config.getAllFiles(CONFIG_SOURCES, CONFIG_SOURCEDIRS, - codeParser->sourceFileNameFilter(), - excludedDirs)); + config.getAllFiles(CONFIG_SOURCES, CONFIG_SOURCEDIRS, excludedDirs)); + + /* + Parse each header file in the set using the appropriate parser and add it + to the big tree. + */ + QSet usedParsers; + + QSet::ConstIterator h = headers.begin(); + while (h != headers.end()) { + CodeParser *codeParser = CodeParser::parserForHeaderFile(*h); + if (codeParser) { + codeParser->parseHeaderFile(config.location(), *h, tree); + usedParsers.insert(codeParser); + } + ++h; + } + foreach (CodeParser *codeParser, usedParsers) + codeParser->doneParsingHeaderFiles(tree); + + usedParsers.clear(); /* - Parse each source text file in the set and add it to the big tree. + Parse each source text file in the set using the appropriate parser and + add it to the big tree. */ QSet::ConstIterator s = sources.begin(); while (s != sources.end()) { - codeParser->parseSourceFile(config.location(), *s, tree); + CodeParser *codeParser = CodeParser::parserForSourceFile(*s); + if (codeParser) { + codeParser->parseSourceFile(config.location(), *s, tree); + usedParsers.insert(codeParser); + } ++s; } - codeParser->doneParsingSourceFiles(tree); + + foreach (CodeParser *codeParser, usedParsers) + codeParser->doneParsingSourceFiles(tree); /* Now the big tree has been built from all the header and @@ -371,7 +382,8 @@ int main(int argc, char **argv) and create a tree for C++. */ CppCodeParser cppParser; - Tree *cppTree = treeForLanguage(cppParser.language()); + QmlCodeParser qmlParser; + PureDocParser docParser; /* Create code markers for plain text and C++. diff --git a/tools/qdoc3/puredocparser.cpp b/tools/qdoc3/puredocparser.cpp new file mode 100644 index 0000000..de7d668 --- /dev/null +++ b/tools/qdoc3/puredocparser.cpp @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/* + puredocparser.cpp +*/ + +#include "puredocparser.h" + +QT_BEGIN_NAMESPACE + +PureDocParser::PureDocParser() +{ +} + +PureDocParser::~PureDocParser() +{ +} + +QStringList PureDocParser::sourceFileNameFilter() +{ + return QStringList("*.qdoc"); +} + +QT_END_NAMESPACE diff --git a/tools/qdoc3/puredocparser.h b/tools/qdoc3/puredocparser.h new file mode 100644 index 0000000..6e37dbd --- /dev/null +++ b/tools/qdoc3/puredocparser.h @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/* + puredocparser.h +*/ + +#ifndef PUREDOCPARSER_H +#define PUREDOCPARSER_H + +#include + +#include "cppcodeparser.h" +#include "location.h" + +QT_BEGIN_NAMESPACE + +class Config; +class Node; +class QString; +class Tree; + +class PureDocParser : public CppCodeParser +{ +public: + PureDocParser(); + virtual ~PureDocParser(); + + virtual QStringList sourceFileNameFilter(); +}; + +QT_END_NAMESPACE + +#endif diff --git a/tools/qdoc3/qdoc3.pro b/tools/qdoc3/qdoc3.pro index c9b05d2..2c91a9c 100644 --- a/tools/qdoc3/qdoc3.pro +++ b/tools/qdoc3/qdoc3.pro @@ -42,6 +42,9 @@ HEADERS += atom.h \ openedlist.h \ pagegenerator.h \ plaincodemarker.h \ + puredocparser.h \ + qmlcodeparser.h \ + qmlvisitor.h \ quoter.h \ separator.h \ text.h \ @@ -67,6 +70,9 @@ SOURCES += atom.cpp \ openedlist.cpp \ pagegenerator.cpp \ plaincodemarker.cpp \ + puredocparser.cpp \ + qmlcodeparser.cpp \ + qmlvisitor.cpp \ quoter.cpp \ separator.cpp \ text.cpp \ @@ -74,6 +80,11 @@ SOURCES += atom.cpp \ tree.cpp \ yyindent.cpp +# Include the QML parsing library from Qt Creator. + +LIBS += -L$$(QTCREATOR_LIBPATH) -lQmlJS -lUtils +INCLUDEPATH += $$(QTCREATOR_INCPATH) + ### Documentation for qdoc3 ### qtPrepareTool(QDOC, qdoc3) diff --git a/tools/qdoc3/qmlcodeparser.cpp b/tools/qdoc3/qmlcodeparser.cpp new file mode 100644 index 0000000..c6ace7d --- /dev/null +++ b/tools/qdoc3/qmlcodeparser.cpp @@ -0,0 +1,168 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/* + qmlcodeparser.cpp +*/ + +#include "parser/qmljsast_p.h" +#include "parser/qmljsastvisitor_p.h" +#include "parser/qmljsnodepool_p.h" + +#include "qmlcodeparser.h" +#include "node.h" +#include "tree.h" +#include "config.h" +#include "qmlvisitor.h" + +QT_BEGIN_NAMESPACE + +#define COMMAND_STARTPAGE Doc::alias("startpage") +#define COMMAND_VARIABLE Doc::alias("variable") + +#define COMMAND_QMLCLASS Doc::alias("qmlclass") +#define COMMAND_QMLPROPERTY Doc::alias("qmlproperty") +#define COMMAND_QMLATTACHEDPROPERTY Doc::alias("qmlattachedproperty") +#define COMMAND_QMLINHERITS Doc::alias("inherits") +#define COMMAND_QMLSIGNAL Doc::alias("qmlsignal") +#define COMMAND_QMLATTACHEDSIGNAL Doc::alias("qmlattachedsignal") +#define COMMAND_QMLMETHOD Doc::alias("qmlmethod") +#define COMMAND_QMLATTACHEDMETHOD Doc::alias("qmlattachedmethod") +#define COMMAND_QMLDEFAULT Doc::alias("default") +#define COMMAND_QMLBASICTYPE Doc::alias("qmlbasictype") + +QmlCodeParser::QmlCodeParser() +{ +} + +QmlCodeParser::~QmlCodeParser() +{ +} + +/*! + Initialize the code parser base class. + */ +void QmlCodeParser::initializeParser(const Config &config) +{ + CodeParser::initializeParser(config); + + lexer = new QmlJS::Lexer(&engine); + parser = new QmlJS::Parser(&engine); +} + +void QmlCodeParser::terminateParser() +{ + delete lexer; + delete parser; +} + +QString QmlCodeParser::language() +{ + return "QML"; +} + +QStringList QmlCodeParser::sourceFileNameFilter() +{ + return QStringList("*.qml"); +} + +void QmlCodeParser::parseSourceFile(const Location& location, + const QString& filePath, + Tree *tree) +{ + QFile in(filePath); + if (!in.open(QIODevice::ReadOnly)) { + location.error(tr("Cannot open QML file '%1'").arg(filePath)); + return; + } + + QString document = in.readAll(); + in.close(); + + Location fileLocation(filePath); + lexer->setCode(document, 1); + + QSet topicCommandsAllowed = topicCommands(); + QSet otherMetacommandsAllowed = otherMetaCommands(); + QSet metacommandsAllowed = topicCommandsAllowed + + otherMetacommandsAllowed; + + QmlJS::NodePool m_nodePool(filePath, &engine); + + if (parser->parse()) { + QmlJS::AST::UiProgram *ast = parser->ast(); + DocVisitor visitor(filePath, document, &engine, tree, metacommandsAllowed); + QmlJS::AST::Node::accept(ast, &visitor); + } +} + +void QmlCodeParser::doneParsingSourceFiles(Tree *tree) +{ +} + +/*! + Returns the set of strings reopresenting the topic commands. + */ +QSet QmlCodeParser::topicCommands() +{ + return QSet() << COMMAND_VARIABLE + << COMMAND_QMLCLASS + << COMMAND_QMLPROPERTY + << COMMAND_QMLATTACHEDPROPERTY + << COMMAND_QMLSIGNAL + << COMMAND_QMLATTACHEDSIGNAL + << COMMAND_QMLMETHOD + << COMMAND_QMLATTACHEDMETHOD + << COMMAND_QMLBASICTYPE; +} + +/*! + Returns the set of strings representing the common metacommands + plus some other metacommands. + */ +QSet QmlCodeParser::otherMetaCommands() +{ + return commonMetaCommands() << COMMAND_STARTPAGE + << COMMAND_QMLINHERITS + << COMMAND_QMLDEFAULT; +} + +QT_END_NAMESPACE diff --git a/tools/qdoc3/qmlcodeparser.h b/tools/qdoc3/qmlcodeparser.h new file mode 100644 index 0000000..f6d6684 --- /dev/null +++ b/tools/qdoc3/qmlcodeparser.h @@ -0,0 +1,90 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/* + qmlcodeparser.h +*/ + +#ifndef QMLCODEPARSER_H +#define QMLCODEPARSER_H + +#include +#include "parser/qmljsengine_p.h" +#include "parser/qmljslexer_p.h" +#include "parser/qmljsparser_p.h" + +#include "codeparser.h" +#include "location.h" + +QT_BEGIN_NAMESPACE + +class Config; +class Node; +class QString; +class Tree; + +class QmlCodeParser : public CodeParser +{ +public: + QmlCodeParser(); + virtual ~QmlCodeParser(); + + virtual void initializeParser(const Config& config); + virtual void terminateParser(); + virtual QString language(); + virtual QStringList sourceFileNameFilter(); + virtual void parseSourceFile(const Location& location, + const QString& filePath, Tree *tree); + virtual void doneParsingSourceFiles(Tree *tree); + +protected: + virtual QSet topicCommands(); + virtual QSet otherMetaCommands(); + +private: + QmlJS::Engine engine; + QmlJS::Lexer *lexer; + QmlJS::Parser *parser; +}; + +QT_END_NAMESPACE + +#endif diff --git a/tools/qdoc3/qmlvisitor.cpp b/tools/qdoc3/qmlvisitor.cpp new file mode 100644 index 0000000..83bf96f --- /dev/null +++ b/tools/qdoc3/qmlvisitor.cpp @@ -0,0 +1,191 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include "parser/qmljsast_p.h" +#include "parser/qmljsastfwd_p.h" +#include "parser/qmljsengine_p.h" + +#include "node.h" +#include "qmlvisitor.h" + +DocVisitor::DocVisitor(const QString &filePath, const QString &code, + QmlJS::Engine *engine, Tree *tree, QSet &commands) +{ + this->filePath = filePath; + this->name = QFileInfo(filePath).baseName(); + document = code; + this->engine = engine; + this->tree = tree; + this->commands = commands; + current = tree->root(); +} + +DocVisitor::~DocVisitor() +{ +} + +QmlJS::AST::SourceLocation DocVisitor::precedingComment(unsigned offset) const +{ + QmlJS::AST::SourceLocation currentLoc; + + foreach (const QmlJS::AST::SourceLocation &loc, engine->comments()) { + if (loc.begin() > lastEndOffset && loc.end() < offset) + currentLoc = loc; + else + break; + } + if (currentLoc.isValid()) { + QString comment = document.mid(currentLoc.offset, currentLoc.length); + if (comment.startsWith("!") || comment.startsWith("*")) + return currentLoc; + } + + return QmlJS::AST::SourceLocation(); +} + +void DocVisitor::applyDocumentation(QmlJS::AST::SourceLocation location, + InnerNode *node) +{ + QmlJS::AST::SourceLocation loc = precedingComment(location.begin()); + + if (loc.isValid()) { + QString source = document.mid(loc.offset, loc.length); + if (source.startsWith(QLatin1String("!")) || + source.startsWith(QLatin1String("*"))) { + + Location start(filePath); + start.setLineNo(loc.startLine); + start.setColumnNo(loc.startColumn); + Location finish(filePath); + finish.setLineNo(loc.startLine); + finish.setColumnNo(loc.startColumn); + + Doc doc(start, finish, source.mid(1), commands); + node->setDoc(doc); + } + } +} + +/*! + Visits element definitions, recording them in a tree structure. +*/ +bool DocVisitor::visit(QmlJS::AST::UiObjectDefinition *definition) +{ + QString type = definition->qualifiedTypeNameId->name->asString(); + + if (current->type() == Node::Namespace) { + QmlClassNode *component = new QmlClassNode(current, name, 0); + applyDocumentation(definition->firstSourceLocation(), component); + current = component; + } + + return true; +} + +void DocVisitor::endVisit(QmlJS::AST::UiObjectDefinition *definition) +{ + lastEndOffset = definition->lastSourceLocation().end(); +} + +bool DocVisitor::visit(QmlJS::AST::UiImportList *imports) +{ + // Note that the imports list can be traversed by iteration to obtain + // all the imports in the document at once, having found just one: + // *it = imports; it; it = it->next + + QString module = document.mid(imports->import->fileNameToken.offset, + imports->import->fileNameToken.length); + QString version = document.mid(imports->import->versionToken.offset, + imports->import->versionToken.length); + importList.append(QPair(module, version)); + + return true; +} + +/*! + Visits public member declarations, such as signals and properties. + These only include custom signals and properties. +*/ +bool DocVisitor::visit(QmlJS::AST::UiPublicMember *member) +{ + switch (member->type) { + case QmlJS::AST::UiPublicMember::Signal: + { + QString name = member->name->asString(); + + QList > parameters; + for (QmlJS::AST::UiParameterList *it = member->parameters; it; it = it->next) { + if (it->type && it->name) + parameters.append(QPair(it->type->asString(), + it->name->asString())); + } + + //current->addSignal(new Signal(name, parameters)); + break; + } + case QmlJS::AST::UiPublicMember::Property: + { + QString type = member->memberType->asString(); + QString name = member->name->asString(); + + //current->addProperty(new Property(type, name)); + break; + } + default: + return false; + } + + //current->doc = precedingComment(member->firstSourceLocation().begin()); + return true; +} + +void DocVisitor::endVisit(QmlJS::AST::UiPublicMember *definition) +{ + lastEndOffset = definition->lastSourceLocation().end(); +} + +bool DocVisitor::visit(QmlJS::AST::IdentifierPropertyName *idproperty) +{ + return true; +} diff --git a/tools/qdoc3/qmlvisitor.h b/tools/qdoc3/qmlvisitor.h new file mode 100644 index 0000000..01da98e --- /dev/null +++ b/tools/qdoc3/qmlvisitor.h @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef DOCVISITOR_H +#define DOCVISITOR_H + +#include +#include "parser/qmljsastvisitor_p.h" +#include "node.h" +#include "tree.h" + +class DocVisitor : public QmlJS::AST::Visitor +{ +public: + DocVisitor(const QString &filePath, const QString &code, + QmlJS::Engine *engine, Tree *tree, QSet &commands); + virtual ~DocVisitor(); + + bool visit(QmlJS::AST::UiImportList *imports); + + bool visit(QmlJS::AST::UiObjectDefinition *definition); + void endVisit(QmlJS::AST::UiObjectDefinition *definition); + + bool visit(QmlJS::AST::UiPublicMember *member); + void endVisit(QmlJS::AST::UiPublicMember *definition); + + bool visit(QmlJS::AST::IdentifierPropertyName *idproperty); + +private: + QmlJS::AST::SourceLocation precedingComment(unsigned offset) const; + void applyDocumentation(QmlJS::AST::SourceLocation location, + InnerNode *node); + + QmlJS::Engine *engine; + quint32 lastEndOffset; + QString filePath; + QString name; + QString document; + QList > importList; + QSet commands; + Tree *tree; + InnerNode *current; +}; + +#endif -- cgit v0.12 From b235215ebadaed8b985323b581e8818dd4f09d7f Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 25 Nov 2010 17:17:21 +0100 Subject: Ensured that the inObsoleteLink variable is initialized. --- tools/qdoc3/htmlgenerator.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index b095f23..3f76204 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -218,7 +218,8 @@ HtmlGenerator::HtmlGenerator() funcLeftParen("\\S(\\()"), myTree(0), slow(false), - obsoleteLinks(false) + obsoleteLinks(false), + inObsoleteLink(false) { } -- cgit v0.12 From fc124dd191f285d6003ad458621f752c2a164cf4 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 25 Nov 2010 17:34:56 +0100 Subject: Ensured that the inObsoleteLink variable is initialized. --- tools/qdoc3/ditaxmlgenerator.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index a83a321..ce597f2 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -385,7 +385,8 @@ DitaXmlGenerator::DitaXmlGenerator() myTree(0), slow(false), obsoleteLinks(false), - noLinks(0) + noLinks(0), + inObsoleteLink(false) { } -- cgit v0.12 From 25762d8825d5085287c3266f29a67046b99ff38a Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 25 Nov 2010 17:36:10 +0100 Subject: Trivial whitespace fixes. --- tools/qdoc3/node.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/qdoc3/node.h b/tools/qdoc3/node.h index 40b78ef..ae713d5 100644 --- a/tools/qdoc3/node.h +++ b/tools/qdoc3/node.h @@ -87,8 +87,8 @@ class Node enum SubType { NoSubType, - Example, - HeaderFile, + Example, + HeaderFile, File, Image, Group, @@ -114,7 +114,7 @@ class Node Commendable, Main, Internal - }; // don't reorder thisw enum + }; // don't reorder this enum enum ThreadSafeness { UnspecifiedSafeness, -- cgit v0.12 From 74fd34b43e2954881767e33fd62fe5b922643f88 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 25 Nov 2010 17:36:57 +0100 Subject: Added a check for read-only pure QML properties before C++ checks. --- tools/qdoc3/node.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/qdoc3/node.cpp b/tools/qdoc3/node.cpp index e043f5d..3e8230c 100644 --- a/tools/qdoc3/node.cpp +++ b/tools/qdoc3/node.cpp @@ -1680,6 +1680,9 @@ static QString valueType(const QString& n) */ bool QmlPropertyNode::isWritable(const Tree* tree) const { + if (wri != Trool_Default) + return fromTrool(wri, false); + Node* n = parent(); while (n && n->subType() != Node::QmlClass) n = n->parent(); -- cgit v0.12 From 5edca8bf762e7f3efcff2d95790b7e5ad3e9a89c Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 25 Nov 2010 17:37:44 +0100 Subject: Ensured that QML nodes are imported from indexes. --- tools/qdoc3/tree.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/qdoc3/tree.cpp b/tools/qdoc3/tree.cpp index 9946f0b..20c1373 100644 --- a/tools/qdoc3/tree.cpp +++ b/tools/qdoc3/tree.cpp @@ -806,6 +806,12 @@ void Tree::readIndexSection(const QDomElement &element, subtype = Node::Page; else if (element.attribute("subtype") == "externalpage") subtype = Node::ExternalPage; + else if (element.attribute("subtype") == "qmlclass") + subtype = Node::QmlClass; + else if (element.attribute("subtype") == "qmlpropertygroup") + subtype = Node::QmlPropertyGroup; + else if (element.attribute("subtype") == "qmlbasictype") + subtype = Node::QmlBasicType; else return; -- cgit v0.12 From b81081ff67d3e27e36c8165c9b0814feca1fcf15 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 25 Nov 2010 17:38:29 +0100 Subject: Added support for pure QML signals and properties. Generalized the function to annotate nodes with documentation. --- tools/qdoc3/qmlvisitor.cpp | 50 +++++++++++++++++++++++++++++++++++----------- tools/qdoc3/qmlvisitor.h | 3 +-- 2 files changed, 39 insertions(+), 14 deletions(-) diff --git a/tools/qdoc3/qmlvisitor.cpp b/tools/qdoc3/qmlvisitor.cpp index 83bf96f..1d65c3d 100644 --- a/tools/qdoc3/qmlvisitor.cpp +++ b/tools/qdoc3/qmlvisitor.cpp @@ -85,14 +85,15 @@ QmlJS::AST::SourceLocation DocVisitor::precedingComment(unsigned offset) const } void DocVisitor::applyDocumentation(QmlJS::AST::SourceLocation location, - InnerNode *node) + Node *node) { QmlJS::AST::SourceLocation loc = precedingComment(location.begin()); if (loc.isValid()) { QString source = document.mid(loc.offset, loc.length); if (source.startsWith(QLatin1String("!")) || - source.startsWith(QLatin1String("*"))) { + (source.startsWith(QLatin1String("*")) && + source[1] != QLatin1Char('*'))) { Location start(filePath); start.setLineNo(loc.startLine); @@ -116,7 +117,13 @@ bool DocVisitor::visit(QmlJS::AST::UiObjectDefinition *definition) if (current->type() == Node::Namespace) { QmlClassNode *component = new QmlClassNode(current, name, 0); + component->setTitle(QLatin1String("QML ") + name + QLatin1String(" Component")); + + QmlClassNode::addInheritedBy(type, component); + component->setLink(Node::InheritsLink, type, type); + applyDocumentation(definition->firstSourceLocation(), component); + current = component; } @@ -152,16 +159,23 @@ bool DocVisitor::visit(QmlJS::AST::UiPublicMember *member) switch (member->type) { case QmlJS::AST::UiPublicMember::Signal: { - QString name = member->name->asString(); - - QList > parameters; - for (QmlJS::AST::UiParameterList *it = member->parameters; it; it = it->next) { - if (it->type && it->name) - parameters.append(QPair(it->type->asString(), - it->name->asString())); + if (current->type() == Node::Fake) { + QmlClassNode *qmlClass = static_cast(current); + if (qmlClass) { + + QString name = member->name->asString(); + FunctionNode *qmlSignal = new FunctionNode(Node::QmlSignal, current, name, false); + + QList parameters; + for (QmlJS::AST::UiParameterList *it = member->parameters; it; it = it->next) { + if (it->type && it->name) + parameters.append(Parameter(it->type->asString(), "", it->name->asString())); + } + + qmlSignal->setParameters(parameters); + applyDocumentation(member->firstSourceLocation(), qmlSignal); + } } - - //current->addSignal(new Signal(name, parameters)); break; } case QmlJS::AST::UiPublicMember::Property: @@ -169,7 +183,19 @@ bool DocVisitor::visit(QmlJS::AST::UiPublicMember *member) QString type = member->memberType->asString(); QString name = member->name->asString(); - //current->addProperty(new Property(type, name)); + if (current->type() == Node::Fake) { + QmlClassNode *qmlClass = static_cast(current); + if (qmlClass) { + + QString name = member->name->asString(); + QmlPropGroupNode *qmlPropGroup = new QmlPropGroupNode(qmlClass, name, false); + if (member->isDefaultMember) + qmlPropGroup->setDefault(); + QmlPropertyNode *qmlPropNode = new QmlPropertyNode(qmlPropGroup, name, type, false); + qmlPropNode->setWritable(!member->isReadonlyMember); + applyDocumentation(member->firstSourceLocation(), qmlPropNode); + } + } break; } default: diff --git a/tools/qdoc3/qmlvisitor.h b/tools/qdoc3/qmlvisitor.h index 01da98e..a830793 100644 --- a/tools/qdoc3/qmlvisitor.h +++ b/tools/qdoc3/qmlvisitor.h @@ -66,8 +66,7 @@ public: private: QmlJS::AST::SourceLocation precedingComment(unsigned offset) const; - void applyDocumentation(QmlJS::AST::SourceLocation location, - InnerNode *node); + void applyDocumentation(QmlJS::AST::SourceLocation location, Node *node); QmlJS::Engine *engine; quint32 lastEndOffset; -- cgit v0.12 From 344c3ad32bd36ad67731aa3171103a6c5e2f93e0 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Sun, 28 Nov 2010 20:44:21 +0100 Subject: Added the foundations of QML markup support. Use the QtDeclarative parser instead of Qt Creator's QML parser. Split the QML visitor into documentation and markup visitors. The code marker used for each file is now determined from its extension. --- tools/qdoc3/cppcodemarker.cpp | 1 - tools/qdoc3/cppcodemarker.h | 56 +- tools/qdoc3/ditaxmlgenerator.cpp | 4 +- tools/qdoc3/ditaxmlgenerator.h | 2 +- tools/qdoc3/generator.h | 2 +- tools/qdoc3/htmlgenerator.cpp | 26 +- tools/qdoc3/htmlgenerator.h | 5 +- tools/qdoc3/main.cpp | 12 +- tools/qdoc3/node.cpp | 1 - tools/qdoc3/pagegenerator.cpp | 14 +- tools/qdoc3/pagegenerator.h | 4 +- tools/qdoc3/qdoc3.pro | 9 +- tools/qdoc3/qmlcodeparser.cpp | 18 +- tools/qdoc3/qmlcodeparser.h | 12 +- tools/qdoc3/qmlmarkupvisitor.cpp | 1415 ++++++++++++++++++++++++++++++++++++++ tools/qdoc3/qmlmarkupvisitor.h | 338 +++++++++ tools/qdoc3/qmlvisitor.cpp | 48 +- tools/qdoc3/qmlvisitor.h | 36 +- 18 files changed, 1877 insertions(+), 126 deletions(-) create mode 100644 tools/qdoc3/qmlmarkupvisitor.cpp create mode 100644 tools/qdoc3/qmlmarkupvisitor.h diff --git a/tools/qdoc3/cppcodemarker.cpp b/tools/qdoc3/cppcodemarker.cpp index 576d103..55a455f 100644 --- a/tools/qdoc3/cppcodemarker.cpp +++ b/tools/qdoc3/cppcodemarker.cpp @@ -43,7 +43,6 @@ cppcodemarker.cpp */ -#include #include "atom.h" #include "cppcodemarker.h" #include "node.h" diff --git a/tools/qdoc3/cppcodemarker.h b/tools/qdoc3/cppcodemarker.h index 804a302..40695c5 100644 --- a/tools/qdoc3/cppcodemarker.h +++ b/tools/qdoc3/cppcodemarker.h @@ -56,36 +56,36 @@ class CppCodeMarker : public CodeMarker CppCodeMarker(); ~CppCodeMarker(); - bool recognizeCode(const QString& code); - bool recognizeExtension(const QString& ext); - bool recognizeLanguage(const QString& lang); - QString plainName(const Node *node); - QString plainFullName(const Node *node, const Node *relative); - QString markedUpCode(const QString& code, - const Node *relative, - const QString& dirPath); - QString markedUpSynopsis(const Node *node, - const Node *relative, - SynopsisStyle style); + virtual bool recognizeCode(const QString& code); + virtual bool recognizeExtension(const QString& ext); + virtual bool recognizeLanguage(const QString& lang); + virtual QString plainName(const Node *node); + virtual QString plainFullName(const Node *node, const Node *relative); + virtual QString markedUpCode(const QString& code, + const Node *relative, + const QString& dirPath); + virtual QString markedUpSynopsis(const Node *node, + const Node *relative, + SynopsisStyle style); #ifdef QDOC_QML - QString markedUpQmlItem(const Node *node, bool summary); + virtual QString markedUpQmlItem(const Node *node, bool summary); #endif - QString markedUpName(const Node *node); - QString markedUpFullName(const Node *node, const Node *relative); - QString markedUpEnumValue(const QString &enumValue, const Node *relative); - QString markedUpIncludes(const QStringList& includes); - QString functionBeginRegExp(const QString& funcName); - QString functionEndRegExp(const QString& funcName); - QList
    sections(const InnerNode *innerNode, - SynopsisStyle style, - Status status); - QList
    qmlSections(const QmlClassNode* qmlClassNode, - SynopsisStyle style, - const Tree* tree); - const Node* resolveTarget(const QString& target, - const Tree* tree, - const Node* relative, - const Node* self = 0); + virtual QString markedUpName(const Node *node); + virtual QString markedUpFullName(const Node *node, const Node *relative); + virtual QString markedUpEnumValue(const QString &enumValue, const Node *relative); + virtual QString markedUpIncludes(const QStringList& includes); + virtual QString functionBeginRegExp(const QString& funcName); + virtual QString functionEndRegExp(const QString& funcName); + virtual QList
    sections(const InnerNode *innerNode, + SynopsisStyle style, + Status status); + virtual QList
    qmlSections(const QmlClassNode* qmlClassNode, + SynopsisStyle style, + const Tree* tree); + virtual const Node* resolveTarget(const QString& target, + const Tree* tree, + const Node* relative, + const Node* self = 0); private: QString addMarkUp(const QString& protectedCode, diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index ce597f2..1014f79 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -533,7 +533,7 @@ QString DitaXmlGenerator::lookupGuid(QString text) \note The file generation is done in the base class, PageGenerator::generateTree(). */ -void DitaXmlGenerator::generateTree(const Tree *tree, CodeMarker *marker) +void DitaXmlGenerator::generateTree(const Tree *tree) { myTree = tree; nonCompatClasses.clear(); @@ -552,7 +552,7 @@ void DitaXmlGenerator::generateTree(const Tree *tree, CodeMarker *marker) findAllNamespaces(tree->root()); findAllSince(tree->root()); - PageGenerator::generateTree(tree, marker); + PageGenerator::generateTree(tree); } void DitaXmlGenerator::startText(const Node* /* relative */, diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index 36bd990..a29df77 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -91,7 +91,7 @@ class DitaXmlGenerator : public PageGenerator virtual void initializeGenerator(const Config& config); virtual void terminateGenerator(); virtual QString format(); - virtual void generateTree(const Tree *tree, CodeMarker *marker); + virtual void generateTree(const Tree *tree); QString protectEnc(const QString &string); static QString protect(const QString &string, const QString &encoding = "ISO-8859-1"); diff --git a/tools/qdoc3/generator.h b/tools/qdoc3/generator.h index 326a247..18c3855 100644 --- a/tools/qdoc3/generator.h +++ b/tools/qdoc3/generator.h @@ -78,7 +78,7 @@ class Generator virtual void terminateGenerator(); virtual QString format() = 0; virtual bool canHandleFormat(const QString &format) { return format == this->format(); } - virtual void generateTree(const Tree *tree, CodeMarker *marker) = 0; + virtual void generateTree(const Tree *tree) = 0; static void initialize(const Config& config); static void terminate(); diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 3f76204..9f5f182 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -217,9 +217,9 @@ HtmlGenerator::HtmlGenerator() threeColumnEnumValueTable(true), funcLeftParen("\\S(\\()"), myTree(0), + inObsoleteLink(false), slow(false), - obsoleteLinks(false), - inObsoleteLink(false) + obsoleteLinks(false) { } @@ -356,7 +356,7 @@ QString HtmlGenerator::format() \note The HTML file generation is done in the base class, PageGenerator::generateTree(). */ -void HtmlGenerator::generateTree(const Tree *tree, CodeMarker *marker) +void HtmlGenerator::generateTree(const Tree *tree) { myTree = tree; nonCompatClasses.clear(); @@ -375,11 +375,11 @@ void HtmlGenerator::generateTree(const Tree *tree, CodeMarker *marker) findAllNamespaces(tree->root()); findAllSince(tree->root()); - PageGenerator::generateTree(tree, marker); + PageGenerator::generateTree(tree); QString fileBase = project.toLower().simplified().replace(" ", "-"); generateIndex(fileBase, projectUrl, projectDescription); - generatePageIndex(outputDir() + "/" + fileBase + ".pageindex", marker); + generatePageIndex(outputDir() + "/" + fileBase + ".pageindex"); helpProjectWriter->generate(myTree); } @@ -2913,18 +2913,6 @@ void HtmlGenerator::generateLink(const Atom* atom, } inLink = false; out() << protectEnc(atom->string().mid(k)); - } else if (marker->recognizeLanguage("Java")) { - // hack for Java: remove () and use when appropriate - bool func = atom->string().endsWith("()"); - bool tt = (func || atom->string().contains(camelCase)); - if (tt) - out() << ""; - if (func) { - out() << protectEnc(atom->string().left(atom->string().length() - 2)); - } else { - out() << protectEnc(atom->string()); - } - out() << ""; } else { out() << protectEnc(atom->string()); } @@ -4168,12 +4156,14 @@ void HtmlGenerator::generatePageElements(QXmlStreamWriter& writer, const Node* n /*! Outputs the file containing the index used for searching the html docs. */ -void HtmlGenerator::generatePageIndex(const QString& fileName, CodeMarker* marker) const +void HtmlGenerator::generatePageIndex(const QString& fileName) const { QFile file(fileName); if (!file.open(QFile::WriteOnly | QFile::Text)) return ; + CodeMarker *marker = CodeMarker::markerForFileName(fileName); + QXmlStreamWriter writer(&file); writer.setAutoFormatting(true); writer.writeStartDocument(); diff --git a/tools/qdoc3/htmlgenerator.h b/tools/qdoc3/htmlgenerator.h index 547cf2f..4276475 100644 --- a/tools/qdoc3/htmlgenerator.h +++ b/tools/qdoc3/htmlgenerator.h @@ -92,7 +92,7 @@ class HtmlGenerator : public PageGenerator virtual void initializeGenerator(const Config& config); virtual void terminateGenerator(); virtual QString format(); - virtual void generateTree(const Tree *tree, CodeMarker *marker); + virtual void generateTree(const Tree *tree); QString protectEnc(const QString &string); static QString protect(const QString &string, const QString &encoding = "ISO-8859-1"); @@ -247,8 +247,7 @@ class HtmlGenerator : public PageGenerator void generatePageElements(QXmlStreamWriter& writer, const Node* node, CodeMarker* marker) const; - void generatePageIndex(const QString& fileName, - CodeMarker* marker) const; + void generatePageIndex(const QString& fileName) const; void generateExtractionMark(const Node *node, ExtractionMarkType markType); QMap refMap; diff --git a/tools/qdoc3/main.cpp b/tools/qdoc3/main.cpp index 2d3f034..ac1c5de 100644 --- a/tools/qdoc3/main.cpp +++ b/tools/qdoc3/main.cpp @@ -55,6 +55,7 @@ #include "htmlgenerator.h" #include "plaincodemarker.h" #include "puredocparser.h" +#include "qmlcodemarker.h" #include "qmlcodeparser.h" #include "tokenizer.h" #include "tree.h" @@ -243,14 +244,6 @@ static void processQdocconfFile(const QString &fileName) Location outputFormatsLocation = config.lastLocation(); /* - There must be a code marker for the source code language, e.g. C++. - If there isn't one, give up. - */ - CodeMarker *marker = CodeMarker::markerForLanguage(lang); - if (!marker && !outputFormats.isEmpty()) - langLocation.fatal(tr("Cannot output documentation for programming language '%1'").arg(lang)); - - /* Read some XML indexes containing definitions from other documentation sets. */ QStringList indexFiles = config.getStringList(CONFIG_INDEXES); @@ -334,7 +327,7 @@ static void processQdocconfFile(const QString &fileName) if (generator == 0) outputFormatsLocation.fatal(tr("Unknown output format '%1'") .arg(*of)); - generator->generateTree(tree, marker); + generator->generateTree(tree); ++of; } @@ -390,6 +383,7 @@ int main(int argc, char **argv) */ PlainCodeMarker plainMarker; CppCodeMarker cppMarker; + QmlCodeMarker qmlMarker; HtmlGenerator htmlGenerator; DitaXmlGenerator ditaxmlGenerator; diff --git a/tools/qdoc3/node.cpp b/tools/qdoc3/node.cpp index 3e8230c..838bbfb 100644 --- a/tools/qdoc3/node.cpp +++ b/tools/qdoc3/node.cpp @@ -45,7 +45,6 @@ #include "node.h" #include "tree.h" -#include "codemarker.h" #include QT_BEGIN_NAMESPACE diff --git a/tools/qdoc3/pagegenerator.cpp b/tools/qdoc3/pagegenerator.cpp index 37dc191..60b40c9 100644 --- a/tools/qdoc3/pagegenerator.cpp +++ b/tools/qdoc3/pagegenerator.cpp @@ -46,6 +46,7 @@ #include #include #include +#include "codemarker.h" #include "pagegenerator.h" #include "tree.h" @@ -175,9 +176,9 @@ bool PageGenerator::parseArg(const QString& src, /*! This function is recursive. */ -void PageGenerator::generateTree(const Tree *tree, CodeMarker *marker) +void PageGenerator::generateTree(const Tree *tree) { - generateInnerNode(tree->root(), marker); + generateInnerNode(tree->root()); } QString PageGenerator::fileBase(const Node *node) const @@ -301,7 +302,7 @@ QTextStream &PageGenerator::out() Recursive writing of html files from the root \a node. */ void -PageGenerator::generateInnerNode(const InnerNode* node, CodeMarker* marker) +PageGenerator::generateInnerNode(const InnerNode* node) { if (!node->url().isNull()) return; @@ -320,6 +321,11 @@ PageGenerator::generateInnerNode(const InnerNode* node, CodeMarker* marker) } } + /* + Obtain a code marker for the source file. + */ + CodeMarker *marker = CodeMarker::markerForFileName(node->location().filePath()); + if (node->parent() != 0) { beginSubPage(node->location(), fileName(node)); if (node->type() == Node::Namespace || node->type() == Node::Class) { @@ -334,7 +340,7 @@ PageGenerator::generateInnerNode(const InnerNode* node, CodeMarker* marker) NodeList::ConstIterator c = node->childNodes().begin(); while (c != node->childNodes().end()) { if ((*c)->isInnerNode() && (*c)->access() != Node::Private) - generateInnerNode((const InnerNode *) *c, marker); + generateInnerNode((const InnerNode *) *c); ++c; } } diff --git a/tools/qdoc3/pagegenerator.h b/tools/qdoc3/pagegenerator.h index 1aa24a1..abb8f1c 100644 --- a/tools/qdoc3/pagegenerator.h +++ b/tools/qdoc3/pagegenerator.h @@ -66,7 +66,7 @@ class PageGenerator : public Generator PageGenerator(); ~PageGenerator(); - virtual void generateTree(const Tree *tree, CodeMarker *marker); + virtual void generateTree(const Tree *tree); protected: virtual QString fileBase(const Node *node) const; @@ -75,7 +75,7 @@ class PageGenerator : public Generator QString outFileName(); void beginSubPage(const Location& location, const QString& fileName); void endSubPage(); - virtual void generateInnerNode(const InnerNode *node, CodeMarker *marker); + virtual void generateInnerNode(const InnerNode *node); QTextStream& out(); QString naturalLanguage; diff --git a/tools/qdoc3/qdoc3.pro b/tools/qdoc3/qdoc3.pro index 2c91a9c..23ff7bd 100644 --- a/tools/qdoc3/qdoc3.pro +++ b/tools/qdoc3/qdoc3.pro @@ -43,7 +43,9 @@ HEADERS += atom.h \ pagegenerator.h \ plaincodemarker.h \ puredocparser.h \ + qmlcodemarker.h \ qmlcodeparser.h \ + qmlmarkupvisitor.h \ qmlvisitor.h \ quoter.h \ separator.h \ @@ -71,7 +73,9 @@ SOURCES += atom.cpp \ pagegenerator.cpp \ plaincodemarker.cpp \ puredocparser.cpp \ + qmlcodemarker.cpp \ qmlcodeparser.cpp \ + qmlmarkupvisitor.cpp \ qmlvisitor.cpp \ quoter.cpp \ separator.cpp \ @@ -80,10 +84,9 @@ SOURCES += atom.cpp \ tree.cpp \ yyindent.cpp -# Include the QML parsing library from Qt Creator. +INCLUDEPATH += $$(QT_BUILD_TREE)/include/QtDeclarative -LIBS += -L$$(QTCREATOR_LIBPATH) -lQmlJS -lUtils -INCLUDEPATH += $$(QTCREATOR_INCPATH) +include($$(QT_SOURCE_TREE)/src/declarative/qml/parser/parser.pri) ### Documentation for qdoc3 ### diff --git a/tools/qdoc3/qmlcodeparser.cpp b/tools/qdoc3/qmlcodeparser.cpp index c6ace7d..329912c 100644 --- a/tools/qdoc3/qmlcodeparser.cpp +++ b/tools/qdoc3/qmlcodeparser.cpp @@ -43,9 +43,9 @@ qmlcodeparser.cpp */ -#include "parser/qmljsast_p.h" -#include "parser/qmljsastvisitor_p.h" -#include "parser/qmljsnodepool_p.h" +#include "private/qdeclarativejsast_p.h" +#include "private/qdeclarativejsastvisitor_p.h" +#include "private/qdeclarativejsnodepool_p.h" #include "qmlcodeparser.h" #include "node.h" @@ -84,8 +84,8 @@ void QmlCodeParser::initializeParser(const Config &config) { CodeParser::initializeParser(config); - lexer = new QmlJS::Lexer(&engine); - parser = new QmlJS::Parser(&engine); + lexer = new QDeclarativeJS::Lexer(&engine); + parser = new QDeclarativeJS::Parser(&engine); } void QmlCodeParser::terminateParser() @@ -125,12 +125,12 @@ void QmlCodeParser::parseSourceFile(const Location& location, QSet metacommandsAllowed = topicCommandsAllowed + otherMetacommandsAllowed; - QmlJS::NodePool m_nodePool(filePath, &engine); + QDeclarativeJS::NodePool m_nodePool(filePath, &engine); if (parser->parse()) { - QmlJS::AST::UiProgram *ast = parser->ast(); - DocVisitor visitor(filePath, document, &engine, tree, metacommandsAllowed); - QmlJS::AST::Node::accept(ast, &visitor); + QDeclarativeJS::AST::UiProgram *ast = parser->ast(); + QmlDocVisitor visitor(filePath, document, &engine, tree, metacommandsAllowed); + QDeclarativeJS::AST::Node::accept(ast, &visitor); } } diff --git a/tools/qdoc3/qmlcodeparser.h b/tools/qdoc3/qmlcodeparser.h index f6d6684..a99e8a3 100644 --- a/tools/qdoc3/qmlcodeparser.h +++ b/tools/qdoc3/qmlcodeparser.h @@ -47,9 +47,9 @@ #define QMLCODEPARSER_H #include -#include "parser/qmljsengine_p.h" -#include "parser/qmljslexer_p.h" -#include "parser/qmljsparser_p.h" +#include "private/qdeclarativejsengine_p.h" +#include "private/qdeclarativejslexer_p.h" +#include "private/qdeclarativejsparser_p.h" #include "codeparser.h" #include "location.h" @@ -80,9 +80,9 @@ protected: virtual QSet otherMetaCommands(); private: - QmlJS::Engine engine; - QmlJS::Lexer *lexer; - QmlJS::Parser *parser; + QDeclarativeJS::Engine engine; + QDeclarativeJS::Lexer *lexer; + QDeclarativeJS::Parser *parser; }; QT_END_NAMESPACE diff --git a/tools/qdoc3/qmlmarkupvisitor.cpp b/tools/qdoc3/qmlmarkupvisitor.cpp new file mode 100644 index 0000000..72a2334 --- /dev/null +++ b/tools/qdoc3/qmlmarkupvisitor.cpp @@ -0,0 +1,1415 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include +#include "private/qdeclarativejsast_p.h" +#include "private/qdeclarativejsastfwd_p.h" +#include "private/qdeclarativejsengine_p.h" + +#include "qmlmarkupvisitor.h" + +QT_BEGIN_NAMESPACE + +QmlMarkupVisitor::QmlMarkupVisitor(const QString &source, bool debug) +{ + this->source = source; + indent = 0; + cursor = 0; + showDebug = debug; +} + +QmlMarkupVisitor::~QmlMarkupVisitor() +{ +} + +QString QmlMarkupVisitor::markedUpCode() +{ + if (cursor < source.length()) + return output + source.mid(cursor); + else + return output; +} + +void QmlMarkupVisitor::addMarkedUpToken( + QDeclarativeJS::AST::SourceLocation &location, const QString &text) +{ + //qDebug() << "t**" << cursor << location.offset; + if (location.offset > cursor) { + QString extra = source.mid(cursor, location.offset - cursor); + if (extra.trimmed().isEmpty()) + output += extra; + else + output += "<<<" + extra + ">>>"; + //qDebug() << "+++" << source.mid(cursor, location.offset - cursor); + cursor += location.offset; + } + + //qDebug() << "-->" << text; + output += text; + cursor += location.length; +} + +QString QmlMarkupVisitor::sourceText(QDeclarativeJS::AST::SourceLocation &location) +{ + return source.mid(location.offset, location.length); +} + +void QmlMarkupVisitor::addVerbatim(QDeclarativeJS::AST::SourceLocation first, + QDeclarativeJS::AST::SourceLocation last) +{ + quint32 start = first.begin(); + //qDebug() << "v**" << cursor << start; + quint32 finish; + if (last.isValid()) + finish = last.end(); + else + finish = first.end(); + + if (start > cursor) { + QString extra = source.mid(cursor, start - cursor); + if (extra.trimmed().isEmpty()) + output += extra; + else + output += "<<<" + extra + ">>>"; + //qDebug() << "+++" << source.mid(cursor, start - cursor); + cursor = start; + } + + QString text = source.mid(start, finish - start); + //qDebug() << "-->" << text; + write(text); + indent -= 1; + output += text; + cursor += text.length(); +} + +void QmlMarkupVisitor::write(const QString &text) +{ + if (showDebug) + qDebug() << QString().fill(QChar(' '), indent) << text; + indent += 1; +} + +void QmlMarkupVisitor::endWrite(const QString &) +{ + indent -= 1; +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiProgram *) +{ + write(""); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiProgram *) +{ + endWrite(""); +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiImport *uiimport) +{ + write(""); + addVerbatim(uiimport->importToken); + if (!uiimport->importUri) + addVerbatim(uiimport->fileNameToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiImport *uiimport) +{ + endWrite(""); + addVerbatim(uiimport->versionToken); + addVerbatim(uiimport->asToken); + addVerbatim(uiimport->importIdToken); + addVerbatim(uiimport->semicolonToken); + //endWrite(""); +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiPublicMember *member) +{ + write(""); + if (member->type == QDeclarativeJS::AST::UiPublicMember::Property) { + addVerbatim(member->defaultToken); + addVerbatim(member->readonlyToken); + addVerbatim(member->propertyToken); + addVerbatim(member->typeModifierToken); + addVerbatim(member->typeToken); + addVerbatim(member->identifierToken); + addVerbatim(member->colonToken); + QDeclarativeJS::AST::Node::accept(member->binding, this); + } else { + addVerbatim(member->propertyToken); + addVerbatim(member->typeModifierToken); + addVerbatim(member->typeToken); + //addVerbatim(member->identifierToken); + QDeclarativeJS::AST::Node::accept(member->parameters, this); + } + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiPublicMember *member) +{ + addVerbatim(member->semicolonToken); + endWrite(""); +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiSourceElement *) +{ + write(""); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiSourceElement *) +{ + endWrite(""); +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiParameterList *) +{ + write(""); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiParameterList *) +{ + endWrite(""); +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiObjectInitializer *initializer) +{ + write(""); + addVerbatim(initializer->lbraceToken, initializer->lbraceToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiObjectInitializer *initializer) +{ + endWrite(""); + addVerbatim(initializer->rbraceToken, initializer->rbraceToken); +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiObjectBinding *binding) +{ + write(""); + QDeclarativeJS::AST::Node::accept(binding->qualifiedId, this); + addVerbatim(binding->colonToken); + QDeclarativeJS::AST::Node::accept(binding->qualifiedTypeNameId, this); + QDeclarativeJS::AST::Node::accept(binding->initializer, this); + return false; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiObjectBinding *) +{ + endWrite(""); +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiScriptBinding *binding) +{ + write(""); + QDeclarativeJS::AST::Node::accept(binding->qualifiedId, this); + addVerbatim(binding->colonToken); + QDeclarativeJS::AST::Node::accept(binding->statement, this); + return false; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiScriptBinding *) +{ + endWrite(""); +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiArrayBinding *binding) +{ + write(""); + QDeclarativeJS::AST::Node::accept(binding->qualifiedId, this); + addVerbatim(binding->colonToken); + addVerbatim(binding->lbracketToken); + QDeclarativeJS::AST::Node::accept(binding->members, this); + addVerbatim(binding->rbracketToken); + return false; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiArrayBinding *formal) +{ + endWrite(""); +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiArrayMemberList *list) +{ + write(""); + for (QDeclarativeJS::AST::UiArrayMemberList *it = list; it; it = it->next) { + QDeclarativeJS::AST::Node::accept(it->member, this); + addVerbatim(it->commaToken); + } + return false; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiArrayMemberList *) +{ + endWrite(""); +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiQualifiedId *id) +{ + write(""); + addVerbatim(id->identifierToken); + return false; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiQualifiedId *) +{ + endWrite(""); +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiSignature *signature) +{ + write(""); + addVerbatim(signature->lparenToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiSignature *signature) +{ + addVerbatim(signature->rparenToken); + endWrite(""); +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiFormal *formal) +{ + write(""); + addVerbatim(formal->identifierToken); + addVerbatim(formal->asToken); + addVerbatim(formal->aliasToken); + return false; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiFormal *) +{ + endWrite(""); +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ThisExpression *expression) +{ + write(""); + addVerbatim(expression->thisToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ThisExpression *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::IdentifierExpression *identifier) +{ + write(""); + addVerbatim(identifier->identifierToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::IdentifierExpression *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NullExpression *null) +{ + write(""); + addVerbatim(null->nullToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::NullExpression *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::TrueLiteral *literal) +{ + write(""); + addVerbatim(literal->trueToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::TrueLiteral *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FalseLiteral *literal) +{ + write(""); + addVerbatim(literal->falseToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::FalseLiteral *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NumericLiteral *literal) +{ + //write(""); + addVerbatim(literal->literalToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::NumericLiteral *) +{ + //endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::StringLiteral *literal) +{ + //write(""); + addVerbatim(literal->literalToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::StringLiteral *) +{ + //endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::RegExpLiteral *literal) +{ + write(""); + addVerbatim(literal->literalToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::RegExpLiteral *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ArrayLiteral *literal) +{ + write(""); + addVerbatim(literal->lbracketToken); + QDeclarativeJS::AST::Node::accept(literal->elements, this); + addVerbatim(literal->rbracketToken); + return false; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ArrayLiteral *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ObjectLiteral *literal) +{ + write(""); + addVerbatim(literal->lbraceToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ObjectLiteral *literal) +{ + addVerbatim(literal->rbraceToken); + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ElementList *list) +{ + write(""); + for (QDeclarativeJS::AST::ElementList *it = list; it; it = it->next) { + QDeclarativeJS::AST::Node::accept(it->expression, this); + addVerbatim(it->commaToken); + } + QDeclarativeJS::AST::Node::accept(list->elision, this); + return false; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ElementList *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Elision *elision) +{ + write(""); + addVerbatim(elision->commaToken, elision->commaToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::Elision *) +{ + endWrite(""); +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::IdentifierPropertyName *) +{ + write(""); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::IdentifierPropertyName *) +{ + endWrite(""); +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::StringLiteralPropertyName *) +{ + write(""); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::StringLiteralPropertyName *) +{ + endWrite(""); +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NumericLiteralPropertyName *) +{ + write(""); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::NumericLiteralPropertyName *) +{ + endWrite(""); +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::PropertyNameAndValueList *list) +{ + write(""); + QDeclarativeJS::AST::Node::accept(list->name, this); + addVerbatim(list->colonToken, list->colonToken); + QDeclarativeJS::AST::Node::accept(list->value, this); + addVerbatim(list->commaToken, list->commaToken); + return false; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::PropertyNameAndValueList *) +{ + endWrite(""); +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NestedExpression *expression) +{ + write(""); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::NestedExpression *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ArrayMemberExpression *expression) +{ + write(""); + QDeclarativeJS::AST::Node::accept(expression->base, this); + addVerbatim(expression->lbracketToken); + QDeclarativeJS::AST::Node::accept(expression->expression, this); + addVerbatim(expression->rbracketToken); + return false; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ArrayMemberExpression *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FieldMemberExpression *expression) +{ + write(""); + QDeclarativeJS::AST::Node::accept(expression->base, this); + addVerbatim(expression->dotToken); + addVerbatim(expression->identifierToken); + return false; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::FieldMemberExpression *expression) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NewMemberExpression *expression) +{ + write(""); + addVerbatim(expression->newToken); + QDeclarativeJS::AST::Node::accept(expression->base, this); + addVerbatim(expression->lparenToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::NewMemberExpression *expression) +{ + addVerbatim(expression->rparenToken); + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NewExpression *expression) +{ + write(""); + addVerbatim(expression->newToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::NewExpression *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::CallExpression *expression) +{ + write(""); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::CallExpression *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ArgumentList *list) +{ + write(""); + addVerbatim(list->commaToken, list->commaToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ArgumentList *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::PostIncrementExpression *expression) +{ + write(""); + addVerbatim(expression->incrementToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::PostIncrementExpression *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::PostDecrementExpression *expression) +{ + write(""); + addVerbatim(expression->decrementToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::PostDecrementExpression *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::DeleteExpression *expression) +{ + write(""); + addVerbatim(expression->deleteToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::DeleteExpression *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::VoidExpression *expression) +{ + write(""); + addVerbatim(expression->voidToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::VoidExpression *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::TypeOfExpression *expression) +{ + write(""); + addVerbatim(expression->typeofToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::TypeOfExpression *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::PreIncrementExpression *expression) +{ + write(""); + addVerbatim(expression->incrementToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::PreIncrementExpression *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::PreDecrementExpression *expression) +{ + write(""); + addVerbatim(expression->decrementToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::PreDecrementExpression *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UnaryPlusExpression *expression) +{ + write(""); + addVerbatim(expression->plusToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UnaryPlusExpression *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UnaryMinusExpression *expression) +{ + write(""); + addVerbatim(expression->minusToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UnaryMinusExpression *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::TildeExpression *expression) +{ + write(""); + addVerbatim(expression->tildeToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::TildeExpression *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NotExpression *expression) +{ + write(""); + addVerbatim(expression->notToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::NotExpression *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::BinaryExpression *expression) +{ + write(""); + QDeclarativeJS::AST::Node::accept(expression->left, this); + addVerbatim(expression->operatorToken); + QDeclarativeJS::AST::Node::accept(expression->right, this); + return false; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::BinaryExpression *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ConditionalExpression *expression) +{ + write(""); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ConditionalExpression *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Expression *expression) +{ + write(""); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::Expression *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Block *block) +{ + write(""); + addVerbatim(block->lbraceToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::Block *block) +{ + addVerbatim(block->rbraceToken); + endWrite(""); +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::StatementList *) +{ + write(""); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::StatementList *) +{ + endWrite(""); + addVerbatim(statement->declarationKindToken); + QDeclarativeJS::AST::Node::accept(statement->declarations, this); + addVerbatim(statement->semicolonToken); + return false; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::VariableStatement *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::VariableDeclarationList *list) +{ + write(""); + for (QDeclarativeJS::AST::VariableDeclarationList *it = list; it; it = it->next) { + QDeclarativeJS::AST::Node::accept(it->declaration, this); + addVerbatim(it->commaToken); + } + return false; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::VariableDeclarationList *) +{ + endWrite(""); +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::VariableDeclaration *declaration) +{ + write(""); + addVerbatim(declaration->identifierToken); + QDeclarativeJS::AST::Node::accept(declaration->expression, this); + return false; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::VariableDeclaration *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::EmptyStatement *statement) +{ + write(""); + addVerbatim(statement->semicolonToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::EmptyStatement *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ExpressionStatement *) +{ + write(""); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ExpressionStatement *statement) +{ + addVerbatim(statement->semicolonToken); + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::IfStatement *statement) +{ + write(""); + addVerbatim(statement->ifToken); + addVerbatim(statement->lparenToken); + QDeclarativeJS::AST::Node::accept(statement->expression, this); + addVerbatim(statement->rparenToken); + QDeclarativeJS::AST::Node::accept(statement->ok, this); + //addVerbatim(statement->elseToken); ### this token referred to the wrong source text for some reason + QDeclarativeJS::AST::Node::accept(statement->ko, this); + return false; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::IfStatement *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::DoWhileStatement *statement) +{ + write(""); + addVerbatim(statement->doToken); + QDeclarativeJS::AST::Node::accept(statement->statement, this); + addVerbatim(statement->whileToken); + addVerbatim(statement->lparenToken); + QDeclarativeJS::AST::Node::accept(statement->expression, this); + addVerbatim(statement->rparenToken); + addVerbatim(statement->semicolonToken); + return false; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::DoWhileStatement *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::WhileStatement *statement) +{ + write(""); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::WhileStatement *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ForStatement *statement) +{ + write(""); + addVerbatim(statement->forToken); + addVerbatim(statement->lparenToken); + QDeclarativeJS::AST::Node::accept(statement->initialiser, this); + addVerbatim(statement->firstSemicolonToken); + QDeclarativeJS::AST::Node::accept(statement->condition, this); + addVerbatim(statement->secondSemicolonToken); + QDeclarativeJS::AST::Node::accept(statement->expression, this); + addVerbatim(statement->rparenToken); + QDeclarativeJS::AST::Node::accept(statement->statement, this); + return false; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ForStatement *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::LocalForStatement *statement) +{ + write(""); + addVerbatim(statement->forToken); + addVerbatim(statement->lparenToken); + addVerbatim(statement->varToken); + QDeclarativeJS::AST::Node::accept(statement->declarations, this); + addVerbatim(statement->firstSemicolonToken); + QDeclarativeJS::AST::Node::accept(statement->condition, this); + addVerbatim(statement->secondSemicolonToken); + QDeclarativeJS::AST::Node::accept(statement->expression, this); + addVerbatim(statement->rparenToken); + QDeclarativeJS::AST::Node::accept(statement->statement, this); + return false; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::LocalForStatement *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ForEachStatement *statement) +{ + write(""); + addVerbatim(statement->forToken); + addVerbatim(statement->lparenToken); + QDeclarativeJS::AST::Node::accept(statement->initialiser, this); + addVerbatim(statement->inToken); + QDeclarativeJS::AST::Node::accept(statement->expression, this); + addVerbatim(statement->rparenToken); + QDeclarativeJS::AST::Node::accept(statement->statement, this); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ForEachStatement *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::LocalForEachStatement *statement) +{ + write(""); + addVerbatim(statement->forToken); + addVerbatim(statement->lparenToken); + addVerbatim(statement->varToken); + QDeclarativeJS::AST::Node::accept(statement->declaration, this); + addVerbatim(statement->inToken); + QDeclarativeJS::AST::Node::accept(statement->expression, this); + addVerbatim(statement->rparenToken); + QDeclarativeJS::AST::Node::accept(statement->statement, this); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::LocalForEachStatement *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ContinueStatement *statement) +{ + write(""); + addVerbatim(statement->continueToken); + addVerbatim(statement->identifierToken); + addVerbatim(statement->semicolonToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ContinueStatement *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::BreakStatement *statement) +{ + write(""); + addVerbatim(statement->breakToken); + addVerbatim(statement->identifierToken); + addVerbatim(statement->semicolonToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::BreakStatement *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ReturnStatement *statement) +{ + write(""); + addVerbatim(statement->returnToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ReturnStatement *statement) +{ + addVerbatim(statement->semicolonToken); + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::WithStatement *statement) +{ + write(""); + addVerbatim(statement->withToken); + addVerbatim(statement->lparenToken); + addVerbatim(statement->rparenToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::WithStatement *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::CaseBlock *block) +{ + write(""); + addVerbatim(block->lbraceToken, block->lbraceToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::CaseBlock *block) +{ + endWrite(""); + addVerbatim(block->rbraceToken, block->rbraceToken); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::SwitchStatement *statement) +{ + write(""); + addVerbatim(statement->switchToken); + addVerbatim(statement->lparenToken); + QDeclarativeJS::AST::Node::accept(statement->expression, this); + addVerbatim(statement->rparenToken); + QDeclarativeJS::AST::Node::accept(statement->block, this); + return false; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::SwitchStatement *statement) +{ + endWrite(""); +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::CaseClauses *) +{ + write(""); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::CaseClauses *) +{ + endWrite(""); +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::CaseClause *clause) +{ + write(""); + addVerbatim(clause->caseToken); + QDeclarativeJS::AST::Node::accept(clause->expression, this); + addVerbatim(clause->colonToken); + QDeclarativeJS::AST::Node::accept(clause->statements, this); + return false; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::CaseClause *clause) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::DefaultClause *clause) +{ + write(""); + addVerbatim(clause->defaultToken, clause->defaultToken); + addVerbatim(clause->colonToken, clause->colonToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::DefaultClause *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::LabelledStatement *statement) +{ + write(""); + addVerbatim(statement->identifierToken); + addVerbatim(statement->colonToken); + QDeclarativeJS::AST::Node::accept(statement->statement, this); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::LabelledStatement *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ThrowStatement *statement) +{ + write(""); + addVerbatim(statement->throwToken); + QDeclarativeJS::AST::Node::accept(statement->expression, this); + addVerbatim(statement->semicolonToken); + return false; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ThrowStatement *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Catch *c) +{ + write(""); + addVerbatim(c->catchToken, c->catchToken); + addVerbatim(c->lparenToken, c->lparenToken); + addVerbatim(c->identifierToken, c->identifierToken); + addVerbatim(c->rparenToken, c->rparenToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::Catch *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Finally *f) +{ + write(""); + addVerbatim(f->finallyToken); + QDeclarativeJS::AST::Node::accept(f->statement, this); + return false; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::Finally *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::TryStatement *statement) +{ + write(""); + addVerbatim(statement->tryToken); + QDeclarativeJS::AST::Node::accept(statement->statement, this); + QDeclarativeJS::AST::Node::accept(statement->catchExpression, this); + QDeclarativeJS::AST::Node::accept(statement->finallyExpression, this); + return false; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::TryStatement *) +{ + endWrite(""); +} + + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FunctionExpression *expression) +{ + write(""); + addVerbatim(expression->functionToken); + addVerbatim(expression->identifierToken); + addVerbatim(expression->lparenToken); + QDeclarativeJS::AST::Node::accept(expression->formals, this); + addVerbatim(expression->rparenToken); + addVerbatim(expression->lbraceToken); + QDeclarativeJS::AST::Node::accept(expression->body, this); + addVerbatim(expression->rbraceToken); + return false; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::FunctionExpression *expression) +{ + endWrite(""); +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FunctionDeclaration *declaration) +{ + write(""); + addVerbatim(declaration->functionToken); + addVerbatim(declaration->identifierToken); + addVerbatim(declaration->lparenToken); + QDeclarativeJS::AST::Node::accept(declaration->formals, this); + addVerbatim(declaration->rparenToken); + addVerbatim(declaration->lbraceToken); + QDeclarativeJS::AST::Node::accept(declaration->body, this); + addVerbatim(declaration->rbraceToken); + return false; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::FunctionDeclaration *) +{ + endWrite(""); +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FormalParameterList *list) +{ + write(""); + addVerbatim(list->commaToken, list->commaToken); + addVerbatim(list->identifierToken, list->identifierToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::FormalParameterList *) +{ + endWrite(""); +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FunctionBody *body) +{ + write(""); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::FunctionBody *body) +{ + endWrite(""); +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::DebuggerStatement *statement) +{ + write(""); + addVerbatim(statement->debuggerToken); + addVerbatim(statement->semicolonToken); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::DebuggerStatement *) +{ + endWrite(""); +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FunctionSourceElement *) +{ + write(""); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::FunctionSourceElement *) +{ + endWrite(""); +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::StatementSourceElement *) +{ + write(""); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::StatementSourceElement *) +{ + endWrite(""); +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiObjectDefinition *) +{ + write(""); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiObjectDefinition *) +{ + endWrite(""); +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiImportList *) +{ + write(""); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiImportList *) +{ + endWrite(""); +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiObjectMemberList *) +{ + write(""); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiObjectMemberList *) +{ + endWrite(""); +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiFormalList *) +{ + write(""); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiFormalList *) +{ + endWrite(""); +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Program *) +{ + write(""); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::Program *) +{ + endWrite(""); +} + +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::SourceElements *) +{ + write(""); + return true; +} + +void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::SourceElements *) +{ + endWrite(""); +} + +QT_END_NAMESPACE diff --git a/tools/qdoc3/qmlmarkupvisitor.h b/tools/qdoc3/qmlmarkupvisitor.h new file mode 100644 index 0000000..86e1ac2 --- /dev/null +++ b/tools/qdoc3/qmlmarkupvisitor.h @@ -0,0 +1,338 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QMLVISITOR_H +#define QMLVISITOR_H + +#include +#include "private/qdeclarativejsastvisitor_p.h" +#include "node.h" +#include "tree.h" + +QT_BEGIN_NAMESPACE + +class QmlMarkupVisitor : public QDeclarativeJS::AST::Visitor +{ +public: + QmlMarkupVisitor(const QString &code, bool debug = false); + virtual ~QmlMarkupVisitor(); + + QString markedUpCode(); + + virtual bool visit(QDeclarativeJS::AST::UiProgram *); + virtual bool visit(QDeclarativeJS::AST::UiImportList *); + virtual bool visit(QDeclarativeJS::AST::UiImport *); + virtual bool visit(QDeclarativeJS::AST::UiPublicMember *); + virtual bool visit(QDeclarativeJS::AST::UiSourceElement *); + virtual bool visit(QDeclarativeJS::AST::UiObjectDefinition *); + virtual bool visit(QDeclarativeJS::AST::UiObjectInitializer *); + virtual bool visit(QDeclarativeJS::AST::UiObjectBinding *); + virtual bool visit(QDeclarativeJS::AST::UiScriptBinding *); + virtual bool visit(QDeclarativeJS::AST::UiArrayBinding *); + virtual bool visit(QDeclarativeJS::AST::UiObjectMemberList *); + virtual bool visit(QDeclarativeJS::AST::UiArrayMemberList *); + virtual bool visit(QDeclarativeJS::AST::UiQualifiedId *); + virtual bool visit(QDeclarativeJS::AST::UiSignature *); + virtual bool visit(QDeclarativeJS::AST::UiFormalList *); + virtual bool visit(QDeclarativeJS::AST::UiFormal *); + + virtual void endVisit(QDeclarativeJS::AST::UiProgram *); + virtual void endVisit(QDeclarativeJS::AST::UiImportList *); + virtual void endVisit(QDeclarativeJS::AST::UiImport *); + virtual void endVisit(QDeclarativeJS::AST::UiPublicMember *); + virtual void endVisit(QDeclarativeJS::AST::UiSourceElement *); + virtual void endVisit(QDeclarativeJS::AST::UiObjectDefinition *); + virtual void endVisit(QDeclarativeJS::AST::UiObjectInitializer *); + virtual void endVisit(QDeclarativeJS::AST::UiObjectBinding *); + virtual void endVisit(QDeclarativeJS::AST::UiScriptBinding *); + virtual void endVisit(QDeclarativeJS::AST::UiArrayBinding *); + virtual void endVisit(QDeclarativeJS::AST::UiObjectMemberList *); + virtual void endVisit(QDeclarativeJS::AST::UiArrayMemberList *); + virtual void endVisit(QDeclarativeJS::AST::UiQualifiedId *); + virtual void endVisit(QDeclarativeJS::AST::UiSignature *); + virtual void endVisit(QDeclarativeJS::AST::UiFormalList *); + virtual void endVisit(QDeclarativeJS::AST::UiFormal *); + + // QDeclarativeJS + virtual bool visit(QDeclarativeJS::AST::ThisExpression *); + virtual void endVisit(QDeclarativeJS::AST::ThisExpression *); + + virtual bool visit(QDeclarativeJS::AST::IdentifierExpression *); + virtual void endVisit(QDeclarativeJS::AST::IdentifierExpression *); + + virtual bool visit(QDeclarativeJS::AST::NullExpression *); + virtual void endVisit(QDeclarativeJS::AST::NullExpression *); + + virtual bool visit(QDeclarativeJS::AST::TrueLiteral *); + virtual void endVisit(QDeclarativeJS::AST::TrueLiteral *); + + virtual bool visit(QDeclarativeJS::AST::FalseLiteral *); + virtual void endVisit(QDeclarativeJS::AST::FalseLiteral *); + + virtual bool visit(QDeclarativeJS::AST::NumericLiteral *); + virtual void endVisit(QDeclarativeJS::AST::NumericLiteral *); + + virtual bool visit(QDeclarativeJS::AST::StringLiteral *); + virtual void endVisit(QDeclarativeJS::AST::StringLiteral *); + + virtual bool visit(QDeclarativeJS::AST::RegExpLiteral *); + virtual void endVisit(QDeclarativeJS::AST::RegExpLiteral *); + + virtual bool visit(QDeclarativeJS::AST::ArrayLiteral *); + virtual void endVisit(QDeclarativeJS::AST::ArrayLiteral *); + + virtual bool visit(QDeclarativeJS::AST::ObjectLiteral *); + virtual void endVisit(QDeclarativeJS::AST::ObjectLiteral *); + + virtual bool visit(QDeclarativeJS::AST::ElementList *); + virtual void endVisit(QDeclarativeJS::AST::ElementList *); + + virtual bool visit(QDeclarativeJS::AST::Elision *); + virtual void endVisit(QDeclarativeJS::AST::Elision *); + + virtual bool visit(QDeclarativeJS::AST::PropertyNameAndValueList *); + virtual void endVisit(QDeclarativeJS::AST::PropertyNameAndValueList *); + + virtual bool visit(QDeclarativeJS::AST::NestedExpression *); + virtual void endVisit(QDeclarativeJS::AST::NestedExpression *); + + virtual bool visit(QDeclarativeJS::AST::IdentifierPropertyName *); + virtual void endVisit(QDeclarativeJS::AST::IdentifierPropertyName *); + + virtual bool visit(QDeclarativeJS::AST::StringLiteralPropertyName *); + virtual void endVisit(QDeclarativeJS::AST::StringLiteralPropertyName *); + + virtual bool visit(QDeclarativeJS::AST::NumericLiteralPropertyName *); + virtual void endVisit(QDeclarativeJS::AST::NumericLiteralPropertyName *); + + virtual bool visit(QDeclarativeJS::AST::ArrayMemberExpression *); + virtual void endVisit(QDeclarativeJS::AST::ArrayMemberExpression *); + + virtual bool visit(QDeclarativeJS::AST::FieldMemberExpression *); + virtual void endVisit(QDeclarativeJS::AST::FieldMemberExpression *); + + virtual bool visit(QDeclarativeJS::AST::NewMemberExpression *); + virtual void endVisit(QDeclarativeJS::AST::NewMemberExpression *); + + virtual bool visit(QDeclarativeJS::AST::NewExpression *); + virtual void endVisit(QDeclarativeJS::AST::NewExpression *); + + virtual bool visit(QDeclarativeJS::AST::CallExpression *); + virtual void endVisit(QDeclarativeJS::AST::CallExpression *); + + virtual bool visit(QDeclarativeJS::AST::ArgumentList *); + virtual void endVisit(QDeclarativeJS::AST::ArgumentList *); + + virtual bool visit(QDeclarativeJS::AST::PostIncrementExpression *); + virtual void endVisit(QDeclarativeJS::AST::PostIncrementExpression *); + + virtual bool visit(QDeclarativeJS::AST::PostDecrementExpression *); + virtual void endVisit(QDeclarativeJS::AST::PostDecrementExpression *); + + virtual bool visit(QDeclarativeJS::AST::DeleteExpression *); + virtual void endVisit(QDeclarativeJS::AST::DeleteExpression *); + + virtual bool visit(QDeclarativeJS::AST::VoidExpression *); + virtual void endVisit(QDeclarativeJS::AST::VoidExpression *); + + virtual bool visit(QDeclarativeJS::AST::TypeOfExpression *); + virtual void endVisit(QDeclarativeJS::AST::TypeOfExpression *); + + virtual bool visit(QDeclarativeJS::AST::PreIncrementExpression *); + virtual void endVisit(QDeclarativeJS::AST::PreIncrementExpression *); + + virtual bool visit(QDeclarativeJS::AST::PreDecrementExpression *); + virtual void endVisit(QDeclarativeJS::AST::PreDecrementExpression *); + + virtual bool visit(QDeclarativeJS::AST::UnaryPlusExpression *); + virtual void endVisit(QDeclarativeJS::AST::UnaryPlusExpression *); + + virtual bool visit(QDeclarativeJS::AST::UnaryMinusExpression *); + virtual void endVisit(QDeclarativeJS::AST::UnaryMinusExpression *); + + virtual bool visit(QDeclarativeJS::AST::TildeExpression *); + virtual void endVisit(QDeclarativeJS::AST::TildeExpression *); + + virtual bool visit(QDeclarativeJS::AST::NotExpression *); + virtual void endVisit(QDeclarativeJS::AST::NotExpression *); + + virtual bool visit(QDeclarativeJS::AST::BinaryExpression *); + virtual void endVisit(QDeclarativeJS::AST::BinaryExpression *); + + virtual bool visit(QDeclarativeJS::AST::ConditionalExpression *); + virtual void endVisit(QDeclarativeJS::AST::ConditionalExpression *); + + virtual bool visit(QDeclarativeJS::AST::Expression *); + virtual void endVisit(QDeclarativeJS::AST::Expression *); + + virtual bool visit(QDeclarativeJS::AST::Block *); + virtual void endVisit(QDeclarativeJS::AST::Block *); + + virtual bool visit(QDeclarativeJS::AST::StatementList *); + virtual void endVisit(QDeclarativeJS::AST::StatementList *); + + virtual bool visit(QDeclarativeJS::AST::VariableStatement *); + virtual void endVisit(QDeclarativeJS::AST::VariableStatement *); + + virtual bool visit(QDeclarativeJS::AST::VariableDeclarationList *); + virtual void endVisit(QDeclarativeJS::AST::VariableDeclarationList *); + + virtual bool visit(QDeclarativeJS::AST::VariableDeclaration *); + virtual void endVisit(QDeclarativeJS::AST::VariableDeclaration *); + + virtual bool visit(QDeclarativeJS::AST::EmptyStatement *); + virtual void endVisit(QDeclarativeJS::AST::EmptyStatement *); + + virtual bool visit(QDeclarativeJS::AST::ExpressionStatement *); + virtual void endVisit(QDeclarativeJS::AST::ExpressionStatement *); + + virtual bool visit(QDeclarativeJS::AST::IfStatement *); + virtual void endVisit(QDeclarativeJS::AST::IfStatement *); + + virtual bool visit(QDeclarativeJS::AST::DoWhileStatement *); + virtual void endVisit(QDeclarativeJS::AST::DoWhileStatement *); + + virtual bool visit(QDeclarativeJS::AST::WhileStatement *); + virtual void endVisit(QDeclarativeJS::AST::WhileStatement *); + + virtual bool visit(QDeclarativeJS::AST::ForStatement *); + virtual void endVisit(QDeclarativeJS::AST::ForStatement *); + + virtual bool visit(QDeclarativeJS::AST::LocalForStatement *); + virtual void endVisit(QDeclarativeJS::AST::LocalForStatement *); + + virtual bool visit(QDeclarativeJS::AST::ForEachStatement *); + virtual void endVisit(QDeclarativeJS::AST::ForEachStatement *); + + virtual bool visit(QDeclarativeJS::AST::LocalForEachStatement *); + virtual void endVisit(QDeclarativeJS::AST::LocalForEachStatement *); + + virtual bool visit(QDeclarativeJS::AST::ContinueStatement *); + virtual void endVisit(QDeclarativeJS::AST::ContinueStatement *); + + virtual bool visit(QDeclarativeJS::AST::BreakStatement *); + virtual void endVisit(QDeclarativeJS::AST::BreakStatement *); + + virtual bool visit(QDeclarativeJS::AST::ReturnStatement *); + virtual void endVisit(QDeclarativeJS::AST::ReturnStatement *); + + virtual bool visit(QDeclarativeJS::AST::WithStatement *); + virtual void endVisit(QDeclarativeJS::AST::WithStatement *); + + virtual bool visit(QDeclarativeJS::AST::CaseBlock *); + virtual void endVisit(QDeclarativeJS::AST::CaseBlock *); + + virtual bool visit(QDeclarativeJS::AST::SwitchStatement *); + virtual void endVisit(QDeclarativeJS::AST::SwitchStatement *); + + virtual bool visit(QDeclarativeJS::AST::CaseClauses *); + virtual void endVisit(QDeclarativeJS::AST::CaseClauses *); + + virtual bool visit(QDeclarativeJS::AST::CaseClause *); + virtual void endVisit(QDeclarativeJS::AST::CaseClause *); + + virtual bool visit(QDeclarativeJS::AST::DefaultClause *); + virtual void endVisit(QDeclarativeJS::AST::DefaultClause *); + + virtual bool visit(QDeclarativeJS::AST::LabelledStatement *); + virtual void endVisit(QDeclarativeJS::AST::LabelledStatement *); + + virtual bool visit(QDeclarativeJS::AST::ThrowStatement *); + virtual void endVisit(QDeclarativeJS::AST::ThrowStatement *); + + virtual bool visit(QDeclarativeJS::AST::TryStatement *); + virtual void endVisit(QDeclarativeJS::AST::TryStatement *); + + virtual bool visit(QDeclarativeJS::AST::Catch *); + virtual void endVisit(QDeclarativeJS::AST::Catch *); + + virtual bool visit(QDeclarativeJS::AST::Finally *); + virtual void endVisit(QDeclarativeJS::AST::Finally *); + + virtual bool visit(QDeclarativeJS::AST::FunctionDeclaration *); + virtual void endVisit(QDeclarativeJS::AST::FunctionDeclaration *); + + virtual bool visit(QDeclarativeJS::AST::FunctionExpression *); + virtual void endVisit(QDeclarativeJS::AST::FunctionExpression *); + + virtual bool visit(QDeclarativeJS::AST::FormalParameterList *); + virtual void endVisit(QDeclarativeJS::AST::FormalParameterList *); + + virtual bool visit(QDeclarativeJS::AST::FunctionBody *); + virtual void endVisit(QDeclarativeJS::AST::FunctionBody *); + + virtual bool visit(QDeclarativeJS::AST::Program *); + virtual void endVisit(QDeclarativeJS::AST::Program *); + + virtual bool visit(QDeclarativeJS::AST::SourceElements *); + virtual void endVisit(QDeclarativeJS::AST::SourceElements *); + + virtual bool visit(QDeclarativeJS::AST::FunctionSourceElement *); + virtual void endVisit(QDeclarativeJS::AST::FunctionSourceElement *); + + virtual bool visit(QDeclarativeJS::AST::StatementSourceElement *); + virtual void endVisit(QDeclarativeJS::AST::StatementSourceElement *); + + virtual bool visit(QDeclarativeJS::AST::DebuggerStatement *); + virtual void endVisit(QDeclarativeJS::AST::DebuggerStatement *); + + virtual bool visit(QDeclarativeJS::AST::UiParameterList *); + virtual void endVisit(QDeclarativeJS::AST::UiParameterList *); + +private: + void addMarkedUpToken(QDeclarativeJS::AST::SourceLocation &location, + const QString &text); + void addVerbatim(QDeclarativeJS::AST::SourceLocation first, + QDeclarativeJS::AST::SourceLocation last = QDeclarativeJS::AST::SourceLocation()); + QString sourceText(QDeclarativeJS::AST::SourceLocation &location); + void write(const QString &text); + void endWrite(const QString &text); + + QString source; + QString output; + quint32 cursor; + int indent; + bool showDebug; +}; + +QT_END_NAMESPACE + +#endif diff --git a/tools/qdoc3/qmlvisitor.cpp b/tools/qdoc3/qmlvisitor.cpp index 1d65c3d..9295624 100644 --- a/tools/qdoc3/qmlvisitor.cpp +++ b/tools/qdoc3/qmlvisitor.cpp @@ -42,15 +42,17 @@ #include #include #include -#include "parser/qmljsast_p.h" -#include "parser/qmljsastfwd_p.h" -#include "parser/qmljsengine_p.h" +#include "private/qdeclarativejsast_p.h" +#include "private/qdeclarativejsastfwd_p.h" +#include "private/qdeclarativejsengine_p.h" #include "node.h" #include "qmlvisitor.h" -DocVisitor::DocVisitor(const QString &filePath, const QString &code, - QmlJS::Engine *engine, Tree *tree, QSet &commands) +QT_BEGIN_NAMESPACE + +QmlDocVisitor::QmlDocVisitor(const QString &filePath, const QString &code, + QDeclarativeJS::Engine *engine, Tree *tree, QSet &commands) { this->filePath = filePath; this->name = QFileInfo(filePath).baseName(); @@ -61,17 +63,17 @@ DocVisitor::DocVisitor(const QString &filePath, const QString &code, current = tree->root(); } -DocVisitor::~DocVisitor() +QmlDocVisitor::~QmlDocVisitor() { } -QmlJS::AST::SourceLocation DocVisitor::precedingComment(unsigned offset) const +QDeclarativeJS::AST::SourceLocation QmlDocVisitor::precedingComment(unsigned offset) const { - QmlJS::AST::SourceLocation currentLoc; + QDeclarativeJS::AST::SourceLocation currentLoc; - foreach (const QmlJS::AST::SourceLocation &loc, engine->comments()) { + foreach (const QDeclarativeJS::AST::SourceLocation &loc, engine->comments()) { if (loc.begin() > lastEndOffset && loc.end() < offset) - currentLoc = loc; + currentLoc = loc; else break; } @@ -81,13 +83,13 @@ QmlJS::AST::SourceLocation DocVisitor::precedingComment(unsigned offset) const return currentLoc; } - return QmlJS::AST::SourceLocation(); + return QDeclarativeJS::AST::SourceLocation(); } -void DocVisitor::applyDocumentation(QmlJS::AST::SourceLocation location, +void QmlDocVisitor::applyDocumentation(QDeclarativeJS::AST::SourceLocation location, Node *node) { - QmlJS::AST::SourceLocation loc = precedingComment(location.begin()); + QDeclarativeJS::AST::SourceLocation loc = precedingComment(location.begin()); if (loc.isValid()) { QString source = document.mid(loc.offset, loc.length); @@ -111,7 +113,7 @@ void DocVisitor::applyDocumentation(QmlJS::AST::SourceLocation location, /*! Visits element definitions, recording them in a tree structure. */ -bool DocVisitor::visit(QmlJS::AST::UiObjectDefinition *definition) +bool QmlDocVisitor::visit(QDeclarativeJS::AST::UiObjectDefinition *definition) { QString type = definition->qualifiedTypeNameId->name->asString(); @@ -130,12 +132,12 @@ bool DocVisitor::visit(QmlJS::AST::UiObjectDefinition *definition) return true; } -void DocVisitor::endVisit(QmlJS::AST::UiObjectDefinition *definition) +void QmlDocVisitor::endVisit(QDeclarativeJS::AST::UiObjectDefinition *definition) { lastEndOffset = definition->lastSourceLocation().end(); } -bool DocVisitor::visit(QmlJS::AST::UiImportList *imports) +bool QmlDocVisitor::visit(QDeclarativeJS::AST::UiImportList *imports) { // Note that the imports list can be traversed by iteration to obtain // all the imports in the document at once, having found just one: @@ -154,10 +156,10 @@ bool DocVisitor::visit(QmlJS::AST::UiImportList *imports) Visits public member declarations, such as signals and properties. These only include custom signals and properties. */ -bool DocVisitor::visit(QmlJS::AST::UiPublicMember *member) +bool QmlDocVisitor::visit(QDeclarativeJS::AST::UiPublicMember *member) { switch (member->type) { - case QmlJS::AST::UiPublicMember::Signal: + case QDeclarativeJS::AST::UiPublicMember::Signal: { if (current->type() == Node::Fake) { QmlClassNode *qmlClass = static_cast(current); @@ -167,7 +169,7 @@ bool DocVisitor::visit(QmlJS::AST::UiPublicMember *member) FunctionNode *qmlSignal = new FunctionNode(Node::QmlSignal, current, name, false); QList parameters; - for (QmlJS::AST::UiParameterList *it = member->parameters; it; it = it->next) { + for (QDeclarativeJS::AST::UiParameterList *it = member->parameters; it; it = it->next) { if (it->type && it->name) parameters.append(Parameter(it->type->asString(), "", it->name->asString())); } @@ -178,7 +180,7 @@ bool DocVisitor::visit(QmlJS::AST::UiPublicMember *member) } break; } - case QmlJS::AST::UiPublicMember::Property: + case QDeclarativeJS::AST::UiPublicMember::Property: { QString type = member->memberType->asString(); QString name = member->name->asString(); @@ -206,12 +208,14 @@ bool DocVisitor::visit(QmlJS::AST::UiPublicMember *member) return true; } -void DocVisitor::endVisit(QmlJS::AST::UiPublicMember *definition) +void QmlDocVisitor::endVisit(QDeclarativeJS::AST::UiPublicMember *definition) { lastEndOffset = definition->lastSourceLocation().end(); } -bool DocVisitor::visit(QmlJS::AST::IdentifierPropertyName *idproperty) +bool QmlDocVisitor::visit(QDeclarativeJS::AST::IdentifierPropertyName *idproperty) { return true; } + +QT_END_NAMESPACE diff --git a/tools/qdoc3/qmlvisitor.h b/tools/qdoc3/qmlvisitor.h index a830793..c7b4bda 100644 --- a/tools/qdoc3/qmlvisitor.h +++ b/tools/qdoc3/qmlvisitor.h @@ -39,36 +39,38 @@ ** ****************************************************************************/ -#ifndef DOCVISITOR_H -#define DOCVISITOR_H +#ifndef QMLVISITOR_H +#define QMLVISITOR_H #include -#include "parser/qmljsastvisitor_p.h" +#include "private/qdeclarativejsastvisitor_p.h" #include "node.h" #include "tree.h" -class DocVisitor : public QmlJS::AST::Visitor +QT_BEGIN_NAMESPACE + +class QmlDocVisitor : public QDeclarativeJS::AST::Visitor { public: - DocVisitor(const QString &filePath, const QString &code, - QmlJS::Engine *engine, Tree *tree, QSet &commands); - virtual ~DocVisitor(); + QmlDocVisitor(const QString &filePath, const QString &code, + QDeclarativeJS::Engine *engine, Tree *tree, QSet &commands); + virtual ~QmlDocVisitor(); - bool visit(QmlJS::AST::UiImportList *imports); + bool visit(QDeclarativeJS::AST::UiImportList *imports); - bool visit(QmlJS::AST::UiObjectDefinition *definition); - void endVisit(QmlJS::AST::UiObjectDefinition *definition); + bool visit(QDeclarativeJS::AST::UiObjectDefinition *definition); + void endVisit(QDeclarativeJS::AST::UiObjectDefinition *definition); - bool visit(QmlJS::AST::UiPublicMember *member); - void endVisit(QmlJS::AST::UiPublicMember *definition); + bool visit(QDeclarativeJS::AST::UiPublicMember *member); + void endVisit(QDeclarativeJS::AST::UiPublicMember *definition); - bool visit(QmlJS::AST::IdentifierPropertyName *idproperty); + bool visit(QDeclarativeJS::AST::IdentifierPropertyName *idproperty); private: - QmlJS::AST::SourceLocation precedingComment(unsigned offset) const; - void applyDocumentation(QmlJS::AST::SourceLocation location, Node *node); + QDeclarativeJS::AST::SourceLocation precedingComment(unsigned offset) const; + void applyDocumentation(QDeclarativeJS::AST::SourceLocation location, Node *node); - QmlJS::Engine *engine; + QDeclarativeJS::Engine *engine; quint32 lastEndOffset; QString filePath; QString name; @@ -79,4 +81,6 @@ private: InnerNode *current; }; +QT_END_NAMESPACE + #endif -- cgit v0.12 From 755f2907ee4bc2b632237409c1d1d77b343aaa2a Mon Sep 17 00:00:00 2001 From: David Boddie Date: Mon, 29 Nov 2010 19:57:56 +0100 Subject: Removed unnecessary include, fixed whitespace. --- tools/qdoc3/doc.cpp | 937 ++++++++++++++++++++++++++-------------------------- 1 file changed, 468 insertions(+), 469 deletions(-) diff --git a/tools/qdoc3/doc.cpp b/tools/qdoc3/doc.cpp index be16c59..4152207 100644 --- a/tools/qdoc3/doc.cpp +++ b/tools/qdoc3/doc.cpp @@ -48,7 +48,6 @@ #include "text.h" #include "tokenizer.h" #include -#include #include #include #include @@ -225,13 +224,13 @@ class DocPrivateExtra QStringMap metaMap; DocPrivateExtra() - : granularity(Doc::Part) { } + : granularity(Doc::Part) { } }; struct Shared // ### get rid of { Shared() - : count(1) { } + : count(1) { } void ref() { ++count; } bool deref() { return (--count == 0); } @@ -301,7 +300,7 @@ void DocPrivate::addAlso(const Text& also) void DocPrivate::constructExtra() { if (extra == 0) - extra = new DocPrivateExtra; + extra = new DocPrivateExtra; } bool DocPrivate::isEnumDocSimplifiable() const @@ -350,7 +349,7 @@ class DocParser private: Location& location(); QString detailsUnknownCommand(const QSet& metaCommandSet, - const QString& str); + const QString& str); void checkExpiry(const QString& date); void insertBaseName(const QString &baseName); void insertTarget(const QString& target, bool keyword); @@ -367,8 +366,8 @@ class DocParser void appendToCode(const QString &code); void startNewPara(); void enterPara(Atom::Type leftType = Atom::ParaLeft, - Atom::Type rightType = Atom::ParaRight, - const QString& string = ""); + Atom::Type rightType = Atom::ParaRight, + const QString& string = ""); void leavePara(); void leaveValue(); void leaveValueList(); @@ -547,7 +546,7 @@ void DocParser::parse(const QString& source, leavePara(); append(Atom::Code, getCode(CMD_CODE, marker)); break; -#ifdef QDOC_QML +#ifdef QDOC_QML case CMD_QML: leavePara(); append(Atom::Qml, getCode(CMD_QML, marker)); @@ -555,7 +554,7 @@ void DocParser::parse(const QString& source, case CMD_QMLTEXT: append(Atom::QmlText); break; -#endif +#endif case CMD_CODELINE: { if (!quoting) { @@ -1465,35 +1464,35 @@ void DocParser::checkExpiry(const QString& date) QRegExp ymd("(\\d{4})(?:-(\\d{2})(?:-(\\d{2})))"); if (ymd.exactMatch(date)) { - int y = ymd.cap(1).toInt(); - int m = ymd.cap(2).toInt(); - int d = ymd.cap(3).toInt(); - - if (m == 0) - m = 1; - if (d == 0) - d = 1; - QDate expiryDate(y, m, d); - if (expiryDate.isValid()) { - int days = expiryDate.daysTo(QDate::currentDate()); - if (days == 0) { - location().warning(tr("Documentation expires today")); - } + int y = ymd.cap(1).toInt(); + int m = ymd.cap(2).toInt(); + int d = ymd.cap(3).toInt(); + + if (m == 0) + m = 1; + if (d == 0) + d = 1; + QDate expiryDate(y, m, d); + if (expiryDate.isValid()) { + int days = expiryDate.daysTo(QDate::currentDate()); + if (days == 0) { + location().warning(tr("Documentation expires today")); + } else if (days == 1) { - location().warning(tr("Documentation expired yesterday")); - } + location().warning(tr("Documentation expired yesterday")); + } else if (days >= 2) { - location().warning(tr("Documentation expired %1 days ago") - .arg(days)); - } - } + location().warning(tr("Documentation expired %1 days ago") + .arg(days)); + } + } else { - location().warning(tr("Date '%1' invalid").arg(date)); - } + location().warning(tr("Date '%1' invalid").arg(date)); + } } else { - location().warning(tr("Date '%1' not in YYYY-MM-DD format") - .arg(date)); + location().warning(tr("Date '%1' not in YYYY-MM-DD format") + .arg(date)); } } @@ -1501,34 +1500,34 @@ void DocParser::insertBaseName(const QString &baseName) { priv->constructExtra(); if (currentSectioningUnit == priv->extra->sectioningUnit) { - priv->extra->baseName = baseName; + priv->extra->baseName = baseName; } else { - Atom *atom = priv->text.firstAtom(); - Atom *sectionLeft = 0; + Atom *atom = priv->text.firstAtom(); + Atom *sectionLeft = 0; - int delta = currentSectioningUnit - priv->extra->sectioningUnit; + int delta = currentSectioningUnit - priv->extra->sectioningUnit; - while (atom != 0) { - if (atom->type() == Atom::SectionLeft && - atom->string().toInt() == delta) - sectionLeft = atom; - atom = atom->next(); - } - if (sectionLeft != 0) - (void) new Atom(sectionLeft, Atom::BaseName, baseName); + while (atom != 0) { + if (atom->type() == Atom::SectionLeft && + atom->string().toInt() == delta) + sectionLeft = atom; + atom = atom->next(); + } + if (sectionLeft != 0) + (void) new Atom(sectionLeft, Atom::BaseName, baseName); } } void DocParser::insertTarget(const QString &target, bool keyword) { if (targetMap.contains(target)) { - location().warning(tr("Duplicate target name '%1'").arg(target)); - targetMap[target].warning(tr("(The previous occurrence is here)")); + location().warning(tr("Duplicate target name '%1'").arg(target)); + targetMap[target].warning(tr("(The previous occurrence is here)")); } else { - targetMap.insert(target, location()); - append(Atom::Target, target); + targetMap.insert(target, location()); + append(Atom::Target, target); priv->constructExtra(); if (keyword) priv->extra->keywords.append(priv->text.lastAtom()); @@ -1540,8 +1539,8 @@ void DocParser::insertTarget(const QString &target, bool keyword) void DocParser::include(const QString& fileName) { if (location().depth() > 16) - location().fatal(tr("Too many nested '\\%1's") - .arg(cmdName(CMD_INCLUDE))); + location().fatal(tr("Too many nested '\\%1's") + .arg(cmdName(CMD_INCLUDE))); QString userFriendlyFilePath; // ### use current directory? @@ -1551,25 +1550,25 @@ void DocParser::include(const QString& fileName) fileName, userFriendlyFilePath); if (filePath.isEmpty()) { - location().warning(tr("Cannot find leaf file '%1'").arg(fileName)); + location().warning(tr("Cannot find leaf file '%1'").arg(fileName)); } else { - QFile inFile(filePath); - if (!inFile.open(QFile::ReadOnly)) { - location().warning(tr("Cannot open leaf file '%1'") - .arg(userFriendlyFilePath)); - } + QFile inFile(filePath); + if (!inFile.open(QFile::ReadOnly)) { + location().warning(tr("Cannot open leaf file '%1'") + .arg(userFriendlyFilePath)); + } else { - location().push(userFriendlyFilePath); + location().push(userFriendlyFilePath); - QTextStream inStream(&inFile); - QString includedStuff = inStream.readAll(); - inFile.close(); + QTextStream inStream(&inFile); + QString includedStuff = inStream.readAll(); + inFile.close(); - in.insert(pos, includedStuff); - len = in.length(); - openedInputs.push(pos + includedStuff.length()); - } + in.insert(pos, includedStuff); + len = in.length(); + openedInputs.push(pos + includedStuff.length()); + } } } @@ -1579,29 +1578,29 @@ void DocParser::startFormat(const QString& format, int cmd) QMap::ConstIterator f = pendingFormats.begin(); while (f != pendingFormats.end()) { - if (*f == format) { - location().warning(tr("Cannot nest '\\%1' commands") - .arg(cmdName(cmd))); - return; - } - ++f; + if (*f == format) { + location().warning(tr("Cannot nest '\\%1' commands") + .arg(cmdName(cmd))); + return; + } + ++f; } append(Atom::FormattingLeft, format); if (isLeftBraceAhead()) { - skipSpacesOrOneEndl(); - pendingFormats.insert(braceDepth, format); - ++braceDepth; - ++pos; + skipSpacesOrOneEndl(); + pendingFormats.insert(braceDepth, format); + ++braceDepth; + ++pos; } else { - append(Atom::String, getArgument()); - append(Atom::FormattingRight, format); - if (format == ATOM_FORMATTING_INDEX && indexStartedPara) { - skipAllSpaces(); - indexStartedPara = false; - } + append(Atom::String, getArgument()); + append(Atom::FormattingRight, format); + if (format == ATOM_FORMATTING_INDEX && indexStartedPara) { + skipAllSpaces(); + indexStartedPara = false; + } } } @@ -1612,37 +1611,37 @@ bool DocParser::openCommand(int cmd) if (cmd != CMD_LINK) { if (outer == CMD_LIST) { - ok = (cmd == CMD_FOOTNOTE || cmd == CMD_LIST); + ok = (cmd == CMD_FOOTNOTE || cmd == CMD_LIST); } else if (outer == CMD_ABSTRACT) { - ok = (cmd == CMD_LIST || + ok = (cmd == CMD_LIST || cmd == CMD_QUOTATION || cmd == CMD_TABLE); } else if (outer == CMD_SIDEBAR) { - ok = (cmd == CMD_LIST || + ok = (cmd == CMD_LIST || cmd == CMD_QUOTATION || cmd == CMD_SIDEBAR); } else if (outer == CMD_QUOTATION) { - ok = (cmd == CMD_LIST); + ok = (cmd == CMD_LIST); } else if (outer == CMD_TABLE) { - ok = (cmd == CMD_LIST || + ok = (cmd == CMD_LIST || cmd == CMD_FOOTNOTE || cmd == CMD_QUOTATION); } else if (outer == CMD_FOOTNOTE || outer == CMD_LINK) { - ok = false; + ok = false; } } if (ok) { - openedCommands.push(cmd); + openedCommands.push(cmd); } else { - location().warning(tr("Cannot use '\\%1' within '\\%2'") - .arg(cmdName(cmd)).arg(cmdName(outer))); + location().warning(tr("Cannot use '\\%1' within '\\%2'") + .arg(cmdName(cmd)).arg(cmdName(outer))); } return ok; } @@ -1650,33 +1649,33 @@ bool DocParser::openCommand(int cmd) bool DocParser::closeCommand(int endCmd) { if (endCmdFor(openedCommands.top()) == endCmd && openedCommands.size() > 1) { - openedCommands.pop(); - return true; + openedCommands.pop(); + return true; } else { - bool contains = false; - QStack opened2 = openedCommands; - while (opened2.size() > 1) { - if (endCmdFor(opened2.top()) == endCmd) { - contains = true; - break; - } - opened2.pop(); - } - - if (contains) { - while (endCmdFor(openedCommands.top()) != endCmd && openedCommands.size() > 1) { - location().warning(tr("Missing '\\%1' before '\\%2'") - .arg(endCmdName(openedCommands.top())) - .arg(cmdName(endCmd))); - openedCommands.pop(); - } - } + bool contains = false; + QStack opened2 = openedCommands; + while (opened2.size() > 1) { + if (endCmdFor(opened2.top()) == endCmd) { + contains = true; + break; + } + opened2.pop(); + } + + if (contains) { + while (endCmdFor(openedCommands.top()) != endCmd && openedCommands.size() > 1) { + location().warning(tr("Missing '\\%1' before '\\%2'") + .arg(endCmdName(openedCommands.top())) + .arg(cmdName(endCmd))); + openedCommands.pop(); + } + } else { - location().warning(tr("Unexpected '\\%1'") - .arg(cmdName(endCmd))); - } - return false; + location().warning(tr("Unexpected '\\%1'") + .arg(cmdName(endCmd))); + } + return false; } } @@ -1685,32 +1684,32 @@ void DocParser::startSection(Doc::SectioningUnit unit, int cmd) leavePara(); if (currentSectioningUnit == Doc::Book) { - currentSectioningUnit = (Doc::SectioningUnit) (unit - 1); - priv->constructExtra(); - priv->extra->sectioningUnit = currentSectioningUnit; + currentSectioningUnit = (Doc::SectioningUnit) (unit - 1); + priv->constructExtra(); + priv->extra->sectioningUnit = currentSectioningUnit; } if (unit <= priv->extra->sectioningUnit) { - location().warning(tr("Unexpected '\\%1' in this documentation") - .arg(cmdName(cmd))); + location().warning(tr("Unexpected '\\%1' in this documentation") + .arg(cmdName(cmd))); } else if (unit - currentSectioningUnit > 1) { - location().warning(tr("Unexpected '\\%1' at this point") - .arg(cmdName(cmd))); + location().warning(tr("Unexpected '\\%1' at this point") + .arg(cmdName(cmd))); } else { - if (currentSectioningUnit >= unit) - endSection(unit, cmd); + if (currentSectioningUnit >= unit) + endSection(unit, cmd); - int delta = unit - priv->extra->sectioningUnit; - append(Atom::SectionLeft, QString::number(delta)); + int delta = unit - priv->extra->sectioningUnit; + append(Atom::SectionLeft, QString::number(delta)); priv->constructExtra(); priv->extra->tableOfContents.append(priv->text.lastAtom()); priv->extra->tableOfContentsLevels.append(unit); - enterPara(Atom::SectionHeadingLeft, + enterPara(Atom::SectionHeadingLeft, Atom::SectionHeadingRight, QString::number(delta)); - currentSectioningUnit = unit; + currentSectioningUnit = unit; } } @@ -1719,20 +1718,20 @@ void DocParser::endSection(int unit, int endCmd) leavePara(); if (unit < priv->extra->sectioningUnit) { - location().warning(tr("Unexpected '\\%1' in this documentation") - .arg(cmdName(endCmd))); + location().warning(tr("Unexpected '\\%1' in this documentation") + .arg(cmdName(endCmd))); } else if (unit > currentSectioningUnit) { - location().warning(tr("Unexpected '\\%1' at this point") - .arg(cmdName(endCmd))); + location().warning(tr("Unexpected '\\%1' at this point") + .arg(cmdName(endCmd))); } else { - while (currentSectioningUnit >= unit) { - int delta = currentSectioningUnit - priv->extra->sectioningUnit; - append(Atom::SectionRight, QString::number(delta)); - currentSectioningUnit = - (Doc::SectioningUnit) (currentSectioningUnit - 1); - } + while (currentSectioningUnit >= unit) { + int delta = currentSectioningUnit - priv->extra->sectioningUnit; + append(Atom::SectionRight, QString::number(delta)); + currentSectioningUnit = + (Doc::SectioningUnit) (currentSectioningUnit - 1); + } } } @@ -1821,10 +1820,10 @@ void DocParser::appendChar(QChar ch) void DocParser::appendWord(const QString &word) { if (priv->text.lastAtom()->type() != Atom::String) { - append(Atom::String, word); + append(Atom::String, word); } else - priv->text.lastAtom()->appendString(word); + priv->text.lastAtom()->appendString(word); } void DocParser::appendToCode(const QString& markedCode) @@ -1832,10 +1831,10 @@ void DocParser::appendToCode(const QString& markedCode) Atom::Type lastType = priv->text.lastAtom()->type(); #ifdef QDOC_QML if (lastType != Atom::Qml) - append(Atom::Qml); + append(Atom::Qml); #else if (lastType != Atom::Code) - append(Atom::Code); + append(Atom::Code); #endif priv->text.lastAtom()->appendString(markedCode); } @@ -1853,44 +1852,44 @@ void DocParser::enterPara(Atom::Type leftType, if (paraState == OutsidePara) { if (priv->text.lastAtom()->type() != Atom::ListItemLeft) leaveValueList(); - append(leftType, string); - indexStartedPara = false; - pendingParaLeftType = leftType; - pendingParaRightType = rightType; - pendingParaString = string; - if ( - leftType == Atom::SectionHeadingLeft) { - paraState = InsideSingleLinePara; - } + append(leftType, string); + indexStartedPara = false; + pendingParaLeftType = leftType; + pendingParaRightType = rightType; + pendingParaString = string; + if ( + leftType == Atom::SectionHeadingLeft) { + paraState = InsideSingleLinePara; + } else { - paraState = InsideMultiLinePara; - } - skipSpacesOrOneEndl(); + paraState = InsideMultiLinePara; + } + skipSpacesOrOneEndl(); } } void DocParser::leavePara() { if (paraState != OutsidePara) { - if (!pendingFormats.isEmpty()) { - location().warning(tr("Missing '}'")); - pendingFormats.clear(); - } - - if (priv->text.lastAtom()->type() == pendingParaLeftType) { - priv->text.stripLastAtom(); - } + if (!pendingFormats.isEmpty()) { + location().warning(tr("Missing '}'")); + pendingFormats.clear(); + } + + if (priv->text.lastAtom()->type() == pendingParaLeftType) { + priv->text.stripLastAtom(); + } else { - if (priv->text.lastAtom()->type() == Atom::String && - priv->text.lastAtom()->string().endsWith(" ")) { - priv->text.lastAtom()->chopString(); - } - append(pendingParaRightType, pendingParaString); - } - paraState = OutsidePara; - indexStartedPara = false; - pendingParaRightType = Atom::Nop; - pendingParaString = ""; + if (priv->text.lastAtom()->type() == Atom::String && + priv->text.lastAtom()->string().endsWith(" ")) { + priv->text.lastAtom()->chopString(); + } + append(pendingParaRightType, pendingParaString); + } + paraState = OutsidePara; + indexStartedPara = false; + pendingParaRightType = Atom::Nop; + pendingParaString = ""; } } @@ -1898,13 +1897,13 @@ void DocParser::leaveValue() { leavePara(); if (openedLists.isEmpty()) { - openedLists.push(OpenedList(OpenedList::Value)); - append(Atom::ListLeft, ATOM_LIST_VALUE); + openedLists.push(OpenedList(OpenedList::Value)); + append(Atom::ListLeft, ATOM_LIST_VALUE); } else { if (priv->text.lastAtom()->type() == Atom::Nop) priv->text.stripLastAtom(); - append(Atom::ListItemRight, ATOM_LIST_VALUE); + append(Atom::ListItemRight, ATOM_LIST_VALUE); } } @@ -1915,9 +1914,9 @@ void DocParser::leaveValueList() (openedLists.top().style() == OpenedList::Value)) { if (priv->text.lastAtom()->type() == Atom::Nop) priv->text.stripLastAtom(); - append(Atom::ListItemRight, ATOM_LIST_VALUE); - append(Atom::ListRight, ATOM_LIST_VALUE); - openedLists.pop(); + append(Atom::ListItemRight, ATOM_LIST_VALUE); + append(Atom::ListRight, ATOM_LIST_VALUE); + openedLists.pop(); } } @@ -1948,43 +1947,43 @@ void DocParser::expandMacro(const QString &name, int numParams) { if (numParams == 0) { - append(Atom::RawString, def); + append(Atom::RawString, def); } else { - QStringList args; - QString rawString; + QStringList args; + QString rawString; - for (int i = 0; i < numParams; i++) { - if (numParams == 1 || isLeftBraceAhead()) { - args << getArgument(true); - } + for (int i = 0; i < numParams; i++) { + if (numParams == 1 || isLeftBraceAhead()) { + args << getArgument(true); + } else { - location().warning(tr("Macro '\\%1' invoked with too few" - " arguments (expected %2, got %3)") - .arg(name).arg(numParams).arg(i)); - break; - } - } - - int j = 0; - while (j < def.size()) { - int paramNo; - if ((def[j] == '\\') && (j < def.size() - 1) && + location().warning(tr("Macro '\\%1' invoked with too few" + " arguments (expected %2, got %3)") + .arg(name).arg(numParams).arg(i)); + break; + } + } + + int j = 0; + while (j < def.size()) { + int paramNo; + if ((def[j] == '\\') && (j < def.size() - 1) && ((paramNo = def[j + 1].digitValue()) >= 1) && (paramNo <= numParams)) { - if (!rawString.isEmpty()) { - append(Atom::RawString, rawString); - rawString = ""; - } - append(Atom::String, args[paramNo - 1]); - j += 2; - } + if (!rawString.isEmpty()) { + append(Atom::RawString, rawString); + rawString = ""; + } + append(Atom::String, args[paramNo - 1]); + j += 2; + } else { - rawString += def[j++]; - } - } - if (!rawString.isEmpty()) - append(Atom::RawString, rawString); + rawString += def[j++]; + } + } + if (!rawString.isEmpty()) + append(Atom::RawString, rawString); } } @@ -1993,29 +1992,29 @@ Doc::SectioningUnit DocParser::getSectioningUnit() QString name = getOptionalArgument(); if (name == "part") { - return Doc::Part; + return Doc::Part; } else if (name == "chapter") { - return Doc::Chapter; + return Doc::Chapter; } else if (name == "section1") { - return Doc::Section1; + return Doc::Section1; } else if (name == "section2") { - return Doc::Section2; + return Doc::Section2; } else if (name == "section3") { - return Doc::Section3; + return Doc::Section3; } else if (name == "section4") { - return Doc::Section4; + return Doc::Section4; } else if (name.isEmpty()) { - return Doc::Section4; + return Doc::Section4; } else { - location().warning(tr("Invalid sectioning unit '%1'").arg(name)); - return Doc::Book; + location().warning(tr("Invalid sectioning unit '%1'").arg(name)); + return Doc::Book; } } @@ -2032,115 +2031,115 @@ QString DocParser::getArgument(bool verbatim) Typically, an argument ends at the next white-space. However, braces can be used to group words: - {a few words} + {a few words} Also, opening and closing parentheses have to match. Thus, - printf("%d\n", x) + printf("%d\n", x) is an argument too, although it contains spaces. Finally, trailing punctuation is not included in an argument, nor is 's. */ if (pos < (int) in.length() && in[pos] == '{') { - pos++; - while (pos < (int) in.length() && delimDepth >= 0) { - switch (in[pos].unicode()) { - case '{': - delimDepth++; - arg += "{"; - pos++; - break; - case '}': - delimDepth--; - if (delimDepth >= 0) - arg += "}"; - pos++; - break; - case '\\': - if (verbatim) { - arg += in[pos]; - pos++; - } + pos++; + while (pos < (int) in.length() && delimDepth >= 0) { + switch (in[pos].unicode()) { + case '{': + delimDepth++; + arg += "{"; + pos++; + break; + case '}': + delimDepth--; + if (delimDepth >= 0) + arg += "}"; + pos++; + break; + case '\\': + if (verbatim) { + arg += in[pos]; + pos++; + } else { - pos++; - if (pos < (int) in.length()) { - if (in[pos].isLetterOrNumber()) - break; - arg += in[pos]; - if (in[pos].isSpace()) { - skipAllSpaces(); - } + pos++; + if (pos < (int) in.length()) { + if (in[pos].isLetterOrNumber()) + break; + arg += in[pos]; + if (in[pos].isSpace()) { + skipAllSpaces(); + } else { - pos++; - } - } - } - break; - default: - arg += in[pos]; - pos++; - } - } - if (delimDepth > 0) - location().warning(tr("Missing '}'")); + pos++; + } + } + } + break; + default: + arg += in[pos]; + pos++; + } + } + if (delimDepth > 0) + location().warning(tr("Missing '}'")); } else { - while (pos < in.length() && + while (pos < in.length() && ((delimDepth > 0) || ((delimDepth == 0) && !in[pos].isSpace()))) { - switch (in[pos].unicode()) { - case '(': - case '[': - case '{': - delimDepth++; - arg += in[pos]; - pos++; - break; - case ')': - case ']': - case '}': - delimDepth--; - if (pos == startPos || delimDepth >= 0) { - arg += in[pos]; - pos++; - } - break; - case '\\': - if (verbatim) { - arg += in[pos]; - pos++; - } + switch (in[pos].unicode()) { + case '(': + case '[': + case '{': + delimDepth++; + arg += in[pos]; + pos++; + break; + case ')': + case ']': + case '}': + delimDepth--; + if (pos == startPos || delimDepth >= 0) { + arg += in[pos]; + pos++; + } + break; + case '\\': + if (verbatim) { + arg += in[pos]; + pos++; + } else { - pos++; - if (pos < (int) in.length()) { - if (in[pos].isLetterOrNumber()) - break; - arg += in[pos]; - if (in[pos].isSpace()) { - skipAllSpaces(); - } + pos++; + if (pos < (int) in.length()) { + if (in[pos].isLetterOrNumber()) + break; + arg += in[pos]; + if (in[pos].isSpace()) { + skipAllSpaces(); + } else { - pos++; - } - } - } - break; - default: - arg += in[pos]; - pos++; - } - } - if ((arg.length() > 1) && + pos++; + } + } + } + break; + default: + arg += in[pos]; + pos++; + } + } + if ((arg.length() > 1) && (QString(".,:;!?").indexOf(in[pos - 1]) != -1) && !arg.endsWith("...")) { - arg.truncate(arg.length() - 1); - pos--; - } - if (arg.length() > 2 && in.mid(pos - 2, 2) == "'s") { - arg.truncate(arg.length() - 2); - pos -= 2; - } + arg.truncate(arg.length() - 1); + pos--; + } + if (arg.length() > 2 && in.mid(pos - 2, 2) == "'s") { + arg.truncate(arg.length() - 2); + pos -= 2; + } } return arg.simplified(); } @@ -2149,11 +2148,11 @@ QString DocParser::getOptionalArgument() { skipSpacesOrOneEndl(); if (pos + 1 < (int) in.length() && in[pos] == '\\' && - in[pos + 1].isLetterOrNumber()) { - return ""; + in[pos + 1].isLetterOrNumber()) { + return ""; } else { - return getArgument(); + return getArgument(); } } @@ -2216,7 +2215,7 @@ QString DocParser::getMetaCommandArgument(const QString &cmdStr) else if (in.at(pos) == ')') --parenDepth; - ++pos; + ++pos; } if (pos == in.size() && parenDepth > 0) { pos = begin; @@ -2236,12 +2235,12 @@ QString DocParser::getUntilEnd(int cmd) int end = rx.indexIn(in, pos); if (end == -1) { - location().warning(tr("Missing '\\%1'").arg(cmdName(endCmd))); - pos = in.length(); + location().warning(tr("Missing '\\%1'").arg(cmdName(endCmd))); + pos = in.length(); } else { - t = in.mid(pos, end - pos); - pos = end + rx.matchedLength(); + t = in.mid(pos, end - pos); + pos = end + rx.matchedLength(); } return t; } @@ -2271,9 +2270,9 @@ bool DocParser::isBlankLine() int i = pos; while (i < len && in[i].isSpace()) { - if (in[i] == '\n') - return true; - i++; + if (in[i] == '\n') + return true; + i++; } return false; } @@ -2284,10 +2283,10 @@ bool DocParser::isLeftBraceAhead() int i = pos; while (i < len && in[i].isSpace() && numEndl < 2) { - // ### bug with '\\' - if (in[i] == '\n') - numEndl++; - i++; + // ### bug with '\\' + if (in[i] == '\n') + numEndl++; + i++; } return numEndl < 2 && i < len && in[i] == '{'; } @@ -2297,31 +2296,31 @@ void DocParser::skipSpacesOnLine() while ((pos < in.length()) && in[pos].isSpace() && (in[pos].unicode() != '\n')) - ++pos; + ++pos; } void DocParser::skipSpacesOrOneEndl() { int firstEndl = -1; while (pos < (int) in.length() && in[pos].isSpace()) { - QChar ch = in[pos]; - if (ch == '\n') { - if (firstEndl == -1) { - firstEndl = pos; - } + QChar ch = in[pos]; + if (ch == '\n') { + if (firstEndl == -1) { + firstEndl = pos; + } else { - pos = firstEndl; - break; - } - } - pos++; + pos = firstEndl; + break; + } + } + pos++; } } void DocParser::skipAllSpaces() { while (pos < len && in[pos].isSpace()) - pos++; + pos++; } void DocParser::skipToNextPreprocessorCommand() @@ -2332,62 +2331,62 @@ void DocParser::skipToNextPreprocessorCommand() int end = rx.indexIn(in, pos + 1); // ### + 1 necessary? if (end == -1) - pos = in.length(); + pos = in.length(); else - pos = end; + pos = end; } int DocParser::endCmdFor(int cmd) { switch (cmd) { case CMD_ABSTRACT: - return CMD_ENDABSTRACT; + return CMD_ENDABSTRACT; case CMD_BADCODE: - return CMD_ENDCODE; + return CMD_ENDCODE; case CMD_CHAPTER: - return CMD_ENDCHAPTER; + return CMD_ENDCHAPTER; case CMD_CODE: - return CMD_ENDCODE; + return CMD_ENDCODE; #ifdef QDOC_QML case CMD_QML: - return CMD_ENDQML; + return CMD_ENDQML; case CMD_QMLTEXT: - return CMD_ENDQMLTEXT; + return CMD_ENDQMLTEXT; #endif case CMD_FOOTNOTE: - return CMD_ENDFOOTNOTE; + return CMD_ENDFOOTNOTE; case CMD_LEGALESE: return CMD_ENDLEGALESE; case CMD_LINK: return CMD_ENDLINK; case CMD_LIST: - return CMD_ENDLIST; + return CMD_ENDLIST; case CMD_NEWCODE: return CMD_ENDCODE; case CMD_OLDCODE: return CMD_NEWCODE; case CMD_OMIT: - return CMD_ENDOMIT; + return CMD_ENDOMIT; case CMD_PART: - return CMD_ENDPART; + return CMD_ENDPART; case CMD_QUOTATION: - return CMD_ENDQUOTATION; + return CMD_ENDQUOTATION; case CMD_RAW: return CMD_ENDRAW; case CMD_SECTION1: - return CMD_ENDSECTION1; + return CMD_ENDSECTION1; case CMD_SECTION2: - return CMD_ENDSECTION2; + return CMD_ENDSECTION2; case CMD_SECTION3: - return CMD_ENDSECTION3; + return CMD_ENDSECTION3; case CMD_SECTION4: - return CMD_ENDSECTION4; + return CMD_ENDSECTION4; case CMD_SIDEBAR: - return CMD_ENDSIDEBAR; + return CMD_ENDSIDEBAR; case CMD_TABLE: - return CMD_ENDTABLE; + return CMD_ENDTABLE; default: - return cmd; + return cmd; } } @@ -2441,14 +2440,14 @@ int DocParser::indentLevel(const QString& str) int column = 0; for (int i = 0; i < (int) str.length(); i++) { - if (str[i] == '\n') { - column = 0; - } + if (str[i] == '\n') { + column = 0; + } else { - if (str[i] != ' ' && column < minIndent) - minIndent = column; - column++; - } + if (str[i] != ' ' && column < minIndent) + minIndent = column; + column++; + } } return minIndent; } @@ -2456,21 +2455,21 @@ int DocParser::indentLevel(const QString& str) QString DocParser::unindent(int level, const QString& str) { if (level == 0) - return str; + return str; QString t; int column = 0; for (int i = 0; i < (int) str.length(); i++) { if (str[i] == QLatin1Char('\n')) { - t += '\n'; - column = 0; - } + t += '\n'; + column = 0; + } else { - if (column >= level) - t += str[i]; - column++; - } + if (column >= level) + t += str[i]; + column++; + } } return t; } @@ -2508,15 +2507,15 @@ Doc::Doc(const Doc& doc) Doc::~Doc() { if (priv && priv->deref()) - delete priv; + delete priv; } Doc &Doc::operator=(const Doc& doc) { if (doc.priv) - doc.priv->ref(); + doc.priv->ref(); if (priv && priv->deref()) - delete priv; + delete priv; priv = doc.priv; return *this; } @@ -2683,18 +2682,18 @@ Text Doc::trimmedBriefText(const QString &className) const whats = w.join(" "); if (whats.endsWith(".")) - whats.truncate(whats.length() - 1); + whats.truncate(whats.length() - 1); if (whats.isEmpty()) { - location().warning( + location().warning( tr("Nonstandard wording in '\\%1' text for '%2' (expected more text)") .arg(COMMAND_BRIEF).arg(className)); - standardWording = false; + standardWording = false; } else - whats[0] = whats[0].toUpper(); + whats[0] = whats[0].toUpper(); - // ### move this once \brief is abolished for properties + // ### move this once \brief is abolished for properties if (standardWording) resultText << whats; } @@ -2704,29 +2703,29 @@ Text Doc::trimmedBriefText(const QString &className) const Text Doc::legaleseText() const { if (priv == 0 || !priv->hasLegalese) - return Text(); + return Text(); else - return body().subText(Atom::LegaleseLeft, Atom::LegaleseRight); + return body().subText(Atom::LegaleseLeft, Atom::LegaleseRight); } const QString& Doc::baseName() const { static QString null; if (priv == 0 || priv->extra == 0) { - return null; + return null; } else { - return priv->extra->baseName; + return priv->extra->baseName; } } Doc::SectioningUnit Doc::granularity() const { if (priv == 0 || priv->extra == 0) { - return DocPrivateExtra().granularity; + return DocPrivateExtra().granularity; } else { - return priv->extra->granularity; + return priv->extra->granularity; } } @@ -2822,80 +2821,80 @@ void Doc::initialize(const Config& config) QSet commands = config.subVars(CONFIG_ALIAS); QSet::ConstIterator c = commands.begin(); while (c != commands.end()) { - QString alias = config.getString(CONFIG_ALIAS + Config::dot + *c); - if (reverseAliasMap.contains(alias)) { - config.lastLocation().warning(tr("Command name '\\%1' cannot stand" - " for both '\\%2' and '\\%3'") - .arg(alias) - .arg(reverseAliasMap[alias]) - .arg(*c)); - } + QString alias = config.getString(CONFIG_ALIAS + Config::dot + *c); + if (reverseAliasMap.contains(alias)) { + config.lastLocation().warning(tr("Command name '\\%1' cannot stand" + " for both '\\%2' and '\\%3'") + .arg(alias) + .arg(reverseAliasMap[alias]) + .arg(*c)); + } else { - reverseAliasMap.insert(alias, *c); - } - aliasMap()->insert(*c, alias); - ++c; + reverseAliasMap.insert(alias, *c); + } + aliasMap()->insert(*c, alias); + ++c; } int i = 0; while (cmds[i].english) { - cmds[i].alias = new QString(alias(cmds[i].english)); - cmdHash()->insert(*cmds[i].alias, cmds[i].no); + cmds[i].alias = new QString(alias(cmds[i].english)); + cmdHash()->insert(*cmds[i].alias, cmds[i].no); - if (cmds[i].no != i) - Location::internalError(tr("command %1 missing").arg(i)); - i++; + if (cmds[i].no != i) + Location::internalError(tr("command %1 missing").arg(i)); + i++; } QSet macroNames = config.subVars(CONFIG_MACRO); QSet::ConstIterator n = macroNames.begin(); while (n != macroNames.end()) { - QString macroDotName = CONFIG_MACRO + Config::dot + *n; - Macro macro; - macro.numParams = -1; - macro.defaultDef = config.getString(macroDotName); - if (!macro.defaultDef.isEmpty()) { - macro.defaultDefLocation = config.lastLocation(); - macro.numParams = Config::numParams(macro.defaultDef); - } - bool silent = false; - - QSet formats = config.subVars(macroDotName); - QSet::ConstIterator f = formats.begin(); - while (f != formats.end()) { - QString def = config.getString(macroDotName + Config::dot + *f); - if (!def.isEmpty()) { - macro.otherDefs.insert(*f, def); - int m = Config::numParams(macro.defaultDef); - if (macro.numParams == -1) { - macro.numParams = m; - } + QString macroDotName = CONFIG_MACRO + Config::dot + *n; + Macro macro; + macro.numParams = -1; + macro.defaultDef = config.getString(macroDotName); + if (!macro.defaultDef.isEmpty()) { + macro.defaultDefLocation = config.lastLocation(); + macro.numParams = Config::numParams(macro.defaultDef); + } + bool silent = false; + + QSet formats = config.subVars(macroDotName); + QSet::ConstIterator f = formats.begin(); + while (f != formats.end()) { + QString def = config.getString(macroDotName + Config::dot + *f); + if (!def.isEmpty()) { + macro.otherDefs.insert(*f, def); + int m = Config::numParams(macro.defaultDef); + if (macro.numParams == -1) { + macro.numParams = m; + } else if (macro.numParams != m) { - if (!silent) { - QString other = tr("default"); - if (macro.defaultDef.isEmpty()) - other = macro.otherDefs.begin().key(); - config.lastLocation().warning(tr("Macro '\\%1' takes" - " inconsistent number" - " of arguments (%2" - " %3, %4 %5)") - .arg(*n) - .arg(*f) - .arg(m) - .arg(other) - .arg(macro.numParams)); - silent = true; - } - if (macro.numParams < m) - macro.numParams = m; - } - } - ++f; - } - - if (macro.numParams != -1) - macroHash()->insert(*n, macro); - ++n; + if (!silent) { + QString other = tr("default"); + if (macro.defaultDef.isEmpty()) + other = macro.otherDefs.begin().key(); + config.lastLocation().warning(tr("Macro '\\%1' takes" + " inconsistent number" + " of arguments (%2" + " %3, %4 %5)") + .arg(*n) + .arg(*f) + .arg(m) + .arg(other) + .arg(macro.numParams)); + silent = true; + } + if (macro.numParams < m) + macro.numParams = m; + } + } + ++f; + } + + if (macro.numParams != -1) + macroHash()->insert(*n, macro); + ++n; } } @@ -2935,27 +2934,27 @@ void Doc::trimCStyleComment(Location& location, QString& str) int i; for (i = 0; i < (int) str.length(); i++) { - if (m.columnNo() == asterColumn) { - if (str[i] != '*') - break; - cleaned += ' '; - metAsterColumn = true; - } + if (m.columnNo() == asterColumn) { + if (str[i] != '*') + break; + cleaned += ' '; + metAsterColumn = true; + } else { - if (str[i] == '\n') { - if (!metAsterColumn) - break; - metAsterColumn = false; - } - cleaned += str[i]; - } - m.advance(str[i]); + if (str[i] == '\n') { + if (!metAsterColumn) + break; + metAsterColumn = false; + } + cleaned += str[i]; + } + m.advance(str[i]); } if (cleaned.length() == str.length()) - str = cleaned; + str = cleaned; for (int i = 0; i < 3; i++) - location.advance(str[i]); + location.advance(str[i]); str = str.mid(3, str.length() - 5); } @@ -2971,19 +2970,19 @@ CodeMarker *Doc::quoteFromFile(const Location &location, QString filePath = Config::findFile(location, DocParser::exampleFiles, DocParser::exampleDirs, - fileName, userFriendlyFilePath); + fileName, userFriendlyFilePath); if (filePath.isEmpty()) { - location.warning(tr("Cannot find example file '%1'").arg(fileName)); + location.warning(tr("Cannot find example file '%1'").arg(fileName)); } else { - QFile inFile(filePath); - if (!inFile.open(QFile::ReadOnly)) { - location.warning(tr("Cannot open example file '%1'").arg(userFriendlyFilePath)); - } + QFile inFile(filePath); + if (!inFile.open(QFile::ReadOnly)) { + location.warning(tr("Cannot open example file '%1'").arg(userFriendlyFilePath)); + } else { - QTextStream inStream(&inFile); - code = DocParser::untabifyEtc(inStream.readAll()); - } + QTextStream inStream(&inFile); + code = DocParser::untabifyEtc(inStream.readAll()); + } } QString dirPath = QFileInfo(filePath).path(); -- cgit v0.12 From 04e6c74420ba808a3bd9ae502ff12c60cc6b58f8 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Mon, 29 Nov 2010 19:58:43 +0100 Subject: Added more span classes to make the QML output more colorful. --- tools/qdoc3/htmlgenerator.cpp | 43 ++++++++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 9f5f182..b4e9d2a 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -89,7 +89,7 @@ static bool showBrokenLinks = false; static QRegExp linkTag("(<@link node=\"([^\"]+)\">).*()"); static QRegExp funcTag("(<@func target=\"([^\"]*)\">)(.*)()"); static QRegExp typeTag("(<@(type|headerfile|func)(?: +[^>]*)?>)(.*)()"); -static QRegExp spanTag(""); +static QRegExp spanTag(""); static QRegExp unknownTag("]*>"); bool parseArg(const QString &src, @@ -216,8 +216,8 @@ HtmlGenerator::HtmlGenerator() numTableRows(0), threeColumnEnumValueTable(true), funcLeftParen("\\S(\\()"), - myTree(0), inObsoleteLink(false), + myTree(0), slow(false), obsoleteLinks(false) { @@ -1476,7 +1476,7 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) return; } #endif - + sections = marker->sections(fake, CodeMarker::Summary, CodeMarker::Okay); s = sections.begin(); while (s != sections.end()) { @@ -2846,23 +2846,40 @@ QString HtmlGenerator::highlightedCode(const QString& markedCode, // "<@preprocessor>" -> ""; // "<@string>" -> ""; // "<@char>" -> ""; - // "" -> "" + // "<@number>" -> ""; + // "<@op>" -> ""; + // "<@type>" -> ""; + // "<@name>" -> ""; + // "<@keyword>" -> ""; + // "" -> "" src = html; html = QString(); static const QString spanTags[] = { - "<@comment>", "", - "<@preprocessor>", "", - "<@string>", "", - "<@char>", "", - "", "", - "","", - "", "", - "", "" + "<@comment>", "", + "<@preprocessor>", "", + "<@string>", "", + "<@char>", "", + "<@number>", "", + "<@op>", "", + "<@type>", "", + "<@name>", "", + "<@keyword>", "", + "", "", + "", "", + "", "", + "", "", + "", "", + "", "", + "", "", + "", "", + "", "", }; + // Update the upper bound of k in the following code to match the length + // of the above array. for (int i = 0, n = src.size(); i < n;) { if (src.at(i) == charLangle) { bool handled = false; - for (int k = 0; k != 8; ++k) { + for (int k = 0; k != 18; ++k) { const QString & tag = spanTags[2 * k]; if (tag == QStringRef(&src, i, tag.length())) { html += spanTags[2 * k + 1]; -- cgit v0.12 From 7072882e6873782f258fa3f7d2acee801226d8c0 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Mon, 29 Nov 2010 19:59:45 +0100 Subject: Fixed grammar. --- tools/qdoc3/test/qt-html-templates-online.qdocconf | 2 +- tools/qdoc3/test/qt-html-templates.qdocconf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/qdoc3/test/qt-html-templates-online.qdocconf b/tools/qdoc3/test/qt-html-templates-online.qdocconf index 7ed8c90..1d55cee 100644 --- a/tools/qdoc3/test/qt-html-templates-online.qdocconf +++ b/tools/qdoc3/test/qt-html-templates-online.qdocconf @@ -126,7 +126,7 @@ HTML.postheader = \ "
    \n" \ "
      \n" \ "
    • Home
    • \n" \ - " \n" + " \n" HTML.postpostheader = \ "
    \n" \ diff --git a/tools/qdoc3/test/qt-html-templates.qdocconf b/tools/qdoc3/test/qt-html-templates.qdocconf index bbd1b21..67ce95a 100644 --- a/tools/qdoc3/test/qt-html-templates.qdocconf +++ b/tools/qdoc3/test/qt-html-templates.qdocconf @@ -13,7 +13,7 @@ HTML.postheader = \ "
    \n" \ "
      \n" \ "
    • Home
    • \n" \ - " \n" + " \n" HTML.postpostheader = \ "
    \n" \ -- cgit v0.12 From 361fa33371a855e82b63b4d45b2ffe36fed82867 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Mon, 29 Nov 2010 20:00:26 +0100 Subject: Made further refinements to the node traversal and comment handling. --- tools/qdoc3/qmlmarkupvisitor.cpp | 285 ++++++++++++++++++++++++--------------- tools/qdoc3/qmlmarkupvisitor.h | 10 +- 2 files changed, 186 insertions(+), 109 deletions(-) diff --git a/tools/qdoc3/qmlmarkupvisitor.cpp b/tools/qdoc3/qmlmarkupvisitor.cpp index 72a2334..4564dc5 100644 --- a/tools/qdoc3/qmlmarkupvisitor.cpp +++ b/tools/qdoc3/qmlmarkupvisitor.cpp @@ -40,7 +40,6 @@ ****************************************************************************/ #include -#include #include #include #include "private/qdeclarativejsast_p.h" @@ -51,42 +50,116 @@ QT_BEGIN_NAMESPACE -QmlMarkupVisitor::QmlMarkupVisitor(const QString &source, bool debug) +QmlMarkupVisitor::QmlMarkupVisitor(const QString &source, QDeclarativeJS::Engine *engine) { this->source = source; + this->engine = engine; indent = 0; cursor = 0; - showDebug = debug; + commentIndex = 0; + debug += QString("Comments %1\n").arg(engine->comments().length()); } QmlMarkupVisitor::~QmlMarkupVisitor() { } +// The protect() function is a copy of the one from CppCodeMarker. + +static const QString samp = QLatin1String("&"); +static const QString slt = QLatin1String("<"); +static const QString sgt = QLatin1String(">"); +static const QString squot = QLatin1String("""); + +QString QmlMarkupVisitor::protect(const QString& str) +{ + int n = str.length(); + QString marked; + marked.reserve(n * 2 + 30); + const QChar *data = str.constData(); + for (int i = 0; i != n; ++i) { + switch (data[i].unicode()) { + case '&': marked += samp; break; + case '<': marked += slt; break; + case '>': marked += sgt; break; + case '"': marked += squot; break; + default : marked += data[i]; + } + } + return marked; +} + QString QmlMarkupVisitor::markedUpCode() { if (cursor < source.length()) - return output + source.mid(cursor); - else - return output; + addExtra(cursor, source.length()); + + //qDebug() << debug; + qDebug() << output; + return output; } -void QmlMarkupVisitor::addMarkedUpToken( - QDeclarativeJS::AST::SourceLocation &location, const QString &text) +void QmlMarkupVisitor::addExtra(quint32 start, quint32 finish) { - //qDebug() << "t**" << cursor << location.offset; - if (location.offset > cursor) { - QString extra = source.mid(cursor, location.offset - cursor); + if (commentIndex >= engine->comments().length()) { + QString extra = source.mid(start, finish - start); if (extra.trimmed().isEmpty()) output += extra; else - output += "<<<" + extra + ">>>"; - //qDebug() << "+++" << source.mid(cursor, location.offset - cursor); - cursor += location.offset; + output += protect(extra); // text that should probably have been caught by the parser + + cursor = finish; + return; } - //qDebug() << "-->" << text; - output += text; + while (commentIndex < engine->comments().length()) { + if (engine->comments()[commentIndex].offset - 2 >= start) + break; + commentIndex++; + } + + quint32 i = start; + while (i < finish && commentIndex < engine->comments().length()) { + quint32 j = engine->comments()[commentIndex].offset - 2; + if (i <= j && j < finish) { + if (i < j) + output += protect(source.mid(i, j - i)); + + quint32 l = engine->comments()[commentIndex].length; + if (source.mid(j, 2) == QLatin1String("/*")) + l += 4; + else + l += 2; + output += QLatin1String("<@comment>"); + output += protect(source.mid(j, l)); + output += QLatin1String(""); + commentIndex++; + i = j + l; + } else + break; + } + + QString extra = source.mid(i, finish - i); + if (extra.trimmed().isEmpty()) + output += extra; + else + output += protect(extra); // text that should probably have been caught by the parser + + cursor = finish; +} + +void QmlMarkupVisitor::addMarkedUpToken( + QDeclarativeJS::AST::SourceLocation &location, const QString &tagName) +{ + if (!location.isValid()) + return; + + if (cursor < location.offset) + addExtra(cursor, location.offset); + else if (cursor > location.offset) + debug += QString("%1 %2\n").arg(cursor).arg(location.offset); + + output += QString(QLatin1String("<@%1>%2")).arg(tagName, protect(sourceText(location)), tagName); cursor += location.length; } @@ -98,36 +171,31 @@ QString QmlMarkupVisitor::sourceText(QDeclarativeJS::AST::SourceLocation &locati void QmlMarkupVisitor::addVerbatim(QDeclarativeJS::AST::SourceLocation first, QDeclarativeJS::AST::SourceLocation last) { + if (!first.isValid()) + return; + quint32 start = first.begin(); - //qDebug() << "v**" << cursor << start; quint32 finish; if (last.isValid()) finish = last.end(); else finish = first.end(); - if (start > cursor) { - QString extra = source.mid(cursor, start - cursor); - if (extra.trimmed().isEmpty()) - output += extra; - else - output += "<<<" + extra + ">>>"; - //qDebug() << "+++" << source.mid(cursor, start - cursor); - cursor = start; - } + if (cursor < start) + addExtra(cursor, start); + else if (cursor > start) + debug += QString("%1 %2 %3 x\n").arg(sourceText(first)).arg(cursor).arg(start); QString text = source.mid(start, finish - start); - //qDebug() << "-->" << text; write(text); indent -= 1; - output += text; - cursor += text.length(); + output += protect(text); + cursor = finish; } void QmlMarkupVisitor::write(const QString &text) { - if (showDebug) - qDebug() << QString().fill(QChar(' '), indent) << text; + debug += QString().fill(QChar(' '), indent) + text + QLatin1String("\n"); indent += 1; } @@ -152,8 +220,8 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiImport *uiimport) write(""); addVerbatim(uiimport->importToken); if (!uiimport->importUri) - addVerbatim(uiimport->fileNameToken); - return true; + addMarkedUpToken(uiimport->fileNameToken, QLatin1String("headerfile")); + return false; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiImport *uiimport) @@ -161,7 +229,7 @@ void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiImport *uiimport) endWrite(""); addVerbatim(uiimport->versionToken); addVerbatim(uiimport->asToken); - addVerbatim(uiimport->importIdToken); + addMarkedUpToken(uiimport->importIdToken, QLatin1String("headerfile")); addVerbatim(uiimport->semicolonToken); //endWrite(""); } @@ -174,23 +242,23 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiPublicMember *member) addVerbatim(member->readonlyToken); addVerbatim(member->propertyToken); addVerbatim(member->typeModifierToken); - addVerbatim(member->typeToken); - addVerbatim(member->identifierToken); + addMarkedUpToken(member->typeToken, QLatin1String("type")); + addMarkedUpToken(member->identifierToken, QLatin1String("name")); addVerbatim(member->colonToken); QDeclarativeJS::AST::Node::accept(member->binding, this); } else { addVerbatim(member->propertyToken); addVerbatim(member->typeModifierToken); - addVerbatim(member->typeToken); + addMarkedUpToken(member->typeToken, QLatin1String("type")); //addVerbatim(member->identifierToken); QDeclarativeJS::AST::Node::accept(member->parameters, this); } - return true; + addVerbatim(member->semicolonToken); + return false; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiPublicMember *member) { - addVerbatim(member->semicolonToken); endWrite(""); } @@ -279,7 +347,7 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiArrayMemberList *list) write(""); for (QDeclarativeJS::AST::UiArrayMemberList *it = list; it; it = it->next) { QDeclarativeJS::AST::Node::accept(it->member, this); - addVerbatim(it->commaToken); + //addVerbatim(it->commaToken); } return false; } @@ -292,7 +360,7 @@ void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiArrayMemberList *) bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiQualifiedId *id) { write(""); - addVerbatim(id->identifierToken); + addMarkedUpToken(id->identifierToken, QLatin1String("name")); return false; } @@ -317,7 +385,7 @@ void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiSignature *signature) bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiFormal *formal) { write(""); - addVerbatim(formal->identifierToken); + addMarkedUpToken(formal->identifierToken, QLatin1String("name")); addVerbatim(formal->asToken); addVerbatim(formal->aliasToken); return false; @@ -344,8 +412,8 @@ void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ThisExpression *) bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::IdentifierExpression *identifier) { write(""); - addVerbatim(identifier->identifierToken); - return true; + addMarkedUpToken(identifier->identifierToken, QLatin1String("name")); + return false; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::IdentifierExpression *) @@ -357,7 +425,7 @@ void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::IdentifierExpression *) bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NullExpression *null) { write(""); - addVerbatim(null->nullToken); + addMarkedUpToken(null->nullToken, QLatin1String("number")); return true; } @@ -370,7 +438,7 @@ void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::NullExpression *) bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::TrueLiteral *literal) { write(""); - addVerbatim(literal->trueToken); + addMarkedUpToken(literal->trueToken, QLatin1String("number")); return true; } @@ -383,7 +451,7 @@ void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::TrueLiteral *) bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FalseLiteral *literal) { write(""); - addVerbatim(literal->falseToken); + addMarkedUpToken(literal->falseToken, QLatin1String("number")); return true; } @@ -396,10 +464,10 @@ void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::FalseLiteral *) bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NumericLiteral *literal) { //write(""); - addVerbatim(literal->literalToken); - return true; + addMarkedUpToken(literal->literalToken, QLatin1String("number")); + return false; } - + void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::NumericLiteral *) { //endWrite(""); @@ -409,10 +477,10 @@ void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::NumericLiteral *) bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::StringLiteral *literal) { //write(""); - addVerbatim(literal->literalToken); + addMarkedUpToken(literal->literalToken, QLatin1String("string")); return true; } - + void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::StringLiteral *) { //endWrite(""); @@ -466,7 +534,7 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ElementList *list) write(""); for (QDeclarativeJS::AST::ElementList *it = list; it; it = it->next) { QDeclarativeJS::AST::Node::accept(it->expression, this); - addVerbatim(it->commaToken); + //addVerbatim(it->commaToken); } QDeclarativeJS::AST::Node::accept(list->elision, this); return false; @@ -571,7 +639,7 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FieldMemberExpression *express write(""); QDeclarativeJS::AST::Node::accept(expression->base, this); addVerbatim(expression->dotToken); - addVerbatim(expression->identifierToken); + addMarkedUpToken(expression->identifierToken, QLatin1String("name")); return false; } @@ -587,12 +655,13 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NewMemberExpression *expressio addVerbatim(expression->newToken); QDeclarativeJS::AST::Node::accept(expression->base, this); addVerbatim(expression->lparenToken); - return true; + QDeclarativeJS::AST::Node::accept(expression->arguments, this); + addVerbatim(expression->rparenToken); + return false; } - + void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::NewMemberExpression *expression) { - addVerbatim(expression->rparenToken); endWrite(""); } @@ -745,7 +814,7 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UnaryMinusExpression *expressi addVerbatim(expression->minusToken); return true; } - + void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UnaryMinusExpression *) { endWrite(""); @@ -758,7 +827,7 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::TildeExpression *expression) addVerbatim(expression->tildeToken); return true; } - + void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::TildeExpression *) { endWrite(""); @@ -771,7 +840,7 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NotExpression *expression) addVerbatim(expression->notToken); return true; } - + void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::NotExpression *) { endWrite(""); @@ -782,7 +851,7 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::BinaryExpression *expression) { write(""); QDeclarativeJS::AST::Node::accept(expression->left, this); - addVerbatim(expression->operatorToken); + addMarkedUpToken(expression->operatorToken, QLatin1String("op")); QDeclarativeJS::AST::Node::accept(expression->right, this); return false; } @@ -798,7 +867,7 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ConditionalExpression *express write(""); return true; } - + void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ConditionalExpression *) { endWrite(""); @@ -816,7 +885,6 @@ void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::Expression *) endWrite(""); } - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Block *block) { write(""); @@ -874,7 +942,7 @@ void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::VariableDeclarationList *) bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::VariableDeclaration *declaration) { write(""); - addVerbatim(declaration->identifierToken); + addMarkedUpToken(declaration->identifierToken, QLatin1String("name")); QDeclarativeJS::AST::Node::accept(declaration->expression, this); return false; } @@ -914,11 +982,12 @@ void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ExpressionStatement *statem bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::IfStatement *statement) { write(""); - addVerbatim(statement->ifToken); + addMarkedUpToken(statement->ifToken, QLatin1String("keyword")); addVerbatim(statement->lparenToken); QDeclarativeJS::AST::Node::accept(statement->expression, this); addVerbatim(statement->rparenToken); QDeclarativeJS::AST::Node::accept(statement->ok, this); + //addMarkedUpToken(statement->elseToken, QLatin1String("keyword")); //addVerbatim(statement->elseToken); ### this token referred to the wrong source text for some reason QDeclarativeJS::AST::Node::accept(statement->ko, this); return false; @@ -933,9 +1002,9 @@ void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::IfStatement *) bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::DoWhileStatement *statement) { write(""); - addVerbatim(statement->doToken); + addMarkedUpToken(statement->doToken, QLatin1String("keyword")); QDeclarativeJS::AST::Node::accept(statement->statement, this); - addVerbatim(statement->whileToken); + addMarkedUpToken(statement->whileToken, QLatin1String("keyword")); addVerbatim(statement->lparenToken); QDeclarativeJS::AST::Node::accept(statement->expression, this); addVerbatim(statement->rparenToken); @@ -954,7 +1023,7 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::WhileStatement *statement) write(""); return true; } - + void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::WhileStatement *) { endWrite(""); @@ -964,7 +1033,7 @@ void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::WhileStatement *) bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ForStatement *statement) { write(""); - addVerbatim(statement->forToken); + addMarkedUpToken(statement->forToken, QLatin1String("keyword")); addVerbatim(statement->lparenToken); QDeclarativeJS::AST::Node::accept(statement->initialiser, this); addVerbatim(statement->firstSemicolonToken); @@ -985,9 +1054,9 @@ void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ForStatement *) bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::LocalForStatement *statement) { write(""); - addVerbatim(statement->forToken); + addMarkedUpToken(statement->forToken, QLatin1String("keyword")); addVerbatim(statement->lparenToken); - addVerbatim(statement->varToken); + addMarkedUpToken(statement->varToken, QLatin1String("keyword")); QDeclarativeJS::AST::Node::accept(statement->declarations, this); addVerbatim(statement->firstSemicolonToken); QDeclarativeJS::AST::Node::accept(statement->condition, this); @@ -1007,14 +1076,14 @@ void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::LocalForStatement *) bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ForEachStatement *statement) { write(""); - addVerbatim(statement->forToken); + addMarkedUpToken(statement->forToken, QLatin1String("keyword")); addVerbatim(statement->lparenToken); QDeclarativeJS::AST::Node::accept(statement->initialiser, this); addVerbatim(statement->inToken); QDeclarativeJS::AST::Node::accept(statement->expression, this); addVerbatim(statement->rparenToken); QDeclarativeJS::AST::Node::accept(statement->statement, this); - return true; + return false; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ForEachStatement *) @@ -1026,15 +1095,15 @@ void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ForEachStatement *) bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::LocalForEachStatement *statement) { write(""); - addVerbatim(statement->forToken); + addMarkedUpToken(statement->forToken, QLatin1String("keyword")); addVerbatim(statement->lparenToken); - addVerbatim(statement->varToken); + addMarkedUpToken(statement->varToken, QLatin1String("keyword")); QDeclarativeJS::AST::Node::accept(statement->declaration, this); addVerbatim(statement->inToken); QDeclarativeJS::AST::Node::accept(statement->expression, this); addVerbatim(statement->rparenToken); QDeclarativeJS::AST::Node::accept(statement->statement, this); - return true; + return false; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::LocalForEachStatement *) @@ -1046,10 +1115,10 @@ void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::LocalForEachStatement *) bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ContinueStatement *statement) { write(""); - addVerbatim(statement->continueToken); - addVerbatim(statement->identifierToken); + addMarkedUpToken(statement->continueToken, QLatin1String("keyword")); + addMarkedUpToken(statement->identifierToken, QLatin1String("name")); addVerbatim(statement->semicolonToken); - return true; + return false; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ContinueStatement *) @@ -1061,10 +1130,10 @@ void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ContinueStatement *) bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::BreakStatement *statement) { write(""); - addVerbatim(statement->breakToken); - addVerbatim(statement->identifierToken); + addMarkedUpToken(statement->breakToken, QLatin1String("keyword")); + addMarkedUpToken(statement->identifierToken, QLatin1String("name")); addVerbatim(statement->semicolonToken); - return true; + return false; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::BreakStatement *) @@ -1076,7 +1145,7 @@ void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::BreakStatement *) bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ReturnStatement *statement) { write(""); - addVerbatim(statement->returnToken); + addMarkedUpToken(statement->returnToken, QLatin1String("keyword")); return true; } @@ -1090,7 +1159,7 @@ void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ReturnStatement *statement) bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::WithStatement *statement) { write(""); - addVerbatim(statement->withToken); + addMarkedUpToken(statement->withToken, QLatin1String("keyword")); addVerbatim(statement->lparenToken); addVerbatim(statement->rparenToken); return true; @@ -1105,7 +1174,7 @@ void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::WithStatement *) bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::CaseBlock *block) { write(""); - addVerbatim(block->lbraceToken, block->lbraceToken); + addVerbatim(block->lbraceToken); return true; } @@ -1119,7 +1188,7 @@ void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::CaseBlock *block) bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::SwitchStatement *statement) { write(""); - addVerbatim(statement->switchToken); + addMarkedUpToken(statement->switchToken, QLatin1String("keyword")); addVerbatim(statement->lparenToken); QDeclarativeJS::AST::Node::accept(statement->expression, this); addVerbatim(statement->rparenToken); @@ -1146,7 +1215,7 @@ void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::CaseClauses *) bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::CaseClause *clause) { write(""); - addVerbatim(clause->caseToken); + addMarkedUpToken(clause->caseToken, QLatin1String("keyword")); QDeclarativeJS::AST::Node::accept(clause->expression, this); addVerbatim(clause->colonToken); QDeclarativeJS::AST::Node::accept(clause->statements, this); @@ -1162,7 +1231,7 @@ void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::CaseClause *clause) bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::DefaultClause *clause) { write(""); - addVerbatim(clause->defaultToken, clause->defaultToken); + addMarkedUpToken(clause->defaultToken, QLatin1String("keyword")); addVerbatim(clause->colonToken, clause->colonToken); return true; } @@ -1176,10 +1245,10 @@ void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::DefaultClause *) bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::LabelledStatement *statement) { write(""); - addVerbatim(statement->identifierToken); + addMarkedUpToken(statement->identifierToken, QLatin1String("name")); addVerbatim(statement->colonToken); QDeclarativeJS::AST::Node::accept(statement->statement, this); - return true; + return false; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::LabelledStatement *) @@ -1191,7 +1260,7 @@ void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::LabelledStatement *) bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ThrowStatement *statement) { write(""); - addVerbatim(statement->throwToken); + addMarkedUpToken(statement->throwToken, QLatin1String("keyword")); QDeclarativeJS::AST::Node::accept(statement->expression, this); addVerbatim(statement->semicolonToken); return false; @@ -1206,11 +1275,11 @@ void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ThrowStatement *) bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Catch *c) { write(""); - addVerbatim(c->catchToken, c->catchToken); - addVerbatim(c->lparenToken, c->lparenToken); - addVerbatim(c->identifierToken, c->identifierToken); - addVerbatim(c->rparenToken, c->rparenToken); - return true; + addMarkedUpToken(c->catchToken, QLatin1String("keyword")); + addVerbatim(c->lparenToken); + addMarkedUpToken(c->identifierToken, QLatin1String("name")); + addVerbatim(c->rparenToken); + return false; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::Catch *) @@ -1222,7 +1291,7 @@ void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::Catch *) bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Finally *f) { write(""); - addVerbatim(f->finallyToken); + addMarkedUpToken(f->finallyToken, QLatin1String("keyword")); QDeclarativeJS::AST::Node::accept(f->statement, this); return false; } @@ -1236,7 +1305,7 @@ void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::Finally *) bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::TryStatement *statement) { write(""); - addVerbatim(statement->tryToken); + addMarkedUpToken(statement->tryToken, QLatin1String("keyword")); QDeclarativeJS::AST::Node::accept(statement->statement, this); QDeclarativeJS::AST::Node::accept(statement->catchExpression, this); QDeclarativeJS::AST::Node::accept(statement->finallyExpression, this); @@ -1252,8 +1321,8 @@ void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::TryStatement *) bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FunctionExpression *expression) { write(""); - addVerbatim(expression->functionToken); - addVerbatim(expression->identifierToken); + addMarkedUpToken(expression->functionToken, QLatin1String("keyword")); + addMarkedUpToken(expression->identifierToken, QLatin1String("name")); addVerbatim(expression->lparenToken); QDeclarativeJS::AST::Node::accept(expression->formals, this); addVerbatim(expression->rparenToken); @@ -1271,8 +1340,8 @@ void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::FunctionExpression *express bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FunctionDeclaration *declaration) { write(""); - addVerbatim(declaration->functionToken); - addVerbatim(declaration->identifierToken); + addMarkedUpToken(declaration->functionToken, QLatin1String("keyword")); + addMarkedUpToken(declaration->identifierToken, QLatin1String("name")); addVerbatim(declaration->lparenToken); QDeclarativeJS::AST::Node::accept(declaration->formals, this); addVerbatim(declaration->rparenToken); @@ -1290,9 +1359,9 @@ void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::FunctionDeclaration *) bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FormalParameterList *list) { write(""); - addVerbatim(list->commaToken, list->commaToken); - addVerbatim(list->identifierToken, list->identifierToken); - return true; + addVerbatim(list->commaToken); + addMarkedUpToken(list->identifierToken, QLatin1String("name")); + return false; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::FormalParameterList *) @@ -1346,10 +1415,12 @@ void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::StatementSourceElement *) endWrite(""); } -bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiObjectDefinition *) +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiObjectDefinition *definition) { write(""); - return true; + QDeclarativeJS::AST::Node::accept(definition->qualifiedTypeNameId, this); + QDeclarativeJS::AST::Node::accept(definition->initializer, this); + return false; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiObjectDefinition *) diff --git a/tools/qdoc3/qmlmarkupvisitor.h b/tools/qdoc3/qmlmarkupvisitor.h index 86e1ac2..01b0acf 100644 --- a/tools/qdoc3/qmlmarkupvisitor.h +++ b/tools/qdoc3/qmlmarkupvisitor.h @@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE class QmlMarkupVisitor : public QDeclarativeJS::AST::Visitor { public: - QmlMarkupVisitor(const QString &code, bool debug = false); + QmlMarkupVisitor(const QString &code, QDeclarativeJS::Engine *engine); virtual ~QmlMarkupVisitor(); QString markedUpCode(); @@ -317,7 +317,11 @@ public: virtual bool visit(QDeclarativeJS::AST::UiParameterList *); virtual void endVisit(QDeclarativeJS::AST::UiParameterList *); +protected: + QString protect(const QString &string); + private: + void addExtra(quint32 start, quint32 finish); void addMarkedUpToken(QDeclarativeJS::AST::SourceLocation &location, const QString &text); void addVerbatim(QDeclarativeJS::AST::SourceLocation first, @@ -326,11 +330,13 @@ private: void write(const QString &text); void endWrite(const QString &text); + QDeclarativeJS::Engine *engine; QString source; QString output; quint32 cursor; + quint32 commentIndex; int indent; - bool showDebug; + QString debug; }; QT_END_NAMESPACE -- cgit v0.12 From 88a86d8e2c82edf53b56afcc2f80fffd32a18e49 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Tue, 30 Nov 2010 18:28:27 +0100 Subject: Made more adjustments to node handling and removed debugging statements. --- tools/qdoc3/qmlmarkupvisitor.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/tools/qdoc3/qmlmarkupvisitor.cpp b/tools/qdoc3/qmlmarkupvisitor.cpp index 4564dc5..387b562 100644 --- a/tools/qdoc3/qmlmarkupvisitor.cpp +++ b/tools/qdoc3/qmlmarkupvisitor.cpp @@ -39,7 +39,6 @@ ** ****************************************************************************/ -#include #include #include #include "private/qdeclarativejsast_p.h" @@ -57,7 +56,7 @@ QmlMarkupVisitor::QmlMarkupVisitor(const QString &source, QDeclarativeJS::Engine indent = 0; cursor = 0; commentIndex = 0; - debug += QString("Comments %1\n").arg(engine->comments().length()); + QString("Comments %1\n").arg(engine->comments().length()); } QmlMarkupVisitor::~QmlMarkupVisitor() @@ -94,8 +93,6 @@ QString QmlMarkupVisitor::markedUpCode() if (cursor < source.length()) addExtra(cursor, source.length()); - //qDebug() << debug; - qDebug() << output; return output; } @@ -157,7 +154,7 @@ void QmlMarkupVisitor::addMarkedUpToken( if (cursor < location.offset) addExtra(cursor, location.offset); else if (cursor > location.offset) - debug += QString("%1 %2\n").arg(cursor).arg(location.offset); + return; output += QString(QLatin1String("<@%1>%2")).arg(tagName, protect(sourceText(location)), tagName); cursor += location.length; @@ -184,7 +181,7 @@ void QmlMarkupVisitor::addVerbatim(QDeclarativeJS::AST::SourceLocation first, if (cursor < start) addExtra(cursor, start); else if (cursor > start) - debug += QString("%1 %2 %3 x\n").arg(sourceText(first)).arg(cursor).arg(start); + return; QString text = source.mid(start, finish - start); write(text); @@ -195,11 +192,10 @@ void QmlMarkupVisitor::addVerbatim(QDeclarativeJS::AST::SourceLocation first, void QmlMarkupVisitor::write(const QString &text) { - debug += QString().fill(QChar(' '), indent) + text + QLatin1String("\n"); indent += 1; } -void QmlMarkupVisitor::endWrite(const QString &) +void QmlMarkupVisitor::endWrite(const QString &text) { indent -= 1; } @@ -877,6 +873,9 @@ void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ConditionalExpression *) bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Expression *expression) { write(""); + QDeclarativeJS::AST::Node::accept(expression->left, this); + addVerbatim(expression->commaToken); + QDeclarativeJS::AST::Node::accept(expression->right, this); return true; } @@ -987,9 +986,10 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::IfStatement *statement) QDeclarativeJS::AST::Node::accept(statement->expression, this); addVerbatim(statement->rparenToken); QDeclarativeJS::AST::Node::accept(statement->ok, this); - //addMarkedUpToken(statement->elseToken, QLatin1String("keyword")); - //addVerbatim(statement->elseToken); ### this token referred to the wrong source text for some reason - QDeclarativeJS::AST::Node::accept(statement->ko, this); + if (statement->ko) { + addMarkedUpToken(statement->elseToken, QLatin1String("keyword")); + QDeclarativeJS::AST::Node::accept(statement->ko, this); + } return false; } -- cgit v0.12 From eae5f69a23d46d237ee2021319d093c580dff679 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 1 Dec 2010 11:57:35 +0100 Subject: Removed an unused function. --- tools/qdoc3/main.cpp | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/tools/qdoc3/main.cpp b/tools/qdoc3/main.cpp index ac1c5de..68b5370 100644 --- a/tools/qdoc3/main.cpp +++ b/tools/qdoc3/main.cpp @@ -95,21 +95,6 @@ static QStringList defines; static QHash trees; /*! - Find the Tree for language \a lang and return a pointer to it. - If there is no Tree for language \a lang in the Tree table, add - a new one. The Tree table is indexed by \a lang strings. - */ -static Tree* treeForLanguage(const QString &lang) -{ - Tree* tree = trees.value(lang); - if (tree == 0) { - tree = new Tree; - trees.insert( lang, tree ); - } - return tree; -} - -/*! Print the help message to \c stdout. */ static void printHelp() -- cgit v0.12 From 0dd0313a194c73508a4fbbf69c716407b781cc6e Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 1 Dec 2010 12:04:46 +0100 Subject: Select the appropriate code marker for each file. --- tools/qdoc3/generator.cpp | 2 +- tools/qdoc3/htmlgenerator.cpp | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/tools/qdoc3/generator.cpp b/tools/qdoc3/generator.cpp index 0f2454e..1b17452 100644 --- a/tools/qdoc3/generator.cpp +++ b/tools/qdoc3/generator.cpp @@ -514,7 +514,7 @@ void Generator::generateBody(const Node *node, CodeMarker *marker) Doc::quoteFromFile(fake->doc().location(), quoter, fake->name()); QString code = quoter.quoteTo(fake->location(), "", ""); text << Atom(Atom::Code, code); - generateText(text, fake, marker); + generateText(text, fake, CodeMarker::markerForFileName(fake->name())); } } } diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 5f70de4..456654f 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -1341,8 +1341,8 @@ void HtmlGenerator::generateClassLikeNode(const InnerNode *inner, } /*! - Generate the html page for a qdoc file that doesn't map - to an underlying c++ file. + Generate the HTML page for a qdoc file that doesn't map + to an underlying C++ file. */ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) { @@ -1360,6 +1360,9 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) else if (fake->subType() == Node::QmlBasicType) { fullTitle = "QML Basic Type: " + fullTitle; htmlTitle = fullTitle; + + // Replace the marker with a QML code marker. + marker = CodeMarker::markerForLanguage(QLatin1String("QML")); } generateHeader(htmlTitle, fake, marker); @@ -1373,6 +1376,9 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) qml_cn = static_cast(fake); sections = marker->qmlSections(qml_cn,CodeMarker::Summary,0); generateTableOfContents(fake,marker,§ions); + + // Replace the marker with a QML code marker. + marker = CodeMarker::markerForLanguage(QLatin1String("QML")); } else if (fake->name() != QString("index.html")) generateTableOfContents(fake,marker,0); -- cgit v0.12 From 76152172c04a40dc9e27423ec092f23da4d628dc Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 1 Dec 2010 12:05:35 +0100 Subject: Trivial comment fix. --- tools/qdoc3/pagegenerator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/qdoc3/pagegenerator.cpp b/tools/qdoc3/pagegenerator.cpp index 60b40c9..cde4b45 100644 --- a/tools/qdoc3/pagegenerator.cpp +++ b/tools/qdoc3/pagegenerator.cpp @@ -299,7 +299,7 @@ QTextStream &PageGenerator::out() } /*! - Recursive writing of html files from the root \a node. + Recursive writing of HTML files from the root \a node. */ void PageGenerator::generateInnerNode(const InnerNode* node) -- cgit v0.12 From d877b3d3b34d4f5c6f9683c54d54e54a37a39998 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 1 Dec 2010 12:30:19 +0100 Subject: Fixed/adjusted handling of UiPublicMember nodes. Removed debugging code. --- tools/qdoc3/qmlmarkupvisitor.cpp | 202 +-------------------------------------- tools/qdoc3/qmlmarkupvisitor.h | 2 - 2 files changed, 5 insertions(+), 199 deletions(-) diff --git a/tools/qdoc3/qmlmarkupvisitor.cpp b/tools/qdoc3/qmlmarkupvisitor.cpp index 387b562..6335ab6 100644 --- a/tools/qdoc3/qmlmarkupvisitor.cpp +++ b/tools/qdoc3/qmlmarkupvisitor.cpp @@ -56,7 +56,6 @@ QmlMarkupVisitor::QmlMarkupVisitor(const QString &source, QDeclarativeJS::Engine indent = 0; cursor = 0; commentIndex = 0; - QString("Comments %1\n").arg(engine->comments().length()); } QmlMarkupVisitor::~QmlMarkupVisitor() @@ -90,7 +89,7 @@ QString QmlMarkupVisitor::protect(const QString& str) QString QmlMarkupVisitor::markedUpCode() { - if (cursor < source.length()) + if (int(cursor) < source.length()) addExtra(cursor, source.length()); return output; @@ -184,36 +183,22 @@ void QmlMarkupVisitor::addVerbatim(QDeclarativeJS::AST::SourceLocation first, return; QString text = source.mid(start, finish - start); - write(text); indent -= 1; output += protect(text); cursor = finish; } -void QmlMarkupVisitor::write(const QString &text) -{ - indent += 1; -} - -void QmlMarkupVisitor::endWrite(const QString &text) -{ - indent -= 1; -} - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiProgram *) { - write(""); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiProgram *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiImport *uiimport) { - write(""); addVerbatim(uiimport->importToken); if (!uiimport->importUri) addMarkedUpToken(uiimport->fileNameToken, QLatin1String("headerfile")); @@ -222,17 +207,14 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiImport *uiimport) void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiImport *uiimport) { - endWrite(""); addVerbatim(uiimport->versionToken); addVerbatim(uiimport->asToken); addMarkedUpToken(uiimport->importIdToken, QLatin1String("headerfile")); addVerbatim(uiimport->semicolonToken); - //endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiPublicMember *member) { - write(""); if (member->type == QDeclarativeJS::AST::UiPublicMember::Property) { addVerbatim(member->defaultToken); addVerbatim(member->readonlyToken); @@ -241,7 +223,10 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiPublicMember *member) addMarkedUpToken(member->typeToken, QLatin1String("type")); addMarkedUpToken(member->identifierToken, QLatin1String("name")); addVerbatim(member->colonToken); - QDeclarativeJS::AST::Node::accept(member->binding, this); + if (member->binding) + QDeclarativeJS::AST::Node::accept(member->binding, this); + else if (member->expression) + QDeclarativeJS::AST::Node::accept(member->expression, this); } else { addVerbatim(member->propertyToken); addVerbatim(member->typeModifierToken); @@ -255,47 +240,39 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiPublicMember *member) void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiPublicMember *member) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiSourceElement *) { - write(""); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiSourceElement *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiParameterList *) { - write(""); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiParameterList *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiObjectInitializer *initializer) { - write(""); addVerbatim(initializer->lbraceToken, initializer->lbraceToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiObjectInitializer *initializer) { - endWrite(""); addVerbatim(initializer->rbraceToken, initializer->rbraceToken); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiObjectBinding *binding) { - write(""); QDeclarativeJS::AST::Node::accept(binding->qualifiedId, this); addVerbatim(binding->colonToken); QDeclarativeJS::AST::Node::accept(binding->qualifiedTypeNameId, this); @@ -305,12 +282,10 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiObjectBinding *binding) void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiObjectBinding *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiScriptBinding *binding) { - write(""); QDeclarativeJS::AST::Node::accept(binding->qualifiedId, this); addVerbatim(binding->colonToken); QDeclarativeJS::AST::Node::accept(binding->statement, this); @@ -319,12 +294,10 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiScriptBinding *binding) void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiScriptBinding *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiArrayBinding *binding) { - write(""); QDeclarativeJS::AST::Node::accept(binding->qualifiedId, this); addVerbatim(binding->colonToken); addVerbatim(binding->lbracketToken); @@ -335,12 +308,10 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiArrayBinding *binding) void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiArrayBinding *formal) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiArrayMemberList *list) { - write(""); for (QDeclarativeJS::AST::UiArrayMemberList *it = list; it; it = it->next) { QDeclarativeJS::AST::Node::accept(it->member, this); //addVerbatim(it->commaToken); @@ -350,24 +321,20 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiArrayMemberList *list) void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiArrayMemberList *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiQualifiedId *id) { - write(""); addMarkedUpToken(id->identifierToken, QLatin1String("name")); return false; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiQualifiedId *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiSignature *signature) { - write(""); addVerbatim(signature->lparenToken); return true; } @@ -375,12 +342,10 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiSignature *signature) void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiSignature *signature) { addVerbatim(signature->rparenToken); - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiFormal *formal) { - write(""); addMarkedUpToken(formal->identifierToken, QLatin1String("name")); addVerbatim(formal->asToken); addVerbatim(formal->aliasToken); @@ -389,116 +354,98 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiFormal *formal) void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiFormal *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ThisExpression *expression) { - write(""); addVerbatim(expression->thisToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ThisExpression *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::IdentifierExpression *identifier) { - write(""); addMarkedUpToken(identifier->identifierToken, QLatin1String("name")); return false; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::IdentifierExpression *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NullExpression *null) { - write(""); addMarkedUpToken(null->nullToken, QLatin1String("number")); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::NullExpression *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::TrueLiteral *literal) { - write(""); addMarkedUpToken(literal->trueToken, QLatin1String("number")); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::TrueLiteral *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FalseLiteral *literal) { - write(""); addMarkedUpToken(literal->falseToken, QLatin1String("number")); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::FalseLiteral *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NumericLiteral *literal) { - //write(""); addMarkedUpToken(literal->literalToken, QLatin1String("number")); return false; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::NumericLiteral *) { - //endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::StringLiteral *literal) { - //write(""); addMarkedUpToken(literal->literalToken, QLatin1String("string")); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::StringLiteral *) { - //endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::RegExpLiteral *literal) { - write(""); addVerbatim(literal->literalToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::RegExpLiteral *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ArrayLiteral *literal) { - write(""); addVerbatim(literal->lbracketToken); QDeclarativeJS::AST::Node::accept(literal->elements, this); addVerbatim(literal->rbracketToken); @@ -507,13 +454,11 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ArrayLiteral *literal) void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ArrayLiteral *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ObjectLiteral *literal) { - write(""); addVerbatim(literal->lbraceToken); return true; } @@ -521,13 +466,11 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ObjectLiteral *literal) void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ObjectLiteral *literal) { addVerbatim(literal->rbraceToken); - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ElementList *list) { - write(""); for (QDeclarativeJS::AST::ElementList *it = list; it; it = it->next) { QDeclarativeJS::AST::Node::accept(it->expression, this); //addVerbatim(it->commaToken); @@ -538,58 +481,48 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ElementList *list) void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ElementList *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Elision *elision) { - write(""); addVerbatim(elision->commaToken, elision->commaToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::Elision *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::IdentifierPropertyName *) { - write(""); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::IdentifierPropertyName *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::StringLiteralPropertyName *) { - write(""); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::StringLiteralPropertyName *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NumericLiteralPropertyName *) { - write(""); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::NumericLiteralPropertyName *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::PropertyNameAndValueList *list) { - write(""); QDeclarativeJS::AST::Node::accept(list->name, this); addVerbatim(list->colonToken, list->colonToken); QDeclarativeJS::AST::Node::accept(list->value, this); @@ -599,24 +532,20 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::PropertyNameAndValueList *list void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::PropertyNameAndValueList *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NestedExpression *expression) { - write(""); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::NestedExpression *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ArrayMemberExpression *expression) { - write(""); QDeclarativeJS::AST::Node::accept(expression->base, this); addVerbatim(expression->lbracketToken); QDeclarativeJS::AST::Node::accept(expression->expression, this); @@ -626,13 +555,11 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ArrayMemberExpression *express void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ArrayMemberExpression *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FieldMemberExpression *expression) { - write(""); QDeclarativeJS::AST::Node::accept(expression->base, this); addVerbatim(expression->dotToken); addMarkedUpToken(expression->identifierToken, QLatin1String("name")); @@ -641,13 +568,11 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FieldMemberExpression *express void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::FieldMemberExpression *expression) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NewMemberExpression *expression) { - write(""); addVerbatim(expression->newToken); QDeclarativeJS::AST::Node::accept(expression->base, this); addVerbatim(expression->lparenToken); @@ -658,194 +583,164 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NewMemberExpression *expressio void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::NewMemberExpression *expression) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NewExpression *expression) { - write(""); addVerbatim(expression->newToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::NewExpression *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::CallExpression *expression) { - write(""); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::CallExpression *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ArgumentList *list) { - write(""); addVerbatim(list->commaToken, list->commaToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ArgumentList *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::PostIncrementExpression *expression) { - write(""); addVerbatim(expression->incrementToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::PostIncrementExpression *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::PostDecrementExpression *expression) { - write(""); addVerbatim(expression->decrementToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::PostDecrementExpression *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::DeleteExpression *expression) { - write(""); addVerbatim(expression->deleteToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::DeleteExpression *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::VoidExpression *expression) { - write(""); addVerbatim(expression->voidToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::VoidExpression *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::TypeOfExpression *expression) { - write(""); addVerbatim(expression->typeofToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::TypeOfExpression *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::PreIncrementExpression *expression) { - write(""); addVerbatim(expression->incrementToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::PreIncrementExpression *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::PreDecrementExpression *expression) { - write(""); addVerbatim(expression->decrementToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::PreDecrementExpression *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UnaryPlusExpression *expression) { - write(""); addVerbatim(expression->plusToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UnaryPlusExpression *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UnaryMinusExpression *expression) { - write(""); addVerbatim(expression->minusToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UnaryMinusExpression *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::TildeExpression *expression) { - write(""); addVerbatim(expression->tildeToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::TildeExpression *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NotExpression *expression) { - write(""); addVerbatim(expression->notToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::NotExpression *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::BinaryExpression *expression) { - write(""); QDeclarativeJS::AST::Node::accept(expression->left, this); addMarkedUpToken(expression->operatorToken, QLatin1String("op")); QDeclarativeJS::AST::Node::accept(expression->right, this); @@ -854,25 +749,21 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::BinaryExpression *expression) void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::BinaryExpression *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ConditionalExpression *expression) { - write(""); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ConditionalExpression *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Expression *expression) { - write(""); QDeclarativeJS::AST::Node::accept(expression->left, this); addVerbatim(expression->commaToken); QDeclarativeJS::AST::Node::accept(expression->right, this); @@ -881,12 +772,10 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Expression *expression) void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::Expression *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Block *block) { - write(""); addVerbatim(block->lbraceToken); return true; } @@ -894,23 +783,19 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Block *block) void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::Block *block) { addVerbatim(block->rbraceToken); - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::StatementList *) { - write(""); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::StatementList *) { - endWrite(""); addVerbatim(statement->declarationKindToken); QDeclarativeJS::AST::Node::accept(statement->declarations, this); addVerbatim(statement->semicolonToken); @@ -919,13 +804,11 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::VariableStatement *statement) void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::VariableStatement *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::VariableDeclarationList *list) { - write(""); for (QDeclarativeJS::AST::VariableDeclarationList *it = list; it; it = it->next) { QDeclarativeJS::AST::Node::accept(it->declaration, this); addVerbatim(it->commaToken); @@ -935,12 +818,10 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::VariableDeclarationList *list) void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::VariableDeclarationList *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::VariableDeclaration *declaration) { - write(""); addMarkedUpToken(declaration->identifierToken, QLatin1String("name")); QDeclarativeJS::AST::Node::accept(declaration->expression, this); return false; @@ -948,39 +829,33 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::VariableDeclaration *declarati void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::VariableDeclaration *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::EmptyStatement *statement) { - write(""); addVerbatim(statement->semicolonToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::EmptyStatement *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ExpressionStatement *) { - write(""); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ExpressionStatement *statement) { addVerbatim(statement->semicolonToken); - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::IfStatement *statement) { - write(""); addMarkedUpToken(statement->ifToken, QLatin1String("keyword")); addVerbatim(statement->lparenToken); QDeclarativeJS::AST::Node::accept(statement->expression, this); @@ -995,13 +870,11 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::IfStatement *statement) void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::IfStatement *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::DoWhileStatement *statement) { - write(""); addMarkedUpToken(statement->doToken, QLatin1String("keyword")); QDeclarativeJS::AST::Node::accept(statement->statement, this); addMarkedUpToken(statement->whileToken, QLatin1String("keyword")); @@ -1014,25 +887,21 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::DoWhileStatement *statement) void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::DoWhileStatement *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::WhileStatement *statement) { - write(""); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::WhileStatement *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ForStatement *statement) { - write(""); addMarkedUpToken(statement->forToken, QLatin1String("keyword")); addVerbatim(statement->lparenToken); QDeclarativeJS::AST::Node::accept(statement->initialiser, this); @@ -1047,13 +916,11 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ForStatement *statement) void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ForStatement *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::LocalForStatement *statement) { - write(""); addMarkedUpToken(statement->forToken, QLatin1String("keyword")); addVerbatim(statement->lparenToken); addMarkedUpToken(statement->varToken, QLatin1String("keyword")); @@ -1069,13 +936,11 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::LocalForStatement *statement) void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::LocalForStatement *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ForEachStatement *statement) { - write(""); addMarkedUpToken(statement->forToken, QLatin1String("keyword")); addVerbatim(statement->lparenToken); QDeclarativeJS::AST::Node::accept(statement->initialiser, this); @@ -1088,13 +953,11 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ForEachStatement *statement) void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ForEachStatement *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::LocalForEachStatement *statement) { - write(""); addMarkedUpToken(statement->forToken, QLatin1String("keyword")); addVerbatim(statement->lparenToken); addMarkedUpToken(statement->varToken, QLatin1String("keyword")); @@ -1108,13 +971,11 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::LocalForEachStatement *stateme void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::LocalForEachStatement *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ContinueStatement *statement) { - write(""); addMarkedUpToken(statement->continueToken, QLatin1String("keyword")); addMarkedUpToken(statement->identifierToken, QLatin1String("name")); addVerbatim(statement->semicolonToken); @@ -1123,13 +984,11 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ContinueStatement *statement) void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ContinueStatement *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::BreakStatement *statement) { - write(""); addMarkedUpToken(statement->breakToken, QLatin1String("keyword")); addMarkedUpToken(statement->identifierToken, QLatin1String("name")); addVerbatim(statement->semicolonToken); @@ -1138,13 +997,11 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::BreakStatement *statement) void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::BreakStatement *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ReturnStatement *statement) { - write(""); addMarkedUpToken(statement->returnToken, QLatin1String("keyword")); return true; } @@ -1152,13 +1009,11 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ReturnStatement *statement) void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ReturnStatement *statement) { addVerbatim(statement->semicolonToken); - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::WithStatement *statement) { - write(""); addMarkedUpToken(statement->withToken, QLatin1String("keyword")); addVerbatim(statement->lparenToken); addVerbatim(statement->rparenToken); @@ -1167,27 +1022,23 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::WithStatement *statement) void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::WithStatement *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::CaseBlock *block) { - write(""); addVerbatim(block->lbraceToken); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::CaseBlock *block) { - endWrite(""); addVerbatim(block->rbraceToken, block->rbraceToken); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::SwitchStatement *statement) { - write(""); addMarkedUpToken(statement->switchToken, QLatin1String("keyword")); addVerbatim(statement->lparenToken); QDeclarativeJS::AST::Node::accept(statement->expression, this); @@ -1198,23 +1049,19 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::SwitchStatement *statement) void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::SwitchStatement *statement) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::CaseClauses *) { - write(""); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::CaseClauses *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::CaseClause *clause) { - write(""); addMarkedUpToken(clause->caseToken, QLatin1String("keyword")); QDeclarativeJS::AST::Node::accept(clause->expression, this); addVerbatim(clause->colonToken); @@ -1224,13 +1071,11 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::CaseClause *clause) void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::CaseClause *clause) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::DefaultClause *clause) { - write(""); addMarkedUpToken(clause->defaultToken, QLatin1String("keyword")); addVerbatim(clause->colonToken, clause->colonToken); return true; @@ -1238,13 +1083,11 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::DefaultClause *clause) void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::DefaultClause *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::LabelledStatement *statement) { - write(""); addMarkedUpToken(statement->identifierToken, QLatin1String("name")); addVerbatim(statement->colonToken); QDeclarativeJS::AST::Node::accept(statement->statement, this); @@ -1253,13 +1096,11 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::LabelledStatement *statement) void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::LabelledStatement *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ThrowStatement *statement) { - write(""); addMarkedUpToken(statement->throwToken, QLatin1String("keyword")); QDeclarativeJS::AST::Node::accept(statement->expression, this); addVerbatim(statement->semicolonToken); @@ -1268,13 +1109,11 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ThrowStatement *statement) void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ThrowStatement *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Catch *c) { - write(""); addMarkedUpToken(c->catchToken, QLatin1String("keyword")); addVerbatim(c->lparenToken); addMarkedUpToken(c->identifierToken, QLatin1String("name")); @@ -1284,13 +1123,11 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Catch *c) void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::Catch *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Finally *f) { - write(""); addMarkedUpToken(f->finallyToken, QLatin1String("keyword")); QDeclarativeJS::AST::Node::accept(f->statement, this); return false; @@ -1298,13 +1135,11 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Finally *f) void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::Finally *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::TryStatement *statement) { - write(""); addMarkedUpToken(statement->tryToken, QLatin1String("keyword")); QDeclarativeJS::AST::Node::accept(statement->statement, this); QDeclarativeJS::AST::Node::accept(statement->catchExpression, this); @@ -1314,13 +1149,11 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::TryStatement *statement) void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::TryStatement *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FunctionExpression *expression) { - write(""); addMarkedUpToken(expression->functionToken, QLatin1String("keyword")); addMarkedUpToken(expression->identifierToken, QLatin1String("name")); addVerbatim(expression->lparenToken); @@ -1334,12 +1167,10 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FunctionExpression *expression void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::FunctionExpression *expression) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FunctionDeclaration *declaration) { - write(""); addMarkedUpToken(declaration->functionToken, QLatin1String("keyword")); addMarkedUpToken(declaration->identifierToken, QLatin1String("name")); addVerbatim(declaration->lparenToken); @@ -1353,12 +1184,10 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FunctionDeclaration *declarati void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::FunctionDeclaration *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FormalParameterList *list) { - write(""); addVerbatim(list->commaToken); addMarkedUpToken(list->identifierToken, QLatin1String("name")); return false; @@ -1366,23 +1195,19 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FormalParameterList *list) void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::FormalParameterList *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FunctionBody *body) { - write(""); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::FunctionBody *body) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::DebuggerStatement *statement) { - write(""); addVerbatim(statement->debuggerToken); addVerbatim(statement->semicolonToken); return true; @@ -1390,34 +1215,28 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::DebuggerStatement *statement) void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::DebuggerStatement *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FunctionSourceElement *) { - write(""); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::FunctionSourceElement *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::StatementSourceElement *) { - write(""); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::StatementSourceElement *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiObjectDefinition *definition) { - write(""); QDeclarativeJS::AST::Node::accept(definition->qualifiedTypeNameId, this); QDeclarativeJS::AST::Node::accept(definition->initializer, this); return false; @@ -1425,62 +1244,51 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiObjectDefinition *definition void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiObjectDefinition *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiImportList *) { - write(""); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiImportList *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiObjectMemberList *) { - write(""); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiObjectMemberList *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiFormalList *) { - write(""); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiFormalList *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Program *) { - write(""); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::Program *) { - endWrite(""); } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::SourceElements *) { - write(""); return true; } void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::SourceElements *) { - endWrite(""); } QT_END_NAMESPACE diff --git a/tools/qdoc3/qmlmarkupvisitor.h b/tools/qdoc3/qmlmarkupvisitor.h index 01b0acf..8177798 100644 --- a/tools/qdoc3/qmlmarkupvisitor.h +++ b/tools/qdoc3/qmlmarkupvisitor.h @@ -327,8 +327,6 @@ private: void addVerbatim(QDeclarativeJS::AST::SourceLocation first, QDeclarativeJS::AST::SourceLocation last = QDeclarativeJS::AST::SourceLocation()); QString sourceText(QDeclarativeJS::AST::SourceLocation &location); - void write(const QString &text); - void endWrite(const QString &text); QDeclarativeJS::Engine *engine; QString source; -- cgit v0.12 From ff9b210719da21a6724bad51e908f9754c7fa172 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 1 Dec 2010 18:15:46 +0100 Subject: Updated handling of some statement nodes, removed unnecessary functions. --- tools/qdoc3/qmlmarkupvisitor.cpp | 512 ++------------------------------------- tools/qdoc3/qmlmarkupvisitor.h | 185 +------------- 2 files changed, 28 insertions(+), 669 deletions(-) diff --git a/tools/qdoc3/qmlmarkupvisitor.cpp b/tools/qdoc3/qmlmarkupvisitor.cpp index 6335ab6..907b95d 100644 --- a/tools/qdoc3/qmlmarkupvisitor.cpp +++ b/tools/qdoc3/qmlmarkupvisitor.cpp @@ -53,7 +53,6 @@ QmlMarkupVisitor::QmlMarkupVisitor(const QString &source, QDeclarativeJS::Engine { this->source = source; this->engine = engine; - indent = 0; cursor = 0; commentIndex = 0; } @@ -183,20 +182,10 @@ void QmlMarkupVisitor::addVerbatim(QDeclarativeJS::AST::SourceLocation first, return; QString text = source.mid(start, finish - start); - indent -= 1; output += protect(text); cursor = finish; } -bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiProgram *) -{ - return true; -} - -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiProgram *) -{ -} - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiImport *uiimport) { addVerbatim(uiimport->importToken); @@ -238,28 +227,6 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiPublicMember *member) return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiPublicMember *member) -{ -} - -bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiSourceElement *) -{ - return true; -} - -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiSourceElement *) -{ -} - -bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiParameterList *) -{ - return true; -} - -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiParameterList *) -{ -} - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiObjectInitializer *initializer) { addVerbatim(initializer->lbraceToken, initializer->lbraceToken); @@ -280,10 +247,6 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiObjectBinding *binding) return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiObjectBinding *) -{ -} - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiScriptBinding *binding) { QDeclarativeJS::AST::Node::accept(binding->qualifiedId, this); @@ -292,10 +255,6 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiScriptBinding *binding) return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiScriptBinding *) -{ -} - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiArrayBinding *binding) { QDeclarativeJS::AST::Node::accept(binding->qualifiedId, this); @@ -306,10 +265,6 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiArrayBinding *binding) return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiArrayBinding *formal) -{ -} - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiArrayMemberList *list) { for (QDeclarativeJS::AST::UiArrayMemberList *it = list; it; it = it->next) { @@ -319,20 +274,12 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiArrayMemberList *list) return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiArrayMemberList *) -{ -} - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiQualifiedId *id) { addMarkedUpToken(id->identifierToken, QLatin1String("name")); return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiQualifiedId *) -{ -} - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiSignature *signature) { addVerbatim(signature->lparenToken); @@ -352,98 +299,54 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiFormal *formal) return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiFormal *) -{ -} - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ThisExpression *expression) { addVerbatim(expression->thisToken); return true; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ThisExpression *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::IdentifierExpression *identifier) { addMarkedUpToken(identifier->identifierToken, QLatin1String("name")); return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::IdentifierExpression *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NullExpression *null) { addMarkedUpToken(null->nullToken, QLatin1String("number")); return true; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::NullExpression *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::TrueLiteral *literal) { addMarkedUpToken(literal->trueToken, QLatin1String("number")); return true; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::TrueLiteral *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FalseLiteral *literal) { addMarkedUpToken(literal->falseToken, QLatin1String("number")); return true; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::FalseLiteral *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NumericLiteral *literal) { addMarkedUpToken(literal->literalToken, QLatin1String("number")); return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::NumericLiteral *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::StringLiteral *literal) { addMarkedUpToken(literal->literalToken, QLatin1String("string")); return true; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::StringLiteral *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::RegExpLiteral *literal) { addVerbatim(literal->literalToken); return true; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::RegExpLiteral *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ArrayLiteral *literal) { addVerbatim(literal->lbracketToken); @@ -452,11 +355,6 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ArrayLiteral *literal) return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ArrayLiteral *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ObjectLiteral *literal) { addVerbatim(literal->lbraceToken); @@ -479,48 +377,12 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ElementList *list) return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ElementList *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Elision *elision) { addVerbatim(elision->commaToken, elision->commaToken); return true; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::Elision *) -{ -} - -bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::IdentifierPropertyName *) -{ - return true; -} - -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::IdentifierPropertyName *) -{ -} - -bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::StringLiteralPropertyName *) -{ - return true; -} - -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::StringLiteralPropertyName *) -{ -} - -bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NumericLiteralPropertyName *) -{ - return true; -} - -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::NumericLiteralPropertyName *) -{ -} - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::PropertyNameAndValueList *list) { QDeclarativeJS::AST::Node::accept(list->name, this); @@ -530,20 +392,6 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::PropertyNameAndValueList *list return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::PropertyNameAndValueList *) -{ -} - -bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NestedExpression *expression) -{ - return true; -} - -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::NestedExpression *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ArrayMemberExpression *expression) { QDeclarativeJS::AST::Node::accept(expression->base, this); @@ -553,11 +401,6 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ArrayMemberExpression *express return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ArrayMemberExpression *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FieldMemberExpression *expression) { QDeclarativeJS::AST::Node::accept(expression->base, this); @@ -566,11 +409,6 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FieldMemberExpression *express return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::FieldMemberExpression *expression) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NewMemberExpression *expression) { addVerbatim(expression->newToken); @@ -581,164 +419,84 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NewMemberExpression *expressio return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::NewMemberExpression *expression) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NewExpression *expression) { addVerbatim(expression->newToken); return true; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::NewExpression *) -{ -} - - -bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::CallExpression *expression) -{ - return true; -} - -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::CallExpression *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ArgumentList *list) { addVerbatim(list->commaToken, list->commaToken); return true; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ArgumentList *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::PostIncrementExpression *expression) { addVerbatim(expression->incrementToken); return true; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::PostIncrementExpression *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::PostDecrementExpression *expression) { addVerbatim(expression->decrementToken); return true; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::PostDecrementExpression *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::DeleteExpression *expression) { addVerbatim(expression->deleteToken); return true; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::DeleteExpression *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::VoidExpression *expression) { addVerbatim(expression->voidToken); return true; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::VoidExpression *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::TypeOfExpression *expression) { addVerbatim(expression->typeofToken); return true; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::TypeOfExpression *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::PreIncrementExpression *expression) { addVerbatim(expression->incrementToken); return true; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::PreIncrementExpression *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::PreDecrementExpression *expression) { addVerbatim(expression->decrementToken); return true; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::PreDecrementExpression *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UnaryPlusExpression *expression) { addVerbatim(expression->plusToken); return true; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UnaryPlusExpression *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UnaryMinusExpression *expression) { addVerbatim(expression->minusToken); return true; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UnaryMinusExpression *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::TildeExpression *expression) { addVerbatim(expression->tildeToken); return true; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::TildeExpression *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::NotExpression *expression) { addVerbatim(expression->notToken); return true; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::NotExpression *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::BinaryExpression *expression) { QDeclarativeJS::AST::Node::accept(expression->left, this); @@ -747,31 +505,22 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::BinaryExpression *expression) return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::BinaryExpression *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ConditionalExpression *expression) { - return true; -} - -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ConditionalExpression *) -{ + QDeclarativeJS::AST::Node::accept(expression->expression, this); + addVerbatim(expression->questionToken); + QDeclarativeJS::AST::Node::accept(expression->ok, this); + addVerbatim(expression->colonToken); + QDeclarativeJS::AST::Node::accept(expression->ko, this); + return false; } - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Expression *expression) { QDeclarativeJS::AST::Node::accept(expression->left, this); addVerbatim(expression->commaToken); QDeclarativeJS::AST::Node::accept(expression->right, this); - return true; -} - -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::Expression *) -{ + return false; } bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Block *block) @@ -785,15 +534,6 @@ void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::Block *block) addVerbatim(block->rbraceToken); } -bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::StatementList *) -{ - return true; -} - -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::StatementList *) -{ -} - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::VariableStatement *statement) { addVerbatim(statement->declarationKindToken); @@ -802,11 +542,6 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::VariableStatement *statement) return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::VariableStatement *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::VariableDeclarationList *list) { for (QDeclarativeJS::AST::VariableDeclarationList *it = list; it; it = it->next) { @@ -816,10 +551,6 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::VariableDeclarationList *list) return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::VariableDeclarationList *) -{ -} - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::VariableDeclaration *declaration) { addMarkedUpToken(declaration->identifierToken, QLatin1String("name")); @@ -827,33 +558,19 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::VariableDeclaration *declarati return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::VariableDeclaration *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::EmptyStatement *statement) { addVerbatim(statement->semicolonToken); return true; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::EmptyStatement *) -{ -} - - -bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ExpressionStatement *) -{ - return true; -} - -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ExpressionStatement *statement) +bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ExpressionStatement *statement) { + QDeclarativeJS::AST::Node::accept(statement->expression, this); addVerbatim(statement->semicolonToken); + return false; } - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::IfStatement *statement) { addMarkedUpToken(statement->ifToken, QLatin1String("keyword")); @@ -868,11 +585,6 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::IfStatement *statement) return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::IfStatement *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::DoWhileStatement *statement) { addMarkedUpToken(statement->doToken, QLatin1String("keyword")); @@ -885,21 +597,16 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::DoWhileStatement *statement) return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::DoWhileStatement *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::WhileStatement *statement) { - return true; -} - -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::WhileStatement *) -{ + addMarkedUpToken(statement->whileToken, QLatin1String("keyword")); + addVerbatim(statement->lparenToken); + QDeclarativeJS::AST::Node::accept(statement->expression, this); + addVerbatim(statement->rparenToken); + QDeclarativeJS::AST::Node::accept(statement->statement, this); + return false; } - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ForStatement *statement) { addMarkedUpToken(statement->forToken, QLatin1String("keyword")); @@ -914,11 +621,6 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ForStatement *statement) return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ForStatement *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::LocalForStatement *statement) { addMarkedUpToken(statement->forToken, QLatin1String("keyword")); @@ -934,11 +636,6 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::LocalForStatement *statement) return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::LocalForStatement *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ForEachStatement *statement) { addMarkedUpToken(statement->forToken, QLatin1String("keyword")); @@ -951,11 +648,6 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ForEachStatement *statement) return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ForEachStatement *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::LocalForEachStatement *statement) { addMarkedUpToken(statement->forToken, QLatin1String("keyword")); @@ -969,11 +661,6 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::LocalForEachStatement *stateme return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::LocalForEachStatement *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ContinueStatement *statement) { addMarkedUpToken(statement->continueToken, QLatin1String("keyword")); @@ -982,11 +669,6 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ContinueStatement *statement) return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ContinueStatement *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::BreakStatement *statement) { addMarkedUpToken(statement->breakToken, QLatin1String("keyword")); @@ -995,36 +677,24 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::BreakStatement *statement) return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::BreakStatement *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ReturnStatement *statement) { addMarkedUpToken(statement->returnToken, QLatin1String("keyword")); - return true; -} - -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ReturnStatement *statement) -{ + QDeclarativeJS::AST::Node::accept(statement->expression, this); addVerbatim(statement->semicolonToken); + return false; } - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::WithStatement *statement) { addMarkedUpToken(statement->withToken, QLatin1String("keyword")); addVerbatim(statement->lparenToken); + QDeclarativeJS::AST::Node::accept(statement->expression, this); addVerbatim(statement->rparenToken); - return true; -} - -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::WithStatement *) -{ + QDeclarativeJS::AST::Node::accept(statement->statement, this); + return false; } - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::CaseBlock *block) { addVerbatim(block->lbraceToken); @@ -1047,19 +717,6 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::SwitchStatement *statement) return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::SwitchStatement *statement) -{ -} - -bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::CaseClauses *) -{ - return true; -} - -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::CaseClauses *) -{ -} - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::CaseClause *clause) { addMarkedUpToken(clause->caseToken, QLatin1String("keyword")); @@ -1069,11 +726,6 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::CaseClause *clause) return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::CaseClause *clause) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::DefaultClause *clause) { addMarkedUpToken(clause->defaultToken, QLatin1String("keyword")); @@ -1081,11 +733,6 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::DefaultClause *clause) return true; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::DefaultClause *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::LabelledStatement *statement) { addMarkedUpToken(statement->identifierToken, QLatin1String("name")); @@ -1094,11 +741,6 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::LabelledStatement *statement) return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::LabelledStatement *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ThrowStatement *statement) { addMarkedUpToken(statement->throwToken, QLatin1String("keyword")); @@ -1107,11 +749,6 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::ThrowStatement *statement) return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::ThrowStatement *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Catch *c) { addMarkedUpToken(c->catchToken, QLatin1String("keyword")); @@ -1121,11 +758,6 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Catch *c) return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::Catch *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Finally *f) { addMarkedUpToken(f->finallyToken, QLatin1String("keyword")); @@ -1133,11 +765,6 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Finally *f) return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::Finally *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::TryStatement *statement) { addMarkedUpToken(statement->tryToken, QLatin1String("keyword")); @@ -1147,11 +774,6 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::TryStatement *statement) return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::TryStatement *) -{ -} - - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FunctionExpression *expression) { addMarkedUpToken(expression->functionToken, QLatin1String("keyword")); @@ -1165,10 +787,6 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FunctionExpression *expression return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::FunctionExpression *expression) -{ -} - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FunctionDeclaration *declaration) { addMarkedUpToken(declaration->functionToken, QLatin1String("keyword")); @@ -1182,10 +800,6 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FunctionDeclaration *declarati return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::FunctionDeclaration *) -{ -} - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FormalParameterList *list) { addVerbatim(list->commaToken); @@ -1193,19 +807,6 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FormalParameterList *list) return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::FormalParameterList *) -{ -} - -bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FunctionBody *body) -{ - return true; -} - -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::FunctionBody *body) -{ -} - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::DebuggerStatement *statement) { addVerbatim(statement->debuggerToken); @@ -1213,28 +814,6 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::DebuggerStatement *statement) return true; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::DebuggerStatement *) -{ -} - -bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::FunctionSourceElement *) -{ - return true; -} - -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::FunctionSourceElement *) -{ -} - -bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::StatementSourceElement *) -{ - return true; -} - -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::StatementSourceElement *) -{ -} - bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiObjectDefinition *definition) { QDeclarativeJS::AST::Node::accept(definition->qualifiedTypeNameId, this); @@ -1242,53 +821,4 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiObjectDefinition *definition return false; } -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiObjectDefinition *) -{ -} - -bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiImportList *) -{ - return true; -} - -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiImportList *) -{ -} - -bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiObjectMemberList *) -{ - return true; -} - -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiObjectMemberList *) -{ -} - -bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiFormalList *) -{ - return true; -} - -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::UiFormalList *) -{ -} - -bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::Program *) -{ - return true; -} - -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::Program *) -{ -} - -bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::SourceElements *) -{ - return true; -} - -void QmlMarkupVisitor::endVisit(QDeclarativeJS::AST::SourceElements *) -{ -} - QT_END_NAMESPACE diff --git a/tools/qdoc3/qmlmarkupvisitor.h b/tools/qdoc3/qmlmarkupvisitor.h index 8177798..35f1b5bc 100644 --- a/tools/qdoc3/qmlmarkupvisitor.h +++ b/tools/qdoc3/qmlmarkupvisitor.h @@ -57,265 +57,96 @@ public: QString markedUpCode(); - virtual bool visit(QDeclarativeJS::AST::UiProgram *); - virtual bool visit(QDeclarativeJS::AST::UiImportList *); virtual bool visit(QDeclarativeJS::AST::UiImport *); + virtual void endVisit(QDeclarativeJS::AST::UiImport *); + virtual bool visit(QDeclarativeJS::AST::UiPublicMember *); - virtual bool visit(QDeclarativeJS::AST::UiSourceElement *); virtual bool visit(QDeclarativeJS::AST::UiObjectDefinition *); + virtual bool visit(QDeclarativeJS::AST::UiObjectInitializer *); + virtual void endVisit(QDeclarativeJS::AST::UiObjectInitializer *); + virtual bool visit(QDeclarativeJS::AST::UiObjectBinding *); virtual bool visit(QDeclarativeJS::AST::UiScriptBinding *); virtual bool visit(QDeclarativeJS::AST::UiArrayBinding *); - virtual bool visit(QDeclarativeJS::AST::UiObjectMemberList *); virtual bool visit(QDeclarativeJS::AST::UiArrayMemberList *); virtual bool visit(QDeclarativeJS::AST::UiQualifiedId *); - virtual bool visit(QDeclarativeJS::AST::UiSignature *); - virtual bool visit(QDeclarativeJS::AST::UiFormalList *); - virtual bool visit(QDeclarativeJS::AST::UiFormal *); - virtual void endVisit(QDeclarativeJS::AST::UiProgram *); - virtual void endVisit(QDeclarativeJS::AST::UiImportList *); - virtual void endVisit(QDeclarativeJS::AST::UiImport *); - virtual void endVisit(QDeclarativeJS::AST::UiPublicMember *); - virtual void endVisit(QDeclarativeJS::AST::UiSourceElement *); - virtual void endVisit(QDeclarativeJS::AST::UiObjectDefinition *); - virtual void endVisit(QDeclarativeJS::AST::UiObjectInitializer *); - virtual void endVisit(QDeclarativeJS::AST::UiObjectBinding *); - virtual void endVisit(QDeclarativeJS::AST::UiScriptBinding *); - virtual void endVisit(QDeclarativeJS::AST::UiArrayBinding *); - virtual void endVisit(QDeclarativeJS::AST::UiObjectMemberList *); - virtual void endVisit(QDeclarativeJS::AST::UiArrayMemberList *); - virtual void endVisit(QDeclarativeJS::AST::UiQualifiedId *); + virtual bool visit(QDeclarativeJS::AST::UiSignature *); virtual void endVisit(QDeclarativeJS::AST::UiSignature *); - virtual void endVisit(QDeclarativeJS::AST::UiFormalList *); - virtual void endVisit(QDeclarativeJS::AST::UiFormal *); - // QDeclarativeJS + virtual bool visit(QDeclarativeJS::AST::UiFormal *); virtual bool visit(QDeclarativeJS::AST::ThisExpression *); - virtual void endVisit(QDeclarativeJS::AST::ThisExpression *); - virtual bool visit(QDeclarativeJS::AST::IdentifierExpression *); - virtual void endVisit(QDeclarativeJS::AST::IdentifierExpression *); - virtual bool visit(QDeclarativeJS::AST::NullExpression *); - virtual void endVisit(QDeclarativeJS::AST::NullExpression *); - virtual bool visit(QDeclarativeJS::AST::TrueLiteral *); - virtual void endVisit(QDeclarativeJS::AST::TrueLiteral *); - virtual bool visit(QDeclarativeJS::AST::FalseLiteral *); - virtual void endVisit(QDeclarativeJS::AST::FalseLiteral *); - virtual bool visit(QDeclarativeJS::AST::NumericLiteral *); - virtual void endVisit(QDeclarativeJS::AST::NumericLiteral *); - virtual bool visit(QDeclarativeJS::AST::StringLiteral *); - virtual void endVisit(QDeclarativeJS::AST::StringLiteral *); - virtual bool visit(QDeclarativeJS::AST::RegExpLiteral *); - virtual void endVisit(QDeclarativeJS::AST::RegExpLiteral *); - virtual bool visit(QDeclarativeJS::AST::ArrayLiteral *); - virtual void endVisit(QDeclarativeJS::AST::ArrayLiteral *); virtual bool visit(QDeclarativeJS::AST::ObjectLiteral *); virtual void endVisit(QDeclarativeJS::AST::ObjectLiteral *); virtual bool visit(QDeclarativeJS::AST::ElementList *); - virtual void endVisit(QDeclarativeJS::AST::ElementList *); - virtual bool visit(QDeclarativeJS::AST::Elision *); - virtual void endVisit(QDeclarativeJS::AST::Elision *); - virtual bool visit(QDeclarativeJS::AST::PropertyNameAndValueList *); - virtual void endVisit(QDeclarativeJS::AST::PropertyNameAndValueList *); - - virtual bool visit(QDeclarativeJS::AST::NestedExpression *); - virtual void endVisit(QDeclarativeJS::AST::NestedExpression *); - - virtual bool visit(QDeclarativeJS::AST::IdentifierPropertyName *); - virtual void endVisit(QDeclarativeJS::AST::IdentifierPropertyName *); - - virtual bool visit(QDeclarativeJS::AST::StringLiteralPropertyName *); - virtual void endVisit(QDeclarativeJS::AST::StringLiteralPropertyName *); - - virtual bool visit(QDeclarativeJS::AST::NumericLiteralPropertyName *); - virtual void endVisit(QDeclarativeJS::AST::NumericLiteralPropertyName *); - virtual bool visit(QDeclarativeJS::AST::ArrayMemberExpression *); - virtual void endVisit(QDeclarativeJS::AST::ArrayMemberExpression *); - virtual bool visit(QDeclarativeJS::AST::FieldMemberExpression *); - virtual void endVisit(QDeclarativeJS::AST::FieldMemberExpression *); - virtual bool visit(QDeclarativeJS::AST::NewMemberExpression *); - virtual void endVisit(QDeclarativeJS::AST::NewMemberExpression *); - virtual bool visit(QDeclarativeJS::AST::NewExpression *); - virtual void endVisit(QDeclarativeJS::AST::NewExpression *); - - virtual bool visit(QDeclarativeJS::AST::CallExpression *); - virtual void endVisit(QDeclarativeJS::AST::CallExpression *); - virtual bool visit(QDeclarativeJS::AST::ArgumentList *); - virtual void endVisit(QDeclarativeJS::AST::ArgumentList *); - virtual bool visit(QDeclarativeJS::AST::PostIncrementExpression *); - virtual void endVisit(QDeclarativeJS::AST::PostIncrementExpression *); - virtual bool visit(QDeclarativeJS::AST::PostDecrementExpression *); - virtual void endVisit(QDeclarativeJS::AST::PostDecrementExpression *); - virtual bool visit(QDeclarativeJS::AST::DeleteExpression *); - virtual void endVisit(QDeclarativeJS::AST::DeleteExpression *); - virtual bool visit(QDeclarativeJS::AST::VoidExpression *); - virtual void endVisit(QDeclarativeJS::AST::VoidExpression *); - virtual bool visit(QDeclarativeJS::AST::TypeOfExpression *); - virtual void endVisit(QDeclarativeJS::AST::TypeOfExpression *); - virtual bool visit(QDeclarativeJS::AST::PreIncrementExpression *); - virtual void endVisit(QDeclarativeJS::AST::PreIncrementExpression *); - virtual bool visit(QDeclarativeJS::AST::PreDecrementExpression *); - virtual void endVisit(QDeclarativeJS::AST::PreDecrementExpression *); - virtual bool visit(QDeclarativeJS::AST::UnaryPlusExpression *); - virtual void endVisit(QDeclarativeJS::AST::UnaryPlusExpression *); - virtual bool visit(QDeclarativeJS::AST::UnaryMinusExpression *); - virtual void endVisit(QDeclarativeJS::AST::UnaryMinusExpression *); - virtual bool visit(QDeclarativeJS::AST::TildeExpression *); - virtual void endVisit(QDeclarativeJS::AST::TildeExpression *); - virtual bool visit(QDeclarativeJS::AST::NotExpression *); - virtual void endVisit(QDeclarativeJS::AST::NotExpression *); - virtual bool visit(QDeclarativeJS::AST::BinaryExpression *); - virtual void endVisit(QDeclarativeJS::AST::BinaryExpression *); - virtual bool visit(QDeclarativeJS::AST::ConditionalExpression *); - virtual void endVisit(QDeclarativeJS::AST::ConditionalExpression *); - virtual bool visit(QDeclarativeJS::AST::Expression *); - virtual void endVisit(QDeclarativeJS::AST::Expression *); virtual bool visit(QDeclarativeJS::AST::Block *); virtual void endVisit(QDeclarativeJS::AST::Block *); - virtual bool visit(QDeclarativeJS::AST::StatementList *); - virtual void endVisit(QDeclarativeJS::AST::StatementList *); - virtual bool visit(QDeclarativeJS::AST::VariableStatement *); - virtual void endVisit(QDeclarativeJS::AST::VariableStatement *); - virtual bool visit(QDeclarativeJS::AST::VariableDeclarationList *); - virtual void endVisit(QDeclarativeJS::AST::VariableDeclarationList *); - virtual bool visit(QDeclarativeJS::AST::VariableDeclaration *); - virtual void endVisit(QDeclarativeJS::AST::VariableDeclaration *); - virtual bool visit(QDeclarativeJS::AST::EmptyStatement *); - virtual void endVisit(QDeclarativeJS::AST::EmptyStatement *); - virtual bool visit(QDeclarativeJS::AST::ExpressionStatement *); - virtual void endVisit(QDeclarativeJS::AST::ExpressionStatement *); - virtual bool visit(QDeclarativeJS::AST::IfStatement *); - virtual void endVisit(QDeclarativeJS::AST::IfStatement *); - virtual bool visit(QDeclarativeJS::AST::DoWhileStatement *); - virtual void endVisit(QDeclarativeJS::AST::DoWhileStatement *); - virtual bool visit(QDeclarativeJS::AST::WhileStatement *); - virtual void endVisit(QDeclarativeJS::AST::WhileStatement *); - virtual bool visit(QDeclarativeJS::AST::ForStatement *); - virtual void endVisit(QDeclarativeJS::AST::ForStatement *); - virtual bool visit(QDeclarativeJS::AST::LocalForStatement *); - virtual void endVisit(QDeclarativeJS::AST::LocalForStatement *); - virtual bool visit(QDeclarativeJS::AST::ForEachStatement *); - virtual void endVisit(QDeclarativeJS::AST::ForEachStatement *); - virtual bool visit(QDeclarativeJS::AST::LocalForEachStatement *); - virtual void endVisit(QDeclarativeJS::AST::LocalForEachStatement *); - virtual bool visit(QDeclarativeJS::AST::ContinueStatement *); - virtual void endVisit(QDeclarativeJS::AST::ContinueStatement *); - virtual bool visit(QDeclarativeJS::AST::BreakStatement *); - virtual void endVisit(QDeclarativeJS::AST::BreakStatement *); - virtual bool visit(QDeclarativeJS::AST::ReturnStatement *); - virtual void endVisit(QDeclarativeJS::AST::ReturnStatement *); - virtual bool visit(QDeclarativeJS::AST::WithStatement *); - virtual void endVisit(QDeclarativeJS::AST::WithStatement *); virtual bool visit(QDeclarativeJS::AST::CaseBlock *); virtual void endVisit(QDeclarativeJS::AST::CaseBlock *); virtual bool visit(QDeclarativeJS::AST::SwitchStatement *); - virtual void endVisit(QDeclarativeJS::AST::SwitchStatement *); - - virtual bool visit(QDeclarativeJS::AST::CaseClauses *); - virtual void endVisit(QDeclarativeJS::AST::CaseClauses *); - virtual bool visit(QDeclarativeJS::AST::CaseClause *); - virtual void endVisit(QDeclarativeJS::AST::CaseClause *); - virtual bool visit(QDeclarativeJS::AST::DefaultClause *); - virtual void endVisit(QDeclarativeJS::AST::DefaultClause *); - virtual bool visit(QDeclarativeJS::AST::LabelledStatement *); - virtual void endVisit(QDeclarativeJS::AST::LabelledStatement *); - virtual bool visit(QDeclarativeJS::AST::ThrowStatement *); - virtual void endVisit(QDeclarativeJS::AST::ThrowStatement *); - virtual bool visit(QDeclarativeJS::AST::TryStatement *); - virtual void endVisit(QDeclarativeJS::AST::TryStatement *); - virtual bool visit(QDeclarativeJS::AST::Catch *); - virtual void endVisit(QDeclarativeJS::AST::Catch *); - virtual bool visit(QDeclarativeJS::AST::Finally *); - virtual void endVisit(QDeclarativeJS::AST::Finally *); - virtual bool visit(QDeclarativeJS::AST::FunctionDeclaration *); - virtual void endVisit(QDeclarativeJS::AST::FunctionDeclaration *); - virtual bool visit(QDeclarativeJS::AST::FunctionExpression *); - virtual void endVisit(QDeclarativeJS::AST::FunctionExpression *); - virtual bool visit(QDeclarativeJS::AST::FormalParameterList *); - virtual void endVisit(QDeclarativeJS::AST::FormalParameterList *); - - virtual bool visit(QDeclarativeJS::AST::FunctionBody *); - virtual void endVisit(QDeclarativeJS::AST::FunctionBody *); - - virtual bool visit(QDeclarativeJS::AST::Program *); - virtual void endVisit(QDeclarativeJS::AST::Program *); - - virtual bool visit(QDeclarativeJS::AST::SourceElements *); - virtual void endVisit(QDeclarativeJS::AST::SourceElements *); - - virtual bool visit(QDeclarativeJS::AST::FunctionSourceElement *); - virtual void endVisit(QDeclarativeJS::AST::FunctionSourceElement *); - - virtual bool visit(QDeclarativeJS::AST::StatementSourceElement *); - virtual void endVisit(QDeclarativeJS::AST::StatementSourceElement *); - virtual bool visit(QDeclarativeJS::AST::DebuggerStatement *); - virtual void endVisit(QDeclarativeJS::AST::DebuggerStatement *); - - virtual bool visit(QDeclarativeJS::AST::UiParameterList *); - virtual void endVisit(QDeclarativeJS::AST::UiParameterList *); protected: QString protect(const QString &string); @@ -333,8 +164,6 @@ private: QString output; quint32 cursor; quint32 commentIndex; - int indent; - QString debug; }; QT_END_NAMESPACE -- cgit v0.12 From 3773bf874b3c9bd8b5a01984091768481c7b4e65 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 2 Dec 2010 20:37:52 +0100 Subject: Added a specialized version of the QML code marker for JavaScript files. --- tools/qdoc3/jscodemarker.cpp | 129 +++++++++++++++++++++++++++++++++++++++++++ tools/qdoc3/jscodemarker.h | 74 +++++++++++++++++++++++++ tools/qdoc3/main.cpp | 2 + tools/qdoc3/qdoc3.pro | 2 + 4 files changed, 207 insertions(+) create mode 100644 tools/qdoc3/jscodemarker.cpp create mode 100644 tools/qdoc3/jscodemarker.h diff --git a/tools/qdoc3/jscodemarker.cpp b/tools/qdoc3/jscodemarker.cpp new file mode 100644 index 0000000..e3a0ff1 --- /dev/null +++ b/tools/qdoc3/jscodemarker.cpp @@ -0,0 +1,129 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/* + jscodemarker.cpp +*/ + +#include "private/qdeclarativejsast_p.h" +#include "private/qdeclarativejsengine_p.h" +#include "private/qdeclarativejslexer_p.h" +#include "private/qdeclarativejsnodepool_p.h" +#include "private/qdeclarativejsparser_p.h" + +#include "atom.h" +#include "node.h" +#include "jscodemarker.h" +#include "qmlmarkupvisitor.h" +#include "text.h" +#include "tree.h" + +QT_BEGIN_NAMESPACE + +JsCodeMarker::JsCodeMarker() +{ +} + +JsCodeMarker::~JsCodeMarker() +{ +} + +/*! + Returns true if the \a code is recognized by the parser. + */ +bool JsCodeMarker::recognizeCode(const QString &code) +{ + QDeclarativeJS::Engine engine; + QDeclarativeJS::Lexer lexer(&engine); + QDeclarativeJS::Parser parser(&engine); + QDeclarativeJS::NodePool m_nodePool("", &engine); + lexer.setCode(code, 1); + + return parser.parseProgram(); +} + +/*! + Returns true if \a ext is any of a list of file extensions + for the QML language. + */ +bool JsCodeMarker::recognizeExtension(const QString &ext) +{ + return ext == "js"; +} + +/*! + Returns true if the \a language is recognized. Only "QML" is + recognized by this marker. + */ +bool JsCodeMarker::recognizeLanguage(const QString &language) +{ + return language == "JavaScript" || language == "ECMAScript"; +} + +QString JsCodeMarker::markedUpCode(const QString &code, + const Node *relative, + const QString &dirPath) +{ + return addMarkUp(code, relative, dirPath); +} + +QString JsCodeMarker::addMarkUp(const QString &code, + const Node * /* relative */, + const QString &dirPath) +{ + QDeclarativeJS::Engine engine; + QDeclarativeJS::Lexer lexer(&engine); + lexer.setCode(code, 1); + + QDeclarativeJS::Parser parser(&engine); + QDeclarativeJS::NodePool m_nodePool("", &engine); + QString output; + + if (parser.parseProgram()) { + QDeclarativeJS::AST::Node *ast = parser.rootNode(); + QmlMarkupVisitor visitor(code, &engine); + QDeclarativeJS::AST::Node::accept(ast, &visitor); + output = visitor.markedUpCode(); + } + return output; +} + +QT_END_NAMESPACE diff --git a/tools/qdoc3/jscodemarker.h b/tools/qdoc3/jscodemarker.h new file mode 100644 index 0000000..f7cb025 --- /dev/null +++ b/tools/qdoc3/jscodemarker.h @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/* + jscodemarker.h +*/ + +#ifndef JSCODEMARKER_H +#define JSCODEMARKER_H + +#include "qmlcodemarker.h" + +QT_BEGIN_NAMESPACE + +class JsCodeMarker : public QmlCodeMarker +{ +public: + JsCodeMarker(); + ~JsCodeMarker(); + + virtual bool recognizeCode(const QString &code); + virtual bool recognizeExtension(const QString &ext); + virtual bool recognizeLanguage(const QString &language); + + virtual QString markedUpCode(const QString &code, + const Node *relative, + const QString &dirPath); + +private: + QString addMarkUp(const QString &code, const Node * /* relative */, + const QString & /* dirPath */); +}; + +QT_END_NAMESPACE + +#endif diff --git a/tools/qdoc3/main.cpp b/tools/qdoc3/main.cpp index 68b5370..782df39 100644 --- a/tools/qdoc3/main.cpp +++ b/tools/qdoc3/main.cpp @@ -53,6 +53,7 @@ #include "ditaxmlgenerator.h" #include "doc.h" #include "htmlgenerator.h" +#include "jscodemarker.h" #include "plaincodemarker.h" #include "puredocparser.h" #include "qmlcodemarker.h" @@ -368,6 +369,7 @@ int main(int argc, char **argv) */ PlainCodeMarker plainMarker; CppCodeMarker cppMarker; + JsCodeMarker jsMarker; QmlCodeMarker qmlMarker; HtmlGenerator htmlGenerator; diff --git a/tools/qdoc3/qdoc3.pro b/tools/qdoc3/qdoc3.pro index 23ff7bd..4bc6bca 100644 --- a/tools/qdoc3/qdoc3.pro +++ b/tools/qdoc3/qdoc3.pro @@ -37,6 +37,7 @@ HEADERS += atom.h \ generator.h \ helpprojectwriter.h \ htmlgenerator.h \ + jscodemarker.h \ location.h \ node.h \ openedlist.h \ @@ -66,6 +67,7 @@ SOURCES += atom.cpp \ generator.cpp \ helpprojectwriter.cpp \ htmlgenerator.cpp \ + jscodemarker.cpp \ location.cpp \ main.cpp \ node.cpp \ -- cgit v0.12 From 6f1e732ff0838461be262fa0b86697fab5d8f5b2 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Fri, 3 Dec 2010 14:39:30 +0100 Subject: Minor housekeeping changes. --- tools/qdoc3/jscodemarker.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/qdoc3/jscodemarker.cpp b/tools/qdoc3/jscodemarker.cpp index e3a0ff1..8b6a31d 100644 --- a/tools/qdoc3/jscodemarker.cpp +++ b/tools/qdoc3/jscodemarker.cpp @@ -107,7 +107,7 @@ QString JsCodeMarker::markedUpCode(const QString &code, QString JsCodeMarker::addMarkUp(const QString &code, const Node * /* relative */, - const QString &dirPath) + const QString & /* dirPath */) { QDeclarativeJS::Engine engine; QDeclarativeJS::Lexer lexer(&engine); -- cgit v0.12 From db506f31cf98d050aef10534fb5dad7058f64caf Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Mon, 6 Dec 2010 08:57:21 +1000 Subject: Doc: make it clear that "z" affects sibling stacking order. Task-number: QTBUG-15802 --- src/declarative/graphicsitems/qdeclarativeitem.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp index 9d6fe12..932e68f 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp @@ -1809,9 +1809,9 @@ void QDeclarativeItem::setClip(bool c) /*! \qmlproperty real Item::z - Sets the stacking order of the item. By default the stacking order is 0. + Sets the stacking order of sibling items. By default the stacking order is 0. - Items with a higher stacking value are drawn on top of items with a + Items with a higher stacking value are drawn on top of siblings with a lower stacking order. Items with the same stacking value are drawn bottom up in the order they appear. Items with a negative stacking value are drawn under their parent's content. -- cgit v0.12 From ac977c4d57eba8fe2b71e51fc3d0b5eddd416e17 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Mon, 6 Dec 2010 12:46:35 +1000 Subject: Qt.include() docs weren't being picked up by qdoc This moves the Qt.include() docs to qdeclarativeengine.cpp and also documents it in the "Integrating JavaScript" page. Task-number: QTBUG-15855 --- doc/src/declarative/javascriptblocks.qdoc | 25 ++++++++++ .../integrating-javascript/includejs/app.qml | 56 ++++++++++++++++++++++ .../integrating-javascript/includejs/factorial.js | 49 +++++++++++++++++++ .../integrating-javascript/includejs/script.js | 48 +++++++++++++++++++ src/declarative/qml/qdeclarativeengine.cpp | 27 +++++++++++ src/declarative/qml/qdeclarativeinclude.cpp | 24 +--------- 6 files changed, 207 insertions(+), 22 deletions(-) create mode 100644 doc/src/snippets/declarative/integrating-javascript/includejs/app.qml create mode 100644 doc/src/snippets/declarative/integrating-javascript/includejs/factorial.js create mode 100644 doc/src/snippets/declarative/integrating-javascript/includejs/script.js diff --git a/doc/src/declarative/javascriptblocks.qdoc b/doc/src/declarative/javascriptblocks.qdoc index 16d0633..41b64da 100644 --- a/doc/src/declarative/javascriptblocks.qdoc +++ b/doc/src/declarative/javascriptblocks.qdoc @@ -143,6 +143,31 @@ As they are shared, stateless library files cannot access QML component instance objects or properties directly, although QML values can be passed as function parameters. + +\section2 Importing One JavaScript File From Another + +If a JavaScript file needs to use functions defined inside another JavaScript file, +the other file can be imported using the \l {QML:Qt::include()}{Qt.include()} +function. This imports all functions from the other file into the current file's +namespace. + +For example, the QML code below left calls \c showCalculations() in \c script.js, +which in turn can call \c factorial() in \c factorial.js, as it has included +\c factorial.js using \l {QML:Qt::include()}{Qt.include()}. + +\table +\row +\o {1,2} \snippet doc/src/snippets/declarative/integrating-javascript/includejs/app.qml 0 +\o \snippet doc/src/snippets/declarative/integrating-javascript/includejs/script.js 0 +\row +\o \snippet doc/src/snippets/declarative/integrating-javascript/includejs/factorial.js 0 +\endtable + +Notice that calling \l {QML:Qt::include()}{Qt.include()} imports all functions from +\c factorial.js into the \c MyScript namespace, which means the QML component can also +access \c factorial() directly as \c MyScript.factorial(). + + \section1 Running JavaScript at Startup It is occasionally necessary to run some imperative code at application (or diff --git a/doc/src/snippets/declarative/integrating-javascript/includejs/app.qml b/doc/src/snippets/declarative/integrating-javascript/includejs/app.qml new file mode 100644 index 0000000..2ecc475 --- /dev/null +++ b/doc/src/snippets/declarative/integrating-javascript/includejs/app.qml @@ -0,0 +1,56 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ +//![0] +import QtQuick 1.0 +import "script.js" as MyScript + +Item { + width: 100; height: 100 + + MouseArea { + anchors.fill: parent + onClicked: { + MyScript.showCalculations(10) + console.log("Call factorial() from QML:", + MyScript.factorial(10)) + } + } +} +//![0] diff --git a/doc/src/snippets/declarative/integrating-javascript/includejs/factorial.js b/doc/src/snippets/declarative/integrating-javascript/includejs/factorial.js new file mode 100644 index 0000000..0a01e9e --- /dev/null +++ b/doc/src/snippets/declarative/integrating-javascript/includejs/factorial.js @@ -0,0 +1,49 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ +//![0] +// factorial.js +function factorial(a) { + a = parseInt(a); + if (a <= 0) + return 1; + else + return a * factorial(a - 1); +} +//![0] diff --git a/doc/src/snippets/declarative/integrating-javascript/includejs/script.js b/doc/src/snippets/declarative/integrating-javascript/includejs/script.js new file mode 100644 index 0000000..7380412 --- /dev/null +++ b/doc/src/snippets/declarative/integrating-javascript/includejs/script.js @@ -0,0 +1,48 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ +//![0] +// script.js +Qt.include("factorial.js") + +function showCalculations(value) { + console.log("Call factorial() from script.js:", + factorial(value)); +} +//![0] diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index a8404f0..201e675 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -261,6 +261,33 @@ of their use. \endlist */ +/*! +\qmlmethod object Qt::include(string url, jsobject callback) + +Includes another JavaScript file. This method can only be used from within JavaScript files, +and not regular QML files. + +This imports all functions from \a url into the current script's namespace. + +Qt.include() returns an object that describes the status of the operation. The object has +a single property, \c {status}, that is set to one of the following values: + +\table +\header \o Symbol \o Value \o Description +\row \o result.OK \o 0 \o The include completed successfully. +\row \o result.LOADING \o 1 \o Data is being loaded from the network. +\row \o result.NETWORK_ERROR \o 2 \o A network error occurred while fetching the url. +\row \o result.EXCEPTION \o 3 \o A JavaScript exception occurred while executing the included code. +An additional \c exception property will be set in this case. +\endtable + +The \c status property will be updated as the operation progresses. + +If provided, \a callback is invoked when the operation completes. The callback is passed +the same object as is returned from the Qt.include() call. +*/ +// Qt.include() is implemented in qdeclarativeinclude.cpp + QDeclarativeEnginePrivate::QDeclarativeEnginePrivate(QDeclarativeEngine *e) : captureProperties(false), rootContext(0), isDebugging(false), diff --git a/src/declarative/qml/qdeclarativeinclude.cpp b/src/declarative/qml/qdeclarativeinclude.cpp index 1e240d7..a9ecdda 100644 --- a/src/declarative/qml/qdeclarativeinclude.cpp +++ b/src/declarative/qml/qdeclarativeinclude.cpp @@ -172,28 +172,8 @@ void QDeclarativeInclude::callback(QScriptEngine *engine, QScriptValue &callback } } -/*! -\qmlmethod object Qt::include(string url, jsobject callback) - -Include another JavaScript file. This method can only be used from within JavaScript files, -and not regular QML files. - -Qt.include() returns an object that describes the status of the operation. The object has -a single property, \c {status} that is set to one of the following values: - -\table -\header \o Symbol \o Value \o Description -\row \o result.OK \o 0 \o The include completed successfully. -\row \o result.LOADING \o 1 \o Data is being loaded from the network. -\row \o result.NETWORK_ERROR \o 2 \o A network error occurred while fetching the url. -\row \o result.EXCEPTION \o 3 \o A JavaScript exception occurred while executing the included code. -An additional \c exception property will be set in this case. -\endtable - -The return object's properties will be updated as the operation progresses. - -If provided, \a callback is invoked when the operation completes. The callback is passed -the same object as is returned from the Qt.include() call. +/* + Documented in qdeclarativeengine.cpp */ QScriptValue QDeclarativeInclude::include(QScriptContext *ctxt, QScriptEngine *engine) { -- cgit v0.12 From b74ec2156b2a1f1acd38443047da5bb26cb082b1 Mon Sep 17 00:00:00 2001 From: Christopher Ham Date: Mon, 6 Dec 2010 15:46:47 +1000 Subject: Cursor shouldn't blink while dragging cursor position A function resetCursorBlinkerTimer was introduced to QLineControl. Each time the cursor position in a textInput is updated, the blinker timer is reset. Task-number: QTBUG-15815 Reviewed-by: Martin Jones --- src/declarative/graphicsitems/qdeclarativetextinput.cpp | 1 + src/gui/widgets/qlinecontrol.cpp | 9 +++++++++ src/gui/widgets/qlinecontrol_p.h | 1 + 3 files changed, 11 insertions(+) diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp index f8421a3..df103de 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp @@ -1479,6 +1479,7 @@ void QDeclarativeTextInput::cursorPosChanged() updateRect();//TODO: Only update rect between pos's updateMicroFocus(); emit cursorPositionChanged(); + d->control->resetCursorBlinkTimer(); if(!d->control->hasSelectedText()){ if(d->lastSelectionStart != d->control->cursor()){ diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp index f338f40..5ea9dc4 100644 --- a/src/gui/widgets/qlinecontrol.cpp +++ b/src/gui/widgets/qlinecontrol.cpp @@ -1308,6 +1308,15 @@ void QLineControl::setCursorBlinkPeriod(int msec) m_blinkPeriod = msec; } +void QLineControl::resetCursorBlinkTimer() +{ + if (m_blinkPeriod == 0 || m_blinkTimer == 0) + return; + killTimer(m_blinkTimer); + m_blinkTimer = startTimer(m_blinkPeriod / 2); + m_blinkStatus = 1; +} + void QLineControl::timerEvent(QTimerEvent *event) { if (event->timerId() == m_blinkTimer) { diff --git a/src/gui/widgets/qlinecontrol_p.h b/src/gui/widgets/qlinecontrol_p.h index 7068f62..d881acf 100644 --- a/src/gui/widgets/qlinecontrol_p.h +++ b/src/gui/widgets/qlinecontrol_p.h @@ -296,6 +296,7 @@ public: int cursorBlinkPeriod() const { return m_blinkPeriod; } void setCursorBlinkPeriod(int msec); + void resetCursorBlinkTimer(); QString cancelText() const { return m_cancelText; } void setCancelText(const QString &text) { m_cancelText = text; } -- cgit v0.12 From 2051459dd9a257c6492c755a583ff331e7009012 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Mon, 6 Dec 2010 17:49:04 +1000 Subject: Some doc clarification for components and javascript integration --- doc/src/declarative/javascriptblocks.qdoc | 5 ++--- src/declarative/qml/qdeclarativecomponent.cpp | 28 +++++++++++++++------------ 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/doc/src/declarative/javascriptblocks.qdoc b/doc/src/declarative/javascriptblocks.qdoc index 41b64da..155bd6e 100644 --- a/doc/src/declarative/javascriptblocks.qdoc +++ b/doc/src/declarative/javascriptblocks.qdoc @@ -94,9 +94,8 @@ Both relative and absolute JavaScript URLs can be imported. In the case of a relative URL, the location is resolved relative to the location of the \l {QML Document} that contains the import. If the script file is not accessible, an error will occur. If the JavaScript needs to be fetched from a network -resource, the QML document has a "Loading" -\l {QDeclarativeComponent::status()}{status} until the script has been -downloaded. +resource, the component's \l {QDeclarativeComponent::status()}{status} is set to +"Loading" until the script has been downloaded. Imported JavaScript files are always qualified using the "as" keyword. The qualifier for JavaScript files must be unique, so there is always a one-to-one diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp index 63bde0f..77fc925 100644 --- a/src/declarative/qml/qdeclarativecomponent.cpp +++ b/src/declarative/qml/qdeclarativecomponent.cpp @@ -147,32 +147,36 @@ class QByteArray; Components are reusable, encapsulated QML elements with well-defined interfaces. Components are often defined by \l {qdeclarativedocuments.html}{component files} - - that is, \c .qml files. The \e Component element allows components to be defined - within QML items rather than in a separate file. This may be useful for reusing - a small component within a QML file, or for defining a component that logically - belongs with other QML components within a file. + that is, \c .qml files. The \e Component element essentially allows QML components + to be defined inline, within a \l {QML Document}{QML document}, rather than as a separate QML file. + This may be useful for reusing a small component within a QML file, or for defining + a component that logically belongs with other QML components within a file. For example, here is a component that is used by multiple \l Loader objects. - It contains a top level \l Rectangle item: + It contains a single item, a \l Rectangle: \snippet doc/src/snippets/declarative/component.qml 0 Notice that while a \l Rectangle by itself would be automatically rendered and displayed, this is not the case for the above rectangle because it is defined inside a \c Component. The component encapsulates the - QML elements within, as if they were defined in a separate \c .qml + QML elements within, as if they were defined in a separate QML file, and is not loaded until requested (in this case, by the two \l Loader objects). - A Component cannot contain anything other - than an \c id and a single top level item. While the \c id is optional, - the top level item is not; you cannot define an empty component. + Defining a \c Component is similar to defining a \l {QML Document}{QML document}. + A QML document has a single top-level item that defines the behaviors and + properties of that component, and cannot define properties or behaviors outside + of that top-level item. In the same way, a \c Component definition contains a single + top level item (which in the above example is a \l Rectangle) and cannot define any + data outside of this item, with the exception of an \e id (which in the above example + is \e redSquare). - The Component element is commonly used to provide graphical components - for views. For example, the ListView::delegate property requires a Component + The \c Component element is commonly used to provide graphical components + for views. For example, the ListView::delegate property requires a \c Component to specify how each list item is to be displayed. - Component objects can also be dynamically created using + \c Component objects can also be created dynamically using \l{QML:Qt::createComponent()}{Qt.createComponent()}. */ -- cgit v0.12 From 2e7cfca6089a0923698b9cd208f79a660e058caa Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Mon, 6 Dec 2010 17:49:17 +1000 Subject: Document support for QVariantList and QVariantMap type conversion --- doc/src/declarative/qtbinding.qdoc | 34 ++++++++++- .../qtbinding/variantlistmap/MyItem.qml | 54 +++++++++++++++++ .../declarative/qtbinding/variantlistmap/main.cpp | 67 ++++++++++++++++++++++ .../qtbinding/variantlistmap/variantlistmap.pro | 2 + 4 files changed, 156 insertions(+), 1 deletion(-) create mode 100644 doc/src/snippets/declarative/qtbinding/variantlistmap/MyItem.qml create mode 100644 doc/src/snippets/declarative/qtbinding/variantlistmap/main.cpp create mode 100644 doc/src/snippets/declarative/qtbinding/variantlistmap/variantlistmap.pro diff --git a/doc/src/declarative/qtbinding.qdoc b/doc/src/declarative/qtbinding.qdoc index 71f41bc..04b8ca6 100644 --- a/doc/src/declarative/qtbinding.qdoc +++ b/doc/src/declarative/qtbinding.qdoc @@ -426,6 +426,7 @@ By default, QML recognizes the following data types: \o QSize, QSizeF \o QRect, QRectF \o QVariant +\o QVariantList, QVariantMap \o QObject* \o Enumerations declared with Q_ENUMS() \endlist @@ -434,6 +435,37 @@ To allow a custom C++ type to be created or used in QML, the C++ class must be r type using qmlRegisterType(), as shown in the \l {Defining new QML elements} section above. +\section2 JavaScript arrays and objects + +There is built-in support for automatic type conversion between QVariantList and JavaScript +arrays, and QVariantMap and JavaScript objects. + +For example, the function defined in QML below left expects two arguments, an array and an object, and prints +their contents using the standard JavaScript syntax for array and object item access. The C++ code +below right calls this function, passing a QVariantList and a QVariantMap, which are automatically +converted to JavaScript array and object values, repectively: + +\table +\row +\o \snippet doc/src/snippets/declarative/qtbinding/variantlistmap/MyItem.qml 0 +\o \snippet doc/src/snippets/declarative/qtbinding/variantlistmap/main.cpp 0 +\endtable + +This produces output like: + +\code +Array item: 10 +Array item: #00ff00 +Array item: bottles +Object item: language = QML +Object item: released = Tue Sep 21 2010 00:00:00 GMT+1000 (EST) +\endcode + +Similarly, if a C++ type uses a QVariantList or QVariantMap type for a property or method +parameter, the value can be created as a JavaScript array or object in the QML +side, and is automatically converted to a QVariantList or QVariantMap when it is passed to C++. + + \section2 Using enumerations of a custom type To use an enumeration from a custom C++ component, the enumeration must be declared with Q_ENUMS() to @@ -455,7 +487,7 @@ See the \l {Tutorial: Writing QML extensions with C++}{Writing QML extensions wi the \l {Extending QML in C++} reference documentation for more information. -\section2 Automatic type conversion +\section2 Automatic type conversion from strings As a convenience, some basic types can be specified in QML using format strings to make it easier to pass simple values from QML to C++. diff --git a/doc/src/snippets/declarative/qtbinding/variantlistmap/MyItem.qml b/doc/src/snippets/declarative/qtbinding/variantlistmap/MyItem.qml new file mode 100644 index 0000000..dd59fed --- /dev/null +++ b/doc/src/snippets/declarative/qtbinding/variantlistmap/MyItem.qml @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ +import QtQuick 1.0 + +//![0] +// MyItem.qml +Item { + function readValues(anArray, anObject) { + for (var i=0; i +#include + +int main(int argc, char *argv[]) { + QApplication app(argc, argv); + +//![0] +// C++ +QDeclarativeView view(QUrl::fromLocalFile("MyItem.qml")); + +QVariantList list; +list << 10 << Qt::green << "bottles"; + +QVariantMap map; +map.insert("language", "QML"); +map.insert("released", QDate(2010, 9, 21)); + +QMetaObject::invokeMethod(view.rootObject(), "readValues", + Q_ARG(QVariant, QVariant::fromValue(list)), + Q_ARG(QVariant, QVariant::fromValue(map))); +//![0] + + view.setSource(QUrl::fromLocalFile("MyItem.qml")); + view.show(); + + return app.exec(); +} + diff --git a/doc/src/snippets/declarative/qtbinding/variantlistmap/variantlistmap.pro b/doc/src/snippets/declarative/qtbinding/variantlistmap/variantlistmap.pro new file mode 100644 index 0000000..68eeaf2 --- /dev/null +++ b/doc/src/snippets/declarative/qtbinding/variantlistmap/variantlistmap.pro @@ -0,0 +1,2 @@ +QT += declarative +SOURCES += main.cpp -- cgit v0.12 From b5915ef3a6d0417440ad82e9369d6679505b953e Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 6 Dec 2010 15:34:19 +0100 Subject: qdoc: Fixed some reported bugs in the XML. --- tools/qdoc3/ditaxmlgenerator.cpp | 69 +++++++++++++++++------------------- tools/qdoc3/test/qt-ditaxml.qdocconf | 8 ++++- 2 files changed, 39 insertions(+), 38 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index d4285a8..b4a42ab 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -714,27 +714,24 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, break; case Atom::Code: { - xmlWriter().writeStartElement("pre"); - xmlWriter().writeAttribute("outputclass","highlightedcode"); + xmlWriter().writeStartElement("codeblock"); QString chars = trimmedTrailing(atom->string()); writeText(chars, marker, relative); - xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // } break; case Atom::Qml: - xmlWriter().writeStartElement("pre"); - xmlWriter().writeAttribute("outputclass","highlightedcode"); + xmlWriter().writeStartElement("codeblock"); writeText(trimmedTrailing(atom->string()), marker, relative); - xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // break; case Atom::CodeNew: xmlWriter().writeStartElement("p"); xmlWriter().writeCharacters("you can rewrite it as"); xmlWriter().writeEndElement(); //

    - xmlWriter().writeStartElement("pre"); - xmlWriter().writeAttribute("outputclass","highlightedcode"); + xmlWriter().writeStartElement("codeblock"); writeText(trimmedTrailing(atom->string()), marker, relative); - xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // break; case Atom::CodeOld: xmlWriter().writeStartElement("p"); @@ -742,10 +739,9 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, xmlWriter().writeEndElement(); //

    // fallthrough case Atom::CodeBad: - xmlWriter().writeStartElement("pre"); - xmlWriter().writeAttribute("outputclass","highlightedcode"); - xmlWriter().writeCharacters(trimmedTrailing(protectEnc(plainCode(atom->string())))); - xmlWriter().writeEndElement(); // + xmlWriter().writeStartElement("codeblock"); + xmlWriter().writeCharacters(trimmedTrailing(plainCode(atom->string()))); + xmlWriter().writeEndElement(); // break; case Atom::FootnoteLeft: // ### For now @@ -1043,30 +1039,30 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, if (atom->next() != 0) text = atom->next()->string(); if (fileName.isEmpty()) { - xmlWriter().writeStartElement("b"); - xmlWriter().writeAttribute("outputclass","error"); - xmlWriter().writeCharacters("[Missing image: "); - xmlWriter().writeCharacters(protectEnc(atom->string())); - xmlWriter().writeEndElement(); // + /* + Don't bother outputting an error message. + Just output the href as if the image is in + the images directory... + */ + fileName = QLatin1String("images/") + protectEnc(atom->string()); } + + xmlWriter().writeStartElement("fig"); + xmlWriter().writeStartElement("image"); + xmlWriter().writeAttribute("href",protectEnc(fileName)); + if (atom->type() == Atom::InlineImage) + xmlWriter().writeAttribute("placement","inline"); else { - xmlWriter().writeStartElement("fig"); - xmlWriter().writeStartElement("image"); - xmlWriter().writeAttribute("href",protectEnc(fileName)); - if (atom->type() == Atom::InlineImage) - xmlWriter().writeAttribute("placement","inline"); - else { - xmlWriter().writeAttribute("placement","break"); - xmlWriter().writeAttribute("align","center"); - } - if (!text.isEmpty()) { - xmlWriter().writeStartElement("alt"); - xmlWriter().writeCharacters(protectEnc(text)); - xmlWriter().writeEndElement(); // - } - xmlWriter().writeEndElement(); // - xmlWriter().writeEndElement(); // + xmlWriter().writeAttribute("placement","break"); + xmlWriter().writeAttribute("align","center"); + } + if (!text.isEmpty()) { + xmlWriter().writeStartElement("alt"); + xmlWriter().writeCharacters(protectEnc(text)); + xmlWriter().writeEndElement(); // } + xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // } break; case Atom::ImageText: @@ -2263,10 +2259,9 @@ void DitaXmlGenerator::generateBrief(const Node* node, CodeMarker* marker) void DitaXmlGenerator::generateIncludes(const InnerNode* inner, CodeMarker* marker) { if (!inner->includes().isEmpty()) { - xmlWriter().writeStartElement("pre"); - xmlWriter().writeAttribute("outputclass","highlightedcode"); + xmlWriter().writeStartElement("codeblock"); writeText(marker->markedUpIncludes(inner->includes()), marker, inner); - xmlWriter().writeEndElement(); // + xmlWriter().writeEndElement(); // } } diff --git a/tools/qdoc3/test/qt-ditaxml.qdocconf b/tools/qdoc3/test/qt-ditaxml.qdocconf index 63baead..1feb2b2 100644 --- a/tools/qdoc3/test/qt-ditaxml.qdocconf +++ b/tools/qdoc3/test/qt-ditaxml.qdocconf @@ -2,7 +2,8 @@ include(qt.qdocconf) imagedirs = $QTDIR/doc/src/images \ $QTDIR/examples \ - $QTDIR/doc/src/template/images + $QTDIR/doc/src/declarative/pics \ + $QTDIR/doc/src/template/images outputdir = $QTDIR/doc/ditaxml outputformats = DITAXML @@ -40,3 +41,8 @@ macro.begincomment = "\\c{/*}" macro.endcomment = "\\c{*/}" macro.uuml.DITAXML = "ü" macro.mdash.DITAXML = "—" + +macro.beginfloatleft.HTML = " " +macro.beginfloatright.HTML = " " +macro.endfloat.HTML = " " +macro.clearfloat.HTML = " " -- cgit v0.12 From 94cccc8b971eda3e0330950111c7988f3dd87309 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Mon, 6 Dec 2010 18:48:51 +0100 Subject: Removed QDebug includes. --- tools/qdoc3/helpprojectwriter.cpp | 2 -- tools/qdoc3/tokenizer.cpp | 1 - tools/qdoc3/tree.cpp | 1 - 3 files changed, 4 deletions(-) diff --git a/tools/qdoc3/helpprojectwriter.cpp b/tools/qdoc3/helpprojectwriter.cpp index 63e8df7..6253c58 100644 --- a/tools/qdoc3/helpprojectwriter.cpp +++ b/tools/qdoc3/helpprojectwriter.cpp @@ -41,7 +41,6 @@ #include #include -//#include #include "atom.h" #include "helpprojectwriter.h" @@ -49,7 +48,6 @@ #include "config.h" #include "node.h" #include "tree.h" -#include QT_BEGIN_NAMESPACE diff --git a/tools/qdoc3/tokenizer.cpp b/tools/qdoc3/tokenizer.cpp index 05ad5ee..6e7da20 100644 --- a/tools/qdoc3/tokenizer.cpp +++ b/tools/qdoc3/tokenizer.cpp @@ -42,7 +42,6 @@ #include "config.h" #include "tokenizer.h" -#include #include #include #include diff --git a/tools/qdoc3/tree.cpp b/tools/qdoc3/tree.cpp index 20c1373..ceb1f0f 100644 --- a/tools/qdoc3/tree.cpp +++ b/tools/qdoc3/tree.cpp @@ -54,7 +54,6 @@ #include "tree.h" #include -#include QT_BEGIN_NAMESPACE -- cgit v0.12 From 6834727fff1f74e15b2c9f25af1845e7f529afaa Mon Sep 17 00:00:00 2001 From: David Boddie Date: Mon, 6 Dec 2010 18:49:17 +0100 Subject: Forced the \qml command to use the QML code marker. --- tools/qdoc3/doc.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/qdoc3/doc.cpp b/tools/qdoc3/doc.cpp index 4152207..f153dfb 100644 --- a/tools/qdoc3/doc.cpp +++ b/tools/qdoc3/doc.cpp @@ -549,7 +549,7 @@ void DocParser::parse(const QString& source, #ifdef QDOC_QML case CMD_QML: leavePara(); - append(Atom::Qml, getCode(CMD_QML, marker)); + append(Atom::Qml, getCode(CMD_QML, CodeMarker::markerForLanguage(QLatin1String("QML")))); break; case CMD_QMLTEXT: append(Atom::QmlText); @@ -2252,7 +2252,8 @@ QString DocParser::getCode(int cmd, CodeMarker *marker) if (indent < minIndent) minIndent = indent; code = unindent(minIndent, code); - marker = CodeMarker::markerForCode(code); + if (!marker) + marker = CodeMarker::markerForCode(code); return marker->markedUpCode(code, 0, ""); } -- cgit v0.12 From bb6d5d9eb2a40de14ab3a41fbdaf4092c1a3b4e8 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Mon, 6 Dec 2010 18:52:38 +0100 Subject: Added missing qmlcodemarker.cpp and qmlcodemarker.h files. Added code to remove pragmas before parsing and add them to the output. The extractPragmas() function was copied into both qmlcodeparser.cpp and qmlcodemarker.cpp from src/declarative/qml/qdeclarativescriptparser.cpp, and was modified to return either nothing (for the API parser) or a list of removed pragmas (for the code marker). --- tools/qdoc3/jscodemarker.cpp | 14 +- tools/qdoc3/qmlcodemarker.cpp | 287 +++++++++++++++++++++++++++++++++++++++ tools/qdoc3/qmlcodemarker.h | 85 ++++++++++++ tools/qdoc3/qmlcodeparser.cpp | 71 +++++++++- tools/qdoc3/qmlcodeparser.h | 3 + tools/qdoc3/qmlmarkupvisitor.cpp | 75 +++++++--- tools/qdoc3/qmlmarkupvisitor.h | 13 +- 7 files changed, 523 insertions(+), 25 deletions(-) create mode 100644 tools/qdoc3/qmlcodemarker.cpp create mode 100644 tools/qdoc3/qmlcodemarker.h diff --git a/tools/qdoc3/jscodemarker.cpp b/tools/qdoc3/jscodemarker.cpp index 8b6a31d..84a28c6 100644 --- a/tools/qdoc3/jscodemarker.cpp +++ b/tools/qdoc3/jscodemarker.cpp @@ -75,7 +75,10 @@ bool JsCodeMarker::recognizeCode(const QString &code) QDeclarativeJS::Lexer lexer(&engine); QDeclarativeJS::Parser parser(&engine); QDeclarativeJS::NodePool m_nodePool("", &engine); - lexer.setCode(code, 1); + + QString newCode = code; + QList pragmas = extractPragmas(newCode); + lexer.setCode(newCode, 1); return parser.parseProgram(); } @@ -111,7 +114,10 @@ QString JsCodeMarker::addMarkUp(const QString &code, { QDeclarativeJS::Engine engine; QDeclarativeJS::Lexer lexer(&engine); - lexer.setCode(code, 1); + + QString newCode = code; + QList pragmas = extractPragmas(newCode); + lexer.setCode(newCode, 1); QDeclarativeJS::Parser parser(&engine); QDeclarativeJS::NodePool m_nodePool("", &engine); @@ -119,7 +125,9 @@ QString JsCodeMarker::addMarkUp(const QString &code, if (parser.parseProgram()) { QDeclarativeJS::AST::Node *ast = parser.rootNode(); - QmlMarkupVisitor visitor(code, &engine); + // Pass the unmodified code to the visitor so that pragmas and other + // unhandled source text can be output. + QmlMarkupVisitor visitor(code, pragmas, &engine); QDeclarativeJS::AST::Node::accept(ast, &visitor); output = visitor.markedUpCode(); } diff --git a/tools/qdoc3/qmlcodemarker.cpp b/tools/qdoc3/qmlcodemarker.cpp new file mode 100644 index 0000000..1e4ad1e --- /dev/null +++ b/tools/qdoc3/qmlcodemarker.cpp @@ -0,0 +1,287 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/* + qmlcodemarker.cpp +*/ + +#include "private/qdeclarativejsast_p.h" +#include "private/qdeclarativejsastfwd_p.h" +#include "private/qdeclarativejsengine_p.h" +#include "private/qdeclarativejslexer_p.h" +#include "private/qdeclarativejsnodepool_p.h" +#include "private/qdeclarativejsparser_p.h" + +#include "atom.h" +#include "node.h" +#include "qmlcodemarker.h" +#include "qmlmarkupvisitor.h" +#include "text.h" +#include "tree.h" + +QT_BEGIN_NAMESPACE + +QmlCodeMarker::QmlCodeMarker() +{ +} + +QmlCodeMarker::~QmlCodeMarker() +{ +} + +/*! + Returns true if the \a code is recognized by the parser. + */ +bool QmlCodeMarker::recognizeCode(const QString &code) +{ + QDeclarativeJS::Engine engine; + QDeclarativeJS::Lexer lexer(&engine); + QDeclarativeJS::Parser parser(&engine); + QDeclarativeJS::NodePool m_nodePool("", &engine); + + QString newCode = code; + extractPragmas(newCode); + lexer.setCode(newCode, 1); + + return parser.parse(); +} + +/*! + Returns true if \a ext is any of a list of file extensions + for the QML language. + */ +bool QmlCodeMarker::recognizeExtension(const QString &ext) +{ + return ext == "qml"; +} + +/*! + Returns true if the \a language is recognized. Only "QML" is + recognized by this marker. + */ +bool QmlCodeMarker::recognizeLanguage(const QString &language) +{ + return language == "QML"; +} + +/*! + Returns the name of the \a node. Method names include are returned with a + trailing set of parentheses. + */ +QString QmlCodeMarker::plainName(const Node *node) +{ + QString name = node->name(); + if (node->type() == Node::QmlMethod) + name += "()"; + return name; +} + +QString QmlCodeMarker::plainFullName(const Node *node, const Node *relative) +{ + if (node->name().isEmpty()) { + return "global"; + } + else { + QString fullName; + while (node) { + fullName.prepend(plainName(node)); + if (node->parent() == relative || node->parent()->name().isEmpty()) + break; + fullName.prepend("::"); + node = node->parent(); + } + return fullName; + } +} + +QString QmlCodeMarker::markedUpCode(const QString &code, + const Node *relative, + const QString &dirPath) +{ + return addMarkUp(code, relative, dirPath); +} + +QString QmlCodeMarker::markedUpName(const Node *node) +{ + QString name = linkTag(node, taggedNode(node)); + if (node->type() == Node::QmlMethod) + name += "()"; + return name; +} + +QString QmlCodeMarker::markedUpFullName(const Node *node, const Node *relative) +{ + if (node->name().isEmpty()) { + return "global"; + } + else { + QString fullName; + for (;;) { + fullName.prepend(markedUpName(node)); + if (node->parent() == relative || node->parent()->name().isEmpty()) + break; + fullName.prepend("<@op>::"); + node = node->parent(); + } + return fullName; + } +} + +QString QmlCodeMarker::markedUpIncludes(const QStringList& includes) +{ + QString code; + + QStringList::ConstIterator inc = includes.begin(); + while (inc != includes.end()) { + code += "import " + *inc + "\n"; + ++inc; + } + return protect(addMarkUp(code, 0, "")); +} + +QString QmlCodeMarker::functionBeginRegExp(const QString& funcName) +{ + return "^" + QRegExp::escape("function " + funcName) + "$"; + +} + +QString QmlCodeMarker::functionEndRegExp(const QString& /* funcName */) +{ + return "^\\}$"; +} + +QString QmlCodeMarker::addMarkUp(const QString &code, + const Node * /* relative */, + const QString & /* dirPath */) +{ + QDeclarativeJS::Engine engine; + QDeclarativeJS::Lexer lexer(&engine); + + QString newCode = code; + QList pragmas = extractPragmas(newCode); + lexer.setCode(newCode, 1); + + QDeclarativeJS::Parser parser(&engine); + QDeclarativeJS::NodePool m_nodePool("", &engine); + QString output; + + if (parser.parse()) { + QDeclarativeJS::AST::UiProgram *ast = parser.ast(); + // Pass the unmodified code to the visitor so that pragmas and other + // unhandled source text can be output. + QmlMarkupVisitor visitor(code, pragmas, &engine); + QDeclarativeJS::AST::Node::accept(ast, &visitor); + output = visitor.markedUpCode(); + } + return output; +} + +/* +Copied and pasted from src/declarative/qml/qdeclarativescriptparser.cpp. +*/ +static void replaceWithSpace(QString &str, int idx, int n) +{ + QChar *data = str.data() + idx; + const QChar space(QLatin1Char(' ')); + for (int ii = 0; ii < n; ++ii) + *data++ = space; +} + +/* +Copied and pasted from src/declarative/qml/qdeclarativescriptparser.cpp then +modified to return a list of removed pragmas. + +Searches for ".pragma " declarations within \a script. Currently supported pragmas +are: + library +*/ +QList QmlCodeMarker::extractPragmas(QString &script) +{ + const QString pragma(QLatin1String("pragma")); + const QString library(QLatin1String("library")); + QList removed; + + QDeclarativeJS::Lexer l(0); + l.setCode(script, 0); + + int token = l.lex(); + + while (true) { + if (token != QDeclarativeJSGrammar::T_DOT) + return removed; + + int startOffset = l.tokenOffset(); + int startLine = l.currentLineNo(); + int startColumn = l.currentColumnNo(); + + token = l.lex(); + + if (token != QDeclarativeJSGrammar::T_IDENTIFIER || + l.currentLineNo() != startLine || + script.mid(l.tokenOffset(), l.tokenLength()) != pragma) + return removed; + + token = l.lex(); + + if (token != QDeclarativeJSGrammar::T_IDENTIFIER || + l.currentLineNo() != startLine) + return removed; + + QString pragmaValue = script.mid(l.tokenOffset(), l.tokenLength()); + int endOffset = l.tokenLength() + l.tokenOffset(); + + token = l.lex(); + if (l.currentLineNo() == startLine) + return removed; + + if (pragmaValue == QLatin1String("library")) { + replaceWithSpace(script, startOffset, endOffset - startOffset); + removed.append( + QDeclarativeJS::AST::SourceLocation( + startOffset, endOffset - startOffset, + startLine, startColumn)); + } else + return removed; + } + return removed; +} + +QT_END_NAMESPACE diff --git a/tools/qdoc3/qmlcodemarker.h b/tools/qdoc3/qmlcodemarker.h new file mode 100644 index 0000000..68e6753 --- /dev/null +++ b/tools/qdoc3/qmlcodemarker.h @@ -0,0 +1,85 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/* + qmlcodemarker.h +*/ + +#ifndef QMLCODEMARKER_H +#define QMLCODEMARKER_H + +#include "private/qdeclarativejsastfwd_p.h" +#include "cppcodemarker.h" + +QT_BEGIN_NAMESPACE + +class QmlCodeMarker : public CppCodeMarker +{ +public: + QmlCodeMarker(); + ~QmlCodeMarker(); + + virtual bool recognizeCode(const QString &code); + virtual bool recognizeExtension(const QString &ext); + virtual bool recognizeLanguage(const QString &language); + virtual QString plainName(const Node *node); + virtual QString plainFullName(const Node *node, const Node *relative); + virtual QString markedUpCode(const QString &code, + const Node *relative, + const QString &dirPath); + + virtual QString markedUpName(const Node *node); + virtual QString markedUpFullName(const Node *node, const Node *relative); + virtual QString markedUpIncludes(const QStringList &includes); + virtual QString functionBeginRegExp(const QString &funcName); + virtual QString functionEndRegExp(const QString &funcName); + + /* Copied from src/declarative/qml/qdeclarativescriptparser.cpp */ + QList extractPragmas(QString &script); + +private: + QString addMarkUp(const QString &code, const Node * /* relative */, + const QString & /* dirPath */); +}; + +QT_END_NAMESPACE + +#endif diff --git a/tools/qdoc3/qmlcodeparser.cpp b/tools/qdoc3/qmlcodeparser.cpp index 329912c..9c1d4ee 100644 --- a/tools/qdoc3/qmlcodeparser.cpp +++ b/tools/qdoc3/qmlcodeparser.cpp @@ -118,7 +118,10 @@ void QmlCodeParser::parseSourceFile(const Location& location, in.close(); Location fileLocation(filePath); - lexer->setCode(document, 1); + + QString newCode = document; + extractPragmas(newCode); + lexer->setCode(newCode, 1); QSet topicCommandsAllowed = topicCommands(); QSet otherMetacommandsAllowed = otherMetaCommands(); @@ -129,7 +132,7 @@ void QmlCodeParser::parseSourceFile(const Location& location, if (parser->parse()) { QDeclarativeJS::AST::UiProgram *ast = parser->ast(); - QmlDocVisitor visitor(filePath, document, &engine, tree, metacommandsAllowed); + QmlDocVisitor visitor(filePath, newCode, &engine, tree, metacommandsAllowed); QDeclarativeJS::AST::Node::accept(ast, &visitor); } } @@ -165,4 +168,68 @@ QSet QmlCodeParser::otherMetaCommands() << COMMAND_QMLDEFAULT; } +/* +Copied and pasted from src/declarative/qml/qdeclarativescriptparser.cpp. +*/ +static void replaceWithSpace(QString &str, int idx, int n) +{ + QChar *data = str.data() + idx; + const QChar space(QLatin1Char(' ')); + for (int ii = 0; ii < n; ++ii) + *data++ = space; +} + +/* +Copied and pasted from src/declarative/qml/qdeclarativescriptparser.cpp then +modified to return no values. + +Searches for ".pragma " declarations within \a script. Currently supported pragmas +are: + library +*/ +void QmlCodeParser::extractPragmas(QString &script) +{ + const QString pragma(QLatin1String("pragma")); + const QString library(QLatin1String("library")); + + QDeclarativeJS::Lexer l(0); + l.setCode(script, 0); + + int token = l.lex(); + + while (true) { + if (token != QDeclarativeJSGrammar::T_DOT) + return; + + int startOffset = l.tokenOffset(); + int startLine = l.currentLineNo(); + + token = l.lex(); + + if (token != QDeclarativeJSGrammar::T_IDENTIFIER || + l.currentLineNo() != startLine || + script.mid(l.tokenOffset(), l.tokenLength()) != pragma) + return; + + token = l.lex(); + + if (token != QDeclarativeJSGrammar::T_IDENTIFIER || + l.currentLineNo() != startLine) + return; + + QString pragmaValue = script.mid(l.tokenOffset(), l.tokenLength()); + int endOffset = l.tokenLength() + l.tokenOffset(); + + token = l.lex(); + if (l.currentLineNo() == startLine) + return; + + if (pragmaValue == QLatin1String("library")) + replaceWithSpace(script, startOffset, endOffset - startOffset); + else + return; + } + return; +} + QT_END_NAMESPACE diff --git a/tools/qdoc3/qmlcodeparser.h b/tools/qdoc3/qmlcodeparser.h index a99e8a3..bbacd72 100644 --- a/tools/qdoc3/qmlcodeparser.h +++ b/tools/qdoc3/qmlcodeparser.h @@ -75,6 +75,9 @@ public: const QString& filePath, Tree *tree); virtual void doneParsingSourceFiles(Tree *tree); + /* Copied from src/declarative/qml/qdeclarativescriptparser.cpp */ + void extractPragmas(QString &script); + protected: virtual QSet topicCommands(); virtual QSet otherMetaCommands(); diff --git a/tools/qdoc3/qmlmarkupvisitor.cpp b/tools/qdoc3/qmlmarkupvisitor.cpp index 907b95d..6bede96 100644 --- a/tools/qdoc3/qmlmarkupvisitor.cpp +++ b/tools/qdoc3/qmlmarkupvisitor.cpp @@ -49,12 +49,42 @@ QT_BEGIN_NAMESPACE -QmlMarkupVisitor::QmlMarkupVisitor(const QString &source, QDeclarativeJS::Engine *engine) +QmlMarkupVisitor::QmlMarkupVisitor(const QString &source, + const QList &pragmas, + QDeclarativeJS::Engine *engine) { this->source = source; this->engine = engine; + cursor = 0; - commentIndex = 0; + extraIndex = 0; + + // Merge the lists of locations of pragmas and comments in the source code. + int i = 0; + int j = 0; + while (i < engine->comments().length() && j < pragmas.length()) { + if (engine->comments()[i].offset < pragmas[j].offset) { + extraTypes.append(Comment); + extraLocations.append(engine->comments()[i]); + ++i; + } else { + extraTypes.append(Pragma); + extraLocations.append(engine->comments()[j]); + ++j; + } + } + + while (i < engine->comments().length()) { + extraTypes.append(Comment); + extraLocations.append(engine->comments()[i]); + ++i; + } + + while (j < pragmas.length()) { + extraTypes.append(Pragma); + extraLocations.append(pragmas[j]); + ++j; + } } QmlMarkupVisitor::~QmlMarkupVisitor() @@ -96,7 +126,7 @@ QString QmlMarkupVisitor::markedUpCode() void QmlMarkupVisitor::addExtra(quint32 start, quint32 finish) { - if (commentIndex >= engine->comments().length()) { + if (extraIndex >= extraLocations.length()) { QString extra = source.mid(start, finish - start); if (extra.trimmed().isEmpty()) output += extra; @@ -107,28 +137,37 @@ void QmlMarkupVisitor::addExtra(quint32 start, quint32 finish) return; } - while (commentIndex < engine->comments().length()) { - if (engine->comments()[commentIndex].offset - 2 >= start) - break; - commentIndex++; + while (extraIndex < extraLocations.length()) { + if (extraTypes[extraIndex] == Comment) { + if (extraLocations[extraIndex].offset - 2 >= start) + break; + } else { + if (extraLocations[extraIndex].offset >= start) + break; + } + extraIndex++; } quint32 i = start; - while (i < finish && commentIndex < engine->comments().length()) { - quint32 j = engine->comments()[commentIndex].offset - 2; + while (i < finish && extraIndex < extraLocations.length()) { + quint32 j = extraLocations[extraIndex].offset - 2; if (i <= j && j < finish) { if (i < j) output += protect(source.mid(i, j - i)); - quint32 l = engine->comments()[commentIndex].length; - if (source.mid(j, 2) == QLatin1String("/*")) - l += 4; - else - l += 2; - output += QLatin1String("<@comment>"); - output += protect(source.mid(j, l)); - output += QLatin1String(""); - commentIndex++; + quint32 l = extraLocations[extraIndex].length; + if (extraTypes[extraIndex] == Comment) { + if (source.mid(j, 2) == QLatin1String("/*")) + l += 4; + else + l += 2; + output += QLatin1String("<@comment>"); + output += protect(source.mid(j, l)); + output += QLatin1String(""); + } else + output += protect(source.mid(j, l)); + + extraIndex++; i = j + l; } else break; diff --git a/tools/qdoc3/qmlmarkupvisitor.h b/tools/qdoc3/qmlmarkupvisitor.h index 35f1b5bc..7a9ff22 100644 --- a/tools/qdoc3/qmlmarkupvisitor.h +++ b/tools/qdoc3/qmlmarkupvisitor.h @@ -52,7 +52,14 @@ QT_BEGIN_NAMESPACE class QmlMarkupVisitor : public QDeclarativeJS::AST::Visitor { public: - QmlMarkupVisitor(const QString &code, QDeclarativeJS::Engine *engine); + enum ExtraType{ + Comment, + Pragma + }; + + QmlMarkupVisitor(const QString &code, + const QList &pragmas, + QDeclarativeJS::Engine *engine); virtual ~QmlMarkupVisitor(); QString markedUpCode(); @@ -160,10 +167,12 @@ private: QString sourceText(QDeclarativeJS::AST::SourceLocation &location); QDeclarativeJS::Engine *engine; + QList extraTypes; + QList extraLocations; QString source; QString output; quint32 cursor; - quint32 commentIndex; + int extraIndex; }; QT_END_NAMESPACE -- cgit v0.12 From 3b9674c720a8aca2558a344e9ca08219687afc91 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Mon, 6 Dec 2010 19:03:14 +0100 Subject: Added an intermediate version of the QML code marker. --- tools/qdoc3/qmlcodemarker.cpp | 378 ++++++++++++++++++++++++++++++++++++++++++ tools/qdoc3/qmlcodemarker.h | 79 +++++++++ 2 files changed, 457 insertions(+) create mode 100644 tools/qdoc3/qmlcodemarker.cpp create mode 100644 tools/qdoc3/qmlcodemarker.h diff --git a/tools/qdoc3/qmlcodemarker.cpp b/tools/qdoc3/qmlcodemarker.cpp new file mode 100644 index 0000000..6a69136 --- /dev/null +++ b/tools/qdoc3/qmlcodemarker.cpp @@ -0,0 +1,378 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/* + qmlcodemarker.cpp +*/ + +#include "node.h" +#include "qmlcodemarker.h" + +QT_BEGIN_NAMESPACE + +QmlCodeMarker::QmlCodeMarker() +{ +} + +QmlCodeMarker::~QmlCodeMarker() +{ +} + +bool QmlCodeMarker::recognizeCode( const QString& /* code */ ) +{ + return true; +} + +bool QmlCodeMarker::recognizeExtension( const QString& ext ) +{ + return ext == "qml"; +} + +bool QmlCodeMarker::recognizeLanguage( const QString& lang ) +{ + return lang == "QML"; +} + +QString QmlCodeMarker::plainName( const Node *node ) +{ + QString name = node->name(); + if ( node->type() == Node::Function ) + name += "()"; + return name; +} + +QString QmlCodeMarker::plainFullName( const Node *node, const Node * /* relative */ ) +{ + QString fullName; + for ( ;; ) { + fullName.prepend( plainName(node) ); + if ( node->parent()->name().isEmpty() ) + break; + node = node->parent(); + fullName.prepend("."); + } + return fullName; +} + +QString QmlCodeMarker::markedUpCode( const QString& code, + const Node * /* relative */, + const QString& /* dirPath */ ) +{ + return protect( code ); +} + +QString QmlCodeMarker::markedUpSynopsis( const Node *node, + const Node * /* relative */, + SynopsisStyle style ) +{ + QString synopsis; + QStringList extras; + QString name; + + name = taggedNode( node ); + if ( style != Detailed ) + name = linkTag( node, name ); + name = "<@name>" + name + ""; + + if ( style == Detailed && !node->parent()->name().isEmpty() && + node->type() != Node::Enum ) + name.prepend( taggedNode(node->parent()) + "." ); + + switch ( node->type() ) { + case Node::Class: + synopsis = "class " + name; + break; + case Node::Function: + { + const FunctionNode *func = (const FunctionNode *) node; + + synopsis = name; + + if ( style == SeparateList ) { + synopsis += "()"; + } else { + synopsis += " ("; + if ( !func->parameters().isEmpty() ) { + synopsis += " "; + int numOptional = 0; + QList::ConstIterator p = func->parameters().begin(); + while ( p != func->parameters().end() ) { + if ( !(*p).defaultValue().isEmpty() ) { + if ( p == func->parameters().begin() ) { + synopsis += "[ "; + } else { + synopsis += " [ , "; + } + numOptional++; + } else { + if ( p != func->parameters().begin() ) + synopsis += ", "; + } + if ( !(*p).name().isEmpty() ) + synopsis += "<@param>" + protect( (*p).name() ) + + " : "; + synopsis += protect( (*p).leftType() ); + ++p; + } + for ( int i = 0; i < numOptional; i++ ) + synopsis += " ]"; + synopsis += " "; + } + synopsis += ")"; + } + + if ( style != SeparateList && !func->returnType().isEmpty() ) + synopsis += " : " + protect( func->returnType() ); + + if ( style == Detailed && func->metaness() == FunctionNode::Signal ) + extras << "[signal]"; + } + break; + case Node::Property: + { + const PropertyNode *property = (const PropertyNode *) node; + + synopsis = name; + if ( style != SeparateList ) + synopsis += " : " + property->dataType(); + if ( style == Detailed && property->setters().isEmpty() ) + extras << "[read only]"; + } + break; + case Node::Enum: + { + /* + The letters A to F and X (upper- and lower-case) can + appear in a hexadecimal constant (e.g. 0x3F). + */ + QRegExp letterRegExp( "[G-WYZg-wyz_]" ); + const EnumNode *enume = (const EnumNode *) node; + + synopsis = name; + if ( style == Summary && !enume->items().isEmpty() ) { + synopsis += " : "; + QString comma; + QList::ConstIterator it = enume->items().begin(); + while ( it != enume->items().end() ) { + if ( enume->itemAccess((*it).name()) == Node::Public ) { + synopsis += comma; + synopsis += (*it).name(); + if ( (*it).value().indexOf(letterRegExp) != -1 ) + synopsis += " = " + (*it).value(); + comma = ", "; + } + ++it; + } + } + } + break; + case Node::Namespace: + case Node::Typedef: + default: + synopsis = name; + } + + if ( style == Summary ) { + if ( node->status() == Node::Preliminary ) { + extras << "(preliminary)"; + } else if ( node->status() == Node::Deprecated ) { + extras << "(deprecated)"; + } else if ( node->status() == Node::Obsolete ) { + extras << "(obsolete)"; + } + } + + QString extra; + if ( !extras.isEmpty() ) + extra = "<@extra>" + extras.join(" ") + ""; + return synopsis + extra; +} + +QString QmlCodeMarker::markedUpName( const Node *node ) +{ + QString name = linkTag( node, taggedNode(node) ); + if ( node->type() == Node::Function ) + name += "()"; + return name; +} + +QString QmlCodeMarker::markedUpFullName( const Node *node, + const Node * /* relative */ ) +{ + QString fullName; + for ( ;; ) { + fullName.prepend( markedUpName(node) ); + if ( node->parent()->name().isEmpty() ) + break; + node = node->parent(); + fullName.prepend( "<@op>." ); + } + return fullName; +} + +QString QmlCodeMarker::markedUpEnumValue(const QString & /* enumValue */, + const Node * /* relative */) +{ + return QString(); +} + +QString QmlCodeMarker::markedUpIncludes( const QStringList& /* includes */ ) +{ + return QString(); +} + +QString QmlCodeMarker::functionBeginRegExp( const QString& funcName ) +{ + return "^function[ \t].*\\b" + QRegExp::escape( funcName ); +} + +QString QmlCodeMarker::functionEndRegExp( const QString& /* funcName */ ) +{ + return "^}"; +} + +QList
    QmlCodeMarker::sections( const InnerNode *inner, SynopsisStyle style, Status status ) +{ + QList
    sections; + + if (inner->type() != Node::Class) + return sections; + + const ClassNode *classe = static_cast(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"); + + QStack stack; + stack.push( classe ); + + while ( !stack.isEmpty() ) { + const ClassNode *ancestorClass = stack.pop(); + + NodeList::ConstIterator c = ancestorClass->childNodes().begin(); + while ( c != ancestorClass->childNodes().end() ) { + if ( (*c)->access() == Node::Public ) { + if ( (*c)->type() == Node::Enum ) { + insert( enums, *c, style, status ); + } else if ( (*c)->type() == Node::Function ) { + const FunctionNode *func = (const FunctionNode *) *c; + if ( func->metaness() == FunctionNode::Signal ) { + insert( signalz, *c, style, status ); + } else { + insert( functions, *c, style, status ); + } + } else if ( (*c)->type() == Node::Property ) { + const PropertyNode *property = + (const PropertyNode *) *c; + if ( property->setters().isEmpty() ) { + insert( readOnlyProperties, *c, style, status ); + } else { + insert( writableProperties, *c, style, status ); + } + } + } + ++c; + } + + QList::ConstIterator r = ancestorClass->baseClasses().begin(); + while ( r != ancestorClass->baseClasses().end() ) { + stack.prepend( (*r).node ); + ++r; + } + } + append( sections, enums ); + append( sections, writableProperties ); + append( sections, readOnlyProperties ); + append( sections, functions ); + append( sections, signalz ); + } else if ( style == Detailed ) { + 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() ) { + if ( (*c)->access() == Node::Public ) { + if ( (*c)->type() == Node::Enum ) { + insert( enums, *c, style, status ); + } else if ( (*c)->type() == Node::Function ) { + insert( functionsAndSignals, *c, style, status ); + } else if ( (*c)->type() == Node::Property ) { + insert( properties, *c, style, status ); + } + } + ++c; + } + append( sections, enums ); + append( sections, properties ); + append( sections, functionsAndSignals ); + } else { // ( style == SeparateList ) + FastSection all(classe, "", "", "member", "members"); + + QStack stack; + stack.push( classe ); + + while ( !stack.isEmpty() ) { + const ClassNode *ancestorClass = stack.pop(); + + NodeList::ConstIterator c = ancestorClass->childNodes().begin(); + while ( c != ancestorClass->childNodes().end() ) { + if ( (*c)->access() == Node::Public ) + insert( all, *c, style, status ); + ++c; + } + + QList::ConstIterator r = ancestorClass->baseClasses().begin(); + while ( r != ancestorClass->baseClasses().end() ) { + stack.prepend( (*r).node ); + ++r; + } + } + append( sections, all ); + } + return sections; +} + +QT_END_NAMESPACE diff --git a/tools/qdoc3/qmlcodemarker.h b/tools/qdoc3/qmlcodemarker.h new file mode 100644 index 0000000..bc46209 --- /dev/null +++ b/tools/qdoc3/qmlcodemarker.h @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/* + qmlcodemarker.h +*/ + +#ifndef QMLCODEMARKER_H +#define QMLCODEMARKER_H + +#include "codemarker.h" + +QT_BEGIN_NAMESPACE + +class QmlCodeMarker : public CodeMarker +{ +public: + QmlCodeMarker(); + ~QmlCodeMarker(); + + bool recognizeCode( const QString& code ); + bool recognizeExtension( const QString& ext ); + bool recognizeLanguage( const QString& lang ); + QString plainName(const Node *node); + QString plainFullName(const Node *node, const Node *relative); + QString markedUpCode( const QString& code, const Node *relative, + const QString& dirPath ); + QString markedUpSynopsis( const Node *node, const Node *relative, + SynopsisStyle style ); + QString markedUpName( const Node *node ); + QString markedUpFullName( const Node *node, const Node *relative ); + QString markedUpEnumValue(const QString &enumValue, const Node *relative); + QString markedUpIncludes( const QStringList& includes ); + QList
    sections(const InnerNode *innerNode, SynopsisStyle style, Status status); + QString functionBeginRegExp( const QString& funcName ); + QString functionEndRegExp( const QString& funcName ); +}; + +QT_END_NAMESPACE + +#endif -- cgit v0.12 From 16447b1193fedf5fdcf1f3d270fa73c5036a1ba0 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Tue, 7 Dec 2010 10:41:10 +1000 Subject: Fix openDatabaseSync() to not create unused directory Task-number: QTBUG-15909 Reviewed-by: Warwick Allison --- src/declarative/qml/qdeclarativesqldatabase.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/declarative/qml/qdeclarativesqldatabase.cpp b/src/declarative/qml/qdeclarativesqldatabase.cpp index 45f277e..3f53111 100644 --- a/src/declarative/qml/qdeclarativesqldatabase.cpp +++ b/src/declarative/qml/qdeclarativesqldatabase.cpp @@ -375,7 +375,6 @@ static QScriptValue qmlsqldatabase_open_sync(QScriptContext *context, QScriptEng } else { created = !QFile::exists(basename+QLatin1String(".sqlite")); database = QSqlDatabase::addDatabase(QLatin1String("QSQLITE"), dbid); - QDir().mkpath(basename); if (created) { ini.setValue(QLatin1String("Name"), dbname); if (dbcreationCallback.isFunction()) -- cgit v0.12 From f3a7c4e458edb40957186e52012f15767eb8c1f4 Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Tue, 7 Dec 2010 12:49:54 +1000 Subject: Update QtGui def files Task-number: QTBUG-15815 --- src/s60installs/bwins/QtGuiu.def | 1 + src/s60installs/eabi/QtGuiu.def | 1 + 2 files changed, 2 insertions(+) diff --git a/src/s60installs/bwins/QtGuiu.def b/src/s60installs/bwins/QtGuiu.def index 6a33fc3..355b46a 100644 --- a/src/s60installs/bwins/QtGuiu.def +++ b/src/s60installs/bwins/QtGuiu.def @@ -12905,4 +12905,5 @@ EXPORTS ?reactivateDeferredActiveObjects@QEventDispatcherS60@@UAEXXZ @ 12904 NONAME ; void QEventDispatcherS60::reactivateDeferredActiveObjects(void) ?userData@QStaticTextItem@@QBEPAVQStaticTextUserData@@XZ @ 12905 NONAME ; class QStaticTextUserData * QStaticTextItem::userData(void) const ?populate@QTextureGlyphCache@@QAE_NPAVQFontEngine@@HPBIPBUQFixedPoint@@@Z @ 12906 NONAME ; bool QTextureGlyphCache::populate(class QFontEngine *, int, unsigned int const *, struct QFixedPoint const *) + ?resetCursorBlinkTimer@QLineControl@@QAEXXZ @ 12907 NONAME ; void QLineControl::resetCursorBlinkTimer(void) diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def index 54768a1..6b8dd7c 100644 --- a/src/s60installs/eabi/QtGuiu.def +++ b/src/s60installs/eabi/QtGuiu.def @@ -12105,4 +12105,5 @@ EXPORTS _ZN15QStaticTextItemD1Ev @ 12104 NONAME _ZN15QStaticTextItemD2Ev @ 12105 NONAME _ZN19QEventDispatcherS6031reactivateDeferredActiveObjectsEv @ 12106 NONAME + _ZN12QLineControl21resetCursorBlinkTimerEv @ 12107 NONAME -- cgit v0.12 From 076bba6c901e292b61fffb7a91020075dcd84919 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Tue, 7 Dec 2010 14:42:50 +0100 Subject: Doc: Added new style colors, increased the contrast of existing colors. --- doc/src/template/style/style.css | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/doc/src/template/style/style.css b/doc/src/template/style/style.css index 16bc9ed..03bc9a9 100755 --- a/doc/src/template/style/style.css +++ b/doc/src/template/style/style.css @@ -179,12 +179,27 @@ span.comment { - color: #8B0000; - font-style: italic; + color: #008B00; } span.string, span.char { - color: #254117; + color: #000084; + } + span.number + { + color: #a46200; + } + span.operator + { + color: black; + } + span.keyword + { + color: #840000; + } + span.name + { + color: black } -- cgit v0.12 From cac82fa92665c21abc8568b3287a50eb3dfc8349 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Tue, 7 Dec 2010 15:57:34 +0100 Subject: Updated the DITA generator to use the modified generator API. --- tools/qdoc3/ditaxmlgenerator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index c7fc2a9..f46b663 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -573,7 +573,7 @@ void DitaXmlGenerator::generateTree(const Tree *tree) findAllNamespaces(tree->root()); findAllSince(tree->root()); - PageGenerator::generateTree(tree, marker); + PageGenerator::generateTree(tree); writeDitaMap(); } -- cgit v0.12 From 327c95f6ce1c2f2ae2e4da8ca89d5ef0b2595af3 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Tue, 7 Dec 2010 16:35:32 +0100 Subject: Updated the DITA configuration to use the new configuration structure. --- tools/qdoc3/test/qt-ditaxml.qdocconf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/qdoc3/test/qt-ditaxml.qdocconf b/tools/qdoc3/test/qt-ditaxml.qdocconf index 1feb2b2..cc2937a 100644 --- a/tools/qdoc3/test/qt-ditaxml.qdocconf +++ b/tools/qdoc3/test/qt-ditaxml.qdocconf @@ -1,4 +1,4 @@ -include(qt.qdocconf) +include(qt-project.qdocconf) imagedirs = $QTDIR/doc/src/images \ $QTDIR/examples \ -- cgit v0.12 From ddeae91ab54bb92b813304778ab8dc4037937274 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Wed, 8 Dec 2010 16:22:04 +1000 Subject: ListView: Fix calculation of currentItem position when out of view. The calculation of position of currentItem when it is out of the visible area was bogus. Task-number: QTBUG-15525 Reviewed-by: Bea Lam --- .../graphicsitems/qdeclarativelistview.cpp | 12 ++- .../qdeclarativelistview/data/displaylist.qml | 9 ++- .../tst_qdeclarativelistview.cpp | 86 ++++++++++++++++++++++ 3 files changed, 102 insertions(+), 5 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index 845da79..2dfee3b 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -739,16 +739,20 @@ void QDeclarativeListViewPrivate::layout() return; } if (!visibleItems.isEmpty()) { - qreal oldEnd = visibleItems.last()->endPosition(); + bool fixedCurrent = currentItem && visibleItems.first()->item == currentItem->item; + qreal sum = visibleItems.first()->size(); qreal pos = visibleItems.first()->position() + visibleItems.first()->size() + spacing; for (int i=1; i < visibleItems.count(); ++i) { FxListItem *item = visibleItems.at(i); item->setPosition(pos); pos += item->size() + spacing; + sum += item->size(); + fixedCurrent = fixedCurrent || (currentItem && item->item == currentItem->item); } - // move current item if it is after the visible items. - if (currentItem && currentIndex > lastVisibleIndex()) - currentItem->setPosition(currentItem->position() + (visibleItems.last()->endPosition() - oldEnd)); + averageSize = qRound(sum / visibleItems.count()); + // move current item if it is not a visible item. + if (currentIndex >= 0 && currentItem && !fixedCurrent) + currentItem->setPosition(positionAt(currentIndex)); } q->refill(); minExtentDirty = true; diff --git a/tests/auto/declarative/qdeclarativelistview/data/displaylist.qml b/tests/auto/declarative/qdeclarativelistview/data/displaylist.qml index 487b70e..9d58530 100644 --- a/tests/auto/declarative/qdeclarativelistview/data/displaylist.qml +++ b/tests/auto/declarative/qdeclarativelistview/data/displaylist.qml @@ -1,6 +1,8 @@ import QtQuick 1.0 Rectangle { + id: root + property real delegateHeight: 20 width: 240 height: 320 color: "#ffffff" @@ -10,7 +12,8 @@ Rectangle { Rectangle { id: wrapper objectName: "wrapper" - height: 20 + height: root.delegateHeight + Behavior on height { NumberAnimation {} } width: 240 Text { text: index @@ -20,6 +23,10 @@ Rectangle { objectName: "displayText" text: display } + Text { + x: 200 + text: wrapper.y + } color: ListView.isCurrentItem ? "lightsteelblue" : "white" } }, diff --git a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp index 759caf2..22ebb1a 100644 --- a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp +++ b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp @@ -103,6 +103,7 @@ private slots: void resizeView(); void sizeLessThan1(); void QTBUG_14821(); + void resizeDelegate(); private: template void items(); @@ -1406,6 +1407,8 @@ void tst_QDeclarativeListView::resetModel() QTRY_VERIFY(display != 0); QTRY_COMPARE(display->text(), strings.at(i)); } + + delete canvas; } void tst_QDeclarativeListView::propertyChanges() @@ -1613,6 +1616,8 @@ void tst_QDeclarativeListView::manualHighlight() QTRY_COMPARE(listview->currentIndex(), 2); QTRY_COMPARE(listview->currentItem(), findItem(contentItem, "wrapper", 2)); QTRY_COMPARE(listview->highlightItem()->y(), listview->currentItem()->y()); + + delete canvas; } void tst_QDeclarativeListView::QTBUG_11105() @@ -1752,6 +1757,8 @@ void tst_QDeclarativeListView::footer() model.clear(); QTRY_COMPARE(footer->y(), 0.0); + + delete canvas; } void tst_QDeclarativeListView::resizeView() @@ -1794,6 +1801,8 @@ void tst_QDeclarativeListView::resizeView() QMetaObject::invokeMethod(canvas->rootObject(), "heightRatio", Q_RETURN_ARG(QVariant, heightRatio)); QCOMPARE(heightRatio.toReal(), 0.25); + + delete canvas; } void tst_QDeclarativeListView::sizeLessThan1() @@ -1849,6 +1858,83 @@ void tst_QDeclarativeListView::QTBUG_14821() listview->incrementCurrentIndex(); QCOMPARE(listview->currentIndex(), 0); + + delete canvas; +} + +void tst_QDeclarativeListView::resizeDelegate() +{ + QDeclarativeView *canvas = createView(); + + QStringList strings; + for (int i = 0; i < 30; ++i) + strings << QString::number(i); + QStringListModel model(strings); + + QDeclarativeContext *ctxt = canvas->rootContext(); + ctxt->setContextProperty("testModel", &model); + + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/displaylist.qml")); + qApp->processEvents(); + + QDeclarativeListView *listview = findItem(canvas->rootObject(), "list"); + QTRY_VERIFY(listview != 0); + + QDeclarativeItem *contentItem = listview->contentItem(); + QTRY_VERIFY(contentItem != 0); + + QTRY_COMPARE(listview->count(), model.rowCount()); + + listview->setCurrentIndex(25); + listview->setContentY(0); + + for (int i = 0; i < 16; ++i) { + QDeclarativeItem *item = findItem(contentItem, "wrapper", i); + QVERIFY(item != 0); + QCOMPARE(item->y(), i*20.0); + } + + QCOMPARE(listview->currentItem()->y(), 500.0); + QTRY_COMPARE(listview->highlightItem()->y(), 500.0); + + canvas->rootObject()->setProperty("delegateHeight", 30); + qApp->processEvents(); + + for (int i = 0; i < 11; ++i) { + QDeclarativeItem *item = findItem(contentItem, "wrapper", i); + QVERIFY(item != 0); + QTRY_COMPARE(item->y(), i*30.0); + } + + QTRY_COMPARE(listview->currentItem()->y(), 750.0); + QTRY_COMPARE(listview->highlightItem()->y(), 750.0); + + listview->setCurrentIndex(1); + listview->positionViewAtIndex(25, QDeclarativeListView::Beginning); + listview->positionViewAtIndex(5, QDeclarativeListView::Beginning); + + for (int i = 5; i < 16; ++i) { + QDeclarativeItem *item = findItem(contentItem, "wrapper", i); + QVERIFY(item != 0); + QCOMPARE(item->y(), i*30.0); + } + + QTRY_COMPARE(listview->currentItem()->y(), 30.0); + QTRY_COMPARE(listview->highlightItem()->y(), 30.0); + + canvas->rootObject()->setProperty("delegateHeight", 20); + qApp->processEvents(); + + for (int i = 5; i < 11; ++i) { + QDeclarativeItem *item = findItem(contentItem, "wrapper", i); + QVERIFY(item != 0); + QTRY_COMPARE(item->y(), 150 + (i-5)*20.0); + } + + QTRY_COMPARE(listview->currentItem()->y(), 70.0); + QTRY_COMPARE(listview->highlightItem()->y(), 70.0); + + delete canvas; } void tst_QDeclarativeListView::qListModelInterface_items() -- cgit v0.12 From 32292a7bdd3764aad917f7df1ea4a791f0b1528f Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 8 Dec 2010 12:13:53 +0100 Subject: qdoc: Fixed the double escaping problem. It's sort of ugly, because it just removes the escapeing that the code marker puts in so the XML stream writer can put the escaping back in again. It doesn't seem to slow it down at all, which is wierd. --- tools/qdoc3/ditaxmlgenerator.cpp | 230 ++++++++++++++++++++------------------- tools/qdoc3/ditaxmlgenerator.h | 1 + 2 files changed, 120 insertions(+), 111 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index b4a42ab..378800c 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -308,6 +308,21 @@ QString DitaXmlGenerator::sinceTitles[] = static bool showBrokenLinks = false; /*! + Quick, dirty, and very ugly. Unescape \a text + so QXmlStreamWriter::writeCharacters() can put + the escapes back in again! + */ +void DitaXmlGenerator::writeCharacters(const QString& text) +{ + QString t = text; + t = t.replace("<","<"); + t = t.replace(">",">"); + t = t.replace("&","&"); + t = t.replace(""","\""); + xmlWriter().writeCharacters(t); +} + +/*! Appends an element to the current XML stream with the \a href attribute and the \a text. */ @@ -317,11 +332,11 @@ void DitaXmlGenerator::addLink(const QString& href, if (!href.isEmpty()) { xmlWriter().writeStartElement("xref"); xmlWriter().writeAttribute("href", href); - xmlWriter().writeCharacters(text.toString()); + writeCharacters(text.toString()); xmlWriter().writeEndElement(); // } else { - xmlWriter().writeCharacters(text.toString()); + writeCharacters(text.toString()); } } @@ -644,11 +659,11 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, endLink(); } else { - xmlWriter().writeCharacters(protectEnc(atom->string())); + writeCharacters(protectEnc(atom->string())); } } else { - xmlWriter().writeCharacters(protectEnc(atom->string())); + writeCharacters(protectEnc(atom->string())); } break; case Atom::BaseName: @@ -673,13 +688,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, xmlWriter().writeCharacters("property"); else if (relative->type() == Node::Variable) xmlWriter().writeCharacters("variable"); - QStringList words = str.split(" "); - if (!(words.first() == "contains" || words.first() == "specifies" - || words.first() == "describes" || words.first() == "defines" - || words.first() == "holds" || words.first() == "determines")) - xmlWriter().writeCharacters(" holds "); - else - xmlWriter().writeCharacters(" "); + xmlWriter().writeCharacters(" holds "); } if (noLinks) { atom = atom->next(); @@ -690,12 +699,11 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, skipAhead++; atom = atom->next(); } - str[0] = str[0].toLower(); - if (str.right(1) == ".") - str.truncate(str.length() - 1); - str[0] = str[0].toUpper(); - xmlWriter().writeCharacters(str + "."); } + str[0] = str[0].toLower(); + if (str.right(1) == ".") + str.truncate(str.length() - 1); + writeCharacters(str + "."); break; case Atom::BriefRight: // if (relative->type() != Node::Fake) @@ -705,7 +713,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, case Atom::C: xmlWriter().writeStartElement(formattingLeftMap()[ATOM_FORMATTING_TELETYPE]); if (inLink) { - xmlWriter().writeCharacters(protectEnc(plainCode(atom->string()))); + writeCharacters(protectEnc(plainCode(atom->string()))); } else { writeText(atom->string(), marker, relative); @@ -740,7 +748,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, // fallthrough case Atom::CodeBad: xmlWriter().writeStartElement("codeblock"); - xmlWriter().writeCharacters(trimmedTrailing(plainCode(atom->string()))); + writeCharacters(trimmedTrailing(plainCode(atom->string()))); xmlWriter().writeEndElement(); // break; case Atom::FootnoteLeft: @@ -986,7 +994,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, xmlWriter().writeStartElement("p"); writeGuidAttribute(Doc::canonicalTitle((*s).name)); xmlWriter().writeAttribute("outputclass","h3"); - xmlWriter().writeCharacters(protectEnc((*s).name)); + writeCharacters(protectEnc((*s).name)); xmlWriter().writeEndElement(); //

    if (idx == Class) generateCompactList(0, marker, ncmap.value(), false, QString("Q")); @@ -1012,7 +1020,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, xmlWriter().writeStartElement("xref"); xmlWriter().writeAttribute("href",linkForNode(pmap.key(), 0)); QStringList pieces = fullName(pmap.key(), 0, marker).split("::"); - xmlWriter().writeCharacters(protectEnc(pieces.last())); + writeCharacters(protectEnc(pieces.last())); xmlWriter().writeEndElement(); // xmlWriter().writeCharacters(":"); xmlWriter().writeEndElement(); //

    @@ -1058,7 +1066,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, } if (!text.isEmpty()) { xmlWriter().writeStartElement("alt"); - xmlWriter().writeCharacters(protectEnc(text)); + writeCharacters(protectEnc(text)); xmlWriter().writeEndElement(); // } xmlWriter().writeEndElement(); // @@ -1184,8 +1192,8 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, xmlWriter().writeStartElement("strow"); xmlWriter().writeStartElement("stentry"); xmlWriter().writeStartElement("tt"); - xmlWriter().writeCharacters(protectEnc(plainCode(marker->markedUpEnumValue(atom->next()->string(), - relative)))); + writeCharacters(protectEnc(plainCode(marker->markedUpEnumValue(atom->next()->string(), + relative)))); xmlWriter().writeEndElement(); //
    xmlWriter().writeEndElement(); // xmlWriter().writeStartElement("stentry"); @@ -1200,7 +1208,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, xmlWriter().writeCharacters("?"); else { xmlWriter().writeStartElement("tt"); - xmlWriter().writeCharacters(protectEnc(itemValue)); + writeCharacters(protectEnc(itemValue)); xmlWriter().writeEndElement(); // } skipAhead = 1; @@ -1278,11 +1286,11 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, if (atom->string() == " ") break; if (atom->string().startsWith("&")) - xmlWriter().writeCharacters(atom->string()); + writeCharacters(atom->string()); else { xmlWriter().writeStartElement("pre"); xmlWriter().writeAttribute("outputclass","raw-html"); - xmlWriter().writeCharacters(atom->string()); + writeCharacters(atom->string()); xmlWriter().writeEndElement(); // } break; @@ -1323,7 +1331,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, generateLink(atom, relative, marker); } else { - xmlWriter().writeCharacters(protectEnc(atom->string())); + writeCharacters(protectEnc(atom->string())); } break; case Atom::TableLeft: @@ -1467,13 +1475,13 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, case Atom::UnhandledFormat: xmlWriter().writeStartElement("b"); xmlWriter().writeAttribute("outputclass","error"); - xmlWriter().writeCharacters("<Missing DITAXML>"); + xmlWriter().writeCharacters(""); xmlWriter().writeEndElement(); // break; case Atom::UnknownCommand: xmlWriter().writeStartElement("b"); xmlWriter().writeAttribute("outputclass","error unknown-command"); - xmlWriter().writeCharacters(protectEnc(atom->string())); + writeCharacters(protectEnc(atom->string())); xmlWriter().writeEndElement(); // break; case Atom::QmlText: @@ -1553,7 +1561,7 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark xmlWriter().writeAttribute("outputclass",attr); xmlWriter().writeStartElement("title"); xmlWriter().writeAttribute("outputclass","h2"); - xmlWriter().writeCharacters(protectEnc((*s).name)); + writeCharacters(protectEnc((*s).name)); xmlWriter().writeEndElement(); // generateSection(s->members, inner, marker, CodeMarker::Summary); generateSectionInheritedList(*s, inner, marker); @@ -1566,7 +1574,7 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark xmlWriter().writeAttribute("outputclass",attr); xmlWriter().writeStartElement("title"); xmlWriter().writeAttribute("outputclass","h2"); - xmlWriter().writeCharacters(protectEnc(name)); + writeCharacters(protectEnc(name)); xmlWriter().writeEndElement(); // generateSection(s->reimpMembers, inner, marker, CodeMarker::Summary); generateSectionInheritedList(*s, inner, marker); @@ -1692,7 +1700,7 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark xmlWriter().writeAttribute("outputclass",attr); xmlWriter().writeStartElement("title"); xmlWriter().writeAttribute("outputclass","h2"); - xmlWriter().writeCharacters(protectEnc((*s).name)); + writeCharacters(protectEnc((*s).name)); xmlWriter().writeEndElement(); // generateSection(s->members, inner, marker, CodeMarker::Summary); generateSectionInheritedList(*s, inner, marker); @@ -1705,7 +1713,7 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark xmlWriter().writeAttribute("outputclass",attr); xmlWriter().writeStartElement("title"); xmlWriter().writeAttribute("outputclass","h2"); - xmlWriter().writeCharacters(protectEnc(name)); + writeCharacters(protectEnc(name)); xmlWriter().writeEndElement(); // generateSection(s->reimpMembers, inner, marker, CodeMarker::Summary); generateSectionInheritedList(*s, inner, marker); @@ -1812,7 +1820,7 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark xmlWriter().writeAttribute("outputclass",attr); xmlWriter().writeStartElement("title"); xmlWriter().writeAttribute("outputclass","h2"); - xmlWriter().writeCharacters(protectEnc((*s).name)); + writeCharacters(protectEnc((*s).name)); xmlWriter().writeEndElement(); // generateSection(s->members, inner, marker, CodeMarker::Summary); generateSectionInheritedList(*s, inner, marker); @@ -1825,7 +1833,7 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark xmlWriter().writeAttribute("outputclass",attr); xmlWriter().writeStartElement("title"); xmlWriter().writeAttribute("outputclass","h2"); - xmlWriter().writeCharacters(protectEnc(name)); + writeCharacters(protectEnc(name)); xmlWriter().writeEndElement(); // generateSection(s->reimpMembers, inner, marker, CodeMarker::Summary); generateSectionInheritedList(*s, inner, marker); @@ -1928,7 +1936,7 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark xmlWriter().writeAttribute("outputclass",attr); xmlWriter().writeStartElement("title"); xmlWriter().writeAttribute("outputclass","h2"); - xmlWriter().writeCharacters(protectEnc((*s).name)); + writeCharacters(protectEnc((*s).name)); xmlWriter().writeEndElement(); // generateQmlSummary(*s,qcn,marker); //generateSection(s->members, inner, marker, CodeMarker::Summary); @@ -1954,7 +1962,7 @@ DitaXmlGenerator::generateClassLikeNode(const InnerNode* inner, CodeMarker* mark xmlWriter().writeAttribute("outputclass",attr); xmlWriter().writeStartElement("title"); xmlWriter().writeAttribute("outputclass","h2"); - xmlWriter().writeCharacters(protectEnc((*s).name)); + writeCharacters(protectEnc((*s).name)); xmlWriter().writeEndElement(); // NodeList::ConstIterator m = (*s).members.begin(); while (m != (*s).members.end()) { @@ -1981,7 +1989,7 @@ void DitaXmlGenerator::writeXrefListItem(const QString& link, const QString& tex xmlWriter().writeStartElement("li"); xmlWriter().writeStartElement("xref"); xmlWriter().writeAttribute("href",link); - xmlWriter().writeCharacters(text); + writeCharacters(text); xmlWriter().writeEndElement(); // xmlWriter().writeEndElement(); // } @@ -2088,7 +2096,7 @@ void DitaXmlGenerator::writeLink(const Node* node, xmlWriter().writeAttribute("href", link); xmlWriter().writeAttribute("role", role); xmlWriter().writeStartElement("linktext"); - xmlWriter().writeCharacters(text); + writeCharacters(text); xmlWriter().writeEndElement(); // xmlWriter().writeEndElement(); // } @@ -2237,7 +2245,7 @@ void DitaXmlGenerator::generateHeader(const Node* node, if (!outputclass.isEmpty()) xmlWriter().writeAttribute("outputclass",outputclass); xmlWriter().writeStartElement(nameElement); // or <apiName> - xmlWriter().writeCharacters(name); + writeCharacters(name); xmlWriter().writeEndElement(); // or } @@ -2605,7 +2613,7 @@ void DitaXmlGenerator::generateAnnotatedList(const Node* relative, else { xmlWriter().writeStartElement("entry"); xmlWriter().writeStartElement("p"); - xmlWriter().writeCharacters(protectEnc(node->doc().briefText().toString())); // zzz + writeCharacters(protectEnc(node->doc().briefText().toString())); // zzz xmlWriter().writeEndElement(); //

    xmlWriter().writeEndElement(); // } @@ -3030,7 +3038,7 @@ void DitaXmlGenerator::generateOverviewList(const Node* relative, CodeMarker* /* xmlWriter().writeAttribute("outputclass","h3"); xmlWriter().writeStartElement("xref"); xmlWriter().writeAttribute("href",linkForNode(groupNode, relative)); - xmlWriter().writeCharacters(protectEnc(groupNode->fullTitle())); + writeCharacters(protectEnc(groupNode->fullTitle())); xmlWriter().writeEndElement(); // xmlWriter().writeEndElement(); //

    if (fakeNodeMap[groupNode].count() == 0) @@ -3044,7 +3052,7 @@ void DitaXmlGenerator::generateOverviewList(const Node* relative, CodeMarker* /* xmlWriter().writeStartElement("li"); xmlWriter().writeStartElement("xref"); xmlWriter().writeAttribute("href",linkForNode(fakeNode, relative)); - xmlWriter().writeCharacters(protectEnc(title)); + writeCharacters(protectEnc(title)); xmlWriter().writeEndElement(); // xmlWriter().writeEndElement(); // } @@ -3065,7 +3073,7 @@ void DitaXmlGenerator::generateOverviewList(const Node* relative, CodeMarker* /* xmlWriter().writeStartElement("li"); xmlWriter().writeStartElement("xref"); xmlWriter().writeAttribute("href",linkForNode(fakeNode, relative)); - xmlWriter().writeCharacters(protectEnc(title)); + writeCharacters(protectEnc(title)); xmlWriter().writeEndElement(); // xmlWriter().writeEndElement(); // } @@ -3120,14 +3128,14 @@ void DitaXmlGenerator::generateSectionInheritedList(const Section& section, else text += section.pluralMember; text += " inherited from "; - xmlWriter().writeCharacters(text); + writeCharacters(text); xmlWriter().writeStartElement("xref"); // zzz text = fileName((*p).first) + "#"; text += DitaXmlGenerator::cleanRef(section.name.toLower()); xmlWriter().writeAttribute("href",text); text = protectEnc(marker->plainFullName((*p).first, relative)); - xmlWriter().writeCharacters(text); + writeCharacters(text); xmlWriter().writeEndElement(); // xmlWriter().writeEndElement(); // ++p; @@ -3269,7 +3277,7 @@ void DitaXmlGenerator::writeText(const QString& markedCode, const Node* n = 0; if (k == 0) { // <@link> if (!html.isEmpty()) { - xmlWriter().writeCharacters(html); + writeCharacters(html); html.clear(); } n = CodeMarker::nodeForString(par1.toString()); @@ -3278,25 +3286,25 @@ void DitaXmlGenerator::writeText(const QString& markedCode, } else if (k == 4) { // <@param> if (!html.isEmpty()) { - xmlWriter().writeCharacters(html); + writeCharacters(html); html.clear(); } xmlWriter().writeStartElement("i"); - xmlWriter().writeCharacters(arg.toString()); + writeCharacters(arg.toString()); xmlWriter().writeEndElement(); // } else if (k == 5) { // <@extra> if (!html.isEmpty()) { - xmlWriter().writeCharacters(html); + writeCharacters(html); html.clear(); } xmlWriter().writeStartElement("tt"); - xmlWriter().writeCharacters(arg.toString()); + writeCharacters(arg.toString()); xmlWriter().writeEndElement(); // } else { if (!html.isEmpty()) { - xmlWriter().writeCharacters(html); + writeCharacters(html); html.clear(); } par1 = QStringRef(); @@ -3328,7 +3336,7 @@ void DitaXmlGenerator::writeText(const QString& markedCode, } if (!html.isEmpty()) { - xmlWriter().writeCharacters(html); + writeCharacters(html); } } @@ -3341,7 +3349,7 @@ void DitaXmlGenerator::generateLink(const Atom* atom, if (funcLeftParen.indexIn(atom->string()) != -1 && marker->recognizeLanguage("Cpp")) { // hack for C++: move () outside of link int k = funcLeftParen.pos(1); - xmlWriter().writeCharacters(protectEnc(atom->string().left(k))); + writeCharacters(protectEnc(atom->string().left(k))); if (link.isEmpty()) { if (showBrokenLinks) xmlWriter().writeEndElement(); // @@ -3349,7 +3357,7 @@ void DitaXmlGenerator::generateLink(const Atom* atom, else xmlWriter().writeEndElement(); // inLink = false; - xmlWriter().writeCharacters(protectEnc(atom->string().mid(k))); + writeCharacters(protectEnc(atom->string().mid(k))); } else if (marker->recognizeLanguage("Java")) { // hack for Java: remove () and use when appropriate @@ -3358,13 +3366,13 @@ void DitaXmlGenerator::generateLink(const Atom* atom, if (tt) xmlWriter().writeStartElement("tt"); if (func) - xmlWriter().writeCharacters(protectEnc(atom->string().left(atom->string().length() - 2))); + writeCharacters(protectEnc(atom->string().left(atom->string().length() - 2))); else - xmlWriter().writeCharacters(protectEnc(atom->string())); + writeCharacters(protectEnc(atom->string())); xmlWriter().writeEndElement(); // } else - xmlWriter().writeCharacters(protectEnc(atom->string())); + writeCharacters(protectEnc(atom->string())); } QString DitaXmlGenerator::cleanRef(const QString& ref) @@ -3699,7 +3707,7 @@ void DitaXmlGenerator::generateFullName(const Node* apparentNode, xmlWriter().writeStartElement("xref"); QString href = linkForNode(actualNode, relative); xmlWriter().writeAttribute("href",href); - xmlWriter().writeCharacters(protectEnc(fullName(apparentNode, relative, marker))); + writeCharacters(protectEnc(fullName(apparentNode, relative, marker))); xmlWriter().writeEndElement(); // } @@ -4417,7 +4425,7 @@ void DitaXmlGenerator::writeDerivations(const ClassNode* cn, CodeMarker* marker) xmlWriter().writeStartElement(CXXCLASSBASECLASS); QString attr = fileName((*r).node) + "#" + (*r).node->guid(); xmlWriter().writeAttribute("href",attr); - xmlWriter().writeCharacters(marker->plainFullName((*r).node)); + writeCharacters(marker->plainFullName((*r).node)); xmlWriter().writeEndElement(); // // not included: or @@ -4529,7 +4537,7 @@ void DitaXmlGenerator::writeFunctions(const Section& s, xmlWriter().writeAttribute("class","signal"); else if (fn->metaness() == FunctionNode::Slot) xmlWriter().writeAttribute("class","slot"); - xmlWriter().writeCharacters(fn->name()); + writeCharacters(fn->name()); xmlWriter().writeEndElement(); // generateBrief(fn,marker); @@ -4589,7 +4597,7 @@ void DitaXmlGenerator::writeFunctions(const Section& s, } else { xmlWriter().writeStartElement(CXXFUNCTIONDECLAREDTYPE); - xmlWriter().writeCharacters(fn->returnType()); + writeCharacters(fn->returnType()); xmlWriter().writeEndElement(); // } @@ -4598,11 +4606,11 @@ void DitaXmlGenerator::writeFunctions(const Section& s, QString fq = fullQualification(fn); if (!fq.isEmpty()) { xmlWriter().writeStartElement(CXXFUNCTIONSCOPEDNAME); - xmlWriter().writeCharacters(fq); + writeCharacters(fq); xmlWriter().writeEndElement(); // } xmlWriter().writeStartElement(CXXFUNCTIONPROTOTYPE); - xmlWriter().writeCharacters(fn->signature(true)); + writeCharacters(fn->signature(true)); xmlWriter().writeEndElement(); // QString fnl = fn->signature(false); @@ -4613,7 +4621,7 @@ void DitaXmlGenerator::writeFunctions(const Section& s, ++idx; fnl = fn->parent()->name() + "::" + fnl.mid(idx); xmlWriter().writeStartElement(CXXFUNCTIONNAMELOOKUP); - xmlWriter().writeCharacters(fnl); + writeCharacters(fnl); xmlWriter().writeEndElement(); // if (!fn->isInternal() && fn->isReimp() && fn->reimplementedFrom() != 0) { @@ -4621,7 +4629,7 @@ void DitaXmlGenerator::writeFunctions(const Section& s, if (rfn && !rfn->isInternal()) { xmlWriter().writeStartElement(CXXFUNCTIONREIMPLEMENTED); xmlWriter().writeAttribute("href",rfn->ditaXmlHref()); - xmlWriter().writeCharacters(marker->plainFullName(rfn)); + writeCharacters(marker->plainFullName(rfn)); xmlWriter().writeEndElement(); // } } @@ -4658,19 +4666,19 @@ void DitaXmlGenerator::writeParameters(const FunctionNode* fn) while (p != parameters.end()) { xmlWriter().writeStartElement(CXXFUNCTIONPARAMETER); xmlWriter().writeStartElement(CXXFUNCTIONPARAMETERDECLAREDTYPE); - xmlWriter().writeCharacters((*p).leftType()); + writeCharacters((*p).leftType()); if (!(*p).rightType().isEmpty()) - xmlWriter().writeCharacters((*p).rightType()); + writeCharacters((*p).rightType()); xmlWriter().writeEndElement(); // xmlWriter().writeStartElement(CXXFUNCTIONPARAMETERDECLARATIONNAME); - xmlWriter().writeCharacters((*p).name()); + writeCharacters((*p).name()); xmlWriter().writeEndElement(); // // not included: if (!(*p).defaultValue().isEmpty()) { xmlWriter().writeStartElement(CXXFUNCTIONPARAMETERDEFAULTVALUE); - xmlWriter().writeCharacters((*p).defaultValue()); + writeCharacters((*p).defaultValue()); xmlWriter().writeEndElement(); // } @@ -4699,7 +4707,7 @@ void DitaXmlGenerator::writeEnumerations(const Section& s, if (!attribute.isEmpty()) xmlWriter().writeAttribute("outputclass",attribute); xmlWriter().writeStartElement("apiName"); - xmlWriter().writeCharacters(en->name()); + writeCharacters(en->name()); xmlWriter().writeEndElement(); // generateBrief(en,marker); @@ -4714,20 +4722,20 @@ void DitaXmlGenerator::writeEnumerations(const Section& s, QString fq = fullQualification(en); if (!fq.isEmpty()) { xmlWriter().writeStartElement(CXXENUMERATIONSCOPEDNAME); - xmlWriter().writeCharacters(fq); + writeCharacters(fq); xmlWriter().writeEndElement(); // } const QList& items = en->items(); if (!items.isEmpty()) { xmlWriter().writeStartElement(CXXENUMERATIONPROTOTYPE); - xmlWriter().writeCharacters(en->name()); + writeCharacters(en->name()); xmlWriter().writeCharacters(" = { "); QList::ConstIterator i = items.begin(); while (i != items.end()) { - xmlWriter().writeCharacters((*i).name()); + writeCharacters((*i).name()); if (!(*i).value().isEmpty()) { xmlWriter().writeCharacters(" = "); - xmlWriter().writeCharacters((*i).value()); + writeCharacters((*i).value()); } ++i; if (i != items.end()) @@ -4738,7 +4746,7 @@ void DitaXmlGenerator::writeEnumerations(const Section& s, } xmlWriter().writeStartElement(CXXENUMERATIONNAMELOOKUP); - xmlWriter().writeCharacters(en->parent()->name() + "::" + en->name()); + writeCharacters(en->parent()->name() + "::" + en->name()); xmlWriter().writeEndElement(); // // not included: @@ -4749,20 +4757,20 @@ void DitaXmlGenerator::writeEnumerations(const Section& s, while (i != items.end()) { xmlWriter().writeStartElement(CXXENUMERATOR); xmlWriter().writeStartElement("apiName"); - xmlWriter().writeCharacters((*i).name()); + writeCharacters((*i).name()); xmlWriter().writeEndElement(); // QString fq = fullQualification(en->parent()); if (!fq.isEmpty()) { xmlWriter().writeStartElement(CXXENUMERATORSCOPEDNAME); - xmlWriter().writeCharacters(fq + "::" + (*i).name()); + writeCharacters(fq + "::" + (*i).name()); xmlWriter().writeEndElement(); // } xmlWriter().writeStartElement(CXXENUMERATORPROTOTYPE); - xmlWriter().writeCharacters((*i).name()); + writeCharacters((*i).name()); xmlWriter().writeEndElement(); // xmlWriter().writeStartElement(CXXENUMERATORNAMELOOKUP); - xmlWriter().writeCharacters(en->parent()->name() + "::" + (*i).name()); + writeCharacters(en->parent()->name() + "::" + (*i).name()); xmlWriter().writeEndElement(); // if (!(*i).value().isEmpty()) { @@ -4818,7 +4826,7 @@ void DitaXmlGenerator::writeTypedefs(const Section& s, if (!attribute.isEmpty()) xmlWriter().writeAttribute("outputclass",attribute); xmlWriter().writeStartElement("apiName"); - xmlWriter().writeCharacters(tn->name()); + writeCharacters(tn->name()); xmlWriter().writeEndElement(); // generateBrief(tn,marker); @@ -4835,14 +4843,14 @@ void DitaXmlGenerator::writeTypedefs(const Section& s, QString fq = fullQualification(tn); if (!fq.isEmpty()) { xmlWriter().writeStartElement(CXXTYPEDEFSCOPEDNAME); - xmlWriter().writeCharacters(fq); + writeCharacters(fq); xmlWriter().writeEndElement(); // } // not included: xmlWriter().writeStartElement(CXXTYPEDEFNAMELOOKUP); - xmlWriter().writeCharacters(tn->parent()->name() + "::" + tn->name()); + writeCharacters(tn->parent()->name() + "::" + tn->name()); xmlWriter().writeEndElement(); // // not included: @@ -4881,7 +4889,7 @@ void DitaXmlGenerator::writeProperties(const Section& s, if (!attribute.isEmpty()) xmlWriter().writeAttribute("outputclass",attribute); xmlWriter().writeStartElement("apiName"); - xmlWriter().writeCharacters(pn->name()); + writeCharacters(pn->name()); xmlWriter().writeEndElement(); // generateBrief(pn,marker); @@ -4900,21 +4908,21 @@ void DitaXmlGenerator::writeProperties(const Section& s, if (!pn->qualifiedDataType().isEmpty()) { xmlWriter().writeStartElement(CXXVARIABLEDECLAREDTYPE); - xmlWriter().writeCharacters(pn->qualifiedDataType()); + writeCharacters(pn->qualifiedDataType()); xmlWriter().writeEndElement(); // } QString fq = fullQualification(pn); if (!fq.isEmpty()) { xmlWriter().writeStartElement(CXXVARIABLESCOPEDNAME); - xmlWriter().writeCharacters(fq); + writeCharacters(fq); xmlWriter().writeEndElement(); // } xmlWriter().writeStartElement(CXXVARIABLEPROTOTYPE); xmlWriter().writeCharacters("Q_PROPERTY("); - xmlWriter().writeCharacters(pn->qualifiedDataType()); + writeCharacters(pn->qualifiedDataType()); xmlWriter().writeCharacters(" "); - xmlWriter().writeCharacters(pn->name()); + writeCharacters(pn->name()); writePropertyParameter("READ",pn->getters()); writePropertyParameter("WRITE",pn->setters()); writePropertyParameter("RESET",pn->resetters()); @@ -4922,14 +4930,14 @@ void DitaXmlGenerator::writeProperties(const Section& s, if (pn->isDesignable() != pn->designableDefault()) { xmlWriter().writeCharacters(" DESIGNABLE "); if (!pn->runtimeDesignabilityFunction().isEmpty()) - xmlWriter().writeCharacters(pn->runtimeDesignabilityFunction()); + writeCharacters(pn->runtimeDesignabilityFunction()); else xmlWriter().writeCharacters(pn->isDesignable() ? "true" : "false"); } if (pn->isScriptable() != pn->scriptableDefault()) { xmlWriter().writeCharacters(" SCRIPTABLE "); if (!pn->runtimeScriptabilityFunction().isEmpty()) - xmlWriter().writeCharacters(pn->runtimeScriptabilityFunction()); + writeCharacters(pn->runtimeScriptabilityFunction()); else xmlWriter().writeCharacters(pn->isScriptable() ? "true" : "false"); } @@ -4949,14 +4957,14 @@ void DitaXmlGenerator::writeProperties(const Section& s, xmlWriter().writeEndElement(); // xmlWriter().writeStartElement(CXXVARIABLENAMELOOKUP); - xmlWriter().writeCharacters(pn->parent()->name() + "::" + pn->name()); + writeCharacters(pn->parent()->name() + "::" + pn->name()); xmlWriter().writeEndElement(); // if (pn->overriddenFrom() != 0) { PropertyNode* opn = (PropertyNode*)pn->overriddenFrom(); xmlWriter().writeStartElement(CXXVARIABLEREIMPLEMENTED); xmlWriter().writeAttribute("href",opn->ditaXmlHref()); - xmlWriter().writeCharacters(marker->plainFullName(opn)); + writeCharacters(marker->plainFullName(opn)); xmlWriter().writeEndElement(); // } @@ -4993,7 +5001,7 @@ void DitaXmlGenerator::writeDataMembers(const Section& s, if (!attribute.isEmpty()) xmlWriter().writeAttribute("outputclass",attribute); xmlWriter().writeStartElement("apiName"); - xmlWriter().writeCharacters(vn->name()); + writeCharacters(vn->name()); xmlWriter().writeEndElement(); // generateBrief(vn,marker); @@ -5018,28 +5026,28 @@ void DitaXmlGenerator::writeDataMembers(const Section& s, // , xmlWriter().writeStartElement(CXXVARIABLEDECLAREDTYPE); - xmlWriter().writeCharacters(vn->leftType()); + writeCharacters(vn->leftType()); if (!vn->rightType().isEmpty()) - xmlWriter().writeCharacters(vn->rightType()); + writeCharacters(vn->rightType()); xmlWriter().writeEndElement(); // QString fq = fullQualification(vn); if (!fq.isEmpty()) { xmlWriter().writeStartElement(CXXVARIABLESCOPEDNAME); - xmlWriter().writeCharacters(fq); + writeCharacters(fq); xmlWriter().writeEndElement(); // } xmlWriter().writeStartElement(CXXVARIABLEPROTOTYPE); - xmlWriter().writeCharacters(vn->leftType() + " "); - //xmlWriter().writeCharacters(vn->parent()->name() + "::" + vn->name()); - xmlWriter().writeCharacters(vn->name()); + writeCharacters(vn->leftType() + " "); + //writeCharacters(vn->parent()->name() + "::" + vn->name()); + writeCharacters(vn->name()); if (!vn->rightType().isEmpty()) - xmlWriter().writeCharacters(vn->rightType()); + writeCharacters(vn->rightType()); xmlWriter().writeEndElement(); // xmlWriter().writeStartElement(CXXVARIABLENAMELOOKUP); - xmlWriter().writeCharacters(vn->parent()->name() + "::" + vn->name()); + writeCharacters(vn->parent()->name() + "::" + vn->name()); xmlWriter().writeEndElement(); // // not included: @@ -5078,7 +5086,7 @@ void DitaXmlGenerator::writeMacros(const Section& s, if (!attribute.isEmpty()) xmlWriter().writeAttribute("outputclass",attribute); xmlWriter().writeStartElement("apiName"); - xmlWriter().writeCharacters(fn->name()); + writeCharacters(fn->name()); xmlWriter().writeEndElement(); // generateBrief(fn,marker); @@ -5092,7 +5100,7 @@ void DitaXmlGenerator::writeMacros(const Section& s, xmlWriter().writeStartElement(CXXDEFINEPROTOTYPE); xmlWriter().writeCharacters("#define "); - xmlWriter().writeCharacters(fn->name()); + writeCharacters(fn->name()); if (fn->metaness() == FunctionNode::MacroWithParams) { QStringList params = fn->parameterNames(); if (!params.isEmpty()) { @@ -5101,7 +5109,7 @@ void DitaXmlGenerator::writeMacros(const Section& s, if (params[i].isEmpty()) xmlWriter().writeCharacters("..."); else - xmlWriter().writeCharacters(params[i]); + writeCharacters(params[i]); if ((i+1) < params.size()) xmlWriter().writeCharacters(", "); } @@ -5111,14 +5119,14 @@ void DitaXmlGenerator::writeMacros(const Section& s, xmlWriter().writeEndElement(); // xmlWriter().writeStartElement(CXXDEFINENAMELOOKUP); - xmlWriter().writeCharacters(fn->name()); + writeCharacters(fn->name()); xmlWriter().writeEndElement(); // if (fn->reimplementedFrom() != 0) { FunctionNode* rfn = (FunctionNode*)fn->reimplementedFrom(); xmlWriter().writeStartElement(CXXDEFINEREIMPLEMENTED); xmlWriter().writeAttribute("href",rfn->ditaXmlHref()); - xmlWriter().writeCharacters(marker->plainFullName(rfn)); + writeCharacters(marker->plainFullName(rfn)); xmlWriter().writeEndElement(); // } @@ -5129,7 +5137,7 @@ void DitaXmlGenerator::writeMacros(const Section& s, for (int i = 0; i < params.size(); ++i) { xmlWriter().writeStartElement(CXXDEFINEPARAMETER); xmlWriter().writeStartElement(CXXDEFINEPARAMETERDECLARATIONNAME); - xmlWriter().writeCharacters(params[i]); + writeCharacters(params[i]); xmlWriter().writeEndElement(); // // not included: @@ -5168,9 +5176,9 @@ void DitaXmlGenerator::writePropertyParameter(const QString& tag, const NodeList NodeList::const_iterator n = nlist.begin(); while (n != nlist.end()) { xmlWriter().writeCharacters(" "); - xmlWriter().writeCharacters(tag); + writeCharacters(tag); xmlWriter().writeCharacters(" "); - xmlWriter().writeCharacters((*n)->name()); + writeCharacters((*n)->name()); ++n; } } @@ -5255,7 +5263,7 @@ void DitaXmlGenerator::writeDetailedDescription(const Node* node, xmlWriter().writeAttribute("outputclass","details"); xmlWriter().writeStartElement("title"); xmlWriter().writeAttribute("outputclass","h2"); - xmlWriter().writeCharacters(title); + writeCharacters(title); xmlWriter().writeEndElement(); // } else { @@ -5294,7 +5302,7 @@ void DitaXmlGenerator::writeNestedClasses(const Section& s, QString link = linkForNode((*m), n); xmlWriter().writeAttribute("href", link); QString name = n->name() + "::" + (*m)->name(); - xmlWriter().writeCharacters(name); + writeCharacters(name); xmlWriter().writeEndElement(); // } ++m; diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index b13fa49..c077b53 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -112,6 +112,7 @@ class DitaXmlGenerator : public PageGenerator void writeXrefListItem(const QString& link, const QString& text); QString fullQualification(const Node* n); + void writeCharacters(const QString& text); void writeDerivations(const ClassNode* cn, CodeMarker* marker); void writeLocation(const Node* n); void writeFunctions(const Section& s, -- cgit v0.12 From 4db69b5c116412bbcdb032affe9fa2c73e61abb1 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 8 Dec 2010 17:50:59 +0100 Subject: Updated the build files to use config files not command line options. --- doc/doc.pri | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/doc.pri b/doc/doc.pri index a5db3c7..3cdac61 100644 --- a/doc/doc.pri +++ b/doc/doc.pri @@ -19,8 +19,8 @@ $$unixstyle { QDOC = cd $$QT_SOURCE_TREE/tools/qdoc3/test && set QT_BUILD_TREE=$$QT_BUILD_TREE&& set QT_SOURCE_TREE=$$QT_SOURCE_TREE&& $$QT_BUILD_TREE/bin/qdoc3.exe $$DOCS_GENERATION_DEFINES QDOC = $$replace(QDOC, "/", "\\") } -ADP_DOCS_QDOCCONF_FILE = -online qt-build-docs.qdocconf -QT_DOCUMENTATION = ($$QDOC -creator qt-api-only.qdocconf assistant.qdocconf designer.qdocconf \ +ADP_DOCS_QDOCCONF_FILE = qt-build-docs-online.qdocconf +QT_DOCUMENTATION = ($$QDOC qt-api-only.qdocconf assistant.qdocconf designer.qdocconf \ linguist.qdocconf qmake.qdocconf qdeclarative.qdocconf) && \ (cd $$QT_BUILD_TREE && \ $$GENERATOR doc-build/html-qt/qt.qhp -o doc/qch/qt.qch && \ -- cgit v0.12 From 0ffdc7556920564fce899ccd4bb4e7ce68a5c4d2 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 8 Dec 2010 17:52:42 +0100 Subject: Use the same style of qmake variable referencing used elsewhere in Qt. --- tools/qdoc3/qdoc3.pro | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/qdoc3/qdoc3.pro b/tools/qdoc3/qdoc3.pro index 4bc6bca..2fedc0f 100644 --- a/tools/qdoc3/qdoc3.pro +++ b/tools/qdoc3/qdoc3.pro @@ -86,9 +86,9 @@ SOURCES += atom.cpp \ tree.cpp \ yyindent.cpp -INCLUDEPATH += $$(QT_BUILD_TREE)/include/QtDeclarative +INCLUDEPATH += $$QT_BUILD_TREE/include/QtDeclarative -include($$(QT_SOURCE_TREE)/src/declarative/qml/parser/parser.pri) +include($$QT_SOURCE_TREE/src/declarative/qml/parser/parser.pri) ### Documentation for qdoc3 ### -- cgit v0.12 From 58ae252e5555dc379b4ed500532bc51ff7bebc25 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Thu, 9 Dec 2010 10:12:35 +1000 Subject: highlightFollowsCurrentItem: false was not always honored In some cases ListView and GridView would position the highlight despite highlightFollowsCurrentItem: false being specified. Task-number: QTBUG-15972 Reviewed-by: Michael Brasser --- src/declarative/graphicsitems/qdeclarativegridview.cpp | 14 +++++++++----- src/declarative/graphicsitems/qdeclarativelistview.cpp | 18 ++++++++++++------ .../qdeclarativegridview/data/manual-highlight.qml | 4 ++-- .../qdeclarativegridview/tst_qdeclarativegridview.cpp | 15 +++++++++++---- .../qdeclarativelistview/data/manual-highlight.qml | 2 +- .../qdeclarativelistview/tst_qdeclarativelistview.cpp | 11 +++++++++-- 6 files changed, 44 insertions(+), 20 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index 1615b0f..4a6a9dc 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -735,7 +735,7 @@ void QDeclarativeGridViewPrivate::createHighlight() QDeclarative_setParent_noEvent(item, q->contentItem()); item->setParentItem(q->contentItem()); highlight = new FxGridItem(item, q); - if (currentItem) + if (currentItem && autoHighlight) highlight->setPosition(currentItem->colPos(), currentItem->rowPos()); highlightXAnimator = new QSmoothedAnimation(q); highlightXAnimator->target = QDeclarativeProperty(highlight->item, QLatin1String("x")); @@ -1253,7 +1253,8 @@ void QDeclarativeGridView::setModel(const QVariant &model) d->moveReason = QDeclarativeGridViewPrivate::SetIndex; d->updateCurrent(d->currentIndex); if (d->highlight && d->currentItem) { - d->highlight->setPosition(d->currentItem->colPos(), d->currentItem->rowPos()); + if (d->autoHighlight) + d->highlight->setPosition(d->currentItem->colPos(), d->currentItem->rowPos()); d->updateTrackedItem(); } d->moveReason = QDeclarativeGridViewPrivate::Other; @@ -1321,7 +1322,8 @@ void QDeclarativeGridView::setDelegate(QDeclarativeComponent *delegate) d->moveReason = QDeclarativeGridViewPrivate::SetIndex; d->updateCurrent(d->currentIndex); if (d->highlight && d->currentItem) { - d->highlight->setPosition(d->currentItem->colPos(), d->currentItem->rowPos()); + if (d->autoHighlight) + d->highlight->setPosition(d->currentItem->colPos(), d->currentItem->rowPos()); d->updateTrackedItem(); } d->moveReason = QDeclarativeGridViewPrivate::Other; @@ -2241,7 +2243,8 @@ void QDeclarativeGridView::componentComplete() else d->updateCurrent(d->currentIndex); if (d->highlight && d->currentItem) { - d->highlight->setPosition(d->currentItem->colPos(), d->currentItem->rowPos()); + if (d->autoHighlight) + d->highlight->setPosition(d->currentItem->colPos(), d->currentItem->rowPos()); d->updateTrackedItem(); } d->moveReason = QDeclarativeGridViewPrivate::Other; @@ -2649,7 +2652,8 @@ void QDeclarativeGridView::modelReset() d->moveReason = QDeclarativeGridViewPrivate::SetIndex; d->updateCurrent(d->currentIndex); if (d->highlight && d->currentItem) { - d->highlight->setPosition(d->currentItem->colPos(), d->currentItem->rowPos()); + if (d->autoHighlight) + d->highlight->setPosition(d->currentItem->colPos(), d->currentItem->rowPos()); d->updateTrackedItem(); } d->moveReason = QDeclarativeGridViewPrivate::Other; diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index 2dfee3b..d008f91 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -1571,7 +1571,8 @@ void QDeclarativeListView::setModel(const QVariant &model) d->moveReason = QDeclarativeListViewPrivate::SetIndex; d->updateCurrent(d->currentIndex); if (d->highlight && d->currentItem) { - d->highlight->setPosition(d->currentItem->position()); + if (d->autoHighlight) + d->highlight->setPosition(d->currentItem->position()); d->updateTrackedItem(); } } @@ -1642,7 +1643,8 @@ void QDeclarativeListView::setDelegate(QDeclarativeComponent *delegate) d->moveReason = QDeclarativeListViewPrivate::SetIndex; d->updateCurrent(d->currentIndex); if (d->highlight && d->currentItem) { - d->highlight->setPosition(d->currentItem->position()); + if (d->autoHighlight) + d->highlight->setPosition(d->currentItem->position()); d->updateTrackedItem(); } } @@ -2632,8 +2634,10 @@ void QDeclarativeListView::positionViewAtIndex(int index, int mode) cancelFlick(); d->setPosition(pos); if (d->highlight) { - d->highlight->setPosition(d->currentItem->itemPosition()); - d->highlight->setSize(d->currentItem->itemSize()); + if (d->autoHighlight) { + d->highlight->setPosition(d->currentItem->itemPosition()); + d->highlight->setSize(d->currentItem->itemSize()); + } d->updateHighlight(); } } @@ -2679,7 +2683,8 @@ void QDeclarativeListView::componentComplete() else d->updateCurrent(d->currentIndex); if (d->highlight && d->currentItem) { - d->highlight->setPosition(d->currentItem->position()); + if (d->autoHighlight) + d->highlight->setPosition(d->currentItem->position()); d->updateTrackedItem(); } d->moveReason = QDeclarativeListViewPrivate::Other; @@ -3142,7 +3147,8 @@ void QDeclarativeListView::modelReset() d->moveReason = QDeclarativeListViewPrivate::SetIndex; d->updateCurrent(d->currentIndex); if (d->highlight && d->currentItem) { - d->highlight->setPosition(d->currentItem->position()); + if (d->autoHighlight) + d->highlight->setPosition(d->currentItem->position()); d->updateTrackedItem(); } d->moveReason = QDeclarativeListViewPrivate::Other; diff --git a/tests/auto/declarative/qdeclarativegridview/data/manual-highlight.qml b/tests/auto/declarative/qdeclarativegridview/data/manual-highlight.qml index 7bb2c95..d082847 100644 --- a/tests/auto/declarative/qdeclarativegridview/data/manual-highlight.qml +++ b/tests/auto/declarative/qdeclarativegridview/data/manual-highlight.qml @@ -28,8 +28,8 @@ Item { objectName: "highlight" width: 80; height: 80 color: "lightsteelblue"; radius: 5 - y: grid.currentItem.y - x: grid.currentItem.x + y: grid.currentItem.y+5 + x: grid.currentItem.x+5 } } diff --git a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp index 7998e30..fd5d140 100644 --- a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp +++ b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp @@ -1215,15 +1215,22 @@ void tst_QDeclarativeGridView::manualHighlight() QTRY_COMPARE(gridview->currentIndex(), 0); QTRY_COMPARE(gridview->currentItem(), findItem(contentItem, "wrapper", 0)); - QTRY_COMPARE(gridview->highlightItem()->y(), gridview->currentItem()->y()); - QTRY_COMPARE(gridview->highlightItem()->x(), gridview->currentItem()->x()); + QTRY_COMPARE(gridview->highlightItem()->y() - 5, gridview->currentItem()->y()); + QTRY_COMPARE(gridview->highlightItem()->x() - 5, gridview->currentItem()->x()); gridview->setCurrentIndex(2); QTRY_COMPARE(gridview->currentIndex(), 2); QTRY_COMPARE(gridview->currentItem(), findItem(contentItem, "wrapper", 2)); - QTRY_COMPARE(gridview->highlightItem()->y(), gridview->currentItem()->y()); - QTRY_COMPARE(gridview->highlightItem()->x(), gridview->currentItem()->x()); + QTRY_COMPARE(gridview->highlightItem()->y() - 5, gridview->currentItem()->y()); + QTRY_COMPARE(gridview->highlightItem()->x() - 5, gridview->currentItem()->x()); + + gridview->positionViewAtIndex(8, QDeclarativeGridView::Contain); + + QTRY_COMPARE(gridview->currentIndex(), 2); + QTRY_COMPARE(gridview->currentItem(), findItem(contentItem, "wrapper", 2)); + QTRY_COMPARE(gridview->highlightItem()->y() - 5, gridview->currentItem()->y()); + QTRY_COMPARE(gridview->highlightItem()->x() - 5, gridview->currentItem()->x()); } void tst_QDeclarativeGridView::footer() diff --git a/tests/auto/declarative/qdeclarativelistview/data/manual-highlight.qml b/tests/auto/declarative/qdeclarativelistview/data/manual-highlight.qml index d8cfd9a..a32a194 100644 --- a/tests/auto/declarative/qdeclarativelistview/data/manual-highlight.qml +++ b/tests/auto/declarative/qdeclarativelistview/data/manual-highlight.qml @@ -28,7 +28,7 @@ Item { objectName: "highlight" width: 180; height: 20 color: "lightsteelblue"; radius: 5 - y: list.currentItem.y + y: list.currentItem.y+5 } } diff --git a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp index 22ebb1a..ff90d32 100644 --- a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp +++ b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp @@ -1609,13 +1609,20 @@ void tst_QDeclarativeListView::manualHighlight() QTRY_COMPARE(listview->currentIndex(), 0); QTRY_COMPARE(listview->currentItem(), findItem(contentItem, "wrapper", 0)); - QTRY_COMPARE(listview->highlightItem()->y(), listview->currentItem()->y()); + QTRY_COMPARE(listview->highlightItem()->y() - 5, listview->currentItem()->y()); listview->setCurrentIndex(2); QTRY_COMPARE(listview->currentIndex(), 2); QTRY_COMPARE(listview->currentItem(), findItem(contentItem, "wrapper", 2)); - QTRY_COMPARE(listview->highlightItem()->y(), listview->currentItem()->y()); + QTRY_COMPARE(listview->highlightItem()->y() - 5, listview->currentItem()->y()); + + // QTBUG-15972 + listview->positionViewAtIndex(3, QDeclarativeListView::Contain); + + QTRY_COMPARE(listview->currentIndex(), 2); + QTRY_COMPARE(listview->currentItem(), findItem(contentItem, "wrapper", 2)); + QTRY_COMPARE(listview->highlightItem()->y() - 5, listview->currentItem()->y()); delete canvas; } -- cgit v0.12 From 1e33b4ea1374b499bf938bc2f370f12404b76a58 Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Thu, 9 Dec 2010 16:40:11 +1000 Subject: Update QtGui bwins def file for QTBUG-15615 --- src/s60installs/bwins/QtGuiu.def | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/s60installs/bwins/QtGuiu.def b/src/s60installs/bwins/QtGuiu.def index 355b46a..bf4d99f 100644 --- a/src/s60installs/bwins/QtGuiu.def +++ b/src/s60installs/bwins/QtGuiu.def @@ -2725,7 +2725,7 @@ EXPORTS ?clearSelection@QTextCursor@@QAEXXZ @ 2724 NONAME ; void QTextCursor::clearSelection(void) ?clearSpans@QTableView@@QAEXXZ @ 2725 NONAME ; void QTableView::clearSpans(void) ?clearString@QLineControl@@ABE?AVQString@@II@Z @ 2726 NONAME ; class QString QLineControl::clearString(unsigned int, unsigned int) const - ?clearSubFocus@QGraphicsItemPrivate@@QAEXPAVQGraphicsItem@@@Z @ 2727 NONAME ; void QGraphicsItemPrivate::clearSubFocus(class QGraphicsItem *) + ?clearSubFocus@QGraphicsItemPrivate@@QAEXPAVQGraphicsItem@@@Z @ 2727 NONAME ABSENT ; void QGraphicsItemPrivate::clearSubFocus(class QGraphicsItem *) ?clearUndo@QLineControl@@QAEXXZ @ 2728 NONAME ; void QLineControl::clearUndo(void) ?click@QAbstractButton@@QAEXXZ @ 2729 NONAME ; void QAbstractButton::click(void) ?clicked@QAbstractButton@@IAEX_N@Z @ 2730 NONAME ; void QAbstractButton::clicked(bool) @@ -9914,7 +9914,7 @@ EXPORTS ?setStyleSheet@QWidget@@QAEXABVQString@@@Z @ 9913 NONAME ; void QWidget::setStyleSheet(class QString const &) ?setStyleStrategy@QFont@@QAEXW4StyleStrategy@1@@Z @ 9914 NONAME ; void QFont::setStyleStrategy(enum QFont::StyleStrategy) ?setStyle_helper@QWidgetPrivate@@QAEXPAVQStyle@@_N1@Z @ 9915 NONAME ; void QWidgetPrivate::setStyle_helper(class QStyle *, bool, bool) - ?setSubFocus@QGraphicsItemPrivate@@QAEXPAVQGraphicsItem@@@Z @ 9916 NONAME ; void QGraphicsItemPrivate::setSubFocus(class QGraphicsItem *) + ?setSubFocus@QGraphicsItemPrivate@@QAEXPAVQGraphicsItem@@@Z @ 9916 NONAME ABSENT ; void QGraphicsItemPrivate::setSubFocus(class QGraphicsItem *) ?setSubTitle@QWizardPage@@QAEXABVQString@@@Z @ 9917 NONAME ; void QWizardPage::setSubTitle(class QString const &) ?setSubTitleFormat@QWizard@@QAEXW4TextFormat@Qt@@@Z @ 9918 NONAME ; void QWizard::setSubTitleFormat(enum Qt::TextFormat) ?setSubmitPolicy@QDataWidgetMapper@@QAEXW4SubmitPolicy@1@@Z @ 9919 NONAME ; void QDataWidgetMapper::setSubmitPolicy(enum QDataWidgetMapper::SubmitPolicy) @@ -12906,4 +12906,6 @@ EXPORTS ?userData@QStaticTextItem@@QBEPAVQStaticTextUserData@@XZ @ 12905 NONAME ; class QStaticTextUserData * QStaticTextItem::userData(void) const ?populate@QTextureGlyphCache@@QAE_NPAVQFontEngine@@HPBIPBUQFixedPoint@@@Z @ 12906 NONAME ; bool QTextureGlyphCache::populate(class QFontEngine *, int, unsigned int const *, struct QFixedPoint const *) ?resetCursorBlinkTimer@QLineControl@@QAEXXZ @ 12907 NONAME ; void QLineControl::resetCursorBlinkTimer(void) + ?setSubFocus@QGraphicsItemPrivate@@QAEXPAVQGraphicsItem@@0@Z @ 12908 NONAME ; void QGraphicsItemPrivate::setSubFocus(class QGraphicsItem *, class QGraphicsItem *) + ?clearSubFocus@QGraphicsItemPrivate@@QAEXPAVQGraphicsItem@@0@Z @ 12909 NONAME ; void QGraphicsItemPrivate::clearSubFocus(class QGraphicsItem *, class QGraphicsItem *) -- cgit v0.12 From 185ad65aedeb45ee3739a4377c44f8d56a3bb4f5 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Thu, 9 Dec 2010 09:53:01 +0100 Subject: qdoc: Updated signature of generateInnerNode() in the XML generator. --- tools/qdoc3/ditaxmlgenerator.cpp | 17 +++++++++++------ tools/qdoc3/ditaxmlgenerator.h | 2 +- tools/qdoc3/qdoc3.pro | 2 +- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 6b7d1fb..abe247b 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -699,11 +699,11 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, skipAhead++; atom = atom->next(); } + str[0] = str[0].toLower(); + if (str.right(1) == ".") + str.truncate(str.length() - 1); + writeCharacters(str + "."); } - str[0] = str[0].toLower(); - if (str.right(1) == ".") - str.truncate(str.length() - 1); - writeCharacters(str + "."); break; case Atom::BriefRight: // if (relative->type() != Node::Fake) @@ -5315,7 +5315,7 @@ void DitaXmlGenerator::writeNestedClasses(const Section& s, Recursive writing of DITA XML files from the root \a node. */ void -DitaXmlGenerator::generateInnerNode(const InnerNode* node, CodeMarker* marker) +DitaXmlGenerator::generateInnerNode(const InnerNode* node) { if (!node->url().isNull()) return; @@ -5334,6 +5334,11 @@ DitaXmlGenerator::generateInnerNode(const InnerNode* node, CodeMarker* marker) } } + /* + Obtain a code marker for the source file. + */ + CodeMarker *marker = CodeMarker::markerForFileName(node->location().filePath()); + if (node->parent() != 0) { beginSubPage(node->location(), fileName(node)); if (node->type() == Node::Namespace || node->type() == Node::Class) { @@ -5353,7 +5358,7 @@ DitaXmlGenerator::generateInnerNode(const InnerNode* node, CodeMarker* marker) NodeList::ConstIterator c = node->childNodes().begin(); while (c != node->childNodes().end()) { if ((*c)->isInnerNode() && (*c)->access() != Node::Private) - generateInnerNode((const InnerNode*) *c, marker); + generateInnerNode((const InnerNode*) *c); ++c; } } diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index 6075a86..1a42e5f 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -252,7 +252,7 @@ class DitaXmlGenerator : public PageGenerator GuidMap* lookupGuidMap(const QString& fileName); virtual void beginSubPage(const Location& location, const QString& fileName); virtual void endSubPage(); - virtual void generateInnerNode(const InnerNode* node, CodeMarker* marker); + virtual void generateInnerNode(const InnerNode* node); QXmlStreamWriter& xmlWriter(); void writeDetailedDescription(const Node* node, CodeMarker* marker, diff --git a/tools/qdoc3/qdoc3.pro b/tools/qdoc3/qdoc3.pro index 4bc6bca..50c20ec 100644 --- a/tools/qdoc3/qdoc3.pro +++ b/tools/qdoc3/qdoc3.pro @@ -86,7 +86,7 @@ SOURCES += atom.cpp \ tree.cpp \ yyindent.cpp -INCLUDEPATH += $$(QT_BUILD_TREE)/include/QtDeclarative +INCLUDEPATH += $$(QT_SOURCE_TREE)/include/QtDeclarative include($$(QT_SOURCE_TREE)/src/declarative/qml/parser/parser.pri) -- cgit v0.12 From 7cfb008dd0aa1908464f071b1661e40e6117aba8 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Thu, 9 Dec 2010 10:13:34 +0100 Subject: doc: Removed some empty \row commands from a table. --- doc/src/platforms/platform-notes.qdoc | 3 --- 1 file changed, 3 deletions(-) diff --git a/doc/src/platforms/platform-notes.qdoc b/doc/src/platforms/platform-notes.qdoc index 177d3f6..b745867 100644 --- a/doc/src/platforms/platform-notes.qdoc +++ b/doc/src/platforms/platform-notes.qdoc @@ -81,14 +81,11 @@ \header \o \o Concurrent \o XmlPatterns \o WebKit(*) \o CLucene \o Phonon \row \o g++ 3.3 \o \o \bold{X} \o \o \bold{X} \o \bold{X} \row \o g++ 3.4 and up \o \bold{X} \o \bold{X} \o \bold{X} \o \bold{X} \o \bold{X} - \row \row \o SunCC 5.5 \o \o \o \o \bold{X} \o \bold{X} - \row \row \o aCC series 3 \o \o \o \o \bold{X} \o \bold{X} \row \o aCC series 6 \o \bold{X} \o \bold{X} \o \bold{X} \o \bold{X} \o \bold{X} \row \o xlC 6 \o \o \o \o \bold{X} \o \bold{X} \row \o Intel CC 10 \o \bold{X} \o \bold{X} \o \bold{X} \o \bold{X} \o \bold{X} - \row \row \o MSVC 2003 \o \bold{X} \o \bold{X} \o \o \bold{X} \o \bold{X} \row \o MSVC 2005 and up \o \bold{X} \o \bold{X} \o \bold{X} \o \bold{X} \o \bold{X} \endtable -- cgit v0.12 From 3ee5edeff7890c3fc1099029320f0fb038e7f81d Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Thu, 9 Dec 2010 12:56:47 +0100 Subject: doc: Removed the \hr macro from the DITA XML qdocconf file. This eliminates some "raw-html" cases. --- tools/qdoc3/test/qt-ditaxml.qdocconf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/qdoc3/test/qt-ditaxml.qdocconf b/tools/qdoc3/test/qt-ditaxml.qdocconf index cc2937a..bc32149 100644 --- a/tools/qdoc3/test/qt-ditaxml.qdocconf +++ b/tools/qdoc3/test/qt-ditaxml.qdocconf @@ -20,7 +20,7 @@ macro.BR.DITAXML = " " macro.copyright.DITAXML = "©" macro.eacute.DITAXML = "é" macro.gui = "\\bold" -macro.hr.DITAXML = "
    " +macro.hr.DITAXML = " " macro.iacute.DITAXML = "í" macro.key = "\\bold" macro.menu = "\\bold" -- cgit v0.12 From bdaab918e08f244bf397b1179358d5a54553b4c9 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Thu, 9 Dec 2010 13:16:48 +0100 Subject: doc: Fixed the \raisedaster macro to write the element. But only for the special case of "*". Still, it got rid of a lot of raw-html cases. More to come here. --- tools/qdoc3/ditaxmlgenerator.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index abe247b..57a6e8d 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -1287,6 +1287,11 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, break; if (atom->string().startsWith("&")) writeCharacters(atom->string()); + else if (atom->string() == "*") { + xmlWriter().writeStartElement("sup"); + writeCharacters("*"); + xmlWriter().writeEndElement(); // + } else { xmlWriter().writeStartElement("pre"); xmlWriter().writeAttribute("outputclass","raw-html"); -- cgit v0.12 From ad68c845e3e368dc4235e64b54e15a9ee886b078 Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Thu, 9 Dec 2010 14:25:16 +0200 Subject: QLabel wraps text at fixed lengths There are multiple problems with text wrapping and dialogs. First, teh CBA height was assumed to be zero, or fetch from previous layout, which caused the dialog to be half under the CBA. Now, CBA height is always asked from AVKON metrics, since asking it from actual component might fail (or produce incorrect results) due to that the component is not created yet (or might still have previous layout active). Additionally, qinputDialog label is now having a size policy to restrict its growing out of dialog borders. Task-number: QT-4354 Reviewed-by: Janne Koskinen --- src/gui/dialogs/qdialog.cpp | 13 ++++++------- src/gui/dialogs/qinputdialog.cpp | 2 ++ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/gui/dialogs/qdialog.cpp b/src/gui/dialogs/qdialog.cpp index fbdc522..16ea045 100644 --- a/src/gui/dialogs/qdialog.cpp +++ b/src/gui/dialogs/qdialog.cpp @@ -901,15 +901,13 @@ bool QDialog::symbianAdjustedPosition() QPoint p; const bool doS60Positioning = !(isFullScreen()||isMaximized()); if (doS60Positioning) { + QPoint oldPos = pos(); // naive way to deduce screen orientation if (S60->screenHeightInPixels > S60->screenWidthInPixels) { int cbaHeight; - const CEikButtonGroupContainer* bgContainer = S60->buttonGroupContainer(); - if (!bgContainer) { - cbaHeight = 0; - } else { - cbaHeight = qt_TSize2QSize(bgContainer->Size()).height(); - } + TRect rect; + AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EControlPane, rect); + cbaHeight = rect.Height(); p.setY(S60->screenHeightInPixels - height() - cbaHeight); p.setX(0); } else { @@ -939,7 +937,8 @@ bool QDialog::symbianAdjustedPosition() p.setX(qMax(0,S60->screenWidthInPixels - width())); } } - move(p); + if (oldPos != p || p.y() < 0) + move(p); } return doS60Positioning; #else diff --git a/src/gui/dialogs/qinputdialog.cpp b/src/gui/dialogs/qinputdialog.cpp index ce27bd3..a29376a 100644 --- a/src/gui/dialogs/qinputdialog.cpp +++ b/src/gui/dialogs/qinputdialog.cpp @@ -234,6 +234,8 @@ void QInputDialogPrivate::ensureLayout() //we want to let the input dialog grow to available size on Symbian. #ifndef Q_OS_SYMBIAN mainLayout->setSizeConstraint(QLayout::SetMinAndMaxSize); +#else + label->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); #endif mainLayout->addWidget(label); mainLayout->addWidget(inputWidget); -- cgit v0.12 From 05f330b96deaec54c4cfd7c1a190e7d90d77a54d Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 9 Dec 2010 16:00:56 +0100 Subject: Used a different style class for areas containing QML markup. --- tools/qdoc3/htmlgenerator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 456654f..ba36d9c 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -489,7 +489,7 @@ int HtmlGenerator::generateAtom(const Atom *atom, break; #ifdef QDOC_QML case Atom::Qml: - out() << "
    "
    +        out() << "
    "
                   << trimmedTrailing(highlightedCode(indent(codeIndent,atom->string()),
                                                      marker,relative))
                   << "
    \n"; -- cgit v0.12 From 32292ebabf620200708d40fa8bfa43fc6562d716 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 9 Dec 2010 16:02:22 +0100 Subject: Removed redundant style information and images. --- tools/qdoc3/test/qt-html-default-styles.qdocconf | 26 ++++------------------ tools/qdoc3/test/qt-html-online-styles.qdocconf | 11 +++------ tools/qdoc3/test/qt-html-templates-online.qdocconf | 6 +---- tools/qdoc3/test/qt-html-templates.qdocconf | 20 ++--------------- 4 files changed, 10 insertions(+), 53 deletions(-) diff --git a/tools/qdoc3/test/qt-html-default-styles.qdocconf b/tools/qdoc3/test/qt-html-default-styles.qdocconf index 30c28cb..c9c02ea 100644 --- a/tools/qdoc3/test/qt-html-default-styles.qdocconf +++ b/tools/qdoc3/test/qt-html-default-styles.qdocconf @@ -4,43 +4,25 @@ HTML.templatedir = $QT_SOURCE_TREE/doc/src/template -HTML.stylesheets = style/style.css \ - style/narrow.css +HTML.stylesheets = style/style.css HTML.scripts = # Files not referenced in any qdoc file (last four needed by qtdemo) # See also qhp.Qt.extraFiles -extraimages.HTML = qt-logo \ - trolltech-logo \ - bg_l.png \ - bg_l_blank.png \ - bg_ll_blank.png \ - bg_ul_blank.png \ - header_bg.png \ - bg_r.png \ - box_bg.png \ +extraimages.HTML = qt-logo.png \ + arrow_down.png \ breadcrumb.png \ bullet_gt.png \ bullet_dn.png \ bullet_sq.png \ bullet_up.png \ - arrow_down.png \ - feedbackground.png \ horBar.png \ - page.png \ - page_bg.png \ - sprites-combined.png \ - spinner.gif \ - stylesheet-coffee-plastique.png \ - taskmenuextension-example.png \ - coloreditorfactoryimage.png \ - dynamiclayouts-example.png + sprites-combined.png # Include the style sheets and scripts used. HTML.headerstyles = \ - " \n" \ " \n" HTML.headerscripts = diff --git a/tools/qdoc3/test/qt-html-online-styles.qdocconf b/tools/qdoc3/test/qt-html-online-styles.qdocconf index 06f8964..6db3491 100644 --- a/tools/qdoc3/test/qt-html-online-styles.qdocconf +++ b/tools/qdoc3/test/qt-html-online-styles.qdocconf @@ -18,10 +18,9 @@ HTML.scripts = scripts/functions.js \ scripts/jquery.js -# Files not referenced in any qdoc file (last four needed by qtdemo) +# Files not referenced in any qdoc file. # See also qhp.Qt.extraFiles -extraimages.HTML = qt-logo \ - trolltech-logo \ +extraimages.HTML = qt-logo.png \ bg_l.png \ bg_l_blank.png \ bg_ll_blank.png \ @@ -40,11 +39,7 @@ extraimages.HTML = qt-logo \ page.png \ page_bg.png \ sprites-combined.png \ - spinner.gif \ - stylesheet-coffee-plastique.png \ - taskmenuextension-example.png \ - coloreditorfactoryimage.png \ - dynamiclayouts-example.png + spinner.gif # Include the style sheets and scripts used. diff --git a/tools/qdoc3/test/qt-html-templates-online.qdocconf b/tools/qdoc3/test/qt-html-templates-online.qdocconf index 1d55cee..bc7dbd2 100644 --- a/tools/qdoc3/test/qt-html-templates-online.qdocconf +++ b/tools/qdoc3/test/qt-html-templates-online.qdocconf @@ -198,7 +198,7 @@ HTML.footer = \ " \n" -# Files not referenced in any qdoc file (last four are needed by qtdemo) +# Files not referenced in any qdoc file. # See also extraimages.HTML qhp.Qt.extraFiles = index.html \ images/bg_l.png \ @@ -220,10 +220,6 @@ qhp.Qt.extraFiles = index.html \ images/page_bg.png \ images/sprites-combined.png \ images/spinner.gif \ - images/stylesheet-coffee-plastique.png \ - images/taskmenuextension-example.png \ - images/coloreditorfactoryimage.png \ - images/dynamiclayouts-example.png \ scripts/functions.js \ scripts/jquery.js \ scripts/narrow.js \ diff --git a/tools/qdoc3/test/qt-html-templates.qdocconf b/tools/qdoc3/test/qt-html-templates.qdocconf index 67ce95a..8241fa0 100644 --- a/tools/qdoc3/test/qt-html-templates.qdocconf +++ b/tools/qdoc3/test/qt-html-templates.qdocconf @@ -47,31 +47,15 @@ HTML.footer = \ " as published by the Free Software Foundation.

    \n" \ "
    \n" \ -# Files not referenced in any qdoc file (last four are needed by qtdemo) +# Files not referenced in any qdoc file. # See also extraimages.HTML qhp.Qt.extraFiles = index.html \ - images/bg_l.png \ - images/bg_l_blank.png \ - images/bg_ll_blank.png \ - images/bg_ul_blank.png \ - images/header_bg.png \ - images/bg_r.png \ - images/box_bg.png \ + images/arrow_down.png \ images/breadcrumb.png \ images/bullet_gt.png \ images/bullet_dn.png \ images/bullet_sq.png \ images/bullet_up.png \ - images/arrow_down.png \ - images/feedbackground.png \ images/horBar.png \ - images/page.png \ - images/page_bg.png \ images/sprites-combined.png \ - images/spinner.gif \ - images/stylesheet-coffee-plastique.png \ - images/taskmenuextension-example.png \ - images/coloreditorfactoryimage.png \ - images/dynamiclayouts-example.png \ - style/narrow.css \ style/style.css -- cgit v0.12 From 77f069df4dcfd40a3d009f40e074ce1a5ac132c1 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 9 Dec 2010 19:38:01 +0100 Subject: Added hack to remove markup for opened comments at the end of snippets. --- tools/qdoc3/quoter.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/qdoc3/quoter.cpp b/tools/qdoc3/quoter.cpp index 6dc7894..84c6fb1 100644 --- a/tools/qdoc3/quoter.cpp +++ b/tools/qdoc3/quoter.cpp @@ -235,10 +235,14 @@ QString Quoter::quoteSnippet(const Location &docLocation, const QString &identif QString lastLine = getLine(); int dIndex = lastLine.indexOf(delimiter); if (dIndex > 0) { + // The delimiter might be preceded on the line by other + // delimeters, so look for the first comment on the line. QString leading = lastLine.left(dIndex); dIndex = leading.indexOf(comment); if (dIndex != -1) leading = leading.left(dIndex); + if (leading.endsWith(QLatin1String("<@comment>"))) + leading.chop(10); if (!leading.trimmed().isEmpty()) t += leading; } -- cgit v0.12 From 297da17b94df6cd4a3b0c4ade56baf55310939e8 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 9 Dec 2010 19:39:35 +0100 Subject: Ensured that object definition identifiers are marked up as links. It may be worthwhile extending this to other UiQualifiedId nodes. --- tools/qdoc3/qmlmarkupvisitor.cpp | 14 +++++++++++--- tools/qdoc3/qmlmarkupvisitor.h | 3 ++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/tools/qdoc3/qmlmarkupvisitor.cpp b/tools/qdoc3/qmlmarkupvisitor.cpp index 6bede96..9916be2 100644 --- a/tools/qdoc3/qmlmarkupvisitor.cpp +++ b/tools/qdoc3/qmlmarkupvisitor.cpp @@ -183,7 +183,8 @@ void QmlMarkupVisitor::addExtra(quint32 start, quint32 finish) } void QmlMarkupVisitor::addMarkedUpToken( - QDeclarativeJS::AST::SourceLocation &location, const QString &tagName) + QDeclarativeJS::AST::SourceLocation &location, const QString &tagName, + const QHash &attributes) { if (!location.isValid()) return; @@ -193,7 +194,10 @@ void QmlMarkupVisitor::addMarkedUpToken( else if (cursor > location.offset) return; - output += QString(QLatin1String("<@%1>%2")).arg(tagName, protect(sourceText(location)), tagName); + output += QString(QLatin1String("<@%1")).arg(tagName); + foreach (const QString &key, attributes) + output += QString(QLatin1String(" %1=\"%2\"")).arg(key).arg(attributes[key]); + output += QString(QLatin1String(">%2")).arg(protect(sourceText(location)), tagName); cursor += location.length; } @@ -853,9 +857,13 @@ bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::DebuggerStatement *statement) return true; } +// Elements and items are represented by UiObjectDefinition nodes. + bool QmlMarkupVisitor::visit(QDeclarativeJS::AST::UiObjectDefinition *definition) { - QDeclarativeJS::AST::Node::accept(definition->qualifiedTypeNameId, this); + QHash attributes; + attributes[QLatin1String("node")] = sourceText(definition->qualifiedTypeNameId->identifierToken); + addMarkedUpToken(definition->qualifiedTypeNameId->identifierToken, QLatin1String("link"), attributes); QDeclarativeJS::AST::Node::accept(definition->initializer, this); return false; } diff --git a/tools/qdoc3/qmlmarkupvisitor.h b/tools/qdoc3/qmlmarkupvisitor.h index 7a9ff22..60bc336 100644 --- a/tools/qdoc3/qmlmarkupvisitor.h +++ b/tools/qdoc3/qmlmarkupvisitor.h @@ -161,7 +161,8 @@ protected: private: void addExtra(quint32 start, quint32 finish); void addMarkedUpToken(QDeclarativeJS::AST::SourceLocation &location, - const QString &text); + const QString &text, + const QHash &attributes = QHash()); void addVerbatim(QDeclarativeJS::AST::SourceLocation first, QDeclarativeJS::AST::SourceLocation last = QDeclarativeJS::AST::SourceLocation()); QString sourceText(QDeclarativeJS::AST::SourceLocation &location); -- cgit v0.12 From 4b8b0321828bd1175534ff3b883956c5b97f9399 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 9 Dec 2010 19:41:10 +0100 Subject: Doc: Temporarily used \qml...\endqml markup for the QML introduction. --- doc/src/declarative/qdeclarativeintro.qdoc | 75 +++++++++++++----------------- 1 file changed, 32 insertions(+), 43 deletions(-) diff --git a/doc/src/declarative/qdeclarativeintro.qdoc b/doc/src/declarative/qdeclarativeintro.qdoc index 4e41fda..299ec73 100644 --- a/doc/src/declarative/qdeclarativeintro.qdoc +++ b/doc/src/declarative/qdeclarativeintro.qdoc @@ -45,7 +45,7 @@ technologies like HTML and CSS, but it's not required. QML looks like this: -\code +\qml import QtQuick 1.0 Rectangle { @@ -58,7 +58,7 @@ Rectangle { anchors.centerIn: parent } } -\endcode +\endqml Objects are specified by their type, followed by a pair of braces. Object types always begin with a capital letter. In the above example, there are @@ -71,18 +71,18 @@ value \c "pics/logo.png". The property and its value are separated by a colon. Properties can be specified one-per-line: -\code +\qml Rectangle { width: 100 height: 100 } -\endcode +\endqml or you can put multiple properties on a single line: -\code +\qml Rectangle { width: 100; height: 100 } -\endcode +\endqml When multiple property/value pairs are specified on a single line, they must be separated by a semicolon. @@ -96,17 +96,17 @@ and \l Image elements would not be available. In addition to assigning values to properties, you can also assign expressions written in JavaScript. -\code +\qml Rotation { angle: 360 * 3 } -\endcode +\endqml These expressions can include references to other objects and properties, in which case a \e binding is established: when the value of the expression changes, the property the expression has been assigned to is automatically updated to that value. -\code +\qml Item { Text { id: text1 @@ -117,7 +117,7 @@ Item { text: text1.text } } -\endcode +\endqml In the example above, the \c text2 object will display the same text as \c text1. If \c text1 is changed, \c text2 is automatically changed to the same value. @@ -142,12 +142,12 @@ your QML files. Comments can also be used to prevent the execution of code, which is sometimes useful for tracking down problems. -\code +\qml Text { text: "Hello world!" //opacity: 0.5 } -\endcode +\endqml In the above example, the Text object will have normal opacity, since the line opacity: 0.5 has been turned into a comment. @@ -164,14 +164,14 @@ Properties begin with a lowercase letter (with the exception of \l{Attached Prop QML supports properties of many types (see \l{QML Basic Types}). The basic types include int, real, bool, string, color, and lists. -\code +\qml Item { x: 10.5 // a 'real' property - ... + // ... state: "details" // a 'string' property focus: true // a 'bool' property } -\endcode +\endqml QML properties are what is known as \e type-safe. That is, they only allow you to assign a value that matches the property type. For example, the \c x property of item is a real, and if you try to assign @@ -193,7 +193,7 @@ The first Rectangle element below has an \e id, "myRect". The second Rectangle e own width by referring to \tt myRect.width, which means it will have the same \tt width value as the first Rectangle element. -\code +\qml Item { Rectangle { id: myRect @@ -205,7 +205,7 @@ Item { height: 200 } } -\endcode +\endqml Note that an \e id must begin with a lower-case letter or an underscore, and cannot contain characters other than letters, numbers and underscores. @@ -214,24 +214,24 @@ Note that an \e id must begin with a lower-case letter or an underscore, and can List properties look like this: -\code +\qml Item { children: [ Image {}, Text {} ] } -\endcode +\endqml The list is enclosed in square brackets, with a comma separating the list elements. In cases where you are only assigning a single item to a list, you can omit the square brackets: -\code +\qml Image { children: Rectangle {} } -\endcode +\endqml Items in the list can be accessed by index. See the \l{list}{list type} documentation for more details about list properties and their available operations. @@ -243,23 +243,23 @@ Each object type can specify one of its list or object properties as its default If a property has been declared as the default property, the property tag can be omitted. For example this code: -\code +\qml State { changes: [ PropertyChanges {}, PropertyChanges {} ] } -\endcode +\endqml can be simplified to: -\code +\qml State { PropertyChanges {} PropertyChanges {} } -\endcode +\endqml because \c changes is the default property of the \c State type. @@ -294,18 +294,7 @@ are of the form \e {Type.property} where \e Type is the type of the element that attaches \e property. For example: -\code -Component { - id: myDelegate - Text { - text: "Hello" - color: ListView.isCurrentItem ? "red" : "blue" - } -} -ListView { - delegate: myDelegate -} -\endcode +\snippet doc/src/snippets/declarative/introduction-qml/attachedproperties1.qml component and list view The \l ListView element attaches the \e ListView.isCurrentItem property to each delegate it creates. @@ -314,12 +303,12 @@ Another example of attached properties is the \l Keys element which attaches properties for handling key presses to any visual Item, for example: -\code +\qml Item { focus: true Keys.onSelectPressed: console.log("Selected") } -\endcode +\endqml \section2 Signal Handlers @@ -327,23 +316,23 @@ Signal handlers allow actions to be taken in response to an event. For instance the \l MouseArea element has signal handlers to handle mouse press, release and click: -\code +\qml MouseArea { onPressed: console.log("mouse button pressed") } -\endcode +\endqml All signal handlers begin with \e "on". Some signal handlers include an optional parameter, for example the MouseArea onPressed signal handler has a \e mouse parameter: -\code +\qml MouseArea { acceptedButtons: Qt.LeftButton | Qt.RightButton onPressed: if (mouse.button == Qt.RightButton) console.log("Right mouse button pressed") } -\endcode +\endqml */ -- cgit v0.12 From bb07641213dfc4c949707500c3d665fae5f4b9f0 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Tue, 7 Dec 2010 14:19:43 +1000 Subject: QDeclarativeProperty doc improvements --- src/declarative/qml/qdeclarativeproperty.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/declarative/qml/qdeclarativeproperty.cpp b/src/declarative/qml/qdeclarativeproperty.cpp index df0917f..60edd64 100644 --- a/src/declarative/qml/qdeclarativeproperty.cpp +++ b/src/declarative/qml/qdeclarativeproperty.cpp @@ -77,15 +77,28 @@ a property on a specific object instance. To read a property's value, programme QDeclarativeProperty instance and call the read() method. Likewise to write a property value the write() method is used. +For example, for the following QML code: + +\qml +// MyItem.qml +import QtQuick 1.0 + +Text { text: "A bit of text" } +\endqml + +The \l Text object's properties could be accessed using QDeclarativeProperty, like this: + \code +#include +#include -QObject *object = declarativeComponent.create(); +... -QDeclarativeProperty property(object, "font.pixelSize"); +QDeclarativeView view(QUrl::fromLocalFile("MyItem.qml")); +QDeclarativeProperty property(view.rootObject(), "font.pixelSize"); qWarning() << "Current pixel size:" << property.read().toInt(); property.write(24); qWarning() << "Pixel size should now be 24:" << property.read().toInt(); - \endcode */ -- cgit v0.12 From b8da3a08945091d077d3096efae23d613b24210b Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Thu, 9 Dec 2010 14:23:42 +1000 Subject: Improvements to anchoring docs Make it clear that anchor margins only apply to anchors. Also document that anchor and absolute positioning cannot be mixed. --- doc/src/declarative/anchor-layout.qdoc | 66 ++++++++++++++++------ src/declarative/graphicsitems/qdeclarativeitem.cpp | 2 + 2 files changed, 51 insertions(+), 17 deletions(-) diff --git a/doc/src/declarative/anchor-layout.qdoc b/doc/src/declarative/anchor-layout.qdoc index b77ce36..f5d5697 100644 --- a/doc/src/declarative/anchor-layout.qdoc +++ b/doc/src/declarative/anchor-layout.qdoc @@ -30,6 +30,8 @@ \target anchor-layout \title Anchor-based Layout in QML +\section1 Overview + In addition to the more traditional \l Grid, \l Row, and \l Column, QML also provides a way to layout items using the concept of \e anchors. Each item can be thought of as having a set of 7 invisible "anchor lines": @@ -54,20 +56,6 @@ In this case, the left edge of \e rect2 is bound to the right edge of \e rect1, \image edge1.png -The anchoring system also allows you to specify margins and offsets. Margins specify the amount of empty space to leave to the outside of an item, while offsets allow you to manipulate positioning using the center anchor lines. Note that margins specified using the anchor layout system only have meaning for anchors; they won't have any effect when using other layouts or absolute positioning. - -\image margins_qml.png - -The following example specifies a left margin: - -\code -Rectangle { id: rect1; ... } -Rectangle { id: rect2; anchors.left: rect1.right; anchors.leftMargin: 5; ... } -\endcode - -In this case, a margin of 5 pixels is reserved to the left of \e rect2, producing the following: - -\image edge2.png You can specify multiple anchors. For example: @@ -78,7 +66,9 @@ Rectangle { id: rect2; anchors.left: rect1.right; anchors.top: rect1.bottom; ... \image edge3.png -By specifying multiple horizontal or vertical anchors you can control the size of an item. For example: +By specifying multiple horizontal or vertical anchors you can control the size of an item. Below, +\e rect2 is anchored to the right of \e rect1 and the left of \e rect3. If either of the blue +rectangles are moved, \e rect2 will stretch and shrink as necessary: \code Rectangle { id: rect1; x: 0; ... } @@ -88,9 +78,42 @@ Rectangle { id: rect3; x: 150; ... } \image edge4.png -\section1 Limitations -For performance reasons, you can only anchor an item to its siblings and direct parent. For example, the following anchor would be considered invalid and would produce a warning: +\section1 Anchor Margins and Offsets + +The anchoring system also allows \e margins and \e offsets to be specified for an item's anchors. +Margins specify the amount of empty space to leave to the outside of an item's anchor, while +offsets allow positioning to be manipulated using the center anchor lines. An item can +specify its anchor margins individually through \l {Item::anchors.leftMargin}{leftMargin}, +\l {Item::anchors.rightMargin}{rightMargin}, \l {Item::anchors.topMargin}{topMargin} and +\l {Item::anchors.bottomMargin}{bottomMargin}, or use \l {Item::}{anchors.margins} to +specify the same margin value for all four edges. Anchor offsets are specified using +\l {Item::anchors.horizontalCenterOffset}{horizontalCenterOffset}, +\l {Item::anchors.verticalCenterOffset}{verticalCenterOffset} and +\l {Item::anchors.baselineOffset}{baselineOffset}. + +\image margins_qml.png + +The following example specifies a left margin: + +\code +Rectangle { id: rect1; ... } +Rectangle { id: rect2; anchors.left: rect1.right; anchors.leftMargin: 5; ... } +\endcode + +In this case, a margin of 5 pixels is reserved to the left of \e rect2, producing the following: + +\image edge2.png + +\note Anchor margins only apply to anchors; they are \e not a generic means of applying margins to an \l Item. +If an anchor margin is specified for an edge but the item is not anchored to any item on that +edge, the margin is not applied. + + +\section1 Restrictions + +For performance reasons, you can only anchor an item to its siblings and direct parent. For example, +the following anchor is invalid and would produce a warning: \badcode Item { @@ -103,4 +126,13 @@ Item { } \endcode +Also, anchor-based layouts cannot be mixed with absolute positioning. If an item specifies its +\l {Item::}{x} position and also sets \l {Item::}{anchors.left}, +or anchors its left and right edges but additionally sets a \l {Item::}{width}, the +result is undefined, as it would not be clear whether the item should use anchoring or absolute +positioning. The same can be said for setting an item's \l {Item::}{y} and \l {Item::}{height} +with \l {Item::}{anchors.top} and \l {Item::}{anchors.bottom}, or setting \l {Item::}{anchors.fill} +as well as \l {Item::}{width} or \l {Item::}{height}. If you wish to change from using +anchor-based to absolute positioning, you can clear an anchor value by setting it to \c undefined. + */ diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp index 932e68f..75e4a0b 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp @@ -2112,6 +2112,8 @@ QDeclarativeAnchorLine QDeclarativeItemPrivate::baseline() const Margins apply to top, bottom, left, right, and fill anchors. The \c anchors.margins property can be used to set all of the various margins at once, to the same value. + Note that margins are anchor-specific and are not applied if an item does not + use anchors. Offsets apply for horizontal center, vertical center, and baseline anchors. -- cgit v0.12 From a0fabfac2ddd0b4e52a1d06623a0864f836cba71 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Fri, 10 Dec 2010 14:22:45 +1000 Subject: Fix broken database creation caused by previous fix 16447b1193fedf5fdcf1f3d270fa73c5036a1ba0 removed unused directory but the fix meant that the base Databases directory was no longer automatically created. Task-number: QTBUG-15909 --- src/declarative/qml/qdeclarativesqldatabase.cpp | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/src/declarative/qml/qdeclarativesqldatabase.cpp b/src/declarative/qml/qdeclarativesqldatabase.cpp index 3f53111..bda02a5 100644 --- a/src/declarative/qml/qdeclarativesqldatabase.cpp +++ b/src/declarative/qml/qdeclarativesqldatabase.cpp @@ -172,16 +172,23 @@ static const char* sqlerror[] = { return errorValue; \ } - -static QString databaseFile(const QString& connectionName, QScriptEngine *engine) +static QString qmlsqldatabase_databasesPath(QScriptEngine *engine) { QDeclarativeScriptEngine *qmlengine = static_cast(engine); - QString basename = qmlengine->offlineStoragePath - + QDir::separator() + QLatin1String("Databases") + QDir::separator(); - basename += connectionName; - return basename; + return qmlengine->offlineStoragePath + + QDir::separator() + QLatin1String("Databases"); } +static void qmlsqldatabase_initDatabasesPath(QScriptEngine *engine) +{ + QDir().mkpath(qmlsqldatabase_databasesPath(engine)); +} + +static QString qmlsqldatabase_databaseFile(const QString& connectionName, QScriptEngine *engine) +{ + return qmlsqldatabase_databasesPath(engine) + QDir::separator() + + connectionName; +} static QScriptValue qmlsqldatabase_item(QScriptContext *context, QScriptEngine *engine) @@ -302,7 +309,7 @@ static QScriptValue qmlsqldatabase_change_version(QScriptContext *context, QScri if (ok) { context->thisObject().setProperty(QLatin1String("version"), to_version, QScriptValue::ReadOnly); - QSettings ini(databaseFile(db.connectionName(),engine)+QLatin1String(".ini"),QSettings::IniFormat); + QSettings ini(qmlsqldatabase_databaseFile(db.connectionName(),engine) + QLatin1String(".ini"), QSettings::IniFormat); ini.setValue(QLatin1String("Version"), to_version); } @@ -348,6 +355,8 @@ static QScriptValue qmlsqldatabase_read_transaction(QScriptContext *context, QSc */ static QScriptValue qmlsqldatabase_open_sync(QScriptContext *context, QScriptEngine *engine) { + qmlsqldatabase_initDatabasesPath(engine); + QSqlDatabase database; QString dbname = context->argument(0).toString(); @@ -360,7 +369,7 @@ static QScriptValue qmlsqldatabase_open_sync(QScriptContext *context, QScriptEng md5.addData(dbname.toUtf8()); QString dbid(QLatin1String(md5.result().toHex())); - QString basename = databaseFile(dbid,engine); + QString basename = qmlsqldatabase_databaseFile(dbid, engine); bool created = false; QString version = dbversion; -- cgit v0.12 From 1de4983c86a73913bd2d719ad765726530009979 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Fri, 10 Dec 2010 15:34:52 +1000 Subject: PathView: removing the currentIndex could make it invalid. Removing the currentIndex could result in currentIndex being > than the number of items in the model. Task-number: QTBUG-15926 Reviewed-by: Michael Brasser --- src/declarative/graphicsitems/qdeclarativepathview.cpp | 2 +- .../declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/declarative/graphicsitems/qdeclarativepathview.cpp b/src/declarative/graphicsitems/qdeclarativepathview.cpp index 7c79afe..87ea214 100644 --- a/src/declarative/graphicsitems/qdeclarativepathview.cpp +++ b/src/declarative/graphicsitems/qdeclarativepathview.cpp @@ -1478,7 +1478,7 @@ void QDeclarativePathView::itemsRemoved(int modelIndex, int count) currentChanged = true; } else if (d->currentIndex >= modelIndex && d->currentIndex < modelIndex + count) { // current item has been removed. - d->currentIndex = qMin(modelIndex, d->modelCount-1); + d->currentIndex = qMin(modelIndex, d->modelCount-count-1); if (d->currentItem) { if (QDeclarativePathViewAttached *att = d->attached(d->currentItem)) att->setIsCurrentItem(true); diff --git a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp index a2a5363..9193707 100644 --- a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp +++ b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp @@ -429,6 +429,10 @@ void tst_QDeclarativePathView::dataModel() pathview->setOffset(0); QCOMPARE(findItems(pathview, "wrapper").count(), 5); + pathview->setCurrentIndex(model.count()-1); + model.removeItem(model.count()-1); + QCOMPARE(pathview->currentIndex(), model.count()-1); + delete canvas; } -- cgit v0.12 From 9d8dac4e4509795b6af8a5885f6e9f1a3ccbaa06 Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Fri, 10 Dec 2010 11:12:23 +0200 Subject: QDateTimeEdit is not showing correctly when resizes in symbian The problem boils down to using large square area for QDateTime widget (which is more or less a date-aware combobox). Style tries to make the combobox button as wide as it is tall, and as button is as tall as the combobox frame, it steals the whole square widget for itself. To fix this, we now limit the combobox button height to be no more than fourth of the total width of the widget. Thus, in normal, non-resized case, button is, as tall as the frame, but as widget is made larger, button stops to grow after reaching quarter of width of the widget. Task-number: QT-4312 Reviewed-by: Janne Koskinen --- src/gui/styles/qs60style.cpp | 38 ++++++++++++++++---------------------- 1 file changed, 16 insertions(+), 22 deletions(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 2f09529..3c715b7 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -104,11 +104,11 @@ const int QS60StylePrivate::m_numberOfLayouts = const short QS60StylePrivate::data[][MAX_PIXELMETRICS] = { // *** generated pixel metrics *** -{5,0,-909,0,0,2,0,0,-1,7,12,22,15,15,7,198,-909,-909,-909,20,13,2,0,0,21,7,18,30,3,3,1,-909,-909,0,1,0,0,12,20,15,15,18,18,1,115,18,0,-909,-909,-909,-909,0,0,16,2,-909,0,0,-909,16,-909,-909,-909,-909,32,18,55,24,55,4,4,4,9,13,-909,5,51,11,5,0,3,3,6,8,3,3,-909,2,-909,-909,-909,-909,5,5,3,1,106}, -{5,0,-909,0,0,1,0,0,-1,8,14,22,15,15,7,164,-909,-909,-909,19,15,2,0,0,21,8,27,28,4,4,1,-909,-909,0,7,6,0,13,23,17,17,21,21,7,115,21,0,-909,-909,-909,-909,0,0,15,1,-909,0,0,-909,15,-909,-909,-909,-909,32,21,65,27,65,3,3,5,10,15,-909,5,58,13,5,0,4,4,7,9,4,4,-909,2,-909,-909,-909,-909,6,6,3,1,106}, -{7,0,-909,0,0,2,0,0,-1,25,69,46,37,37,9,258,-909,-909,-909,23,19,26,0,0,32,25,72,44,5,5,2,-909,-909,0,7,21,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,25,2,-909,0,0,-909,25,-909,-909,-909,-909,87,27,77,35,77,13,3,6,8,19,-909,7,74,19,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1,135}, -{7,0,-909,0,0,2,0,0,-1,25,68,46,37,37,9,258,-909,-909,-909,31,19,6,0,0,32,25,60,52,5,5,2,-909,-909,0,7,32,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,26,2,-909,0,0,-909,26,-909,-909,-909,-909,87,27,96,35,96,12,3,6,8,19,-909,7,74,22,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1,135}, -{7,0,-909,0,0,2,0,0,-1,10,20,27,18,18,9,301,-909,-909,-909,29,18,5,0,0,35,7,32,30,5,5,2,-909,-909,0,2,8,0,16,28,21,21,26,26,2,170,26,0,-909,-909,-909,-909,0,0,21,6,-909,0,0,-909,-909,-909,-909,-909,-909,54,26,265,34,265,5,5,6,3,18,-909,7,72,19,7,0,5,6,8,11,6,5,-909,2,-909,-909,-909,-909,5,5,3,1,106} +{5,0,-909,0,0,2,0,2,-1,7,12,22,15,15,7,198,-909,-909,-909,20,13,2,0,0,21,7,18,30,3,3,1,-909,-909,0,1,0,0,12,20,15,15,18,18,1,115,18,0,-909,-909,-909,-909,0,0,16,2,-909,0,0,-909,16,-909,-909,-909,-909,32,18,55,24,55,4,4,4,9,13,-909,5,51,11,5,0,3,3,6,8,3,3,-909,2,-909,-909,-909,-909,5,5,3,1,106}, +{5,0,-909,0,0,1,0,2,-1,8,14,22,15,15,7,164,-909,-909,-909,19,15,2,0,0,21,8,27,28,4,4,1,-909,-909,0,7,6,0,13,23,17,17,21,21,7,115,21,0,-909,-909,-909,-909,0,0,15,1,-909,0,0,-909,15,-909,-909,-909,-909,32,21,65,27,65,3,3,5,10,15,-909,5,58,13,5,0,4,4,7,9,4,4,-909,2,-909,-909,-909,-909,6,6,3,1,106}, +{7,0,-909,0,0,2,0,5,-1,25,69,46,37,37,9,258,-909,-909,-909,23,19,26,0,0,32,25,72,44,5,5,2,-909,-909,0,7,21,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,25,2,-909,0,0,-909,25,-909,-909,-909,-909,87,27,77,35,77,13,3,6,8,19,-909,7,74,19,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1,135}, +{7,0,-909,0,0,2,0,5,-1,25,68,46,37,37,9,258,-909,-909,-909,31,19,6,0,0,32,25,60,52,5,5,2,-909,-909,0,7,32,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,26,2,-909,0,0,-909,26,-909,-909,-909,-909,87,27,96,35,96,12,3,6,8,19,-909,7,74,22,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1,135}, +{7,0,-909,0,0,2,0,2,-1,10,20,27,18,18,9,301,-909,-909,-909,29,18,5,0,0,35,7,32,30,5,5,2,-909,-909,0,2,8,0,16,28,21,21,26,26,2,170,26,0,-909,-909,-909,-909,0,0,21,6,-909,0,0,-909,-909,-909,-909,-909,-909,54,26,265,34,265,5,5,6,3,18,-909,7,72,19,7,0,5,6,8,11,6,5,-909,2,-909,-909,-909,-909,5,5,3,1,106} // *** End of generated data *** }; @@ -1071,11 +1071,11 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom // Button frame QStyleOptionFrame buttonOption; buttonOption.QStyleOption::operator=(*cmb); - const int maxHeight = cmbxFrame.height(); - const int maxWidth = cmbxFrame.width() - cmbxEditField.width(); + const int maxButtonSide = cmbxFrame.width() - cmbxEditField.width(); + const int newTop = cmbxEditField.center().y() - maxButtonSide / 2; const int topLeftPoint = direction ? - (cmbxEditField.right() + 1) : (cmbxEditField.left() + 1 - maxWidth); - const QRect buttonRect(topLeftPoint, cmbxEditField.top(), maxWidth, maxHeight); + (cmbxEditField.right() + 1) : (cmbxEditField.left() + 1 - maxButtonSide); + const QRect buttonRect(topLeftPoint, newTop, maxButtonSide, maxButtonSide); buttonOption.rect = buttonRect; buttonOption.state = cmb->state; drawPrimitive(PE_PanelButtonCommand, &buttonOption, painter, widget); @@ -2884,30 +2884,24 @@ QRect QS60Style::subControlRect(ComplexControl control, const QStyleOptionComple ret = cmb->rect; const int width = cmb->rect.width(); const int height = cmb->rect.height(); - const int buttonIconSize = QS60StylePrivate::pixelMetric(PM_ButtonIconSize); const int buttonMargin = cmb->frame ? 2 : 0; // lets use spinbox frame here as well, as no combobox specific value available. const int frameThickness = cmb->frame ? pixelMetric(PM_SpinBoxFrameWidth, cmb, widget) : 0; - const int buttonWidth = qMax(cmb->rect.height(), buttonIconSize); - + const int buttonMinSize = QS60StylePrivate::pixelMetric(PM_ButtonIconSize) + 2 * buttonMargin; QSize buttonSize; - buttonSize.setWidth(buttonWidth + 2 * buttonMargin); - buttonSize.setHeight(qMax(8, (cmb->rect.height() >> 1) - frameThickness)); //buttons should be squares + //allow button to grow to one fourth of the frame height, if the frame is really tall + buttonSize.setHeight(qMin(height, qMax(width / 4, buttonMinSize))); + buttonSize.setWidth(buttonSize.height()); buttonSize = buttonSize.expandedTo(QApplication::globalStrut()); switch (scontrol) { case SC_ComboBoxArrow: { - const int xposMod = cmb->rect.x() + width - buttonMargin - buttonWidth; + const int xposMod = cmb->rect.x() + width - buttonMargin - buttonSize.width(); const int ypos = cmb->rect.y(); - ret.setRect(xposMod, ypos + buttonMargin, buttonWidth, height - 2 * buttonMargin); + ret.setRect(xposMod, ypos + buttonMargin, buttonSize.width(), height - 2 * buttonMargin); } break; case SC_ComboBoxEditField: { - const int withFrameX = cmb->rect.x() + width - frameThickness - buttonSize.width(); - ret = QRect( - frameThickness, - frameThickness, - withFrameX - frameThickness, - height - 2 * frameThickness); + ret = QRect(0, 0, cmb->rect.x() + width - buttonSize.width(), height); } break; case SC_ComboBoxListBoxPopup: { -- cgit v0.12 From f2ab8acd583941dcd673c627ff03d25e519e1f6b Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Fri, 10 Dec 2010 11:34:45 +0200 Subject: Fix whitespace in qs60style.cpp Reviewed-by: TrustMe --- src/gui/styles/qs60style.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 3c715b7..56d2d19 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -2889,7 +2889,7 @@ QRect QS60Style::subControlRect(ComplexControl control, const QStyleOptionComple const int frameThickness = cmb->frame ? pixelMetric(PM_SpinBoxFrameWidth, cmb, widget) : 0; const int buttonMinSize = QS60StylePrivate::pixelMetric(PM_ButtonIconSize) + 2 * buttonMargin; QSize buttonSize; - //allow button to grow to one fourth of the frame height, if the frame is really tall + //allow button to grow to one fourth of the frame height, if the frame is really tall buttonSize.setHeight(qMin(height, qMax(width / 4, buttonMinSize))); buttonSize.setWidth(buttonSize.height()); buttonSize = buttonSize.expandedTo(QApplication::globalStrut()); -- cgit v0.12 From 38856b7ca5ec18b0292dd3dd11d8ea42fea361e6 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Fri, 10 Dec 2010 10:43:57 +0100 Subject: QmlViewer: Fix crash on exit We can't use atexit() handler to show a warning, since whether the QApplication object then still exists or not is undefined. Instead, call the method directly where it makes sense (warnings about command line arguments etc). Task-number: QTBUG-15740 Reviewed-by: Thomas Hartmann --- tools/qml/main.cpp | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp index 209c72f..104f7b7 100644 --- a/tools/qml/main.cpp +++ b/tools/qml/main.cpp @@ -86,14 +86,16 @@ void myMessageOutput(QtMsgType type, const char *msg) QWeakPointer logger; QString warnings; -void showWarnings() +void exitApp(int i) { +#ifdef Q_OS_WIN + // Debugging output is not visible by default on Windows - + // therefore show modal dialog with errors instead. if (!warnings.isEmpty()) { - int argc = 0; char **argv = 0; - QApplication application(argc, argv); // QApplication() in main has been destroyed already. - Q_UNUSED(application) QMessageBox::warning(0, QApplication::tr("Qt QML Viewer"), warnings); } +#endif + exit(i); } static QAtomicInt recursiveLock(0); @@ -102,14 +104,16 @@ void myMessageOutput(QtMsgType type, const char *msg) { QString strMsg = QString::fromLatin1(msg); - if (!logger.isNull() && !QCoreApplication::closingDown()) { - if (recursiveLock.testAndSetOrdered(0, 1)) { - QMetaObject::invokeMethod(logger.data(), "append", Q_ARG(QString, strMsg)); - recursiveLock = 0; + if (!QCoreApplication::closingDown()) { + if (!logger.isNull()) { + if (recursiveLock.testAndSetOrdered(0, 1)) { + QMetaObject::invokeMethod(logger.data(), "append", Q_ARG(QString, strMsg)); + recursiveLock = 0; + } + } else { + warnings += strMsg; + warnings += QLatin1Char('\n'); } - } else { - warnings += strMsg; - warnings += QLatin1Char('\n'); } if (systemMsgOutput) { // Windows systemMsgOutput(type, msg); @@ -165,7 +169,8 @@ void usage() qWarning(" "); qWarning(" Press F1 for interactive help"); - exit(1); + + exitApp(1); } void scriptOptsUsage() @@ -184,7 +189,8 @@ void scriptOptsUsage() qWarning(" saveonexit ............................... save recording on viewer exit"); qWarning(" "); qWarning(" One of record, play or both must be specified."); - exit(1); + + exitApp(1); } enum WarningsConfig { ShowWarnings, HideWarnings, DefaultWarnings }; @@ -370,7 +376,7 @@ static void parseCommandLineOptions(const QStringList &arguments) qApp->setStartDragDistance(arguments.at(++i).toInt()); } else if (arg == QLatin1String("-v") || arg == QLatin1String("-version")) { qWarning("Qt QML Viewer version %s", QT_VERSION_STR); - exit(0); + exitApp(0); } else if (arg == "-translation") { if (lastArg) usage(); opts.translationFile = arguments.at(++i); @@ -400,7 +406,7 @@ static void parseCommandLineOptions(const QStringList &arguments) QDeclarativeEngine tmpEngine; QString paths = tmpEngine.importPathList().join(QLatin1String(":")); qWarning("Current search path: %s", paths.toLocal8Bit().constData()); - exit(0); + exitApp(0); } opts.imports << arguments.at(++i); } else if (arg == "-P") { @@ -529,12 +535,6 @@ int main(int argc, char ** argv) systemMsgOutput = qInstallMsgHandler(myMessageOutput); #endif -#if defined (Q_OS_WIN) - // Debugging output is not visible by default on Windows - - // therefore show modal dialog with errors instead. - atexit(showWarnings); -#endif - #if defined (Q_WS_X11) || defined (Q_WS_MAC) //### default to using raster graphics backend for now bool gsSpecified = false; -- cgit v0.12 From 240c33480ea300a78416205602af293d5c223ee2 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Fri, 10 Dec 2010 11:17:33 +0100 Subject: QmlViewer: Remove trailing whitespace --- tools/qml/browser/Browser.qml | 2 +- tools/qml/deviceorientation.h | 4 ++-- tools/qml/qdeclarativetester.cpp | 16 ++++++++-------- tools/qml/qdeclarativetester.h | 4 ++-- tools/qml/qmlruntime.cpp | 4 ++-- tools/qml/startup/startup.qml | 6 +++--- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/tools/qml/browser/Browser.qml b/tools/qml/browser/Browser.qml index b9573da..968d077 100644 --- a/tools/qml/browser/Browser.qml +++ b/tools/qml/browser/Browser.qml @@ -173,7 +173,7 @@ Rectangle { width: parent.width model: folders1 delegate: folderDelegate - highlight: Rectangle { + highlight: Rectangle { color: palette.highlight visible: root.showFocusHighlight && view1.count != 0 gradient: Gradient { diff --git a/tools/qml/deviceorientation.h b/tools/qml/deviceorientation.h index 487ebd4..88ceb1b 100644 --- a/tools/qml/deviceorientation.h +++ b/tools/qml/deviceorientation.h @@ -52,8 +52,8 @@ class DeviceOrientation : public QObject Q_OBJECT Q_ENUMS(Orientation) public: - enum Orientation { - UnknownOrientation, + enum Orientation { + UnknownOrientation, Portrait, Landscape, PortraitInverted, diff --git a/tools/qml/qdeclarativetester.cpp b/tools/qml/qdeclarativetester.cpp index e3a1f59..1bcdb04 100644 --- a/tools/qml/qdeclarativetester.cpp +++ b/tools/qml/qdeclarativetester.cpp @@ -54,9 +54,9 @@ QT_BEGIN_NAMESPACE extern Q_GUI_EXPORT bool qt_applefontsmoothing_enabled; -QDeclarativeTester::QDeclarativeTester(const QString &script, QDeclarativeViewer::ScriptOptions opts, +QDeclarativeTester::QDeclarativeTester(const QString &script, QDeclarativeViewer::ScriptOptions opts, QDeclarativeView *parent) -: QAbstractAnimation(parent), m_script(script), m_view(parent), filterEvents(true), options(opts), +: QAbstractAnimation(parent), m_script(script), m_view(parent), filterEvents(true), options(opts), testscript(0), hasCompleted(false), hasFailed(false) { parent->viewport()->installEventFilter(this); @@ -75,8 +75,8 @@ QDeclarativeTester::QDeclarativeTester(const QString &script, QDeclarativeViewer QDeclarativeTester::~QDeclarativeTester() { - if (!hasFailed && - options & QDeclarativeViewer::Record && + if (!hasFailed && + options & QDeclarativeViewer::Record && options & QDeclarativeViewer::SaveOnExit) save(); } @@ -228,7 +228,7 @@ void QDeclarativeTester::save() } ts << " }\n"; - while (!mouseevents.isEmpty() && + while (!mouseevents.isEmpty() && mouseevents.first().msec == fe.msec) { MouseEvent me = mouseevents.takeFirst(); @@ -345,7 +345,7 @@ void QDeclarativeTester::updateCurrentTime(int msec) if (QDeclarativeVisualTestFrame *frame = qobject_cast(event)) { if (frame->msec() < msec) { if (options & QDeclarativeViewer::TestImages && !(options & QDeclarativeViewer::Record)) { - qWarning() << "QDeclarativeTester(" << m_script << "): Extra frame. Seen:" + qWarning() << "QDeclarativeTester(" << m_script << "): Extra frame. Seen:" << msec << "Expected:" << frame->msec(); imagefailure(); } @@ -371,7 +371,7 @@ void QDeclarativeTester::updateCurrentTime(int msec) } if (goodImage != img) { QString reject(frame->image().toLocalFile() + ".reject.png"); - qWarning() << "QDeclarativeTester(" << m_script << "): Image mismatch. Reject saved to:" + qWarning() << "QDeclarativeTester(" << m_script << "): Image mismatch. Reject saved to:" << reject; img.save(reject); bool doDiff = (goodImage.size() == img.size()); @@ -424,7 +424,7 @@ void QDeclarativeTester::updateCurrentTime(int msec) ke.destination = ViewPort; } m_savedKeyEvents.append(ke); - } + } testscriptidx++; } diff --git a/tools/qml/qdeclarativetester.h b/tools/qml/qdeclarativetester.h index 0cf508a..5a2a8c6 100644 --- a/tools/qml/qdeclarativetester.h +++ b/tools/qml/qdeclarativetester.h @@ -122,7 +122,7 @@ public: int type() const { return m_type; } void setType(int t) { m_type = t; } - + int button() const { return m_button; } void setButton(int b) { m_button = b; } @@ -237,7 +237,7 @@ private: struct MouseEvent { MouseEvent(QMouseEvent *e) - : type(e->type()), button(e->button()), buttons(e->buttons()), + : type(e->type()), button(e->button()), buttons(e->buttons()), pos(e->pos()), modifiers(e->modifiers()), destination(View) {} QEvent::Type type; diff --git a/tools/qml/qmlruntime.cpp b/tools/qml/qmlruntime.cpp index a368bc1..3803691 100644 --- a/tools/qml/qmlruntime.cpp +++ b/tools/qml/qmlruntime.cpp @@ -820,7 +820,7 @@ void QDeclarativeViewer::createMenu() fileMenu->addAction(reloadAction); fileMenu->addSeparator(); fileMenu->addAction(closeAction); -#if !defined(Q_OS_SYMBIAN) +#if !defined(Q_OS_SYMBIAN) fileMenu->addAction(quitAction); QMenu *recordMenu = menu->addMenu(tr("&Recording")); @@ -836,7 +836,7 @@ void QDeclarativeViewer::createMenu() settingsMenu->addAction(proxyAction); #if defined(Q_OS_SYMBIAN) settingsMenu->addAction(fullscreenAction); -#else +#else settingsMenu->addAction(recordOptions); settingsMenu->addMenu(loggerWindow->preferencesMenu()); #endif // !Q_OS_SYMBIAN diff --git a/tools/qml/startup/startup.qml b/tools/qml/startup/startup.qml index 9ca50a3..d3bc932 100644 --- a/tools/qml/startup/startup.qml +++ b/tools/qml/startup/startup.qml @@ -92,8 +92,8 @@ Rectangle { to: 360 loops: NumberAnimation.Infinite running: true - duration: 2000 - } + duration: 2000 + } } } } @@ -168,6 +168,6 @@ Rectangle { } } } - ] + ] } // treatsApp -- cgit v0.12 From 376e636eccedb8d8bbb280c3e2655722a5902461 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Fri, 10 Dec 2010 11:21:04 +0100 Subject: QmlViewer: Remove trailing whitespace --- tools/qml/qdeclarativetester.h | 2 +- tools/qml/qml.pro | 4 ++-- tools/qml/qmlruntime.cpp | 2 +- tools/qml/startup/startup.qml | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tools/qml/qdeclarativetester.h b/tools/qml/qdeclarativetester.h index 5a2a8c6..6fdf495 100644 --- a/tools/qml/qdeclarativetester.h +++ b/tools/qml/qdeclarativetester.h @@ -122,7 +122,7 @@ public: int type() const { return m_type; } void setType(int t) { m_type = t; } - + int button() const { return m_button; } void setButton(int b) { m_button = b; } diff --git a/tools/qml/qml.pro b/tools/qml/qml.pro index 3927dd6..bdac6e3 100644 --- a/tools/qml/qml.pro +++ b/tools/qml/qml.pro @@ -4,7 +4,7 @@ DESTDIR = ../../bin include(qml.pri) -SOURCES += main.cpp +SOURCES += main.cpp INCLUDEPATH += ../../include/QtDeclarative INCLUDEPATH += ../../src/declarative/util @@ -26,7 +26,7 @@ wince* { QT += xmlpatterns } contains(QT_CONFIG, webkit) { - QT += webkit + QT += webkit } } maemo5 { diff --git a/tools/qml/qmlruntime.cpp b/tools/qml/qmlruntime.cpp index 3803691..142e4c5 100644 --- a/tools/qml/qmlruntime.cpp +++ b/tools/qml/qmlruntime.cpp @@ -820,7 +820,7 @@ void QDeclarativeViewer::createMenu() fileMenu->addAction(reloadAction); fileMenu->addSeparator(); fileMenu->addAction(closeAction); -#if !defined(Q_OS_SYMBIAN) +#if !defined(Q_OS_SYMBIAN) fileMenu->addAction(quitAction); QMenu *recordMenu = menu->addMenu(tr("&Recording")); diff --git a/tools/qml/startup/startup.qml b/tools/qml/startup/startup.qml index d3bc932..35c44c2 100644 --- a/tools/qml/startup/startup.qml +++ b/tools/qml/startup/startup.qml @@ -92,8 +92,8 @@ Rectangle { to: 360 loops: NumberAnimation.Infinite running: true - duration: 2000 - } + duration: 2000 + } } } } @@ -168,6 +168,6 @@ Rectangle { } } } - ] + ] } // treatsApp -- cgit v0.12 From 891d0c143b33c6e2e16af322652e4d7bccca2292 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Fri, 10 Dec 2010 14:57:03 +0100 Subject: Doc: Added a note about the Public Suffix List. Added at the request of Peter Hartmann and Legal. --- doc/src/legal/3rdparty.qdoc | 81 ++++++++++++++++++++++++++++----------------- 1 file changed, 51 insertions(+), 30 deletions(-) diff --git a/doc/src/legal/3rdparty.qdoc b/doc/src/legal/3rdparty.qdoc index 8b3d5f2..9cc83a6 100644 --- a/doc/src/legal/3rdparty.qdoc +++ b/doc/src/legal/3rdparty.qdoc @@ -683,36 +683,57 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - + \hr - jquery 1.4.2.js Copyright 2010 John Resig - This software is dual licensed under the MIT or GPL version 2 licenses. - Nokia has used the software herein under the MIT license. - - jquery includes Sizzle.js Copyright 2010 The Dojo Foundaton and is - licensed under the MIT, BSD and GPL licenses. Nokia has used this - software herein under the MIT license. - - The MIT License - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. - - + jquery 1.4.2.js Copyright 2010 John Resig + This software is dual licensed under the MIT or GPL version 2 licenses. + Nokia has used the software herein under the MIT license. + + jquery includes Sizzle.js Copyright 2010 The Dojo Foundaton and is + licensed under the MIT, BSD and GPL licenses. Nokia has used this + software herein under the MIT license. + + The MIT License + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + + + \section1 The Public Suffix List + + \e{The Public Suffix List is an initiative of the Mozilla Project, but is + maintained as a community resource. It is available for use in any + software, but was originally created to meet the needs of browser + manufacturers. It allows browsers to, for example:} + \list + \o \e{Avoid privacy-damaging "supercookies" being set for high-level + domain name suffixes} + \o \e{Highlight the most important part of a domain name in the user + interface} + \o \e{Accurately sort history entries by site} + \endlist + -- quoted from \l{publicsuffix.org}. + + The public suffix list is used inside Qt to avoid such "supercookies" + mentioned above being set in the cookie jar supported by Qt (by the + QNetworkCookieJar class). + + See \c src/network/access/qnetworkcookiejartlds_p.h.INFO for more + information about how the list is used. */ -- cgit v0.12 From 2249a44e57764e88ed2967aee7f845fdf4cf2358 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Mon, 13 Dec 2010 09:31:37 +1000 Subject: Build on Symbian Reviewed-by: Michael Brasser --- tools/qml/main.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp index 104f7b7..b9513b9 100644 --- a/tools/qml/main.cpp +++ b/tools/qml/main.cpp @@ -59,6 +59,19 @@ QtMsgHandler systemMsgOutput = 0; static QDeclarativeViewer *openFile(const QString &fileName); static void showViewer(QDeclarativeViewer *viewer); +QString warnings; +void exitApp(int i) +{ +#ifdef Q_OS_WIN + // Debugging output is not visible by default on Windows - + // therefore show modal dialog with errors instead. + if (!warnings.isEmpty()) { + QMessageBox::warning(0, QApplication::tr("Qt QML Viewer"), warnings); + } +#endif + exit(i); +} + #if defined (Q_OS_SYMBIAN) #include #include @@ -85,19 +98,6 @@ void myMessageOutput(QtMsgType type, const char *msg) QWeakPointer logger; -QString warnings; -void exitApp(int i) -{ -#ifdef Q_OS_WIN - // Debugging output is not visible by default on Windows - - // therefore show modal dialog with errors instead. - if (!warnings.isEmpty()) { - QMessageBox::warning(0, QApplication::tr("Qt QML Viewer"), warnings); - } -#endif - exit(i); -} - static QAtomicInt recursiveLock(0); void myMessageOutput(QtMsgType type, const char *msg) -- cgit v0.12 From 35f964ac3d88831c857a850bbdc58fcbfdbaf13c Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Mon, 13 Dec 2010 13:49:52 +1000 Subject: A QAIM model resulted in items moving to incorrect locations QAbstractItemModel moves items to the gaps between items. QML views assume items are moved to the destination index. This means we need to adjust the destination when moving forward to a gap. Task-number: QTBUG-15841 Reviewed-by: Michael Brasser --- src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp index 4fe6c4c..4f5213a 100644 --- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp +++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp @@ -1367,7 +1367,7 @@ void QDeclarativeVisualDataModel::_q_rowsMoved(const QModelIndex &sourceParent, Q_D(QDeclarativeVisualDataModel); const int count = sourceEnd - sourceStart + 1; if (destinationParent == d->m_root && sourceParent == d->m_root) { - _q_itemsMoved(sourceStart, destinationRow, count); + _q_itemsMoved(sourceStart, sourceStart > destinationRow ? destinationRow : destinationRow-1, count); } else if (sourceParent == d->m_root) { _q_itemsRemoved(sourceStart, count); } else if (destinationParent == d->m_root) { -- cgit v0.12 From 18b940539d0633f30ae055feedb48aeb15969814 Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Wed, 8 Dec 2010 13:38:48 +1000 Subject: Add mirroring-positioners.qml example --- .../positioners/mirroring-positioners.qml | 70 ++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 examples/declarative/positioners/mirroring-positioners.qml diff --git a/examples/declarative/positioners/mirroring-positioners.qml b/examples/declarative/positioners/mirroring-positioners.qml new file mode 100644 index 0000000..0db95dd --- /dev/null +++ b/examples/declarative/positioners/mirroring-positioners.qml @@ -0,0 +1,70 @@ +import QtQuick 1.0 + +Rectangle { + width: column.width+10 + height: column.height+10 + property bool arabic: false + Column { + id: column + spacing: 10 + anchors.centerIn: parent + Text { + text: "Row" + anchors.horizontalCenter: parent.horizontalCenter + } + Row { + flow: arabic ? Row.RightToLeft : Row.LeftToRight + spacing: 10 + Repeater { + model: 4 + Loader { + property int value: index + sourceComponent: delegate + } + } + } + Text { + text: "Grid" + anchors.horizontalCenter: parent.horizontalCenter + } + Grid { + flow: arabic ? Grid.RightToLeft : Grid.LeftToRight + spacing: 10; columns: 4 + Repeater { + model: 11 + Loader { + property int value: index + sourceComponent: delegate + } + } + } + Rectangle { + height: 50; width: parent.width + color: mouseArea.pressed ? "black" : "gray" + Text { + text: arabic ? "RTL" : "LTR" + color: "white" + font.pixelSize: 20 + anchors.centerIn: parent + } + MouseArea { + id: mouseArea + onClicked: arabic = !arabic + anchors.fill: parent + } + } + } + Component { + id: delegate + Rectangle { + width: 50; height: 50 + color: Qt.rgba(0.8/(parent.value+1),0.8/(parent.value+1),0.8/(parent.value+1),1.0) + Text { + text: parent.parent.value+1 + color: "white" + font.pixelSize: 20 + anchors.centerIn: parent + } + } + } +} -- cgit v0.12 From ad653d169aaecf6273787a01797c7647a13eec04 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Mon, 13 Dec 2010 16:09:52 +1000 Subject: Fix dragging Flickable back over start point. Change 810e21d9e404aa2fcb602cb68bfd892387b234e7 caused regression. Once stealMouse is set to true is must stay that way until release. Task-number: QTBUG-15998 Reviewed-by: Michael Brasser --- src/declarative/graphicsitems/qdeclarativeflickable.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativeflickable.cpp b/src/declarative/graphicsitems/qdeclarativeflickable.cpp index 377f3b5..f1d92c5 100644 --- a/src/declarative/graphicsitems/qdeclarativeflickable.cpp +++ b/src/declarative/graphicsitems/qdeclarativeflickable.cpp @@ -700,8 +700,8 @@ void QDeclarativeFlickablePrivate::handleMouseMoveEvent(QGraphicsSceneMouseEvent bool rejectY = false; bool rejectX = false; - bool stealY = false; - bool stealX = false; + bool stealY = stealMouse; + bool stealX = stealMouse; if (q->yflick()) { int dy = int(event->pos().y() - pressPos.y()); -- cgit v0.12 From 2e2f26072647b08292955ebad631c34d58c828f9 Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Mon, 13 Dec 2010 17:08:09 +1000 Subject: Revert "Add mirroring-positioners.qml example" that was accidentally pushed This reverts commit 18b940539d0633f30ae055feedb48aeb15969814. --- .../positioners/mirroring-positioners.qml | 70 ---------------------- 1 file changed, 70 deletions(-) delete mode 100644 examples/declarative/positioners/mirroring-positioners.qml diff --git a/examples/declarative/positioners/mirroring-positioners.qml b/examples/declarative/positioners/mirroring-positioners.qml deleted file mode 100644 index 0db95dd..0000000 --- a/examples/declarative/positioners/mirroring-positioners.qml +++ /dev/null @@ -1,70 +0,0 @@ -import QtQuick 1.0 - -Rectangle { - width: column.width+10 - height: column.height+10 - property bool arabic: false - Column { - id: column - spacing: 10 - anchors.centerIn: parent - Text { - text: "Row" - anchors.horizontalCenter: parent.horizontalCenter - } - Row { - flow: arabic ? Row.RightToLeft : Row.LeftToRight - spacing: 10 - Repeater { - model: 4 - Loader { - property int value: index - sourceComponent: delegate - } - } - } - Text { - text: "Grid" - anchors.horizontalCenter: parent.horizontalCenter - } - Grid { - flow: arabic ? Grid.RightToLeft : Grid.LeftToRight - spacing: 10; columns: 4 - Repeater { - model: 11 - Loader { - property int value: index - sourceComponent: delegate - } - } - } - Rectangle { - height: 50; width: parent.width - color: mouseArea.pressed ? "black" : "gray" - Text { - text: arabic ? "RTL" : "LTR" - color: "white" - font.pixelSize: 20 - anchors.centerIn: parent - } - MouseArea { - id: mouseArea - onClicked: arabic = !arabic - anchors.fill: parent - } - } - } - Component { - id: delegate - Rectangle { - width: 50; height: 50 - color: Qt.rgba(0.8/(parent.value+1),0.8/(parent.value+1),0.8/(parent.value+1),1.0) - Text { - text: parent.parent.value+1 - color: "white" - font.pixelSize: 20 - anchors.centerIn: parent - } - } - } -} -- cgit v0.12 From 95ddfa13737164c93c58ce3694ce59ec68a016d9 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Mon, 13 Dec 2010 17:33:13 +1000 Subject: Ensure ListView contentHeight is set to a valid size. If the view height is 0 no items will be created so the contentHeight can not be estimated. The currentItem is usually created, so it is possible to use that to estimate. Task-number: QTBUG-16037 Reviewed-by: Bea Lam --- .../graphicsitems/qdeclarativelistview.cpp | 6 ++++ .../qdeclarativelistview/data/qtbug16037.qml | 37 ++++++++++++++++++++++ .../tst_qdeclarativelistview.cpp | 20 ++++++++++++ 3 files changed, 63 insertions(+) create mode 100644 tests/auto/declarative/qdeclarativelistview/data/qtbug16037.qml diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index d008f91..2a7f508 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -265,6 +265,8 @@ public: } } pos = (*(--visibleItems.constEnd()))->endPosition() + invisibleCount * (averageSize + spacing); + } else if (model && model->count()) { + pos = model->count() * averageSize + (model->count()-1) * spacing; } return pos; } @@ -1050,6 +1052,8 @@ void QDeclarativeListViewPrivate::updateCurrent(int modelIndex) // This is slightly sub-optimal, but section heading caching minimizes the impact. if (currentItem->section) currentItem->section->setVisible(false); + if (visibleItems.isEmpty()) + averageSize = currentItem->size(); } updateHighlight(); emit q->currentIndexChanged(); @@ -1576,6 +1580,7 @@ void QDeclarativeListView::setModel(const QVariant &model) d->updateTrackedItem(); } } + d->updateViewport(); } connect(d->model, SIGNAL(itemsInserted(int,int)), this, SLOT(itemsInserted(int,int))); connect(d->model, SIGNAL(itemsRemoved(int,int)), this, SLOT(itemsRemoved(int,int))); @@ -1647,6 +1652,7 @@ void QDeclarativeListView::setDelegate(QDeclarativeComponent *delegate) d->highlight->setPosition(d->currentItem->position()); d->updateTrackedItem(); } + d->updateViewport(); } } emit delegateChanged(); diff --git a/tests/auto/declarative/qdeclarativelistview/data/qtbug16037.qml b/tests/auto/declarative/qdeclarativelistview/data/qtbug16037.qml new file mode 100644 index 0000000..0756618 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelistview/data/qtbug16037.qml @@ -0,0 +1,37 @@ +import QtQuick 1.0 + +Item { + width: 640 + height: 480 + + function setModel() { + listView.model = listModel1 + } + + ListModel { + id: listModel1 + ListElement { text: "Apple" } + ListElement { text: "Banana" } + ListElement { text: "Orange" } + ListElement { text: "Coconut" } + } + + Rectangle { + width: 200 + height: listView.contentHeight + color: "yellow" + anchors.centerIn: parent + + ListView { + id: listView + objectName: "listview" + anchors.fill: parent + + delegate: Item { + width: 200 + height: 20 + Text { text: model.text; anchors.centerIn: parent } + } + } + } +} diff --git a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp index ff90d32..b834d46 100644 --- a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp +++ b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp @@ -104,6 +104,7 @@ private slots: void sizeLessThan1(); void QTBUG_14821(); void resizeDelegate(); + void QTBUG_16037(); private: template void items(); @@ -1944,6 +1945,25 @@ void tst_QDeclarativeListView::resizeDelegate() delete canvas; } +void tst_QDeclarativeListView::QTBUG_16037() +{ + QDeclarativeView *canvas = createView(); + + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/qtbug16037.qml")); + qApp->processEvents(); + + QDeclarativeListView *listview = findItem(canvas->rootObject(), "listview"); + QTRY_VERIFY(listview != 0); + + QVERIFY(listview->contentHeight() <= 0.0); + + QMetaObject::invokeMethod(canvas->rootObject(), "setModel"); + + QTRY_COMPARE(listview->contentHeight(), 80.0); + + delete canvas; +} + void tst_QDeclarativeListView::qListModelInterface_items() { items(); -- cgit v0.12 From de1632cc7be17df234cd86d49df9787e6aa68107 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Fri, 10 Dec 2010 13:05:40 +0100 Subject: Add expected failures for JS test suite on Symbian These are bugs in the back-end (JavaScriptCore), not in the QtScript layer. Flag them as such. Task-number: QTBUG-15435 Reviewed-by: Jedrzej Nowacki --- tests/auto/qscriptjstestsuite/tst_qscriptjstestsuite.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/auto/qscriptjstestsuite/tst_qscriptjstestsuite.cpp b/tests/auto/qscriptjstestsuite/tst_qscriptjstestsuite.cpp index a280256..4b14cc9 100644 --- a/tests/auto/qscriptjstestsuite/tst_qscriptjstestsuite.cpp +++ b/tests/auto/qscriptjstestsuite/tst_qscriptjstestsuite.cpp @@ -745,6 +745,16 @@ tst_Suite::tst_Suite() addExpectedFailure("ecma/TypeConversion/9.3.1-3.js", "1/-1e-2000", willFixInNextReleaseMessage); #endif +#ifdef Q_OS_SYMBIAN + addExpectedFailure("ecma/Math/15.8.2.13.js", "Math.pow(-1, 0.5)", willFixInNextReleaseMessage); + addExpectedFailure("ecma/Math/15.8.2.13.js", "Math.pow(-1, -0.5)", willFixInNextReleaseMessage); + addExpectedFailure("ecma_3/Operators/order-01.js", "operator evaluation order: 11.5.1 *", willFixInNextReleaseMessage); + addExpectedFailure("ecma_3/Operators/order-01.js", "operator evaluation order: 11.5.2 /", willFixInNextReleaseMessage); + addExpectedFailure("ecma_3/Operators/order-01.js", "operator evaluation order: 11.6.2 -", willFixInNextReleaseMessage); + addExpectedFailure("ecma_3/Operators/order-01.js", "operator evaluation order: 11.13.2 *=", willFixInNextReleaseMessage); + addExpectedFailure("ecma_3/Operators/order-01.js", "operator evaluation order: 11.13.2 /=", willFixInNextReleaseMessage); +#endif + static const char klass[] = "tst_QScriptJsTestSuite"; QVector *data = qt_meta_data_tst_Suite(); -- cgit v0.12 From 6160f8541e4d7cb66de7680b5fb439fb757c59dd Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Mon, 13 Dec 2010 10:28:42 +0200 Subject: Symbian specific input methods should use 'Text' mode as default case Currently default case is 'lower'. It makes more sense to set the default as 'Text', as it is natural default case for most text entries. Task-number: QTBUG-10311 Reviewed-by: Miikka Heikkinen --- src/gui/inputmethod/qcoefepinputcontext_s60.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index 4a1b9b9..5e8a2e1 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -89,7 +89,7 @@ QCoeFepInputContext::QCoeFepInputContext(QObject *parent) m_fepState->SetFlags(EAknEditorFlagDefault); m_fepState->SetDefaultInputMode( EAknEditorTextInputMode ); m_fepState->SetPermittedInputModes( EAknEditorAllInputModes ); - m_fepState->SetDefaultCase( EAknEditorLowerCase ); + m_fepState->SetDefaultCase( EAknEditorTextCase ); m_fepState->SetPermittedCases( EAknEditorAllCaseModes ); m_fepState->SetSpecialCharacterTableResourceId(R_AVKON_SPECIAL_CHARACTER_TABLE_DIALOG); m_fepState->SetNumericKeymap( EAknEditorStandardNumberModeKeymap ); -- cgit v0.12 From db13511196f94e61c8c679448b6182f09b6ce539 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 13 Dec 2010 10:16:07 +0100 Subject: doc: Eliminated some "raw-html" cases. More to come. --- doc/src/widgets-and-layouts/gallery-cde.qdoc | 427 ++++++--------------------- 1 file changed, 91 insertions(+), 336 deletions(-) diff --git a/doc/src/widgets-and-layouts/gallery-cde.qdoc b/doc/src/widgets-and-layouts/gallery-cde.qdoc index c783399..69287b9 100644 --- a/doc/src/widgets-and-layouts/gallery-cde.qdoc +++ b/doc/src/widgets-and-layouts/gallery-cde.qdoc @@ -34,345 +34,100 @@ This page shows some of the widgets available in Qt when configured to use the "cde" style. -\raw HTML -

    Buttons

    +\section2 Buttons - -- - - - - - - - - - - - - - - - - -
    -\endraw -\inlineimage cde-pushbutton.png -\raw HTML - -\endraw -\inlineimage cde-toolbutton.png -\raw HTML -
    -\endraw -The QPushButton widget provides a command button. -\raw HTML - -\endraw -\raw HTML -
    -\endraw -\inlineimage cde-checkbox.png -\raw HTML - -\endraw -\inlineimage cde-radiobutton.png -\raw HTML -
    -\endraw -The QCheckBox widget provides a checkbox with a text label.\raw HTML - -\endraw -The QRadioButton widget provides a radio button with a text or pixmap label.\raw HTML -
    -\endraw -\raw HTML -

    Containers

    +\table 100% +\row +\o \image cde-checkbox.png + \caption The QCheckBox widget provides a checkbox with a text label. +\o \image cde-radiobutton.png + \caption The QRadioButton widget provides a radio button with a text or pixmap label. +\o \image cde-pushbutton.png + \image cde-toolbutton.png + \caption The QPushButton widget provides a command button. +\endtable - -- - - - - - - - - - - - - - - - - -
    -\endraw -\inlineimage cde-groupbox.png -\raw HTML - -\endraw -\inlineimage cde-tabwidget.png -\raw HTML -
    -\endraw -The QGroupBox widget provides a group box frame with a title.\raw HTML - -\endraw -The QTabWidget class provides a stack of tabbed widgets.\raw HTML -
    -\endraw -\inlineimage cde-frame.png -\raw HTML - -\endraw -\inlineimage cde-toolbox.png -\raw HTML -
    -\endraw -The QFrame widget provides a simple decorated container for other widgets.\raw HTML - -\endraw -The QToolBox class provides a column of tabbed widget items.\raw HTML -
    -\endraw -\raw HTML -

    Item Views

    +\section2 Containers - -- - - - - - - - - - - - - - - -
    -\endraw -\inlineimage cde-listview.png -\raw HTML - -\endraw -\inlineimage cde-treeview.png -\raw HTML -
    -\endraw -The QListView class provides a default model/view implementation of a list/icon view. The QListWidget class provides a classic item-based list/icon view.\raw HTML - -\endraw -The QTreeView class provides a default model/view implementation of a tree view. The QTreeWidget class provides a classic item-based tree view.\raw HTML -
    -\endraw -\inlineimage cde-tableview.png -\raw HTML -
    -\endraw -The QTableView class provides a default model/view implementation of a table view. The QTableWidget class provides a classic item-based table view.\raw HTML -
    -\endraw -\raw HTML -

    Display Widgets

    +\table 100% +\row +\o \image cde-groupbox.png + The The QGroupBox widget provides a group box frame with a title. +\o \image cde-tabwidget.png + The QTabWidget class provides a stack of tabbed widgets. +\o \image cde-frame.png + The QFrame widget provides a simple decorated container for other widgets. +\o \image cde-toolbox.png + The QToolBox class provides a column of tabbed widget items. +\endtable - -- - - - - - - - - - - - - - - -
    -\endraw -\inlineimage cde-progressbar.png -\raw HTML - -\endraw -\inlineimage cde-lcdnumber.png -\raw HTML -
    -\endraw -The QProgressBar widget provides a horizontal progress bar.\raw HTML - -\endraw -The QLCDNumber widget displays a number with LCD-like digits.\raw HTML -
    -\endraw -\inlineimage cde-label.png -\raw HTML -
    -\endraw -The QLabel widget provides a text or image display.\raw HTML -
    -\endraw -\raw HTML -

    Input Widgets

    +\section2 Item Views + +\table 100% +\row +\o \image cde-listview.png + The QListView class provides a default model/view implementation of a list/icon view. The QListWidget class provides a classic item-based list/icon view. +\o \image cde-treeview.png + The QTreeView class provides a default model/view implementation of a tree view. The QTreeWidget class provides a classic item-based tree view. +\o \image cde-tableview.png + The QTableView class provides a default model/view implementation of a table view. The QTableWidget class provides a classic item-based table view.\o +\o +\endtable + +\section2 Display Widgets + +\table 100% +\row +\o \image cde-progressbar.png + The QProgressBar widget provides a horizontal progress bar. +\o \image cde-label.png + The QLabel widget provides a text or image display. +\o \image cde-lcdnumber.png + The QLCDNumber widget displays a number with LCD-like digits. +\endtable + +\section2 Input Widgets + +\table 100% +\row +\o \image cde-lineedit.png + The QLineEdit widget is a one-line text editor. +\o \image cde-dateedit.png + The QDateEdit class provides a widget for editing dates. +\o \image cde-timeedit.png + The QTimeEdit class provides a widget for editing times. +\o \image cde-datetimeedit.png + The QDateTimeEdit class provides a widget for editing dates and times. +\endtable + +\table 100% +\row +\o \image cde-slider.png + The QSlider widget provides a vertical or horizontal slider. +\o \image cde-combobox.png + The QComboBox widget is a combined button and pop-up list. +\o \image cde-spinbox.png + The QSpinBox class provides a spin box widget. +\endtable + +\table 100% +\row +\o \image cde-fontcombobox.png + The QFontComboBox widget is a specialized combobox that enables fonts to be selected from a pop-up list containing previews of available fonts. +\o \image cde-doublespinbox.png + The QDoubleSpinBox class provides a spin box widget that allows double precision floating point numbers to be entered. +\o \image cde-horizontalscrollbar.png + The QScrollBar widget provides a vertical or horizontal scroll bar. Here, we show a scroll bar with horizontal orientation. +\endtable + +\table 100% +\row +\o \image cde-dial.png + The QDial class provides a rounded range control (like a speedometer or potentiometer). +\o \image cde-textedit.png + The QTextEdit class provides a widget that is used to edit and display both plain and rich text. +\o \image cde-calendarwidget.png + The QCalendarWidget class provides a monthly calendar widget that can be used to select dates. +\endtable - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -\endraw -\inlineimage cde-slider.png -\raw HTML - -\endraw -\inlineimage cde-lineedit.png -\raw HTML -
    -\endraw -The QSlider widget provides a vertical or horizontal slider.\raw HTML - -\endraw -The QLineEdit widget is a one-line text editor.\raw HTML -
    -\endraw -\inlineimage cde-combobox.png -\raw HTML - -\endraw -\inlineimage cde-doublespinbox.png -\raw HTML -
    -\endraw -The QComboBox widget is a combined button and pop-up list.\raw HTML - -\endraw -The QDoubleSpinBox class provides a spin box widget that allows double precision floating point numbers to be entered.\raw HTML -
    -\endraw -\inlineimage cde-spinbox.png -\raw HTML - -\endraw -\inlineimage cde-timeedit.png -\raw HTML -
    -\endraw -The QSpinBox class provides a spin box widget.\raw HTML - -\endraw -The QTimeEdit class provides a widget for editing times.\raw HTML -
    -\endraw -\inlineimage cde-dateedit.png -\raw HTML - -\endraw -\inlineimage cde-datetimeedit.png -\raw HTML -
    -\endraw -The QDateEdit class provides a widget for editing dates.\raw HTML - -\endraw -The QDateTimeEdit class provides a widget for editing dates and times.\raw HTML -
    -\endraw -\inlineimage cde-textedit.png -\raw HTML - -\endraw -\inlineimage cde-horizontalscrollbar.png -\raw HTML -
    -\endraw -The QTextEdit class provides a widget that is used to edit and - display both plain and rich text.\raw HTML - -\endraw -The QScrollBar widget provides a vertical or horizontal scroll bar. Here, we show a scroll bar with horizontal orientation.\raw HTML -
    -\endraw -\inlineimage cde-dial.png -\raw HTML - -\endraw -\inlineimage cde-calendarwidget.png -\raw HTML -
    -\endraw -The QDial class provides a rounded range control (like a - speedometer or potentiometer).\raw HTML - -\endraw -The QCalendarWidget class provides a monthly calendar widget that can be used to select dates.\raw HTML -
    -\endraw -\inlineimage cde-fontcombobox.png -\raw HTML -
    -\endraw -The QFontComboBox widget is a specialized combobox that enables fonts to be selected from a pop-up list containing previews of available fonts.\raw HTML -
    -\endraw */ -- cgit v0.12 From ba8e841523f005bddca581d70ef0883c5a26f47a Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 13 Dec 2010 11:34:49 +0100 Subject: doc: Replaced some \raw and \endraw uses with \table and \endtable In DITA XML, there is no straightforward way to translate raw html into DITA XML, because the XML stream writer automagically escapes all the raw html elements. So I am beginning to replace uses of the \raw command with \table, which gets output correctly. The problem is the XML stream writer must see each XML element start and end, because it keeps them on a stack. When you output XML elements with the writeCharacters() function, it escapes the '<' and '>' of any XML elements the character string contains. --- .../widgets-and-layouts/gallery-cleanlooks.qdoc | 432 +++++--------------- doc/src/widgets-and-layouts/gallery-gtk.qdoc | 436 +++++---------------- doc/src/widgets-and-layouts/gallery-macintosh.qdoc | 432 +++++--------------- doc/src/widgets-and-layouts/gallery-motif.qdoc | 432 +++++--------------- doc/src/widgets-and-layouts/gallery-plastique.qdoc | 432 +++++--------------- doc/src/widgets-and-layouts/gallery-windows.qdoc | 432 +++++--------------- .../widgets-and-layouts/gallery-windowsvista.qdoc | 432 +++++--------------- doc/src/widgets-and-layouts/gallery-windowsxp.qdoc | 432 +++++--------------- 8 files changed, 768 insertions(+), 2692 deletions(-) diff --git a/doc/src/widgets-and-layouts/gallery-cleanlooks.qdoc b/doc/src/widgets-and-layouts/gallery-cleanlooks.qdoc index d03adc8..59e2934 100644 --- a/doc/src/widgets-and-layouts/gallery-cleanlooks.qdoc +++ b/doc/src/widgets-and-layouts/gallery-cleanlooks.qdoc @@ -34,345 +34,105 @@ This page shows some of the widgets available in Qt when configured to use the "cleanlooks" style. -\raw HTML -

    Buttons

    +\section2 Buttons - -- - - - - - - - - - - - - - - - - -
    -\endraw -\inlineimage cleanlooks-pushbutton.png -\raw HTML - -\endraw -\inlineimage cleanlooks-toolbutton.png -\raw HTML -
    -\endraw -The QPushButton widget provides a command button.\raw HTML - -\endraw -The QToolButton class provides a quick-access button to commands - or options, usually used inside a QToolBar.\raw HTML -
    -\endraw -\inlineimage cleanlooks-checkbox.png -\raw HTML - -\endraw -\inlineimage cleanlooks-radiobutton.png -\raw HTML -
    -\endraw -The QCheckBox widget provides a checkbox with a text label.\raw HTML - -\endraw -The QRadioButton widget provides a radio button with a text or pixmap label.\raw HTML -
    -\endraw -\raw HTML -

    Containers

    +\table 100% +\row +\o \image cleanlooks-pushbutton.png + \caption The QPushButton widget provides a command button. +\o \image cleanlooks-toolbutton.png + \caption The QToolButton class provides a quick-access button to commands + or options, usually used inside a QToolBar. +\endtable - -- - - - - - - - - - - - - - - - - -
    -\endraw -\inlineimage cleanlooks-groupbox.png -\raw HTML - -\endraw -\inlineimage cleanlooks-tabwidget.png -\raw HTML -
    -\endraw -The QGroupBox widget provides a group box frame with a title.\raw HTML - -\endraw -The QTabWidget class provides a stack of tabbed widgets.\raw HTML -
    -\endraw -\inlineimage cleanlooks-frame.png -\raw HTML - -\endraw -\inlineimage cleanlooks-toolbox.png -\raw HTML -
    -\endraw -The QFrame widget provides a simple decorated container for other widgets.\raw HTML - -\endraw -The QToolBox class provides a column of tabbed widget items.\raw HTML -
    -\endraw -\raw HTML -

    Item Views

    +\table 100% +\row +\o \image cleanlooks-checkbox.png + \caption The QCheckBox widget provides a checkbox with a text label. +\o \image cleanlooks-radiobutton.png + \caption The QRadioButton widget provides a radio button with a text or pixmap label. +\endtable - -- - - - - - - - - - - - - - - -
    -\endraw -\inlineimage cleanlooks-listview.png -\raw HTML - -\endraw -\inlineimage cleanlooks-treeview.png -\raw HTML -
    -\endraw -The QListView class provides a default model/view implementation of a list/icon view. The QListWidget class provides a classic item-based list/icon view.\raw HTML - -\endraw -The QTreeView class provides a default model/view implementation of a tree view. The QTreeWidget class provides a classic item-based tree view.\raw HTML -
    -\endraw -\inlineimage cleanlooks-tableview.png -\raw HTML -
    -\endraw -The QTableView class provides a default model/view implementation of a table view. The QTableWidget class provides a classic item-based table view.\raw HTML -
    -\endraw -\raw HTML -

    Display Widgets

    +\section2 Containers - -- - - - - - - - - - - - - - - -
    -\endraw -\inlineimage cleanlooks-progressbar.png -\raw HTML - -\endraw -\inlineimage cleanlooks-lcdnumber.png -\raw HTML -
    -\endraw -The QProgressBar widget provides a horizontal progress bar.\raw HTML - -\endraw -The QLCDNumber widget displays a number with LCD-like digits.\raw HTML -
    -\endraw -\inlineimage cleanlooks-label.png -\raw HTML -
    -\endraw -The QLabel widget provides a text or image display.\raw HTML -
    -\endraw -\raw HTML -

    Input Widgets

    +\table 100% +\row +\o \image cleanlooks-groupbox.png + The The QGroupBox widget provides a group box frame with a title. +\o \image cleanlooks-tabwidget.png + The QTabWidget class provides a stack of tabbed widgets. +\o \image cleanlooks-frame.png + The QFrame widget provides a simple decorated container for other widgets. +\o \image cleanlooks-toolbox.png + The QToolBox class provides a column of tabbed widget items. +\endtable - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -\endraw -\inlineimage cleanlooks-slider.png -\raw HTML - -\endraw -\inlineimage cleanlooks-lineedit.png -\raw HTML -
    -\endraw -The QSlider widget provides a vertical or horizontal slider.\raw HTML - -\endraw -The QLineEdit widget is a one-line text editor.\raw HTML -
    -\endraw -\inlineimage cleanlooks-combobox.png -\raw HTML - -\endraw -\inlineimage cleanlooks-doublespinbox.png -\raw HTML -
    -\endraw -The QComboBox widget is a combined button and pop-up list.\raw HTML - -\endraw -The QDoubleSpinBox class provides a spin box widget that allows double precision floating point numbers to be entered.\raw HTML -
    -\endraw -\inlineimage cleanlooks-spinbox.png -\raw HTML - -\endraw -\inlineimage cleanlooks-timeedit.png -\raw HTML -
    -\endraw -The QSpinBox class provides a spin box widget.\raw HTML - -\endraw -The QTimeEdit class provides a widget for editing times.\raw HTML -
    -\endraw -\inlineimage cleanlooks-dateedit.png -\raw HTML - -\endraw -\inlineimage cleanlooks-datetimeedit.png -\raw HTML -
    -\endraw -The QDateEdit class provides a widget for editing dates.\raw HTML - -\endraw -The QDateTimeEdit class provides a widget for editing dates and times.\raw HTML -
    -\endraw -\inlineimage cleanlooks-textedit.png -\raw HTML - -\endraw -\inlineimage cleanlooks-horizontalscrollbar.png -\raw HTML -
    -\endraw -The QTextEdit class provides a widget that is used to edit and - display both plain and rich text.\raw HTML - -\endraw -The QScrollBar widget provides a vertical or horizontal scroll bar. Here, we show a scroll bar with horizontal orientation.\raw HTML -
    -\endraw -\inlineimage cleanlooks-dial.png -\raw HTML - -\endraw -\inlineimage cleanlooks-calendarwidget.png -\raw HTML -
    -\endraw -The QDial class provides a rounded range control (like a - speedometer or potentiometer).\raw HTML - -\endraw -The QCalendarWidget class provides a monthly calendar widget that can be used to select dates.\raw HTML -
    -\endraw -\inlineimage cleanlooks-fontcombobox.png -\raw HTML -
    -\endraw -The QFontComboBox widget is a specialized combobox that enables fonts to be selected from a pop-up list containing previews of available fonts.\raw HTML -
    -\endraw +\section2 Item Views + +\table 100% +\row +\o \image cleanlooks-listview.png + The QListView class provides a default model/view implementation of a list/icon view. The QListWidget class provides a classic item-based list/icon view. +\o \image cleanlooks-treeview.png + The QTreeView class provides a default model/view implementation of a tree view. The QTreeWidget class provides a classic item-based tree view. +\o \image cleanlooks-tableview.png + The QTableView class provides a default model/view implementation of a table view. The QTableWidget class provides a classic item-based table view.\o +\o +\endtable + +\section2 Display Widgets + +\table 100% +\row +\o \image cleanlooks-progressbar.png + The QProgressBar widget provides a horizontal progress bar. +\o \image cleanlooks-label.png + The QLabel widget provides a text or image display. +\o \image cleanlooks-lcdnumber.png + The QLCDNumber widget displays a number with LCD-like digits. +\endtable + +\section2 Input Widgets + +\table 100% +\row +\o \image cleanlooks-lineedit.png + The QLineEdit widget is a one-line text editor. +\o \image cleanlooks-dateedit.png + The QDateEdit class provides a widget for editing dates. +\o \image cleanlooks-timeedit.png + The QTimeEdit class provides a widget for editing times. +\o \image cleanlooks-datetimeedit.png + The QDateTimeEdit class provides a widget for editing dates and times. +\endtable + +\table 100% +\row +\o \image cleanlooks-slider.png + The QSlider widget provides a vertical or horizontal slider. +\o \image cleanlooks-combobox.png + The QComboBox widget is a combined button and pop-up list. +\o \image cleanlooks-spinbox.png + The QSpinBox class provides a spin box widget. +\endtable + +\table 100% +\row +\o \image cleanlooks-fontcombobox.png + The QFontComboBox widget is a specialized combobox that enables fonts to be selected from a pop-up list containing previews of available fonts. +\o \image cleanlooks-doublespinbox.png + The QDoubleSpinBox class provides a spin box widget that allows double precision floating point numbers to be entered. +\o \image cleanlooks-horizontalscrollbar.png + The QScrollBar widget provides a vertical or horizontal scroll bar. Here, we show a scroll bar with horizontal orientation. +\endtable + +\table 100% +\row +\o \image cleanlooks-dial.png + The QDial class provides a rounded range control (like a speedometer or potentiometer). +\o \image cleanlooks-textedit.png + The QTextEdit class provides a widget that is used to edit and display both plain and rich text. +\o \image cleanlooks-calendarwidget.png + The QCalendarWidget class provides a monthly calendar widget that can be used to select dates. +\endtable */ diff --git a/doc/src/widgets-and-layouts/gallery-gtk.qdoc b/doc/src/widgets-and-layouts/gallery-gtk.qdoc index b3a6372..b2f8458 100644 --- a/doc/src/widgets-and-layouts/gallery-gtk.qdoc +++ b/doc/src/widgets-and-layouts/gallery-gtk.qdoc @@ -37,349 +37,105 @@ Take a look at the \l{Qt Widget Gallery} to see how Qt applications appear in other styles. -\raw HTML -

    Buttons

    +\section2 Buttons - -- - - - - - - - - - - - - - - - - -
    -\endraw -\inlineimage gtk-pushbutton.png -\raw HTML - -\endraw -\inlineimage gtk-toolbutton.png -\raw HTML -
    -\endraw -The QPushButton widget provides a command button.\raw HTML - -\endraw -The QToolButton class provides a quick-access button to commands - or options, usually used inside a QToolBar.\raw HTML -
    -\endraw -\inlineimage gtk-checkbox.png -\raw HTML - -\endraw -\inlineimage gtk-radiobutton.png -\raw HTML -
    -\endraw -The QCheckBox widget provides a checkbox with a text label.\raw HTML - -\endraw -The QRadioButton widget provides a radio button with a text or pixmap label.\raw HTML -
    -\endraw -\raw HTML -

    Containers

    +\table 100% +\row +\o \image gtk-pushbutton.png + \caption The QPushButton widget provides a command button. +\o \image gtk-toolbutton.png + \caption The QToolButton class provides a quick-access button to commands + or options, usually used inside a QToolBar. +\endtable - -- - - - - - - - - - - - - - - - - -
    -\endraw -\inlineimage gtk-groupbox.png -\raw HTML - -\endraw -\inlineimage gtk-tabwidget.png -\raw HTML -
    -\endraw -The QGroupBox widget provides a group box frame with a title.\raw HTML - -\endraw -The QTabWidget class provides a stack of tabbed widgets.\raw HTML -
    -\endraw -\inlineimage gtk-toolbox.png -\raw HTML - -\endraw -\inlineimage gtk-frame.png -\raw HTML -
    -\endraw -The QToolBox class provides a column of tabbed widget items.\raw HTML - -\endraw -The QFrame widget provides a simple decorated container for other widgets.\raw HTML -
    -\endraw -\raw HTML -

    Item Views

    +\table 100% +\row +\o \image gtk-checkbox.png + \caption The QCheckBox widget provides a checkbox with a text label. +\o \image gtk-radiobutton.png + \caption The QRadioButton widget provides a radio button with a text or pixmap label. +\endtable - -- - - - - - - - - - - - - - - - -
    -\endraw -\inlineimage gtk-listview.png -\raw HTML - -\endraw -\inlineimage gtk-treeview.png -\raw HTML -
    -\endraw -The QListView class provides a default model/view implementation of a list/icon view. The QListWidget class provides a classic item-based list/icon view.\raw HTML - -\endraw -The QTreeView class provides a default model/view implementation of a tree view. The QTreeWidget class provides a classic item-based tree view.\raw HTML -
    -\endraw -\inlineimage gtk-tableview.png -\raw HTML -
    -\endraw -The QTableView class provides a default model/view implementation of a table view. The QTableWidget class provides a classic item-based table view.\raw HTML - -\endraw -\raw HTML -
    -\endraw -\raw HTML -

    Display Widgets

    +\section2 Containers - -- - - - - - - - - - - - - - - -
    -\endraw -\inlineimage gtk-progressbar.png -\raw HTML - -\endraw -\inlineimage gtk-lcdnumber.png -\raw HTML -
    -\endraw -The QProgressBar widget provides a horizontal progress bar.\raw HTML - -\endraw -The QLCDNumber widget displays a number with LCD-like digits.\raw HTML -
    -\endraw -\inlineimage gtk-label.png -\raw HTML -
    -\endraw -The QLabel widget provides a text or image display.\raw HTML -
    -\endraw -\raw HTML -

    Input Widgets

    +\table 100% +\row +\o \image gtk-groupbox.png + The The QGroupBox widget provides a group box frame with a title. +\o \image gtk-tabwidget.png + The QTabWidget class provides a stack of tabbed widgets. +\o \image gtk-frame.png + The QFrame widget provides a simple decorated container for other widgets. +\o \image gtk-toolbox.png + The QToolBox class provides a column of tabbed widget items. +\endtable - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -\endraw -\inlineimage gtk-slider.png -\raw HTML - -\endraw -\inlineimage gtk-lineedit.png -\raw HTML -
    -\endraw -The QSlider widget provides a vertical or horizontal slider.\raw HTML - -\endraw -The QLineEdit widget is a one-line text editor.\raw HTML -
    -\endraw -\inlineimage gtk-combobox.png -\raw HTML - -\endraw -\inlineimage gtk-doublespinbox.png -\raw HTML -
    -\endraw -The QComboBox widget is a combined button and pop-up list.\raw HTML - -\endraw -The QDoubleSpinBox class provides a spin box widget that allows double precision floating point numbers to be entered.\raw HTML -
    -\endraw -\inlineimage gtk-spinbox.png -\raw HTML - -\endraw -\inlineimage gtk-timeedit.png -\raw HTML -
    -\endraw -The QSpinBox class provides a spin box widget.\raw HTML - -\endraw -The QTimeEdit class provides a widget for editing times.\raw HTML -
    -\endraw -\inlineimage gtk-dateedit.png -\raw HTML - -\endraw -\inlineimage gtk-datetimeedit.png -\raw HTML -
    -\endraw -The QDateEdit class provides a widget for editing dates.\raw HTML - -\endraw -The QDateTimeEdit class provides a widget for editing dates and times.\raw HTML -
    -\endraw -\inlineimage gtk-textedit.png -\raw HTML - -\endraw -\inlineimage gtk-horizontalscrollbar.png -\raw HTML -
    -\endraw -The QTextEdit class provides a widget that is used to edit and - display both plain and rich text.\raw HTML - -\endraw -The QScrollBar widget provides a vertical or horizontal scroll bar. Here, we show a scroll bar with horizontal orientation.\raw HTML -
    -\endraw -\inlineimage gtk-dial.png -\raw HTML - -\endraw -\inlineimage gtk-calendarwidget.png -\raw HTML -
    -\endraw -The QDial class provides a rounded range control (like a - speedometer or potentiometer).\raw HTML - -\endraw -The QCalendarWidget class provides a monthly calendar widget that can be used to select dates.\raw HTML -
    -\endraw -\inlineimage gtk-fontcombobox.png -\raw HTML -
    -\endraw -The QFontComboBox widget is a specialized combobox that enables fonts to be selected from a pop-up list containing previews of available fonts.\raw HTML -
    -\endraw +\section2 Item Views + +\table 100% +\row +\o \image gtk-listview.png + The QListView class provides a default model/view implementation of a list/icon view. The QListWidget class provides a classic item-based list/icon view. +\o \image gtk-treeview.png + The QTreeView class provides a default model/view implementation of a tree view. The QTreeWidget class provides a classic item-based tree view. +\o \image gtk-tableview.png + The QTableView class provides a default model/view implementation of a table view. The QTableWidget class provides a classic item-based table view.\o +\o +\endtable + +\section2 Display Widgets + +\table 100% +\row +\o \image gtk-progressbar.png + The QProgressBar widget provides a horizontal progress bar. +\o \image gtk-label.png + The QLabel widget provides a text or image display. +\o \image gtk-lcdnumber.png + The QLCDNumber widget displays a number with LCD-like digits. +\endtable + +\section2 Input Widgets + +\table 100% +\row +\o \image gtk-lineedit.png + The QLineEdit widget is a one-line text editor. +\o \image gtk-dateedit.png + The QDateEdit class provides a widget for editing dates. +\o \image gtk-timeedit.png + The QTimeEdit class provides a widget for editing times. +\o \image gtk-datetimeedit.png + The QDateTimeEdit class provides a widget for editing dates and times. +\endtable + +\table 100% +\row +\o \image gtk-slider.png + The QSlider widget provides a vertical or horizontal slider. +\o \image gtk-combobox.png + The QComboBox widget is a combined button and pop-up list. +\o \image gtk-spinbox.png + The QSpinBox class provides a spin box widget. +\endtable + +\table 100% +\row +\o \image gtk-fontcombobox.png + The QFontComboBox widget is a specialized combobox that enables fonts to be selected from a pop-up list containing previews of available fonts. +\o \image gtk-doublespinbox.png + The QDoubleSpinBox class provides a spin box widget that allows double precision floating point numbers to be entered. +\o \image gtk-horizontalscrollbar.png + The QScrollBar widget provides a vertical or horizontal scroll bar. Here, we show a scroll bar with horizontal orientation. +\endtable + +\table 100% +\row +\o \image gtk-dial.png + The QDial class provides a rounded range control (like a speedometer or potentiometer). +\o \image gtk-textedit.png + The QTextEdit class provides a widget that is used to edit and display both plain and rich text. +\o \image gtk-calendarwidget.png + The QCalendarWidget class provides a monthly calendar widget that can be used to select dates. +\endtable */ diff --git a/doc/src/widgets-and-layouts/gallery-macintosh.qdoc b/doc/src/widgets-and-layouts/gallery-macintosh.qdoc index 30a78ca..44d7eb9 100644 --- a/doc/src/widgets-and-layouts/gallery-macintosh.qdoc +++ b/doc/src/widgets-and-layouts/gallery-macintosh.qdoc @@ -34,345 +34,105 @@ This page shows some of the widgets available in Qt when configured to use the "macintosh" style. -\raw HTML -

    Buttons

    +\section2 Buttons - -- - - - - - - - - - - - - - - - - -
    -\endraw -\inlineimage macintosh-pushbutton.png -\raw HTML - -\endraw -\inlineimage macintosh-toolbutton.png -\raw HTML -
    -\endraw -The QPushButton widget provides a command button.\raw HTML - -\endraw -The QToolButton class provides a quick-access button to commands - or options, usually used inside a QToolBar.\raw HTML -
    -\endraw -\inlineimage macintosh-checkbox.png -\raw HTML - -\endraw -\inlineimage macintosh-radiobutton.png -\raw HTML -
    -\endraw -The QCheckBox widget provides a checkbox with a text label.\raw HTML - -\endraw -The QRadioButton widget provides a radio button with a text or pixmap label.\raw HTML -
    -\endraw -\raw HTML -

    Containers

    +\table 100% +\row +\o \image macintosh-pushbutton.png + \caption The QPushButton widget provides a command button. +\o \image macintosh-toolbutton.png + \caption The QToolButton class provides a quick-access button to commands + or options, usually used inside a QToolBar. +\endtable - -- - - - - - - - - - - - - - - - - -
    -\endraw -\inlineimage macintosh-groupbox.png -\raw HTML - -\endraw -\inlineimage macintosh-tabwidget.png -\raw HTML -
    -\endraw -The QGroupBox widget provides a group box frame with a title.\raw HTML - -\endraw -The QTabWidget class provides a stack of tabbed widgets.\raw HTML -
    -\endraw -\inlineimage macintosh-frame.png -\raw HTML - -\endraw -\inlineimage macintosh-toolbox.png -\raw HTML -
    -\endraw -The QFrame widget provides a simple decorated container for other widgets.\raw HTML - -\endraw -The QToolBox class provides a column of tabbed widget items.\raw HTML -
    -\endraw -\raw HTML -

    Item Views

    +\table 100% +\row +\o \image macintosh-checkbox.png + \caption The QCheckBox widget provides a checkbox with a text label. +\o \image macintosh-radiobutton.png + \caption The QRadioButton widget provides a radio button with a text or pixmap label. +\endtable - -- - - - - - - - - - - - - - - -
    -\endraw -\inlineimage macintosh-listview.png -\raw HTML - -\endraw -\inlineimage macintosh-treeview.png -\raw HTML -
    -\endraw -The QListView class provides a default model/view implementation of a list/icon view. The QListWidget class provides a classic item-based list/icon view.\raw HTML - -\endraw -The QTreeView class provides a default model/view implementation of a tree view. The QTreeWidget class provides a classic item-based tree view.\raw HTML -
    -\endraw -\inlineimage macintosh-tableview.png -\raw HTML -
    -\endraw -The QTableView class provides a default model/view implementation of a table view. The QTableWidget class provides a classic item-based table view.\raw HTML -
    -\endraw -\raw HTML -

    Display Widgets

    +\section2 Containers - -- - - - - - - - - - - - - - - -
    -\endraw -\inlineimage macintosh-progressbar.png -\raw HTML - -\endraw -\inlineimage macintosh-lcdnumber.png -\raw HTML -
    -\endraw -The QProgressBar widget provides a horizontal progress bar.\raw HTML - -\endraw -The QLCDNumber widget displays a number with LCD-like digits.\raw HTML -
    -\endraw -\inlineimage macintosh-label.png -\raw HTML -
    -\endraw -The QLabel widget provides a text or image display.\raw HTML -
    -\endraw -\raw HTML -

    Input Widgets

    +\table 100% +\row +\o \image macintosh-groupbox.png + The The QGroupBox widget provides a group box frame with a title. +\o \image macintosh-tabwidget.png + The QTabWidget class provides a stack of tabbed widgets. +\o \image macintosh-frame.png + The QFrame widget provides a simple decorated container for other widgets. +\o \image macintosh-toolbox.png + The QToolBox class provides a column of tabbed widget items. +\endtable - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -\endraw -\inlineimage macintosh-slider.png -\raw HTML - -\endraw -\inlineimage macintosh-lineedit.png -\raw HTML -
    -\endraw -The QSlider widget provides a vertical or horizontal slider.\raw HTML - -\endraw -The QLineEdit widget is a one-line text editor.\raw HTML -
    -\endraw -\inlineimage macintosh-combobox.png -\raw HTML - -\endraw -\inlineimage macintosh-doublespinbox.png -\raw HTML -
    -\endraw -The QComboBox widget is a combined button and pop-up list.\raw HTML - -\endraw -The QDoubleSpinBox class provides a spin box widget that allows double precision floating point numbers to be entered.\raw HTML -
    -\endraw -\inlineimage macintosh-spinbox.png -\raw HTML - -\endraw -\inlineimage macintosh-timeedit.png -\raw HTML -
    -\endraw -The QSpinBox class provides a spin box widget.\raw HTML - -\endraw -The QTimeEdit class provides a widget for editing times.\raw HTML -
    -\endraw -\inlineimage macintosh-dateedit.png -\raw HTML - -\endraw -\inlineimage macintosh-datetimeedit.png -\raw HTML -
    -\endraw -The QDateEdit class provides a widget for editing dates.\raw HTML - -\endraw -The QDateTimeEdit class provides a widget for editing dates and times.\raw HTML -
    -\endraw -\inlineimage macintosh-textedit.png -\raw HTML - -\endraw -\inlineimage macintosh-horizontalscrollbar.png -\raw HTML -
    -\endraw -The QTextEdit class provides a widget that is used to edit and - display both plain and rich text.\raw HTML - -\endraw -The QScrollBar widget provides a vertical or horizontal scroll bar. Here, we show a scroll bar with horizontal orientation.\raw HTML -
    -\endraw -\inlineimage macintosh-dial.png -\raw HTML - -\endraw -\inlineimage macintosh-calendarwidget.png -\raw HTML -
    -\endraw -The QDial class provides a rounded range control (like a - speedometer or potentiometer).\raw HTML - -\endraw -The QCalendarWidget class provides a monthly calendar widget that can be used to select dates.\raw HTML -
    -\endraw -\inlineimage macintosh-fontcombobox.png -\raw HTML -
    -\endraw -The QFontComboBox widget is a specialized combobox that enables fonts to be selected from a pop-up list containing previews of available fonts.\raw HTML -
    -\endraw +\section2 Item Views + +\table 100% +\row +\o \image macintosh-listview.png + The QListView class provides a default model/view implementation of a list/icon view. The QListWidget class provides a classic item-based list/icon view. +\o \image macintosh-treeview.png + The QTreeView class provides a default model/view implementation of a tree view. The QTreeWidget class provides a classic item-based tree view. +\o \image macintosh-tableview.png + The QTableView class provides a default model/view implementation of a table view. The QTableWidget class provides a classic item-based table view.\o +\o +\endtable + +\section2 Display Widgets + +\table 100% +\row +\o \image macintosh-progressbar.png + The QProgressBar widget provides a horizontal progress bar. +\o \image macintosh-label.png + The QLabel widget provides a text or image display. +\o \image macintosh-lcdnumber.png + The QLCDNumber widget displays a number with LCD-like digits. +\endtable + +\section2 Input Widgets + +\table 100% +\row +\o \image macintosh-lineedit.png + The QLineEdit widget is a one-line text editor. +\o \image macintosh-dateedit.png + The QDateEdit class provides a widget for editing dates. +\o \image macintosh-timeedit.png + The QTimeEdit class provides a widget for editing times. +\o \image macintosh-datetimeedit.png + The QDateTimeEdit class provides a widget for editing dates and times. +\endtable + +\table 100% +\row +\o \image macintosh-slider.png + The QSlider widget provides a vertical or horizontal slider. +\o \image macintosh-combobox.png + The QComboBox widget is a combined button and pop-up list. +\o \image macintosh-spinbox.png + The QSpinBox class provides a spin box widget. +\endtable + +\table 100% +\row +\o \image macintosh-fontcombobox.png + The QFontComboBox widget is a specialized combobox that enables fonts to be selected from a pop-up list containing previews of available fonts. +\o \image macintosh-doublespinbox.png + The QDoubleSpinBox class provides a spin box widget that allows double precision floating point numbers to be entered. +\o \image macintosh-horizontalscrollbar.png + The QScrollBar widget provides a vertical or horizontal scroll bar. Here, we show a scroll bar with horizontal orientation. +\endtable + +\table 100% +\row +\o \image macintosh-dial.png + The QDial class provides a rounded range control (like a speedometer or potentiometer). +\o \image macintosh-textedit.png + The QTextEdit class provides a widget that is used to edit and display both plain and rich text. +\o \image macintosh-calendarwidget.png + The QCalendarWidget class provides a monthly calendar widget that can be used to select dates. +\endtable */ diff --git a/doc/src/widgets-and-layouts/gallery-motif.qdoc b/doc/src/widgets-and-layouts/gallery-motif.qdoc index 861c22a..b9c95c8 100644 --- a/doc/src/widgets-and-layouts/gallery-motif.qdoc +++ b/doc/src/widgets-and-layouts/gallery-motif.qdoc @@ -34,345 +34,105 @@ This page shows some of the widgets available in Qt when configured to use the "motif" style. -\raw HTML -

    Buttons

    +\section2 Buttons - -- - - - - - - - - - - - - - - - - -
    -\endraw -\inlineimage motif-pushbutton.png -\raw HTML - -\endraw -\inlineimage motif-toolbutton.png -\raw HTML -
    -\endraw -The QPushButton widget provides a command button.\raw HTML - -\endraw -The QToolButton class provides a quick-access button to commands - or options, usually used inside a QToolBar.\raw HTML -
    -\endraw -\inlineimage motif-checkbox.png -\raw HTML - -\endraw -\inlineimage motif-radiobutton.png -\raw HTML -
    -\endraw -The QCheckBox widget provides a checkbox with a text label.\raw HTML - -\endraw -The QRadioButton widget provides a radio button with a text or pixmap label.\raw HTML -
    -\endraw -\raw HTML -

    Containers

    +\table 100% +\row +\o \image motif-pushbutton.png + \caption The QPushButton widget provides a command button. +\o \image motif-toolbutton.png + \caption The QToolButton class provides a quick-access button to commands + or options, usually used inside a QToolBar. +\endtable - -- - - - - - - - - - - - - - - - - -
    -\endraw -\inlineimage motif-groupbox.png -\raw HTML - -\endraw -\inlineimage motif-tabwidget.png -\raw HTML -
    -\endraw -The QGroupBox widget provides a group box frame with a title.\raw HTML - -\endraw -The QTabWidget class provides a stack of tabbed widgets.\raw HTML -
    -\endraw -\inlineimage motif-frame.png -\raw HTML - -\endraw -\inlineimage motif-toolbox.png -\raw HTML -
    -\endraw -The QFrame widget provides a simple decorated container for other widgets.\raw HTML - -\endraw -The QToolBox class provides a column of tabbed widget items.\raw HTML -
    -\endraw -\raw HTML -

    Item Views

    +\table 100% +\row +\o \image motif-checkbox.png + \caption The QCheckBox widget provides a checkbox with a text label. +\o \image motif-radiobutton.png + \caption The QRadioButton widget provides a radio button with a text or pixmap label. +\endtable - -- - - - - - - - - - - - - - - -
    -\endraw -\inlineimage motif-listview.png -\raw HTML - -\endraw -\inlineimage motif-treeview.png -\raw HTML -
    -\endraw -The QListView class provides a default model/view implementation of a list/icon view. The QListWidget class provides a classic item-based list/icon view.\raw HTML - -\endraw -The QTreeView class provides a default model/view implementation of a tree view. The QTreeWidget class provides a classic item-based tree view.\raw HTML -
    -\endraw -\inlineimage motif-tableview.png -\raw HTML -
    -\endraw -The QTableView class provides a default model/view implementation of a table view. The QTableWidget class provides a classic item-based table view.\raw HTML -
    -\endraw -\raw HTML -

    Display Widgets

    +\section2 Containers - -- - - - - - - - - - - - - - - -
    -\endraw -\inlineimage motif-progressbar.png -\raw HTML - -\endraw -\inlineimage motif-lcdnumber.png -\raw HTML -
    -\endraw -The QProgressBar widget provides a horizontal progress bar.\raw HTML - -\endraw -The QLCDNumber widget displays a number with LCD-like digits.\raw HTML -
    -\endraw -\inlineimage motif-label.png -\raw HTML -
    -\endraw -The QLabel widget provides a text or image display.\raw HTML -
    -\endraw -\raw HTML -

    Input Widgets

    +\table 100% +\row +\o \image motif-groupbox.png + The The QGroupBox widget provides a group box frame with a title. +\o \image motif-tabwidget.png + The QTabWidget class provides a stack of tabbed widgets. +\o \image motif-frame.png + The QFrame widget provides a simple decorated container for other widgets. +\o \image motif-toolbox.png + The QToolBox class provides a column of tabbed widget items. +\endtable - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -\endraw -\inlineimage motif-slider.png -\raw HTML - -\endraw -\inlineimage motif-lineedit.png -\raw HTML -
    -\endraw -The QSlider widget provides a vertical or horizontal slider.\raw HTML - -\endraw -The QLineEdit widget is a one-line text editor.\raw HTML -
    -\endraw -\inlineimage motif-combobox.png -\raw HTML - -\endraw -\inlineimage motif-doublespinbox.png -\raw HTML -
    -\endraw -The QComboBox widget is a combined button and pop-up list.\raw HTML - -\endraw -The QDoubleSpinBox class provides a spin box widget that allows double precision floating point numbers to be entered.\raw HTML -
    -\endraw -\inlineimage motif-spinbox.png -\raw HTML - -\endraw -\inlineimage motif-timeedit.png -\raw HTML -
    -\endraw -The QSpinBox class provides a spin box widget.\raw HTML - -\endraw -The QTimeEdit class provides a widget for editing times.\raw HTML -
    -\endraw -\inlineimage motif-dateedit.png -\raw HTML - -\endraw -\inlineimage motif-datetimeedit.png -\raw HTML -
    -\endraw -The QDateEdit class provides a widget for editing dates.\raw HTML - -\endraw -The QDateTimeEdit class provides a widget for editing dates and times.\raw HTML -
    -\endraw -\inlineimage motif-textedit.png -\raw HTML - -\endraw -\inlineimage motif-horizontalscrollbar.png -\raw HTML -
    -\endraw -The QTextEdit class provides a widget that is used to edit and - display both plain and rich text.\raw HTML - -\endraw -The QScrollBar widget provides a vertical or horizontal scroll bar. Here, we show a scroll bar with horizontal orientation.\raw HTML -
    -\endraw -\inlineimage motif-dial.png -\raw HTML - -\endraw -\inlineimage motif-calendarwidget.png -\raw HTML -
    -\endraw -The QDial class provides a rounded range control (like a - speedometer or potentiometer).\raw HTML - -\endraw -The QCalendarWidget class provides a monthly calendar widget that can be used to select dates.\raw HTML -
    -\endraw -\inlineimage motif-fontcombobox.png -\raw HTML -
    -\endraw -The QFontComboBox widget is a specialized combobox that enables fonts to be selected from a pop-up list containing previews of available fonts.\raw HTML -
    -\endraw +\section2 Item Views + +\table 100% +\row +\o \image motif-listview.png + The QListView class provides a default model/view implementation of a list/icon view. The QListWidget class provides a classic item-based list/icon view. +\o \image motif-treeview.png + The QTreeView class provides a default model/view implementation of a tree view. The QTreeWidget class provides a classic item-based tree view. +\o \image motif-tableview.png + The QTableView class provides a default model/view implementation of a table view. The QTableWidget class provides a classic item-based table view.\o +\o +\endtable + +\section2 Display Widgets + +\table 100% +\row +\o \image motif-progressbar.png + The QProgressBar widget provides a horizontal progress bar. +\o \image motif-label.png + The QLabel widget provides a text or image display. +\o \image motif-lcdnumber.png + The QLCDNumber widget displays a number with LCD-like digits. +\endtable + +\section2 Input Widgets + +\table 100% +\row +\o \image motif-lineedit.png + The QLineEdit widget is a one-line text editor. +\o \image motif-dateedit.png + The QDateEdit class provides a widget for editing dates. +\o \image motif-timeedit.png + The QTimeEdit class provides a widget for editing times. +\o \image motif-datetimeedit.png + The QDateTimeEdit class provides a widget for editing dates and times. +\endtable + +\table 100% +\row +\o \image motif-slider.png + The QSlider widget provides a vertical or horizontal slider. +\o \image motif-combobox.png + The QComboBox widget is a combined button and pop-up list. +\o \image motif-spinbox.png + The QSpinBox class provides a spin box widget. +\endtable + +\table 100% +\row +\o \image motif-fontcombobox.png + The QFontComboBox widget is a specialized combobox that enables fonts to be selected from a pop-up list containing previews of available fonts. +\o \image motif-doublespinbox.png + The QDoubleSpinBox class provides a spin box widget that allows double precision floating point numbers to be entered. +\o \image motif-horizontalscrollbar.png + The QScrollBar widget provides a vertical or horizontal scroll bar. Here, we show a scroll bar with horizontal orientation. +\endtable + +\table 100% +\row +\o \image motif-dial.png + The QDial class provides a rounded range control (like a speedometer or potentiometer). +\o \image motif-textedit.png + The QTextEdit class provides a widget that is used to edit and display both plain and rich text. +\o \image motif-calendarwidget.png + The QCalendarWidget class provides a monthly calendar widget that can be used to select dates. +\endtable */ diff --git a/doc/src/widgets-and-layouts/gallery-plastique.qdoc b/doc/src/widgets-and-layouts/gallery-plastique.qdoc index 0ea62ee..5f2a1ec 100644 --- a/doc/src/widgets-and-layouts/gallery-plastique.qdoc +++ b/doc/src/widgets-and-layouts/gallery-plastique.qdoc @@ -34,345 +34,105 @@ This page shows some of the widgets available in Qt when configured to use the "plastique" style. -\raw HTML -

    Buttons

    +\section2 Buttons - -- - - - - - - - - - - - - - - - - -
    -\endraw -\inlineimage plastique-pushbutton.png -\raw HTML - -\endraw -\inlineimage plastique-toolbutton.png -\raw HTML -
    -\endraw -The QPushButton widget provides a command button.\raw HTML - -\endraw -The QToolButton class provides a quick-access button to commands - or options, usually used inside a QToolBar.\raw HTML -
    -\endraw -\inlineimage plastique-checkbox.png -\raw HTML - -\endraw -\inlineimage plastique-radiobutton.png -\raw HTML -
    -\endraw -The QCheckBox widget provides a checkbox with a text label.\raw HTML - -\endraw -The QRadioButton widget provides a radio button with a text or pixmap label.\raw HTML -
    -\endraw -\raw HTML -

    Containers

    +\table 100% +\row +\o \image plastique-pushbutton.png + \caption The QPushButton widget provides a command button. +\o \image plastique-toolbutton.png + \caption The QToolButton class provides a quick-access button to commands + or options, usually used inside a QToolBar. +\endtable - -- - - - - - - - - - - - - - - - - -
    -\endraw -\inlineimage plastique-groupbox.png -\raw HTML - -\endraw -\inlineimage plastique-tabwidget.png -\raw HTML -
    -\endraw -The QGroupBox widget provides a group box frame with a title.\raw HTML - -\endraw -The QTabWidget class provides a stack of tabbed widgets.\raw HTML -
    -\endraw -\inlineimage plastique-frame.png -\raw HTML - -\endraw -\inlineimage plastique-toolbox.png -\raw HTML -
    -\endraw -The QFrame widget provides a simple decorated container for other widgets.\raw HTML - -\endraw -The QToolBox class provides a column of tabbed widget items.\raw HTML -
    -\endraw -\raw HTML -

    Item Views

    +\table 100% +\row +\o \image plastique-checkbox.png + \caption The QCheckBox widget provides a checkbox with a text label. +\o \image plastique-radiobutton.png + \caption The QRadioButton widget provides a radio button with a text or pixmap label. +\endtable - -- - - - - - - - - - - - - - - -
    -\endraw -\inlineimage plastique-listview.png -\raw HTML - -\endraw -\inlineimage plastique-treeview.png -\raw HTML -
    -\endraw -The QListView class provides a default model/view implementation of a list/icon view. The QListWidget class provides a classic item-based list/icon view.\raw HTML - -\endraw -The QTreeView class provides a default model/view implementation of a tree view. The QTreeWidget class provides a classic item-based tree view.\raw HTML -
    -\endraw -\inlineimage plastique-tableview.png -\raw HTML -
    -\endraw -The QTableView class provides a default model/view implementation of a table view. The QTableWidget class provides a classic item-based table view.\raw HTML -
    -\endraw -\raw HTML -

    Display Widgets

    +\section2 Containers - -- - - - - - - - - - - - - - - -
    -\endraw -\inlineimage plastique-progressbar.png -\raw HTML - -\endraw -\inlineimage plastique-lcdnumber.png -\raw HTML -
    -\endraw -The QProgressBar widget provides a horizontal progress bar.\raw HTML - -\endraw -The QLCDNumber widget displays a number with LCD-like digits.\raw HTML -
    -\endraw -\inlineimage plastique-label.png -\raw HTML -
    -\endraw -The QLabel widget provides a text or image display.\raw HTML -
    -\endraw -\raw HTML -

    Input Widgets

    +\table 100% +\row +\o \image plastique-groupbox.png + The The QGroupBox widget provides a group box frame with a title. +\o \image plastique-tabwidget.png + The QTabWidget class provides a stack of tabbed widgets. +\o \image plastique-frame.png + The QFrame widget provides a simple decorated container for other widgets. +\o \image plastique-toolbox.png + The QToolBox class provides a column of tabbed widget items. +\endtable - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -\endraw -\inlineimage plastique-slider.png -\raw HTML - -\endraw -\inlineimage plastique-lineedit.png -\raw HTML -
    -\endraw -The QSlider widget provides a vertical or horizontal slider.\raw HTML - -\endraw -The QLineEdit widget is a one-line text editor.\raw HTML -
    -\endraw -\inlineimage plastique-combobox.png -\raw HTML - -\endraw -\inlineimage plastique-doublespinbox.png -\raw HTML -
    -\endraw -The QComboBox widget is a combined button and pop-up list.\raw HTML - -\endraw -The QDoubleSpinBox class provides a spin box widget that allows double precision floating point numbers to be entered.\raw HTML -
    -\endraw -\inlineimage plastique-spinbox.png -\raw HTML - -\endraw -\inlineimage plastique-timeedit.png -\raw HTML -
    -\endraw -The QSpinBox class provides a spin box widget.\raw HTML - -\endraw -The QTimeEdit class provides a widget for editing times.\raw HTML -
    -\endraw -\inlineimage plastique-dateedit.png -\raw HTML - -\endraw -\inlineimage plastique-datetimeedit.png -\raw HTML -
    -\endraw -The QDateEdit class provides a widget for editing dates.\raw HTML - -\endraw -The QDateTimeEdit class provides a widget for editing dates and times.\raw HTML -
    -\endraw -\inlineimage plastique-textedit.png -\raw HTML - -\endraw -\inlineimage plastique-horizontalscrollbar.png -\raw HTML -
    -\endraw -The QTextEdit class provides a widget that is used to edit and - display both plain and rich text.\raw HTML - -\endraw -The QScrollBar widget provides a vertical or horizontal scroll bar. Here, we show a scroll bar with horizontal orientation.\raw HTML -
    -\endraw -\inlineimage plastique-dial.png -\raw HTML - -\endraw -\inlineimage plastique-calendarwidget.png -\raw HTML -
    -\endraw -The QDial class provides a rounded range control (like a - speedometer or potentiometer).\raw HTML - -\endraw -The QCalendarWidget class provides a monthly calendar widget that can be used to select dates.\raw HTML -
    -\endraw -\inlineimage plastique-fontcombobox.png -\raw HTML -
    -\endraw -The QFontComboBox widget is a specialized combobox that enables fonts to be selected from a pop-up list containing previews of available fonts.\raw HTML -
    -\endraw +\section2 Item Views + +\table 100% +\row +\o \image plastique-listview.png + The QListView class provides a default model/view implementation of a list/icon view. The QListWidget class provides a classic item-based list/icon view. +\o \image plastique-treeview.png + The QTreeView class provides a default model/view implementation of a tree view. The QTreeWidget class provides a classic item-based tree view. +\o \image plastique-tableview.png + The QTableView class provides a default model/view implementation of a table view. The QTableWidget class provides a classic item-based table view.\o +\o +\endtable + +\section2 Display Widgets + +\table 100% +\row +\o \image plastique-progressbar.png + The QProgressBar widget provides a horizontal progress bar. +\o \image plastique-label.png + The QLabel widget provides a text or image display. +\o \image plastique-lcdnumber.png + The QLCDNumber widget displays a number with LCD-like digits. +\endtable + +\section2 Input Widgets + +\table 100% +\row +\o \image plastique-lineedit.png + The QLineEdit widget is a one-line text editor. +\o \image plastique-dateedit.png + The QDateEdit class provides a widget for editing dates. +\o \image plastique-timeedit.png + The QTimeEdit class provides a widget for editing times. +\o \image plastique-datetimeedit.png + The QDateTimeEdit class provides a widget for editing dates and times. +\endtable + +\table 100% +\row +\o \image plastique-slider.png + The QSlider widget provides a vertical or horizontal slider. +\o \image plastique-combobox.png + The QComboBox widget is a combined button and pop-up list. +\o \image plastique-spinbox.png + The QSpinBox class provides a spin box widget. +\endtable + +\table 100% +\row +\o \image plastique-fontcombobox.png + The QFontComboBox widget is a specialized combobox that enables fonts to be selected from a pop-up list containing previews of available fonts. +\o \image plastique-doublespinbox.png + The QDoubleSpinBox class provides a spin box widget that allows double precision floating point numbers to be entered. +\o \image plastique-horizontalscrollbar.png + The QScrollBar widget provides a vertical or horizontal scroll bar. Here, we show a scroll bar with horizontal orientation. +\endtable + +\table 100% +\row +\o \image plastique-dial.png + The QDial class provides a rounded range control (like a speedometer or potentiometer). +\o \image plastique-textedit.png + The QTextEdit class provides a widget that is used to edit and display both plain and rich text. +\o \image plastique-calendarwidget.png + The QCalendarWidget class provides a monthly calendar widget that can be used to select dates. +\endtable */ diff --git a/doc/src/widgets-and-layouts/gallery-windows.qdoc b/doc/src/widgets-and-layouts/gallery-windows.qdoc index d3464a0..fe38745 100644 --- a/doc/src/widgets-and-layouts/gallery-windows.qdoc +++ b/doc/src/widgets-and-layouts/gallery-windows.qdoc @@ -34,345 +34,105 @@ This page shows some of the widgets available in Qt when configured to use the "windows" style. -\raw HTML -

    Buttons

    +\section2 Buttons - -- - - - - - - - - - - - - - - - - -
    -\endraw -\inlineimage windows-pushbutton.png -\raw HTML - -\endraw -\inlineimage windows-toolbutton.png -\raw HTML -
    -\endraw -The QPushButton widget provides a command button.\raw HTML - -\endraw -The QToolButton class provides a quick-access button to commands - or options, usually used inside a QToolBar.\raw HTML -
    -\endraw -\inlineimage windows-checkbox.png -\raw HTML - -\endraw -\inlineimage windows-radiobutton.png -\raw HTML -
    -\endraw -The QCheckBox widget provides a checkbox with a text label.\raw HTML - -\endraw -The QRadioButton widget provides a radio button with a text or pixmap label.\raw HTML -
    -\endraw -\raw HTML -

    Containers

    +\table 100% +\row +\o \image windows-pushbutton.png + \caption The QPushButton widget provides a command button. +\o \image windows-toolbutton.png + \caption The QToolButton class provides a quick-access button to commands + or options, usually used inside a QToolBar. +\endtable - -- - - - - - - - - - - - - - - - - -
    -\endraw -\inlineimage windows-groupbox.png -\raw HTML - -\endraw -\inlineimage windows-tabwidget.png -\raw HTML -
    -\endraw -The QGroupBox widget provides a group box frame with a title.\raw HTML - -\endraw -The QTabWidget class provides a stack of tabbed widgets.\raw HTML -
    -\endraw -\inlineimage windows-frame.png -\raw HTML - -\endraw -\inlineimage windows-toolbox.png -\raw HTML -
    -\endraw -The QFrame widget provides a simple decorated container for other widgets.\raw HTML - -\endraw -The QToolBox class provides a column of tabbed widget items.\raw HTML -
    -\endraw -\raw HTML -

    Item Views

    +\table 100% +\row +\o \image windows-checkbox.png + \caption The QCheckBox widget provides a checkbox with a text label. +\o \image windows-radiobutton.png + \caption The QRadioButton widget provides a radio button with a text or pixmap label. +\endtable - -- - - - - - - - - - - - - - - -
    -\endraw -\inlineimage windows-listview.png -\raw HTML - -\endraw -\inlineimage windows-treeview.png -\raw HTML -
    -\endraw -The QListView class provides a default model/view implementation of a list/icon view. The QListWidget class provides a classic item-based list/icon view.\raw HTML - -\endraw -The QTreeView class provides a default model/view implementation of a tree view. The QTreeWidget class provides a classic item-based tree view.\raw HTML -
    -\endraw -\inlineimage windows-tableview.png -\raw HTML -
    -\endraw -The QTableView class provides a default model/view implementation of a table view. The QTableWidget class provides a classic item-based table view.\raw HTML -
    -\endraw -\raw HTML -

    Display Widgets

    +\section2 Containers - -- - - - - - - - - - - - - - - -
    -\endraw -\inlineimage windows-progressbar.png -\raw HTML - -\endraw -\inlineimage windows-lcdnumber.png -\raw HTML -
    -\endraw -The QProgressBar widget provides a horizontal progress bar.\raw HTML - -\endraw -The QLCDNumber widget displays a number with LCD-like digits.\raw HTML -
    -\endraw -\inlineimage windows-label.png -\raw HTML -
    -\endraw -The QLabel widget provides a text or image display.\raw HTML -
    -\endraw -\raw HTML -

    Input Widgets

    +\table 100% +\row +\o \image windows-groupbox.png + The The QGroupBox widget provides a group box frame with a title. +\o \image windows-tabwidget.png + The QTabWidget class provides a stack of tabbed widgets. +\o \image windows-frame.png + The QFrame widget provides a simple decorated container for other widgets. +\o \image windows-toolbox.png + The QToolBox class provides a column of tabbed widget items. +\endtable - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -\endraw -\inlineimage windows-slider.png -\raw HTML - -\endraw -\inlineimage windows-lineedit.png -\raw HTML -
    -\endraw -The QSlider widget provides a vertical or horizontal slider.\raw HTML - -\endraw -The QLineEdit widget is a one-line text editor.\raw HTML -
    -\endraw -\inlineimage windows-combobox.png -\raw HTML - -\endraw -\inlineimage windows-doublespinbox.png -\raw HTML -
    -\endraw -The QComboBox widget is a combined button and pop-up list.\raw HTML - -\endraw -The QDoubleSpinBox class provides a spin box widget that allows double precision floating point numbers to be entered.\raw HTML -
    -\endraw -\inlineimage windows-spinbox.png -\raw HTML - -\endraw -\inlineimage windows-timeedit.png -\raw HTML -
    -\endraw -The QSpinBox class provides a spin box widget.\raw HTML - -\endraw -The QTimeEdit class provides a widget for editing times.\raw HTML -
    -\endraw -\inlineimage windows-dateedit.png -\raw HTML - -\endraw -\inlineimage windows-datetimeedit.png -\raw HTML -
    -\endraw -The QDateEdit class provides a widget for editing dates.\raw HTML - -\endraw -The QDateTimeEdit class provides a widget for editing dates and times.\raw HTML -
    -\endraw -\inlineimage windows-textedit.png -\raw HTML - -\endraw -\inlineimage windows-horizontalscrollbar.png -\raw HTML -
    -\endraw -The QTextEdit class provides a widget that is used to edit and - display both plain and rich text.\raw HTML - -\endraw -The QScrollBar widget provides a vertical or horizontal scroll bar. Here, we show a scroll bar with horizontal orientation.\raw HTML -
    -\endraw -\inlineimage windows-dial.png -\raw HTML - -\endraw -\inlineimage windows-calendarwidget.png -\raw HTML -
    -\endraw -The QDial class provides a rounded range control (like a - speedometer or potentiometer).\raw HTML - -\endraw -The QCalendarWidget class provides a monthly calendar widget that can be used to select dates.\raw HTML -
    -\endraw -\inlineimage windows-fontcombobox.png -\raw HTML -
    -\endraw -The QFontComboBox widget is a specialized combobox that enables fonts to be selected from a pop-up list containing previews of available fonts.\raw HTML -
    -\endraw +\section2 Item Views + +\table 100% +\row +\o \image windows-listview.png + The QListView class provides a default model/view implementation of a list/icon view. The QListWidget class provides a classic item-based list/icon view. +\o \image windows-treeview.png + The QTreeView class provides a default model/view implementation of a tree view. The QTreeWidget class provides a classic item-based tree view. +\o \image windows-tableview.png + The QTableView class provides a default model/view implementation of a table view. The QTableWidget class provides a classic item-based table view.\o +\o +\endtable + +\section2 Display Widgets + +\table 100% +\row +\o \image windows-progressbar.png + The QProgressBar widget provides a horizontal progress bar. +\o \image windows-label.png + The QLabel widget provides a text or image display. +\o \image windows-lcdnumber.png + The QLCDNumber widget displays a number with LCD-like digits. +\endtable + +\section2 Input Widgets + +\table 100% +\row +\o \image windows-lineedit.png + The QLineEdit widget is a one-line text editor. +\o \image windows-dateedit.png + The QDateEdit class provides a widget for editing dates. +\o \image windows-timeedit.png + The QTimeEdit class provides a widget for editing times. +\o \image windows-datetimeedit.png + The QDateTimeEdit class provides a widget for editing dates and times. +\endtable + +\table 100% +\row +\o \image windows-slider.png + The QSlider widget provides a vertical or horizontal slider. +\o \image windows-combobox.png + The QComboBox widget is a combined button and pop-up list. +\o \image windows-spinbox.png + The QSpinBox class provides a spin box widget. +\endtable + +\table 100% +\row +\o \image windows-fontcombobox.png + The QFontComboBox widget is a specialized combobox that enables fonts to be selected from a pop-up list containing previews of available fonts. +\o \image windows-doublespinbox.png + The QDoubleSpinBox class provides a spin box widget that allows double precision floating point numbers to be entered. +\o \image windows-horizontalscrollbar.png + The QScrollBar widget provides a vertical or horizontal scroll bar. Here, we show a scroll bar with horizontal orientation. +\endtable + +\table 100% +\row +\o \image windows-dial.png + The QDial class provides a rounded range control (like a speedometer or potentiometer). +\o \image windows-textedit.png + The QTextEdit class provides a widget that is used to edit and display both plain and rich text. +\o \image windows-calendarwidget.png + The QCalendarWidget class provides a monthly calendar widget that can be used to select dates. +\endtable */ diff --git a/doc/src/widgets-and-layouts/gallery-windowsvista.qdoc b/doc/src/widgets-and-layouts/gallery-windowsvista.qdoc index 00afd52..e017a2c 100644 --- a/doc/src/widgets-and-layouts/gallery-windowsvista.qdoc +++ b/doc/src/widgets-and-layouts/gallery-windowsvista.qdoc @@ -34,345 +34,105 @@ This page shows some of the widgets available in Qt when configured to use the "windowsvista" style. -\raw HTML -

    Buttons

    +\section2 Buttons - -- - - - - - - - - - - - - - - - - -
    -\endraw -\inlineimage windowsvista-pushbutton.png -\raw HTML - -\endraw -\inlineimage windowsvista-toolbutton.png -\raw HTML -
    -\endraw -The QPushButton widget provides a command button.\raw HTML - -\endraw -The QToolButton class provides a quick-access button to commands - or options, usually used inside a QToolBar.\raw HTML -
    -\endraw -\inlineimage windowsvista-checkbox.png -\raw HTML - -\endraw -\inlineimage windowsvista-radiobutton.png -\raw HTML -
    -\endraw -The QCheckBox widget provides a checkbox with a text label.\raw HTML - -\endraw -The QRadioButton widget provides a radio button with a text or pixmap label.\raw HTML -
    -\endraw -\raw HTML -

    Containers

    +\table 100% +\row +\o \image windowsvista-pushbutton.png + \caption The QPushButton widget provides a command button. +\o \image windowsvista-toolbutton.png + \caption The QToolButton class provides a quick-access button to commands + or options, usually used inside a QToolBar. +\endtable - -- - - - - - - - - - - - - - - - - -
    -\endraw -\inlineimage windowsvista-groupbox.png -\raw HTML - -\endraw -\inlineimage windowsvista-tabwidget.png -\raw HTML -
    -\endraw -The QGroupBox widget provides a group box frame with a title.\raw HTML - -\endraw -The QTabWidget class provides a stack of tabbed widgets.\raw HTML -
    -\endraw -\inlineimage windowsvista-frame.png -\raw HTML - -\endraw -\inlineimage windowsvista-toolbox.png -\raw HTML -
    -\endraw -The QFrame widget provides a simple decorated container for other widgets.\raw HTML - -\endraw -The QToolBox class provides a column of tabbed widget items.\raw HTML -
    -\endraw -\raw HTML -

    Item Views

    +\table 100% +\row +\o \image windowsvista-checkbox.png + \caption The QCheckBox widget provides a checkbox with a text label. +\o \image windowsvista-radiobutton.png + \caption The QRadioButton widget provides a radio button with a text or pixmap label. +\endtable - -- - - - - - - - - - - - - - - -
    -\endraw -\inlineimage windowsvista-listview.png -\raw HTML - -\endraw -\inlineimage windowsvista-treeview.png -\raw HTML -
    -\endraw -The QListView class provides a default model/view implementation of a list/icon view. The QListWidget class provides a classic item-based list/icon view.\raw HTML - -\endraw -The QTreeView class provides a default model/view implementation of a tree view. The QTreeWidget class provides a classic item-based tree view.\raw HTML -
    -\endraw -\inlineimage windowsvista-tableview.png -\raw HTML -
    -\endraw -The QTableView class provides a default model/view implementation of a table view. The QTableWidget class provides a classic item-based table view.\raw HTML -
    -\endraw -\raw HTML -

    Display Widgets

    +\section2 Containers - -- - - - - - - - - - - - - - - -
    -\endraw -\inlineimage windowsvista-progressbar.png -\raw HTML - -\endraw -\inlineimage windowsvista-lcdnumber.png -\raw HTML -
    -\endraw -The QProgressBar widget provides a horizontal progress bar.\raw HTML - -\endraw -The QLCDNumber widget displays a number with LCD-like digits.\raw HTML -
    -\endraw -\inlineimage windowsvista-label.png -\raw HTML -
    -\endraw -The QLabel widget provides a text or image display.\raw HTML -
    -\endraw -\raw HTML -

    Input Widgets

    +\table 100% +\row +\o \image windowsvista-groupbox.png + The The QGroupBox widget provides a group box frame with a title. +\o \image windowsvista-tabwidget.png + The QTabWidget class provides a stack of tabbed widgets. +\o \image windowsvista-frame.png + The QFrame widget provides a simple decorated container for other widgets. +\o \image windowsvista-toolbox.png + The QToolBox class provides a column of tabbed widget items. +\endtable - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -\endraw -\inlineimage windowsvista-slider.png -\raw HTML - -\endraw -\inlineimage windowsvista-lineedit.png -\raw HTML -
    -\endraw -The QSlider widget provides a vertical or horizontal slider.\raw HTML - -\endraw -The QLineEdit widget is a one-line text editor.\raw HTML -
    -\endraw -\inlineimage windowsvista-combobox.png -\raw HTML - -\endraw -\inlineimage windowsvista-doublespinbox.png -\raw HTML -
    -\endraw -The QComboBox widget is a combined button and pop-up list.\raw HTML - -\endraw -The QDoubleSpinBox class provides a spin box widget that allows double precision floating point numbers to be entered.\raw HTML -
    -\endraw -\inlineimage windowsvista-spinbox.png -\raw HTML - -\endraw -\inlineimage windowsvista-timeedit.png -\raw HTML -
    -\endraw -The QSpinBox class provides a spin box widget.\raw HTML - -\endraw -The QTimeEdit class provides a widget for editing times.\raw HTML -
    -\endraw -\inlineimage windowsvista-dateedit.png -\raw HTML - -\endraw -\inlineimage windowsvista-datetimeedit.png -\raw HTML -
    -\endraw -The QDateEdit class provides a widget for editing dates.\raw HTML - -\endraw -The QDateTimeEdit class provides a widget for editing dates and times.\raw HTML -
    -\endraw -\inlineimage windowsvista-textedit.png -\raw HTML - -\endraw -\inlineimage windowsvista-horizontalscrollbar.png -\raw HTML -
    -\endraw -The QTextEdit class provides a widget that is used to edit and - display both plain and rich text.\raw HTML - -\endraw -The QScrollBar widget provides a vertical or horizontal scroll bar. Here, we show a scroll bar with horizontal orientation.\raw HTML -
    -\endraw -\inlineimage windowsvista-dial.png -\raw HTML - -\endraw -\inlineimage windowsvista-calendarwidget.png -\raw HTML -
    -\endraw -The QDial class provides a rounded range control (like a - speedometer or potentiometer).\raw HTML - -\endraw -The QCalendarWidget class provides a monthly calendar widget that can be used to select dates.\raw HTML -
    -\endraw -\inlineimage windowsvista-fontcombobox.png -\raw HTML -
    -\endraw -The QFontComboBox widget is a specialized combobox that enables fonts to be selected from a pop-up list containing previews of available fonts.\raw HTML -
    -\endraw +\section2 Item Views + +\table 100% +\row +\o \image windowsvista-listview.png + The QListView class provides a default model/view implementation of a list/icon view. The QListWidget class provides a classic item-based list/icon view. +\o \image windowsvista-treeview.png + The QTreeView class provides a default model/view implementation of a tree view. The QTreeWidget class provides a classic item-based tree view. +\o \image windowsvista-tableview.png + The QTableView class provides a default model/view implementation of a table view. The QTableWidget class provides a classic item-based table view.\o +\o +\endtable + +\section2 Display Widgets + +\table 100% +\row +\o \image windowsvista-progressbar.png + The QProgressBar widget provides a horizontal progress bar. +\o \image windowsvista-label.png + The QLabel widget provides a text or image display. +\o \image windowsvista-lcdnumber.png + The QLCDNumber widget displays a number with LCD-like digits. +\endtable + +\section2 Input Widgets + +\table 100% +\row +\o \image windowsvista-lineedit.png + The QLineEdit widget is a one-line text editor. +\o \image windowsvista-dateedit.png + The QDateEdit class provides a widget for editing dates. +\o \image windowsvista-timeedit.png + The QTimeEdit class provides a widget for editing times. +\o \image windowsvista-datetimeedit.png + The QDateTimeEdit class provides a widget for editing dates and times. +\endtable + +\table 100% +\row +\o \image windowsvista-slider.png + The QSlider widget provides a vertical or horizontal slider. +\o \image windowsvista-combobox.png + The QComboBox widget is a combined button and pop-up list. +\o \image windowsvista-spinbox.png + The QSpinBox class provides a spin box widget. +\endtable + +\table 100% +\row +\o \image windowsvista-fontcombobox.png + The QFontComboBox widget is a specialized combobox that enables fonts to be selected from a pop-up list containing previews of available fonts. +\o \image windowsvista-doublespinbox.png + The QDoubleSpinBox class provides a spin box widget that allows double precision floating point numbers to be entered. +\o \image windowsvista-horizontalscrollbar.png + The QScrollBar widget provides a vertical or horizontal scroll bar. Here, we show a scroll bar with horizontal orientation. +\endtable + +\table 100% +\row +\o \image windowsvista-dial.png + The QDial class provides a rounded range control (like a speedometer or potentiometer). +\o \image windowsvista-textedit.png + The QTextEdit class provides a widget that is used to edit and display both plain and rich text. +\o \image windowsvista-calendarwidget.png + The QCalendarWidget class provides a monthly calendar widget that can be used to select dates. +\endtable */ diff --git a/doc/src/widgets-and-layouts/gallery-windowsxp.qdoc b/doc/src/widgets-and-layouts/gallery-windowsxp.qdoc index 60c8ff0..f3c53ee 100644 --- a/doc/src/widgets-and-layouts/gallery-windowsxp.qdoc +++ b/doc/src/widgets-and-layouts/gallery-windowsxp.qdoc @@ -34,345 +34,105 @@ This page shows some of the widgets available in Qt when configured to use the "windowsxp" style. -\raw HTML -

    Buttons

    +\section2 Buttons - -- - - - - - - - - - - - - - - - - -
    -\endraw -\inlineimage windowsxp-pushbutton.png -\raw HTML - -\endraw -\inlineimage windowsxp-toolbutton.png -\raw HTML -
    -\endraw -The QPushButton widget provides a command button.\raw HTML - -\endraw -The QToolButton class provides a quick-access button to commands - or options, usually used inside a QToolBar.\raw HTML -
    -\endraw -\inlineimage windowsxp-checkbox.png -\raw HTML - -\endraw -\inlineimage windowsxp-radiobutton.png -\raw HTML -
    -\endraw -The QCheckBox widget provides a checkbox with a text label.\raw HTML - -\endraw -The QRadioButton widget provides a radio button with a text or pixmap label.\raw HTML -
    -\endraw -\raw HTML -

    Containers

    +\table 100% +\row +\o \image windowsxp-pushbutton.png + \caption The QPushButton widget provides a command button. +\o \image windowsxp-toolbutton.png + \caption The QToolButton class provides a quick-access button to commands + or options, usually used inside a QToolBar. +\endtable - -- - - - - - - - - - - - - - - - - -
    -\endraw -\inlineimage windowsxp-groupbox.png -\raw HTML - -\endraw -\inlineimage windowsxp-tabwidget.png -\raw HTML -
    -\endraw -The QGroupBox widget provides a group box frame with a title.\raw HTML - -\endraw -The QTabWidget class provides a stack of tabbed widgets.\raw HTML -
    -\endraw -\inlineimage windowsxp-frame.png -\raw HTML - -\endraw -\inlineimage windowsxp-toolbox.png -\raw HTML -
    -\endraw -The QFrame widget provides a simple decorated container for other widgets.\raw HTML - -\endraw -The QToolBox class provides a column of tabbed widget items.\raw HTML -
    -\endraw -\raw HTML -

    Item Views

    +\table 100% +\row +\o \image windowsxp-checkbox.png + \caption The QCheckBox widget provides a checkbox with a text label. +\o \image windowsxp-radiobutton.png + \caption The QRadioButton widget provides a radio button with a text or pixmap label. +\endtable - -- - - - - - - - - - - - - - - -
    -\endraw -\inlineimage windowsxp-listview.png -\raw HTML - -\endraw -\inlineimage windowsxp-treeview.png -\raw HTML -
    -\endraw -The QListView class provides a default model/view implementation of a list/icon view. The QListWidget class provides a classic item-based list/icon view.\raw HTML - -\endraw -The QTreeView class provides a default model/view implementation of a tree view. The QTreeWidget class provides a classic item-based tree view.\raw HTML -
    -\endraw -\inlineimage windowsxp-tableview.png -\raw HTML -
    -\endraw -The QTableView class provides a default model/view implementation of a table view. The QTableWidget class provides a classic item-based table view.\raw HTML -
    -\endraw -\raw HTML -

    Display Widgets

    +\section2 Containers - -- - - - - - - - - - - - - - - -
    -\endraw -\inlineimage windowsxp-progressbar.png -\raw HTML - -\endraw -\inlineimage windowsxp-lcdnumber.png -\raw HTML -
    -\endraw -The QProgressBar widget provides a horizontal progress bar.\raw HTML - -\endraw -The QLCDNumber widget displays a number with LCD-like digits.\raw HTML -
    -\endraw -\inlineimage windowsxp-label.png -\raw HTML -
    -\endraw -The QLabel widget provides a text or image display.\raw HTML -
    -\endraw -\raw HTML -

    Input Widgets

    +\table 100% +\row +\o \image windowsxp-groupbox.png + The The QGroupBox widget provides a group box frame with a title. +\o \image windowsxp-tabwidget.png + The QTabWidget class provides a stack of tabbed widgets. +\o \image windowsxp-frame.png + The QFrame widget provides a simple decorated container for other widgets. +\o \image windowsxp-toolbox.png + The QToolBox class provides a column of tabbed widget items. +\endtable - -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -\endraw -\inlineimage windowsxp-slider.png -\raw HTML - -\endraw -\inlineimage windowsxp-lineedit.png -\raw HTML -
    -\endraw -The QSlider widget provides a vertical or horizontal slider.\raw HTML - -\endraw -The QLineEdit widget is a one-line text editor.\raw HTML -
    -\endraw -\inlineimage windowsxp-combobox.png -\raw HTML - -\endraw -\inlineimage windowsxp-doublespinbox.png -\raw HTML -
    -\endraw -The QComboBox widget is a combined button and pop-up list.\raw HTML - -\endraw -The QDoubleSpinBox class provides a spin box widget that allows double precision floating point numbers to be entered.\raw HTML -
    -\endraw -\inlineimage windowsxp-spinbox.png -\raw HTML - -\endraw -\inlineimage windowsxp-timeedit.png -\raw HTML -
    -\endraw -The QSpinBox class provides a spin box widget.\raw HTML - -\endraw -The QTimeEdit class provides a widget for editing times.\raw HTML -
    -\endraw -\inlineimage windowsxp-dateedit.png -\raw HTML - -\endraw -\inlineimage windowsxp-datetimeedit.png -\raw HTML -
    -\endraw -The QDateEdit class provides a widget for editing dates.\raw HTML - -\endraw -The QDateTimeEdit class provides a widget for editing dates and times.\raw HTML -
    -\endraw -\inlineimage windowsxp-textedit.png -\raw HTML - -\endraw -\inlineimage windowsxp-horizontalscrollbar.png -\raw HTML -
    -\endraw -The QTextEdit class provides a widget that is used to edit and - display both plain and rich text.\raw HTML - -\endraw -The QScrollBar widget provides a vertical or horizontal scroll bar. Here, we show a scroll bar with horizontal orientation.\raw HTML -
    -\endraw -\inlineimage windowsxp-dial.png -\raw HTML - -\endraw -\inlineimage windowsxp-calendarwidget.png -\raw HTML -
    -\endraw -The QDial class provides a rounded range control (like a - speedometer or potentiometer).\raw HTML - -\endraw -The QCalendarWidget class provides a monthly calendar widget that can be used to select dates.\raw HTML -
    -\endraw -\inlineimage windowsxp-fontcombobox.png -\raw HTML -
    -\endraw -The QFontComboBox widget is a specialized combobox that enables fonts to be selected from a pop-up list containing previews of available fonts.\raw HTML -
    -\endraw +\section2 Item Views + +\table 100% +\row +\o \image windowsxp-listview.png + The QListView class provides a default model/view implementation of a list/icon view. The QListWidget class provides a classic item-based list/icon view. +\o \image windowsxp-treeview.png + The QTreeView class provides a default model/view implementation of a tree view. The QTreeWidget class provides a classic item-based tree view. +\o \image windowsxp-tableview.png + The QTableView class provides a default model/view implementation of a table view. The QTableWidget class provides a classic item-based table view.\o +\o +\endtable + +\section2 Display Widgets + +\table 100% +\row +\o \image windowsxp-progressbar.png + The QProgressBar widget provides a horizontal progress bar. +\o \image windowsxp-label.png + The QLabel widget provides a text or image display. +\o \image windowsxp-lcdnumber.png + The QLCDNumber widget displays a number with LCD-like digits. +\endtable + +\section2 Input Widgets + +\table 100% +\row +\o \image windowsxp-lineedit.png + The QLineEdit widget is a one-line text editor. +\o \image windowsxp-dateedit.png + The QDateEdit class provides a widget for editing dates. +\o \image windowsxp-timeedit.png + The QTimeEdit class provides a widget for editing times. +\o \image windowsxp-datetimeedit.png + The QDateTimeEdit class provides a widget for editing dates and times. +\endtable + +\table 100% +\row +\o \image windowsxp-slider.png + The QSlider widget provides a vertical or horizontal slider. +\o \image windowsxp-combobox.png + The QComboBox widget is a combined button and pop-up list. +\o \image windowsxp-spinbox.png + The QSpinBox class provides a spin box widget. +\endtable + +\table 100% +\row +\o \image windowsxp-fontcombobox.png + The QFontComboBox widget is a specialized combobox that enables fonts to be selected from a pop-up list containing previews of available fonts. +\o \image windowsxp-doublespinbox.png + The QDoubleSpinBox class provides a spin box widget that allows double precision floating point numbers to be entered. +\o \image windowsxp-horizontalscrollbar.png + The QScrollBar widget provides a vertical or horizontal scroll bar. Here, we show a scroll bar with horizontal orientation. +\endtable + +\table 100% +\row +\o \image windowsxp-dial.png + The QDial class provides a rounded range control (like a speedometer or potentiometer). +\o \image windowsxp-textedit.png + The QTextEdit class provides a widget that is used to edit and display both plain and rich text. +\o \image windowsxp-calendarwidget.png + The QCalendarWidget class provides a monthly calendar widget that can be used to select dates. +\endtable */ -- cgit v0.12 From 53dc4de29913356e9521ac433fb13b36d2b5ab8b Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 13 Dec 2010 12:23:29 +0100 Subject: doc: Replaced some \raw and \endraw uses with \table and \endtable In DITA XML, there is no straightforward way to translate raw html into DITA XML, because the XML stream writer automagically escapes all the raw html elements. So I am beginning to replace uses of the \raw command with \table, which gets output correctly. The problem is the XML stream writer must see each XML element start and end, because it keeps them on a stack. When you output XML elements with the writeCharacters() function, it escapes the '<' and '>' of any XML elements the character string contains. --- doc/src/widgets-and-layouts/gallery.qdoc | 112 +++++++++---------------------- 1 file changed, 30 insertions(+), 82 deletions(-) diff --git a/doc/src/widgets-and-layouts/gallery.qdoc b/doc/src/widgets-and-layouts/gallery.qdoc index 201817b..d11d9c8 100644 --- a/doc/src/widgets-and-layouts/gallery.qdoc +++ b/doc/src/widgets-and-layouts/gallery.qdoc @@ -34,103 +34,51 @@ with the native desktop enviroment. Below, you can find links to the various widget styles that are supplied with Qt 4. - \raw HTML - - - - - - - - - - - - - - - - - - - - - - - - -
    - \endraw - \image plastique-tabwidget.png Plastique Style Widget Gallery - - \bold{\l{Plastique Style Widget Gallery}} + \table + \row + \o \image plastique-tabwidget.png Plastique Style Widget Gallery + \caption \l{Plastique Style Widget Gallery} The Plastique style is provided by QPlastiqueStyle. - \raw HTML - - \endraw - \image windowsxp-tabwidget.png Windows XP Style Widget Gallery - - \bold{\l{Windows XP Style Widget Gallery}} + \o \image windowsxp-tabwidget.png Windows XP Style Widget Gallery + \caption \l{Windows XP Style Widget Gallery} The Windows XP style is provided by QWindowsXPStyle. - \raw HTML -
    - \endraw - \image gtk-tabwidget.png GTK Style Widget Gallery + \o \image windows-tabwidget.png Windows Style Widget Gallery + \caption \l{Windows Style Widget Gallery} - \bold{\l{GTK Style Widget Gallery}} - - The GTK style is provided by QGtkStyle. - \raw HTML - - \endraw - \image macintosh-tabwidget.png Macintosh Style Widget Gallery + The Windows style is provided by QWindowsStyle. + \endtable - \bold{\l{Macintosh Style Widget Gallery}} + \table + \row + \o \image macintosh-tabwidget.png Macintosh Style Widget Gallery + \caption \l{Macintosh Style Widget Gallery} The Macintosh style is provided by QMacStyle. - \raw HTML -
    - \endraw - \image cleanlooks-tabwidget.png Cleanlooks Style Widget Gallery - - \bold{\l{Cleanlooks Style Widget Gallery}} + \o \image cleanlooks-tabwidget.png Cleanlooks Style Widget Gallery + \caption \l{Cleanlooks Style Widget Gallery} The Cleanlooks style is provided by QCleanlooksStyle. - \raw HTML - - \endraw - \image windowsvista-tabwidget.png Windows Vista Style Widget Gallery - - \bold{\l{Windows Vista Style Widget Gallery}} + \o \image windowsvista-tabwidget.png Windows Vista Style Widget Gallery + \caption \l{Windows Vista Style Widget Gallery} The Windows Vista style is provided by QWindowsVistaStyle. - \raw HTML -
    - \endraw - \image motif-tabwidget.png Motif Style Widget Gallery + \endtable - \bold{\l{Motif Style Widget Gallery}} + \table + \row + \o \image gtk-tabwidget.png GTK Style Widget Gallery + \caption \l{GTK Style Widget Gallery} - The Motif style is provided by QMotifStyle. - \raw HTML - - \endraw - \image windows-tabwidget.png Windows Style Widget Gallery - - \bold{\l{Windows Style Widget Gallery}} - - The Windows style is provided by QWindowsStyle. - \raw HTML -
    - \endraw - \image cde-tabwidget.png CDE Style Widget Gallery + The GTK style is provided by QGtkStyle. + \o \image motif-tabwidget.png Motif Style Widget Gallery + \caption \l{Motif Style Widget Gallery} - \bold{\l{CDE Style Widget Gallery}} + The Motif style is provided by QMotifStyle. + \o \image cde-tabwidget.png CDE Style Widget Gallery + \caption \l{CDE Style Widget Gallery} The Common Desktop Environment style is provided by QCDEStyle. - \raw HTML -
    - \endraw + \endtable */ -- cgit v0.12 From 7ee2e9fd873b2c38a1a362170c4a0e4754cfd22a Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Mon, 18 Oct 2010 09:28:14 +0200 Subject: Cocoa: native child filedialogs sometimes shows non-native on screen The reason is that we make all child dialogs of a modal dialogs non-modaly shaddowed, as documented. But we forgot to check if a window is actually visible before raising it to front. Also adding harmless auto release pool Rev-By: prasanth --- src/gui/kernel/qeventdispatcher_mac.mm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qeventdispatcher_mac.mm b/src/gui/kernel/qeventdispatcher_mac.mm index 515c6d3..dc926e0 100644 --- a/src/gui/kernel/qeventdispatcher_mac.mm +++ b/src/gui/kernel/qeventdispatcher_mac.mm @@ -844,7 +844,7 @@ static void setChildrenWorksWhenModal(QWidget *widget, bool worksWhenModal) NSWindow *window = qt_mac_window_for(dialogs[i]); if (window && [window isKindOfClass:[NSPanel class]]) { [static_cast(window) setWorksWhenModal:worksWhenModal]; - if (worksWhenModal && dialogs[i]->isVisible()){ + if (worksWhenModal && [window isVisible]){ [window orderFront:window]; } } @@ -856,6 +856,7 @@ void QEventDispatcherMacPrivate::updateChildrenWorksWhenModal() // Make the dialog children of the widget // active. And make the dialog children of // the previous modal dialog unactive again: + QMacCocoaAutoReleasePool pool; int size = cocoaModalSessionStack.size(); if (size > 0){ if (QWidget *prevModal = cocoaModalSessionStack[size-1].widget) -- cgit v0.12 From a04b19d34c23df5bb6e4f499b6b12c7a1211969a Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Mon, 18 Oct 2010 15:27:02 +0200 Subject: Cocoa: make sure stays on top child windows are not levelled down [NSWindow addChild] levels the child to the level of the parent. In Qt we do not want this. So we do a check after setting up the parent-child relationship for this. Reviewed-by: cduclos --- src/gui/kernel/qwidget_mac.mm | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 997419b..08af3ac 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -2822,8 +2822,12 @@ void QWidgetPrivate::setSubWindowStacking(bool set) if (NSWindow *pwin = [qt_mac_nativeview_for(parent) window]) { if (set) { Qt::WindowType ptype = parent->window()->windowType(); - if ([pwin isVisible] && (ptype == Qt::Window || ptype == Qt::Dialog) && ![qwin parentWindow]) + if ([pwin isVisible] && (ptype == Qt::Window || ptype == Qt::Dialog) && ![qwin parentWindow]) { + NSInteger level = [qwin level]; [pwin addChildWindow:qwin ordered:NSWindowAbove]; + if ([qwin level] < level) + [qwin setLevel:level]; + } } else { [pwin removeChildWindow:qwin]; } @@ -2837,8 +2841,12 @@ void QWidgetPrivate::setSubWindowStacking(bool set) if (NSWindow *cwin = [qt_mac_nativeview_for(child) window]) { if (set) { Qt::WindowType ctype = child->window()->windowType(); - if ([cwin isVisible] && (ctype == Qt::Window || ctype == Qt::Dialog) && ![cwin parentWindow]) + if ([cwin isVisible] && (ctype == Qt::Window || ctype == Qt::Dialog) && ![cwin parentWindow]) { + NSInteger level = [cwin level]; [qwin addChildWindow:cwin ordered:NSWindowAbove]; + if ([cwin level] < level) + [cwin setLevel:level]; + } } else { [qwin removeChildWindow:qt_mac_window_for(child)]; } -- cgit v0.12 From 19148694b1e094ad968e26e6fab448d3d2c7f4d4 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Mon, 18 Oct 2010 15:30:12 +0200 Subject: Cocoa: cannot use staysOnTop flag for native file dialogs We cannot mix staysOnTop and native file dialogs, since Cocoa will anyway set it back to NSModalPanelWindowLevel when running it app modal. There are ways to work around this issue, but the file dialog also has a button for showing a "create directory" modal panel, and this we cannot control. Reviewed-by: cduclos --- src/gui/dialogs/qfiledialog_mac.mm | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/gui/dialogs/qfiledialog_mac.mm b/src/gui/dialogs/qfiledialog_mac.mm index 87850a7..1e13113 100644 --- a/src/gui/dialogs/qfiledialog_mac.mm +++ b/src/gui/dialogs/qfiledialog_mac.mm @@ -719,6 +719,14 @@ bool QFileDialogPrivate::setVisible_sys(bool visible) if (!visible == q->isHidden()) return false; + if (q->windowFlags() & Qt::WindowStaysOnTopHint) { + // The native file dialog tries all it can to stay + // on the NSModalPanel level. And it might also show + // its own "create directory" dialog that we cannot control. + // So we need to use the non-native version in this case... + return false; + } + #ifndef QT_MAC_USE_COCOA return visible ? showCarbonNavServicesDialog() : hideCarbonNavServicesDialog(); #else -- cgit v0.12 From 3e2cb226277998a7841c85048493c89bc1ccc95f Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Mon, 18 Oct 2010 16:12:46 +0200 Subject: Cocoa: Fix addChildWindow bug where we connect a grandparent to a child A plain bug where we ask for a list of widgets, but forget that qFindChildren is recursive, which is not what we want. Reviewed-by: jbache --- src/gui/kernel/qwidget_mac.mm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 08af3ac..b89cb88 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -2834,9 +2834,9 @@ void QWidgetPrivate::setSubWindowStacking(bool set) } } - QList widgets = q->findChildren(); + QObjectList widgets = q->children(); for (int i=0; i(widgets.at(i)); if (child && child->isWindow()) { if (NSWindow *cwin = [qt_mac_nativeview_for(child) window]) { if (set) { -- cgit v0.12 From 780b4d84205f16c46f6c5e85e6c1925beb4e4dba Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Mon, 22 Nov 2010 11:08:34 +0100 Subject: Cocoa: combobox does not hightlight when mouse re-hovers the first item The reason is that on Mac, the highlight is supposed to switch off when the mouse moves out of the drop down menu. On X11, it stays. So there is a separate code path for this in qcombobox.cpp. But it fails to clear the index set in the view when the mouse leaves, which stops the item from re-highligh when the mouse re-enters. Reviewed-by: ogoffart --- src/gui/widgets/qcombobox.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/widgets/qcombobox.cpp b/src/gui/widgets/qcombobox.cpp index 7859bdc..5a4e507 100644 --- a/src/gui/widgets/qcombobox.cpp +++ b/src/gui/widgets/qcombobox.cpp @@ -398,7 +398,7 @@ void QComboBoxPrivateContainer::leaveEvent(QEvent *) #ifdef Q_WS_MAC QStyleOptionComboBox opt = comboStyleOption(); if (combo->style()->styleHint(QStyle::SH_ComboBox_Popup, &opt, combo)) - view->clearSelection(); + view->setCurrentIndex(QModelIndex()); #endif } -- cgit v0.12 From d9004ddf237a09f3b7f25128ceb83a0e79e7b1aa Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Mon, 13 Dec 2010 13:39:34 +0100 Subject: Cocoa: popup hides behind window Reason: when cocoa receives a mouse press/release in a window, it finds the correct view inside that window and sends the mouse event to it. But NSWindow also does some other stuff just before sending the event, like raise and lower windows. So when we override sendEvent, and more over, do not call [super sendEvent], we stop this raise/lower etc from working. So, to make this work again, I partially revert change 0b2eab87ad3bd73a0744469a45c29ca098649c9b Task-number: QTBUG-15638, QTBUG-1517 Reviewed-by: Fabien Freling --- src/gui/kernel/qcocoasharedwindowmethods_mac_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h b/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h index ddf1a27..1e2e71b 100644 --- a/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h +++ b/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h @@ -182,7 +182,7 @@ QT_END_NAMESPACE bool handled = false; // sometimes need to redirect mouse events to the popup. QWidget *popup = qAppInstance()->activePopupWidget(); - if (popup) { + if (popup && popup != widget) { switch([event type]) { case NSLeftMouseDown: -- cgit v0.12 From 485ac91fd7e1243fad8809c0664130b52c5fa0bb Mon Sep 17 00:00:00 2001 From: David Boddie Date: Mon, 13 Dec 2010 14:07:05 +0100 Subject: Removed trailing whitespace. --- tools/qdoc3/atom.h | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/tools/qdoc3/atom.h b/tools/qdoc3/atom.h index 70fbae9..5b7da31 100644 --- a/tools/qdoc3/atom.h +++ b/tools/qdoc3/atom.h @@ -56,20 +56,20 @@ class Atom { public: enum Type { - AbstractLeft, - AbstractRight, + AbstractLeft, + AbstractRight, AnnotatedList, AutoLink, - BaseName, + BaseName, BriefLeft, - BriefRight, + BriefRight, C, - CaptionLeft, + CaptionLeft, CaptionRight, - Code, - CodeBad, - CodeNew, - CodeOld, + Code, + CodeBad, + CodeNew, + CodeOld, CodeQuoteArgument, CodeQuoteCommand, #ifdef QDOC_QML @@ -77,42 +77,42 @@ class Atom #endif FootnoteLeft, FootnoteRight, - FormatElse, + FormatElse, FormatEndif, FormatIf, FormattingLeft, FormattingRight, GeneratedList, - Image, + Image, ImageText, InlineImage, LegaleseLeft, LegaleseRight, - LineBreak, - Link, + LineBreak, + Link, LinkNode, - ListLeft, + ListLeft, ListItemNumber, ListTagLeft, ListTagRight, ListItemLeft, - ListItemRight, - ListRight, - Nop, + ListItemRight, + ListRight, + Nop, ParaLeft, - ParaRight, + ParaRight, #ifdef QDOC_QML Qml, QmlText, #endif - QuotationLeft, + QuotationLeft, QuotationRight, RawString, SectionLeft, SectionRight, SectionHeadingLeft, SectionHeadingRight, - SidebarLeft, + SidebarLeft, SidebarRight, SinceList, SnippetCommand, @@ -120,18 +120,18 @@ class Atom SnippetLocation, String, TableLeft, - TableRight, + TableRight, TableHeaderLeft, TableHeaderRight, TableRowLeft, - TableRowRight, - TableItemLeft, + TableRowRight, + TableItemLeft, TableItemRight, TableOfContents, Target, - UnhandledFormat, + UnhandledFormat, UnknownCommand, - Last = UnknownCommand + Last = UnknownCommand }; Atom(Type type, const QString &string = "") -- cgit v0.12 From 69ed34d2aa77a3bacc7f66797baa514f35358b7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Mon, 13 Dec 2010 14:21:39 +0100 Subject: Fixed GL 2 engine rendering of images / pixmaps above max texture size. Down-scale images or pixmaps that are above the max texture size. Not optimal performance-wise, but better than failing. Task-number: QTBUG-16033 Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../gl2paintengineex/qpaintengineex_opengl2.cpp | 52 +++++++++++++++++++--- .../gl2paintengineex/qpaintengineex_opengl2_p.h | 2 + 2 files changed, 49 insertions(+), 5 deletions(-) diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index 4a64f39..668a3f0 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -163,6 +163,8 @@ void QGL2PaintEngineExPrivate::setBrush(const QBrush& brush) Q_ASSERT(newStyle != Qt::NoBrush); currentBrush = brush; + if (!currentBrushPixmap.isNull()) + currentBrushPixmap = QPixmap(); brushUniformsDirty = true; // All brushes have at least one uniform if (newStyle > Qt::SolidPattern) @@ -221,10 +223,14 @@ void QGL2PaintEngineExPrivate::updateBrushTexture() updateTextureFilter(GL_TEXTURE_2D, GL_CLAMP_TO_EDGE, q->state()->renderHints & QPainter::SmoothPixmapTransform); } else if (style == Qt::TexturePattern) { - const QPixmap& texPixmap = currentBrush.texture(); + currentBrushPixmap = currentBrush.texture(); + + int max_texture_size = ctx->d_func()->maxTextureSize(); + if (currentBrushPixmap.width() > max_texture_size || currentBrushPixmap.height() > max_texture_size) + currentBrushPixmap = currentBrushPixmap.scaled(max_texture_size, max_texture_size, Qt::KeepAspectRatio); glActiveTexture(GL_TEXTURE0 + QT_BRUSH_TEXTURE_UNIT); - QGLTexture *tex = ctx->d_func()->bindTexture(texPixmap, GL_TEXTURE_2D, GL_RGBA, + QGLTexture *tex = ctx->d_func()->bindTexture(currentBrushPixmap, GL_TEXTURE_2D, GL_RGBA, QGLContext::InternalBindOption | QGLContext::CanFlipNativePixmapBindOption); updateTextureFilter(GL_TEXTURE_2D, GL_REPEAT, q->state()->renderHints & QPainter::SmoothPixmapTransform); @@ -1305,13 +1311,30 @@ void QGL2PaintEngineEx::transformChanged() } +static const QRectF scaleRect(const QRectF &r, qreal sx, qreal sy) +{ + return QRectF(r.x() * sx, r.y() * sy, r.width() * sx, r.height() * sy); +} + void QGL2PaintEngineEx::drawPixmap(const QRectF& dest, const QPixmap & pixmap, const QRectF & src) { Q_D(QGL2PaintEngineEx); + QGLContext *ctx = d->ctx; + + int max_texture_size = ctx->d_func()->maxTextureSize(); + if (pixmap.width() > max_texture_size || pixmap.height() > max_texture_size) { + QPixmap scaled = pixmap.scaled(max_texture_size, max_texture_size, Qt::KeepAspectRatio); + + const qreal sx = scaled.width() / qreal(pixmap.width()); + const qreal sy = scaled.height() / qreal(pixmap.height()); + + drawPixmap(dest, scaled, scaleRect(src, sx, sy)); + return; + } + ensureActive(); d->transferMode(ImageDrawingMode); - QGLContext *ctx = d->ctx; glActiveTexture(GL_TEXTURE0 + QT_IMAGE_TEXTURE_UNIT); QGLTexture *texture = ctx->d_func()->bindTexture(pixmap, GL_TEXTURE_2D, GL_RGBA, @@ -1334,11 +1357,24 @@ void QGL2PaintEngineEx::drawImage(const QRectF& dest, const QImage& image, const Qt::ImageConversionFlags) { Q_D(QGL2PaintEngineEx); + QGLContext *ctx = d->ctx; + + int max_texture_size = ctx->d_func()->maxTextureSize(); + if (image.width() > max_texture_size || image.height() > max_texture_size) { + QImage scaled = image.scaled(max_texture_size, max_texture_size, Qt::KeepAspectRatio); + + const qreal sx = scaled.width() / qreal(image.width()); + const qreal sy = scaled.height() / qreal(image.height()); + + drawImage(dest, scaled, scaleRect(src, sx, sy)); + return; + } + ensureActive(); d->transferMode(ImageDrawingMode); - QGLContext *ctx = d->ctx; glActiveTexture(GL_TEXTURE0 + QT_IMAGE_TEXTURE_UNIT); + QGLTexture *texture = ctx->d_func()->bindTexture(image, GL_TEXTURE_2D, GL_RGBA, QGLContext::InternalBindOption); GLuint id = texture->id; @@ -1737,7 +1773,13 @@ void QGL2PaintEngineEx::drawPixmapFragments(const QPainter::PixmapFragment *frag } ensureActive(); - d->drawPixmapFragments(fragments, fragmentCount, pixmap, hints); + int max_texture_size = d->ctx->d_func()->maxTextureSize(); + if (pixmap.width() > max_texture_size || pixmap.height() > max_texture_size) { + QPixmap scaled = pixmap.scaled(max_texture_size, max_texture_size, Qt::KeepAspectRatio); + d->drawPixmapFragments(fragments, fragmentCount, scaled, hints); + } else { + d->drawPixmapFragments(fragments, fragmentCount, pixmap, hints); + } } diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h index b255e75..02b737b 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h @@ -274,6 +274,8 @@ public: QBrush currentBrush; // May not be the state's brush! const QBrush noBrush; + QPixmap currentBrushPixmap; + QGL2PEXVertexArray vertexCoordinateArray; QGL2PEXVertexArray textureCoordinateArray; QVector elementIndices; -- cgit v0.12 From 0af1f5508e165f3b494ab236cb1cdf1b0edcffa5 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Mon, 13 Dec 2010 11:29:22 +0100 Subject: Fixes text jitter in QtQuick components when using the virtual keyboard QGraphicsView::mapFromScene() returns a QRect instead of a QRectF. Thus, we were prematurely rounding the micro focus rectangle coordinates in QGraphicsView::inputMethodQuery(). (The Qt::ImMicroFocus query returns a QRectF from QGraphicsScene, which is the result of querying QDeclarativeTextEdit and mapping it to the scene.) Auto-test included. Reviewed-by: leo Reviewed-by: bnilsen Task-number: QTCOMPONENTS-288 Task-number: QTBUG-16063 --- src/gui/graphicsview/qgraphicsview.cpp | 2 +- tests/auto/qgraphicsview/tst_qgraphicsview.cpp | 39 ++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp index a566c8e..2acea8a 100644 --- a/src/gui/graphicsview/qgraphicsview.cpp +++ b/src/gui/graphicsview/qgraphicsview.cpp @@ -2494,7 +2494,7 @@ QVariant QGraphicsView::inputMethodQuery(Qt::InputMethodQuery query) const QVariant value = d->scene->inputMethodQuery(query); if (value.type() == QVariant::RectF) - value = mapFromScene(value.toRectF()).boundingRect(); + value = d->mapRectFromScene(value.toRectF()); else if (value.type() == QVariant::PointF) value = mapFromScene(value.toPointF()); else if (value.type() == QVariant::Rect) diff --git a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp index 0a9633f..e1fbaee 100644 --- a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp @@ -246,6 +246,7 @@ private slots: void QTBUG_4151_clipAndIgnore(); void QTBUG_5859_exposedRect(); void QTBUG_7438_cursor(); + void QTBUG_16063_microFocusRect(); public slots: void dummySlot() {} @@ -4450,5 +4451,43 @@ void tst_QGraphicsView::QTBUG_7438_cursor() #endif } +class IMItem : public QGraphicsRectItem +{ +public: + IMItem(QGraphicsItem *parent = 0): + QGraphicsRectItem(mf.adjusted(-5, -5, 5, 5), parent) + { + setFlag(QGraphicsItem::ItemIsFocusable, true); + setFlag(QGraphicsItem::ItemAcceptsInputMethod, true); + } + + QVariant inputMethodQuery(Qt::InputMethodQuery query) const + { + return mf; + } + + static QRectF mf; +}; + +QRectF IMItem::mf(1.5, 1.6, 10, 10); + +void tst_QGraphicsView::QTBUG_16063_microFocusRect() +{ + QGraphicsScene scene; + IMItem *item = new IMItem(); + scene.addItem(item); + + QGraphicsView view(&scene); + + view.setFixedSize(40, 40); + view.show(); + QTest::qWaitForWindowShown(&view); + + scene.setFocusItem(item); + view.setFocus(); + QRectF mfv = view.inputMethodQuery(Qt::ImMicroFocus).toRectF(); + QCOMPARE(mfv, QRectF(13.5, 13.6, 10, 10)); +} + QTEST_MAIN(tst_QGraphicsView) #include "tst_qgraphicsview.moc" -- cgit v0.12 From d5fe82b2ab939727f573429605abd99c039a99d1 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Mon, 13 Dec 2010 15:41:16 +0200 Subject: Fix crash when creating more than one QApplication in single test case CBA pointer is stored in static variable and it wasn't cleaned up properly at QApplication destruction, which led to crash. Task-number: QTBUG-15915 Reviewed-by: Sami Merila Reviewed-by: Janne Koskinen --- src/gui/kernel/qapplication_s60.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 8596563..81fa4e6 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -1633,6 +1633,13 @@ void qt_cleanup() //Change mouse pointer back S60->wsSession().SetPointerCursorMode(EPointerCursorNone); +#ifdef Q_WS_S60 + // Clear CBA + CEikonEnv::Static()->AppUiFactory()->SwapButtonGroup(0); + delete S60->buttonGroupContainer(); + S60->setButtonGroupContainer(0); +#endif + if (S60->qtOwnsS60Environment) { // Restore the S60 framework trap handler. See qt_init(). User::SetTrapHandler(S60->s60InstalledTrapHandler); -- cgit v0.12 From 50d3c15bd16f4e70327f8de30c8c0df5ed2f995c Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Mon, 13 Dec 2010 16:08:36 +0200 Subject: Minor optimization Use already defined factory pointer instead of re-asking it twice. Reviewed-by: Janne Koskinen --- src/gui/kernel/qwidget_s60.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index 609307c..d6ad3c3 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -504,7 +504,7 @@ void QWidgetPrivate::show_sys() CEikButtonGroupContainer *cba = CEikButtonGroupContainer::NewL(CEikButtonGroupContainer::ECba, CEikButtonGroupContainer::EHorizontal,ui,R_AVKON_SOFTKEYS_EMPTY_WITH_IDS); - CEikButtonGroupContainer *oldCba = CEikonEnv::Static()->AppUiFactory()->SwapButtonGroup(cba); + CEikButtonGroupContainer *oldCba = factory->SwapButtonGroup(cba); Q_ASSERT(!oldCba); S60->setButtonGroupContainer(cba); @@ -513,7 +513,7 @@ void QWidgetPrivate::show_sys() menuBar->SetMenuType(CEikMenuBar::EMenuOptions); S60->appUi()->AddToStackL(menuBar,ECoeStackPriorityMenu,ECoeStackFlagRefusesFocus); - CEikMenuBar *oldMenu = CEikonEnv::Static()->AppUiFactory()->SwapMenuBar(menuBar); + CEikMenuBar *oldMenu = factory->SwapMenuBar(menuBar); Q_ASSERT(!oldMenu); ) -- cgit v0.12 From 5e0be0aae4aa4011b4dbf7d1d457e4c8b4f6d4dc Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Mon, 13 Dec 2010 16:12:25 +0200 Subject: Fix qapplication autotest deployment Necessary default deployment was getting removed from qapplication test Task-number: QTBUG-15915 Reviewed-by: Janne Koskinen --- tests/auto/qapplication/test/test.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/qapplication/test/test.pro b/tests/auto/qapplication/test/test.pro index 2c54c37..d946e7e 100644 --- a/tests/auto/qapplication/test/test.pro +++ b/tests/auto/qapplication/test/test.pro @@ -17,7 +17,7 @@ symbian: { someTest.sources = test.pro someTest.path = test windowIcon.sources = ../heart.svg - DEPLOYMENT = additional deploy someTest windowIcon + DEPLOYMENT += additional deploy someTest windowIcon LIBS += -lcone -lavkon } -- cgit v0.12 From 44911b0d44f4840e0d7678f8de7227a3a4018d34 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Mon, 13 Dec 2010 16:15:51 +0200 Subject: Non-hacky fix for qwidget autotest Turns out there is a nice way for getting current CBA, CEikButtonGroupContainer::Current(), so using that instead of the previous hack. Task-number: QTBUG-15915 Reviewed-by: Janne Koskinen --- tests/auto/qwidget/tst_qwidget.cpp | 32 +++++--------------------------- 1 file changed, 5 insertions(+), 27 deletions(-) diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index 6069383..d611225 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -10029,28 +10029,6 @@ void tst_QWidget::openModal_taskQTBUG_5804() } #ifdef Q_OS_SYMBIAN - -static CEikButtonGroupContainer* cba() -{ - CEikButtonGroupContainer *oldCba = NULL; - - // Due to convoluted/buggy implementation of MEikAppUiFactory interface in Symbian, - // the only way to get the correct cba is to use SwapButtonGroup function. - // Calling SwapButtonGroup doesn't trigger anything, it only changes the value of iToolbar - // member variable, so this double switching should not cause any interference for test. - QT_TRAP_THROWING( - CEikButtonGroupContainer *dummyCba = CEikButtonGroupContainer::NewL( - CEikButtonGroupContainer::ECba, CEikButtonGroupContainer::EHorizontal, NULL, 0); - - oldCba = CEikonEnv::Static()->AppUiFactory()->SwapButtonGroup(dummyCba); - CEikonEnv::Static()->AppUiFactory()->SwapButtonGroup(oldCba); - - delete dummyCba; - ) - - return oldCba; -} - void tst_QWidget::cbaVisibility() { // Test case for task 261048 @@ -10083,7 +10061,7 @@ void tst_QWidget::cbaVisibility() // Verify window decorations i.e. status pane and CBA are visible. CEikStatusPane* statusPane = CEikonEnv::Static()->AppUiFactory()->StatusPane(); QVERIFY(statusPane->IsVisible()); - CEikButtonGroupContainer* buttonGroup = cba(); + CEikButtonGroupContainer* buttonGroup = CEikButtonGroupContainer::Current(); QVERIFY(buttonGroup->IsVisible()); } @@ -10100,7 +10078,7 @@ void tst_QWidget::fullScreenWindowModeTransitions() const QRect fullScreenGeometry = qApp->desktop()->screenGeometry(&widget); const QRect maximumScreenGeometry = qApp->desktop()->availableGeometry(&widget); CEikStatusPane *statusPane = CEikonEnv::Static()->AppUiFactory()->StatusPane(); - CEikButtonGroupContainer *buttonGroup = cba(); + CEikButtonGroupContainer *buttonGroup = CEikButtonGroupContainer::Current(); //Enter widget.showNormal(); @@ -10154,7 +10132,7 @@ void tst_QWidget::maximizedWindowModeTransitions() const QRect fullScreenGeometry = qApp->desktop()->screenGeometry(&widget); const QRect maximumScreenGeometry = qApp->desktop()->availableGeometry(&widget); CEikStatusPane *statusPane = CEikonEnv::Static()->AppUiFactory()->StatusPane(); - CEikButtonGroupContainer *buttonGroup = cba(); + CEikButtonGroupContainer *buttonGroup = CEikButtonGroupContainer::Current(); //Enter widget.showNormal(); @@ -10210,7 +10188,7 @@ void tst_QWidget::minimizedWindowModeTransitions() const QRect fullScreenGeometry = qApp->desktop()->screenGeometry(&widget); const QRect maximumScreenGeometry = qApp->desktop()->availableGeometry(&widget); CEikStatusPane *statusPane = CEikonEnv::Static()->AppUiFactory()->StatusPane(); - CEikButtonGroupContainer *buttonGroup = cba(); + CEikButtonGroupContainer *buttonGroup = CEikButtonGroupContainer::Current(); //Enter widget.showNormal(); @@ -10266,7 +10244,7 @@ void tst_QWidget::normalWindowModeTransitions() const QRect fullScreenGeometry = qApp->desktop()->screenGeometry(&widget); const QRect maximumScreenGeometry = qApp->desktop()->availableGeometry(&widget); CEikStatusPane *statusPane = CEikonEnv::Static()->AppUiFactory()->StatusPane(); - CEikButtonGroupContainer *buttonGroup = cba(); + CEikButtonGroupContainer *buttonGroup = CEikButtonGroupContainer::Current(); //Enter widget.showMaximized(); -- cgit v0.12 From b8f639f27a05043f9f9ac371352508d6527f0123 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 10 Dec 2010 10:00:54 +0100 Subject: Comment a bit more the timer ID allocation code. Also add the notes for where to place .loadAcquire when that function exists. Reviewed-By: Bradley T. Hughes --- src/corelib/kernel/qabstracteventdispatcher.cpp | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/corelib/kernel/qabstracteventdispatcher.cpp b/src/corelib/kernel/qabstracteventdispatcher.cpp index bcf4477..1c1c6e3 100644 --- a/src/corelib/kernel/qabstracteventdispatcher.cpp +++ b/src/corelib/kernel/qabstracteventdispatcher.cpp @@ -120,11 +120,20 @@ void QAbstractEventDispatcherPrivate::init() } } +// Timer IDs are implemented using a free-list; +// there's a vector initialized with: +// X[i] = i + 1 +// and nextFreeTimerId starts with 1. +// +// Allocating a timer ID involves taking the ID from +// X[nextFreeTimerId] +// updating nextFreeTimerId to this value and returning the old value +// (continues below). int QAbstractEventDispatcherPrivate::allocateTimerId() { int timerId, newTimerId; do { - timerId = nextFreeTimerId; + timerId = nextFreeTimerId; //.loadAcquire(); // ### FIXME Proper memory ordering semantics // which bucket are we looking in? int which = timerId & 0x00ffffff; @@ -148,6 +157,17 @@ int QAbstractEventDispatcherPrivate::allocateTimerId() return timerId; } +// Releasing a timer ID requires putting the current ID back in the vector; +// we do it by setting: +// X[timerId] = nextFreeTimerId; +// then we update nextFreeTimerId to the timer we've just released +// +// The extra code in allocateTimerId and releaseTimerId are ABA prevention +// and bucket memory. The buckets are simply to make sure we allocate only +// the necessary number of timers. See above. +// +// ABA prevention simply adds a value to 7 of the top 8 bits when resetting +// nextFreeTimerId. void QAbstractEventDispatcherPrivate::releaseTimerId(int timerId) { int which = timerId & 0x00ffffff; @@ -157,7 +177,7 @@ void QAbstractEventDispatcherPrivate::releaseTimerId(int timerId) int freeId, newTimerId; do { - freeId = nextFreeTimerId; + freeId = nextFreeTimerId;//.loadAcquire(); // ### FIXME Proper memory ordering semantics b[at] = freeId & 0x00ffffff; newTimerId = prepareNewValueWithSerialNumber(freeId, timerId); -- cgit v0.12 From f0a892a46fdc438277c8b401c267db4bd92aec1b Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 13 Dec 2010 14:50:07 +0100 Subject: Fix ABA problem with: the serial must be updated on all accesses The nextFreeTimerId's serial counter was only being updated on timer ID releasing. It needs to be updated on allocation too. Reviewed-by: Bradley T. Hughes --- src/corelib/kernel/qabstracteventdispatcher.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/kernel/qabstracteventdispatcher.cpp b/src/corelib/kernel/qabstracteventdispatcher.cpp index 1c1c6e3..5619921 100644 --- a/src/corelib/kernel/qabstracteventdispatcher.cpp +++ b/src/corelib/kernel/qabstracteventdispatcher.cpp @@ -151,7 +151,7 @@ int QAbstractEventDispatcherPrivate::allocateTimerId() } } - newTimerId = b[at]; + newTimerId = prepareNewValueWithSerialNumber(timerId, b[at]); } while (!nextFreeTimerId.testAndSetRelaxed(timerId, newTimerId)); return timerId; -- cgit v0.12 From a02a747a9d5294127dfe3e676a2759e228257e70 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 13 Dec 2010 14:58:16 +0100 Subject: Use constants the timer ID masks instead of values everywhere Reviewed-By: Bradley T. Hughes --- src/corelib/kernel/qabstracteventdispatcher.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/corelib/kernel/qabstracteventdispatcher.cpp b/src/corelib/kernel/qabstracteventdispatcher.cpp index 5619921..002d360 100644 --- a/src/corelib/kernel/qabstracteventdispatcher.cpp +++ b/src/corelib/kernel/qabstracteventdispatcher.cpp @@ -77,10 +77,14 @@ Q_DESTRUCTOR_FUNCTION(timerIdsDestructorFunction) static QBasicAtomicInt nextFreeTimerId = Q_BASIC_ATOMIC_INITIALIZER(1); +static const int TimerIdMask = 0x00ffffff; +static const int TimerSerialMask = ~TimerIdMask & ~0x80000000; +static const int TimerSerialCounter = TimerIdMask + 1; + // avoid the ABA-problem by using 7 of the top 8 bits of the timerId as a serial number static inline int prepareNewValueWithSerialNumber(int oldId, int newId) { - return (newId & 0x00FFFFFF) | ((oldId + 0x01000000) & 0x7f000000); + return (newId & TimerIdMask) | ((oldId + TimerSerialCounter) & TimerSerialMask); } static inline int bucketOffset(int timerId) @@ -136,7 +140,7 @@ int QAbstractEventDispatcherPrivate::allocateTimerId() timerId = nextFreeTimerId; //.loadAcquire(); // ### FIXME Proper memory ordering semantics // which bucket are we looking in? - int which = timerId & 0x00ffffff; + int which = timerId & TimerIdMask; int bucket = bucketOffset(which); int at = bucketIndex(bucket, which); int *b = timerIds[bucket]; @@ -170,7 +174,7 @@ int QAbstractEventDispatcherPrivate::allocateTimerId() // nextFreeTimerId. void QAbstractEventDispatcherPrivate::releaseTimerId(int timerId) { - int which = timerId & 0x00ffffff; + int which = timerId & TimerIdMask; int bucket = bucketOffset(which); int at = bucketIndex(bucket, which); int *b = timerIds[bucket]; @@ -178,7 +182,7 @@ void QAbstractEventDispatcherPrivate::releaseTimerId(int timerId) int freeId, newTimerId; do { freeId = nextFreeTimerId;//.loadAcquire(); // ### FIXME Proper memory ordering semantics - b[at] = freeId & 0x00ffffff; + b[at] = freeId & TimerIdMask; newTimerId = prepareNewValueWithSerialNumber(freeId, timerId); } while (!nextFreeTimerId.testAndSetRelease(freeId, newTimerId)); -- cgit v0.12 From bd9d5c80235ce6d1b005df96c3058b75e82bd6f0 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 13 Dec 2010 15:02:27 +0100 Subject: Add a small protection against releasing a timer twice. The cell corresponding to an allocated timer ID in the free list is unused (because the ID isn't free). So use it to store an invalid value that we can check against the user's value. This provides some protection against a given timer being released twice. Since we store the serial counter of the nextFreeTimerId, getting the same ID twice is a 1-in-128 chance. Reviewed-By: Bradley T. Hughes --- src/corelib/kernel/qabstracteventdispatcher.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/corelib/kernel/qabstracteventdispatcher.cpp b/src/corelib/kernel/qabstracteventdispatcher.cpp index 002d360..bf675a7 100644 --- a/src/corelib/kernel/qabstracteventdispatcher.cpp +++ b/src/corelib/kernel/qabstracteventdispatcher.cpp @@ -132,18 +132,24 @@ void QAbstractEventDispatcherPrivate::init() // Allocating a timer ID involves taking the ID from // X[nextFreeTimerId] // updating nextFreeTimerId to this value and returning the old value +// +// When the timer ID is allocated, its cell in the vector is unused (it's a +// free list). As an added protection, we use the cell to store an invalid +// (negative) value that we can later check for integrity. +// // (continues below). int QAbstractEventDispatcherPrivate::allocateTimerId() { int timerId, newTimerId; + int at, *b; do { timerId = nextFreeTimerId; //.loadAcquire(); // ### FIXME Proper memory ordering semantics // which bucket are we looking in? int which = timerId & TimerIdMask; int bucket = bucketOffset(which); - int at = bucketIndex(bucket, which); - int *b = timerIds[bucket]; + at = bucketIndex(bucket, which); + b = timerIds[bucket]; if (!b) { // allocate a new bucket @@ -158,6 +164,8 @@ int QAbstractEventDispatcherPrivate::allocateTimerId() newTimerId = prepareNewValueWithSerialNumber(timerId, b[at]); } while (!nextFreeTimerId.testAndSetRelaxed(timerId, newTimerId)); + b[at] = -timerId; + return timerId; } @@ -179,6 +187,8 @@ void QAbstractEventDispatcherPrivate::releaseTimerId(int timerId) int at = bucketIndex(bucket, which); int *b = timerIds[bucket]; + Q_ASSERT(b[at] == -timerId); + int freeId, newTimerId; do { freeId = nextFreeTimerId;//.loadAcquire(); // ### FIXME Proper memory ordering semantics -- cgit v0.12 From c4e5d784609533e26ee9ea6459cd315bd9c3c0a4 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Mon, 13 Dec 2010 19:47:23 +0100 Subject: Fixed macro argument handling. Fixed macro definition parsing that confused someone into thinking that single backslashes would appear in macro definitions instead of control codes. Fixed a bug that caused only arguments in general macros to be handled. Enabled arguments in HTML macros. --- tools/qdoc3/doc.cpp | 47 ++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 42 insertions(+), 5 deletions(-) diff --git a/tools/qdoc3/doc.cpp b/tools/qdoc3/doc.cpp index f153dfb..a6e42c6 100644 --- a/tools/qdoc3/doc.cpp +++ b/tools/qdoc3/doc.cpp @@ -374,6 +374,7 @@ class DocParser void leaveTableRow(); CodeMarker *quoteFromFile(); void expandMacro(const QString& name, const QString& def, int numParams); + QString expandMacroToString(const QString &name, const QString &def, int numParams); Doc::SectioningUnit getSectioningUnit(); QString getArgument(bool verbatim = false); QString getOptionalArgument(); @@ -1228,7 +1229,7 @@ void DocParser::parse(const QString& source, } else { location().push(macro.defaultDefLocation.filePath()); - in.insert(pos, macro.defaultDef); + in.insert(pos, expandMacroToString(cmdStr, macro.defaultDef, macro.numParams)); len = in.length(); openedInputs.push(pos + macro.defaultDef.length()); } @@ -1968,15 +1969,14 @@ void DocParser::expandMacro(const QString &name, int j = 0; while (j < def.size()) { int paramNo; - if ((def[j] == '\\') && (j < def.size() - 1) && - ((paramNo = def[j + 1].digitValue()) >= 1) && + if (((paramNo = def[j].unicode()) >= 1) && (paramNo <= numParams)) { if (!rawString.isEmpty()) { append(Atom::RawString, rawString); rawString = ""; } append(Atom::String, args[paramNo - 1]); - j += 2; + j += 1; } else { rawString += def[j++]; @@ -1987,6 +1987,43 @@ void DocParser::expandMacro(const QString &name, } } +QString DocParser::expandMacroToString(const QString &name, const QString &def, int numParams) +{ + if (numParams == 0) { + return def; + } + else { + QStringList args; + QString rawString; + + for (int i = 0; i < numParams; i++) { + if (numParams == 1 || isLeftBraceAhead()) { + args << getArgument(true); + } + else { + location().warning(tr("Macro '\\%1' invoked with too few" + " arguments (expected %2, got %3)") + .arg(name).arg(numParams).arg(i)); + break; + } + } + + int j = 0; + while (j < def.size()) { + int paramNo; + if (((paramNo = def[j].unicode()) >= 1) && + (paramNo <= numParams)) { + rawString += args[paramNo - 1]; + j += 1; + } + else { + rawString += def[j++]; + } + } + return rawString; + } +} + Doc::SectioningUnit DocParser::getSectioningUnit() { QString name = getOptionalArgument(); @@ -2866,7 +2903,7 @@ void Doc::initialize(const Config& config) QString def = config.getString(macroDotName + Config::dot + *f); if (!def.isEmpty()) { macro.otherDefs.insert(*f, def); - int m = Config::numParams(macro.defaultDef); + int m = Config::numParams(def); if (macro.numParams == -1) { macro.numParams = m; } -- cgit v0.12 From b0ee435866b65c22338bfb6c878352ff69d868da Mon Sep 17 00:00:00 2001 From: David Boddie Date: Mon, 13 Dec 2010 19:52:01 +0100 Subject: Added macros for floating images and floating images with alt text. Ideally, these would be HTML-only macros, but the macro system doesn't know whether macro arguments used in pure HTML are file names, so the necessary files are not included. By using qdoc commands, we ensure the files are copied into the generated documentation's images directory. --- tools/qdoc3/test/macros.qdocconf | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/tools/qdoc3/test/macros.qdocconf b/tools/qdoc3/test/macros.qdocconf index 510a8b3..712d5e4 100644 --- a/tools/qdoc3/test/macros.qdocconf +++ b/tools/qdoc3/test/macros.qdocconf @@ -30,6 +30,38 @@ macro.endcomment = "\\c{*/}" macro.uuml.HTML = "ü" macro.mdash.HTML = "—" +# Macros for floating images and floating images with alt text. +# Ideally, these would be HTML-only macros. + +macro.floatleft = "\\raw HTML\n" \ + "
    " \ + "\\endraw\n" \ + "\\inlineimage \1\n" \ + "\\raw HTML\n" \ + "
    \n" \ + "\\endraw\n" +macro.figureleft = "\\raw HTML\n" \ + "
    " \ + "\\endraw\n" \ + "\\inlineimage \1 \2\n" \ + "\\raw HTML\n" \ + "
    \n" \ + "\\endraw\n" +macro.floatright = "\\raw HTML\n" \ + "
    \n" \ + "\\endraw\n" \ + "\\inlineimage \1\n" \ + "\\raw HTML\n" \ + "
    \n" \ + "\\endraw\n" +macro.figureright = "\\raw HTML\n" \ + "
    " \ + "\\endraw\n" \ + "\\inlineimage \1 \2\n" \ + "\\raw HTML\n" \ + "
    \n" \ + "\\endraw\n" + macro.beginfloatleft.HTML = "
    " macro.beginfloatright.HTML = "
    " macro.endfloat.HTML = "
    " -- cgit v0.12 From 95d30d54ca0771a31bf687dac885f02fc1244fc8 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Mon, 13 Dec 2010 19:54:33 +0100 Subject: Doc: Whitespace fix. --- doc/src/template/style/style.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/template/style/style.css b/doc/src/template/style/style.css index 03bc9a9..04d8c05 100755 --- a/doc/src/template/style/style.css +++ b/doc/src/template/style/style.css @@ -281,7 +281,7 @@ color: #4c0033; text-decoration: none; } - .content a:visited:hover + .content a:visited:hover { color: #4c0033; text-decoration: underline; -- cgit v0.12 From 38ac76c159044117c1faba7dbfa3e0ee65c487ed Mon Sep 17 00:00:00 2001 From: David Boddie Date: Mon, 13 Dec 2010 19:55:08 +0100 Subject: Doc: Fixed non-well-formed XHTML. --- doc/src/declarative/qmlinuse.qdoc | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/doc/src/declarative/qmlinuse.qdoc b/doc/src/declarative/qmlinuse.qdoc index 1127b4c..a1be46c 100644 --- a/doc/src/declarative/qmlinuse.qdoc +++ b/doc/src/declarative/qmlinuse.qdoc @@ -72,7 +72,7 @@
    -
    +
    @@ -100,7 +100,7 @@
    -
    +
    @@ -140,7 +140,7 @@
    -
    +
    @@ -185,7 +185,7 @@
    -
    +
    @@ -198,7 +198,7 @@
    -

    QML Interaction Elements

    +

    QML Interaction Elements

    These elements define basic interactions such as touch movements and focus management.

    Elements: @@ -216,7 +216,7 @@
    -
    +
    @@ -243,7 +243,7 @@
    -
    +
    @@ -276,7 +276,7 @@
    -
    +
    @@ -307,7 +307,7 @@
    -
    +
    @@ -334,7 +334,7 @@
    -
    +
    @@ -372,7 +372,7 @@
    -
    +
    @@ -410,7 +410,7 @@
    -
    +
    @@ -441,7 +441,7 @@
    -
    +
    @@ -468,7 +468,7 @@
    -
    +
    -- cgit v0.12 From 5cb2226ddf96555417f08c9bfe35addfc93f6acd Mon Sep 17 00:00:00 2001 From: David Boddie Date: Mon, 13 Dec 2010 19:57:01 +0100 Subject: Doc: Changed floating images to use the new float qdoc macros. --- doc/src/declarative/positioners.qdoc | 22 ++++++---------------- doc/src/declarative/qdeclarativemodels.qdoc | 4 +--- doc/src/getting-started/how-to-learn-qt.qdoc | 4 +--- doc/src/zh_CN/getting-started/how-to-learn-qt.qdoc | 4 +--- .../graphicsitems/qdeclarativeflickable.cpp | 4 +--- .../graphicsitems/qdeclarativegridview.cpp | 8 ++------ .../graphicsitems/qdeclarativemousearea.cpp | 4 +--- .../graphicsitems/qdeclarativerectangle.cpp | 20 +++++--------------- src/declarative/util/qdeclarativelistmodel.cpp | 8 ++------ src/gui/graphicsview/qgraphicsanchorlayout.cpp | 4 +--- 10 files changed, 21 insertions(+), 61 deletions(-) diff --git a/doc/src/declarative/positioners.qdoc b/doc/src/declarative/positioners.qdoc index 9265732..ed320a1 100644 --- a/doc/src/declarative/positioners.qdoc +++ b/doc/src/declarative/positioners.qdoc @@ -53,9 +53,7 @@ graphical elements: \section2 Column -\beginfloatright -\image qml-column.png -\endfloat +\floatright qml-column.png \l Column items are used to vertically arrange items. The following example uses a Column item to arrange three \l Rectangle items in an area defined @@ -70,9 +68,7 @@ must be added to a parent Rectangle, if desired. \section2 Row -\beginfloatright -\image qml-row.png -\endfloat +\floatright qml-row.png \l Row items are used to horizontally arrange items. The following example uses a Row item to arrange three rounded \l Rectangle items in an area defined @@ -87,9 +83,7 @@ left around the edges of the horizontally centered Row item. \section2 Grid -\beginfloatright -\image qml-grid-spacing.png -\endfloat +\floatright qml-grid-spacing.png \l Grid items are used to place items in a grid or table arrangement. The following example uses a Grid item to place four \l Rectangle items @@ -108,10 +102,8 @@ at the appropriate places in the Grid definition. \section2 Flow -\beginfloatright -\image qml-flow-text1.png -\image qml-flow-text2.png -\endfloat +\floatright qml-flow-text1.png +\floatright qml-flow-text2.png \l Flow items are used to place items like words on a page, with rows or columns of non-overlapping items. @@ -137,9 +129,7 @@ control of spacing between items and between lines of items. \section1 Repeaters -\beginfloatright -\image qml-repeater-grid-index.png -\endfloat +\floatright qml-repeater-grid-index.png Repeaters create items from a template for use with positioners, using data from a model. Combining repeaters and positioners is an easy way to lay out diff --git a/doc/src/declarative/qdeclarativemodels.qdoc b/doc/src/declarative/qdeclarativemodels.qdoc index e11cd56..a61b115 100644 --- a/doc/src/declarative/qdeclarativemodels.qdoc +++ b/doc/src/declarative/qdeclarativemodels.qdoc @@ -504,9 +504,7 @@ a Web browser. \l ListView shows a classic list of items with horizontal or vertical placing of items. -\beginfloatright -\inlineimage qml-listview-snippet.png -\endfloat +\floatright qml-listview-snippet.png The following example shows a minimal ListView displaying a sequence of numbers (using an \l{QML Data Models#An Integer}{integer as a model}). diff --git a/doc/src/getting-started/how-to-learn-qt.qdoc b/doc/src/getting-started/how-to-learn-qt.qdoc index e9f462c..e5f1ff9 100644 --- a/doc/src/getting-started/how-to-learn-qt.qdoc +++ b/doc/src/getting-started/how-to-learn-qt.qdoc @@ -51,9 +51,7 @@ key overviews to deepen your understanding of Qt: The Qt \l{Object Model} and \l{Signals and Slots}. - \beginfloatleft - \inlineimage qtdemo-small.png - \endfloat + \floatleft qtdemo-small.png \section1 Getting an Overview diff --git a/doc/src/zh_CN/getting-started/how-to-learn-qt.qdoc b/doc/src/zh_CN/getting-started/how-to-learn-qt.qdoc index d942ee6..598cbea 100644 --- a/doc/src/zh_CN/getting-started/how-to-learn-qt.qdoc +++ b/doc/src/zh_CN/getting-started/how-to-learn-qt.qdoc @@ -41,9 +41,7 @@ 现在您已经编写了一些小型可用的应用程序,并对 Qt 编程有更加广泛的了解。您可以直接着手做自己的项目,但我们建议您阅读以下一些关键简介以加深您对 Qt 的了解:\l{Qt Object Model}Qt 对象模型}和\l{Signals and Slots}{信号和槽}。 - \beginfloatleft - \inlineimage qtdemo-small.png - \endfloat + \floatleft qtdemo-small.png \section1 了解概况 diff --git a/src/declarative/graphicsitems/qdeclarativeflickable.cpp b/src/declarative/graphicsitems/qdeclarativeflickable.cpp index 377f3b5..1899a39 100644 --- a/src/declarative/graphicsitems/qdeclarativeflickable.cpp +++ b/src/declarative/graphicsitems/qdeclarativeflickable.cpp @@ -373,9 +373,7 @@ void QDeclarativeFlickablePrivate::updateBeginningEnd() \section1 Example Usage - \beginfloatright - \inlineimage flickable.gif - \endfloat + \floatright flickable.gif The following example shows a small view onto a large image in which the user can drag or flick the image in order to view different parts of it. diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index 1615b0f..c7517f4 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -1095,9 +1095,7 @@ void QDeclarativeGridViewPrivate::flick(AxisData &data, qreal minExtent, qreal m \snippet doc/src/snippets/declarative/gridview/ContactModel.qml 0 - \beginfloatright - \inlineimage gridview-simple.png - \endfloat + \floatright gridview-simple.png This model can be referenced as \c ContactModel in other QML files. See \l{QML Modules} for more information about creating reusable components like this. @@ -1111,9 +1109,7 @@ void QDeclarativeGridViewPrivate::flick(AxisData &data, qreal minExtent, qreal m \codeline \snippet doc/src/snippets/declarative/gridview/gridview.qml classdocs simple - \beginfloatright - \inlineimage gridview-highlight.png - \endfloat + \floatright gridview-highlight.png The view will create a new delegate for each item in the model. Note that the delegate is able to access the model's \c name and \c portrait data directly. diff --git a/src/declarative/graphicsitems/qdeclarativemousearea.cpp b/src/declarative/graphicsitems/qdeclarativemousearea.cpp index 0a043a7..56e5c6b 100644 --- a/src/declarative/graphicsitems/qdeclarativemousearea.cpp +++ b/src/declarative/graphicsitems/qdeclarativemousearea.cpp @@ -216,9 +216,7 @@ QDeclarativeMouseAreaPrivate::~QDeclarativeMouseAreaPrivate() \section1 Example Usage - \beginfloatright - \inlineimage qml-mousearea-snippet.png - \endfloat + \floatright qml-mousearea-snippet.png The following example uses a MouseArea in a \l Rectangle that changes the \l Rectangle color to red when clicked: diff --git a/src/declarative/graphicsitems/qdeclarativerectangle.cpp b/src/declarative/graphicsitems/qdeclarativerectangle.cpp index 99b36a8..969027e 100644 --- a/src/declarative/graphicsitems/qdeclarativerectangle.cpp +++ b/src/declarative/graphicsitems/qdeclarativerectangle.cpp @@ -131,9 +131,7 @@ void QDeclarativeGradientStop::updateGradient() \section1 Example Usage - \beginfloatright - \inlineimage qml-gradient.png - \endfloat + \floatright qml-gradient.png The following example declares a \l Rectangle item with a gradient starting with red, blending to yellow at one third of the height of the rectangle, @@ -217,9 +215,7 @@ void QDeclarativeGradient::doUpdate() \section1 Example Usage - \beginfloatright - \inlineimage declarative-rect.png - \endfloat + \floatright declarative-rect.png The following example shows the effects of some of the common properties on a Rectangle item, which in this case is used to create a square: @@ -269,9 +265,7 @@ void QDeclarativeRectangle::doUpdate() rectangle (as documented for QRect rendering). This can cause unintended effects if \c border.width is 1 and the rectangle is \l{Item::clip}{clipped} by a parent item: - \beginfloatright - \inlineimage rect-border-width.png - \endfloat + \floatright rect-border-width.png \snippet doc/src/snippets/declarative/rectangle/rect-border-width.qml 0 @@ -293,9 +287,7 @@ QDeclarativePen *QDeclarativeRectangle::border() This property allows for the construction of simple vertical gradients. Other gradients may by formed by adding rotation to the rectangle. - \beginfloatleft - \inlineimage declarative-rect_gradient.png - \endfloat + \floatleft declarative-rect_gradient.png \snippet doc/src/snippets/declarative/rectangle/rectangle-gradient.qml rectangles \clearfloat @@ -361,9 +353,7 @@ void QDeclarativeRectangle::setRadius(qreal radius) The default color is white. - \beginfloatright - \inlineimage rect-color.png - \endfloat + \floatright rect-color.png The following example shows rectangles with colors specified using hexadecimal and named color notation: diff --git a/src/declarative/util/qdeclarativelistmodel.cpp b/src/declarative/util/qdeclarativelistmodel.cpp index 398480e..52e563b 100644 --- a/src/declarative/util/qdeclarativelistmodel.cpp +++ b/src/declarative/util/qdeclarativelistmodel.cpp @@ -108,9 +108,7 @@ QDeclarativeListModelParser::ListInstruction *QDeclarativeListModelParser::ListM The following example shows a ListModel containing three elements, with the roles "name" and "cost". - \beginfloatright - \inlineimage listmodel.png - \endfloat + \floatright listmodel.png \snippet doc/src/snippets/declarative/listmodel.qml 0 @@ -133,9 +131,7 @@ QDeclarativeListModelParser::ListInstruction *QDeclarativeListModelParser::ListM The delegate displays all the fruit attributes: - \beginfloatright - \inlineimage listmodel-nested.png - \endfloat + \floatright listmodel-nested.png \snippet doc/src/snippets/declarative/listmodel-nested.qml delegate diff --git a/src/gui/graphicsview/qgraphicsanchorlayout.cpp b/src/gui/graphicsview/qgraphicsanchorlayout.cpp index 539826b..1d1d257 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout.cpp +++ b/src/gui/graphicsview/qgraphicsanchorlayout.cpp @@ -56,9 +56,7 @@ Items that are anchored are automatically added to the layout, and if items are removed, all their anchors will be automatically removed. - \beginfloatleft - \inlineimage simpleanchorlayout-example.png Using an anchor layout to align simple colored widgets. - \endfloat + \figureleft{simpleanchorlayout-example.png}{Using an anchor layout to align simple colored widgets.} Anchors are always set up between edges of an item, where the "center" is also considered to be an edge. Consider the following example: -- cgit v0.12 From 8d0863f175199384e41a00fa18a9ea7d177c7f0e Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 13 Dec 2010 22:57:17 +0100 Subject: qrgb565: Use the trivial qt_memconvert() and qt_rectconvert() Use memcpy() instead of the generic conversion routines where both template arguments are qrgb565. Yields a massive performance gain for tiling opaque (background) images in WebKit on 16-bit displays. This was previously restricted to Q_WS_QWS for some unknown reason. Reviewed-by: Benjamin Poulain --- src/gui/painting/qdrawhelper_p.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h index 0cc2e40..33fd21e 100644 --- a/src/gui/painting/qdrawhelper_p.h +++ b/src/gui/painting/qdrawhelper_p.h @@ -1684,9 +1684,7 @@ QT_TRIVIAL_MEMCONVERT_IMPL(qrgb888) QT_TRIVIAL_MEMCONVERT_IMPL(qargb6666) QT_TRIVIAL_MEMCONVERT_IMPL(qrgb666) QT_TRIVIAL_MEMCONVERT_IMPL(quint16) -#ifdef Q_WS_QWS QT_TRIVIAL_MEMCONVERT_IMPL(qrgb565) -#endif QT_TRIVIAL_MEMCONVERT_IMPL(qargb8565) QT_TRIVIAL_MEMCONVERT_IMPL(qargb8555) QT_TRIVIAL_MEMCONVERT_IMPL(qrgb555) @@ -1783,9 +1781,7 @@ QT_RECTCONVERT_TRIVIAL_IMPL(quint32) QT_RECTCONVERT_TRIVIAL_IMPL(qrgb888) QT_RECTCONVERT_TRIVIAL_IMPL(qargb6666) QT_RECTCONVERT_TRIVIAL_IMPL(qrgb666) -#ifdef Q_WS_QWS QT_RECTCONVERT_TRIVIAL_IMPL(qrgb565) -#endif QT_RECTCONVERT_TRIVIAL_IMPL(qargb8565) QT_RECTCONVERT_TRIVIAL_IMPL(quint16) QT_RECTCONVERT_TRIVIAL_IMPL(qargb8555) -- cgit v0.12 From 2eee49127b80b5b56c605f76ccea004b03d89577 Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Tue, 14 Dec 2010 11:22:50 +1000 Subject: Remove active selection when TextEdit loses focus Task-number: QTBUG-15341 Reviewed-by: Yann Bodson --- .../graphicsitems/qdeclarativetextedit.cpp | 14 ++++++++ .../graphicsitems/qdeclarativetextedit_p.h | 1 + .../tst_qdeclarativetextedit.cpp | 40 ++++++++++++++++++++++ 3 files changed, 55 insertions(+) diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp index e05f4e4..1042cf1 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp @@ -994,6 +994,20 @@ void QDeclarativeTextEditPrivate::focusChanged(bool hasFocus) QDeclarativeItemPrivate::focusChanged(hasFocus); } +void QDeclarativeTextEdit::focusOutEvent(QFocusEvent *event) +{ + Q_D(QDeclarativeTextEdit); + if (event->reason() != Qt::ActiveWindowFocusReason + && event->reason() != Qt::PopupFocusReason) { + QTextCursor cursor = d->control->textCursor(); + if (cursor.hasSelection()) { + cursor.clearSelection(); + d->control->setTextCursor(cursor); + } + } + QDeclarativePaintedItem::focusOutEvent(event); +} + /*! \qmlmethod void TextEdit::selectAll() diff --git a/src/declarative/graphicsitems/qdeclarativetextedit_p.h b/src/declarative/graphicsitems/qdeclarativetextedit_p.h index 68fde3d..6826cb5 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextedit_p.h @@ -249,6 +249,7 @@ protected: void keyPressEvent(QKeyEvent *); void keyReleaseEvent(QKeyEvent *); void focusInEvent(QFocusEvent *event); + void focusOutEvent(QFocusEvent *event); // mouse filter? void mousePressEvent(QGraphicsSceneMouseEvent *event); diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp index a7971cc..ed02451 100644 --- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp +++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp @@ -110,6 +110,7 @@ private slots: void mouseSelection_data(); void mouseSelection(); void inputMethodHints(); + void clearSelectionOnFocusLost(); void cursorDelegate(); void delegateLoading_data(); @@ -748,6 +749,45 @@ void tst_qdeclarativetextedit::inputMethodHints() QVERIFY(textEditObject->inputMethodHints() & Qt::ImhUppercaseOnly); } +// QTBUG-15341 +void tst_qdeclarativetextedit::clearSelectionOnFocusLost() +{ + + // create a visible scene with two text edits + QGraphicsScene scene; + QGraphicsView view(&scene); + QDeclarativeTextEdit edit; + QDeclarativeTextEdit secondEdit; + edit.setText("Hello world!"); + scene.addItem(&edit); + scene.addItem(&secondEdit); + view.show(); + QApplication::setActiveWindow(&view); + QTest::qWaitForWindowShown(&view); + QTRY_COMPARE(QApplication::activeWindow(), static_cast(&view)); + + int index = 0; + while (index < Qt::NoFocusReason) { + + // focus the first text edit and select text + edit.setFocus(true); + edit.selectAll(); + QVERIFY(edit.hasActiveFocus() && !secondEdit.hasActiveFocus()); + QCOMPARE(edit.selectedText().size(), 12); + + // lose focus in the first text edit + qobject_cast(&secondEdit)->setFocus(Qt::FocusReason(index)); + QVERIFY(!edit.hasActiveFocus() && secondEdit.hasActiveFocus()); + + // depending on the focus reason, selection should now be cleared + bool clearSelection = (index != Qt::ActiveWindowFocusReason && index != Qt::PopupFocusReason); + QCOMPARE(edit.selectedText().isEmpty(), clearSelection); + index++; + } +} + + + void tst_qdeclarativetextedit::cursorDelegate() { QDeclarativeView* view = createView(SRCDIR "/data/cursorTest.qml"); -- cgit v0.12 From e4257e41c1c9e764d27f1c61f9173c34444236f3 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Tue, 14 Dec 2010 14:27:38 +1000 Subject: Abort working replies with error when network session fails. Otherwise the connections will stay in a zombie state until the TCP keep alive timer times out in a couple of hours. Task-number: Maemo 201619 --- src/network/access/qnetworkreplyimpl.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index cf6e674..3d1df06 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -271,8 +271,8 @@ void QNetworkReplyImplPrivate::_q_networkSessionConnected() void QNetworkReplyImplPrivate::_q_networkSessionFailed() { - // Abort waiting replies. - if (state == WaitingForSession) { + // Abort waiting and working replies. + if (state == WaitingForSession || state == Working) { state = Working; error(QNetworkReplyImpl::UnknownNetworkError, QCoreApplication::translate("QNetworkReply", "Network session error.")); -- cgit v0.12 From f58cf707dd5668ca2849f457e951a9cef7d1d544 Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Tue, 14 Dec 2010 15:27:23 +1000 Subject: Revert a fix made for bug QTBUG-15341 Reverted a commit 2eee49127b80b5b56c605f76ccea004b03d89577 "Remove active selection when TextEdit loses focus". Contrary to TextInput, by default TextEdit keeps the selection visible when the editor loses active focus. If this is not wanted, a property called persistentSelection can be set false to make selection dependant on the focus. --- .../graphicsitems/qdeclarativetextedit.cpp | 14 -------- .../graphicsitems/qdeclarativetextedit_p.h | 1 - .../tst_qdeclarativetextedit.cpp | 40 ---------------------- 3 files changed, 55 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp index 1042cf1..e05f4e4 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp @@ -994,20 +994,6 @@ void QDeclarativeTextEditPrivate::focusChanged(bool hasFocus) QDeclarativeItemPrivate::focusChanged(hasFocus); } -void QDeclarativeTextEdit::focusOutEvent(QFocusEvent *event) -{ - Q_D(QDeclarativeTextEdit); - if (event->reason() != Qt::ActiveWindowFocusReason - && event->reason() != Qt::PopupFocusReason) { - QTextCursor cursor = d->control->textCursor(); - if (cursor.hasSelection()) { - cursor.clearSelection(); - d->control->setTextCursor(cursor); - } - } - QDeclarativePaintedItem::focusOutEvent(event); -} - /*! \qmlmethod void TextEdit::selectAll() diff --git a/src/declarative/graphicsitems/qdeclarativetextedit_p.h b/src/declarative/graphicsitems/qdeclarativetextedit_p.h index 6826cb5..68fde3d 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextedit_p.h @@ -249,7 +249,6 @@ protected: void keyPressEvent(QKeyEvent *); void keyReleaseEvent(QKeyEvent *); void focusInEvent(QFocusEvent *event); - void focusOutEvent(QFocusEvent *event); // mouse filter? void mousePressEvent(QGraphicsSceneMouseEvent *event); diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp index ed02451..a7971cc 100644 --- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp +++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp @@ -110,7 +110,6 @@ private slots: void mouseSelection_data(); void mouseSelection(); void inputMethodHints(); - void clearSelectionOnFocusLost(); void cursorDelegate(); void delegateLoading_data(); @@ -749,45 +748,6 @@ void tst_qdeclarativetextedit::inputMethodHints() QVERIFY(textEditObject->inputMethodHints() & Qt::ImhUppercaseOnly); } -// QTBUG-15341 -void tst_qdeclarativetextedit::clearSelectionOnFocusLost() -{ - - // create a visible scene with two text edits - QGraphicsScene scene; - QGraphicsView view(&scene); - QDeclarativeTextEdit edit; - QDeclarativeTextEdit secondEdit; - edit.setText("Hello world!"); - scene.addItem(&edit); - scene.addItem(&secondEdit); - view.show(); - QApplication::setActiveWindow(&view); - QTest::qWaitForWindowShown(&view); - QTRY_COMPARE(QApplication::activeWindow(), static_cast(&view)); - - int index = 0; - while (index < Qt::NoFocusReason) { - - // focus the first text edit and select text - edit.setFocus(true); - edit.selectAll(); - QVERIFY(edit.hasActiveFocus() && !secondEdit.hasActiveFocus()); - QCOMPARE(edit.selectedText().size(), 12); - - // lose focus in the first text edit - qobject_cast(&secondEdit)->setFocus(Qt::FocusReason(index)); - QVERIFY(!edit.hasActiveFocus() && secondEdit.hasActiveFocus()); - - // depending on the focus reason, selection should now be cleared - bool clearSelection = (index != Qt::ActiveWindowFocusReason && index != Qt::PopupFocusReason); - QCOMPARE(edit.selectedText().isEmpty(), clearSelection); - index++; - } -} - - - void tst_qdeclarativetextedit::cursorDelegate() { QDeclarativeView* view = createView(SRCDIR "/data/cursorTest.qml"); -- cgit v0.12 From c34225b62ea2dd2a545baf2ade41629be6a55473 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Tue, 14 Dec 2010 13:59:36 +1000 Subject: Clarify that XmlListModel is read only --- src/declarative/util/qdeclarativexmllistmodel.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/declarative/util/qdeclarativexmllistmodel.cpp b/src/declarative/util/qdeclarativexmllistmodel.cpp index ce5b483..49a12b1 100644 --- a/src/declarative/util/qdeclarativexmllistmodel.cpp +++ b/src/declarative/util/qdeclarativexmllistmodel.cpp @@ -503,9 +503,9 @@ void QDeclarativeXmlListModelPrivate::clear_role(QDeclarativeListProperty Date: Tue, 14 Dec 2010 16:38:02 +1000 Subject: Docs: implications of creating network access managers in other threads Task-number: QTBUG-16032 --- .../qdeclarativenetworkaccessmanagerfactory.cpp | 53 ++++++++++++++-------- 1 file changed, 33 insertions(+), 20 deletions(-) diff --git a/src/declarative/qml/qdeclarativenetworkaccessmanagerfactory.cpp b/src/declarative/qml/qdeclarativenetworkaccessmanagerfactory.cpp index d22798d..36e9721 100644 --- a/src/declarative/qml/qdeclarativenetworkaccessmanagerfactory.cpp +++ b/src/declarative/qml/qdeclarativenetworkaccessmanagerfactory.cpp @@ -46,27 +46,44 @@ QT_BEGIN_NAMESPACE /*! \class QDeclarativeNetworkAccessManagerFactory \since 4.7 - \brief The QDeclarativeNetworkAccessManagerFactory class provides a factory for QNetworkAccessManager for use by a Qt Declarative engine. + \brief The QDeclarativeNetworkAccessManagerFactory class creates QNetworkAccessManager instances for a QML engine. - QNetworkAccessManager is used for all network access by QML. - By implementing a factory it is possible to create custom - QNetworkAccessManager with specialized caching, proxy and - cookie support. + A QML engine uses QNetworkAccessManager for all network access. + By implementing a factory, it is possible to provide the QML engine + with custom QNetworkAccessManager instances with specialized caching, + proxy and cookies support. - To implement a factory, subclass QDeclarativeNetworkAccessManagerFactory and implement - the create() method. + To implement a factory, subclass QDeclarativeNetworkAccessManagerFactory and + implement the virtual create() method, then assign it to the relevant QML + engine using QDeclarativeEngine::setNetworkAccessManagerFactory(). - To use a factory, assign it to the relevant QDeclarativeEngine using - QDeclarativeEngine::setNetworkAccessManagerFactory(). + Note the QML engine may create QNetworkAccessManager instances + from multiple threads. Because of this, the implementation of the create() + method must be \l{Reentrancy and Thread-Safety}{reentrant}. In addition, + the developer should be careful if the signals of the object to be + returned from create() are connected to the slots of an object that may + be created in a different thread: - Note: the create() method may be called by multiple threads, so ensure the - implementation of this method is reentrant. + \list + \o The QML engine internally handles all requests, and cleans up any + QNetworkReply objects it creates. Receiving the + QNetworkAccessManager::finished() signal in another thread may not + provide the receiver with a valid reply object if it has already + been deleted. + \o Authentication details provided to QNetworkAccessManager::authenticationRequired() + must be provided immediately, so this signal cannot be connected as a + Qt::QueuedConnection (or as the default Qt::AutoConnection from another + thread). + \endlist + + For more information about signals and threads, see + \l {Threads and QObjects} and \l {Signals and Slots Across Threads}. - \sa QDeclarativeEngine::setNetworkAccessManagerFactory(), {declarative/cppextensions/networkaccessmanagerfactory}{NetworkAccessManagerFactory example} + \sa {declarative/cppextensions/networkaccessmanagerfactory}{NetworkAccessManagerFactory example} */ /*! - The destructor is empty. + Destroys the factory. The default implementation does nothing. */ QDeclarativeNetworkAccessManagerFactory::~QDeclarativeNetworkAccessManagerFactory() { @@ -75,13 +92,9 @@ QDeclarativeNetworkAccessManagerFactory::~QDeclarativeNetworkAccessManagerFactor /*! \fn QNetworkAccessManager *QDeclarativeNetworkAccessManagerFactory::create(QObject *parent) - Implement this method to create a QNetworkAccessManager with \a parent. - This allows proxies, caching and cookie support to be setup appropriately. - - This method must return a new QNetworkAccessManager each time it is called. - The parent of the QNetworkAccessManager must be the \a parent provided. - The QNetworkAccessManager(s) created by this - function will be destroyed automatically when their parent is destroyed. + Creates and returns a network access manager with the specified \a parent. + This method must return a new QNetworkAccessManager instance each time + it is called. Note: this method may be called by multiple threads, so ensure the implementation of this method is reentrant. -- cgit v0.12 From 725716bcf158988ac664da8f8bcd2d9a8e91a916 Mon Sep 17 00:00:00 2001 From: axis Date: Fri, 10 Dec 2010 10:32:11 +0100 Subject: Fixed several compile and deployment issues in the mmf phonon plugin. RevBy: Trust me --- src/3rdparty/phonon/mmf/abstractaudioeffect.h | 2 +- src/3rdparty/phonon/mmf/audioequalizer.cpp | 2 +- src/3rdparty/phonon/mmf/bassboost.cpp | 2 +- src/3rdparty/phonon/mmf/environmentalreverb.cpp | 2 +- src/3rdparty/phonon/mmf/loudness.cpp | 2 +- src/3rdparty/phonon/mmf/stereowidening.cpp | 2 +- src/plugins/phonon/mmf/mmf.pro | 4 ++-- src/s60installs/s60installs.pro | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/3rdparty/phonon/mmf/abstractaudioeffect.h b/src/3rdparty/phonon/mmf/abstractaudioeffect.h index 8879636..70adcf6 100644 --- a/src/3rdparty/phonon/mmf/abstractaudioeffect.h +++ b/src/3rdparty/phonon/mmf/abstractaudioeffect.h @@ -21,7 +21,7 @@ along with this library. If not, see . #include -#include +#include #include diff --git a/src/3rdparty/phonon/mmf/audioequalizer.cpp b/src/3rdparty/phonon/mmf/audioequalizer.cpp index 28433f6..1d2bbd4 100644 --- a/src/3rdparty/phonon/mmf/audioequalizer.cpp +++ b/src/3rdparty/phonon/mmf/audioequalizer.cpp @@ -16,7 +16,7 @@ along with this library. If not, see . */ -#include +#include #include "audioequalizer.h" QT_BEGIN_NAMESPACE diff --git a/src/3rdparty/phonon/mmf/bassboost.cpp b/src/3rdparty/phonon/mmf/bassboost.cpp index 81d9208..67076f6 100644 --- a/src/3rdparty/phonon/mmf/bassboost.cpp +++ b/src/3rdparty/phonon/mmf/bassboost.cpp @@ -16,7 +16,7 @@ along with this library. If not, see . */ -#include +#include #include "bassboost.h" QT_BEGIN_NAMESPACE diff --git a/src/3rdparty/phonon/mmf/environmentalreverb.cpp b/src/3rdparty/phonon/mmf/environmentalreverb.cpp index c500385..d4f5223 100644 --- a/src/3rdparty/phonon/mmf/environmentalreverb.cpp +++ b/src/3rdparty/phonon/mmf/environmentalreverb.cpp @@ -16,7 +16,7 @@ along with this library. If not, see . */ -#include +#include #include "environmentalreverb.h" QT_BEGIN_NAMESPACE diff --git a/src/3rdparty/phonon/mmf/loudness.cpp b/src/3rdparty/phonon/mmf/loudness.cpp index 22d7518..ca05ab0 100644 --- a/src/3rdparty/phonon/mmf/loudness.cpp +++ b/src/3rdparty/phonon/mmf/loudness.cpp @@ -16,7 +16,7 @@ along with this library. If not, see . */ -#include +#include #include "loudness.h" QT_BEGIN_NAMESPACE diff --git a/src/3rdparty/phonon/mmf/stereowidening.cpp b/src/3rdparty/phonon/mmf/stereowidening.cpp index e452160..f90651b 100644 --- a/src/3rdparty/phonon/mmf/stereowidening.cpp +++ b/src/3rdparty/phonon/mmf/stereowidening.cpp @@ -16,7 +16,7 @@ along with this library. If not, see . */ -#include +#include #include "stereowidening.h" QT_BEGIN_NAMESPACE diff --git a/src/plugins/phonon/mmf/mmf.pro b/src/plugins/phonon/mmf/mmf.pro index 691fc80..5d7b61d 100644 --- a/src/plugins/phonon/mmf/mmf.pro +++ b/src/plugins/phonon/mmf/mmf.pro @@ -103,7 +103,7 @@ symbian { exists($${EPOCROOT}epoc32/include/mw/downloadmgrclient.h) { HEADERS += $$PHONON_MMF_DIR/download.h SOURCES += $$PHONON_MMF_DIR/download.cpp - LIBS += -ldownloadmgr + LIBS += -lDownloadMgr DEFINES += PHONON_MMF_PROGRESSIVE_DOWNLOAD } } @@ -125,7 +125,7 @@ symbian { LIBS += -lmediaclientaudiostream # For CMdaAudioOutputStream # These are for effects. - LIBS += -lAudioEqualizerEffect -lBassBoostEffect -lDistanceAttenuationEffect -lDopplerBase -lEffectBase -lEnvironmentalReverbEffect -lListenerDopplerEffect -lListenerLocationEffect -lListenerOrientationEffect -lLocationBase -lLoudnessEffect -lOrientationBase -lSourceDopplerEffect -lSourceLocationEffect -lSourceOrientationEffect -lStereoWideningEffect + LIBS += -lAudioEqualizerEffect -lBassBoostEffect -lDistanceAttenuationEffect -lDopplerbase -lEffectBase -lEnvironmentalReverbEffect -lListenerDopplerEffect -lListenerLocationEffect -lListenerOrientationEffect -lLocationBase -lLoudnessEffect -lOrientationBase -lSourceDopplerEffect -lSourceLocationEffect -lSourceOrientationEffect -lStereoWideningEffect # This is needed for having the .qtplugin file properly created on Symbian. QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/phonon_backend diff --git a/src/s60installs/s60installs.pro b/src/s60installs/s60installs.pro index ff67bcf..5a435cd 100644 --- a/src/s60installs/s60installs.pro +++ b/src/s60installs/s60installs.pro @@ -132,7 +132,7 @@ symbian: { codecs_plugins.path = c:$$QT_PLUGINS_BASE_DIR/codecs contains(QT_CONFIG, phonon-backend) { - phonon_backend_plugins.sources += $$QMAKE_LIBDIR_QT/phonon_mmf$${QT_LIBINFIX}.dll + phonon_backend_plugins.sources += $$QT_BUILD_TREE/plugins/phonon_backend/phonon_mmf$${QT_LIBINFIX}.dll phonon_backend_plugins.path = c:$$QT_PLUGINS_BASE_DIR/phonon_backend DEPLOYMENT += phonon_backend_plugins -- cgit v0.12 From 6aa1ab84404c92f2048270b1932fa10cecdcc58d Mon Sep 17 00:00:00 2001 From: axis Date: Fri, 10 Dec 2010 15:35:06 +0100 Subject: Fixed a bug in the input methods on S60 with QGraphicsWebView. The bug happened because we did not expect to receive a call to CancelFepInlineEdit() when the widget had not previously been given any preedit text by S60. However, this can happen, and if it happens at the same time that there is a temporarily visible character in the widget (because it will be obscured as a password a second later), then the temporary character would be discarded. Fixed by checking in the beginning of CancelFepInlineEdit() whether we currently have any temporary preedit text or not, and if we do, we don't clear the contents, since it is the input context itself that generated the preedit text, not S60. Also made sure that the temporary preedit text is committed if we receive a call to UpdateFepInlineTextL(), which may sometimes happen without a call to StartFepInlineEditL(). Task: QT-4314 AutoTest: Included RevBy: Shane Kearns --- src/gui/inputmethod/qcoefepinputcontext_s60.cpp | 8 ++ tests/auto/qinputcontext/qinputcontext.pro | 2 + tests/auto/qinputcontext/tst_qinputcontext.cpp | 141 +++++++++++++++++++++++- 3 files changed, 148 insertions(+), 3 deletions(-) diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index 4a1b9b9..686f388 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -657,6 +657,8 @@ void QCoeFepInputContext::UpdateFepInlineTextL(const TDesC& aNewInlineText, if (!w) return; + commitTemporaryPreeditString(); + m_inlinePosition = aPositionOfInsertionPointInInlineText; QList attributes; @@ -694,6 +696,12 @@ void QCoeFepInputContext::SetInlineEditingCursorVisibilityL(TBool aCursorVisibil void QCoeFepInputContext::CancelFepInlineEdit() { + // We are not supposed to ever have a tempPreeditString and a real preedit string + // from S60 at the same time, so it should be safe to rely on this test to determine + // whether we should honor S60's request to clear the text or not. + if (m_hasTempPreeditString) + return; + QList attributes; QInputMethodEvent event(QLatin1String(""), attributes); event.setCommitString(QLatin1String(""), 0, 0); diff --git a/tests/auto/qinputcontext/qinputcontext.pro b/tests/auto/qinputcontext/qinputcontext.pro index ec6831e..4b3ab96 100644 --- a/tests/auto/qinputcontext/qinputcontext.pro +++ b/tests/auto/qinputcontext/qinputcontext.pro @@ -1,6 +1,8 @@ load(qttest_p4) SOURCES += tst_qinputcontext.cpp +contains(QT_CONFIG, webkit):QT += webkit + symbian { LIBS += -lws32 -lcone } diff --git a/tests/auto/qinputcontext/tst_qinputcontext.cpp b/tests/auto/qinputcontext/tst_qinputcontext.cpp index 5a258a9..020f177 100644 --- a/tests/auto/qinputcontext/tst_qinputcontext.cpp +++ b/tests/auto/qinputcontext/tst_qinputcontext.cpp @@ -50,6 +50,13 @@ #include #include #include +#include +#include + +#ifdef QT_WEBKIT_LIB +#include +#include +#endif #ifdef Q_OS_SYMBIAN #include @@ -466,6 +473,115 @@ void tst_QInputContext::focusProxy() QCOMPARE(gic->focusWidget(), &proxy); } +#ifdef QT_WEBKIT_LIB +class AutoWebView : public QWebView +{ + Q_OBJECT + +public: + AutoWebView() + : m_length(0) + , m_mode(QLineEdit::Normal) + { + updatePage(); + } + ~AutoWebView() {} + + void updatePage() + { + // The update might reset the input method parameters. + bool imEnabled = testAttribute(Qt::WA_InputMethodEnabled); + Qt::InputMethodHints hints = inputMethodHints(); + + QString page = "" + "
    "; + if (m_mode == QLineEdit::Password) + page = page.arg("password"); + else + page = page.arg("text"); + + if (m_length == 0) + page = page.arg(""); + else + page = page.arg("maxlength=\"" + QString::number(m_length) + "\""); + + setHtml(page); + + setAttribute(Qt::WA_InputMethodEnabled, imEnabled); + setInputMethodHints(hints); + } + void setMaxLength(int length) + { + m_length = length; + updatePage(); + } + void setEchoMode(QLineEdit::EchoMode mode) + { + m_mode = mode; + updatePage(); + } + + int m_length; + QLineEdit::EchoMode m_mode; +}; + +class AutoGraphicsWebView : public QGraphicsView +{ + Q_OBJECT + +public: + AutoGraphicsWebView() + : m_length(0) + , m_mode(QLineEdit::Normal) + { + m_scene.addItem(&m_view); + setScene(&m_scene); + m_view.setFocus(); + updatePage(); + } + ~AutoGraphicsWebView() {} + + void updatePage() + { + // The update might reset the input method parameters. + bool imEnabled = testAttribute(Qt::WA_InputMethodEnabled); + Qt::InputMethodHints hints = inputMethodHints(); + + QString page = "" + "
    "; + if (m_mode == QLineEdit::Password) + page = page.arg("password"); + else + page = page.arg("text"); + + if (m_length == 0) + page = page.arg(""); + else + page = page.arg("maxlength=\"" + QString::number(m_length) + "\""); + + m_view.setHtml(page); + + setAttribute(Qt::WA_InputMethodEnabled, imEnabled); + setInputMethodHints(hints); + } + void setMaxLength(int length) + { + m_length = length; + updatePage(); + } + void setEchoMode(QLineEdit::EchoMode mode) + { + m_mode = mode; + updatePage(); + } + + int m_length; + QLineEdit::EchoMode m_mode; + QGraphicsScene m_scene; + QGraphicsWebView m_view; +}; +#endif // QT_WEBKIT_LIB + void tst_QInputContext::symbianTestCoeFepInputContext_data() { #ifdef Q_OS_SYMBIAN @@ -481,6 +597,10 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() symbianTestCoeFepInputContext_addData(); symbianTestCoeFepInputContext_addData(); symbianTestCoeFepInputContext_addData(); +# ifdef QT_WEBKIT_LIB + symbianTestCoeFepInputContext_addData(); + symbianTestCoeFepInputContext_addData(); +# endif #endif } @@ -1087,13 +1207,28 @@ void tst_QInputContext::symbianTestCoeFepInputContext() editwidget->setAttribute(Qt::WA_InputMethodEnabled, inputMethodEnabled); editwidget->setInputMethodHints(inputMethodHints); - QLineEdit *lineedit = qobject_cast(editwidget); - if (lineedit) { + if (QLineEdit *lineedit = qobject_cast(editwidget)) { if (maxLength > 0) lineedit->setMaxLength(maxLength); lineedit->setEchoMode(echoMode); +#ifdef QT_WEBKIT_LIB + } else if (AutoWebView *webView = qobject_cast(editwidget)) { + if (maxLength > 0) + webView->setMaxLength(maxLength); + webView->setEchoMode(echoMode); + // WebKit disables T9 everywhere. + if (inputMethodEnabled && !(inputMethodHints & Qt::ImhNoPredictiveText)) + return; + } else if (AutoGraphicsWebView *webView = qobject_cast(editwidget)) { + if (maxLength > 0) + webView->setMaxLength(maxLength); + webView->setEchoMode(echoMode); + // WebKit disables T9 everywhere. + if (inputMethodEnabled && !(inputMethodHints & Qt::ImhNoPredictiveText)) + return; +#endif } else if (maxLength > 0 || echoMode != QLineEdit::Normal) { - // Only QLineEdits support these features so don't attempt any tests using those + // Only some widgets support these features so don't attempt any tests using those // on other widgets. return; } -- cgit v0.12 From 284211ccbd2cbdfea46cdf4b8628a1a967271985 Mon Sep 17 00:00:00 2001 From: Michael Dominic K Date: Tue, 14 Dec 2010 10:26:39 +0100 Subject: Prevent ::flush from being called on QGLWindowSurface if no painting happened. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Merge-request: 2527 Reviewed-by: Harald Fernengel Reviewed-by: Samuel Rødal --- src/opengl/qwindowsurface_gl.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp index f64b93c..6749826 100644 --- a/src/opengl/qwindowsurface_gl.cpp +++ b/src/opengl/qwindowsurface_gl.cpp @@ -267,6 +267,7 @@ struct QGLWindowSurfacePrivate int tried_pb : 1; int destructive_swap_buffers : 1; int geometry_updated : 1; + int did_paint : 1; QGLContext *ctx; @@ -330,6 +331,7 @@ QGLWindowSurface::QGLWindowSurface(QWidget *window) d_ptr->glDevice.d = d_ptr; d_ptr->q_ptr = this; d_ptr->geometry_updated = false; + d_ptr->did_paint = false; } QGLWindowSurface::~QGLWindowSurface() @@ -461,6 +463,8 @@ void QGLWindowSurface::beginPaint(const QRegion &) glClearColor(0.0, 0.0, 0.0, 0.0); glClear(clearFlags); } + + d_ptr->did_paint = true; } void QGLWindowSurface::endPaint(const QRegion &rgn) @@ -513,6 +517,13 @@ void QGLWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint & if (d_ptr->geometry_updated) return; + // did_paint is set to true in ::beginPaint. ::beginPaint means that we + // at least cleared the background (= painted something). In EGL API it's a + // mistakte to call swapBuffers if nothing was painted. This check protects + // the flush func from being executed if it's for nothing. + if (! d_ptr->did_paint) + return; + QWidget *parent = widget->internalWinId() ? widget : widget->nativeParentWidget(); Q_ASSERT(parent); @@ -736,6 +747,8 @@ void QGLWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint & ctx->swapBuffers(); else glFlush(); + + d_ptr->did_paint = false; } -- cgit v0.12 From 4d93a606ea0438be8062fda82baf639a9ced78ba Mon Sep 17 00:00:00 2001 From: Harald Fernengel Date: Tue, 14 Dec 2010 10:28:26 +0100 Subject: Trivial: Fix coding style Fix coding style of merge request --- src/opengl/qwindowsurface_gl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp index 6749826..7dc7dc7 100644 --- a/src/opengl/qwindowsurface_gl.cpp +++ b/src/opengl/qwindowsurface_gl.cpp @@ -521,7 +521,7 @@ void QGLWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint & // at least cleared the background (= painted something). In EGL API it's a // mistakte to call swapBuffers if nothing was painted. This check protects // the flush func from being executed if it's for nothing. - if (! d_ptr->did_paint) + if (!d_ptr->did_paint) return; QWidget *parent = widget->internalWinId() ? widget : widget->nativeParentWidget(); -- cgit v0.12 From e864a530a5c48459c433518ff6ad893f33ec93d8 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Tue, 14 Dec 2010 10:57:11 +0100 Subject: Fix failing tst_QGraphicsView::QTBUG_16063_microFocusRect auto-test This ammends commit 0af1f5508e165f3b494ab236cb1cdf1b0edcffa5. Reviewed-by: trust me --- tests/auto/qgraphicsview/tst_qgraphicsview.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp index e1fbaee..e259177 100644 --- a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp @@ -4455,7 +4455,7 @@ class IMItem : public QGraphicsRectItem { public: IMItem(QGraphicsItem *parent = 0): - QGraphicsRectItem(mf.adjusted(-5, -5, 5, 5), parent) + QGraphicsRectItem(QRectF(0, 0, 20, 20), parent) { setFlag(QGraphicsItem::ItemIsFocusable, true); setFlag(QGraphicsItem::ItemAcceptsInputMethod, true); @@ -4486,7 +4486,7 @@ void tst_QGraphicsView::QTBUG_16063_microFocusRect() scene.setFocusItem(item); view.setFocus(); QRectF mfv = view.inputMethodQuery(Qt::ImMicroFocus).toRectF(); - QCOMPARE(mfv, QRectF(13.5, 13.6, 10, 10)); + QCOMPARE(mfv, IMItem::mf.translated(-view.mapToScene(view.sceneRect().toRect()).boundingRect().topLeft())); } QTEST_MAIN(tst_QGraphicsView) -- cgit v0.12 From 736b8205158dd7b98af862a029b273dff6fb716d Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 8 Dec 2010 13:23:23 +0100 Subject: QApplication: fix crash exit whith native windows Regression introduced in 8dd8db250d92521fda619bdcf3e1c859b37b2da0 Patch comes from the task Task-number: QTBUG-15774 --- src/gui/kernel/qapplication.cpp | 6 +++--- tests/auto/qapplication/modal/main.cpp | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index a4ae46b..b4ff7c4 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -1101,6 +1101,9 @@ QApplication::~QApplication() QApplicationPrivate::is_app_closing = true; QApplicationPrivate::is_app_running = false; + delete QWidgetPrivate::mapper; + QWidgetPrivate::mapper = 0; + // delete all widgets if (QWidgetPrivate::allWidgets) { QWidgetSet *mySet = QWidgetPrivate::allWidgets; @@ -1130,9 +1133,6 @@ QApplication::~QApplication() delete d->ignore_cursor; d->ignore_cursor = 0; #endif - delete QWidgetPrivate::mapper; - QWidgetPrivate::mapper = 0; - delete QApplicationPrivate::app_pal; QApplicationPrivate::app_pal = 0; delete QApplicationPrivate::sys_pal; diff --git a/tests/auto/qapplication/modal/main.cpp b/tests/auto/qapplication/modal/main.cpp index f9d8fb4..3eaaa0d 100644 --- a/tests/auto/qapplication/modal/main.cpp +++ b/tests/auto/qapplication/modal/main.cpp @@ -47,6 +47,7 @@ int main(int argc, char *argv[]) { QApplication app(argc, argv); + QApplication::setAttribute(Qt::AA_NativeWindows); //QTBUG-15774 base *b = new base(); return app.exec(); } -- cgit v0.12 From 3778c3f5208f3db99d6b23a2a3c4abf1fe2ec64f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Arve=20S=C3=A6ther?= Date: Tue, 14 Dec 2010 11:46:57 +0100 Subject: Make sure that d->init() is called from both ctors. QGraphicsLayout uses the protected ctor that did not call d->init(), so all its subclasses was potentially suffering from this. Task-number: QTBUG-15333 Reviewed-by: John Tapsell --- src/gui/graphicsview/qgraphicslayoutitem.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/graphicsview/qgraphicslayoutitem.cpp b/src/gui/graphicsview/qgraphicslayoutitem.cpp index df13039..b11dc9e 100644 --- a/src/gui/graphicsview/qgraphicslayoutitem.cpp +++ b/src/gui/graphicsview/qgraphicslayoutitem.cpp @@ -129,7 +129,6 @@ void QGraphicsLayoutItemPrivate::init() { sizeHintCacheDirty = true; sizeHintWithConstraintCacheDirty = true; - sizePolicy = QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); } /*! @@ -400,6 +399,7 @@ QGraphicsLayoutItem::QGraphicsLayoutItem(QGraphicsLayoutItem *parent, bool isLay { Q_D(QGraphicsLayoutItem); d->init(); + sizePolicy = QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); d->q_ptr = this; } @@ -410,6 +410,7 @@ QGraphicsLayoutItem::QGraphicsLayoutItem(QGraphicsLayoutItemPrivate &dd) : d_ptr(&dd) { Q_D(QGraphicsLayoutItem); + d->init(); d->q_ptr = this; } -- cgit v0.12 From 542fe69cdeff81acb8f986ff4606043613345dc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Arve=20S=C3=A6ther?= Date: Tue, 14 Dec 2010 13:03:43 +0100 Subject: Fix to commit 3778c3f5208f3db99d6b23a2a3c4abf1fe2ec64f This is what could happen if you go to lunch before comitting. --- src/gui/graphicsview/qgraphicslayoutitem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/graphicsview/qgraphicslayoutitem.cpp b/src/gui/graphicsview/qgraphicslayoutitem.cpp index b11dc9e..0a24aae 100644 --- a/src/gui/graphicsview/qgraphicslayoutitem.cpp +++ b/src/gui/graphicsview/qgraphicslayoutitem.cpp @@ -399,7 +399,7 @@ QGraphicsLayoutItem::QGraphicsLayoutItem(QGraphicsLayoutItem *parent, bool isLay { Q_D(QGraphicsLayoutItem); d->init(); - sizePolicy = QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); + d->sizePolicy = QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); d->q_ptr = this; } -- cgit v0.12 From 0fe36ac832abf8f8d438b21fce0177b65b3bbf3a Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Tue, 14 Dec 2010 13:22:12 +0100 Subject: qdoc: Changed index.qdoc to use new \div command This is necessary for the Mimir project, but it is also useful for writing html output in that now you can write the index page (and other such pages) using pure qdoc commands. i.e. you don't need to use raw html for this sort of thing anymore. --- doc/src/index.qdoc | 166 ++++++++++++++++++----------------- tools/qdoc3/atom.cpp | 3 + tools/qdoc3/atom.h | 2 + tools/qdoc3/ditaxmlgenerator.cpp | 8 ++ tools/qdoc3/doc.cpp | 23 +++-- tools/qdoc3/htmlgenerator.cpp | 12 ++- tools/qdoc3/test/macros.qdocconf | 1 + tools/qdoc3/test/qt-ditaxml.qdocconf | 1 + 8 files changed, 131 insertions(+), 85 deletions(-) diff --git a/doc/src/index.qdoc b/doc/src/index.qdoc index 57fc18a..aefbea1 100644 --- a/doc/src/index.qdoc +++ b/doc/src/index.qdoc @@ -29,83 +29,91 @@ \page index.html \keyword Qt Reference Documentation - \raw HTML -
    -
    - Qt Developer Guide
    -
    -
    -
    -

    Qt is a cross-platform application and UI framework. Using Qt, you can write web-enabled applications once and deploy them across desktop, mobile and embedded operating systems without rewriting the source code.

    -
    - -
    -
    - -
    -
    - Qt Tools
    -
    -
    -
    -

    Qt offers a selection of development tools for different tasks. Use Qt Creator for - project and code management as well as building powerfull UIs.

    -
    - -
    -
    - \endraw + \div {indexbox guide} + \div {heading} + Qt Developer Guide + \enddiv + \div {indexboxcont indexboxbar} + \div {section indexIcon} \emptyspan + \enddiv + \div {section} + Qt is a cross-platform application and UI + framework. Using Qt, you can write web-enabled + applications once and deploy them across desktop, + mobile and embedded operating systems without + rewriting the source code. + \enddiv + \div {section sectionlist} + \list + \o \l{Getting Started Guides}{Getting started} + \o \l{Installation}{Installation} + \o \l{how-to-learn-qt.html}{How to learn Qt} + \o \l{tutorials.html}{Tutorials} + \o \l{Qt Examples}{Examples} + \o \l{qt4-7-intro.html}{What's new in Qt 4.7} + \endlist + \enddiv + \enddiv + \enddiv + \div {indexbox api} + \div {heading} + Qt API + \enddiv + \div {indexboxcont indexboxbar } + \div {sectionlist tricol} + \list + \o \l{All Classes}{All Classes} + \o \l{All Functions}{All Functions} + \o \l{All Modules}{All Modules} + \o \l{All Namespaces}{All Namespaces} + \o \l{Global Qt Declarations}{Global Declarations} + \o \l{Qt Licenses and Credits}{Licenses and Credits} + \endlist + \enddiv + \div {sectionlist tricol} + \list + \o \l{qt-basic-concepts.html}{Programming with Qt} + \o \l{qt-gui-concepts.html}{UI Design with Qt} + \o \l{developing-with-qt.html}{Cross-platform and Platform-specific} + \o \l{technology-apis.html}{Qt and Key Technologies} + \o \l{best-practices.html}{Best Practices Guides} + \endlist + \enddiv + \div {sectionlist} + \list + \o \l{qtquick.html}{Qt Quick} + \o \l{qdeclarativeintroduction.html}{Introduction to QML} + \o \l{qdeclarativeelements.html}{QML Elements} + \o \l{qdeclarativeexamples.html}{QML Examples and Demos} + \endlist + \enddiv + \enddiv + \enddiv + \div {indexbox tools} + \div {heading} + Qt Tools + \enddiv + \div {indexboxcont} + \div {section indexIcon} \emptyspan + \enddiv + \div {section} + Qt offers a selection of development tools for + different tasks. Use Qt Creator for project and code + management as well as building powerfull UIs. + \enddiv + \div {section sectionlist} + \list + \o \l{http://doc.qt.nokia.com/qtcreator-2.0/index.html}{Qt Creator} + \o \l{designer-manual.html}{Qt Designer} + \o \l{linguist-manual.html}{Qt Linguist} + \o \l{assistant-manual.html}{Qt Assistant} + \o \l{qmake-manual.html}{Qt qmake} + \o \l{http://doc.qt.nokia.com/qtsimulator-1.0/index.html}{Qt Simulator} + \o \l{http://qt.nokia.com/developer/eclipse-integration}{Eclipse Integration} + \o \l{http://qt.nokia.com/products/appdev}{Add-On Products and Services} + \o \l{qvfb.html}{Virtual Framebuffer} + \endlist + \enddiv + \enddiv + \enddiv */ diff --git a/tools/qdoc3/atom.cpp b/tools/qdoc3/atom.cpp index d18c3c4..301244d 100644 --- a/tools/qdoc3/atom.cpp +++ b/tools/qdoc3/atom.cpp @@ -107,6 +107,7 @@ QString Atom::UPPERROMAN_ ("upperroman"); \value CodeOld \value CodeQuoteArgument \value CodeQuoteCommand + \value Div \value EndQmlText \value FormatElse \value FormatEndif @@ -179,6 +180,8 @@ static const struct { { "CodeOld", Atom::CodeOld }, { "CodeQuoteArgument", Atom::CodeQuoteArgument }, { "CodeQuoteCommand", Atom::CodeQuoteCommand }, + { "Div", Atom::Div }, + { "EndDiv", Atom::EndDiv }, #ifdef QDOC_QML { "EndQmlText", Atom::EndQmlText }, #endif diff --git a/tools/qdoc3/atom.h b/tools/qdoc3/atom.h index 4639711..fe85aec 100644 --- a/tools/qdoc3/atom.h +++ b/tools/qdoc3/atom.h @@ -72,7 +72,9 @@ class Atom CodeOld, CodeQuoteArgument, CodeQuoteCommand, + Div, #ifdef QDOC_QML + EndDiv, EndQmlText, #endif FootnoteLeft, diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 57a6e8d..7b40886 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -751,6 +751,14 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, writeCharacters(trimmedTrailing(plainCode(atom->string()))); xmlWriter().writeEndElement(); // break; + case Atom::Div: + xmlWriter().writeStartElement("bodydiv"); + if (!atom->string().isEmpty()) + xmlWriter().writeAttribute("outputclass", atom->string()); + break; + case Atom::EndDiv: + xmlWriter().writeEndElement(); // + break; case Atom::FootnoteLeft: // ### For now if (in_para) { diff --git a/tools/qdoc3/doc.cpp b/tools/qdoc3/doc.cpp index 9a154f8..1c72f54 100644 --- a/tools/qdoc3/doc.cpp +++ b/tools/qdoc3/doc.cpp @@ -74,11 +74,11 @@ struct Macro enum { CMD_A, CMD_ABSTRACT, CMD_ANNOTATEDLIST, CMD_BADCODE, CMD_BASENAME, CMD_BOLD, CMD_BRIEF, CMD_C, CMD_CAPTION, - CMD_CHAPTER, CMD_CODE, CMD_CODELINE, CMD_DOTS, CMD_ELSE, - CMD_ENDABSTRACT, CMD_ENDCHAPTER, CMD_ENDCODE, - CMD_ENDFOOTNOTE, CMD_ENDIF, CMD_ENDLEGALESE, CMD_ENDLINK, - CMD_ENDLIST, CMD_ENDOMIT, CMD_ENDPART, CMD_ENDQUOTATION, - CMD_ENDRAW, CMD_ENDSECTION1, CMD_ENDSECTION2, + CMD_CHAPTER, CMD_CODE, CMD_CODELINE, CMD_DIV, CMD_DOTS, + CMD_ELSE, CMD_ENDABSTRACT, CMD_ENDCHAPTER, CMD_ENDCODE, + CMD_ENDDIV, CMD_ENDFOOTNOTE, CMD_ENDIF, CMD_ENDLEGALESE, + CMD_ENDLINK, CMD_ENDLIST, CMD_ENDOMIT, CMD_ENDPART, + CMD_ENDQUOTATION, CMD_ENDRAW, CMD_ENDSECTION1, CMD_ENDSECTION2, CMD_ENDSECTION3, CMD_ENDSECTION4, CMD_ENDSIDEBAR, CMD_ENDTABLE, CMD_EXPIRE, CMD_FOOTNOTE, CMD_GENERATELIST, CMD_GRANULARITY, CMD_HEADER, CMD_I, CMD_IF, CMD_IMAGE, @@ -117,11 +117,13 @@ static struct { { "chapter", CMD_CHAPTER, 0 }, { "code", CMD_CODE, 0 }, { "codeline", CMD_CODELINE, 0}, + { "div", CMD_DIV, 0 }, { "dots", CMD_DOTS, 0 }, { "else", CMD_ELSE, 0 }, { "endabstract", CMD_ENDABSTRACT, 0 }, { "endchapter", CMD_ENDCHAPTER, 0 }, { "endcode", CMD_ENDCODE, 0 }, + { "enddiv", CMD_ENDDIV, 0 }, { "endfootnote", CMD_ENDFOOTNOTE, 0 }, { "endif", CMD_ENDIF, 0 }, { "endlegalese", CMD_ENDLEGALESE, 0 }, @@ -555,6 +557,11 @@ void DocParser::parse(const QString& source, append(Atom::QmlText); break; #endif + case CMD_DIV: + leavePara(); + x = getArgument(true); + append(Atom::Div, x); + break; case CMD_CODELINE: { if (!quoting) { @@ -622,6 +629,10 @@ void DocParser::parse(const QString& source, case CMD_ENDCODE: closeCommand(cmd); break; + case CMD_ENDDIV: + append(Atom::EndDiv); + closeCommand(cmd); + break; #ifdef QDOC_QML case CMD_ENDQML: closeCommand(cmd); @@ -2348,6 +2359,8 @@ int DocParser::endCmdFor(int cmd) return CMD_ENDCHAPTER; case CMD_CODE: return CMD_ENDCODE; + case CMD_DIV: + return CMD_ENDDIV; #ifdef QDOC_QML case CMD_QML: return CMD_ENDQML; diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index b5295c8..40cfba3 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -211,13 +211,13 @@ static void addLink(const QString &linkTarget, HtmlGenerator::HtmlGenerator() : helpProjectWriter(0), inLink(false), + inObsoleteLink(false), inContents(false), inSectionHeading(false), inTableHeader(false), numTableRows(0), threeColumnEnumValueTable(true), funcLeftParen("\\S(\\()"), - inObsoleteLink(false), myTree(0), slow(false), obsoleteLinks(false) @@ -511,6 +511,13 @@ int HtmlGenerator::generateAtom(const Atom *atom, << trimmedTrailing(protectEnc(plainCode(indent(codeIndent,atom->string())))) << "\n"; break; + case Atom::Div: + out() << "string().isEmpty()) + out() << " class=\"" << atom->string() << "\">"; + else + out() << ">"; + break; case Atom::FootnoteLeft: // ### For now if (in_para) { @@ -1129,6 +1136,9 @@ int HtmlGenerator::generateAtom(const Atom *atom, out() << "\\" << protectEnc(atom->string()) << ""; break; + case Atom::EndDiv: + out() << "
    "; + break; #ifdef QDOC_QML case Atom::QmlText: case Atom::EndQmlText: diff --git a/tools/qdoc3/test/macros.qdocconf b/tools/qdoc3/test/macros.qdocconf index 510a8b3..2262daa 100644 --- a/tools/qdoc3/test/macros.qdocconf +++ b/tools/qdoc3/test/macros.qdocconf @@ -34,3 +34,4 @@ macro.beginfloatleft.HTML = "
    " macro.beginfloatright.HTML = "
    " macro.endfloat.HTML = "
    " macro.clearfloat.HTML = "
    " +macro.emptyspan.HTML = "" diff --git a/tools/qdoc3/test/qt-ditaxml.qdocconf b/tools/qdoc3/test/qt-ditaxml.qdocconf index bc32149..211bdb2 100644 --- a/tools/qdoc3/test/qt-ditaxml.qdocconf +++ b/tools/qdoc3/test/qt-ditaxml.qdocconf @@ -46,3 +46,4 @@ macro.beginfloatleft.HTML = " " macro.beginfloatright.HTML = " " macro.endfloat.HTML = " " macro.clearfloat.HTML = " " +macro.emptyspan.DITAXML = " " -- cgit v0.12 From 0727539b89898544047d32e63633790fa0c44b5a Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 14 Dec 2010 14:03:08 +0100 Subject: Don't delete FBO when resetting glyph cache When the glyph cache is cleared because the max texture size has been exceeded, we shouldn't delete the fbo as this is only created in setContext() and will thus not be recreated. All subsequent resizing of the cache will fail. Task-number: QT-3971 Reviewed-by: Samuel --- src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp index 66445cd..1b879c3 100644 --- a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp +++ b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp @@ -83,13 +83,9 @@ void QGLTextureGlyphCache::clear() if (ctx) { QGLShareContextScope scope(ctx); - if (!ctx->d_ptr->workaround_brokenFBOReadBack) - glDeleteFramebuffers(1, &m_fbo); - if (m_width || m_height) glDeleteTextures(1, &m_texture); - m_fbo = 0; m_texture = 0; m_width = 0; m_height = 0; @@ -105,6 +101,13 @@ void QGLTextureGlyphCache::clear() QGLTextureGlyphCache::~QGLTextureGlyphCache() { + if (ctx) { + QGLShareContextScope scope(ctx); + + if (!ctx->d_ptr->workaround_brokenFBOReadBack) + glDeleteFramebuffers(1, &m_fbo); + } + clear(); } -- cgit v0.12 From a8fb1076935a0eb58f803477ed246dc237624370 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Tue, 14 Dec 2010 16:03:40 +0100 Subject: Removed macros for figures and floats. We'll use \div...\enddiv instead. --- tools/qdoc3/test/macros.qdocconf | 32 -------------------------------- 1 file changed, 32 deletions(-) diff --git a/tools/qdoc3/test/macros.qdocconf b/tools/qdoc3/test/macros.qdocconf index 39986fc..2262daa 100644 --- a/tools/qdoc3/test/macros.qdocconf +++ b/tools/qdoc3/test/macros.qdocconf @@ -30,38 +30,6 @@ macro.endcomment = "\\c{*/}" macro.uuml.HTML = "ü" macro.mdash.HTML = "—" -# Macros for floating images and floating images with alt text. -# Ideally, these would be HTML-only macros. - -macro.floatleft = "\\raw HTML\n" \ - "
    " \ - "\\endraw\n" \ - "\\inlineimage \1\n" \ - "\\raw HTML\n" \ - "
    \n" \ - "\\endraw\n" -macro.figureleft = "\\raw HTML\n" \ - "
    " \ - "\\endraw\n" \ - "\\inlineimage \1 \2\n" \ - "\\raw HTML\n" \ - "
    \n" \ - "\\endraw\n" -macro.floatright = "\\raw HTML\n" \ - "
    \n" \ - "\\endraw\n" \ - "\\inlineimage \1\n" \ - "\\raw HTML\n" \ - "
    \n" \ - "\\endraw\n" -macro.figureright = "\\raw HTML\n" \ - "
    " \ - "\\endraw\n" \ - "\\inlineimage \1 \2\n" \ - "\\raw HTML\n" \ - "
    \n" \ - "\\endraw\n" - macro.beginfloatleft.HTML = "
    " macro.beginfloatright.HTML = "
    " macro.endfloat.HTML = "
    " -- cgit v0.12 From bf835c2e69b3bc37145e572f68554bf771eeec3f Mon Sep 17 00:00:00 2001 From: David Boddie Date: Tue, 14 Dec 2010 16:05:30 +0100 Subject: Treat div elements like paragraphs. --- tools/qdoc3/doc.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/qdoc3/doc.cpp b/tools/qdoc3/doc.cpp index 8d4d0ee..ce9e30d 100644 --- a/tools/qdoc3/doc.cpp +++ b/tools/qdoc3/doc.cpp @@ -562,6 +562,8 @@ void DocParser::parse(const QString& source, leavePara(); x = getArgument(true); append(Atom::Div, x); + openedCommands.push(cmd); + enterPara(); break; case CMD_CODELINE: { @@ -631,6 +633,7 @@ void DocParser::parse(const QString& source, closeCommand(cmd); break; case CMD_ENDDIV: + leavePara(); append(Atom::EndDiv); closeCommand(cmd); break; -- cgit v0.12 From cbfeb79c80a774166e016e7c879bba465ffc0496 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Tue, 14 Dec 2010 16:07:48 +0100 Subject: Doc: Used div elements for floats, updated the style sheet. --- doc/src/declarative/positioners.qdoc | 22 ++++++++++++++++------ doc/src/declarative/qdeclarativemodels.qdoc | 4 +++- doc/src/getting-started/how-to-learn-qt.qdoc | 4 +++- doc/src/template/style/style.css | 11 ++++++++++- doc/src/zh_CN/getting-started/how-to-learn-qt.qdoc | 4 +++- .../graphicsitems/qdeclarativeflickable.cpp | 4 +++- .../graphicsitems/qdeclarativegridview.cpp | 4 +++- .../graphicsitems/qdeclarativemousearea.cpp | 4 +++- .../graphicsitems/qdeclarativerectangle.cpp | 20 +++++++++++++++----- src/declarative/util/qdeclarativelistmodel.cpp | 8 ++++++-- src/gui/graphicsview/qgraphicsanchorlayout.cpp | 4 +++- 11 files changed, 68 insertions(+), 21 deletions(-) diff --git a/doc/src/declarative/positioners.qdoc b/doc/src/declarative/positioners.qdoc index ed320a1..d97acbd 100644 --- a/doc/src/declarative/positioners.qdoc +++ b/doc/src/declarative/positioners.qdoc @@ -53,7 +53,9 @@ graphical elements: \section2 Column -\floatright qml-column.png +\div{float-right} +\inlineimage qml-column.png +\enddiv \l Column items are used to vertically arrange items. The following example uses a Column item to arrange three \l Rectangle items in an area defined @@ -68,7 +70,9 @@ must be added to a parent Rectangle, if desired. \section2 Row -\floatright qml-row.png +\div{float-right} +\inlineimage qml-row.png +\enddiv \l Row items are used to horizontally arrange items. The following example uses a Row item to arrange three rounded \l Rectangle items in an area defined @@ -83,7 +87,9 @@ left around the edges of the horizontally centered Row item. \section2 Grid -\floatright qml-grid-spacing.png +\div{float-right} +\inlineimage qml-grid-spacing.png +\enddiv \l Grid items are used to place items in a grid or table arrangement. The following example uses a Grid item to place four \l Rectangle items @@ -102,8 +108,10 @@ at the appropriate places in the Grid definition. \section2 Flow -\floatright qml-flow-text1.png -\floatright qml-flow-text2.png +\div{float-right} +\inlineimage qml-flow-text1.png +\inlineimage qml-flow-text2.png +\enddiv \l Flow items are used to place items like words on a page, with rows or columns of non-overlapping items. @@ -129,7 +137,9 @@ control of spacing between items and between lines of items. \section1 Repeaters -\floatright qml-repeater-grid-index.png +\div{float-right} +\inlineimage qml-repeater-grid-index.png +\enddiv Repeaters create items from a template for use with positioners, using data from a model. Combining repeaters and positioners is an easy way to lay out diff --git a/doc/src/declarative/qdeclarativemodels.qdoc b/doc/src/declarative/qdeclarativemodels.qdoc index a61b115..495b3bd 100644 --- a/doc/src/declarative/qdeclarativemodels.qdoc +++ b/doc/src/declarative/qdeclarativemodels.qdoc @@ -504,7 +504,9 @@ a Web browser. \l ListView shows a classic list of items with horizontal or vertical placing of items. -\floatright qml-listview-snippet.png +\div{float-right} +\inlineimage qml-listview-snippet.png +\enddiv The following example shows a minimal ListView displaying a sequence of numbers (using an \l{QML Data Models#An Integer}{integer as a model}). diff --git a/doc/src/getting-started/how-to-learn-qt.qdoc b/doc/src/getting-started/how-to-learn-qt.qdoc index e5f1ff9..0d5fd0a 100644 --- a/doc/src/getting-started/how-to-learn-qt.qdoc +++ b/doc/src/getting-started/how-to-learn-qt.qdoc @@ -51,7 +51,9 @@ key overviews to deepen your understanding of Qt: The Qt \l{Object Model} and \l{Signals and Slots}. - \floatleft qtdemo-small.png + \div{float-left} + \inlineimage qtdemo-small.png + \enddiv \section1 Getting an Overview diff --git a/doc/src/template/style/style.css b/doc/src/template/style/style.css index 04d8c05..d623bd4 100755 --- a/doc/src/template/style/style.css +++ b/doc/src/template/style/style.css @@ -176,7 +176,16 @@ { /* background-color: #E6E6E6;*/ /* disabled until further notice */ } - + + div.float-left + { + float: left; margin-right: 2em + } + div.float-right + { + float: right; margin-left: 2em + } + span.comment { color: #008B00; diff --git a/doc/src/zh_CN/getting-started/how-to-learn-qt.qdoc b/doc/src/zh_CN/getting-started/how-to-learn-qt.qdoc index 598cbea..e74c84c 100644 --- a/doc/src/zh_CN/getting-started/how-to-learn-qt.qdoc +++ b/doc/src/zh_CN/getting-started/how-to-learn-qt.qdoc @@ -41,7 +41,9 @@ 现在您已经编写了一些小型可用的应用程序,并对 Qt 编程有更加广泛的了解。您可以直接着手做自己的项目,但我们建议您阅读以下一些关键简介以加深您对 Qt 的了解:\l{Qt Object Model}Qt 对象模型}和\l{Signals and Slots}{信号和槽}。 - \floatleft qtdemo-small.png + \div {float-left} + \inlineimage qtdemo-small.png + \enddiv \section1 了解概况 diff --git a/src/declarative/graphicsitems/qdeclarativeflickable.cpp b/src/declarative/graphicsitems/qdeclarativeflickable.cpp index 1899a39..cd770d4 100644 --- a/src/declarative/graphicsitems/qdeclarativeflickable.cpp +++ b/src/declarative/graphicsitems/qdeclarativeflickable.cpp @@ -373,7 +373,9 @@ void QDeclarativeFlickablePrivate::updateBeginningEnd() \section1 Example Usage - \floatright flickable.gif + \div {float-right} + \inlineimage flickable.gif + \enddiv The following example shows a small view onto a large image in which the user can drag or flick the image in order to view different parts of it. diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index c7517f4..ba66aba 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -1095,7 +1095,9 @@ void QDeclarativeGridViewPrivate::flick(AxisData &data, qreal minExtent, qreal m \snippet doc/src/snippets/declarative/gridview/ContactModel.qml 0 - \floatright gridview-simple.png + \div {float-right} + \inlineimage gridview-simple.png + \enddiv This model can be referenced as \c ContactModel in other QML files. See \l{QML Modules} for more information about creating reusable components like this. diff --git a/src/declarative/graphicsitems/qdeclarativemousearea.cpp b/src/declarative/graphicsitems/qdeclarativemousearea.cpp index 56e5c6b..3d5c29f 100644 --- a/src/declarative/graphicsitems/qdeclarativemousearea.cpp +++ b/src/declarative/graphicsitems/qdeclarativemousearea.cpp @@ -216,7 +216,9 @@ QDeclarativeMouseAreaPrivate::~QDeclarativeMouseAreaPrivate() \section1 Example Usage - \floatright qml-mousearea-snippet.png + \div {float-right} + \inlineimage qml-mousearea-snippet.png + \enddiv The following example uses a MouseArea in a \l Rectangle that changes the \l Rectangle color to red when clicked: diff --git a/src/declarative/graphicsitems/qdeclarativerectangle.cpp b/src/declarative/graphicsitems/qdeclarativerectangle.cpp index 969027e..7bb6afb 100644 --- a/src/declarative/graphicsitems/qdeclarativerectangle.cpp +++ b/src/declarative/graphicsitems/qdeclarativerectangle.cpp @@ -131,7 +131,9 @@ void QDeclarativeGradientStop::updateGradient() \section1 Example Usage - \floatright qml-gradient.png + \div {float-right} + \inlineimage qml-gradient.png + \enddiv The following example declares a \l Rectangle item with a gradient starting with red, blending to yellow at one third of the height of the rectangle, @@ -215,7 +217,9 @@ void QDeclarativeGradient::doUpdate() \section1 Example Usage - \floatright declarative-rect.png + \div {float-right} + \inlineimage declarative-rect.png + \enddiv The following example shows the effects of some of the common properties on a Rectangle item, which in this case is used to create a square: @@ -265,7 +269,9 @@ void QDeclarativeRectangle::doUpdate() rectangle (as documented for QRect rendering). This can cause unintended effects if \c border.width is 1 and the rectangle is \l{Item::clip}{clipped} by a parent item: - \floatright rect-border-width.png + \div {float-right} + \inlineimage rect-border-width.png + \enddiv \snippet doc/src/snippets/declarative/rectangle/rect-border-width.qml 0 @@ -287,7 +293,9 @@ QDeclarativePen *QDeclarativeRectangle::border() This property allows for the construction of simple vertical gradients. Other gradients may by formed by adding rotation to the rectangle. - \floatleft declarative-rect_gradient.png + \div {float-left} + \inlineimage declarative-rect_gradient.png + \enddiv \snippet doc/src/snippets/declarative/rectangle/rectangle-gradient.qml rectangles \clearfloat @@ -353,7 +361,9 @@ void QDeclarativeRectangle::setRadius(qreal radius) The default color is white. - \floatright rect-color.png + \div {float-right} + \inlineimage rect-color.png + \enddiv The following example shows rectangles with colors specified using hexadecimal and named color notation: diff --git a/src/declarative/util/qdeclarativelistmodel.cpp b/src/declarative/util/qdeclarativelistmodel.cpp index 52e563b..0f117f5 100644 --- a/src/declarative/util/qdeclarativelistmodel.cpp +++ b/src/declarative/util/qdeclarativelistmodel.cpp @@ -108,7 +108,9 @@ QDeclarativeListModelParser::ListInstruction *QDeclarativeListModelParser::ListM The following example shows a ListModel containing three elements, with the roles "name" and "cost". - \floatright listmodel.png + \div {float-right} + \inlineimage listmodel.png + \enddiv \snippet doc/src/snippets/declarative/listmodel.qml 0 @@ -131,7 +133,9 @@ QDeclarativeListModelParser::ListInstruction *QDeclarativeListModelParser::ListM The delegate displays all the fruit attributes: - \floatright listmodel-nested.png + \div {float-right} + \inlineimage listmodel-nested.png + \enddiv \snippet doc/src/snippets/declarative/listmodel-nested.qml delegate diff --git a/src/gui/graphicsview/qgraphicsanchorlayout.cpp b/src/gui/graphicsview/qgraphicsanchorlayout.cpp index 1d1d257..fe0ad86 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout.cpp +++ b/src/gui/graphicsview/qgraphicsanchorlayout.cpp @@ -56,7 +56,9 @@ Items that are anchored are automatically added to the layout, and if items are removed, all their anchors will be automatically removed. - \figureleft{simpleanchorlayout-example.png}{Using an anchor layout to align simple colored widgets.} + \div {float-left} + \inlineimage simpleanchorlayout-example.png Using an anchor layout to align simple colored widgets. + \enddiv Anchors are always set up between edges of an item, where the "center" is also considered to be an edge. Consider the following example: -- cgit v0.12 From c031e5808ee406277a5401c69801e5c6e2ebfaea Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Wed, 15 Dec 2010 14:16:36 +1000 Subject: Fix invalid configurations being added to bearermonitor list. --- examples/network/bearermonitor/bearermonitor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/network/bearermonitor/bearermonitor.cpp b/examples/network/bearermonitor/bearermonitor.cpp index 75ffb01..bfa3d1f 100644 --- a/examples/network/bearermonitor/bearermonitor.cpp +++ b/examples/network/bearermonitor/bearermonitor.cpp @@ -226,7 +226,7 @@ void BearerMonitor::updateConfigurations() if (defaultConfiguration.type() == QNetworkConfiguration::ServiceNetwork) updateSnapConfiguration(defaultItem, defaultConfiguration); - } else { + } else if (defaultConfiguration.isValid()) { configurationAdded(defaultConfiguration); } -- cgit v0.12 From c9faf2defa9fa3209e44e8a5c1ae2da8e630d379 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Wed, 8 Dec 2010 17:48:14 +1000 Subject: Ensure that DBus is connected before all uses. In early system startup applications may try to use ICD before it is contactable. Ensure that the connection to ICD is established before all calls are made. If ICD is still not contactable QDBusServiceWatcher is used to monitor registration of the com.nokia.icd2 address and reconnection is attempted once ICD is started. Task-number: Maemo 199755 --- src/plugins/bearer/icd/qicdengine.cpp | 93 ++++++++++++++++++++++++++++++----- src/plugins/bearer/icd/qicdengine.h | 6 +++ 2 files changed, 88 insertions(+), 11 deletions(-) diff --git a/src/plugins/bearer/icd/qicdengine.cpp b/src/plugins/bearer/icd/qicdengine.cpp index bdf4e2e..a5a183b 100644 --- a/src/plugins/bearer/icd/qicdengine.cpp +++ b/src/plugins/bearer/icd/qicdengine.cpp @@ -229,7 +229,7 @@ void IapMonitor::iapRemoved(const QString &iap_id) /******************************************************************************/ QIcdEngine::QIcdEngine(QObject *parent) -: QBearerEngine(parent), iapMonitor(0), m_dbusInterface(0), +: QBearerEngine(parent), iapMonitor(0), m_dbusInterface(0), m_icdServiceWatcher(0), firstUpdate(true), m_scanGoingOn(false) { } @@ -248,9 +248,10 @@ QNetworkConfigurationManager::Capabilities QIcdEngine::capabilities() const QNetworkConfigurationManager::NetworkSessionRequired; } -void QIcdEngine::initialize() +bool QIcdEngine::ensureDBusConnection() { - QMutexLocker locker(&mutex); + if (m_dbusInterface) + return true; // Setup DBus Interface for ICD m_dbusInterface = new QDBusInterface(ICD_DBUS_API_INTERFACE, @@ -259,9 +260,22 @@ void QIcdEngine::initialize() QDBusConnection::systemBus(), this); - // abort if cannot connect to DBus. - if (!m_dbusInterface->isValid()) - return; + if (!m_dbusInterface->isValid()) { + delete m_dbusInterface; + m_dbusInterface = 0; + + if (!m_icdServiceWatcher) { + m_icdServiceWatcher = new QDBusServiceWatcher(ICD_DBUS_API_INTERFACE, + QDBusConnection::systemBus(), + QDBusServiceWatcher::WatchForOwnerChange, + this); + + connect(m_icdServiceWatcher, SIGNAL(serviceOwnerChanged(QString,QString,QString)), + this, SLOT(icdServiceOwnerChanged(QString,QString,QString))); + } + + return false; + } connect(&m_scanTimer, SIGNAL(timeout()), this, SLOT(finishAsyncConfigurationUpdate())); m_scanTimer.setSingleShot(true); @@ -289,6 +303,19 @@ void QIcdEngine::initialize() doRequestUpdate(); getIcdInitialState(); + + return true; +} + +void QIcdEngine::initialize() +{ + QMutexLocker locker(&mutex); + + if (!ensureDBusConnection()) { + locker.unlock(); + emit updateCompleted(); + locker.relock(); + } } static inline QString network_attrs_to_security(uint network_attrs) @@ -792,6 +819,9 @@ QNetworkConfigurationPrivatePointer QIcdEngine::defaultConfiguration() { QMutexLocker locker(&mutex); + if (!ensureDBusConnection()) + return QNetworkConfigurationPrivatePointer(); + // Here we just return [ANY] request to icd and let the icd decide which IAP to connect. return userChoiceConfigurations.value(OSSO_IAP_ANY); } @@ -933,13 +963,52 @@ void QIcdEngine::connectionStateSignalsSlot(QDBusMessage msg) locker.relock(); } +void QIcdEngine::icdServiceOwnerChanged(const QString &serviceName, const QString &oldOwner, + const QString &newOwner) +{ + QMutexLocker locker(&mutex); + + if (newOwner.isEmpty()) { + // Disconnected from ICD, remove all configurations + cleanup(); + delete iapMonitor; + iapMonitor = 0; + delete m_dbusInterface; + m_dbusInterface = 0; + + QMutableHashIterator i(accessPointConfigurations); + while (i.hasNext()) { + i.next(); + + QNetworkConfigurationPrivatePointer ptr = i.value(); + i.remove(); + + locker.unlock(); + emit configurationRemoved(ptr); + locker.relock(); + } + + userChoiceConfigurations.clear(); + } else { + // Connected to ICD ensure connection. + ensureDBusConnection(); + } +} + void QIcdEngine::requestUpdate() { QMutexLocker locker(&mutex); - if (m_scanGoingOn) { + if (!ensureDBusConnection()) { + locker.unlock(); + emit updateCompleted(); + locker.relock(); return; } + + if (m_scanGoingOn) + return; + m_scanGoingOn = true; m_dbusInterface->connection().connect(ICD_DBUS_API_INTERFACE, @@ -956,14 +1025,16 @@ void QIcdEngine::requestUpdate() void QIcdEngine::cancelAsyncConfigurationUpdate() { - if (!m_scanGoingOn) { + if (!ensureDBusConnection()) return; - } + + if (!m_scanGoingOn) + return; + m_scanGoingOn = false; - if (m_scanTimer.isActive()) { + if (m_scanTimer.isActive()) m_scanTimer.stop(); - } m_dbusInterface->connection().disconnect(ICD_DBUS_API_INTERFACE, ICD_DBUS_API_PATH, diff --git a/src/plugins/bearer/icd/qicdengine.h b/src/plugins/bearer/icd/qicdengine.h index d528f15..d5b4fb3 100644 --- a/src/plugins/bearer/icd/qicdengine.h +++ b/src/plugins/bearer/icd/qicdengine.h @@ -53,6 +53,7 @@ QT_BEGIN_NAMESPACE class QNetworkConfigurationPrivate; class IapMonitor; class QDBusInterface; +class QDBusServiceWatcher; inline QNetworkConfiguration::BearerType bearerTypeFromIapType(const QString &iapType) { @@ -147,12 +148,15 @@ private Q_SLOTS: void finishAsyncConfigurationUpdate(); void asyncUpdateConfigurationsSlot(QDBusMessage msg); void connectionStateSignalsSlot(QDBusMessage msg); + void icdServiceOwnerChanged(const QString &serviceName, const QString &oldOwner, + const QString &newOwner); private: void startListeningStateSignalsForAllConnections(); void doRequestUpdate(QList scanned = QList()); void cancelAsyncConfigurationUpdate(); void getIcdInitialState(); + bool ensureDBusConnection(); private: IapMonitor *iapMonitor; @@ -162,6 +166,8 @@ private: QStringList m_typesToBeScanned; QList m_scanResult; + QDBusServiceWatcher *m_icdServiceWatcher; + bool firstUpdate; bool m_scanGoingOn; }; -- cgit v0.12 From e75980a322ea1088e1c6bf60259b8ba853d32444 Mon Sep 17 00:00:00 2001 From: Aaron McCarthy Date: Wed, 15 Dec 2010 15:30:43 +1000 Subject: Fix possible null pointer dereference. When parsing a new connection an access point with the same SSID may not have been previously seen. Task-number: QTBUG-15276 --- src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp index 554f9b7..f93b605 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp @@ -743,9 +743,11 @@ QNetworkConfigurationPrivate *QNetworkManagerEngine::parseConnection(const QStri QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.take(accessPointId); - mutex.unlock(); - emit configurationRemoved(ptr); - mutex.lock(); + if (ptr) { + mutex.unlock(); + emit configurationRemoved(ptr); + mutex.lock(); + } } break; } -- cgit v0.12 From 27de60f2f6047cb3f698825af96e569fde04ef06 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Wed, 15 Dec 2010 17:06:25 +1000 Subject: Add extra type of embedded license. Marketing needs this for commercial customers. Reviewed-by: Trust Me --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 7141880..aa8d047 100755 --- a/configure +++ b/configure @@ -480,7 +480,7 @@ elif [ $COMMERCIAL_USER = "yes" ]; then # Qt All-OS LICENSE_EXTENSION="-ALLOS" ;; - 8M,* | KM,* | S9,* | SC,* | SU,* | SW,* | X9,* | XC,* | XU,* | XW,*) + 8M,* | KM,* | S9,* | SC,* | SM,* | SU,* | SW,* | X9,* | XC,* | XU,* | XW,*) # Qt for Embedded Linux LICENSE_EXTENSION="-EMBEDDED" ;; -- cgit v0.12 From 915a31420c4f8d04c82103e3dd4d33b468a9334d Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Wed, 15 Dec 2010 11:44:19 +0200 Subject: Resize event for QDesktopWidget was sent too early Some recent changes had caused a change in events sent from avkon to QSymbianControl, causing QDesktopWidget to be get resize event before the client area of application was correct. Moved the resize event sending from HandleStatusPaneSizeChange to HandleResourceChange (case KEikDynamicLayoutVariantSwitch). Task-number: QTBUG-16095 Reviewed-by: Sami Merila --- src/gui/kernel/qapplication_s60.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 81fa4e6..6db1fa8 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -667,9 +667,6 @@ void QSymbianControl::HandleStatusPaneSizeChange() { QS60MainAppUi *s60AppUi = static_cast(S60->appUi()); s60AppUi->HandleStatusPaneSizeChange(); - // Send resize event to trigger desktopwidget workAreaResized signal - QResizeEvent e(qt_desktopWidget->size(), qt_desktopWidget->size()); - QApplication::sendEvent(qt_desktopWidget, &e); } #endif @@ -1310,6 +1307,9 @@ void QSymbianControl::HandleResourceChange(int resourceType) case KEikDynamicLayoutVariantSwitch: { handleClientAreaChange(); + // Send resize event to trigger desktopwidget workAreaResized signal + QResizeEvent e(qt_desktopWidget->size(), qt_desktopWidget->size()); + QApplication::sendEvent(qt_desktopWidget, &e); break; } #endif -- cgit v0.12 From e0aa9897bc2d04054cc65dbe3452bee2ed2eacd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Wed, 15 Dec 2010 12:41:08 +0100 Subject: Prevent crash in drawhelper code when the cpu has MMXEXT but no SSE. We can't use the qdrawhelper_sse.cpp or qdrawhelper_sse3dnow.cpp when SSE is not run-time detected, as those are compiled with -msse and MMXEXT is just a subset of SSE. The compiler might choose to use an instruction not in the subset, causing a crash at run-time. Task-number: QTBUG-15693 Reviewed-by: Thiago Macieira --- src/gui/painting/qdrawhelper.cpp | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 024a69d..62af212 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -7711,17 +7711,6 @@ void qInitDrawhelperAsm() } #endif #endif // SSE -#if defined(QT_HAVE_MMXEXT) && defined(QT_HAVE_SSE) - } else if (features & MMXEXT) { - qt_memfill32 = qt_memfill32_sse; - qDrawHelper[QImage::Format_RGB16].bitmapBlit = qt_bitmapblit16_sse; -# ifdef QT_HAVE_3DNOW - if (features & MMX3DNOW) { - qt_memfill32 = qt_memfill32_sse3dnow; - qDrawHelper[QImage::Format_RGB16].bitmapBlit = qt_bitmapblit16_sse3dnow; - } -# endif // 3DNOW -#endif // MMXEXT } #ifdef QT_HAVE_MMX if (features & MMX) { -- cgit v0.12 From 21b1b5a9af95af10b281176564f14cafa2339006 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Sat, 11 Dec 2010 00:03:14 +0100 Subject: Improve performance of clipping to a scaled QRectF Clipping to a scaled QRectF was so far hitting the slow code path in the raster paintengine that generates clip spans for every line. This is not needed as we also clip translated QRectF's to integer rects. This patch does the same for scaled rectangles and ensures the clipping really happens at the closest pixel boundary. Reviewed-by: Samuel --- src/gui/painting/qpaintengine_raster.cpp | 33 ++++++++++++++++++++++---------- src/gui/painting/qpaintengine_raster_p.h | 2 ++ 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 89202ac..4d06c9f 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -1212,7 +1212,7 @@ void QRasterPaintEngine::clip(const QVectorPath &path, Qt::ClipOperation op) // There are some cases that are not supported by clip(QRect) if (op != Qt::UniteClip && (op != Qt::IntersectClip || !s->clip || s->clip->hasRectClip || s->clip->hasRegionClip)) { - if (s->matrix.type() <= QTransform::TxTranslate + if (s->matrix.type() <= QTransform::TxScale && ((path.shape() == QVectorPath::RectangleHint) || (isRect(points, path.elementCount()) && (!types || (types[0] == QPainterPath::MoveToElement @@ -1224,8 +1224,8 @@ void QRasterPaintEngine::clip(const QVectorPath &path, Qt::ClipOperation op) #endif QRectF r(points[0], points[1], points[4]-points[0], points[5]-points[1]); - clip(r.toRect(), op); - return; + if (setClipRectInDeviceCoords(s->matrix.mapRect(r).toRect(), op)) + return; } } @@ -1286,7 +1286,6 @@ void QRasterPaintEngine::clip(const QRect &rect, Qt::ClipOperation op) qDebug() << "QRasterPaintEngine::clip(): " << rect << op; #endif - Q_D(QRasterPaintEngine); QRasterPaintEngineState *s = state(); if (op == Qt::NoClip) { @@ -1296,11 +1295,23 @@ void QRasterPaintEngine::clip(const QRect &rect, Qt::ClipOperation op) QPaintEngineEx::clip(rect, op); return; - } else if (op == Qt::ReplaceClip || s->clip == 0) { + } else if (!setClipRectInDeviceCoords(s->matrix.mapRect(rect), op)) { + QPaintEngineEx::clip(rect, op); + return; + } +} + + +bool QRasterPaintEngine::setClipRectInDeviceCoords(const QRect &r, Qt::ClipOperation op) +{ + Q_D(QRasterPaintEngine); + QRect clipRect = r & d->deviceRect; + QRasterPaintEngineState *s = state(); + + if (op == Qt::ReplaceClip || s->clip == 0) { // No current clip, hence we intersect with sysclip and be // done with it... - QRect clipRect = s->matrix.mapRect(rect) & d->deviceRect; QRegion clipRegion = systemClip(); QClipData *clip = new QClipData(d->rasterBuffer->height()); @@ -1316,12 +1327,11 @@ void QRasterPaintEngine::clip(const QRect &rect, Qt::ClipOperation op) s->clip->enabled = true; s->flags.has_clip_ownership = true; - } else { // intersect clip with current clip + } else if (op == Qt::IntersectClip){ // intersect clip with current clip QClipData *base = s->clip; Q_ASSERT(base); if (base->hasRectClip || base->hasRegionClip) { - QRect clipRect = s->matrix.mapRect(rect) & d->deviceRect; if (!s->flags.has_clip_ownership) { s->clip = new QClipData(d->rasterBuffer->height()); s->flags.has_clip_ownership = true; @@ -1332,11 +1342,14 @@ void QRasterPaintEngine::clip(const QRect &rect, Qt::ClipOperation op) s->clip->setClipRegion(base->clipRegion & clipRect); s->clip->enabled = true; } else { - QPaintEngineEx::clip(rect, op); - return; + return false; } + } else { + return false; } + qrasterpaintengine_dirty_clip(d, s); + return true; } diff --git a/src/gui/painting/qpaintengine_raster_p.h b/src/gui/painting/qpaintengine_raster_p.h index 1016f8d..7d4d3b6 100644 --- a/src/gui/painting/qpaintengine_raster_p.h +++ b/src/gui/painting/qpaintengine_raster_p.h @@ -266,6 +266,8 @@ private: void drawGlyphsS60(const QPointF &p, const QTextItemInt &ti); #endif // Q_OS_SYMBIAN && QT_NO_FREETYPE + bool setClipRectInDeviceCoords(const QRect &r, Qt::ClipOperation op); + inline void ensureBrush(const QBrush &brush) { if (!qbrush_fast_equals(state()->lastBrush, brush) || (brush.style() != Qt::NoBrush && state()->fillFlags)) updateBrush(brush); -- cgit v0.12 From cace8e6a9f00ee478dfe63a7fa6959056cfe7e8a Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 15 Dec 2010 13:51:23 +0100 Subject: Doc: Fixed an old-style float. --- src/declarative/graphicsitems/qdeclarativegridview.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index ba66aba..264f12c 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -1111,7 +1111,9 @@ void QDeclarativeGridViewPrivate::flick(AxisData &data, qreal minExtent, qreal m \codeline \snippet doc/src/snippets/declarative/gridview/gridview.qml classdocs simple - \floatright gridview-highlight.png + \div {float-right} + \inlineimage gridview-highlight.png + \enddiv The view will create a new delegate for each item in the model. Note that the delegate is able to access the model's \c name and \c portrait data directly. -- cgit v0.12 From 3e7adcb80a86748608d5517413301cd2b1b8df78 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Wed, 15 Dec 2010 16:42:05 +0100 Subject: Check for null-pointer to avoid a crash in textedit demo. Task-number: QTBUG-16125 Reviewed-by: trustme --- demos/textedit/textedit.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/demos/textedit/textedit.cpp b/demos/textedit/textedit.cpp index 165c97c..9fa1949 100644 --- a/demos/textedit/textedit.cpp +++ b/demos/textedit/textedit.cpp @@ -262,7 +262,8 @@ void TextEdit::setupEditActions() tb->addAction(a); menu->addAction(a); #ifndef QT_NO_CLIPBOARD - actionPaste->setEnabled(QApplication::clipboard()->mimeData()->hasText()); + if (const QMimeData *md = QApplication::clipboard()->mimeData()) + actionPaste->setEnabled(md->hasText()); #endif } @@ -681,7 +682,8 @@ void TextEdit::cursorPositionChanged() void TextEdit::clipboardDataChanged() { #ifndef QT_NO_CLIPBOARD - actionPaste->setEnabled(QApplication::clipboard()->mimeData()->hasText()); + if (const QMimeData *md = QApplication::clipboard()->mimeData()) + actionPaste->setEnabled(md->hasText()); #endif } -- cgit v0.12 From cb51c2157f870a5c83ae6d9435ec4b1004392bc9 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 13 Dec 2010 22:26:39 +0100 Subject: Don't need to set FD_CLOEXEC since qt_safe_* will have done that. Reviewed-By: Trust Me --- src/network/socket/qnativesocketengine_unix.cpp | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/src/network/socket/qnativesocketengine_unix.cpp b/src/network/socket/qnativesocketengine_unix.cpp index f6bfbac..021acd0 100644 --- a/src/network/socket/qnativesocketengine_unix.cpp +++ b/src/network/socket/qnativesocketengine_unix.cpp @@ -202,9 +202,6 @@ bool QNativeSocketEnginePrivate::createNewSocket(QAbstractSocket::SocketType soc return false; } - // Ensure that the socket is closed on exec*(). - ::fcntl(socket, F_SETFD, FD_CLOEXEC); - socketDescriptor = socket; return true; } @@ -565,16 +562,6 @@ int QNativeSocketEnginePrivate::nativeAccept() #else int acceptedDescriptor = qt_safe_accept(socketDescriptor, 0, 0); #endif - //check if we have valid descriptor at all - if(acceptedDescriptor > 0) { - // Ensure that the socket is closed on exec*() - ::fcntl(acceptedDescriptor, F_SETFD, FD_CLOEXEC); - } -#ifdef Q_OS_SYMBIAN - else { - qWarning("QNativeSocketEnginePrivate::nativeAccept() - acceptedDescriptor <= 0"); - } -#endif return acceptedDescriptor; } -- cgit v0.12 From e1955231478df8990cf8b1f80438abf957c5d6f2 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 14 Dec 2010 11:25:32 +0100 Subject: Add a warning about trying to release a timer ID that isn't active Reviewed-By: Trust Me --- src/corelib/kernel/qeventdispatcher_unix.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/corelib/kernel/qeventdispatcher_unix.cpp b/src/corelib/kernel/qeventdispatcher_unix.cpp index f50994c..b2ccc68 100644 --- a/src/corelib/kernel/qeventdispatcher_unix.cpp +++ b/src/corelib/kernel/qeventdispatcher_unix.cpp @@ -501,6 +501,7 @@ bool QTimerInfoList::unregisterTimer(int timerId) } } // id not found + qWarning("Application asked to unregister timer 0x%x which is not registered in this thread. Fix application.", timerId); return false; } -- cgit v0.12 From 038927f1208ff346cbe8d2cfefbd39808ffb5711 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 15 Dec 2010 18:48:05 +0100 Subject: Autotest: Add some comments about this obscure test. More information, see commit d9bf386d917c64ad5d8f11f9daadf82b2be9d531 (old qt-history) and old TT task 90183. Reviewed-By: Trust Me --- tests/auto/qprocess/tst_qprocess.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/auto/qprocess/tst_qprocess.cpp b/tests/auto/qprocess/tst_qprocess.cpp index fd310f4..13f1d26 100644 --- a/tests/auto/qprocess/tst_qprocess.cpp +++ b/tests/auto/qprocess/tst_qprocess.cpp @@ -1999,11 +1999,15 @@ void tst_QProcess::spaceInName() void tst_QProcess::lockupsInStartDetached() { #if !defined(Q_OS_SYMBIAN) - // What exactly is this call supposed to achieve anyway? + // Check that QProcess doesn't cause a lock up at this program's + // exit if a thread was started and we tried to run a program that + // doesn't exist. Before Qt 4.2, this used to lock up on Unix due + // to calling ::exit instead of ::_exit if execve failed. + QHostInfo::lookupHost(QString("something.invalid"), 0, 0); -#endif QProcess::execute("yjhbrty"); QProcess::startDetached("yjhbrty"); +#endif } //----------------------------------------------------------------------------- -- cgit v0.12 From 7b0809edf975f3226b43d3b43b5fe8035298fde9 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 15 Dec 2010 18:48:48 +0100 Subject: ICC: Don't print warning 1259 since it's too annoying. ICC 12 keeps outputting this when you copy a type of larger size to a smaller, or from int to float. --- mkspecs/linux-icc/qmake.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkspecs/linux-icc/qmake.conf b/mkspecs/linux-icc/qmake.conf index af56a9a..ba707e23 100644 --- a/mkspecs/linux-icc/qmake.conf +++ b/mkspecs/linux-icc/qmake.conf @@ -23,7 +23,7 @@ QMAKE_YACC = yacc QMAKE_YACCFLAGS = -d QMAKE_CFLAGS = -falign-stack=maintain-16-byte QMAKE_CFLAGS_DEPS = -M -QMAKE_CFLAGS_WARN_ON = -w1 -Wcheck -wd654,1572,411,873,1125 +QMAKE_CFLAGS_WARN_ON = -w1 -Wcheck -wd654,1572,411,873,1125,2259 QMAKE_CFLAGS_WARN_OFF = -w QMAKE_CFLAGS_RELEASE = -O2 -falign-functions=16 -ansi-alias -fstrict-aliasing QMAKE_CFLAGS_DEBUG = -O0 -g -- cgit v0.12 From 981a83d7832e8cd1ee7bcd42dfaba62f0b04f2c1 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 15 Dec 2010 18:53:57 +0100 Subject: Suppress a warning about killing a timer that isn't active. The timer was active, but it got killed by ~QObject. The QObject d-pointer is deleted after the timers (as is expected), which means that the QBasicTimer destructors in QAbstractItemViewPrivate are run after the timers are already gone. Reviewed-by: Trust Me --- src/gui/itemviews/qabstractitemview.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp index acc8deb..177b088 100644 --- a/src/gui/itemviews/qabstractitemview.cpp +++ b/src/gui/itemviews/qabstractitemview.cpp @@ -595,6 +595,8 @@ QAbstractItemView::QAbstractItemView(QAbstractItemViewPrivate &dd, QWidget *pare */ QAbstractItemView::~QAbstractItemView() { + // stop this timer here before ~QObject + d_func()->delayedReset.stop(); } /*! -- cgit v0.12 From 867a421ed539040bd197c13f6c98f313e232cdf3 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Thu, 16 Dec 2010 11:37:13 +0100 Subject: qdoc: Added typedef to help the OSX compiler accept a template. --- tools/qdoc3/qmlmarkupvisitor.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/qdoc3/qmlmarkupvisitor.h b/tools/qdoc3/qmlmarkupvisitor.h index 60bc336..709a858 100644 --- a/tools/qdoc3/qmlmarkupvisitor.h +++ b/tools/qdoc3/qmlmarkupvisitor.h @@ -159,10 +159,11 @@ protected: QString protect(const QString &string); private: + typedef QHash StringHash; void addExtra(quint32 start, quint32 finish); void addMarkedUpToken(QDeclarativeJS::AST::SourceLocation &location, const QString &text, - const QHash &attributes = QHash()); + const StringHash &attributes = StringHash()); void addVerbatim(QDeclarativeJS::AST::SourceLocation first, QDeclarativeJS::AST::SourceLocation last = QDeclarativeJS::AST::SourceLocation()); QString sourceText(QDeclarativeJS::AST::SourceLocation &location); -- cgit v0.12 From fa57982fadab625fb022d32f690ef05427920581 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Thu, 16 Dec 2010 11:30:17 +0100 Subject: QmlDebugger: Fix runtime warnings about unregistered metatypes Check whether the type of a property is known to the metatype system before trying to read from it. That avoids lots of runtime warnings e.g. for the QSequentialGroup::currentAnimation property, which type QAbstractAnimation * isn't registered by default via qRegisterMetaType<>(). Reviewed-by: Christiaan Janssen Task-number: QTCREATORBUG-2853 --- src/declarative/qml/qdeclarativeenginedebug.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/declarative/qml/qdeclarativeenginedebug.cpp b/src/declarative/qml/qdeclarativeenginedebug.cpp index bffe681..e54f7d6 100644 --- a/src/declarative/qml/qdeclarativeenginedebug.cpp +++ b/src/declarative/qml/qdeclarativeenginedebug.cpp @@ -146,7 +146,10 @@ QDeclarativeEngineDebugServer::propertyData(QObject *obj, int propIdx) if (binding) rv.binding = binding->expression(); - QVariant value = prop.read(obj); + QVariant value; + if (prop.userType() != 0) { + value = prop.read(obj); + } rv.value = valueContents(value); if (QDeclarativeValueTypeFactory::isValueType(prop.userType())) { -- cgit v0.12 From 6f9642572c392536c07a52037e4c1de587489c49 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 16 Dec 2010 13:21:22 +0100 Subject: Add work around for bug when painting w/glTexSubImage into large texture It seems that copying small rectangles from glTexSubImage2D into a texture which is 2048x2048 is busted on some SGX drivers, even though the driver reports 2048 as the maximum texture size. This caused text to turn into flickering garbage once the texture glyph cache had grown to its max size (e.g. when painting very many Chinese glyphs.) To work around the problem, we hardcore the maximum texture height to 1024 on this driver so that the texture glyph cache is reset whenever that size is exceeded. Task-number: QT-3971 Done-with: Samuel --- src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp | 5 ++++- src/opengl/qgl.cpp | 1 + src/opengl/qgl_egl.cpp | 2 ++ src/opengl/qgl_p.h | 1 + 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp index 1b879c3..ba311c3 100644 --- a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp +++ b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp @@ -323,6 +323,9 @@ int QGLTextureGlyphCache::maxTextureWidth() const int QGLTextureGlyphCache::maxTextureHeight() const { - return ctx->d_ptr->maxTextureSize(); + if (ctx->d_ptr->workaround_brokenTexSubImage) + return qMin(1024, ctx->d_ptr->maxTextureSize()); + else + return ctx->d_ptr->maxTextureSize(); } QT_END_NAMESPACE diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 18f1203..9bf879a 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -1706,6 +1706,7 @@ void QGLContextPrivate::init(QPaintDevice *dev, const QGLFormat &format) active_engine = 0; workaround_needsFullClearOnEveryFrame = false; workaround_brokenFBOReadBack = false; + workaround_brokenTexSubImage = false; workaroundsCached = false; workaround_brokenTextureFromPixmap = false; diff --git a/src/opengl/qgl_egl.cpp b/src/opengl/qgl_egl.cpp index 8902099..6f9e39c 100644 --- a/src/opengl/qgl_egl.cpp +++ b/src/opengl/qgl_egl.cpp @@ -204,6 +204,8 @@ void QGLContext::makeCurrent() const char *egl_version = eglQueryString(d->eglContext->display(), EGL_VERSION); if (egl_version && strstr(egl_version, "1.3")) d->workaround_brokenFBOReadBack = true; + else if (egl_version && strstr(egl_version, "1.4")) + d->workaround_brokenTexSubImage = true; } } } diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index b46d428..bf830ba 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -401,6 +401,7 @@ public: // workarounds for driver/hw bugs on different platforms uint workaround_needsFullClearOnEveryFrame : 1; uint workaround_brokenFBOReadBack : 1; + uint workaround_brokenTexSubImage : 1; uint workaroundsCached : 1; uint workaround_brokenTextureFromPixmap : 1; -- cgit v0.12 From ab8a9e77d877fd53eaec8dca1eeca619a4ba81d6 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Thu, 16 Dec 2010 12:57:06 +0200 Subject: Avoid duplicate resize event No need to have two resize events in queue for same widget, so do not post a new one if one is already pending in QSymbianControl::SizeChanged(). Reviewed-by: Sami Merila --- src/gui/kernel/qapplication_s60.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 6db1fa8..181fcc7 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -1174,8 +1174,10 @@ void QSymbianControl::SizeChanged() if (!slowResize && tlwExtra) tlwExtra->inTopLevelResize = false; } else { - QResizeEvent *e = new QResizeEvent(newSize, oldSize); - QApplication::postEvent(qwidget, e); + if (!qwidget->testAttribute(Qt::WA_PendingResizeEvent)) { + QResizeEvent *e = new QResizeEvent(newSize, oldSize); + QApplication::postEvent(qwidget, e); + } } } -- cgit v0.12 From f0347c8c0c37bd90dcaefb8f4b669096f7eb66b5 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Thu, 16 Dec 2010 15:23:51 +0200 Subject: Improved orientation change autotest The test wasn't even compiling anymore, so fixed that. Also added additional orientation change and an available geometry check after each orientation change. Reviewed-by: Sami Merila --- .../orientationchange/orientationchange.pro | 1 + .../orientationchange/tst_orientationchange.cpp | 43 ++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/tests/auto/symbian/orientationchange/orientationchange.pro b/tests/auto/symbian/orientationchange/orientationchange.pro index 08b34f9..98aa2ad 100644 --- a/tests/auto/symbian/orientationchange/orientationchange.pro +++ b/tests/auto/symbian/orientationchange/orientationchange.pro @@ -4,4 +4,5 @@ SOURCES += tst_orientationchange.cpp symbian { INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE + LIBS += -lcone -leikcore -lavkon # Screen orientation } diff --git a/tests/auto/symbian/orientationchange/tst_orientationchange.cpp b/tests/auto/symbian/orientationchange/tst_orientationchange.cpp index eb3709d..2ac2f7f 100644 --- a/tests/auto/symbian/orientationchange/tst_orientationchange.cpp +++ b/tests/auto/symbian/orientationchange/tst_orientationchange.cpp @@ -45,6 +45,8 @@ #include #include +#include +#include class tst_orientationchange : public QObject { @@ -151,6 +153,47 @@ void tst_orientationchange::resizeEventOnOrientationChange() } QCOMPARE(normalWidget->resizeEventCount, 0); + QDesktopWidget desktop; + QRect qtAvail = desktop.availableGeometry(normalWidget); + TRect clientRect = static_cast(CCoeEnv::Static()-> AppUi())->ClientRect(); + QRect symbianAvail = qt_TRect2QRect(clientRect); + QCOMPARE(qtAvail, symbianAvail); + + // Switch orientation back to original + orientation = orientation == CAknAppUi::EAppUiOrientationPortrait + ? CAknAppUi::EAppUiOrientationLandscape + : CAknAppUi::EAppUiOrientationPortrait; + + + fullScreenWidget->reset(); + maximizedWidget->reset(); + normalWidget->reset(); + + TRAP(err, appUi->SetOrientationL(orientation)); + + QCoreApplication::sendPostedEvents(); + QCoreApplication::sendPostedEvents(); + + // setOrientationL is not guaranteed to change orientation + // (if emulator configured to support just portrait or landscape, then + // setOrientationL call shouldn't do anything). + // So let's ensure that we do not get resize event twice. + + QVERIFY(fullScreenWidget->resizeEventCount <= 1); + if (fullScreenWidget->resizeEventCount) { + QCOMPARE(fullScreenWidget->size(), fullScreenWidget->resizeEventSize); + } + QVERIFY(maximizedWidget->resizeEventCount <= 1); + if (fullScreenWidget->resizeEventCount) { + QCOMPARE(maximizedWidget->size(), maximizedWidget->resizeEventSize); + } + QCOMPARE(normalWidget->resizeEventCount, 0); + + qtAvail = desktop.availableGeometry(normalWidget); + clientRect = static_cast(CCoeEnv::Static()-> AppUi())->ClientRect(); + symbianAvail = qt_TRect2QRect(clientRect); + QCOMPARE(qtAvail, symbianAvail); + TRAP(err, appUi->SetOrientationL(CAknAppUi::EAppUiOrientationUnspecified)); delete normalWidget; -- cgit v0.12 From 7857e0cf4673fb0defab5af9c60d0c2dea93e55c Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Wed, 15 Dec 2010 18:55:48 +0100 Subject: Doc: typo fixed in doc/src/declarative/extending.qdoc Reviewed-by: TrustMe --- doc/src/declarative/extending.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/declarative/extending.qdoc b/doc/src/declarative/extending.qdoc index e23ca91..748ec6c 100644 --- a/doc/src/declarative/extending.qdoc +++ b/doc/src/declarative/extending.qdoc @@ -461,7 +461,7 @@ constructing an animation object and manually setting the animation's "target" property, a property value source can be assigned directly to a property of any type and automatically set up this association. -The example shown here is rather contrived: the \c announcment property of the +The example shown here is rather contrived: the \c announcement property of the \c BirthdayParty object is a string that is printed every time it is assigned and the \c HappyBirthdaySong value source generates the lyrics of the song "Happy Birthday". -- cgit v0.12 From 632016368e26ba06d7d09740a8a1805f4ea911f1 Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Fri, 17 Dec 2010 15:24:30 +1000 Subject: Update test bitmaps for QDeclarativeImage::svg() autotest on Linux Task-number: Reviewed-by: Martin Jones --- .../declarative/qdeclarativeimage/data/heart.png | Bin 12424 -> 12577 bytes .../declarative/qdeclarativeimage/data/heart200.png | Bin 7943 -> 8063 bytes 2 files changed, 0 insertions(+), 0 deletions(-) diff --git a/tests/auto/declarative/qdeclarativeimage/data/heart.png b/tests/auto/declarative/qdeclarativeimage/data/heart.png index ff93f6c..abe97fe 100644 Binary files a/tests/auto/declarative/qdeclarativeimage/data/heart.png and b/tests/auto/declarative/qdeclarativeimage/data/heart.png differ diff --git a/tests/auto/declarative/qdeclarativeimage/data/heart200.png b/tests/auto/declarative/qdeclarativeimage/data/heart200.png index 5a31ae8..7fbb13c 100644 Binary files a/tests/auto/declarative/qdeclarativeimage/data/heart200.png and b/tests/auto/declarative/qdeclarativeimage/data/heart200.png differ -- cgit v0.12 From e0abcb2ff7a3044305580659f9a432a9630a5943 Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Fri, 17 Dec 2010 16:18:03 +1000 Subject: Fix QDeclarativeState::reset() autotest Current state reset mechanism does not really work for Text elements as the keeping implicit correct would require relayouting of text twice (See bug QTBUG-15118). Changed QDeclarativeState reset autotest to use Image element instead of Text element until the issue has been fixed. Task-number: Reviewed-by: Yann Bodson --- tests/auto/declarative/qdeclarativestates/data/image.png | Bin 0 -> 173 bytes tests/auto/declarative/qdeclarativestates/data/reset.qml | 9 ++++----- .../qdeclarativestates/tst_qdeclarativestates.cpp | 13 ++++++------- 3 files changed, 10 insertions(+), 12 deletions(-) create mode 100644 tests/auto/declarative/qdeclarativestates/data/image.png diff --git a/tests/auto/declarative/qdeclarativestates/data/image.png b/tests/auto/declarative/qdeclarativestates/data/image.png new file mode 100644 index 0000000..ed1833c Binary files /dev/null and b/tests/auto/declarative/qdeclarativestates/data/image.png differ diff --git a/tests/auto/declarative/qdeclarativestates/data/reset.qml b/tests/auto/declarative/qdeclarativestates/data/reset.qml index 8799c97..a140ffa 100644 --- a/tests/auto/declarative/qdeclarativestates/data/reset.qml +++ b/tests/auto/declarative/qdeclarativestates/data/reset.qml @@ -3,17 +3,16 @@ import QtQuick 1.0 Rectangle { width: 640 height: 480 - Text { - id: theText + Image { + id: image width: 40 - wrapMode: Text.WordWrap - text: "a text string that is longer than 40 pixels" + source: "image.png" } states: State { name: "state1" PropertyChanges { - target: theText + target: image width: undefined } } diff --git a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp index b8409a5..870842c 100644 --- a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp +++ b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp @@ -44,7 +44,6 @@ #include #include #include -#include #include #include #include @@ -1126,15 +1125,15 @@ void tst_qdeclarativestates::reset() QDeclarativeRectangle *rect = qobject_cast(c.create()); QVERIFY(rect != 0); - QDeclarativeText *text = rect->findChild(); - QVERIFY(text != 0); - QCOMPARE(text->width(), qreal(40.)); - QVERIFY(text->width() < text->height()); + QDeclarativeImage *image = rect->findChild(); + QVERIFY(image != 0); + QCOMPARE(image->width(), qreal(40.)); + QCOMPARE(image->height(), qreal(20.)); QDeclarativeItemPrivate::get(rect)->setState("state1"); - QVERIFY(text->width() > 41); - QVERIFY(text->width() > text->height()); + QCOMPARE(image->width(), 20.0); + QCOMPARE(image->height(), qreal(20.)); } void tst_qdeclarativestates::illegalObjectCreation() -- cgit v0.12 From 80eb3ebbfe24738163532494e8866ac20fd1b0e4 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Thu, 16 Dec 2010 16:03:13 +0200 Subject: Fix incorrect file name case for OpenGL libraries in symbian.conf. To support linux builds, file names must be cased correctly. Task-number: QT-4375 Reviewed-by: Miikka Heikkinen --- mkspecs/common/symbian/symbian.conf | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mkspecs/common/symbian/symbian.conf b/mkspecs/common/symbian/symbian.conf index 707335c..00cf0d7 100644 --- a/mkspecs/common/symbian/symbian.conf +++ b/mkspecs/common/symbian/symbian.conf @@ -70,12 +70,12 @@ QMAKE_LIBS_CORE = $$QMAKE_LIBS -lefsrv -lhal -lbafl QMAKE_LIBS_GUI = $$QMAKE_LIBS_CORE -lfbscli -lbitgdi -lgdi -lws32 -lapgrfx -lcone -leikcore -lmediaclientaudio -lapparc -lcentralrepository QMAKE_LIBS_NETWORK = QMAKE_LIBS_EGL = -llibEGL -QMAKE_LIBS_OPENGL = -llibglesv2 +QMAKE_LIBS_OPENGL = -llibGLESv2 QMAKE_LIBS_OPENGL_ES1 = -llibGLESv1_CM -QMAKE_LIBS_OPENGL_ES2 = -llibglesv2 -QMAKE_LIBS_OPENGL_QT = -llibglesv2 -lcone -lws32 +QMAKE_LIBS_OPENGL_ES2 = -llibGLESv2 +QMAKE_LIBS_OPENGL_QT = -llibGLESv2 -lcone -lws32 QMAKE_LIBS_OPENGL_ES1_QT = -llibGLESv1_CM -lcone -lws32 -QMAKE_LIBS_OPENGL_ES2_QT = -llibglesv2 -lcone -lws32 +QMAKE_LIBS_OPENGL_ES2_QT = -llibGLESv2 -lcone -lws32 QMAKE_LIBS_OPENVG = -llibOpenVG -lfbscli -lbitgdi -lgdi QMAKE_LIBS_THREAD = -llibpthread QMAKE_LIBS_COMPAT = -- cgit v0.12 From d238b0ba236da4c3c33c0707d8dd6f5e5903d6c0 Mon Sep 17 00:00:00 2001 From: Ville Pernu Date: Fri, 17 Dec 2010 11:08:53 +0200 Subject: Fix waitForOpened not working with already active configuration When an active QNetworkConfiguration is already in use (e.g. browser already open), the QNetworkSession::waitForOpened() did not work properly. Changed one if-statement in the function to adapt to the scenario. Reviewed-by: Perttu Pohjonen Task-number: QTBUG-565 --- src/network/bearer/qnetworksession.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/network/bearer/qnetworksession.cpp b/src/network/bearer/qnetworksession.cpp index 226c3c5..db1a37c 100644 --- a/src/network/bearer/qnetworksession.cpp +++ b/src/network/bearer/qnetworksession.cpp @@ -310,8 +310,9 @@ bool QNetworkSession::waitForOpened(int msecs) if (d->isOpen) return true; - if (d->state != Connecting) + if (!(d->state == Connecting || d->state == Connected)) { return false; + } QEventLoop* loop = new QEventLoop(this); QObject::connect(d, SIGNAL(quitPendingWaitsForOpened()), -- cgit v0.12 From b54efea2e97baac1d9442e829be2d6fb322c5085 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Fri, 17 Dec 2010 11:37:52 +0200 Subject: Use relative include instead of absolute in default qmake.conf Absolute include path breaks QtP releases which copy mkspecs under epoc32 and do not necessarily have the sources available in the original absolute path and can't patch the paths either at installation time. Task-number: QTBUG-16172 Reviewed-by: Oswald Buddenhagen --- tools/configure/configureapp.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index c967dad..915a56d 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -3267,8 +3267,14 @@ void Configure::generateConfigfiles() if (qmakeConfFile.open(QFile::WriteOnly | QFile::Text)) { QTextStream qmakeConfStream; qmakeConfStream.setDevice(&qmakeConfFile); + // While QMAKESPEC_ORIGINAL being relative or absolute doesn't matter for the + // primary use of this variable by qmake to identify the original mkspec, the + // variable is also used for few special cases where the absolute path is required. + // Conversely, the include of the original qmake.conf must be done using relative path, + // as some Qt binary deployments are done in a manner that doesn't allow for patching + // the paths at the installation time. qmakeConfStream << "QMAKESPEC_ORIGINAL=" << pltSpec << endl << endl; - qmakeConfStream << "include(" << pltSpec << "/qmake.conf)" << endl; + qmakeConfStream << "include(" << "../" << spec << "/qmake.conf)" << endl << endl; qmakeConfStream.flush(); qmakeConfFile.close(); } -- cgit v0.12 From d491aee7887331e6b1207e647f4d2ee3f43efacd Mon Sep 17 00:00:00 2001 From: Jerome Pasion Date: Mon, 20 Dec 2010 10:41:18 +0100 Subject: Added BSD license to snippet code. --- doc/src/snippets/declarative/focus/focusColumn.qml | 39 ++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/doc/src/snippets/declarative/focus/focusColumn.qml b/doc/src/snippets/declarative/focus/focusColumn.qml index eb59309..9b761dd 100644 --- a/doc/src/snippets/declarative/focus/focusColumn.qml +++ b/doc/src/snippets/declarative/focus/focusColumn.qml @@ -1,3 +1,42 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the FOO module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ import QtQuick 1.0 Rectangle { -- cgit v0.12