summaryrefslogtreecommitdiffstats
path: root/src/tools
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2013-02-18 16:14:52 +0100
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2013-02-18 16:14:52 +0100
commitf4900d340a4c620b56871995741696d28e53c167 (patch)
tree66d4ed6e4e8012e8a534717e87bf15cf8a992652 /src/tools
parent7c33ae6a7bbbd42ce70acf77aa55c1bc2a23c8ec (diff)
parent843de37bca944110fdf3aab161d680e3845d2dd2 (diff)
Merge remote-tracking branch 'origin/stable' into dev
Conflicts: src/widgets/styles/qmacstyle_mac.mm Change-Id: If8326db9e7da3cbf45dbf7475fdff9915c7723b1
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/qdoc/config.h1
-rw-r--r--src/tools/qdoc/cppcodemarker.cpp10
-rw-r--r--src/tools/qdoc/cppcodeparser.cpp9
-rw-r--r--src/tools/qdoc/ditaxmlgenerator.cpp2
-rw-r--r--src/tools/qdoc/htmlgenerator.cpp62
-rw-r--r--src/tools/qdoc/htmlgenerator.h9
-rw-r--r--src/tools/qdoc/node.cpp2
-rw-r--r--src/tools/qdoc/node.h12
-rw-r--r--src/tools/qdoc/qdoc.pro2
-rw-r--r--src/tools/qdoc/qdocdatabase.cpp30
-rw-r--r--src/tools/qdoc/qdocdatabase.h1
-rw-r--r--src/tools/qdoc/qmlvisitor.cpp15
-rw-r--r--src/tools/qdoc/tree.cpp4
-rw-r--r--src/tools/tools.pro2
14 files changed, 126 insertions, 35 deletions
diff --git a/src/tools/qdoc/config.h b/src/tools/qdoc/config.h
index 2c655cdf23..521f1c12b8 100644
--- a/src/tools/qdoc/config.h
+++ b/src/tools/qdoc/config.h
@@ -188,6 +188,7 @@ private:
#define CONFIG_INDEXES "indexes"
#define CONFIG_LANGUAGE "language"
#define CONFIG_MACRO "macro"
+#define CONFIG_MANIFESTMETA "manifestmeta"
#define CONFIG_NATURALLANGUAGE "naturallanguage"
#define CONFIG_NOLINKERRORS "nolinkerrors"
#define CONFIG_OBSOLETELINKS "obsoletelinks"
diff --git a/src/tools/qdoc/cppcodemarker.cpp b/src/tools/qdoc/cppcodemarker.cpp
index 0bebe0d670..c85c5c64ef 100644
--- a/src/tools/qdoc/cppcodemarker.cpp
+++ b/src/tools/qdoc/cppcodemarker.cpp
@@ -1165,8 +1165,8 @@ QList<Section> CppCodeMarker::qmlSections(const QmlClassNode* qmlClassNode, Syno
}
++c;
}
- if (qcn->qmlBase() != 0) {
- qcn = static_cast<const QmlClassNode*>(qcn->qmlBase());
+ if (qcn->qmlBaseNode() != 0) {
+ qcn = static_cast<const QmlClassNode*>(qcn->qmlBaseNode());
if (!qcn->isAbstract())
qcn = 0;
}
@@ -1241,8 +1241,8 @@ QList<Section> CppCodeMarker::qmlSections(const QmlClassNode* qmlClassNode, Syno
}
++c;
}
- if (qcn->qmlBase() != 0) {
- qcn = static_cast<const QmlClassNode*>(qcn->qmlBase());
+ if (qcn->qmlBaseNode() != 0) {
+ qcn = static_cast<const QmlClassNode*>(qcn->qmlBaseNode());
if (!qcn->isAbstract())
qcn = 0;
}
@@ -1287,7 +1287,7 @@ QList<Section> CppCodeMarker::qmlSections(const QmlClassNode* qmlClassNode, Syno
}
++c;
}
- const DocNode* dn = current->qmlBase();
+ const DocNode* dn = current->qmlBaseNode();
if (dn) {
if (dn->subType() == Node::QmlClass)
current = static_cast<const QmlClassNode*>(dn);
diff --git a/src/tools/qdoc/cppcodeparser.cpp b/src/tools/qdoc/cppcodeparser.cpp
index 0af5a841eb..68edb1336a 100644
--- a/src/tools/qdoc/cppcodeparser.cpp
+++ b/src/tools/qdoc/cppcodeparser.cpp
@@ -951,11 +951,10 @@ void CppCodeParser::processOtherMetaCommand(const Doc& doc,
else if (command == COMMAND_QMLINHERITS) {
if (node->name() == arg)
doc.location().warning(tr("%1 tries to inherit itself").arg(arg));
- else {
- setLink(node, Node::InheritsLink, arg);
- if (node->subType() == Node::QmlClass) {
- QmlClassNode::addInheritedBy(arg,node);
- }
+ else if (node->subType() == Node::QmlClass) {
+ QmlClassNode *qmlClass = static_cast<QmlClassNode*>(node);
+ qmlClass->setQmlBaseName(arg);
+ QmlClassNode::addInheritedBy(arg,node);
}
}
else if (command == COMMAND_QMLINSTANTIATES) {
diff --git a/src/tools/qdoc/ditaxmlgenerator.cpp b/src/tools/qdoc/ditaxmlgenerator.cpp
index 43d3a8071d..22694dd0d3 100644
--- a/src/tools/qdoc/ditaxmlgenerator.cpp
+++ b/src/tools/qdoc/ditaxmlgenerator.cpp
@@ -4198,7 +4198,7 @@ void DitaXmlGenerator::generateQmlInherits(const QmlClassNode* qcn, CodeMarker*
{
if (!qcn)
return;
- const DocNode* base = qcn->qmlBase();
+ const DocNode* base = qcn->qmlBaseNode();
if (base) {
writeStartTag(DT_qmlInherits);
//writeStartTag(DT_qmlTypeDef);
diff --git a/src/tools/qdoc/htmlgenerator.cpp b/src/tools/qdoc/htmlgenerator.cpp
index 8052558dc6..2666f10eb4 100644
--- a/src/tools/qdoc/htmlgenerator.cpp
+++ b/src/tools/qdoc/htmlgenerator.cpp
@@ -223,6 +223,7 @@ void HtmlGenerator::initializeGenerator(const Config &config)
QString prefix = CONFIG_QHP + Config::dot + project + Config::dot;
manifestDir = "qthelp://" + config.getString(prefix + "namespace");
manifestDir += QLatin1Char('/') + config.getString(prefix + "virtualFolder") + QLatin1Char('/');
+ readManifestMetaContent(config);
examplesPath = config.getString(CONFIG_EXAMPLESINSTALLPATH);
if (!examplesPath.isEmpty())
examplesPath += QLatin1Char('/');
@@ -3869,7 +3870,7 @@ void HtmlGenerator::generateQmlInherits(const QmlClassNode* qcn, CodeMarker* mar
{
if (!qcn)
return;
- const DocNode* base = qcn->qmlBase();
+ const DocNode* base = qcn->qmlBaseNode();
if (base) {
Text text;
text << Atom::ParaLeft << "Inherits ";
@@ -3991,10 +3992,11 @@ void HtmlGenerator::generateManifestFiles()
generateManifestFile("examples", "example");
generateManifestFile("demos", "demo");
ExampleNode::exampleNodeMap.clear();
+ manifestMetaContent.clear();
}
/*!
- This function is called by generaqteManiferstFile(), once
+ This function is called by generateManifestFiles(), once
for each manifest file to be generated. \a manifest is the
type of manifest file.
*/
@@ -4086,6 +4088,36 @@ void HtmlGenerator::generateManifestFile(QString manifest, QString element)
}
if (!en->imageFileName().isEmpty())
writer.writeAttribute("imageUrl", manifestDir + en->imageFileName());
+
+ QString fullName = project + QLatin1Char('/') + en->title();
+ QSet<QString> tags;
+ for (int idx=0; idx < manifestMetaContent.size(); ++idx) {
+ foreach (const QString &name, manifestMetaContent[idx].names) {
+ bool match = false;
+ int wildcard = name.indexOf(QChar('*'));
+ switch (wildcard) {
+ case -1: // no wildcard, exact match
+ match = (fullName == name);
+ break;
+ case 0: // '*' matches all
+ match = true;
+ break;
+ default: // match with wildcard at the end
+ match = fullName.startsWith(name.left(wildcard));
+ }
+ if (match) {
+ tags += manifestMetaContent[idx].tags;
+ foreach (const QString &attr, manifestMetaContent[idx].attributes) {
+ QStringList attrList = attr.split(QLatin1Char(':'), QString::SkipEmptyParts);
+ if (attrList.count() == 1)
+ attrList.append(QStringLiteral("true"));
+ if (attrList.count() == 2)
+ writer.writeAttribute(attrList[0], attrList[1]);
+ }
+ }
+ }
+ }
+
writer.writeStartElement("description");
Text brief = en->doc().briefText();
if (!brief.isEmpty())
@@ -4093,12 +4125,11 @@ void HtmlGenerator::generateManifestFile(QString manifest, QString element)
else
writer.writeCDATA(QString("No description available"));
writer.writeEndElement(); // description
- QStringList tags = en->title().toLower().split(QLatin1Char(' '));
+ tags += QSet<QString>::fromList(en->title().toLower().split(QLatin1Char(' ')));
if (!tags.isEmpty()) {
writer.writeStartElement("tags");
bool wrote_one = false;
- for (int n=0; n<tags.size(); ++n) {
- QString tag = tags.at(n);
+ foreach (QString tag, tags) {
if (tag.at(0).isDigit())
continue;
if (tag.at(0) == '-')
@@ -4109,7 +4140,7 @@ void HtmlGenerator::generateManifestFile(QString manifest, QString element)
continue;
if (tag.endsWith(QLatin1Char(':')))
tag.chop(1);
- if (n>0 && wrote_one)
+ if (wrote_one)
writer.writeCharacters(",");
writer.writeCharacters(tag);
wrote_one = true;
@@ -4163,6 +4194,25 @@ void HtmlGenerator::generateManifestFile(QString manifest, QString element)
}
/*!
+ Reads metacontent - additional attributes and tags to apply
+ when generating manifest files, read from config. Takes the
+ configuration class \a config as a parameter.
+ */
+void HtmlGenerator::readManifestMetaContent(const Config &config)
+{
+ QStringList names = config.getStringList(CONFIG_MANIFESTMETA + Config::dot + QStringLiteral("filters"));
+
+ foreach (const QString &manifest, names) {
+ ManifestMetaFilter filter;
+ QString prefix = CONFIG_MANIFESTMETA + Config::dot + manifest + Config::dot;
+ filter.names = config.getStringSet(prefix + QStringLiteral("names"));
+ filter.attributes = config.getStringSet(prefix + QStringLiteral("attributes"));
+ filter.tags = config.getStringSet(prefix + QStringLiteral("tags"));
+ manifestMetaContent.append(filter);
+ }
+}
+
+/*!
Find global entities that have documentation but no
\e{relates} comand. Report these as errors if they
are not also marked \e {internal}.
diff --git a/src/tools/qdoc/htmlgenerator.h b/src/tools/qdoc/htmlgenerator.h
index 65d874f619..f2efab78a1 100644
--- a/src/tools/qdoc/htmlgenerator.h
+++ b/src/tools/qdoc/htmlgenerator.h
@@ -108,6 +108,7 @@ protected:
virtual QString linkForNode(const Node *node, const Node *relative);
void generateManifestFile(QString manifest, QString element);
+ void readManifestMetaContent(const Config &config);
private:
enum SubTitleSize { SmallSubTitle, LargeSubTitle };
@@ -118,6 +119,13 @@ private:
EndMark
};
+ struct ManifestMetaFilter
+ {
+ QSet<QString> names;
+ QSet<QString> attributes;
+ QSet<QString> tags;
+ };
+
const QPair<QString,QString> anchorForNode(const Node *node);
void generateBreadCrumbs(const QString& title,
const Node *node,
@@ -242,6 +250,7 @@ private:
bool obsoleteLinks;
QStack<QXmlStreamWriter*> xmlWriterStack;
static int id;
+ QList<ManifestMetaFilter> manifestMetaContent;
public:
static bool debugging_on;
static QString divNavTop;
diff --git a/src/tools/qdoc/node.cpp b/src/tools/qdoc/node.cpp
index 0fb9ccc97f..5fbdb487db 100644
--- a/src/tools/qdoc/node.cpp
+++ b/src/tools/qdoc/node.cpp
@@ -2097,7 +2097,7 @@ QmlClassNode::QmlClassNode(InnerNode *parent, const QString& name)
abstract_(false),
cnodeRequired_(false),
cnode_(0),
- base_(0)
+ baseNode_(0)
{
int i = 0;
if (name.startsWith("QML:")) {
diff --git a/src/tools/qdoc/node.h b/src/tools/qdoc/node.h
index 11c08fb659..ecb3c5771e 100644
--- a/src/tools/qdoc/node.h
+++ b/src/tools/qdoc/node.h
@@ -131,8 +131,7 @@ public:
NextLink,
PreviousLink,
ContentsLink,
- IndexLink,
- InheritsLink /*,
+ IndexLink /*,
GlossaryLink,
CopyrightLink,
ChapterLink,
@@ -546,8 +545,10 @@ public:
virtual void setAbstract(bool b) { abstract_ = b; }
const ImportList& importList() const { return importList_; }
void setImportList(const ImportList& il) { importList_ = il; }
- const DocNode* qmlBase() const { return base_; }
- void setQmlBase(DocNode* b) { base_ = b; }
+ const QString& qmlBaseName() const { return baseName_; }
+ void setQmlBaseName(const QString& name) { baseName_ = name; }
+ const DocNode* qmlBaseNode() const { return baseNode_; }
+ void setQmlBaseNode(DocNode* b) { baseNode_ = b; }
void requireCppClass() { cnodeRequired_ = true; }
bool cppClassRequired() const { return cnodeRequired_; }
static void addInheritedBy(const QString& base, Node* sub);
@@ -562,7 +563,8 @@ private:
bool abstract_;
bool cnodeRequired_;
ClassNode* cnode_;
- DocNode* base_;
+ QString baseName_;
+ DocNode* baseNode_;
ImportList importList_;
};
diff --git a/src/tools/qdoc/qdoc.pro b/src/tools/qdoc/qdoc.pro
index 9729a758f0..9df79ec718 100644
--- a/src/tools/qdoc/qdoc.pro
+++ b/src/tools/qdoc/qdoc.pro
@@ -91,3 +91,5 @@ qtPrepareTool(QHELPGENERATOR, qhelpgenerator)
QMAKE_DOCS = $$PWD/doc/config/qdoc.qdocconf
load(qt_tool)
+
+TR_EXCLUDE += $$PWD/*
diff --git a/src/tools/qdoc/qdocdatabase.cpp b/src/tools/qdoc/qdocdatabase.cpp
index 982df5bbc3..4208d529c8 100644
--- a/src/tools/qdoc/qdocdatabase.cpp
+++ b/src/tools/qdoc/qdocdatabase.cpp
@@ -623,6 +623,7 @@ const NodeMultiMap& QDocDatabase::getSinceMap(const QString& key) const
to generating documentation.
*/
void QDocDatabase::resolveIssues() {
+ resolveQmlInheritance(treeRoot());
resolveTargets(treeRoot());
tree_->resolveCppToQmlLinks();
}
@@ -822,6 +823,35 @@ QString QDocDatabase::findTarget(const QString& target, const Node* node) const
}
/*!
+ For each QML Type node in the tree beginning at \a root,
+ if it has a QML base type name but its QML base type node
+ pointer is 0, use the QML base type name to look up the
+ base type node. If the node is found in the tree, set the
+ node's QML base type node pointer.
+ */
+void QDocDatabase::resolveQmlInheritance(InnerNode* root)
+{
+ // Dop we need recursion?
+ foreach (Node* child, root->childNodes()) {
+ if (child->type() == Node::Document && child->subType() == Node::QmlClass) {
+ QmlClassNode* qcn = static_cast<QmlClassNode*>(child);
+ if ((qcn->qmlBaseNode() == 0) && !qcn->qmlBaseName().isEmpty()) {
+ QmlClassNode* bqcn = findQmlType(QString(), qcn->qmlBaseName());
+ if (bqcn) {
+ qcn->setQmlBaseNode(bqcn);
+ }
+#if 0
+ else {
+ qDebug() << "Unable to resolve QML base type:" << qcn->qmlBaseName()
+ << "for QML type:" << qcn->name();
+ }
+#endif
+ }
+ }
+ }
+}
+
+/*!
*/
void QDocDatabase::resolveTargets(InnerNode* root)
{
diff --git a/src/tools/qdoc/qdocdatabase.h b/src/tools/qdoc/qdocdatabase.h
index 857fd301bb..9c6810941d 100644
--- a/src/tools/qdoc/qdocdatabase.h
+++ b/src/tools/qdoc/qdocdatabase.h
@@ -140,6 +140,7 @@ class QDocDatabase
Tree* tree() { return tree_; }
NamespaceNode* treeRoot() { return tree_->root(); }
void resolveInheritance() { tree_->resolveInheritance(); }
+ void resolveQmlInheritance(InnerNode* root);
void resolveIssues();
void fixInheritance() { tree_->fixInheritance(); }
void resolveProperties() { tree_->resolveProperties(); }
diff --git a/src/tools/qdoc/qmlvisitor.cpp b/src/tools/qdoc/qmlvisitor.cpp
index 9dc15d56f1..15af03d9ba 100644
--- a/src/tools/qdoc/qmlvisitor.cpp
+++ b/src/tools/qdoc/qmlvisitor.cpp
@@ -106,7 +106,7 @@ QmlDocVisitor::~QmlDocVisitor()
}
/*!
- Returns the location of thre nearest comment above the \a offset.
+ Returns the location of the nearest comment above the \a offset.
*/
QQmlJS::AST::SourceLocation QmlDocVisitor::precedingComment(quint32 offset) const
{
@@ -322,11 +322,10 @@ void QmlDocVisitor::applyMetacommands(QQmlJS::AST::SourceLocation,
else if (command == COMMAND_QMLINHERITS) {
if (node->name() == args[0].first)
doc.location().warning(tr("%1 tries to inherit itself").arg(args[0].first));
- else {
- CodeParser::setLink(node, Node::InheritsLink, args[0].first);
- if (node->subType() == Node::QmlClass) {
- QmlClassNode::addInheritedBy(args[0].first,node);
- }
+ else if (node->subType() == Node::QmlClass) {
+ QmlClassNode *qmlClass = static_cast<QmlClassNode*>(node);
+ qmlClass->setQmlBaseName(args[0].first);
+ QmlClassNode::addInheritedBy(args[0].first,node);
}
}
else if (command == COMMAND_QMLDEFAULT) {
@@ -389,11 +388,9 @@ bool QmlDocVisitor::visit(QQmlJS::AST::UiObjectDefinition *definition)
QmlClassNode *component = new QmlClassNode(current, name);
component->setTitle(name);
component->setImportList(importList);
-
if (applyDocumentation(definition->firstSourceLocation(), component)) {
QmlClassNode::addInheritedBy(type, component);
- if (!component->links().contains(Node::InheritsLink))
- component->setLink(Node::InheritsLink, type, type);
+ component->setQmlBaseName(type);
}
current = component;
}
diff --git a/src/tools/qdoc/tree.cpp b/src/tools/qdoc/tree.cpp
index ea1d2a92e2..1efab11a92 100644
--- a/src/tools/qdoc/tree.cpp
+++ b/src/tools/qdoc/tree.cpp
@@ -399,10 +399,12 @@ void Tree::addPropertyFunction(PropertyNode* property,
/*!
This function resolves inheritance and reimplementation settings
- for each class node found in the namspace beginning ar \a rootNode.
+ for each C++ class node found in the namspace beginning at \a rootNode.
If it finds another namespace node in the child list of \a rootNode,
it calls itself recursively. For each child of \a rootNode that is a
class node, it calls the other resolveInheritance() function.
+
+ This function does not resolve QML inheritance.
*/
void Tree::resolveInheritance(NamespaceNode* rootNode)
{
diff --git a/src/tools/tools.pro b/src/tools/tools.pro
index c3a9ea228e..fa9ed54c50 100644
--- a/src/tools/tools.pro
+++ b/src/tools/tools.pro
@@ -41,5 +41,3 @@ SUBDIRS = $$TOOLS_SUBDIRS
bootstrap_prepare_docs.depends += $${src_tools_qdoc.target}-make_first
bootstrap_prepare_docs.target = $${src_tools_bootstrap.target}-prepare_docs
QMAKE_EXTRA_TARGETS += bootstrap_prepare_docs
-
-TR_EXCLUDE += $$PWD/*