From a6a4f5343ac67a4921c86fa70fc1ae49b1ef3b7d Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 21 Nov 2011 12:51:01 +0100 Subject: qdoc3: qdoc supports \depends in 4.8 This is what you write... /*! \example designer/calculatorbuilder \depends examples/qmlapplicationviewer \title Calculator Builder Example This is what you get... calculator,builder designer/calculatorbuilder/main.cpp ../../examples/qmlapplicationviewer Task-number: QTBUG-22838 --- tools/qdoc3/codeparser.cpp | 5 +++++ tools/qdoc3/htmlgenerator.cpp | 8 ++++++++ tools/qdoc3/node.h | 4 ++++ 3 files changed, 17 insertions(+) diff --git a/tools/qdoc3/codeparser.cpp b/tools/qdoc3/codeparser.cpp index 9ab5f82..9bf9c14 100644 --- a/tools/qdoc3/codeparser.cpp +++ b/tools/qdoc3/codeparser.cpp @@ -51,6 +51,7 @@ QT_BEGIN_NAMESPACE #define COMMAND_COMPAT Doc::alias(QLatin1String("compat")) +#define COMMAND_DEPENDS Doc::alias(QLatin1String("depends")) #define COMMAND_DEPRECATED Doc::alias(QLatin1String("deprecated")) // ### don't document #define COMMAND_INGROUP Doc::alias(QLatin1String("ingroup")) #define COMMAND_INMODULE Doc::alias(QLatin1String("inmodule")) // ### don't document @@ -200,6 +201,7 @@ CodeParser *CodeParser::parserForSourceFile(const QString &filePath) QSet CodeParser::commonMetaCommands() { return QSet() << COMMAND_COMPAT + << COMMAND_DEPENDS << COMMAND_DEPRECATED << COMMAND_INGROUP << COMMAND_INMODULE @@ -231,6 +233,9 @@ void CodeParser::processCommonMetaCommand(const Location &location, if (command == COMMAND_COMPAT) { node->setStatus(Node::Compat); } + else if (command == COMMAND_DEPENDS) { + node->addDependency(arg); + } else if (command == COMMAND_DEPRECATED) { node->setStatus(Node::Deprecated); } diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 923d523..a840c93 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -4483,6 +4483,14 @@ void HtmlGenerator::generateManifestFile(QString manifest, QString element) } } } + if (!en->dependencies().isEmpty()) { + for (int idx=0; idxdependencies().size(); ++idx) { + writer.writeStartElement("depends"); + QString file = "../../" + en->dependencies()[idx]; + writer.writeCharacters(file); + writer.writeEndElement(); // depends + } + } writer.writeEndElement(); // example ++i; } diff --git a/tools/qdoc3/node.h b/tools/qdoc3/node.h index a08151a..60636d1 100644 --- a/tools/qdoc3/node.h +++ b/tools/qdoc3/node.h @@ -167,6 +167,7 @@ class Node void setTemplateStuff(const QString &templateStuff) { tpl = templateStuff; } void setPageType(PageType t) { pageTyp = t; } void setPageType(const QString& t); + virtual void addDependency(const QString& ) { } virtual bool isInnerNode() const = 0; virtual bool isReimp() const { return false; } @@ -409,12 +410,15 @@ class ExampleNode : public FakeNode virtual ~ExampleNode() { } virtual QString imageFileName() const { return imageFileName_; } virtual void setImageFileName(const QString& ifn) { imageFileName_ = ifn; } + virtual void addDependency(const QString& arg) { dependencies_.append(arg); } + const QStringList& dependencies() const { return dependencies_; } public: static ExampleNodeMap exampleNodeMap; private: QString imageFileName_; + QStringList dependencies_; }; class QmlClassNode : public FakeNode -- cgit v0.12 From b9f0c6c8026f5f7f6924a42ded8f73f1c9cd9b75 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Mon, 21 Nov 2011 13:38:13 +0100 Subject: qdoc3: qdoc supports \depends in 4.8 This is what you write... /*! \example designer/calculatorbuilder \depends qmlapplicationviewer \title Calculator Builder Example This is what you get... calculator,builder designer/calculatorbuilder/main.cpp $QTDIR/examples/qmlapplicationviewer Task-number: QTBUG-22838 --- tools/qdoc3/htmlgenerator.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index a840c93..f1c0b8f 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -4485,10 +4485,15 @@ void HtmlGenerator::generateManifestFile(QString manifest, QString element) } if (!en->dependencies().isEmpty()) { for (int idx=0; idxdependencies().size(); ++idx) { - writer.writeStartElement("depends"); - QString file = "../../" + en->dependencies()[idx]; + writer.writeStartElement("dependency"); + QString file = "$QTDIR/"; + if (demos) + file += "demos/"; + else + file += "examples/"; + file += en->dependencies()[idx]; writer.writeCharacters(file); - writer.writeEndElement(); // depends + writer.writeEndElement(); // dependency } } writer.writeEndElement(); // example -- cgit v0.12