diff options
author | Martin Smith <msmith@trolltech.com> | 2010-02-26 08:44:33 (GMT) |
---|---|---|
committer | Martin Smith <msmith@trolltech.com> | 2010-02-26 08:44:33 (GMT) |
commit | 540c19cd525fe0eb4fc70cfd625deeb77eb1b7cf (patch) | |
tree | 8ee7e6d700de3d911e8d0ccf4e2b2cd0a417fcde /tools/qdoc3 | |
parent | 84fd26983a40ecae3e761106aa8f550c3b7fd7ba (diff) | |
parent | 7944ac1fb6eb0ae3bbbfdf6780b52f7174174a93 (diff) | |
download | Qt-540c19cd525fe0eb4fc70cfd625deeb77eb1b7cf.zip Qt-540c19cd525fe0eb4fc70cfd625deeb77eb1b7cf.tar.gz Qt-540c19cd525fe0eb4fc70cfd625deeb77eb1b7cf.tar.bz2 |
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/oslo-staging-1
Diffstat (limited to 'tools/qdoc3')
-rw-r--r-- | tools/qdoc3/codemarker.cpp | 2 | ||||
-rw-r--r-- | tools/qdoc3/cppcodemarker.cpp | 2 | ||||
-rw-r--r-- | tools/qdoc3/cppcodeparser.cpp | 2 | ||||
-rw-r--r-- | tools/qdoc3/generator.cpp | 26 | ||||
-rw-r--r-- | tools/qdoc3/generator.h | 7 | ||||
-rw-r--r-- | tools/qdoc3/htmlgenerator.cpp | 56 | ||||
-rw-r--r-- | tools/qdoc3/htmlgenerator.h | 2 | ||||
-rw-r--r-- | tools/qdoc3/node.cpp | 8 | ||||
-rw-r--r-- | tools/qdoc3/node.h | 6 | ||||
-rw-r--r-- | tools/qdoc3/test/qt_zh_CN.qdocconf | 86 |
10 files changed, 124 insertions, 73 deletions
diff --git a/tools/qdoc3/codemarker.cpp b/tools/qdoc3/codemarker.cpp index ee93080..15f2c2d 100644 --- a/tools/qdoc3/codemarker.cpp +++ b/tools/qdoc3/codemarker.cpp @@ -177,7 +177,7 @@ const Node *CodeMarker::nodeForString(const QString& string) QString CodeMarker::stringForNode(const Node *node) { if (sizeof(const Node *) == sizeof(ulong)) { - return QString::number(reinterpret_cast<ulong>(node)); + return QString::number(reinterpret_cast<quintptr>(node)); } else { return QString::number(reinterpret_cast<qulonglong>(node)); diff --git a/tools/qdoc3/cppcodemarker.cpp b/tools/qdoc3/cppcodemarker.cpp index 657cfbb..3ff6ebe 100644 --- a/tools/qdoc3/cppcodemarker.cpp +++ b/tools/qdoc3/cppcodemarker.cpp @@ -145,7 +145,7 @@ QString CppCodeMarker::plainFullName(const Node *node, const Node *relative) } else { QString fullName; - for (;;) { + while (node) { fullName.prepend(plainName(node)); if (node->parent() == relative || node->parent()->name().isEmpty()) break; diff --git a/tools/qdoc3/cppcodeparser.cpp b/tools/qdoc3/cppcodeparser.cpp index d9e9c3b..021d64a 100644 --- a/tools/qdoc3/cppcodeparser.cpp +++ b/tools/qdoc3/cppcodeparser.cpp @@ -1034,7 +1034,7 @@ void CppCodeParser::processOtherMetaCommand(const Doc& doc, else if (command == COMMAND_QMLINHERITS) { setLink(node, Node::InheritsLink, arg); if (node->subType() == Node::QmlClass) { - QmlClassNode::addInheritedBy(arg,node); + QmlClassNode::addInheritedBy(arg,node->name()); } } else if (command == COMMAND_QMLDEFAULT) { diff --git a/tools/qdoc3/generator.cpp b/tools/qdoc3/generator.cpp index a7ab453..6a8899a 100644 --- a/tools/qdoc3/generator.cpp +++ b/tools/qdoc3/generator.cpp @@ -1186,32 +1186,6 @@ void Generator::appendSortedNames(Text& text, } } -void Generator::appendSortedNames(Text& text, - const Node* base, - const NodeList& subs, - CodeMarker *marker) -{ - NodeList::ConstIterator r; - QMap<QString,Text> classMap; - int index = 0; - - r = subs.begin(); - while (r != subs.end()) { - Text className; - appendFullName(className, (*r), base, marker); - classMap[className.toString().toLower()] = className; - ++r; - } - - QStringList classNames = classMap.keys(); - classNames.sort(); - - foreach (const QString &className, classNames) { - text << classMap[className]; - text << separator(index++, classNames.count()); - } -} - int Generator::skipAtoms(const Atom *atom, Atom::Type type) const { int skipAhead = 0; diff --git a/tools/qdoc3/generator.h b/tools/qdoc3/generator.h index 50ffb0a..44f56e2 100644 --- a/tools/qdoc3/generator.h +++ b/tools/qdoc3/generator.h @@ -169,13 +169,6 @@ class Generator const QList<RelatedClass> &classes, CodeMarker *marker); - protected: - void appendSortedNames(Text& text, - const Node* base, - const NodeList& subs, - CodeMarker *marker); - - private: QString amp; QString lt; QString gt; diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 0477ebb..e767460 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -73,7 +73,6 @@ QString HtmlGenerator::sinceTitles[] = " New Typedefs", " New Properties", " New Variables", - " New QML Elements", " New Qml Properties", " New Qml Signals", " New Qml Methods", @@ -688,8 +687,6 @@ int HtmlGenerator::generateAtom(const Atom *atom, nsmap = newSinceMaps.find(atom->string()); NewClassMaps::const_iterator ncmap; ncmap = newClassMaps.find(atom->string()); - NewClassMaps::const_iterator nqcmap; - nqcmap = newQmlClassMaps.find(atom->string()); if ((nsmap != newSinceMaps.constEnd()) && !nsmap.value().isEmpty()) { QList<Section> sections; QList<Section>::ConstIterator s; @@ -700,10 +697,6 @@ int HtmlGenerator::generateAtom(const Atom *atom, while (n != nsmap.value().constEnd()) { const Node* node = n.value(); switch (node->type()) { - case Node::Fake: - if (node->subType() == Node::QmlClass) - sections[QmlClass].appendMember((Node*)node); - break; case Node::Namespace: sections[Namespace].appendMember((Node*)node); break; @@ -789,8 +782,6 @@ int HtmlGenerator::generateAtom(const Atom *atom, out() << "<h3>" << protectEnc((*s).name) << "</h3>\n"; if (idx == Class) generateCompactList(0, marker, ncmap.value(), QString("Q")); - else if (idx == QmlClass) - generateCompactList(0, marker, nqcmap.value(), QString("Q")); else if (idx == MemberFunction) { ParentMaps parentmaps; ParentMaps::iterator pmap; @@ -2341,11 +2332,7 @@ void HtmlGenerator::generateCompactList(const Node *relative, out() << "<a href=\"" << linkForNode(it.value(), relative) << "\">"; - QStringList pieces; - if (it.value()->subType() == Node::QmlClass) - pieces << it.value()->name(); - else - pieces = fullName(it.value(), relative, marker).split("::"); + QStringList pieces = fullName(it.value(), relative, marker).split("::"); out() << protectEnc(pieces.last()); out() << "</a>"; if (pieces.size() > 1) { @@ -3736,9 +3723,6 @@ void HtmlGenerator::findAllSince(const InnerNode *node) NewClassMaps::iterator ncmap = newClassMaps.find(sinceVersion); if (ncmap == newClassMaps.end()) ncmap = newClassMaps.insert(sinceVersion,NodeMap()); - NewClassMaps::iterator nqcmap = newQmlClassMaps.find(sinceVersion); - if (nqcmap == newQmlClassMaps.end()) - nqcmap = newQmlClassMaps.insert(sinceVersion,NodeMap()); if ((*child)->type() == Node::Function) { FunctionNode *func = static_cast<FunctionNode *>(*child); @@ -3758,15 +3742,6 @@ void HtmlGenerator::findAllSince(const InnerNode *node) nsmap.value().insert(className,(*child)); ncmap.value().insert(className,(*child)); } - else if ((*child)->subType() == Node::QmlClass) { - QString className = (*child)->name(); - if ((*child)->parent() && - (*child)->parent()->type() == Node::Namespace && - !(*child)->parent()->name().isEmpty()) - className = (*child)->parent()->name()+"::"+className; - nsmap.value().insert(className,(*child)); - nqcmap.value().insert(className,(*child)); - } } else { QString name = (*child)->name(); @@ -4341,15 +4316,40 @@ void HtmlGenerator::generateQmlInheritedBy(const QmlClassNode* cn, CodeMarker* marker) { if (cn) { - NodeList subs; + QStringList subs; QmlClassNode::subclasses(cn->name(),subs); if (!subs.isEmpty()) { + subs.sort(); Text text; text << Atom::ParaLeft << "Inherited by "; - appendSortedNames(text,cn,subs,marker); + for (int i = 0; i < subs.size(); ++i) { + text << subs.at(i); + text << separator(i, subs.size()); + } text << Atom::ParaRight; generateText(text, cn, marker); } +#if 0 + if (cn->links().contains(Node::InheritsLink)) { + QPair<QString,QString> linkPair; + linkPair = cn->links()[Node::InheritsLink]; + QStringList strList(linkPair.first); + const Node* n = myTree->findNode(strList,Node::Fake); + if (n && n->subType() == Node::QmlClass) { + const QmlClassNode* qcn = static_cast<const QmlClassNode*>(n); + out() << "<p style=\"text-align: center\">"; + Text text; + text << "[Inherits "; + text << Atom(Atom::LinkNode,CodeMarker::stringForNode(qcn)); + text << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK); + text << Atom(Atom::String, linkPair.second); + text << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK); + text << "]"; + generateText(text, cn, marker); + out() << "</p>"; + } + } +#endif } } diff --git a/tools/qdoc3/htmlgenerator.h b/tools/qdoc3/htmlgenerator.h index 8fe0331..551bead 100644 --- a/tools/qdoc3/htmlgenerator.h +++ b/tools/qdoc3/htmlgenerator.h @@ -90,7 +90,6 @@ class HtmlGenerator : public PageGenerator Typedef, Property, Variable, - QmlClass, QmlProperty, QmlSignal, QmlMethod, @@ -327,7 +326,6 @@ class HtmlGenerator : public PageGenerator NewSinceMaps newSinceMaps; static QString sinceTitles[]; NewClassMaps newClassMaps; - NewClassMaps newQmlClassMaps; static int id; }; diff --git a/tools/qdoc3/node.cpp b/tools/qdoc3/node.cpp index 83014d3..358fdd1 100644 --- a/tools/qdoc3/node.cpp +++ b/tools/qdoc3/node.cpp @@ -1257,7 +1257,7 @@ bool TargetNode::isInnerNode() const #ifdef QDOC_QML bool QmlClassNode::qmlOnly = false; -QMultiMap<QString,Node*> QmlClassNode::inheritedBy; +QMultiMap<QString,QString> QmlClassNode::inheritedBy; /*! Constructs a Qml class node (i.e. a Fake node with the @@ -1302,15 +1302,15 @@ QString QmlClassNode::fileBase() const Record the fact that QML class \a base is inherited by QML class \a sub. */ -void QmlClassNode::addInheritedBy(const QString& base, Node* sub) +void QmlClassNode::addInheritedBy(const QString& base, const QString& sub) { inheritedBy.insert(base,sub); } /*! - Loads the list \a subs with the nodes of all the subclasses of \a base. + Loads the list \a subs with the names of all the subclasses of \a base. */ -void QmlClassNode::subclasses(const QString& base, NodeList& subs) +void QmlClassNode::subclasses(const QString& base, QStringList& subs) { subs.clear(); if (inheritedBy.contains(base)) diff --git a/tools/qdoc3/node.h b/tools/qdoc3/node.h index fd39698..ae5dcd7 100644 --- a/tools/qdoc3/node.h +++ b/tools/qdoc3/node.h @@ -383,12 +383,12 @@ class QmlClassNode : public FakeNode const ClassNode* classNode() const { return cnode; } virtual QString fileBase() const; - static void addInheritedBy(const QString& base, Node* sub); - static void subclasses(const QString& base, NodeList& subs); + static void addInheritedBy(const QString& base, const QString& sub); + static void subclasses(const QString& base, QStringList& subs); public: static bool qmlOnly; - static QMultiMap<QString,Node*> inheritedBy; + static QMultiMap<QString,QString> inheritedBy; private: const ClassNode* cnode; diff --git a/tools/qdoc3/test/qt_zh_CN.qdocconf b/tools/qdoc3/test/qt_zh_CN.qdocconf new file mode 100644 index 0000000..8c7e64a --- /dev/null +++ b/tools/qdoc3/test/qt_zh_CN.qdocconf @@ -0,0 +1,86 @@ +include(compat.qdocconf) +include(macros.qdocconf) +include(qt-cpp-ignore.qdocconf) +include(qt-html-templates_zh_CN.qdocconf) +include(qt-defines.qdocconf) + +project = Qt +versionsym = +version = %VERSION% +description = Qt Reference Documentation +url = http://qt.nokia.com/doc/zh_CN/4.7 + +sourceencoding = UTF-8 +outputencoding = UTF-8 +naturallanguage = zh-Hans + +indexes = $QTDIR/doc/html/qt.index + +qhp.projects = Qt + +qhp.Qt.file = qt.qhp +qhp.Qt.namespace = com.trolltech.qt.470 +qhp.Qt.virtualFolder = qdoc +qhp.Qt.title = 教程 +qhp.Qt.indexTitle = 教程 +qhp.Qt.selectors = fake:example + +qhp.Qt.filterAttributes = qt 4.7.0 qtrefdoc zh_CN +qhp.Qt.customFilters.Qt.name = Qt 4.7.0 +qhp.Qt.customFilters.Qt.filterAttributes = qt 4.7.0 + +# Files not referenced in any qdoc file (last four are needed by qtdemo) +# See also extraimages.HTML +qhp.Qt.extraFiles = classic.css \ + images/qt-logo.png \ + images/taskmenuextension-example.png \ + images/coloreditorfactoryimage.png \ + images/dynamiclayouts-example.png \ + images/stylesheet-coffee-plastique.png + +language = Cpp + +sourcedirs = $QTDIR/doc/src/zh_CN + +excludedirs = $QTDIR/src/3rdparty/clucene \ + $QTDIR/src/3rdparty/des \ + $QTDIR/src/3rdparty/freetype \ + $QTDIR/src/3rdparty/harfbuzz \ + $QTDIR/src/3rdparty/kdebase \ + $QTDIR/src/3rdparty/libjpeg \ + $QTDIR/src/3rdparty/libmng \ + $QTDIR/src/3rdparty/libpng \ + $QTDIR/src/3rdparty/libtiff \ + $QTDIR/src/3rdparty/md4 \ + $QTDIR/src/3rdparty/md5 \ + $QTDIR/src/3rdparty/patches \ + $QTDIR/src/3rdparty/sha1 \ + $QTDIR/src/3rdparty/sqlite \ + $QTDIR/src/3rdparty/webkit/JavaScriptCore \ + $QTDIR/src/3rdparty/webkit/WebCore \ + $QTDIR/src/3rdparty/wintab \ + $QTDIR/src/3rdparty/zlib \ + $QTDIR/doc/src/snippets \ + $QTDIR/src/3rdparty/phonon/gstreamer \ + $QTDIR/src/3rdparty/phonon/ds9 \ + $QTDIR/src/3rdparty/phonon/qt7 \ + $QTDIR/src/3rdparty/phonon/mmf \ + $QTDIR/src/3rdparty/phonon/waveout + +sources.fileextensions = "*.cpp *.qdoc *.mm" +examples.fileextensions = "*.cpp *.h *.js *.xq *.svg *.xml *.ui *.qhp *.qhcp" +examples.imageextensions = "*.png" + +exampledirs = $QTDIR/doc/src \ + $QTDIR/examples \ + $QTDIR/examples/tutorials \ + $QTDIR \ + $QTDIR/qmake/examples \ + $QTDIR/src/3rdparty/webkit/WebKit/qt/docs +imagedirs = $QTDIR/doc/src/images \ + $QTDIR/examples +outputdir = $QTDIR/doc/html_zh_CN +tagfile = $QTDIR/doc/html_zh_CN/qt.tags +base = file:$QTDIR/doc/html_zh_CN + +HTML.generatemacrefs = "true" |