diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2011-04-06 22:41:16 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2011-04-06 22:41:16 (GMT) |
commit | f9fce9b432bfcb5c2f48b2b34056a63bd805d8d3 (patch) | |
tree | 01cdd02ff5c5c1b2c7dccaabf7addcb940feb7cd /tools | |
parent | 3ec5f0c801645cf8beac52f7eab0c97190f9b46d (diff) | |
parent | 4409d1b454f02fa1e5e07560a1db6012074172eb (diff) | |
download | Qt-f9fce9b432bfcb5c2f48b2b34056a63bd805d8d3.zip Qt-f9fce9b432bfcb5c2f48b2b34056a63bd805d8d3.tar.gz Qt-f9fce9b432bfcb5c2f48b2b34056a63bd805d8d3.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-doc-staging into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-doc-staging:
Fixed the declarative headers and includes within qdoc.
Removed invalid public slots section.
Minor feature fix led to refactoring for i18n's sake.
Fixed string-int concatenation issue.
qdoc: Allowed multiple values for certain metadata tags.
qdoc: modified \include to take a 2nd arg, snippet id.
Doc: Minor fix to title.
Doc: Fixed markup.
Doc: Added a missing command.
Doc: Removed duplicate documentation.
Removed some links and prettified others.
Doc: Squashed commit of Roland Wolf's threading tutorial.
Diffstat (limited to 'tools')
34 files changed, 357 insertions, 145 deletions
diff --git a/tools/qdoc3/config.cpp b/tools/qdoc3/config.cpp index 267a09c..838f6ac 100644 --- a/tools/qdoc3/config.cpp +++ b/tools/qdoc3/config.cpp @@ -338,7 +338,7 @@ QSet<QString> Config::subVars(const QString& var) const { QSet<QString> result; QString varDot = var + QLatin1Char('.'); - QMap<QString, QString>::ConstIterator v = stringValueMap.begin(); + QStringMultiMap::ConstIterator v = stringValueMap.begin(); while (v != stringValueMap.end()) { if (v.key().startsWith(varDot)) { QString subVar = v.key().mid(varDot.length()); @@ -357,10 +357,10 @@ QSet<QString> Config::subVars(const QString& var) const with the matching keys (stripped of the prefix \a var and mapped to their values. The pairs are inserted into \a t */ -void Config::subVarsAndValues(const QString& var, QStringMap& t) const +void Config::subVarsAndValues(const QString& var, QStringMultiMap& t) const { QString varDot = var + QLatin1Char('.'); - QMap<QString, QString>::ConstIterator v = stringValueMap.begin(); + QStringMultiMap::ConstIterator v = stringValueMap.begin(); while (v != stringValueMap.end()) { if (v.key().startsWith(varDot)) { QString subVar = v.key().mid(varDot.length()); diff --git a/tools/qdoc3/config.h b/tools/qdoc3/config.h index 767acb1..8e19ed2 100644 --- a/tools/qdoc3/config.h +++ b/tools/qdoc3/config.h @@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE -typedef QMap<QString,QString> QStringMap; +typedef QMultiMap<QString, QString> QStringMultiMap; class Config { @@ -76,7 +76,7 @@ class Config QRegExp getRegExp(const QString& var) const; QList<QRegExp> getRegExpList(const QString& var) const; QSet<QString> subVars(const QString& var) const; - void subVarsAndValues(const QString& var, QStringMap& t) const; + void subVarsAndValues(const QString& var, QStringMultiMap& t) const; QStringList getAllFiles(const QString& filesVar, const QString& dirsVar, const QSet<QString> &excludedDirs = QSet<QString>()); diff --git a/tools/qdoc3/declarativeparser/qdeclarativejsast.cpp b/tools/qdoc3/declarativeparser/qdeclarativejsast.cpp index afb399a..e59ffd7 100644 --- a/tools/qdoc3/declarativeparser/qdeclarativejsast.cpp +++ b/tools/qdoc3/declarativeparser/qdeclarativejsast.cpp @@ -39,9 +39,9 @@ ** ****************************************************************************/ -#include "private/qdeclarativejsast_p.h" +#include "qdeclarativejsast_p.h" -#include "private/qdeclarativejsastvisitor_p.h" +#include "qdeclarativejsastvisitor_p.h" QT_QML_BEGIN_NAMESPACE diff --git a/tools/qdoc3/declarativeparser/qdeclarativejsast_p.h b/tools/qdoc3/declarativeparser/qdeclarativejsast_p.h index 956d6e7..cd41187 100644 --- a/tools/qdoc3/declarativeparser/qdeclarativejsast_p.h +++ b/tools/qdoc3/declarativeparser/qdeclarativejsast_p.h @@ -53,8 +53,8 @@ // We mean it. // -#include "private/qdeclarativejsastvisitor_p.h" -#include "private/qdeclarativejsglobal_p.h" +#include "qdeclarativejsastvisitor_p.h" +#include "qdeclarativejsglobal_p.h" #include <QtCore/QString> diff --git a/tools/qdoc3/declarativeparser/qdeclarativejsastfwd_p.h b/tools/qdoc3/declarativeparser/qdeclarativejsastfwd_p.h index 8a20ab2..8344d54 100644 --- a/tools/qdoc3/declarativeparser/qdeclarativejsastfwd_p.h +++ b/tools/qdoc3/declarativeparser/qdeclarativejsastfwd_p.h @@ -42,7 +42,7 @@ #ifndef QDECLARATIVEJSAST_FWD_P_H #define QDECLARATIVEJSAST_FWD_P_H -#include "private/qdeclarativejsglobal_p.h" +#include "qdeclarativejsglobal_p.h" #include <QtCore/qglobal.h> diff --git a/tools/qdoc3/declarativeparser/qdeclarativejsastvisitor.cpp b/tools/qdoc3/declarativeparser/qdeclarativejsastvisitor.cpp index 8df755a..b4eecc1 100644 --- a/tools/qdoc3/declarativeparser/qdeclarativejsastvisitor.cpp +++ b/tools/qdoc3/declarativeparser/qdeclarativejsastvisitor.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "private/qdeclarativejsastvisitor_p.h" +#include "qdeclarativejsastvisitor_p.h" QT_QML_BEGIN_NAMESPACE diff --git a/tools/qdoc3/declarativeparser/qdeclarativejsastvisitor_p.h b/tools/qdoc3/declarativeparser/qdeclarativejsastvisitor_p.h index 519b8c8..6ef7c81 100644 --- a/tools/qdoc3/declarativeparser/qdeclarativejsastvisitor_p.h +++ b/tools/qdoc3/declarativeparser/qdeclarativejsastvisitor_p.h @@ -53,8 +53,8 @@ // We mean it. // -#include "private/qdeclarativejsastfwd_p.h" -#include "private/qdeclarativejsglobal_p.h" +#include "qdeclarativejsastfwd_p.h" +#include "qdeclarativejsglobal_p.h" QT_QML_BEGIN_NAMESPACE diff --git a/tools/qdoc3/declarativeparser/qdeclarativejsengine_p.cpp b/tools/qdoc3/declarativeparser/qdeclarativejsengine_p.cpp index ec9271a..4d135c2 100644 --- a/tools/qdoc3/declarativeparser/qdeclarativejsengine_p.cpp +++ b/tools/qdoc3/declarativeparser/qdeclarativejsengine_p.cpp @@ -39,10 +39,10 @@ ** ****************************************************************************/ -#include "private/qdeclarativejsengine_p.h" +#include "qdeclarativejsengine_p.h" -#include "private/qdeclarativejsglobal_p.h" -#include "private/qdeclarativejsnodepool_p.h" +#include "qdeclarativejsglobal_p.h" +#include "qdeclarativejsnodepool_p.h" #include <qnumeric.h> #include <QHash> diff --git a/tools/qdoc3/declarativeparser/qdeclarativejsengine_p.h b/tools/qdoc3/declarativeparser/qdeclarativejsengine_p.h index 6c18b50..c6126ea 100644 --- a/tools/qdoc3/declarativeparser/qdeclarativejsengine_p.h +++ b/tools/qdoc3/declarativeparser/qdeclarativejsengine_p.h @@ -53,8 +53,8 @@ // We mean it. // -#include "private/qdeclarativejsglobal_p.h" -#include "private/qdeclarativejsastfwd_p.h" +#include "qdeclarativejsglobal_p.h" +#include "qdeclarativejsastfwd_p.h" #include <QString> #include <QSet> diff --git a/tools/qdoc3/declarativeparser/qdeclarativejslexer.cpp b/tools/qdoc3/declarativeparser/qdeclarativejslexer.cpp index 4dfef45..f5fb791 100644 --- a/tools/qdoc3/declarativeparser/qdeclarativejslexer.cpp +++ b/tools/qdoc3/declarativeparser/qdeclarativejslexer.cpp @@ -43,11 +43,11 @@ #include <config.h> #endif -#include "private/qdeclarativejslexer_p.h" +#include "qdeclarativejslexer_p.h" -#include "private/qdeclarativejsglobal_p.h" -#include "private/qdeclarativejsengine_p.h" -#include "private/qdeclarativejsgrammar_p.h" +#include "qdeclarativejsglobal_p.h" +#include "qdeclarativejsengine_p.h" +#include "qdeclarativejsgrammar_p.h" #include <QtCore/qcoreapplication.h> diff --git a/tools/qdoc3/declarativeparser/qdeclarativejslexer_p.h b/tools/qdoc3/declarativeparser/qdeclarativejslexer_p.h index e41337d..8febb54 100644 --- a/tools/qdoc3/declarativeparser/qdeclarativejslexer_p.h +++ b/tools/qdoc3/declarativeparser/qdeclarativejslexer_p.h @@ -53,7 +53,7 @@ // We mean it. // -#include "private/qdeclarativejsglobal_p.h" +#include "qdeclarativejsglobal_p.h" #include <QtCore/QString> diff --git a/tools/qdoc3/declarativeparser/qdeclarativejsmemorypool_p.h b/tools/qdoc3/declarativeparser/qdeclarativejsmemorypool_p.h index 7eea975..ebf75d1 100644 --- a/tools/qdoc3/declarativeparser/qdeclarativejsmemorypool_p.h +++ b/tools/qdoc3/declarativeparser/qdeclarativejsmemorypool_p.h @@ -53,7 +53,7 @@ // We mean it. // -#include "private/qdeclarativejsglobal_p.h" +#include "qdeclarativejsglobal_p.h" #include <QtCore/qglobal.h> #include <QtCore/qshareddata.h> diff --git a/tools/qdoc3/declarativeparser/qdeclarativejsnodepool_p.h b/tools/qdoc3/declarativeparser/qdeclarativejsnodepool_p.h index fde4897..ca3841c 100644 --- a/tools/qdoc3/declarativeparser/qdeclarativejsnodepool_p.h +++ b/tools/qdoc3/declarativeparser/qdeclarativejsnodepool_p.h @@ -53,8 +53,8 @@ // We mean it. // -#include "private/qdeclarativejsglobal_p.h" -#include "private/qdeclarativejsmemorypool_p.h" +#include "qdeclarativejsglobal_p.h" +#include "qdeclarativejsmemorypool_p.h" #include <QtCore/QHash> #include <QtCore/QString> diff --git a/tools/qdoc3/declarativeparser/qdeclarativejsparser.cpp b/tools/qdoc3/declarativeparser/qdeclarativejsparser.cpp index 9a93fa1..118dcc6 100644 --- a/tools/qdoc3/declarativeparser/qdeclarativejsparser.cpp +++ b/tools/qdoc3/declarativeparser/qdeclarativejsparser.cpp @@ -44,14 +44,14 @@ #include <string.h> -#include "private/qdeclarativejsengine_p.h" -#include "private/qdeclarativejslexer_p.h" -#include "private/qdeclarativejsast_p.h" -#include "private/qdeclarativejsnodepool_p.h" +#include "qdeclarativejsengine_p.h" +#include "qdeclarativejslexer_p.h" +#include "qdeclarativejsast_p.h" +#include "qdeclarativejsnodepool_p.h" -#include "private/qdeclarativejsparser_p.h" +#include "qdeclarativejsparser_p.h" #include <QVarLengthArray> // diff --git a/tools/qdoc3/declarativeparser/qdeclarativejsparser_p.h b/tools/qdoc3/declarativeparser/qdeclarativejsparser_p.h index ad46bff..5eec1a4 100644 --- a/tools/qdoc3/declarativeparser/qdeclarativejsparser_p.h +++ b/tools/qdoc3/declarativeparser/qdeclarativejsparser_p.h @@ -59,10 +59,10 @@ #ifndef QDECLARATIVEJSPARSER_P_H #define QDECLARATIVEJSPARSER_P_H -#include "private/qdeclarativejsglobal_p.h" -#include "private/qdeclarativejsgrammar_p.h" -#include "private/qdeclarativejsast_p.h" -#include "private/qdeclarativejsengine_p.h" +#include "qdeclarativejsglobal_p.h" +#include "qdeclarativejsgrammar_p.h" +#include "qdeclarativejsast_p.h" +#include "qdeclarativejsengine_p.h" #include <QtCore/QList> #include <QtCore/QString> diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index 4b4f776..1bc4992 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -5566,24 +5566,12 @@ void DitaXmlGenerator::writeDitaMap() \note If \a t is found in the metadata map, it is erased. i.e. Once you call this function for a particular \a t, you consume \a t. - - At the moment, it doesn't chaeck to see if there is a - default value for the tag. But it will eventually. */ bool DitaXmlGenerator::writeMetadataElement(const InnerNode* inner, DitaXmlGenerator::DitaTag t, bool force) { - QString s; - QStringMap& metaTagMap = const_cast<QStringMap&>(inner->doc().metaTagMap()); - QStringMap::iterator i = metaTagMap.find(ditaTags[t]); - if (i == metaTagMap.end()) { - s = metadataDefault(t); - } - else { - s = i.value(); - metaTagMap.erase(i); - } + QString s = getMetadataElement(inner,t); if (s.isEmpty() && !force) return false; writeStartTag(t); @@ -5593,6 +5581,34 @@ bool DitaXmlGenerator::writeMetadataElement(const InnerNode* inner, return true; } + +/*! + Looks up the tag name for \a t in the map of metadata + values for the current topic in \a inner. If one or more + value sfor the tag are found, the elements are written. + Otherwise nothing is written. + + Returns true or false depending on whether it writes + at least one element using the tag \a t. + + \note If \a t is found in the metadata map, it is erased. + i.e. Once you call this function for a particular \a t, + you consume \a t. + */ +bool DitaXmlGenerator::writeMetadataElements(const InnerNode* inner, + DitaXmlGenerator::DitaTag t) +{ + QStringList s = getMetadataElements(inner,t); + if (s.isEmpty()) + return false; + for (int i=0; i<s.size(); ++i) { + writeStartTag(t); + xmlWriter().writeCharacters(s[i]); + writeEndTag(); + } + return true; +} + /*! Looks up the tag name for \a t in the map of metadata values for the current topic in \a inner. If a value @@ -5604,16 +5620,29 @@ bool DitaXmlGenerator::writeMetadataElement(const InnerNode* inner, */ QString DitaXmlGenerator::getMetadataElement(const InnerNode* inner, DitaXmlGenerator::DitaTag t) { - QString s; - QStringMap& metaTagMap = const_cast<QStringMap&>(inner->doc().metaTagMap()); - QStringMap::iterator i = metaTagMap.find(ditaTags[t]); - if (i != metaTagMap.end()) { - s = i.value(); - metaTagMap.erase(i); - } - else { + QString s = Generator::getMetadataElement(inner, ditaTags[t]); + if (s.isEmpty()) s = metadataDefault(t); - } + return s; +} + +/*! + Looks up the tag name for \a t in the map of metadata + values for the current topic in \a inner. If values + for the tag are found, they are returned in a string + list. + + \note If \a t is found in the metadata map, all the + pairs having the key \a t are erased. i.e. Once you + all this function for a particular \a t, you consume + \a t. + */ +QStringList DitaXmlGenerator::getMetadataElements(const InnerNode* inner, + DitaXmlGenerator::DitaTag t) +{ + QStringList s = Generator::getMetadataElements(inner,ditaTags[t]); + if (s.isEmpty()) + s.append(metadataDefault(t)); return s; } @@ -5671,7 +5700,7 @@ DitaXmlGenerator::writeProlog(const InnerNode* inner, CodeMarker* marker) if (!inner) return; writeStartTag(DT_prolog); - writeMetadataElement(inner,DT_author); + writeMetadataElements(inner,DT_author); writeMetadataElement(inner,DT_publisher); QString s = getMetadataElement(inner,DT_copyryear); QString t = getMetadataElement(inner,DT_copyrholder); @@ -5690,11 +5719,13 @@ DitaXmlGenerator::writeProlog(const InnerNode* inner, CodeMarker* marker) xmlWriter().writeAttribute("view",s); writeEndTag(); // </permissions> writeStartTag(DT_metadata); - s = getMetadataElement(inner,DT_audience); - if (!s.isEmpty()) { - writeStartTag(DT_audience); - xmlWriter().writeAttribute("type",s); - writeEndTag(); // </audience> + QStringList sl = getMetadataElements(inner,DT_audience); + if (!sl.isEmpty()) { + for (int i=0; i<sl.size(); ++i) { + writeStartTag(DT_audience); + xmlWriter().writeAttribute("type",sl[i]); + writeEndTag(); // </audience> + } } if (!writeMetadataElement(inner,DT_category,false)) { writeStartTag(DT_category); @@ -5755,7 +5786,7 @@ DitaXmlGenerator::writeProlog(const InnerNode* inner, CodeMarker* marker) } writeEndTag(); // </prodinfo> } - const QStringMap& metaTagMap = inner->doc().metaTagMap(); + const QStringMultiMap& metaTagMap = inner->doc().metaTagMap(); QMapIterator<QString, QString> i(metaTagMap); while (i.hasNext()) { i.next(); diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index c7400bb..ffca234 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -319,7 +319,9 @@ class DitaXmlGenerator : public PageGenerator bool writeMetadataElement(const InnerNode* inner, DitaXmlGenerator::DitaTag t, bool force=true); + bool writeMetadataElements(const InnerNode* inner, DitaXmlGenerator::DitaTag t); QString getMetadataElement(const InnerNode* inner, DitaXmlGenerator::DitaTag t); + QStringList getMetadataElements(const InnerNode* inner, DitaXmlGenerator::DitaTag t); private: enum SubTitleSize { SmallSubTitle, LargeSubTitle }; @@ -516,7 +518,7 @@ class DitaXmlGenerator : public PageGenerator static QString ditaTags[]; QStack<QXmlStreamWriter*> xmlWriterStack; QStack<DitaTag> tagStack; - QStringMap metadataDefaults; + QStringMultiMap metadataDefaults; }; #define DITAXMLGENERATOR_ADDRESS "address" diff --git a/tools/qdoc3/doc.cpp b/tools/qdoc3/doc.cpp index 945b765..2239f43 100644 --- a/tools/qdoc3/doc.cpp +++ b/tools/qdoc3/doc.cpp @@ -63,6 +63,7 @@ Q_GLOBAL_STATIC(QSet<QString>, null_Set_QString) Q_GLOBAL_STATIC(QStringList, null_QStringList) Q_GLOBAL_STATIC(QList<Text>, null_QList_Text) Q_GLOBAL_STATIC(QStringMap, null_QStringMap) +Q_GLOBAL_STATIC(QStringMultiMap, null_QStringMultiMap) struct Macro { @@ -228,7 +229,7 @@ class DocPrivateExtra QList<int> tableOfContentsLevels; QList<Atom*> keywords; QList<Atom*> targets; - QStringMap metaMap; + QStringMultiMap metaMap; DocPrivateExtra() : granularity(Doc::Part) { } @@ -360,7 +361,7 @@ class DocParser void checkExpiry(const QString& date); void insertBaseName(const QString &baseName); void insertTarget(const QString& target, bool keyword); - void include(const QString& fileName); + void include(const QString& fileName, const QString& identifier); void startFormat(const QString& format, int cmd); bool openCommand(int cmd); bool closeCommand(int endCmd); @@ -804,7 +805,11 @@ void DocParser::parse(const QString& source, append(Atom::ImageText, getRestOfLine()); break; case CMD_INCLUDE: - include(getArgument()); + { + QString fileName = getArgument(); + QString identifier = getRestOfLine(); + include(fileName, identifier); + } break; case CMD_INLINEIMAGE: enterPara(); @@ -1578,7 +1583,7 @@ void DocParser::insertTarget(const QString &target, bool keyword) } } -void DocParser::include(const QString& fileName) +void DocParser::include(const QString& fileName, const QString& identifier) { if (location().depth() > 16) location().fatal(tr("Too many nested '\\%1's") @@ -1592,12 +1597,12 @@ void DocParser::include(const QString& fileName) fileName, userFriendlyFilePath); if (filePath.isEmpty()) { - location().warning(tr("Cannot find leaf file '%1'").arg(fileName)); + location().warning(tr("Cannot find qdoc include file '%1'").arg(fileName)); } else { QFile inFile(filePath); if (!inFile.open(QFile::ReadOnly)) { - location().warning(tr("Cannot open leaf file '%1'") + location().warning(tr("Cannot open qdoc include file '%1'") .arg(userFriendlyFilePath)); } else { @@ -1607,9 +1612,56 @@ void DocParser::include(const QString& fileName) QString includedStuff = inStream.readAll(); inFile.close(); - in.insert(pos, includedStuff); - len = in.length(); - openedInputs.push(pos + includedStuff.length()); + if (identifier.isEmpty()) { + in.insert(pos, includedStuff); + len = in.length(); + openedInputs.push(pos + includedStuff.length()); + } + else { + QStringList lineBuffer = includedStuff.split(QLatin1Char('\n')); + int i = 0; + int startLine = -1; + while (i < lineBuffer.size()) { + if (lineBuffer[i].startsWith("//!")) { + if (lineBuffer[i].contains(identifier)) { + startLine = i+1; + break; + } + } + ++i; + } + if (startLine < 0) { + location().warning(tr("Cannot find '%1' in '%2'") + .arg(identifier) + .arg(userFriendlyFilePath)); + return; + + } + QString result; + i = startLine; + do { + if (lineBuffer[i].startsWith("//!")) { + if (i<lineBuffer.size()) { + if (lineBuffer[i].contains(identifier)) { + break; + } + } + } + else + result += lineBuffer[i] + "\n"; + ++i; + } while (i < lineBuffer.size()); + if (result.isEmpty()) { + location().warning(tr("Empty qdoc snippet '%1' in '%2'") + .arg(identifier) + .arg(userFriendlyFilePath)); + } + else { + in.insert(pos, result); + len = in.length(); + openedInputs.push(pos + result.length()); + } + } } } } @@ -2909,9 +2961,9 @@ const QList<Atom *> &Doc::targets() const return priv->extra->targets; } -const QStringMap &Doc::metaTagMap() const +const QStringMultiMap &Doc::metaTagMap() const { - return priv && priv->extra ? priv->extra->metaMap : *null_QStringMap(); + return priv && priv->extra ? priv->extra->metaMap : *null_QStringMultiMap(); } void Doc::initialize(const Config& config) diff --git a/tools/qdoc3/doc.h b/tools/qdoc3/doc.h index ea832b1..e043b3a 100644 --- a/tools/qdoc3/doc.h +++ b/tools/qdoc3/doc.h @@ -64,7 +64,6 @@ class FakeNode; typedef QMap<QString, QStringList> QCommandMap; typedef QMap<QString, QString> QStringMap; -typedef QStringMap::const_iterator QStringMapEntry; typedef QMultiMap<QString, QString> QStringMultiMap; class Doc @@ -118,7 +117,7 @@ class Doc const QList<int> &tableOfContentsLevels() const; const QList<Atom *> &keywords() const; const QList<Atom *> &targets() const; - const QStringMap &metaTagMap() const; + const QStringMultiMap &metaTagMap() const; static void initialize( const Config &config ); static void terminate(); diff --git a/tools/qdoc3/doc/qdoc-manual.qdoc b/tools/qdoc3/doc/qdoc-manual.qdoc index 49dd819..0e4055b 100644 --- a/tools/qdoc3/doc/qdoc-manual.qdoc +++ b/tools/qdoc3/doc/qdoc-manual.qdoc @@ -259,6 +259,7 @@ \o \l {12-0-qdoc-commands-miscellaneous.html#if-command} {\\if} \o \l {09-qdoc-commands-includingimages.html#image-command} {\\image} \o \l {12-0-qdoc-commands-miscellaneous.html#include-command} {\\include} + \o \l {12-0-qdoc-commands-miscellaneous.html#include-command} {\\input} \o \l {09-qdoc-commands-includingimages.html#inlineimage-command} {\\inlineimage} \o \l {08-qdoc-commands-creatinglinks.html#keyword-command} {\\keyword} \o \l {08-qdoc-commands-creatinglinks.html#l-command} {\\l} @@ -1437,9 +1438,6 @@ application up and running. \endquotation - \warning If you use the \l {Compatibility Issues} - {compat.qdocconf} file this command is called \\include. - See also \l {quotefromfile-command} {\\quotefromfile} and \l {code-command} {\\code}. @@ -3965,24 +3963,28 @@ \target include-command \section1 \\include - The \\include command expands to the contents of the - file specified by the command's argument. - - \warning This is preliminary functionality. For more information, - see the \l - {26-qdoc-commands-compatibility.html#include-versus-input} - {compatibility} section. - - The command takes a file name as an argument, and is useful when - some piece of the documentation is used repeatedly: Move the - repetetive text into a separate file, and use the \\include - command whenever you want to insert the separate documentation. - - The contents of such a file should follow QDoc syntax, excluding - the enclosing \c{/}\c{*!} ... \c{*}\c{/} marks. To ensure that - QDoc won't attempt to read the file as a stand-alone piece of - documentation, we recommend that you use the \c .qdocinc - extension. + The \\include command sends all or part of the file specified by + its first argument to the QDoc input stream to be processed as a + qdoc comment snippet. This command is often assigned the alias, + \e {input}, in the QDoc configuration file, e.g. \e {alias.include + = input}. + + The command is useful when some snippet of commands and text is to + be used in multiple places in the documentation. In that case, + move the snippet into a separate file and use the \\include + command wherever you want to insert the snippet into the + documentation. To prevent QDoc from reading the file as a + stand-alone page of documentation, we recommend that you use the + \c .qdocinc extension for these \e {include} files. + + The command can have either one or two arguments. The first + argument is always a file name. The contents of the file must be + QDoc input, i.e. a sequence of QDoc commands and text, but without + the enclosing qdoc comment \c{/}\c{*!} ... \c{*}\c{/} delimeters. + If you want to include the entire named file, don't use the second + argument. If you want to include only part of the file, see the + \l{2-argument-form}{two argument form} below. Here is an example + of the one argument form: \code / *! @@ -3995,7 +3997,9 @@ * / \endcode - QDoc renders this as: + Here are links to the \c .qdocinc files used above: + \l{signalandslots.qdocinc}, \l{objectmodel.qdocinc}, + \l{layoutmanagement.qdocinc}. QDoc renders this page as: \quotation \raw HTML @@ -4007,8 +4011,40 @@ \input examples/layoutmanagement.qdocinc \endquotation - Here is the actual \c .qdocinc files: \l signalandslots.qdocinc, - \l objectmodel.qdocinc, \l layoutmanagement.qdocinc + \target 2-argument-form} + \section2 \\include filename snippet-identifier + + It is kind of a pain to make a separate \c .qdocinc file for every + QDoc include snippet you want to use in multiple places in the + documentation, especially given that you probably have to put the + copyright/license notice in every one of these files. So if you + have lots of these include snippets, you can put them all in a + single file if you want, and surround each one with: + \code + //! [snippet-id1] + + QDoc commands and text... + + //! [snippet-id1] + + //! [snippet-id2] + + More QDoc commands and text... + + //! [snippet-id2] + \endcode + + Then you can use the two-argument form of the command: + + \code + \input examples/signalandslots.qdocinc snippet-id2 + \input examples/objectmodel.qdocinc another-snippet-id + \endcode + + It works as expected. The sequence of QDoc commands and text found + between the two tags with the same name as the second argument is + sent to the QDoc input stream. You can even nest these snippets, + although it's not clear why you would want to do that. \target meta-command \section1 \\meta diff --git a/tools/qdoc3/generator.cpp b/tools/qdoc3/generator.cpp index b4768db..f05c030 100644 --- a/tools/qdoc3/generator.cpp +++ b/tools/qdoc3/generator.cpp @@ -549,7 +549,10 @@ void Generator::generateAlsoList(const Node *node, CodeMarker *marker) if (!alsoList.isEmpty()) { Text text; - text << Atom::ParaLeft << "See also "; + text << Atom::ParaLeft + << Atom(Atom::FormattingLeft,ATOM_FORMATTING_BOLD) + << "See also " + << Atom(Atom::FormattingRight,ATOM_FORMATTING_BOLD); for (int i = 0; i < alsoList.size(); ++i) text << alsoList.at(i) << separator(i, alsoList.size()); @@ -559,6 +562,28 @@ void Generator::generateAlsoList(const Node *node, CodeMarker *marker) } } +/*! + Generate a list of maintainers in the output + */ +void Generator::generateMaintainerList(const InnerNode* node, CodeMarker* marker) +{ + QStringList sl = getMetadataElements(node,"maintainer"); + + if (!sl.isEmpty()) { + Text text; + text << Atom::ParaLeft + << Atom(Atom::FormattingLeft,ATOM_FORMATTING_BOLD) + << "Maintained by: " + << Atom(Atom::FormattingRight,ATOM_FORMATTING_BOLD); + + for (int i = 0; i < sl.size(); ++i) + text << sl.at(i) << separator(i, sl.size()); + + text << Atom::ParaRight; + generateText(text, node, marker); + } +} + void Generator::generateInherits(const ClassNode *classe, CodeMarker *marker) { QList<RelatedClass>::ConstIterator r; @@ -566,7 +591,10 @@ void Generator::generateInherits(const ClassNode *classe, CodeMarker *marker) if (!classe->baseClasses().isEmpty()) { Text text; - text << Atom::ParaLeft << "Inherits "; + text << Atom::ParaLeft + << Atom(Atom::FormattingLeft,ATOM_FORMATTING_BOLD) + << "Inherits: " + << Atom(Atom::FormattingRight,ATOM_FORMATTING_BOLD); r = classe->baseClasses().begin(); index = 0; @@ -604,7 +632,10 @@ void Generator::generateInheritedBy(const ClassNode *classe, { if (!classe->derivedClasses().isEmpty()) { Text text; - text << Atom::ParaLeft << "Inherited by "; + text << Atom::ParaLeft + << Atom(Atom::FormattingLeft,ATOM_FORMATTING_BOLD) + << "Inherited by: " + << Atom(Atom::FormattingRight,ATOM_FORMATTING_BOLD); appendSortedNames(text, classe, classe->derivedClasses(), marker); text << Atom::ParaRight; @@ -1275,4 +1306,44 @@ QString Generator::outputPrefix(const QString &nodeType) return outputPrefixes[nodeType]; } +/*! + Looks up the tag \a t in the map of metadata values for the + current topic in \a inner. If a value for the tag is found, + the value is returned. + + \note If \a t is found in the metadata map, it is erased. + i.e. Once you call this function for a particular \a t, + you consume \a t. + */ +QString Generator::getMetadataElement(const InnerNode* inner, const QString& t) +{ + QString s; + QStringMultiMap& metaTagMap = const_cast<QStringMultiMap&>(inner->doc().metaTagMap()); + QStringMultiMap::iterator i = metaTagMap.find(t); + if (i != metaTagMap.end()) { + s = i.value(); + metaTagMap.erase(i); + } + return s; +} + +/*! + Looks up the tag \a t in the map of metadata values for the + current topic in \a inner. If values for the tag are found, + they are returned in a string list. + + \note If \a t is found in the metadata map, all the pairs + having the key \a t are erased. i.e. Once you call this + function for a particular \a t, you consume \a t. + */ +QStringList Generator::getMetadataElements(const InnerNode* inner, const QString& t) +{ + QStringList s; + QStringMultiMap& metaTagMap = const_cast<QStringMultiMap&>(inner->doc().metaTagMap()); + s = metaTagMap.values(t); + if (!s.isEmpty()) + metaTagMap.remove(t); + return s; +} + QT_END_NAMESPACE diff --git a/tools/qdoc3/generator.h b/tools/qdoc3/generator.h index 4482313..8fd5370 100644 --- a/tools/qdoc3/generator.h +++ b/tools/qdoc3/generator.h @@ -106,6 +106,7 @@ class Generator #endif virtual void generateBody(const Node *node, CodeMarker *marker); virtual void generateAlsoList(const Node *node, CodeMarker *marker); + virtual void generateMaintainerList(const InnerNode* node, CodeMarker* marker); virtual void generateInherits(const ClassNode *classe, CodeMarker *marker); virtual void generateInheritedBy(const ClassNode *classe, @@ -141,7 +142,6 @@ class Generator void unknownAtom(const Atom *atom); QMap<QString, QString> &formattingLeftMap(); QMap<QString, QString> &formattingRightMap(); - QMap<QString, QStringList> editionModuleMap; QMap<QString, QStringList> editionGroupMap; @@ -150,6 +150,9 @@ class Generator static void supplementAlsoList(const Node *node, QList<Text> &alsoList); static QString outputPrefix(const QString &nodeType); + QString getMetadataElement(const InnerNode* inner, const QString& t); + QStringList getMetadataElements(const InnerNode* inner, const QString& t); + private: void generateReimplementedFrom(const FunctionNode *func, CodeMarker *marker); diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index d1d1561..114db26 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -1327,6 +1327,7 @@ void HtmlGenerator::generateClassLikeNode(const InnerNode *inner, generateBody(inner, marker); out() << "</div>\n"; // QTBUG-9504 generateAlsoList(inner, marker); + generateMaintainerList(inner, marker); generateExtractionMark(inner, EndMark); } @@ -1605,7 +1606,10 @@ void HtmlGenerator::generateBreadCrumbs(const QString &title, const ClassNode *cn = static_cast<const ClassNode *>(node); QString name = node->moduleName(); breadcrumbs << Atom(Atom::ListItemLeft) - << Atom(Atom::AutoLink, QLatin1String("Modules")) + << Atom(Atom::Link, QLatin1String("All Modules")) + << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK) + << Atom(Atom::String, QLatin1String("Modules")) + << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK) << Atom(Atom::ListItemRight); if (!name.isEmpty()) breadcrumbs << Atom(Atom::ListItemLeft) @@ -1620,7 +1624,10 @@ void HtmlGenerator::generateBreadCrumbs(const QString &title, const FakeNode* fn = static_cast<const FakeNode*>(node); if (node->subType() == Node::Module) { breadcrumbs << Atom(Atom::ListItemLeft) - << Atom(Atom::AutoLink, QLatin1String("Modules")) + << Atom(Atom::Link, QLatin1String("All Modules")) + << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK) + << Atom(Atom::String, QLatin1String("Modules")) + << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK) << Atom(Atom::ListItemRight); QString name = node->name(); if (!name.isEmpty()) @@ -1630,9 +1637,7 @@ void HtmlGenerator::generateBreadCrumbs(const QString &title, } else if (node->subType() == Node::Group) { if (fn->name() == QString("modules")) - breadcrumbs << Atom(Atom::ListItemLeft) - << Atom(Atom::AutoLink, QLatin1String("Modules")) - << Atom(Atom::ListItemRight); + breadcrumbs << Atom(Atom::String, QLatin1String("Modules")); else breadcrumbs << Atom(Atom::ListItemLeft) << Atom(Atom::String, protectEnc(title)) @@ -1641,7 +1646,10 @@ void HtmlGenerator::generateBreadCrumbs(const QString &title, else if (node->subType() == Node::Page) { if (fn->name() == QString("qdeclarativeexamples.html")) { breadcrumbs << Atom(Atom::ListItemLeft) - << Atom(Atom::AutoLink, QLatin1String("Examples")) + << Atom(Atom::Link, QLatin1String("Qt Examples")) + << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK) + << Atom(Atom::String, QLatin1String("Examples")) + << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK) << Atom(Atom::ListItemRight); breadcrumbs << Atom(Atom::ListItemLeft) << Atom(Atom::AutoLink, QLatin1String("QML Examples & Demos")) @@ -1649,16 +1657,17 @@ void HtmlGenerator::generateBreadCrumbs(const QString &title, } else if (fn->name().startsWith("examples-")) { breadcrumbs << Atom(Atom::ListItemLeft) - << Atom(Atom::AutoLink, QLatin1String("Examples")) + << Atom(Atom::Link, QLatin1String("Qt Examples")) + << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK) + << Atom(Atom::String, QLatin1String("Examples")) + << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK) << Atom(Atom::ListItemRight); breadcrumbs << Atom(Atom::ListItemLeft) << Atom(Atom::String, protectEnc(title)) << Atom(Atom::ListItemRight); } else if (fn->name() == QString("namespaces.html")) - breadcrumbs << Atom(Atom::ListItemLeft) - << Atom(Atom::AutoLink, QLatin1String("Namespaces")) - << Atom(Atom::ListItemRight); + breadcrumbs << Atom(Atom::String, QLatin1String("Namespaces")); else breadcrumbs << Atom(Atom::ListItemLeft) << Atom(Atom::String, protectEnc(title)) @@ -1674,7 +1683,10 @@ void HtmlGenerator::generateBreadCrumbs(const QString &title, } else if (node->subType() == Node::Example) { breadcrumbs << Atom(Atom::ListItemLeft) - << Atom(Atom::AutoLink, QLatin1String("Examples")) + << Atom(Atom::Link, QLatin1String("Qt Examples")) + << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK) + << Atom(Atom::String, QLatin1String("Examples")) + << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK) << Atom(Atom::ListItemRight); QStringList sl = fn->name().split('/'); if (sl.contains("declarative")) @@ -1692,7 +1704,10 @@ void HtmlGenerator::generateBreadCrumbs(const QString &title, } else if (node->type() == Node::Namespace) { breadcrumbs << Atom(Atom::ListItemLeft) - << Atom(Atom::AutoLink, QLatin1String("Namespaces")) + << Atom(Atom::Link, QLatin1String("All Namespaces")) + << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK) + << Atom(Atom::String, QLatin1String("Namespaces")) + << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK) << Atom(Atom::ListItemRight); breadcrumbs << Atom(Atom::ListItemLeft) << Atom(Atom::String, protectEnc(title)) diff --git a/tools/qdoc3/jscodemarker.cpp b/tools/qdoc3/jscodemarker.cpp index 5a513f7..cbf040f 100644 --- a/tools/qdoc3/jscodemarker.cpp +++ b/tools/qdoc3/jscodemarker.cpp @@ -43,11 +43,11 @@ jscodemarker.cpp */ -#include "private/qdeclarativejsast_p.h" -#include "private/qdeclarativejsengine_p.h" -#include "private/qdeclarativejslexer_p.h" -#include "private/qdeclarativejsnodepool_p.h" -#include "private/qdeclarativejsparser_p.h" +#include "declarativeparser/qdeclarativejsast_p.h" +#include "declarativeparser/qdeclarativejsengine_p.h" +#include "declarativeparser/qdeclarativejslexer_p.h" +#include "declarativeparser/qdeclarativejsnodepool_p.h" +#include "declarativeparser/qdeclarativejsparser_p.h" #include "atom.h" #include "node.h" diff --git a/tools/qdoc3/qmlcodemarker.cpp b/tools/qdoc3/qmlcodemarker.cpp index a7dc5a0..ccca7b5 100644 --- a/tools/qdoc3/qmlcodemarker.cpp +++ b/tools/qdoc3/qmlcodemarker.cpp @@ -43,12 +43,12 @@ qmlcodemarker.cpp */ -#include "private/qdeclarativejsast_p.h" -#include "private/qdeclarativejsastfwd_p.h" -#include "private/qdeclarativejsengine_p.h" -#include "private/qdeclarativejslexer_p.h" -#include "private/qdeclarativejsnodepool_p.h" -#include "private/qdeclarativejsparser_p.h" +#include "declarativeparser/qdeclarativejsast_p.h" +#include "declarativeparser/qdeclarativejsastfwd_p.h" +#include "declarativeparser/qdeclarativejsengine_p.h" +#include "declarativeparser/qdeclarativejslexer_p.h" +#include "declarativeparser/qdeclarativejsnodepool_p.h" +#include "declarativeparser/qdeclarativejsparser_p.h" #include "atom.h" #include "node.h" diff --git a/tools/qdoc3/qmlcodemarker.h b/tools/qdoc3/qmlcodemarker.h index d693456..aab3455 100644 --- a/tools/qdoc3/qmlcodemarker.h +++ b/tools/qdoc3/qmlcodemarker.h @@ -46,7 +46,7 @@ #ifndef QMLCODEMARKER_H #define QMLCODEMARKER_H -#include "private/qdeclarativejsastfwd_p.h" +#include "declarativeparser/qdeclarativejsastfwd_p.h" #include "cppcodemarker.h" QT_BEGIN_NAMESPACE diff --git a/tools/qdoc3/qmlcodeparser.cpp b/tools/qdoc3/qmlcodeparser.cpp index 93a3ff9..45ca96f 100644 --- a/tools/qdoc3/qmlcodeparser.cpp +++ b/tools/qdoc3/qmlcodeparser.cpp @@ -43,9 +43,9 @@ qmlcodeparser.cpp */ -#include "private/qdeclarativejsast_p.h" -#include "private/qdeclarativejsastvisitor_p.h" -#include "private/qdeclarativejsnodepool_p.h" +#include "declarativeparser/qdeclarativejsast_p.h" +#include "declarativeparser/qdeclarativejsastvisitor_p.h" +#include "declarativeparser/qdeclarativejsnodepool_p.h" #include "qmlcodeparser.h" #include "node.h" diff --git a/tools/qdoc3/qmlcodeparser.h b/tools/qdoc3/qmlcodeparser.h index e5cc0dd..667cf5e 100644 --- a/tools/qdoc3/qmlcodeparser.h +++ b/tools/qdoc3/qmlcodeparser.h @@ -47,9 +47,9 @@ #define QMLCODEPARSER_H #include <QSet> -#include "private/qdeclarativejsengine_p.h" -#include "private/qdeclarativejslexer_p.h" -#include "private/qdeclarativejsparser_p.h" +#include "declarativeparser/qdeclarativejsengine_p.h" +#include "declarativeparser/qdeclarativejslexer_p.h" +#include "declarativeparser/qdeclarativejsparser_p.h" #include "codeparser.h" #include "location.h" diff --git a/tools/qdoc3/qmlmarkupvisitor.cpp b/tools/qdoc3/qmlmarkupvisitor.cpp index 7acac48..d88694b 100644 --- a/tools/qdoc3/qmlmarkupvisitor.cpp +++ b/tools/qdoc3/qmlmarkupvisitor.cpp @@ -41,9 +41,9 @@ #include <QStringList> #include <QtGlobal> -#include "private/qdeclarativejsast_p.h" -#include "private/qdeclarativejsastfwd_p.h" -#include "private/qdeclarativejsengine_p.h" +#include "declarativeparser/qdeclarativejsast_p.h" +#include "declarativeparser/qdeclarativejsastfwd_p.h" +#include "declarativeparser/qdeclarativejsengine_p.h" #include "qmlmarkupvisitor.h" diff --git a/tools/qdoc3/qmlmarkupvisitor.h b/tools/qdoc3/qmlmarkupvisitor.h index 709a858..97e392f 100644 --- a/tools/qdoc3/qmlmarkupvisitor.h +++ b/tools/qdoc3/qmlmarkupvisitor.h @@ -43,7 +43,7 @@ #define QMLVISITOR_H #include <QString> -#include "private/qdeclarativejsastvisitor_p.h" +#include "declarativeparser/qdeclarativejsastvisitor_p.h" #include "node.h" #include "tree.h" diff --git a/tools/qdoc3/qmlvisitor.cpp b/tools/qdoc3/qmlvisitor.cpp index 9295624..fc65093 100644 --- a/tools/qdoc3/qmlvisitor.cpp +++ b/tools/qdoc3/qmlvisitor.cpp @@ -42,9 +42,9 @@ #include <QFileInfo> #include <QStringList> #include <QtGlobal> -#include "private/qdeclarativejsast_p.h" -#include "private/qdeclarativejsastfwd_p.h" -#include "private/qdeclarativejsengine_p.h" +#include "declarativeparser/qdeclarativejsast_p.h" +#include "declarativeparser/qdeclarativejsastfwd_p.h" +#include "declarativeparser/qdeclarativejsengine_p.h" #include "node.h" #include "qmlvisitor.h" diff --git a/tools/qdoc3/qmlvisitor.h b/tools/qdoc3/qmlvisitor.h index 9da2c72..4771f9e 100644 --- a/tools/qdoc3/qmlvisitor.h +++ b/tools/qdoc3/qmlvisitor.h @@ -43,7 +43,7 @@ #define QMLVISITOR_H #include <QString> -#include "private/qdeclarativejsastvisitor_p.h" +#include "declarativeparser/qdeclarativejsastvisitor_p.h" #include "node.h" #include "tree.h" diff --git a/tools/qdoc3/quoter.cpp b/tools/qdoc3/quoter.cpp index dadf67c..d9210e3 100644 --- a/tools/qdoc3/quoter.cpp +++ b/tools/qdoc3/quoter.cpp @@ -41,6 +41,7 @@ #include <qfileinfo.h> #include <qregexp.h> +#include <qdebug.h> #include "quoter.h" @@ -65,7 +66,7 @@ static void replaceMultipleNewlines(QString &s) } // This is equivalent to line.split( QRegExp("\n(?!\n|$)") ) but much faster -static QStringList splitLines(const QString &line) +QStringList Quoter::splitLines(const QString &line) { QStringList result; int i = line.size(); diff --git a/tools/qdoc3/quoter.h b/tools/qdoc3/quoter.h index 6a59ab4..ee515b2 100644 --- a/tools/qdoc3/quoter.h +++ b/tools/qdoc3/quoter.h @@ -69,6 +69,8 @@ public: const QString& pattern ); QString quoteSnippet(const Location &docLocation, const QString &identifier); + static QStringList splitLines(const QString &line); + private: QString getLine(int unindent = 0); void failedAtEnd( const Location& docLocation, const QString& command ); |