summaryrefslogtreecommitdiffstats
path: root/tools/qdoc3
diff options
context:
space:
mode:
Diffstat (limited to 'tools/qdoc3')
-rw-r--r--tools/qdoc3/config.h1
-rw-r--r--tools/qdoc3/cppcodemarker.cpp32
-rw-r--r--tools/qdoc3/doc.cpp17
-rw-r--r--tools/qdoc3/doc/qdoc-manual.qdoc21
-rw-r--r--tools/qdoc3/generator.cpp16
-rw-r--r--tools/qdoc3/generator.h2
-rw-r--r--tools/qdoc3/helpprojectwriter.cpp32
-rw-r--r--tools/qdoc3/htmlgenerator.cpp147
-rw-r--r--tools/qdoc3/htmlgenerator.h1
-rw-r--r--tools/qdoc3/node.cpp2
-rw-r--r--tools/qdoc3/pagegenerator.cpp8
-rw-r--r--tools/qdoc3/tree.cpp162
12 files changed, 257 insertions, 184 deletions
diff --git a/tools/qdoc3/config.h b/tools/qdoc3/config.h
index bc2b6a2..9ebc0f8 100644
--- a/tools/qdoc3/config.h
+++ b/tools/qdoc3/config.h
@@ -148,6 +148,7 @@ class Config
#define CONFIG_OUTPUTENCODING "outputencoding"
#define CONFIG_OUTPUTLANGUAGE "outputlanguage"
#define CONFIG_OUTPUTFORMATS "outputformats"
+#define CONFIG_OUTPUTPREFIXES "outputprefixes"
#define CONFIG_PROJECT "project"
#define CONFIG_QHP "qhp"
#define CONFIG_QUOTINGINFORMATION "quotinginformation"
diff --git a/tools/qdoc3/cppcodemarker.cpp b/tools/qdoc3/cppcodemarker.cpp
index 1b1e8f2..e27916b 100644
--- a/tools/qdoc3/cppcodemarker.cpp
+++ b/tools/qdoc3/cppcodemarker.cpp
@@ -935,6 +935,8 @@ QString CppCodeMarker::addMarkUp(const QString &in,
int braceDepth = 0;
int parenDepth = 0;
int i = 0;
+ int start = 0;
+ int finish = 0;
char ch;
QRegExp classRegExp("Qt?(?:[A-Z3]+[a-z][A-Za-z]*|t)");
QRegExp functionRegExp("q([A-Z][a-z]+)+");
@@ -942,7 +944,6 @@ QString CppCodeMarker::addMarkUp(const QString &in,
readChar();
while (ch != EOF) {
- int second = i;
QString tag;
bool target = false;
@@ -950,6 +951,7 @@ QString CppCodeMarker::addMarkUp(const QString &in,
QString ident;
do {
ident += ch;
+ finish = i;
readChar();
} while (isalnum(ch) || ch == '_');
@@ -970,6 +972,7 @@ QString CppCodeMarker::addMarkUp(const QString &in,
}
} else if (isdigit(ch)) {
do {
+ finish = i;
readChar();
} while (isalnum(ch) || ch == '.');
tag = QLatin1String("number");
@@ -992,10 +995,12 @@ QString CppCodeMarker::addMarkUp(const QString &in,
case ']':
case '|':
case '~':
+ finish = i;
readChar();
tag = QLatin1String("op");
break;
case '"':
+ finish = i;
readChar();
while (ch != EOF && ch != '"') {
@@ -1003,19 +1008,23 @@ QString CppCodeMarker::addMarkUp(const QString &in,
readChar();
readChar();
}
+ finish = i;
readChar();
tag = QLatin1String("string");
break;
case '#':
+ finish = i;
readChar();
while (ch != EOF && ch != '\n') {
if (ch == '\\')
readChar();
+ finish = i;
readChar();
}
tag = QLatin1String("preprocessor");
break;
case '\'':
+ finish = i;
readChar();
while (ch != EOF && ch != '\'') {
@@ -1023,28 +1032,35 @@ QString CppCodeMarker::addMarkUp(const QString &in,
readChar();
readChar();
}
+ finish = i;
readChar();
tag = QLatin1String("char");
break;
case '(':
+ finish = i;
readChar();
parenDepth++;
break;
case ')':
+ finish = i;
readChar();
parenDepth--;
break;
case ':':
+ finish = i;
readChar();
if (ch == ':') {
+ finish = i;
readChar();
tag = QLatin1String("op");
}
break;
case '/':
+ finish = i;
readChar();
if (ch == '/') {
do {
+ finish = i;
readChar();
} while (ch != EOF && ch != '\n');
tag = QLatin1String("comment");
@@ -1052,6 +1068,7 @@ QString CppCodeMarker::addMarkUp(const QString &in,
bool metAster = false;
bool metAsterSlash = false;
+ finish = i;
readChar();
while (!metAsterSlash) {
@@ -1064,6 +1081,7 @@ QString CppCodeMarker::addMarkUp(const QString &in,
metAsterSlash = true;
else
metAster = false;
+ finish = i;
readChar();
}
tag = QLatin1String("comment");
@@ -1072,23 +1090,24 @@ QString CppCodeMarker::addMarkUp(const QString &in,
}
break;
case '{':
+ finish = i;
readChar();
braceDepth++;
break;
case '}':
+ finish = i;
readChar();
braceDepth--;
break;
default:
+ finish = i;
readChar();
}
}
QString text;
- if ((tag.isEmpty() || second == 1) && i == code.length())
- text = code.mid(second - 1, i - second + 1);
- else
- text = code.mid(second - 1, i - second);
+ text = code.mid(start, finish - start);
+ start = finish;
if (!tag.isEmpty()) {
out += QLatin1String("<@") + tag;
@@ -1101,7 +1120,10 @@ QString CppCodeMarker::addMarkUp(const QString &in,
if (!tag.isEmpty())
out += QLatin1String("</@") + tag + QLatin1String(">");
+ }
+ if (start < code.length()) {
+ out += protect(code.mid(start));
}
return out;
diff --git a/tools/qdoc3/doc.cpp b/tools/qdoc3/doc.cpp
index 76c47a2..a730799 100644
--- a/tools/qdoc3/doc.cpp
+++ b/tools/qdoc3/doc.cpp
@@ -369,6 +369,7 @@ class DocParser
void appendChar(QChar ch);
void appendWord(const QString &word);
void appendToCode(const QString &code);
+ void appendToCode(const QString &code, Atom::Type defaultType);
void startNewPara();
void enterPara(Atom::Type leftType = Atom::ParaLeft,
Atom::Type rightType = Atom::ParaRight,
@@ -1112,9 +1113,8 @@ void DocParser::parse(const QString& source,
append(Atom::SnippetIdentifier, identifier);
}
else {
- Doc::quoteFromFile(location(),quoter,snippet);
- appendToCode(quoter.quoteSnippet(location(),
- identifier));
+ marker = Doc::quoteFromFile(location(),quoter,snippet);
+ appendToCode(quoter.quoteSnippet(location(), identifier), marker->atomType());
}
}
break;
@@ -1855,7 +1855,7 @@ void DocParser::appendToCode(const QString& markedCode)
{
Atom::Type lastType = priv->text.lastAtom()->type();
#ifdef QDOC_QML
- if (lastType != Atom::Qml)
+ if (lastType != Atom::Qml && lastType != Atom::Code && lastType != Atom::JavaScript)
append(Atom::Qml);
#else
if (lastType != Atom::Code)
@@ -1864,6 +1864,15 @@ void DocParser::appendToCode(const QString& markedCode)
priv->text.lastAtom()->appendString(markedCode);
}
+void DocParser::appendToCode(const QString &markedCode, Atom::Type defaultType)
+{
+ Atom::Type lastType = priv->text.lastAtom()->type();
+ if (lastType != Atom::Qml && lastType != Atom::Code && lastType != Atom::JavaScript)
+ append(defaultType, markedCode);
+ else
+ priv->text.lastAtom()->appendString(markedCode);
+}
+
void DocParser::startNewPara()
{
leavePara();
diff --git a/tools/qdoc3/doc/qdoc-manual.qdoc b/tools/qdoc3/doc/qdoc-manual.qdoc
index adf92fe..7290c0e 100644
--- a/tools/qdoc3/doc/qdoc-manual.qdoc
+++ b/tools/qdoc3/doc/qdoc-manual.qdoc
@@ -7069,6 +7069,8 @@
\l {22-qdoc-configuration-generalvariables.html#outputdir}{outputdir},
\l {22-qdoc-configuration-generalvariables.html#outputformats}
{outputformats},
+ \l {22-qdoc-configuration-generalvariables.html#outputprefixes}
+ {outputprefixes},
\l {22-qdoc-configuration-generalvariables.html#slow}{slow},
\l {22-qdoc-configuration-generalvariables.html#sourcedirs}{sourcedirs},
\l {22-qdoc-configuration-generalvariables.html#sources}{sources},
@@ -7155,6 +7157,8 @@
\l {22-qdoc-configuration-generalvariables.html#outputdir}{outputdir},
\l {22-qdoc-configuration-generalvariables.html#outputformats}
{outputformats},
+ \l {22-qdoc-configuration-generalvariables.html#outputprefixes}
+ {outputprefixes},
\l {22-qdoc-configuration-generalvariables.html#slow}{slow},
\l {22-qdoc-configuration-generalvariables.html#sourcedirs}{sourcedirs},
\l {22-qdoc-configuration-generalvariables.html#sources}{sources},
@@ -7796,6 +7800,23 @@
the default format, and doesn't need to be specified.
\row
+ \o \bold outputprefixes \target outputprefixes
+ \o \bold {The \c outputprefixes variable specifies a mapping between
+ types of files and the prefixes to prepend to the HTML file names
+ in the generated documentation.}
+
+ For example:
+
+ \code
+ outputprefixes = QML
+ outputprefixes.QML = qt-components-
+ \endcode
+
+ Be default, files containing the API documentation for QML elements
+ or components are prefixed with "qml-". In the above example, the
+ prefix "qt-components-" is used instead.
+
+ \row
\o \bold qhp \target qhp
\o \bold{The \c qhp variable is used to define the information to be
written out to Qt Help Project (\c{qhp}) files.}
diff --git a/tools/qdoc3/generator.cpp b/tools/qdoc3/generator.cpp
index 276eab4..b4768db 100644
--- a/tools/qdoc3/generator.cpp
+++ b/tools/qdoc3/generator.cpp
@@ -43,7 +43,9 @@
generator.cpp
*/
#include <qdir.h>
+#ifdef DEBUG_MULTIPLE_QDOCCONF_FILES
#include <qdebug.h>
+#endif
#include "codemarker.h"
#include "config.h"
#include "doc.h"
@@ -73,6 +75,7 @@ QStringList Generator::styleFiles;
QStringList Generator::styleDirs;
QString Generator::outDir;
QString Generator::project;
+QHash<QString, QString> Generator::outputPrefixes;
static void singularPlural(Text& text, const NodeList& nodes)
{
@@ -272,6 +275,14 @@ void Generator::initialize(const Config &config)
}
project = config.getString(CONFIG_PROJECT);
+
+ QStringList prefixes = config.getStringList(CONFIG_OUTPUTPREFIXES);
+ if (!prefixes.isEmpty()) {
+ foreach (QString prefix, prefixes)
+ outputPrefixes[prefix] = config.getString(
+ CONFIG_OUTPUTPREFIXES + Config::dot + prefix);
+ } else
+ outputPrefixes[QLatin1String("QML")] = QLatin1String("qml-");
}
void Generator::terminate()
@@ -1259,4 +1270,9 @@ QString Generator::fullName(const Node *node,
return marker->plainFullName(node, relative);
}
+QString Generator::outputPrefix(const QString &nodeType)
+{
+ return outputPrefixes[nodeType];
+}
+
QT_END_NAMESPACE
diff --git a/tools/qdoc3/generator.h b/tools/qdoc3/generator.h
index 8378d07..4482313 100644
--- a/tools/qdoc3/generator.h
+++ b/tools/qdoc3/generator.h
@@ -148,6 +148,7 @@ class Generator
static QString trimmedTrailing(const QString &string);
static bool matchAhead(const Atom *atom, Atom::Type expectedAtomType);
static void supplementAlsoList(const Node *node, QList<Text> &alsoList);
+ static QString outputPrefix(const QString &nodeType);
private:
void generateReimplementedFrom(const FunctionNode *func,
@@ -198,6 +199,7 @@ class Generator
static QStringList styleDirs;
static QString outDir;
static QString project;
+ static QHash<QString, QString> outputPrefixes;
};
QT_END_NAMESPACE
diff --git a/tools/qdoc3/helpprojectwriter.cpp b/tools/qdoc3/helpprojectwriter.cpp
index 386ce20..f2e2f04 100644
--- a/tools/qdoc3/helpprojectwriter.cpp
+++ b/tools/qdoc3/helpprojectwriter.cpp
@@ -214,7 +214,7 @@ QStringList HelpProjectWriter::keywordDetails(const Node *node) const
details << node->name();
details << node->name();
}
- details << tree->fullDocumentLocation(node);
+ details << HtmlGenerator::fullDocumentLocation(node);
return details;
}
@@ -274,12 +274,12 @@ bool HelpProjectWriter::generateSection(HelpProject &project,
case Node::Class:
project.keywords.append(keywordDetails(node));
- project.files.insert(tree->fullDocumentLocation(node));
+ project.files.insert(HtmlGenerator::fullDocumentLocation(node));
break;
case Node::Namespace:
project.keywords.append(keywordDetails(node));
- project.files.insert(tree->fullDocumentLocation(node));
+ project.files.insert(HtmlGenerator::fullDocumentLocation(node));
break;
case Node::Enum:
@@ -299,7 +299,7 @@ bool HelpProjectWriter::generateSection(HelpProject &project,
details << item.name(); // "name"
details << item.name(); // "id"
}
- details << tree->fullDocumentLocation(node);
+ details << HtmlGenerator::fullDocumentLocation(node);
project.keywords.append(details);
}
}
@@ -330,7 +330,7 @@ bool HelpProjectWriter::generateSection(HelpProject &project,
if (node->relates()) {
project.memberStatus[node->relates()].insert(node->status());
- project.files.insert(tree->fullDocumentLocation(node->relates()));
+ project.files.insert(HtmlGenerator::fullDocumentLocation(node->relates()));
} else if (node->parent())
project.memberStatus[node->parent()].insert(node->status());
}
@@ -344,7 +344,7 @@ bool HelpProjectWriter::generateSection(HelpProject &project,
// Use the location of any associated enum node in preference
// to that of the typedef.
if (enumNode)
- typedefDetails[2] = tree->fullDocumentLocation(enumNode);
+ typedefDetails[2] = HtmlGenerator::fullDocumentLocation(enumNode);
project.keywords.append(typedefDetails);
}
@@ -364,11 +364,11 @@ bool HelpProjectWriter::generateSection(HelpProject &project,
QStringList details;
details << keyword->string()
<< keyword->string()
- << tree->fullDocumentLocation(node) + "#" + Doc::canonicalTitle(keyword->string());
+ << HtmlGenerator::fullDocumentLocation(node) + "#" + Doc::canonicalTitle(keyword->string());
project.keywords.append(details);
} else
fakeNode->doc().location().warning(
- tr("Bad keyword in %1").arg(tree->fullDocumentLocation(node))
+ tr("Bad keyword in %1").arg(HtmlGenerator::fullDocumentLocation(node))
);
}
}
@@ -382,16 +382,16 @@ bool HelpProjectWriter::generateSection(HelpProject &project,
QStringList details;
details << title
<< title
- << tree->fullDocumentLocation(node) + "#" + Doc::canonicalTitle(title);
+ << HtmlGenerator::fullDocumentLocation(node) + "#" + Doc::canonicalTitle(title);
project.keywords.append(details);
} else
fakeNode->doc().location().warning(
- tr("Bad contents item in %1").arg(tree->fullDocumentLocation(node))
+ tr("Bad contents item in %1").arg(HtmlGenerator::fullDocumentLocation(node))
);
}
}
*/
- project.files.insert(tree->fullDocumentLocation(node));
+ project.files.insert(HtmlGenerator::fullDocumentLocation(node));
}
break;
}
@@ -470,7 +470,7 @@ void HelpProjectWriter::generate(const Tree *tre)
void HelpProjectWriter::writeNode(HelpProject &project, QXmlStreamWriter &writer,
const Node *node)
{
- QString href = tree->fullDocumentLocation(node);
+ QString href = HtmlGenerator::fullDocumentLocation(node);
QString objName = node->name();
switch (node->type()) {
@@ -613,12 +613,12 @@ void HelpProjectWriter::generateProject(HelpProject &project)
writer.writeStartElement("toc");
writer.writeStartElement("section");
- QString indexPath = tree->fullDocumentLocation(tree->findFakeNodeByTitle(project.indexTitle));
+ QString indexPath = HtmlGenerator::fullDocumentLocation(tree->findFakeNodeByTitle(project.indexTitle));
if (indexPath.isEmpty())
indexPath = "index.html";
writer.writeAttribute("ref", HtmlGenerator::cleanRef(indexPath));
writer.writeAttribute("title", project.indexTitle);
- project.files.insert(tree->fullDocumentLocation(rootNode));
+ project.files.insert(HtmlGenerator::fullDocumentLocation(rootNode));
generateSections(project, writer, rootNode);
@@ -656,7 +656,7 @@ void HelpProjectWriter::generateProject(HelpProject &project)
const FakeNode *page = tree->findFakeNodeByTitle(atom->string());
writer.writeStartElement("section");
- QString indexPath = tree->fullDocumentLocation(page);
+ QString indexPath = HtmlGenerator::fullDocumentLocation(page);
writer.writeAttribute("ref", HtmlGenerator::cleanRef(indexPath));
writer.writeAttribute("title", atom->string());
project.files.insert(indexPath);
@@ -681,7 +681,7 @@ void HelpProjectWriter::generateProject(HelpProject &project)
if (!name.isEmpty()) {
writer.writeStartElement("section");
- QString indexPath = tree->fullDocumentLocation(tree->findFakeNodeByTitle(subproject.indexTitle));
+ QString indexPath = HtmlGenerator::fullDocumentLocation(tree->findFakeNodeByTitle(subproject.indexTitle));
writer.writeAttribute("ref", HtmlGenerator::cleanRef(indexPath));
writer.writeAttribute("title", subproject.title);
project.files.insert(indexPath);
diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp
index 196bd44..0ff28af 100644
--- a/tools/qdoc3/htmlgenerator.cpp
+++ b/tools/qdoc3/htmlgenerator.cpp
@@ -4246,6 +4246,151 @@ void HtmlGenerator::generateExtractionMark(const Node *node, ExtractionMarkType
}
}
+/*!
+ Returns the full document location for HTML-based documentation.
+ */
+QString HtmlGenerator::fullDocumentLocation(const Node *node)
+{
+ if (!node)
+ return "";
+ if (!node->url().isEmpty())
+ return node->url();
+
+ QString parentName;
+ QString anchorRef;
+
+ if (node->type() == Node::Namespace) {
+
+ // The root namespace has no name - check for this before creating
+ // an attribute containing the location of any documentation.
+
+ if (!node->fileBase().isEmpty())
+ parentName = node->fileBase() + ".html";
+ else
+ return "";
+ }
+ else if (node->type() == Node::Fake) {
+#ifdef QDOC_QML
+ if ((node->subType() == Node::QmlClass) ||
+ (node->subType() == Node::QmlBasicType)) {
+ QString fb = node->fileBase();
+ if (fb.startsWith(Generator::outputPrefix(QLatin1String("QML"))))
+ return fb + ".html";
+ else
+ return Generator::outputPrefix(QLatin1String("QML")) + node->fileBase() + QLatin1String(".html");
+ } else
+#endif
+ parentName = node->fileBase() + ".html";
+ }
+ else if (node->fileBase().isEmpty())
+ return "";
+
+ Node *parentNode = 0;
+
+ if ((parentNode = node->relates()))
+ parentName = fullDocumentLocation(node->relates());
+ else if ((parentNode = node->parent())) {
+ if (parentNode->subType() == Node::QmlPropertyGroup) {
+ parentNode = parentNode->parent();
+ parentName = fullDocumentLocation(parentNode);
+ }
+ else
+ parentName = fullDocumentLocation(node->parent());
+ }
+
+ switch (node->type()) {
+ case Node::Class:
+ case Node::Namespace:
+ if (parentNode && !parentNode->name().isEmpty())
+ parentName = parentName.replace(".html", "") + "-"
+ + node->fileBase().toLower() + ".html";
+ else
+ parentName = node->fileBase() + ".html";
+ break;
+ case Node::Function:
+ {
+ /*
+ Functions can be destructors, overloaded, or
+ have associated properties.
+ */
+ const FunctionNode *functionNode =
+ static_cast<const FunctionNode *>(node);
+
+ if (functionNode->metaness() == FunctionNode::Dtor)
+ anchorRef = "#dtor." + functionNode->name().mid(1);
+
+ else if (functionNode->associatedProperty())
+ return fullDocumentLocation(functionNode->associatedProperty());
+
+ else if (functionNode->overloadNumber() > 1)
+ anchorRef = "#" + functionNode->name()
+ + "-" + QString::number(functionNode->overloadNumber());
+ else
+ anchorRef = "#" + functionNode->name();
+ }
+
+ /*
+ Use node->name() instead of node->fileBase() as
+ the latter returns the name in lower-case. For
+ HTML anchors, we need to preserve the case.
+ */
+ break;
+ case Node::Enum:
+ anchorRef = "#" + node->name() + "-enum";
+ break;
+ case Node::Typedef:
+ anchorRef = "#" + node->name() + "-typedef";
+ break;
+ case Node::Property:
+ anchorRef = "#" + node->name() + "-prop";
+ break;
+ case Node::QmlProperty:
+ anchorRef = "#" + node->name() + "-prop";
+ break;
+ case Node::QmlSignal:
+ anchorRef = "#" + node->name() + "-signal";
+ break;
+ case Node::QmlMethod:
+ anchorRef = "#" + node->name() + "-method";
+ break;
+ case Node::Variable:
+ anchorRef = "#" + node->name() + "-var";
+ break;
+ case Node::Target:
+ anchorRef = "#" + Doc::canonicalTitle(node->name());
+ break;
+ case Node::Fake:
+ {
+ /*
+ Use node->fileBase() for fake nodes because they are represented
+ by pages whose file names are lower-case.
+ */
+ parentName = node->fileBase();
+ parentName.replace("/", "-").replace(".", "-");
+ parentName += ".html";
+ }
+ break;
+ default:
+ break;
+ }
+
+ // Various objects can be compat (deprecated) or obsolete.
+ if (node->type() != Node::Class && node->type() != Node::Namespace) {
+ switch (node->status()) {
+ case Node::Compat:
+ parentName.replace(".html", "-qt3.html");
+ break;
+ case Node::Obsolete:
+ parentName.replace(".html", "-obsolete.html");
+ break;
+ default:
+ ;
+ }
+ }
+
+ return parentName.toLower() + anchorRef;
+}
+
#endif
- QT_END_NAMESPACE
+QT_END_NAMESPACE
diff --git a/tools/qdoc3/htmlgenerator.h b/tools/qdoc3/htmlgenerator.h
index 6e00ed3..eed96e7 100644
--- a/tools/qdoc3/htmlgenerator.h
+++ b/tools/qdoc3/htmlgenerator.h
@@ -98,6 +98,7 @@ class HtmlGenerator : public PageGenerator
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]; }
+ static QString fullDocumentLocation(const Node *node);
protected:
virtual void startText(const Node *relative, CodeMarker *marker);
diff --git a/tools/qdoc3/node.cpp b/tools/qdoc3/node.cpp
index a36d440..7195322 100644
--- a/tools/qdoc3/node.cpp
+++ b/tools/qdoc3/node.cpp
@@ -1693,7 +1693,7 @@ static QString valueType(const QString& n)
read-only. The algorithm for figuring this out is long
amd tedious and almost certainly will break. It currently
doesn't work for qmlproperty bool PropertyChanges::explicit,
- because the tokenized gets confused on "explicit" .
+ because the tokenizer gets confused on "explicit".
*/
bool QmlPropertyNode::isWritable(const Tree* tree) const
{
diff --git a/tools/qdoc3/pagegenerator.cpp b/tools/qdoc3/pagegenerator.cpp
index 89ec6fe..d5564f7 100644
--- a/tools/qdoc3/pagegenerator.cpp
+++ b/tools/qdoc3/pagegenerator.cpp
@@ -206,15 +206,15 @@ QString PageGenerator::fileBase(const Node *node) const
#ifdef QDOC_QML
/*
To avoid file name conflicts in the html directory,
- we prepend "qml-" to the file name of QML element doc
- files.
+ we prepend a prefix (by default, "qml-") to the file name of QML
+ element doc files.
*/
if ((p->subType() == Node::QmlClass) ||
(p->subType() == Node::QmlBasicType)) {
if (!base.startsWith(QLatin1String("QML:")))
- base.prepend("qml-");
+ base.prepend(outputPrefix(QLatin1String("QML")));
}
-#endif
+#endif
if (!pp || pp->name().isEmpty() || pp->type() == Node::Fake)
break;
base.prepend(QLatin1Char('-'));
diff --git a/tools/qdoc3/tree.cpp b/tools/qdoc3/tree.cpp
index 5972b9f..eec6578 100644
--- a/tools/qdoc3/tree.cpp
+++ b/tools/qdoc3/tree.cpp
@@ -1226,7 +1226,7 @@ bool Tree::generateIndexSection(QXmlStreamWriter &writer,
QString fullName = fullDocumentName(node);
if (fullName != objName)
writer.writeAttribute("fullname", fullName);
- writer.writeAttribute("href", fullDocumentLocation(node));
+ writer.writeAttribute("href", HtmlGenerator::fullDocumentLocation(node));
if ((node->type() != Node::Fake) && (!node->isQmlNode()))
writer.writeAttribute("location", node->location().fileName());
@@ -1364,6 +1364,8 @@ bool Tree::generateIndexSection(QXmlStreamWriter &writer,
{
const QmlPropertyNode *qpn = static_cast<const QmlPropertyNode*>(node);
writer.writeAttribute("type", qpn->dataType());
+ writer.writeAttribute("attached", qpn->isAttached() ? "true" : "false");
+ writer.writeAttribute("writable", qpn->isWritable(this) ? "true" : "false");
}
break;
case Node::Property:
@@ -1667,7 +1669,7 @@ void Tree::generateTagFileCompounds(QXmlStreamWriter &writer,
if (node->type() == Node::Class) {
writer.writeTextElement("name", fullDocumentName(node));
- writer.writeTextElement("filename", fullDocumentLocation(node));
+ writer.writeTextElement("filename", HtmlGenerator::fullDocumentLocation(node));
// Classes contain information about their base classes.
const ClassNode *classNode = static_cast<const ClassNode*>(node);
@@ -1685,7 +1687,7 @@ void Tree::generateTagFileCompounds(QXmlStreamWriter &writer,
generateTagFileCompounds(writer, static_cast<const InnerNode *>(node));
} else {
writer.writeTextElement("name", fullDocumentName(node));
- writer.writeTextElement("filename", fullDocumentLocation(node));
+ writer.writeTextElement("filename", HtmlGenerator::fullDocumentLocation(node));
// Recurse to write all members.
generateTagFileMembers(writer, static_cast<const InnerNode *>(node));
@@ -1806,7 +1808,7 @@ void Tree::generateTagFileMembers(QXmlStreamWriter &writer,
"virtual " + functionNode->returnType());
writer.writeTextElement("name", objName);
- QStringList pieces = fullDocumentLocation(node).split("#");
+ QStringList pieces = HtmlGenerator::fullDocumentLocation(node).split("#");
writer.writeTextElement("anchorfile", pieces[0]);
writer.writeTextElement("anchor", pieces[1]);
@@ -1846,7 +1848,7 @@ void Tree::generateTagFileMembers(QXmlStreamWriter &writer,
const PropertyNode *propertyNode = static_cast<const PropertyNode*>(node);
writer.writeAttribute("type", propertyNode->dataType());
writer.writeTextElement("name", objName);
- QStringList pieces = fullDocumentLocation(node).split("#");
+ QStringList pieces = HtmlGenerator::fullDocumentLocation(node).split("#");
writer.writeTextElement("anchorfile", pieces[0]);
writer.writeTextElement("anchor", pieces[1]);
writer.writeTextElement("arglist", "");
@@ -1858,7 +1860,7 @@ void Tree::generateTagFileMembers(QXmlStreamWriter &writer,
{
const EnumNode *enumNode = static_cast<const EnumNode*>(node);
writer.writeTextElement("name", objName);
- QStringList pieces = fullDocumentLocation(node).split("#");
+ QStringList pieces = HtmlGenerator::fullDocumentLocation(node).split("#");
writer.writeTextElement("anchor", pieces[1]);
writer.writeTextElement("arglist", "");
writer.writeEndElement(); // member
@@ -1882,7 +1884,7 @@ void Tree::generateTagFileMembers(QXmlStreamWriter &writer,
else
writer.writeAttribute("type", "");
writer.writeTextElement("name", objName);
- QStringList pieces = fullDocumentLocation(node).split("#");
+ QStringList pieces = HtmlGenerator::fullDocumentLocation(node).split("#");
writer.writeTextElement("anchorfile", pieces[0]);
writer.writeTextElement("anchor", pieces[1]);
writer.writeTextElement("arglist", "");
@@ -1934,152 +1936,6 @@ void Tree::addExternalLink(const QString &url, const Node *relative)
}
/*!
- Returns the full document location for HTML-based documentation.
- This should be moved into the HTML generator.
- */
-QString Tree::fullDocumentLocation(const Node *node) const
-{
- if (!node)
- return "";
- if (!node->url().isEmpty())
- return node->url();
-
- QString parentName;
- QString anchorRef;
-
- if (node->type() == Node::Namespace) {
-
- // The root namespace has no name - check for this before creating
- // an attribute containing the location of any documentation.
-
- if (!node->fileBase().isEmpty())
- parentName = node->fileBase() + ".html";
- else
- return "";
- }
- else if (node->type() == Node::Fake) {
-#ifdef QDOC_QML
- if ((node->subType() == Node::QmlClass) ||
- (node->subType() == Node::QmlBasicType)) {
- QString fb = node->fileBase();
- if (fb.startsWith(QLatin1String("qml-")))
- return fb + ".html";
- else
- return "qml-" + node->fileBase() + ".html";
- } else
-#endif
- parentName = node->fileBase() + ".html";
- }
- else if (node->fileBase().isEmpty())
- return "";
-
- Node *parentNode = 0;
-
- if ((parentNode = node->relates()))
- parentName = fullDocumentLocation(node->relates());
- else if ((parentNode = node->parent())) {
- if (parentNode->subType() == Node::QmlPropertyGroup) {
- parentNode = parentNode->parent();
- parentName = fullDocumentLocation(parentNode);
- }
- else
- parentName = fullDocumentLocation(node->parent());
- }
-
- switch (node->type()) {
- case Node::Class:
- case Node::Namespace:
- if (parentNode && !parentNode->name().isEmpty())
- parentName = parentName.replace(".html", "") + "-"
- + node->fileBase().toLower() + ".html";
- else
- parentName = node->fileBase() + ".html";
- break;
- case Node::Function:
- {
- /*
- Functions can be destructors, overloaded, or
- have associated properties.
- */
- const FunctionNode *functionNode =
- static_cast<const FunctionNode *>(node);
-
- if (functionNode->metaness() == FunctionNode::Dtor)
- anchorRef = "#dtor." + functionNode->name().mid(1);
-
- else if (functionNode->associatedProperty())
- return fullDocumentLocation(functionNode->associatedProperty());
-
- else if (functionNode->overloadNumber() > 1)
- anchorRef = "#" + functionNode->name()
- + "-" + QString::number(functionNode->overloadNumber());
- else
- anchorRef = "#" + functionNode->name();
- }
-
- /*
- Use node->name() instead of node->fileBase() as
- the latter returns the name in lower-case. For
- HTML anchors, we need to preserve the case.
- */
- break;
- case Node::Enum:
- anchorRef = "#" + node->name() + "-enum";
- break;
- case Node::Typedef:
- anchorRef = "#" + node->name() + "-typedef";
- break;
- case Node::Property:
- anchorRef = "#" + node->name() + "-prop";
- break;
- case Node::QmlProperty:
- anchorRef = "#" + node->name() + "-prop";
- break;
- case Node::QmlSignal:
- anchorRef = "#" + node->name() + "-signal";
- break;
- case Node::QmlMethod:
- anchorRef = "#" + node->name() + "-method";
- break;
- case Node::Variable:
- anchorRef = "#" + node->name() + "-var";
- break;
- case Node::Target:
- anchorRef = "#" + Doc::canonicalTitle(node->name());
- break;
- case Node::Fake:
- {
- /*
- Use node->fileBase() for fake nodes because they are represented
- by pages whose file names are lower-case.
- */
- parentName = node->fileBase();
- parentName.replace("/", "-").replace(".", "-");
- parentName += ".html";
- }
- break;
- default:
- break;
- }
-
- // Various objects can be compat (deprecated) or obsolete.
- if (node->type() != Node::Class && node->type() != Node::Namespace) {
- switch (node->status()) {
- case Node::Compat:
- parentName.replace(".html", "-qt3.html");
- break;
- case Node::Obsolete:
- parentName.replace(".html", "-obsolete.html");
- break;
- default:
- ;
- }
- }
-
- return parentName.toLower() + anchorRef;
-}
-
-/*!
Construct the full document name for \a node and return the
name.
*/