diff --git a/src/tools/qdoc/htmlgenerator.cpp b/src/tools/qdoc/htmlgenerator.cpp index 6ab6e9f915..b8ad119466 100644 --- a/src/tools/qdoc/htmlgenerator.cpp +++ b/src/tools/qdoc/htmlgenerator.cpp @@ -279,7 +279,6 @@ void HtmlGenerator::generateTree(const Tree *tree) QString fileBase = project.toLower().simplified().replace(" ", "-"); generateIndex(fileBase, projectUrl, projectDescription); - generatePageIndex(outputDir() + QLatin1Char('/') + fileBase + ".pageindex"); helpProjectWriter->generate(myTree); generateManifestFiles(); @@ -4289,225 +4288,6 @@ void HtmlGenerator::generateInstantiatedBy(const ClassNode* cn, CodeMarker* mark } } -/*! - Generate the element for the given \a node using the \a writer. - Return true if a element was written; otherwise return false. - */ -bool HtmlGenerator::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; - - QString guid = QUuid::createUuid().toString(); - QString title; - QString rawTitle; - QString fullTitle; - QStringList pageWords; - QXmlStreamAttributes attributes; - - QString url = node->outputSubdirectory(); - if (!url.isEmpty()) - url.append(QLatin1Char('/')); - url.append(Generator::fileName(node)); - - writer.writeStartElement("page"); - - if (node->isInnerNode()) { - const InnerNode* inner = static_cast(node); - if (!inner->pageKeywords().isEmpty()) - pageWords << inner->pageKeywords(); - - switch (node->type()) { - case Node::Fake: - { - const FakeNode* fake = static_cast(node); - title = fake->fullTitle(); - pageWords << title; - break; - } - case Node::Class: - { - title = node->name() + " Class"; - pageWords << node->name() << "class" << "reference"; - break; - } - case Node::Namespace: - { - rawTitle = marker->plainName(inner); - fullTitle = marker->plainFullName(inner); - title = rawTitle + " Namespace"; - pageWords << rawTitle << "namespace" << "reference"; - break; - } - default: - title = node->name(); - pageWords << title; - break; - } - } - else { - switch (node->type()) { - case Node::Enum: - { - title = node->name() + " Enum"; - pageWords << node->name() << "enum" << "type"; - url += QLatin1Char('#') + node->name() + "-enum"; - break; - } - case Node::Function: - { - title = node->name() + " Function"; - pageWords << node->name() << "function"; - url += QLatin1Char('#') + node->name(); - break; - } - case Node::Property: - { - title = node->name() + " Property"; - pageWords << node->name() << "property"; - url += QLatin1Char('#') + node->name() + "-prop"; - break; - } - case Node::Typedef: - { - title = node->name() + " Type"; - pageWords << node->name() << "typedef" << "type"; - url += QLatin1Char('#') + node->name(); - break; - } - default: - title = node->name(); - pageWords << title; - break; - } - - Node* parent = node->parent(); - if (parent && ((parent->type() == Node::Class) || - (parent->type() == Node::Namespace))) { - pageWords << parent->name(); - } - } - - writer.writeAttribute("id",guid); - writer.writeStartElement("pageWords"); - writer.writeCharacters(pageWords.join(" ")); - - writer.writeEndElement(); - writer.writeStartElement("pageTitle"); - writer.writeCharacters(title); - writer.writeEndElement(); - writer.writeStartElement("pageUrl"); - writer.writeCharacters(url); - writer.writeEndElement(); - writer.writeStartElement("pageType"); - QString ptype = "Article"; - switch (node->pageType()) { - case Node::ApiPage: - ptype = "APIPage"; - break; - case Node::ArticlePage: - ptype = "Article"; - break; - case Node::ExamplePage: - ptype = "Example"; - break; - case Node::HowToPage: - ptype = "HowTo"; - break; - case Node::OverviewPage: - ptype = "Overview"; - break; - case Node::TutorialPage: - ptype = "Tutorial"; - break; - case Node::FAQPage: - ptype = "FAQ"; - break; - default: - break; - } - writer.writeCharacters(ptype); - writer.writeEndElement(); - writer.writeEndElement(); - - if (node->type() == Node::Fake && node->doc().hasTableOfContents()) { - QList toc = node->doc().tableOfContents(); - if (!toc.isEmpty()) { - for (int i = 0; i < toc.size(); ++i) { - Text headingText = Text::sectionHeading(toc.at(i)); - QString s = headingText.toString(); - writer.writeStartElement("page"); - guid = QUuid::createUuid().toString(); - QString internalUrl = url + QLatin1Char('#') + Doc::canonicalTitle(s); - writer.writeAttribute("id",guid); - writer.writeStartElement("pageWords"); - writer.writeCharacters(pageWords.join(" ")); - writer.writeCharacters(" "); - writer.writeCharacters(s); - writer.writeEndElement(); - writer.writeStartElement("pageTitle"); - writer.writeCharacters(s); - writer.writeEndElement(); - writer.writeStartElement("pageUrl"); - writer.writeCharacters(internalUrl); - writer.writeEndElement(); - writer.writeStartElement("pageType"); - writer.writeCharacters("Article"); - writer.writeEndElement(); - writer.writeEndElement(); - } - } - } - return true; -} - -/*! - Traverse the tree recursively and generate the - elements. - */ -void HtmlGenerator::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 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(); - writer.writeStartElement("qtPageIndex"); - - generatePageElements(writer, myTree->root(), marker); - - writer.writeEndElement(); // qtPageIndex - writer.writeEndDocument(); - file.close(); -} - void HtmlGenerator::generateExtractionMark(const Node *node, ExtractionMarkType markType) { if (markType != EndMark) { diff --git a/src/tools/qdoc/htmlgenerator.h b/src/tools/qdoc/htmlgenerator.h index 841c226b75..1ba88f83df 100644 --- a/src/tools/qdoc/htmlgenerator.h +++ b/src/tools/qdoc/htmlgenerator.h @@ -239,13 +239,6 @@ private: 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) const; void generateExtractionMark(const Node *node, ExtractionMarkType markType); void reportOrphans(const InnerNode* parent);