diff options
Diffstat (limited to 'tools/qdoc3')
-rw-r--r-- | tools/qdoc3/atom.cpp | 6 | ||||
-rw-r--r-- | tools/qdoc3/atom.h | 4 | ||||
-rw-r--r-- | tools/qdoc3/codeparser.cpp | 41 | ||||
-rw-r--r-- | tools/qdoc3/cppcodeparser.cpp | 12 | ||||
-rw-r--r-- | tools/qdoc3/doc.cpp | 256 | ||||
-rw-r--r-- | tools/qdoc3/generator.cpp | 362 | ||||
-rw-r--r-- | tools/qdoc3/generator.h | 95 | ||||
-rw-r--r-- | tools/qdoc3/htmlgenerator.cpp | 166 | ||||
-rw-r--r-- | tools/qdoc3/pagegenerator.cpp | 4 | ||||
-rw-r--r-- | tools/qdoc3/test/classic.css | 8 | ||||
-rw-r--r-- | tools/qdoc3/test/macros.qdocconf | 2 | ||||
-rw-r--r-- | tools/qdoc3/test/qt-api-only.qdocconf | 2 | ||||
-rw-r--r-- | tools/qdoc3/test/qt-build-docs.qdocconf | 6 | ||||
-rw-r--r-- | tools/qdoc3/test/qt.qdocconf | 2 |
14 files changed, 617 insertions, 349 deletions
diff --git a/tools/qdoc3/atom.cpp b/tools/qdoc3/atom.cpp index a764653..f341862 100644 --- a/tools/qdoc3/atom.cpp +++ b/tools/qdoc3/atom.cpp @@ -106,6 +106,7 @@ QString Atom::UPPERROMAN_ ("upperroman"); \value CodeOld \value CodeQuoteArgument \value CodeQuoteCommand + \value EndQmlText \value FormatElse \value FormatEndif \value FormatIf @@ -131,6 +132,7 @@ QString Atom::UPPERROMAN_ ("upperroman"); \value ParaLeft \value ParaRight \value Qml + \value QmlText \value QuotationLeft \value QuotationRight \value RawString @@ -174,6 +176,9 @@ static const struct { { "CodeOld", Atom::CodeOld }, { "CodeQuoteArgument", Atom::CodeQuoteArgument }, { "CodeQuoteCommand", Atom::CodeQuoteCommand }, +#ifdef QDOC_QML + { "EndQmlText", Atom::EndQmlText }, +#endif { "FootnoteLeft", Atom::FootnoteLeft }, { "FootnoteRight", Atom::FootnoteRight }, { "FormatElse", Atom::FormatElse }, @@ -202,6 +207,7 @@ static const struct { { "ParaRight", Atom::ParaRight }, #ifdef QDOC_QML { "Qml", Atom::Qml}, + { "QmlText", Atom::QmlText }, #endif { "QuotationLeft", Atom::QuotationLeft }, { "QuotationRight", Atom::QuotationRight }, diff --git a/tools/qdoc3/atom.h b/tools/qdoc3/atom.h index 0d2a924..178d9ed 100644 --- a/tools/qdoc3/atom.h +++ b/tools/qdoc3/atom.h @@ -71,6 +71,9 @@ class Atom CodeOld, CodeQuoteArgument, CodeQuoteCommand, +#ifdef QDOC_QML + EndQmlText, +#endif FootnoteLeft, FootnoteRight, FormatElse, @@ -99,6 +102,7 @@ class Atom ParaRight, #ifdef QDOC_QML Qml, + QmlText, #endif QuotationLeft, QuotationRight, diff --git a/tools/qdoc3/codeparser.cpp b/tools/qdoc3/codeparser.cpp index 63b6865..9a58bc6 100644 --- a/tools/qdoc3/codeparser.cpp +++ b/tools/qdoc3/codeparser.cpp @@ -177,6 +177,11 @@ QSet<QString> CodeParser::commonMetaCommands() << COMMAND_TITLE; } +/*! + The topic command has been processed. Now process the other + metacommands that were found. These are not the text markup + commands. + */ void CodeParser::processCommonMetaCommand(const Location &location, const QString &command, const QString &arg, @@ -185,31 +190,43 @@ void CodeParser::processCommonMetaCommand(const Location &location, { if (command == COMMAND_COMPAT) { node->setStatus(Node::Compat); - } else if (command == COMMAND_DEPRECATED) { + } + else if (command == COMMAND_DEPRECATED) { node->setStatus(Node::Deprecated); - } else if (command == COMMAND_INGROUP) { + } + else if (command == COMMAND_INGROUP) { tree->addToGroup(node, arg); - } else if (command == COMMAND_INPUBLICGROUP) { + } + else if (command == COMMAND_INPUBLICGROUP) { tree->addToPublicGroup(node, arg); - } else if (command == COMMAND_INMODULE) { + } + else if (command == COMMAND_INMODULE) { node->setModuleName(arg); - } else if (command == COMMAND_MAINCLASS) { + } + else if (command == COMMAND_MAINCLASS) { node->setStatus(Node::Main); - } else if (command == COMMAND_OBSOLETE) { + } + else if (command == COMMAND_OBSOLETE) { if (node->status() != Node::Compat) node->setStatus(Node::Obsolete); - } else if (command == COMMAND_NONREENTRANT) { + } + else if (command == COMMAND_NONREENTRANT) { node->setThreadSafeness(Node::NonReentrant); - } else if (command == COMMAND_PRELIMINARY) { + } + else if (command == COMMAND_PRELIMINARY) { node->setStatus(Node::Preliminary); - } else if (command == COMMAND_INTERNAL) { + } + else if (command == COMMAND_INTERNAL) { node->setAccess(Node::Private); node->setStatus(Node::Internal); - } else if (command == COMMAND_REENTRANT) { + } + else if (command == COMMAND_REENTRANT) { node->setThreadSafeness(Node::Reentrant); - } else if (command == COMMAND_SINCE) { + } + else if (command == COMMAND_SINCE) { node->setSince(arg); - } else if (command == COMMAND_SUBTITLE) { + } + else if (command == COMMAND_SUBTITLE) { if (node->type() == Node::Fake) { FakeNode *fake = static_cast<FakeNode *>(node); fake->setSubTitle(arg); diff --git a/tools/qdoc3/cppcodeparser.cpp b/tools/qdoc3/cppcodeparser.cpp index fcf77f5..1ad5843 100644 --- a/tools/qdoc3/cppcodeparser.cpp +++ b/tools/qdoc3/cppcodeparser.cpp @@ -672,11 +672,13 @@ Node *CppCodeParser::processTopicCommand(const Doc& doc, else if (command == COMMAND_QMLCLASS) { const ClassNode* classNode = 0; QStringList names = arg.split(" "); - qDebug() << "QMLCLASS" << names; - Node* n = tre->findNode(names[1].split("::"),Node::Class); - if (n) { - classNode = static_cast<const ClassNode*>(n); - qDebug() << "FOUND IT!" << classNode->name(); + //qDebug() << "QMLCLASS" << names; + if (names.size() > 1) { + Node* n = tre->findNode(names[1].split("::"),Node::Class); + if (n) { + classNode = static_cast<const ClassNode*>(n); + //qDebug() << "FOUND IT!" << classNode->name(); + } } return new QmlNode(tre->root(), names[0], classNode); } diff --git a/tools/qdoc3/doc.cpp b/tools/qdoc3/doc.cpp index 1d3a7d4..61d0ed6 100644 --- a/tools/qdoc3/doc.cpp +++ b/tools/qdoc3/doc.cpp @@ -311,7 +311,8 @@ bool DocPrivate::isEnumDocSimplifiable() const while (atom) { if (atom->type() == Atom::AutoLink || atom->type() == Atom::String) { justMetColon = atom->string().endsWith(":"); - } else if ((atom->type() == Atom::ListLeft) && + } + else if ((atom->type() == Atom::ListLeft) && (atom->string() == ATOM_LIST_VALUE)) { if (justMetColon || numValueTables > 0) return false; @@ -478,7 +479,8 @@ void DocParser::parse(const QString& source, if (ch.isLetterOrNumber()) { cmdStr += ch; pos++; - } else { + } + else { break; } } @@ -488,7 +490,8 @@ void DocParser::parse(const QString& source, if (in.at(pos).isSpace()) { skipAllSpaces(); appendChar(QLatin1Char(' ')); - } else { + } + else { appendChar(in.at(pos++)); } } @@ -570,6 +573,9 @@ void DocParser::parse(const QString& source, leavePara(); append(Atom::Qml, getCode(CMD_QML, marker)); break; + case CMD_QMLTEXT: + append(Atom::QmlText); + break; #endif case CMD_CODELINE: { @@ -579,7 +585,7 @@ void DocParser::parse(const QString& source, && priv->text.lastAtom()->string().endsWith("\n\n")) priv->text.lastAtom()->chopString(); appendToCode("\n"); - } else { + } lse { append(Atom::CodeQuoteCommand, cmdStr); append(Atom::CodeQuoteArgument, " "); } @@ -589,7 +595,8 @@ void DocParser::parse(const QString& source, && priv->text.lastAtom()->string().endsWith("\n\n")) priv->text.lastAtom()->chopString(); appendToCode("\n"); - } else { + } + else { append(Atom::CodeQuoteCommand, cmdStr); append(Atom::CodeQuoteArgument, " "); } @@ -651,14 +658,16 @@ void DocParser::parse(const QString& source, if (preprocessorSkipping.size() > 0) { if (preprocessorSkipping.top()) { --numPreprocessorSkipping; - } else { + } + else { ++numPreprocessorSkipping; } preprocessorSkipping.top() = !preprocessorSkipping.top(); (void)getRestOfLine(); // ### should ensure that it's empty if (numPreprocessorSkipping) skipToNextPreprocessorCommand(); - } else { + } + else { location().warning(tr("Unexpected '\\%1'").arg(cmdName(CMD_ELSE))); } break; @@ -678,6 +687,9 @@ void DocParser::parse(const QString& source, case CMD_ENDQML: closeCommand(cmd); break; + case CMD_ENDQMLTEXT: + append(Atom::EndQmlText); + break; #endif case CMD_ENDFOOTNOTE: if (closeCommand(cmd)) { @@ -693,7 +705,8 @@ void DocParser::parse(const QString& source, (void)getRestOfLine(); // ### should ensure that it's empty if (numPreprocessorSkipping) skipToNextPreprocessorCommand(); - } else { + } + else { location().warning(tr("Unexpected '\\%1'").arg(cmdName(CMD_ENDIF))); } break; @@ -784,12 +797,14 @@ void DocParser::parse(const QString& source, leaveTableRow(); append(Atom::TableHeaderLeft); inTableHeader = true; - } else { + } + else { if (openedCommands.contains(CMD_TABLE)) { location().warning(tr("Cannot use '\\%1' within '\\%2'") .arg(cmdName(CMD_HEADER)) .arg(cmdName(openedCommands.top()))); - } else { + } + else { location().warning(tr("Cannot use '\\%1' outside of '\\%2'") .arg(cmdName(CMD_HEADER)) .arg(cmdName(CMD_TABLE))); @@ -824,7 +839,8 @@ void DocParser::parse(const QString& source, if (paraState == OutsidePara) { enterPara(); indexStartedPara = true; - } else { + } + else { const Atom *last = priv->text.lastAtom(); if (indexStartedPara && (last->type() != Atom::FormattingRight || @@ -844,12 +860,14 @@ void DocParser::parse(const QString& source, if (isLeftBraceAhead()) { currentLinkAtom = priv->text.lastAtom(); startFormat(ATOM_FORMATTING_LINK, cmd); - } else { + } + else { append(Atom::FormattingLeft, ATOM_FORMATTING_LINK); append(Atom::String, cleanLink(x)); append(Atom::FormattingRight, ATOM_FORMATTING_LINK); } - } else { + } + else { x = getArgument(); append(Atom::Link, x); append(Atom::FormattingLeft, ATOM_FORMATTING_LINK); @@ -893,7 +911,8 @@ void DocParser::parse(const QString& source, if (openedLists.top().isStarted()) { append(Atom::ListItemRight, openedLists.top().styleString()); - } else { + } + else { append(Atom::ListLeft, openedLists.top().styleString()); } @@ -903,7 +922,8 @@ void DocParser::parse(const QString& source, append(Atom::ListItemLeft, openedLists.top().styleString()); enterPara(); - } else if (openedCommands.top() == CMD_TABLE) { + } + else if (openedCommands.top() == CMD_TABLE) { x = "1,1"; if (isLeftBraceAhead()) x = getArgument(); @@ -915,14 +935,16 @@ void DocParser::parse(const QString& source, .arg(cmdName(CMD_O))); append(Atom::TableRowLeft); inTableRow = true; - } else if (inTableItem) { + } + else if (inTableItem) { append(Atom::TableItemRight); inTableItem = false; } append(Atom::TableItemLeft, x); inTableItem = true; - } else { + } + else { location().warning(tr("Command '\\%1' outside of '\\%2' and '\\%3'") .arg(cmdName(cmd)) .arg(cmdName(CMD_LIST)) @@ -1003,7 +1025,8 @@ void DocParser::parse(const QString& source, append(Atom::Code, quoter.quoteTo(location(), cmdStr, "")); quoter.reset(); - } else { + } + else { append(Atom::CodeQuoteCommand, cmdStr); append(Atom::CodeQuoteArgument, fileName); } @@ -1029,7 +1052,8 @@ void DocParser::parse(const QString& source, quoter.quoteUntil(location(), cmdStr, slashed(marker->functionEndRegExp(x)))); quoter.reset(); - } else { + } + else { append(Atom::CodeQuoteCommand, cmdStr); append(Atom::CodeQuoteArgument, slashed(marker->functionEndRegExp(x))); } @@ -1050,12 +1074,14 @@ void DocParser::parse(const QString& source, leaveTableRow(); append(Atom::TableRowLeft); inTableRow = true; - } else { + } + else { if (openedCommands.contains(CMD_TABLE)) { location().warning(tr("Cannot use '\\%1' within '\\%2'") .arg(cmdName(CMD_ROW)) .arg(cmdName(openedCommands.top()))); - } else { + } + else { location().warning(tr("Cannot use '\\%1' outside of '\\%2'") .arg(cmdName(CMD_ROW)) .arg(cmdName(CMD_TABLE))); @@ -1126,7 +1152,8 @@ void DocParser::parse(const QString& source, append(Atom::SnippetCommand, cmdStr); append(Atom::SnippetLocation, snippet); append(Atom::SnippetIdentifier, identifier); - } else { + } + else { Doc::quoteFromFile(location(),quoter,snippet); appendToCode(quoter.quoteSnippet(location(), identifier)); @@ -1136,7 +1163,8 @@ void DocParser::parse(const QString& source, append(Atom::SnippetCommand, cmdStr); append(Atom::SnippetLocation, snippet); append(Atom::SnippetIdentifier, identifier); - } else { + } + else { Doc::quoteFromFile(location(),quoter,snippet); appendToCode(quoter.quoteSnippet(location(), identifier)); @@ -1189,7 +1217,8 @@ void DocParser::parse(const QString& source, location().warning(tr("Invalid Unicode character '%1' specified " "with '%2'") .arg(x, cmdName(CMD_UNICODE))); - } else { + } + else { append(Atom::String, QChar(unicodeChar)); } } @@ -1210,7 +1239,8 @@ void DocParser::parse(const QString& source, skipSpacesOrOneEndl(); if (isBlankLine()) append(Atom::Nop); - } else { + } + else { // ### problems } break; @@ -1349,7 +1379,8 @@ void DocParser::parse(const QString& source, if (ch.isSpace()) { ++pos; newWord = false; - } else { + } + else { enterPara(); newWord = true; } @@ -1461,7 +1492,8 @@ void DocParser::parse(const QString& source, if (openedCommands.top() != CMD_OMIT) { location().warning(tr("Missing '\\%1'").arg(endCmdName(openedCommands.top()))); - } else if (preprocessorSkipping.count() > 0) { + } + else if (preprocessorSkipping.count() > 0) { location().warning(tr("Missing '\\%1'").arg(cmdName(CMD_ENDIF))); } @@ -1526,16 +1558,20 @@ void DocParser::checkExpiry(const QString& date) int days = expiryDate.daysTo(QDate::currentDate()); if (days == 0) { location().warning(tr("Documentation expires today")); - } else if (days == 1) { + } + else if (days == 1) { location().warning(tr("Documentation expired yesterday")); - } else if (days >= 2) { + } + else if (days >= 2) { location().warning(tr("Documentation expired %1 days ago") .arg(days)); } - } else { + } + else { location().warning(tr("Date '%1' invalid").arg(date)); } - } else { + } + else { location().warning(tr("Date '%1' not in YYYY-MM-DD format") .arg(date)); } @@ -1546,7 +1582,8 @@ void DocParser::insertBaseName(const QString &baseName) priv->constructExtra(); if (currentSectioningUnit == priv->extra->sectioningUnit) { priv->extra->baseName = baseName; - } else { + } + else { Atom *atom = priv->text.firstAtom(); Atom *sectionLeft = 0; @@ -1568,7 +1605,8 @@ 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)")); - } else { + } + else { targetMap.insert(target, location()); append(Atom::Target, target); priv->constructExtra(); @@ -1594,12 +1632,14 @@ void DocParser::include(const QString& fileName) userFriendlyFilePath); if (filePath.isEmpty()) { location().warning(tr("Cannot find leaf file '%1'").arg(fileName)); - } else { + } + else { QFile inFile(filePath); if (!inFile.open(QFile::ReadOnly)) { location().warning(tr("Cannot open leaf file '%1'") .arg(userFriendlyFilePath)); - } else { + } + else { location().push(userFriendlyFilePath); QTextStream inStream(&inFile); @@ -1634,7 +1674,8 @@ void DocParser::startFormat(const QString& format, int cmd) pendingFormats.insert(braceDepth, format); ++braceDepth; ++pos; - } else { + } + else { append(Atom::String, getArgument()); append(Atom::FormattingRight, format); if (format == ATOM_FORMATTING_INDEX && indexStartedPara) { @@ -1652,28 +1693,34 @@ bool DocParser::openCommand(int cmd) if (cmd != CMD_LINK) { if (outer == CMD_LIST) { ok = (cmd == CMD_FOOTNOTE || cmd == CMD_LIST); - } else if (outer == CMD_ABSTRACT) { + } + else if (outer == CMD_ABSTRACT) { ok = (cmd == CMD_LIST || cmd == CMD_QUOTATION || cmd == CMD_TABLE); - } else if (outer == CMD_SIDEBAR) { + } + else if (outer == CMD_SIDEBAR) { ok = (cmd == CMD_LIST || cmd == CMD_QUOTATION || cmd == CMD_SIDEBAR); - } else if (outer == CMD_QUOTATION) { + } + else if (outer == CMD_QUOTATION) { ok = (cmd == CMD_LIST); - } else if (outer == CMD_TABLE) { + } + else if (outer == CMD_TABLE) { ok = (cmd == CMD_LIST || cmd == CMD_FOOTNOTE || cmd == CMD_QUOTATION); - } else if (outer == CMD_FOOTNOTE || outer == CMD_LINK) { + } + else if (outer == CMD_FOOTNOTE || outer == CMD_LINK) { ok = false; } } if (ok) { openedCommands.push(cmd); - } else { + } + else { location().warning(tr("Cannot use '\\%1' within '\\%2'") .arg(cmdName(cmd)).arg(cmdName(outer))); } @@ -1685,7 +1732,8 @@ bool DocParser::closeCommand(int endCmd) if (endCmdFor(openedCommands.top()) == endCmd && openedCommands.size() > 1) { openedCommands.pop(); return true; - } else { + } + else { bool contains = false; QStack<int> opened2 = openedCommands; while (opened2.size() > 1) { @@ -1703,7 +1751,8 @@ bool DocParser::closeCommand(int endCmd) .arg(cmdName(endCmd))); openedCommands.pop(); } - } else { + } + else { location().warning(tr("Unexpected '\\%1'") .arg(cmdName(endCmd))); } @@ -1728,10 +1777,12 @@ void DocParser::startSection(Doc::SectioningUnit unit, int cmd) if (unit <= priv->extra->sectioningUnit) { location().warning(tr("Unexpected '\\%1' in this documentation") .arg(cmdName(cmd))); - } else if (unit - currentSectioningUnit > 1) { + } + else if (unit - currentSectioningUnit > 1) { location().warning(tr("Unexpected '\\%1' at this point") .arg(cmdName(cmd))); - } else { + } + else { if (currentSectioningUnit >= unit) endSection(unit, cmd); @@ -1754,10 +1805,12 @@ void DocParser::endSection(int unit, int endCmd) if (unit < priv->extra->sectioningUnit) { location().warning(tr("Unexpected '\\%1' in this documentation") .arg(cmdName(endCmd))); - } else if (unit > currentSectioningUnit) { + } + else if (unit > currentSectioningUnit) { location().warning(tr("Unexpected '\\%1' at this point") .arg(cmdName(endCmd))); - } else { + } + else { while (currentSectioningUnit >= unit) { int delta = currentSectioningUnit - priv->extra->sectioningUnit; append(Atom::SectionRight, QString::number(delta)); @@ -1895,7 +1948,8 @@ void DocParser::enterPara(Atom::Type leftType, #endif leftType == Atom::SectionHeadingLeft) { paraState = InsideSingleLinePara; - } else { + } + else { paraState = InsideMultiLinePara; } skipSpacesOrOneEndl(); @@ -1912,7 +1966,8 @@ void DocParser::leavePara() if (priv->text.lastAtom()->type() == pendingParaLeftType) { priv->text.stripLastAtom(); - } else { + } + else { if (priv->text.lastAtom()->type() == Atom::String && priv->text.lastAtom()->string().endsWith(" ")) { priv->text.lastAtom()->chopString(); @@ -1932,7 +1987,8 @@ void DocParser::leaveValue() if (openedLists.isEmpty()) { openedLists.push(OpenedList(OpenedList::Value)); append(Atom::ListLeft, ATOM_LIST_VALUE); - } else { + } + else { if (priv->text.lastAtom()->type() == Atom::Nop) priv->text.stripLastAtom(); append(Atom::ListItemRight, ATOM_LIST_VALUE); @@ -1980,14 +2036,16 @@ void DocParser::expandMacro(const QString &name, { if (numParams == 0) { append(Atom::RawString, def); - } else { + } + else { QStringList args; QString rawString; for (int i = 0; i < numParams; i++) { if (numParams == 1 || isLeftBraceAhead()) { args << getArgument(true); - } else { + } + else { location().warning(tr("Macro '\\%1' invoked with too few" " arguments (expected %2, got %3)") .arg(name).arg(numParams).arg(i)); @@ -2007,7 +2065,8 @@ void DocParser::expandMacro(const QString &name, } append(Atom::String, args[paramNo - 1]); j += 2; - } else { + } + else { rawString += def[j++]; } } @@ -2022,19 +2081,26 @@ Doc::SectioningUnit DocParser::getSectioningUnit() if (name == "part") { return Doc::Part; - } else if (name == "chapter") { + } + else if (name == "chapter") { return Doc::Chapter; - } else if (name == "section1") { + } + else if (name == "section1") { return Doc::Section1; - } else if (name == "section2") { + } + else if (name == "section2") { return Doc::Section2; - } else if (name == "section3") { + } + else if (name == "section3") { return Doc::Section3; - } else if (name == "section4") { + } + else if (name == "section4") { return Doc::Section4; - } else if (name.isEmpty()) { + } + else if (name.isEmpty()) { return Doc::Section4; - } else { + } + else { location().warning(tr("Invalid sectioning unit '%1'").arg(name)); return Doc::Book; } @@ -2081,7 +2147,8 @@ QString DocParser::getArgument(bool verbatim) if (verbatim) { arg += in[pos]; pos++; - } else { + } + else { pos++; if (pos < (int) in.length()) { if (in[pos].isLetterOrNumber()) @@ -2089,7 +2156,8 @@ QString DocParser::getArgument(bool verbatim) arg += in[pos]; if (in[pos].isSpace()) { skipAllSpaces(); - } else { + } + else { pos++; } } @@ -2102,7 +2170,8 @@ QString DocParser::getArgument(bool verbatim) } if (delimDepth > 0) location().warning(tr("Missing '}'")); - } else { + } + else { while (pos < in.length() && ((delimDepth > 0) || ((delimDepth == 0) && @@ -2128,7 +2197,8 @@ QString DocParser::getArgument(bool verbatim) if (verbatim) { arg += in[pos]; pos++; - } else { + } + else { pos++; if (pos < (int) in.length()) { if (in[pos].isLetterOrNumber()) @@ -2136,7 +2206,8 @@ QString DocParser::getArgument(bool verbatim) arg += in[pos]; if (in[pos].isSpace()) { skipAllSpaces(); - } else { + } + else { pos++; } } @@ -2167,7 +2238,8 @@ QString DocParser::getOptionalArgument() if (pos + 1 < (int) in.length() && in[pos] == '\\' && in[pos + 1].isLetterOrNumber()) { return ""; - } else { + } + else { return getArgument(); } } @@ -2191,7 +2263,8 @@ QString DocParser::getRestOfLine() in[pos].isSpace() && (in[pos] != '\n')) ++pos; - } else { + } + else { trailingSlash = false; ++pos; } @@ -2252,7 +2325,8 @@ QString DocParser::getUntilEnd(int cmd) if (end == -1) { location().warning(tr("Missing '\\%1'").arg(cmdName(endCmd))); pos = in.length(); - } else { + } + else { t = in.mid(pos, end - pos); pos = end + rx.matchedLength(); } @@ -2327,7 +2401,8 @@ void DocParser::skipSpacesOrOneEndl() if (ch == '\n') { if (firstEndl == -1) { firstEndl = pos; - } else { + } + else { pos = firstEndl; break; } @@ -2369,6 +2444,8 @@ int DocParser::endCmdFor(int cmd) #ifdef QDOC_QML case CMD_QML: return CMD_ENDQML; + case CMD_QMLTEXT: + return CMD_ENDQMLTEXT; #endif case CMD_FOOTNOTE: return CMD_ENDFOOTNOTE; @@ -2459,7 +2536,8 @@ int DocParser::indentLevel(const QString& str) for (int i = 0; i < (int) str.length(); i++) { if (str[i] == '\n') { column = 0; - } else { + } + else { if (str[i] != ' ' && column < minIndent) minIndent = column; column++; @@ -2480,7 +2558,8 @@ QString DocParser::unindent(int level, const QString& str) if (str[i] == QLatin1Char('\n')) { t += '\n'; column = 0; - } else { + } + else { if (column >= level) t += str[i]; column++; @@ -2615,7 +2694,8 @@ void Doc::simplifyEnumDoc() atom = atom->next(); if (atom) atom = atom->next(); - } else { + } + else { newText << *atom; atom = atom->next(); } @@ -2730,7 +2810,8 @@ Text Doc::trimmedBriefText(const QString &className) const tr("Nonstandard wording in '\\%1' text for '%2' (expected more text)") .arg(COMMAND_BRIEF).arg(className)); standardWording = false; - } else + } + else whats[0] = whats[0].toUpper(); // ### move this once \brief is abolished for properties @@ -2753,7 +2834,8 @@ const QString& Doc::baseName() const static QString null; if (priv == 0 || priv->extra == 0) { return null; - } else { + } + else { return priv->extra->baseName; } } @@ -2762,7 +2844,8 @@ Doc::SectioningUnit Doc::granularity() const { if (priv == 0 || priv->extra == 0) { return DocPrivateExtra().granularity; - } else { + } + else { return priv->extra->granularity; } } @@ -2772,7 +2855,8 @@ Doc::SectioningUnit Doc::sectioningUnit() const { if (priv == 0 || priv->extra == 0) { return DocPrivateExtra().sectioningUnit; - } else { + } + else { return priv->extra->sectioningUnit; } } @@ -2873,7 +2957,8 @@ void Doc::initialize(const Config& config) .arg(alias) .arg(reverseAliasMap[alias]) .arg(*c)); - } else { + } + else { reverseAliasMap.insert(alias, *c); } aliasMap()->insert(*c, alias); @@ -2912,7 +2997,8 @@ void Doc::initialize(const Config& config) int m = Config::numParams(macro.defaultDef); if (macro.numParams == -1) { macro.numParams = m; - } else if (macro.numParams != m) { + } + else if (macro.numParams != m) { if (!silent) { QString other = tr("default"); if (macro.defaultDef.isEmpty()) @@ -3016,11 +3102,13 @@ CodeMarker *Doc::quoteFromFile(const Location &location, fileName, userFriendlyFilePath); if (filePath.isEmpty()) { location.warning(tr("Cannot find example file '%1'").arg(fileName)); - } else { + } + else { QFile inFile(filePath); if (!inFile.open(QFile::ReadOnly)) { location.warning(tr("Cannot open example file '%1'").arg(userFriendlyFilePath)); - } else { + } + else { QTextStream inStream(&inFile); code = DocParser::untabifyEtc(inStream.readAll()); } @@ -3061,11 +3149,13 @@ QString Doc::canonicalTitle(const QString &title) begun = true; slurping = false; lastAlnum = result.size(); - } else if (!slurping) { + } + else if (!slurping) { if (begun) result += QLatin1Char('-'); slurping = true; - } else { + } + else { // !alnum && slurping -> nothin } } diff --git a/tools/qdoc3/generator.cpp b/tools/qdoc3/generator.cpp index 8a90636..d89d6af 100644 --- a/tools/qdoc3/generator.cpp +++ b/tools/qdoc3/generator.cpp @@ -96,21 +96,22 @@ void Generator::terminateGenerator() void Generator::initialize(const Config &config) { outputFormats = config.getStringSet(CONFIG_OUTPUTFORMATS); - if ( !outputFormats.isEmpty() ) { + if (!outputFormats.isEmpty()) { outDir = config.getString(CONFIG_OUTPUTDIR); - if ( outDir.isEmpty() ) + if (outDir.isEmpty()) config.lastLocation().fatal(tr("No output directory specified in configuration file")); QDir dirInfo; - if ( dirInfo.exists(outDir) ) { - if ( !Config::removeDirContents(outDir) ) + if (dirInfo.exists(outDir)) { + if (!Config::removeDirContents(outDir)) config.lastLocation().error(tr("Cannot empty output directory '%1'").arg(outDir)); - } else { - if ( !dirInfo.mkpath(outDir) ) + } + else { + if (!dirInfo.mkpath(outDir)) config.lastLocation().fatal(tr("Cannot create output directory '%1'").arg(outDir)); } - if ( !dirInfo.mkdir(outDir + "/images") ) + if (!dirInfo.mkdir(outDir + "/images")) config.lastLocation().fatal(tr("Cannot create output directory '%1'") .arg(outDir + "/images")); } @@ -119,9 +120,9 @@ void Generator::initialize(const Config &config) imageDirs = config.getStringList(CONFIG_IMAGEDIRS); QString imagesDotFileExtensions = CONFIG_IMAGES + Config::dot + CONFIG_FILEEXTENSIONS; - QSet<QString> formats = config.subVars( imagesDotFileExtensions ); + QSet<QString> formats = config.subVars(imagesDotFileExtensions); QSet<QString>::ConstIterator f = formats.begin(); - while ( f != formats.end() ) { + while (f != formats.end()) { imgFileExts[*f] = config.getStringList(imagesDotFileExtensions + Config::dot + *f); ++f; } @@ -146,33 +147,35 @@ void Generator::initialize(const Config &config) ++g; } - QRegExp secondParamAndAbove( "[\2-\7]" ); - QSet<QString> formattingNames = config.subVars( CONFIG_FORMATTING ); + QRegExp secondParamAndAbove("[\2-\7]"); + QSet<QString> formattingNames = config.subVars(CONFIG_FORMATTING); QSet<QString>::ConstIterator n = formattingNames.begin(); - while ( n != formattingNames.end() ) { + while (n != formattingNames.end()) { QString formattingDotName = CONFIG_FORMATTING + Config::dot + *n; - QSet<QString> formats = config.subVars( formattingDotName ); + QSet<QString> formats = config.subVars(formattingDotName); QSet<QString>::ConstIterator f = formats.begin(); - while ( f != formats.end() ) { - QString def = config.getString( formattingDotName + Config::dot + - *f ); - if ( !def.isEmpty() ) { - int numParams = Config::numParams( def ); + while (f != formats.end()) { + QString def = config.getString(formattingDotName + Config::dot + + *f); + if (!def.isEmpty()) { + int numParams = Config::numParams(def); int numOccs = def.count("\1"); - if ( numParams != 1 ) { + if (numParams != 1) { config.lastLocation().warning(tr("Formatting '%1' must have exactly one" " parameter (found %2)") .arg(*n).arg(numParams)); - } else if ( numOccs > 1 ) { + } + else if (numOccs > 1) { config.lastLocation().fatal(tr("Formatting '%1' must contain exactly one" " occurrence of '\\1' (found %2)") .arg(*n).arg(numOccs)); - } else { - int paramPos = def.indexOf( "\1" ); - fmtLeftMaps[*f].insert( *n, def.left(paramPos) ); - fmtRightMaps[*f].insert( *n, def.mid(paramPos + 1) ); + } + else { + int paramPos = def.indexOf("\1"); + fmtLeftMaps[*f].insert(*n, def.left(paramPos)); + fmtRightMaps[*f].insert(*n, def.mid(paramPos + 1)); } } ++f; @@ -186,7 +189,7 @@ void Generator::initialize(const Config &config) void Generator::terminate() { QList<Generator *>::ConstIterator g = generators.begin(); - while ( g != generators.end() ) { + while (g != generators.end()) { if (outputFormats.contains((*g)->format())) (*g)->terminateGenerator(); ++g; @@ -200,65 +203,97 @@ void Generator::terminate() outDir = ""; } -Generator *Generator::generatorForFormat( const QString& format ) +Generator *Generator::generatorForFormat(const QString& format) { QList<Generator *>::ConstIterator g = generators.begin(); - while ( g != generators.end() ) { - if ( (*g)->format() == format ) + while (g != generators.end()) { + if ((*g)->format() == format) return *g; ++g; } return 0; } -void Generator::startText( const Node * /* relative */, - CodeMarker * /* marker */ ) +void Generator::startText(const Node * /* relative */, + CodeMarker * /* marker */) { } -void Generator::endText( const Node * /* relative */, - CodeMarker * /* marker */ ) +void Generator::endText(const Node * /* relative */, + CodeMarker * /* marker */) { } -int Generator::generateAtom( const Atom * /* atom */, - const Node * /* relative */, - CodeMarker * /* marker */ ) +int Generator::generateAtom(const Atom * /* atom */, + const Node * /* relative */, + CodeMarker * /* marker */) { return 0; } -void Generator::generateClassLikeNode(const InnerNode * /* classe */, CodeMarker * /* marker */) +void Generator::generateClassLikeNode(const InnerNode * /* classe */, + CodeMarker * /* marker */) { } -void Generator::generateFakeNode( const FakeNode * /* fake */, - CodeMarker * /* marker */ ) +void Generator::generateFakeNode(const FakeNode * /* fake */, + CodeMarker * /* marker */) { } -void Generator::generateText( const Text& text, const Node *relative, - CodeMarker *marker ) +void Generator::generateText(const Text& text, + const Node *relative, + CodeMarker *marker) { - if ( text.firstAtom() != 0 ) { + if (text.firstAtom() != 0) { int numAtoms = 0; - startText( relative, marker ); - generateAtomList( text.firstAtom(), relative, marker, true, numAtoms ); - endText( relative, marker ); + startText(relative, marker); + generateAtomList(text.firstAtom(), + relative, + marker, + true, + numAtoms); + endText(relative, marker); } } -void Generator::generateBody( const Node *node, CodeMarker *marker ) +#ifdef QDOC_QML +void Generator::generateQmlText(const Text& text, + const Node *relative, + CodeMarker *marker) +{ + if (text.firstAtom() != 0) { + startText(relative, marker); + const Atom *atom = text.firstAtom(); + 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); + } +} +#endif + +void Generator::generateBody(const Node *node, CodeMarker *marker) { bool quiet = false; - if ( node->type() == Node::Function ) { + if (node->type() == Node::Function) { #if 0 const FunctionNode *func = (const FunctionNode *) node; - if ( func->isOverload() && func->metaness() != FunctionNode::Ctor ) - generateOverload( node, marker ); + if (func->isOverload() && func->metaness() != FunctionNode::Ctor) + generateOverload(node, marker); #endif - } else if (node->type() == Node::Fake) { + } + else if (node->type() == Node::Fake) { const FakeNode *fake = static_cast<const FakeNode *>(node); if (fake->subType() == FakeNode::Example) generateExampleFiles(fake, marker); @@ -270,42 +305,45 @@ void Generator::generateBody( const Node *node, CodeMarker *marker ) if (!quiet) // ### might be unnecessary node->location().warning(tr("No documentation for '%1'") .arg(marker->plainFullName(node))); - } else { + } + else { generateText(node->doc().body(), node, marker); - if ( node->type() == Node::Enum ) { + if (node->type() == Node::Enum) { const EnumNode *enume = (const EnumNode *) node; QSet<QString> definedItems; QList<EnumItem>::ConstIterator it = enume->items().begin(); - while ( it != enume->items().end() ) { - definedItems.insert( (*it).name() ); + while (it != enume->items().end()) { + definedItems.insert((*it).name()); ++it; } QSet<QString> documentedItems = enume->doc().enumItemNames().toSet(); QSet<QString> allItems = definedItems + documentedItems; - if ( allItems.count() > definedItems.count() || - allItems.count() > documentedItems.count() ) { + if (allItems.count() > definedItems.count() || + allItems.count() > documentedItems.count()) { QSet<QString>::ConstIterator a = allItems.begin(); - while ( a != allItems.end() ) { - if ( !definedItems.contains(*a) ) { + while (a != allItems.end()) { + if (!definedItems.contains(*a)) { QString details; - QString best = nearestName( *a, definedItems ); - if ( !best.isEmpty() && !documentedItems.contains(best) ) - details = tr( "Maybe you meant '%1'?" ).arg( best ); + QString best = nearestName(*a, definedItems); + if (!best.isEmpty() && !documentedItems.contains(best)) + details = tr("Maybe you meant '%1'?").arg(best); node->doc().location().warning( tr("No such enum item '%1' in %2").arg(*a).arg(marker->plainFullName(node)), details); - } else if ( !documentedItems.contains(*a) ) { + } + else if (!documentedItems.contains(*a)) { node->doc().location().warning( tr("Undocumented enum item '%1' in %2").arg(*a).arg(marker->plainFullName(node))); } ++a; } } - } else if ( node->type() == Node::Function ) { + } + else if (node->type() == Node::Function) { const FunctionNode *func = static_cast<const FunctionNode *>(node); QSet<QString> definedParams; @@ -315,8 +353,9 @@ void Generator::generateBody( const Node *node, CodeMarker *marker ) && func->name() != QLatin1String("operator++") && func->name() != QLatin1String("operator--")) { node->doc().location().warning(tr("Missing parameter name")); - } else { - definedParams.insert( (*p).name() ); + } + else { + definedParams.insert((*p).name()); } ++p; } @@ -330,13 +369,14 @@ void Generator::generateBody( const Node *node, CodeMarker *marker ) if (!definedParams.contains(*a)) { QString details; QString best = nearestName(*a, definedParams); - if ( !best.isEmpty() ) + if (!best.isEmpty()) details = tr("Maybe you meant '%1'?").arg(best); node->doc().location().warning( tr("No such parameter '%1' in %2").arg(*a).arg(marker->plainFullName(node)), details); - } else if ( !(*a).isEmpty() && !documentedParams.contains(*a) ) { + } + else if (!(*a).isEmpty() && !documentedParams.contains(*a)) { bool needWarning = (func->status() > Node::Obsolete); if (func->overloadNumber() > 1) { FunctionNode *primaryFunc = @@ -365,8 +405,8 @@ void Generator::generateBody( const Node *node, CodeMarker *marker ) node->doc().location().warning(tr("Undocumented return value")); } - if ( func->reimplementedFrom() != 0 ) - generateReimplementedFrom( func, marker ); + if (func->reimplementedFrom() != 0) + generateReimplementedFrom(func, marker); } } @@ -383,7 +423,7 @@ void Generator::generateBody( const Node *node, CodeMarker *marker ) } } -void Generator::generateAlsoList( const Node *node, CodeMarker *marker ) +void Generator::generateAlsoList(const Node *node, CodeMarker *marker) { QList<Text> alsoList = node->doc().alsoList(); supplementAlsoList(node, alsoList); @@ -396,7 +436,7 @@ void Generator::generateAlsoList( const Node *node, CodeMarker *marker ) text << alsoList.at(i) << separator(i, alsoList.size()); text << Atom::ParaRight; - generateText( text, node, marker ); + generateText(text, node, marker); } } @@ -405,41 +445,41 @@ void Generator::generateInherits(const ClassNode *classe, CodeMarker *marker) QList<RelatedClass>::ConstIterator r; int index; - if ( !classe->baseClasses().isEmpty() ) { + if (!classe->baseClasses().isEmpty()) { Text text; text << Atom::ParaLeft << "Inherits "; r = classe->baseClasses().begin(); index = 0; - while ( r != classe->baseClasses().end() ) { + while (r != classe->baseClasses().end()) { text << Atom(Atom::LinkNode, CodeMarker::stringForNode((*r).node)) << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK) << Atom(Atom::String, (*r).dataTypeWithTemplateArgs) << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK); - if ( (*r).access == Node::Protected ) { + if ((*r).access == Node::Protected) { text << " (protected)"; - } else if ( (*r).access == Node::Private ) { + } else if ((*r).access == Node::Private) { text << " (private)"; } - text << separator( index++, classe->baseClasses().count() ); + text << separator(index++, classe->baseClasses().count()); ++r; } text << Atom::ParaRight; - generateText( text, classe, marker ); + generateText(text, classe, marker); } } -void Generator::generateInheritedBy( const ClassNode *classe, - CodeMarker *marker ) +void Generator::generateInheritedBy(const ClassNode *classe, + CodeMarker *marker) { - if ( !classe->derivedClasses().isEmpty() ) { + if (!classe->derivedClasses().isEmpty()) { Text text; text << Atom::ParaLeft << "Inherited by "; appendSortedNames(text, classe, classe->derivedClasses(), marker); text << Atom::ParaRight; - generateText( text, classe, marker ); + generateText(text, classe, marker); } } @@ -480,17 +520,19 @@ void Generator::generateModuleWarning(const ClassNode *classe, CodeMarker *marke << "This class is not part of the Qt Console Edition." << Atom(Atom::FormattingRight, ATOM_FORMATTING_BOLD) << Atom::ParaRight; - } else if (Tokenizer::isTrue("defined(desktoplightedition)") + } + else if (Tokenizer::isTrue("defined(desktoplightedition)") && !editionModuleMap["DesktopLight"].contains(module)) { text << Atom::ParaLeft << Atom(Atom::FormattingLeft, ATOM_FORMATTING_BOLD) << "This class is not part of the Qt Desktop Light Edition." << Atom(Atom::FormattingRight, ATOM_FORMATTING_BOLD) << Atom::ParaRight; - } else if (module == "Qt3Support" && Tokenizer::isTrue("defined(opensourceedition)")) { - text << Atom::ParaLeft << Atom( Atom::FormattingLeft, ATOM_FORMATTING_BOLD ) + } + else if (module == "Qt3Support" && Tokenizer::isTrue("defined(opensourceedition)")) { + text << Atom::ParaLeft << Atom(Atom::FormattingLeft, ATOM_FORMATTING_BOLD) << "Note to Qt Desktop Light Edition users:" - << Atom( Atom::FormattingRight, ATOM_FORMATTING_BOLD ) + << Atom(Atom::FormattingRight, ATOM_FORMATTING_BOLD) << " This class is only available in the " << Atom(Atom::AutoLink, "Qt Desktop Edition") << "." << Atom::ParaRight; @@ -500,28 +542,28 @@ void Generator::generateModuleWarning(const ClassNode *classe, CodeMarker *marke } } -QString Generator::indent( int level, const QString& markedCode ) +QString Generator::indent(int level, const QString& markedCode) { - if ( level == 0 ) + if (level == 0) return markedCode; QString t; int column = 0; int i = 0; - while ( i < (int) markedCode.length() ) { - if ( markedCode.at(i) == QLatin1Char('<') ) { - while ( i < (int) markedCode.length() ) { + while (i < (int) markedCode.length()) { + if (markedCode.at(i) == QLatin1Char('<')) { + while (i < (int) markedCode.length()) { t += markedCode.at(i++); - if ( markedCode.at(i - 1) == QLatin1Char('>') ) + if (markedCode.at(i - 1) == QLatin1Char('>')) break; } } else { - if ( markedCode.at(i) == QLatin1Char('\n') ) { + if (markedCode.at(i) == QLatin1Char('\n')) { column = 0; } else { - if ( column == 0 ) { - for ( int j = 0; j < level; j++ ) + if (column == 0) { + for (int j = 0; j < level; j++) t += QLatin1Char(' '); } column++; @@ -532,20 +574,20 @@ QString Generator::indent( int level, const QString& markedCode ) return t; } -QString Generator::plainCode( const QString& markedCode ) +QString Generator::plainCode(const QString& markedCode) { QString t = markedCode; - t.replace( tag, QString() ); - t.replace( quot, QLatin1String("\"") ); - t.replace( gt, QLatin1String(">") ); - t.replace( lt, QLatin1String("<") ); - t.replace( amp, QLatin1String("&") ); + t.replace(tag, QString()); + t.replace(quot, QLatin1String("\"")); + t.replace(gt, QLatin1String(">")); + t.replace(lt, QLatin1String("<")); + t.replace(amp, QLatin1String("&")); return t; } -QString Generator::typeString( const Node *node ) +QString Generator::typeString(const Node *node) { - switch ( node->type() ) { + switch (node->type()) { case Node::Namespace: return "namespace"; case Node::Class: @@ -564,7 +606,7 @@ QString Generator::typeString( const Node *node ) } } -QString Generator::imageFileName( const Node *relative, const QString& fileBase ) +QString Generator::imageFileName(const Node *relative, const QString& fileBase) { QString userFriendlyFilePath; QString filePath = Config::findFile( @@ -580,18 +622,18 @@ QString Generator::imageFileName( const Node *relative, const QString& fileBase outputDir() + QLatin1String("/images")); } -void Generator::setImageFileExtensions( const QStringList& extensions ) +void Generator::setImageFileExtensions(const QStringList& extensions) { imgFileExts[format()] = extensions; } -void Generator::unknownAtom( const Atom *atom ) +void Generator::unknownAtom(const Atom *atom) { - Location::internalError( tr("unknown atom type '%1' in %2 generator") - .arg(atom->typeString()).arg(format()) ); + Location::internalError(tr("unknown atom type '%1' in %2 generator") + .arg(atom->typeString()).arg(format())); } -bool Generator::matchAhead( const Atom *atom, Atom::Type expectedAtomType ) +bool Generator::matchAhead(const Atom *atom, Atom::Type expectedAtomType) { return atom->next() != 0 && atom->next()->type() == expectedAtomType; } @@ -664,44 +706,44 @@ QString Generator::trimmedTrailing(const QString &string) return trimmed; } -void Generator::generateStatus( const Node *node, CodeMarker *marker ) +void Generator::generateStatus(const Node *node, CodeMarker *marker) { Text text; - switch ( node->status() ) { + switch (node->status()) { case Node::Commendable: case Node::Main: break; case Node::Preliminary: - text << Atom::ParaLeft << Atom( Atom::FormattingLeft, ATOM_FORMATTING_BOLD ) << "This " - << typeString( node ) << " is under development and is subject to change." - << Atom( Atom::FormattingRight, ATOM_FORMATTING_BOLD ) << Atom::ParaRight; + text << Atom::ParaLeft << Atom(Atom::FormattingLeft, ATOM_FORMATTING_BOLD) << "This " + << typeString(node) << " is under development and is subject to change." + << Atom(Atom::FormattingRight, ATOM_FORMATTING_BOLD) << Atom::ParaRight; break; case Node::Deprecated: text << Atom::ParaLeft; if (node->isInnerNode()) - text << Atom( Atom::FormattingLeft, ATOM_FORMATTING_BOLD ); - text << "This " << typeString( node ) << " is deprecated."; + text << Atom(Atom::FormattingLeft, ATOM_FORMATTING_BOLD); + text << "This " << typeString(node) << " is deprecated."; if (node->isInnerNode()) - text << Atom( Atom::FormattingRight, ATOM_FORMATTING_BOLD ); + text << Atom(Atom::FormattingRight, ATOM_FORMATTING_BOLD); text << Atom::ParaRight; break; case Node::Obsolete: text << Atom::ParaLeft; if (node->isInnerNode()) - text << Atom( Atom::FormattingLeft, ATOM_FORMATTING_BOLD ); - text << "This " << typeString( node ) << " is obsolete."; + text << Atom(Atom::FormattingLeft, ATOM_FORMATTING_BOLD); + text << "This " << typeString(node) << " is obsolete."; if (node->isInnerNode()) - text << Atom( Atom::FormattingRight, ATOM_FORMATTING_BOLD ); + text << Atom(Atom::FormattingRight, ATOM_FORMATTING_BOLD); text << " It is provided to keep old source code working. We strongly advise against " << "using it in new code." << Atom::ParaRight; break; case Node::Compat: // reimplemented in HtmlGenerator subclass if (node->isInnerNode()) { - text << Atom::ParaLeft << Atom( Atom::FormattingLeft, ATOM_FORMATTING_BOLD ) << "This " - << typeString( node ) << " is part of the Qt 3 compatibility layer." - << Atom( Atom::FormattingRight, ATOM_FORMATTING_BOLD ) + text << Atom::ParaLeft << Atom(Atom::FormattingLeft, ATOM_FORMATTING_BOLD) << "This " + << typeString(node) << " is part of the Qt 3 compatibility layer." + << Atom(Atom::FormattingRight, ATOM_FORMATTING_BOLD) << " It is provided to keep old source code working. We strongly advise against " << "using it in new code. See " << Atom(Atom::AutoLink, "Porting to Qt 4") @@ -759,7 +801,8 @@ void Generator::generateThreadSafeness(const Node *node, CodeMarker *marker) } if (except.isEmpty()) { text << "."; - } else { + } + else { text << ", except "; NodeList::ConstIterator e = except.begin(); @@ -770,7 +813,8 @@ void Generator::generateThreadSafeness(const Node *node, CodeMarker *marker) ++e; } } - } else { + } + else { text << "This " << typeString(node) << " is " << theStockLink << "."; } text << Atom::ParaRight; @@ -796,7 +840,7 @@ void Generator::generateSince(const Node *node, CodeMarker *marker) /*! No longer in use. */ -void Generator::generateOverload( const Node *node, CodeMarker *marker ) +void Generator::generateOverload(const Node *node, CodeMarker *marker) { Text text; text << Atom::ParaLeft @@ -804,55 +848,71 @@ void Generator::generateOverload( const Node *node, CodeMarker *marker ) QString t = node->name() + "()"; text << Atom::AutoLink << t << Atom::ParaRight; - generateText( text, node, marker ); + generateText(text, node, marker); } -void Generator::generateReimplementedFrom( const FunctionNode *func, - CodeMarker *marker ) +void Generator::generateReimplementedFrom(const FunctionNode *func, + CodeMarker *marker) { - if ( func->reimplementedFrom() != 0 ) { + if (func->reimplementedFrom() != 0) { const FunctionNode *from = func->reimplementedFrom(); if (from->access() != Node::Private && from->parent()->access() != Node::Private) { Text text; text << Atom::ParaLeft << "Reimplemented from "; - appendFullName( text, from->parent(), func, marker, from ); + appendFullName(text, from->parent(), func, marker, from); text << "." << Atom::ParaRight; - generateText( text, func, marker ); + generateText(text, func, marker); } } } -const Atom *Generator::generateAtomList(const Atom *atom, const Node *relative, CodeMarker *marker, - bool generate, int &numAtoms) +const Atom *Generator::generateAtomList(const Atom *atom, + const Node *relative, + CodeMarker *marker, + bool generate, + int &numAtoms) { while (atom) { if (atom->type() == Atom::FormatIf) { int numAtoms0 = numAtoms; bool rightFormat = canHandleFormat(atom->string()); - atom = generateAtomList(atom->next(), relative, marker, generate && rightFormat, + atom = generateAtomList(atom->next(), + relative, + marker, + generate && rightFormat, numAtoms); if (!atom) return 0; if (atom->type() == Atom::FormatElse) { ++numAtoms; - atom = generateAtomList( atom->next(), relative, marker, - generate && !rightFormat, numAtoms ); + atom = generateAtomList(atom->next(), + relative, + marker, + generate && !rightFormat, + numAtoms); if (!atom) return 0; } 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"). + arg(format())); Atom unhandledFormatAtom(Atom::UnhandledFormat, format()); - generateAtomList(&unhandledFormatAtom, relative, marker, generate, numAtoms); + generateAtomList(&unhandledFormatAtom, + relative, + marker, + generate, + numAtoms); } atom = atom->next(); } - } else if (atom->type() == Atom::FormatElse || atom->type() == Atom::FormatEndif) { + } + else if (atom->type() == Atom::FormatElse || atom->type() == Atom::FormatEndif) { return atom; - } else { + } + else { int n = 1; if (generate) { n += generateAtom(atom, relative, marker); @@ -865,11 +925,13 @@ const Atom *Generator::generateAtomList(const Atom *atom, const Node *relative, return 0; } -void Generator::appendFullName( Text& text, const Node *apparentNode, - const Node *relative, CodeMarker *marker, - const Node *actualNode ) +void Generator::appendFullName(Text& text, + const Node *apparentNode, + const Node *relative, + CodeMarker *marker, + const Node *actualNode) { - if ( actualNode == 0 ) + if (actualNode == 0) actualNode = apparentNode; text << Atom(Atom::LinkNode, CodeMarker::stringForNode(actualNode)) << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK) @@ -877,7 +939,8 @@ void Generator::appendFullName( Text& text, const Node *apparentNode, << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK); } -void Generator::appendSortedNames(Text& text, const ClassNode *classe, +void Generator::appendSortedNames(Text& text, + const ClassNode *classe, const QList<RelatedClass> &classes, CodeMarker *marker) { @@ -886,11 +949,11 @@ void Generator::appendSortedNames(Text& text, const ClassNode *classe, int index = 0; r = classes.begin(); - while ( r != classes.end() ) { + while (r != classes.end()) { if ((*r).node->access() == Node::Public && (*r).node->status() != Node::Internal && !(*r).node->doc().isEmpty()) { Text className; - appendFullName( className, (*r).node, classe, marker ); + appendFullName(className, (*r).node, classe, marker); classMap[className.toString().toLower()] = className; } ++r; @@ -901,7 +964,7 @@ void Generator::appendSortedNames(Text& text, const ClassNode *classe, foreach (const QString &className, classNames) { text << classMap[className]; - text << separator( index++, classNames.count() ); + text << separator(index++, classNames.count()); } } @@ -909,14 +972,15 @@ int Generator::skipAtoms(const Atom *atom, Atom::Type type) const { int skipAhead = 0; atom = atom->next(); - while ( atom != 0 && atom->type() != type ) { + while (atom != 0 && atom->type() != type) { skipAhead++; atom = atom->next(); } return skipAhead; } -QString Generator::fullName(const Node *node, const Node *relative, +QString Generator::fullName(const Node *node, + const Node *relative, CodeMarker *marker) const { if (node->type() == Node::Fake) diff --git a/tools/qdoc3/generator.h b/tools/qdoc3/generator.h index 2c06480..3db2d8d 100644 --- a/tools/qdoc3/generator.h +++ b/tools/qdoc3/generator.h @@ -70,7 +70,7 @@ class Tree; class Generator { -public: + public: Generator(); virtual ~Generator(); @@ -80,47 +80,57 @@ public: virtual bool canHandleFormat(const QString &format) { return format == this->format(); } virtual void generateTree(const Tree *tree, CodeMarker *marker) = 0; - static void initialize( const Config& config ); + static void initialize(const Config& config); static void terminate(); - static Generator *generatorForFormat( const QString& format ); - -protected: - virtual void startText( const Node *relative, CodeMarker *marker ); - virtual void endText( const Node *relative, CodeMarker *marker ); - virtual int generateAtom( const Atom *atom, const Node *relative, - CodeMarker *marker ); + static Generator *generatorForFormat(const QString& format); + + protected: + virtual void startText(const Node *relative, CodeMarker *marker); + virtual void endText(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 void generateText( const Text& text, const Node *relative, - CodeMarker *marker ); - virtual void generateBody( const Node *node, CodeMarker *marker ); - virtual void generateAlsoList( const Node *node, CodeMarker *marker ); - virtual void generateInherits( const ClassNode *classe, - CodeMarker *marker ); - virtual void generateInheritedBy( const ClassNode *classe, - CodeMarker *marker ); - - void generateThreadSafeness( const Node *node, CodeMarker *marker ); + virtual void generateFakeNode(const FakeNode *fake, CodeMarker *marker); + + virtual void generateText(const Text& text, + const Node *relative, + CodeMarker *marker); +#ifdef QDOC_QML + virtual void generateQmlText(const Text& text, + const Node *relative, + CodeMarker *marker); +#endif + virtual void generateBody(const Node *node, CodeMarker *marker); + virtual void generateAlsoList(const Node *node, CodeMarker *marker); + virtual void generateInherits(const ClassNode *classe, + CodeMarker *marker); + virtual void generateInheritedBy(const ClassNode *classe, + CodeMarker *marker); + + 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 Node *relative, - CodeMarker *marker, bool generate, - int& numGeneratedAtoms ); + void generateStatus(const Node *node, CodeMarker *marker); + const Atom *generateAtomList(const Atom *atom, + const Node *relative, + CodeMarker *marker, + bool generate, + int& numGeneratedAtoms); void generateExampleFiles(const FakeNode *fake, CodeMarker *marker); - void generateModuleWarning( const ClassNode *classe, CodeMarker *marker); + void generateModuleWarning(const ClassNode *classe, CodeMarker *marker); virtual int skipAtoms(const Atom *atom, Atom::Type type) const; - virtual QString fullName(const Node *node, const Node *relative, + virtual QString fullName(const Node *node, + const Node *relative, CodeMarker *marker) const; const QString& outputDir() { return outDir; } - QString indent( int level, const QString& markedCode ); - QString plainCode( const QString& markedCode ); - virtual QString typeString( const Node *node ); - virtual QString imageFileName( const Node *relative, const QString& fileBase ); - void setImageFileExtensions( const QStringList& extensions ); - void unknownAtom( const Atom *atom ); + QString indent(int level, const QString& markedCode); + QString plainCode(const QString& markedCode); + virtual QString typeString(const Node *node); + virtual QString imageFileName(const Node *relative, const QString& fileBase); + void setImageFileExtensions(const QStringList& extensions); + void unknownAtom(const Atom *atom); QMap<QString, QString> &formattingLeftMap(); QMap<QString, QString> &formattingRightMap(); @@ -128,17 +138,20 @@ protected: QMap<QString, QStringList> editionGroupMap; static QString trimmedTrailing(const QString &string); - static bool matchAhead( const Atom *atom, Atom::Type expectedAtomType ); + static bool matchAhead(const Atom *atom, Atom::Type expectedAtomType); static void supplementAlsoList(const Node *node, QList<Text> &alsoList); private: - void generateOverload( const Node *node, CodeMarker *marker ); - void generateReimplementedFrom( const FunctionNode *func, - CodeMarker *marker ); - void appendFullName( Text& text, const Node *apparentNode, - const Node *relative, CodeMarker *marker, - const Node *actualNode = 0 ); - void appendSortedNames(Text& text, const ClassNode *classe, + void generateOverload(const Node *node, CodeMarker *marker); + void generateReimplementedFrom(const FunctionNode *func, + CodeMarker *marker); + void appendFullName(Text& text, + const Node *apparentNode, + const Node *relative, + CodeMarker *marker, + const Node *actualNode = 0); + void appendSortedNames(Text& text, + const ClassNode *classe, const QList<RelatedClass> &classes, CodeMarker *marker); diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index a0fc743..13d52bf 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -319,7 +319,8 @@ int HtmlGenerator::generateAtom(const Atom *atom, out() << formattingLeftMap()[ATOM_FORMATTING_TELETYPE]; if (inLink) { out() << protect(plainCode(atom->string())); - } else { + } + else { out() << highlightedCode(atom->string(), marker, relative); } out() << formattingRightMap()[ATOM_FORMATTING_TELETYPE]; @@ -382,22 +383,26 @@ int HtmlGenerator::generateAtom(const Atom *atom, case Atom::FormattingRight: if (atom->string() == ATOM_FORMATTING_LINK) { endLink(); - } else { + } + else { out() << formattingRightMap()[atom->string()]; } break; case Atom::GeneratedList: if (atom->string() == "annotatedclasses") { generateAnnotatedList(relative, marker, nonCompatClasses); - } else if (atom->string() == "classes") { + } + else if (atom->string() == "classes") { generateCompactList(relative, marker, nonCompatClasses); - } else if (atom->string().contains("classesbymodule")) { + } + 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")) { + } + else if (atom->string().contains("classesbyedition")) { QString arg = atom->string().trimmed(); QString editionName = atom->string().mid(atom->string().indexOf( @@ -422,7 +427,8 @@ int HtmlGenerator::generateAtom(const Atom *atom, groupClasses = groups.values(groupName.mid(1)); foreach (const Node *node, groupClasses) editionClasses.remove(node->name()); - } else { + } + else { groupClasses = groups.values(groupName); foreach (const Node *node, groupClasses) editionClasses.insert(node->name(), node); @@ -430,23 +436,32 @@ int HtmlGenerator::generateAtom(const Atom *atom, } generateAnnotatedList(relative, marker, editionClasses); } - } else if (atom->string() == "classhierarchy") { + } + else if (atom->string() == "classhierarchy") { generateClassHierarchy(relative, marker, nonCompatClasses); - } else if (atom->string() == "compatclasses") { + } + else if (atom->string() == "compatclasses") { generateCompactList(relative, marker, compatClasses); - } else if (atom->string() == "functionindex") { + } + else if (atom->string() == "functionindex") { generateFunctionIndex(relative, marker); - } else if (atom->string() == "legalese") { + } + else if (atom->string() == "legalese") { generateLegaleseList(relative, marker); - } else if (atom->string() == "mainclasses") { + } + else if (atom->string() == "mainclasses") { generateCompactList(relative, marker, mainClasses); - } else if (atom->string() == "services") { + } + else if (atom->string() == "services") { generateCompactList(relative, marker, serviceClasses); - } else if (atom->string() == "overviews") { + } + else if (atom->string() == "overviews") { generateOverviewList(relative, marker); - } else if (atom->string() == "namespaces") { + } + else if (atom->string() == "namespaces") { generateAnnotatedList(relative, marker, namespaceIndex); - } else if (atom->string() == "related") { + } + else if (atom->string() == "related") { const FakeNode *fake = static_cast<const FakeNode *>(relative); if (fake && !fake->groupMembers().isEmpty()) { QMap<QString, const Node *> groupMembersMap; @@ -456,7 +471,8 @@ int HtmlGenerator::generateAtom(const Atom *atom, } generateAnnotatedList(fake, marker, groupMembersMap); } - } else if (atom->string() == "relatedinline") { + } + else if (atom->string() == "relatedinline") { const FakeNode *fake = static_cast<const FakeNode *>(relative); if (fake && !fake->groupMembers().isEmpty()) { // Reverse the list into the original scan order. @@ -482,7 +498,8 @@ int HtmlGenerator::generateAtom(const Atom *atom, if (fileName.isEmpty()) { out() << "<font color=\"red\">[Missing image " << protect(atom->string()) << "]</font>"; - } else { + } + else { out() << "<img src=\"" << protect(fileName) << "\""; if (!text.isEmpty()) out() << " alt=\"" << protect(text) << "\""; @@ -530,29 +547,37 @@ int HtmlGenerator::generateAtom(const Atom *atom, } if (atom->string() == ATOM_LIST_BULLET) { out() << "<ul>\n"; - } else if (atom->string() == ATOM_LIST_TAG) { + } + else if (atom->string() == ATOM_LIST_TAG) { out() << "<dl>\n"; - } else if (atom->string() == ATOM_LIST_VALUE) { + } + else if (atom->string() == ATOM_LIST_VALUE) { threeColumnEnumValueTable = isThreeColumnEnumValueTable(atom); if (threeColumnEnumValueTable) { out() << "<p><table border=\"1\" cellpadding=\"2\" cellspacing=\"1\" width=\"100%\">\n" "<tr><th width=\"25%\">Constant</th><th width=\"15%\">Value</th>" "<th width=\"60%\">Description</th></tr>\n"; - } else { + } + else { out() << "<p><table border=\"1\" cellpadding=\"2\" cellspacing=\"1\" width=\"40%\">\n" << "<tr><th width=\"60%\">Constant</th><th width=\"40%\">Value</th></tr>\n"; } - } else { + } + else { out() << "<ol type="; if (atom->string() == ATOM_LIST_UPPERALPHA) { out() << "\"A\""; - } else if (atom->string() == ATOM_LIST_LOWERALPHA) { + } + else if (atom->string() == ATOM_LIST_LOWERALPHA) { out() << "\"a\""; - } else if (atom->string() == ATOM_LIST_UPPERROMAN) { + } + else if (atom->string() == ATOM_LIST_UPPERROMAN) { out() << "\"I\""; - } else if (atom->string() == ATOM_LIST_LOWERROMAN) { + } + else if (atom->string() == ATOM_LIST_LOWERROMAN) { out() << "\"i\""; - } else { // (atom->string() == ATOM_LIST_NUMERIC) + } + else { // (atom->string() == ATOM_LIST_NUMERIC) out() << "\"1\""; } if (atom->next() != 0 && atom->next()->string().toInt() != 1) @@ -565,7 +590,8 @@ int HtmlGenerator::generateAtom(const Atom *atom, case Atom::ListTagLeft: if (atom->string() == ATOM_LIST_TAG) { out() << "<dt>"; - } else { // (atom->string() == ATOM_LIST_VALUE) + } + else { // (atom->string() == ATOM_LIST_VALUE) // ### Trenton out() << "<tr><td valign=\"top\"><tt>" @@ -594,13 +620,15 @@ int HtmlGenerator::generateAtom(const Atom *atom, case Atom::ListItemLeft: if (atom->string() == ATOM_LIST_TAG) { out() << "<dd>"; - } else if (atom->string() == ATOM_LIST_VALUE) { + } + else if (atom->string() == ATOM_LIST_VALUE) { if (threeColumnEnumValueTable) { out() << "</td><td valign=\"top\">"; if (matchAhead(atom, Atom::ListItemRight)) out() << " "; } - } else { + } + else { out() << "<li>"; } if (matchAhead(atom, Atom::ParaLeft)) @@ -609,20 +637,25 @@ int HtmlGenerator::generateAtom(const Atom *atom, case Atom::ListItemRight: if (atom->string() == ATOM_LIST_TAG) { out() << "</dd>\n"; - } else if (atom->string() == ATOM_LIST_VALUE) { + } + else if (atom->string() == ATOM_LIST_VALUE) { out() << "</td></tr>\n"; - } else { + } + else { out() << "</li>\n"; } break; case Atom::ListRight: if (atom->string() == ATOM_LIST_BULLET) { out() << "</ul>\n"; - } else if (atom->string() == ATOM_LIST_TAG) { + } + else if (atom->string() == ATOM_LIST_TAG) { out() << "</dl>\n"; - } else if (atom->string() == ATOM_LIST_VALUE) { + } + else if (atom->string() == ATOM_LIST_VALUE) { out() << "</table></p>\n"; - } else { + } + else { out() << "</ol>\n"; } break; @@ -658,7 +691,8 @@ int HtmlGenerator::generateAtom(const Atom *atom, do { sectionNumber.append("1"); } while (sectionNumber.size() < nextLevel); - } else { + } + else { while (sectionNumber.size() > nextLevel) { sectionNumber.removeLast(); } @@ -688,7 +722,8 @@ int HtmlGenerator::generateAtom(const Atom *atom, case Atom::String: if (inLink && !inContents && !inSectionHeading) { generateLink(atom, relative, marker); - } else { + } + else { out() << protect(atom->string()); } break; @@ -704,7 +739,8 @@ int HtmlGenerator::generateAtom(const Atom *atom, << "cellspacing=\"1\" border=\"0\">\n"; else out() << "<p><table align=\"center\" cellpadding=\"2\" cellspacing=\"1\" border=\"0\">\n"; - } else { + } + else { out() << "<p><table align=\"center\" cellpadding=\"2\" cellspacing=\"1\" border=\"0\">\n"; } numTableRows = 0; @@ -721,7 +757,8 @@ int HtmlGenerator::generateAtom(const Atom *atom, if (matchAhead(atom, Atom::TableHeaderLeft)) { skipAhead = 1; out() << "\n<tr valign=\"top\" class=\"qt-style\">"; - } else { + } + else { out() << "</thead>\n"; inTableHeader = false; } @@ -798,6 +835,12 @@ int HtmlGenerator::generateAtom(const Atom *atom, out() << "<font color=\"red\"><b><code>\\" << protect(atom->string()) << "</code></b></font>"; 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); } @@ -821,7 +864,8 @@ void HtmlGenerator::generateClassLikeNode(const InnerNode *inner, rawTitle = marker->plainName(inner); fullTitle = marker->plainFullName(inner); title = rawTitle + " Namespace Reference"; - } else if (inner->type() == Node::Class) { + } + else if (inner->type() == Node::Class) { classe = static_cast<const ClassNode *>(inner); rawTitle = marker->plainName(inner); fullTitle = marker->plainFullName(inner); @@ -1101,12 +1145,12 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) generateBody(fake, marker); #ifdef QDOC_QML if (fake->subType() == FakeNode::QmlClass) { - qDebug() << "generateFakeNode(): QML CLASS" << fake->name(); + //qDebug() << "generateFakeNode(): QML CLASS" << fake->name(); const QmlNode* qmlNode = static_cast<const QmlNode*>(fake); const ClassNode* cn = qmlNode->classNode(); if (cn) { - qDebug() << " CPP CLASS" << cn->name(); - generateBody(cn, marker); + //qDebug() << " CPP CLASS" << cn->name(); + generateQmlText(cn->doc().body(), cn, marker); } } #endif @@ -1142,18 +1186,23 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) if (fake->subType() == FakeNode::Example) { appendDcfSubSection(&dcfExamplesRoot, fakeSection); - } else if (fake->subType() != FakeNode::File) { + } + else if (fake->subType() != FakeNode::File) { QString contentsPage = fake->links().value(Node::ContentsLink).first; if (contentsPage == "Qt Designer Manual") { appendDcfSubSection(&dcfDesignerRoot, fakeSection); - } else if (contentsPage == "Qt Linguist Manual") { + } + else if (contentsPage == "Qt Linguist Manual") { appendDcfSubSection(&dcfLinguistRoot, fakeSection); - } else if (contentsPage == "Qt Assistant Manual") { + } + else if (contentsPage == "Qt Assistant Manual") { appendDcfSubSection(&dcfAssistantRoot, fakeSection); - } else if (contentsPage == "qmake Manual") { + } + else if (contentsPage == "qmake Manual") { appendDcfSubSection(&dcfQmakeRoot, fakeSection); - } else { + } + else { appendDcfSubSection(&dcfOverviewsRoot, fakeSection); } } @@ -2865,10 +2914,10 @@ void HtmlGenerator::findAllQmlClasses(const InnerNode *node) const FakeNode* fakeNode = static_cast<const FakeNode *>(*c); if (fakeNode->subType() == FakeNode::QmlClass) { const QmlNode* qmlNode = static_cast<const QmlNode*>(fakeNode); - qDebug() << "HtmlGenerator: QML CLASS" << qmlNode->name(); + //qDebug() << "HtmlGenerator: QML CLASS" << qmlNode->name(); const Node* n = qmlNode->classNode(); if (n) - qDebug() << " FOUND IT!" << n->name(); + //qDebug() << " FOUND IT!" << n->name(); } qmlClasses.insert(fakeNode->name(),*c); } @@ -2922,9 +2971,11 @@ const Node *HtmlGenerator::findNodeForTarget(const QString &target, if (target.isEmpty()) { node = relative; - } else if (target.endsWith(".html")) { + } + else if (target.endsWith(".html")) { node = tre->root()->findNode(target, Node::Fake); - } else if (marker) { + } + else if (marker) { node = marker->resolveTarget(target, tre, relative); if (!node) node = tre->findFakeNodeByTitle(target); @@ -2969,11 +3020,13 @@ QString HtmlGenerator::getLink(const Atom *atom, || atom->string().startsWith("mailto:"))) { link = atom->string(); - } else { + } + else { QStringList path; if (atom->string().contains('#')) { path = atom->string().split('#'); - } else { + } + else { path.append(atom->string()); } @@ -2982,9 +3035,11 @@ QString HtmlGenerator::getLink(const Atom *atom, QString first = path.first().trimmed(); if (first.isEmpty()) { node = relative; - } else if (first.endsWith(".html")) { + } + else if (first.endsWith(".html")) { node = tre->root()->findNode(first, Node::Fake); - } else { + } + else { node = marker->resolveTarget(first, tre, relative); if (!node) node = tre->findFakeNodeByTitle(first); @@ -2997,7 +3052,8 @@ QString HtmlGenerator::getLink(const Atom *atom, return node->url(); else path.removeFirst(); - } else { + } + else { node = relative; } diff --git a/tools/qdoc3/pagegenerator.cpp b/tools/qdoc3/pagegenerator.cpp index 39e286e..2d50279 100644 --- a/tools/qdoc3/pagegenerator.cpp +++ b/tools/qdoc3/pagegenerator.cpp @@ -198,9 +198,11 @@ void PageGenerator::generateInnerNode(const InnerNode *node, } else if (node->type() == Node::Fake) { const FakeNode* fakeNode = static_cast<const FakeNode *>(node); +#ifdef QDOC_QML if (fakeNode->subType() == FakeNode::QmlClass) { - qDebug() << "FILENAME:" << fileName(node); + //qDebug() << "FILENAME:" << fileName(node); } +#endif generateFakeNode(static_cast<const FakeNode *>(node), marker); } endSubPage(); diff --git a/tools/qdoc3/test/classic.css b/tools/qdoc3/test/classic.css index 0d0b664..6cf7377 100644 --- a/tools/qdoc3/test/classic.css +++ b/tools/qdoc3/test/classic.css @@ -99,6 +99,14 @@ body pre color: black } +table tr.qt-code pre +{ + padding: 0.2em; + border: #e7e7e7 1px solid; + background: #f1f1f1; + color: black +} + span.preprocessor, span.preprocessor a { color: darkblue; diff --git a/tools/qdoc3/test/macros.qdocconf b/tools/qdoc3/test/macros.qdocconf index d14f80a..85fe1db 100644 --- a/tools/qdoc3/test/macros.qdocconf +++ b/tools/qdoc3/test/macros.qdocconf @@ -23,5 +23,7 @@ macro.rarrow.HTML = "→" macro.reg.HTML = "<sup>®</sup>" macro.return = "Returns" macro.starslash = "\\c{*/}" +macro.begincomment = "\\c{/*}" +macro.endcomment = "\\c{*/}" macro.uuml.HTML = "ü" macro.mdash.HTML = "—" diff --git a/tools/qdoc3/test/qt-api-only.qdocconf b/tools/qdoc3/test/qt-api-only.qdocconf index 2e91ba2..bc5656b 100644 --- a/tools/qdoc3/test/qt-api-only.qdocconf +++ b/tools/qdoc3/test/qt-api-only.qdocconf @@ -9,7 +9,7 @@ url = ./ # Ensures that the documentation for the tools is not included in the generated # .qhp file. -qhp.Qt.excluded = $QT_SOURCE_TREE/doc/src/assistant-manual.qdoc \ +qhp.Qt.excluded += $QT_SOURCE_TREE/doc/src/assistant-manual.qdoc \ $QT_SOURCE_TREE/doc/src/examples/simpletextviewer.qdoc \ $QT_SOURCE_TREE/doc/src/designer-manual.qdoc \ $QT_SOURCE_TREE/doc/src/examples/calculatorbuilder.qdoc \ diff --git a/tools/qdoc3/test/qt-build-docs.qdocconf b/tools/qdoc3/test/qt-build-docs.qdocconf index a085768..25cdc5a 100644 --- a/tools/qdoc3/test/qt-build-docs.qdocconf +++ b/tools/qdoc3/test/qt-build-docs.qdocconf @@ -92,7 +92,11 @@ excludedirs = $QT_SOURCE_TREE/src/3rdparty/clucene \ $QT_SOURCE_TREE/src/3rdparty/webkit/WebCore \ $QT_SOURCE_TREE/src/3rdparty/wintab \ $QT_SOURCE_TREE/src/3rdparty/zlib \ - $QT_SOURCE_TREE/doc/src/snippets + $QT_SOURCE_TREE/doc/src/snippets \ + $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/waveout sources.fileextensions = "*.cpp *.qdoc *.mm" examples.fileextensions = "*.cpp *.h *.js *.xq *.svg *.xml *.ui *.qhp *.qhcp" diff --git a/tools/qdoc3/test/qt.qdocconf b/tools/qdoc3/test/qt.qdocconf index 298311e..4d401a4 100644 --- a/tools/qdoc3/test/qt.qdocconf +++ b/tools/qdoc3/test/qt.qdocconf @@ -22,7 +22,7 @@ edition.DesktopLight.groups = -graphicsview-api qhp.projects = Qt qhp.Qt.file = qt.qhp -qhp.Qt.namespace = com.trolltech.qt.450 +qhp.Qt.namespace = com.trolltech.qt.451 qhp.Qt.virtualFolder = qdoc qhp.Qt.indexTitle = Qt Reference Documentation qhp.Qt.indexRoot = |