diff options
author | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2011-09-15 10:30:48 (GMT) |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2011-09-15 10:30:48 (GMT) |
commit | 9b2ef45e8109dcdfce16c6c41ae38476f8aac8df (patch) | |
tree | 4a1e4ec384f3e851c665ecc91f79d6bf47326005 /tools | |
parent | e29af89ec3655188e00def7234bf7181d070b09b (diff) | |
parent | 704dd92581783d91ccd234d58896d7078eed14a5 (diff) | |
download | Qt-9b2ef45e8109dcdfce16c6c41ae38476f8aac8df.zip Qt-9b2ef45e8109dcdfce16c6c41ae38476f8aac8df.tar.gz Qt-9b2ef45e8109dcdfce16c6c41ae38476f8aac8df.tar.bz2 |
Merge remote-tracking branch 'mainline/4.8'
Diffstat (limited to 'tools')
-rw-r--r-- | tools/qdbus/qdbus/qdbus.cpp | 8 | ||||
-rw-r--r-- | tools/qdoc3/codemarker.cpp | 2 | ||||
-rw-r--r-- | tools/qdoc3/codeparser.cpp | 3 | ||||
-rw-r--r-- | tools/qdoc3/cppcodemarker.cpp | 20 | ||||
-rw-r--r-- | tools/qdoc3/cppcodeparser.cpp | 17 | ||||
-rw-r--r-- | tools/qdoc3/ditaxmlgenerator.cpp | 96 | ||||
-rw-r--r-- | tools/qdoc3/ditaxmlgenerator.h | 11 | ||||
-rw-r--r-- | tools/qdoc3/doc.cpp | 6 | ||||
-rw-r--r-- | tools/qdoc3/generator.cpp | 153 | ||||
-rw-r--r-- | tools/qdoc3/generator.h | 12 | ||||
-rw-r--r-- | tools/qdoc3/htmlgenerator.cpp | 300 | ||||
-rw-r--r-- | tools/qdoc3/htmlgenerator.h | 16 | ||||
-rw-r--r-- | tools/qdoc3/node.cpp | 54 | ||||
-rw-r--r-- | tools/qdoc3/node.h | 31 | ||||
-rw-r--r-- | tools/qvfb/qvfb.pro | 10 |
15 files changed, 490 insertions, 249 deletions
diff --git a/tools/qdbus/qdbus/qdbus.cpp b/tools/qdbus/qdbus/qdbus.cpp index 14b4b9e..757267f 100644 --- a/tools/qdbus/qdbus/qdbus.cpp +++ b/tools/qdbus/qdbus/qdbus.cpp @@ -59,7 +59,7 @@ static bool printArgumentsLiterally = false; static void showUsage() { - printf("Usage: qdbus [--system] [--literal] [servicename] [path] [method] [args]\n" + printf("Usage: qdbus [--system | --address ADDRESS] [--literal] [servicename] [path] [method] [args]\n" "\n" " servicename the service to connect to (e.g., org.freedesktop.DBus)\n" " path the path to the object (e.g., /)\n" @@ -71,6 +71,7 @@ static void showUsage() "\n" "Options:\n" " --system connect to the system bus\n" + " --address ADDRESS connect to the given bus\n" " --literal print replies literally\n"); } @@ -454,6 +455,11 @@ int main(int argc, char **argv) if (arg == QLatin1String("--system")) { connection = QDBusConnection::systemBus(); connectionOpened = true; + } else if (arg == QLatin1String("--address")) { + if (!args.isEmpty()) { + connection = QDBusConnection::connectToBus(args.takeFirst(), "bus"); + connectionOpened = true; + } } else if (arg == QLatin1String("--literal")) { printArgumentsLiterally = true; } else if (arg == QLatin1String("--help")) { diff --git a/tools/qdoc3/codemarker.cpp b/tools/qdoc3/codemarker.cpp index 614419e..705ef6c 100644 --- a/tools/qdoc3/codemarker.cpp +++ b/tools/qdoc3/codemarker.cpp @@ -76,7 +76,7 @@ CodeMarker::~CodeMarker() A code market performs no initialization by default. Marker-specific initialization is performed in subclasses. */ -void CodeMarker::initializeMarker(const Config &config) +void CodeMarker::initializeMarker(const Config& ) // config { } diff --git a/tools/qdoc3/codeparser.cpp b/tools/qdoc3/codeparser.cpp index c7a8912..9ab5f82 100644 --- a/tools/qdoc3/codeparser.cpp +++ b/tools/qdoc3/codeparser.cpp @@ -287,6 +287,9 @@ void CodeParser::processCommonMetaCommand(const Location &location, FakeNode *fake = static_cast<FakeNode *>(node); fake->setTitle(arg); nameToTitle.insert(fake->name(),arg); + if (fake->subType() == Node::Example) { + + } } else location.warning(tr("Ignored '\\%1'").arg(COMMAND_TITLE)); diff --git a/tools/qdoc3/cppcodemarker.cpp b/tools/qdoc3/cppcodemarker.cpp index 71b4e90..37c2c3a 100644 --- a/tools/qdoc3/cppcodemarker.cpp +++ b/tools/qdoc3/cppcodemarker.cpp @@ -935,7 +935,7 @@ QString CppCodeMarker::addMarkUp(const QString &in, ident += ch; finish = i; readChar(); - } while (isalnum(ch) || ch == '_'); + } while (ch >= 0 && isalnum(ch) || ch == '_'); if (classRegExp.exactMatch(ident)) { tag = QLatin1String("type"); @@ -1137,15 +1137,15 @@ QList<Section> CppCodeMarker::qmlSections(const QmlClassNode* qmlClassNode, "property", "properties"); FastSection qmlsignals(qmlClassNode, - "Signals", + "Signal Handlers", "", - "signal", - "signals"); + "signal handler", + "signal handlers"); FastSection qmlattachedsignals(qmlClassNode, - "Attached Signals", + "Attached Signal Handlers", "", - "signal", - "signals"); + "signal handler", + "signal handlers"); FastSection qmlmethods(qmlClassNode, "Methods", "", @@ -1200,9 +1200,9 @@ QList<Section> CppCodeMarker::qmlSections(const QmlClassNode* qmlClassNode, FastSection qmlproperties(qmlClassNode, "Property Documentation","qmlprop","member","members"); FastSection qmlattachedproperties(qmlClassNode,"Attached Property Documentation","qmlattprop", "member","members"); - FastSection qmlsignals(qmlClassNode,"Signal Documentation","qmlsig","member","members"); - FastSection qmlattachedsignals(qmlClassNode,"Attached Signal Documentation","qmlattsig", - "member","members"); + FastSection qmlsignals(qmlClassNode,"Signal Handler Documentation","qmlsig","handler","handlers"); + FastSection qmlattachedsignals(qmlClassNode,"Attached Signal Handler Documentation","qmlattsig", + "handler","handlers"); FastSection qmlmethods(qmlClassNode,"Method Documentation","qmlmeth","member","members"); FastSection qmlattachedmethods(qmlClassNode,"Attached Method Documentation","qmlattmeth", "member","members"); diff --git a/tools/qdoc3/cppcodeparser.cpp b/tools/qdoc3/cppcodeparser.cpp index 6f5baa0..1a4c344 100644 --- a/tools/qdoc3/cppcodeparser.cpp +++ b/tools/qdoc3/cppcodeparser.cpp @@ -47,7 +47,7 @@ #include <stdio.h> #include <errno.h> - +#include <qdebug.h> #include "codechunk.h" #include "config.h" #include "cppcodeparser.h" @@ -704,7 +704,7 @@ Node *CppCodeParser::processTopicCommand(const Doc& doc, if (command == COMMAND_CLASS) { if (paths.size() > 1) { if (!paths[1].endsWith(".h")) { - ClassNode*cnode = static_cast<ClassNode*>(node); + ClassNode* cnode = static_cast<ClassNode*>(node); cnode->setQmlElement(paths[1]); } } @@ -712,9 +712,9 @@ Node *CppCodeParser::processTopicCommand(const Doc& doc, return node; } else if (command == COMMAND_EXAMPLE) { - FakeNode *fake = new FakeNode(tre->root(), arg, Node::Example); - createExampleFileNodes(fake); - return fake; + ExampleNode* en = new ExampleNode(tre->root(), arg); + createExampleFileNodes(en); + return en; } else if (command == COMMAND_EXTERNALPAGE) { return new FakeNode(tre->root(), arg, Node::ExternalPage); @@ -2349,8 +2349,8 @@ void CppCodeParser::createExampleFileNodes(FakeNode *fake) proFileName, userFriendlyFilePath); if (fullPath.isEmpty()) { - fake->doc().location().warning( - tr("Cannot find file '%1' or '%2'").arg(tmp).arg(proFileName)); + fake->doc().location().warning(tr("Cannot find file '%1' or '%2'").arg(tmp).arg(proFileName)); + fake->doc().location().warning(tr("EXAMPLE PATH DOES NOT EXIST: %1").arg(examplePath)); return; } } @@ -2362,7 +2362,6 @@ void CppCodeParser::createExampleFileNodes(FakeNode *fake) QStringList exampleFiles = Config::getFilesHere(fullPath,exampleNameFilter); QString imagesPath = fullPath + "/images"; QStringList imageFiles = Config::getFilesHere(imagesPath,exampleImageFilter); - if (!exampleFiles.isEmpty()) { // move main.cpp and to the end, if it exists QString mainCpp; @@ -2382,7 +2381,7 @@ void CppCodeParser::createExampleFileNodes(FakeNode *fake) exampleFiles.append(mainCpp); // add any qmake Qt resource files and qmake project files - exampleFiles += Config::getFilesHere(fullPath, "*.qrc *.pro qmldir"); + exampleFiles += Config::getFilesHere(fullPath, "*.qrc *.pro *.qmlproject qmldir"); } foreach (const QString &exampleFile, exampleFiles) diff --git a/tools/qdoc3/ditaxmlgenerator.cpp b/tools/qdoc3/ditaxmlgenerator.cpp index fc66923..e3e32a0 100644 --- a/tools/qdoc3/ditaxmlgenerator.cpp +++ b/tools/qdoc3/ditaxmlgenerator.cpp @@ -62,25 +62,6 @@ QT_BEGIN_NAMESPACE #define COMMAND_VERSION Doc::alias("version") int DitaXmlGenerator::id = 0; -QString DitaXmlGenerator::sinceTitles[] = - { - " New Namespaces", - " New Classes", - " New Member Functions", - " New Functions in Namespaces", - " New Global Functions", - " New Macros", - " New Enum Types", - " New Typedefs", - " New Properties", - " New Variables", - " New QML Elements", - " New Qml Properties", - " New Qml Signals", - " New Qml Methods", - "" - }; - /* The strings in this array must appear in the same order as the values in enum DitaXmlGenerator::DitaTag. @@ -770,7 +751,7 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, { writeStartTag(DT_codeblock); xmlWriter().writeAttribute("outputclass","cpp"); - QString chars = trimmedTrailing(atom->string()); + QString chars = trimmedTrailing(atom->string()); writeText(chars, marker, relative); writeEndTag(); // </codeblock> } @@ -1199,7 +1180,10 @@ int DitaXmlGenerator::generateAtom(const Atom *atom, Just output the href as if the image is in the images directory... */ - fileName = QLatin1String("images/") + protectEnc(atom->string()); + if (atom->string()[0] == '/') + fileName = QLatin1String("images") + atom->string(); + else + fileName = QLatin1String("images/") + atom->string(); } if (currentTag() != DT_xref) @@ -3408,6 +3392,7 @@ void DitaXmlGenerator::writeText(const QString& markedCode, "<@type>", "<@type>", "<@headerfile>", "<@headerfile>", "<@func>", "<@func>", + "<@func ", "<@func ", "<@param>", "<@param>", "<@extra>", "<@extra>", "</@link>", "</@link>", @@ -3420,7 +3405,7 @@ void DitaXmlGenerator::writeText(const QString& markedCode, for (int i = 0, n = src.size(); i < n;) { if (src.at(i) == charLangle) { bool handled = false; - for (int k = 0; k != 12; ++k) { + for (int k = 0; k != 13; ++k) { const QString & tag = spanTags[2 * k]; if (tag == QStringRef(&src, i, tag.length())) { html += spanTags[2 * k + 1]; @@ -3953,70 +3938,6 @@ void DitaXmlGenerator::findAllClasses(const InnerNode* node) } } -/*! - For generating the "New Classes... in 4.x" section on the - What's New in 4.x" page. - */ -void DitaXmlGenerator::findAllSince(const InnerNode* node) -{ - NodeList::const_iterator child = node->childNodes().constBegin(); - while (child != node->childNodes().constEnd()) { - QString sinceVersion = (*child)->since(); - if (((*child)->access() != Node::Private) && !sinceVersion.isEmpty()) { - NewSinceMaps::iterator nsmap = newSinceMaps.find(sinceVersion); - if (nsmap == newSinceMaps.end()) - nsmap = newSinceMaps.insert(sinceVersion,NodeMultiMap()); - 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); - if ((func->status() > Node::Obsolete) && - (func->metaness() != FunctionNode::Ctor) && - (func->metaness() != FunctionNode::Dtor)) { - nsmap.value().insert(func->name(),(*child)); - } - } - else if ((*child)->url().isEmpty()) { - if ((*child)->type() == Node::Class && !(*child)->doc().isEmpty()) { - 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)); - 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(); - if ((*child)->parent() && - (*child)->parent()->type() == Node::Namespace && - !(*child)->parent()->name().isEmpty()) - name = (*child)->parent()->name()+"::"+name; - nsmap.value().insert(name,(*child)); - } - if ((*child)->isInnerNode()) { - findAllSince(static_cast<InnerNode *>(*child)); - } - } - ++child; - } -} - void DitaXmlGenerator::findAllFunctions(const InnerNode* node) { NodeList::ConstIterator c = node->childNodes().begin(); @@ -4397,7 +4318,8 @@ void DitaXmlGenerator::generateDetailedQmlMember(const Node* node, writeStartTag(DT_li); writeGuidAttribute((Node*)qpn); QString attr; - if (!qpn->isWritable(myTree)) + const ClassNode* cn = qpn->declarativeCppNode(); + if (cn && !qpn->isWritable(myTree)) attr = "read-only"; if (qpgn->isDefault()) { if (!attr.isEmpty()) diff --git a/tools/qdoc3/ditaxmlgenerator.h b/tools/qdoc3/ditaxmlgenerator.h index 408f46c..d8d3563 100644 --- a/tools/qdoc3/ditaxmlgenerator.h +++ b/tools/qdoc3/ditaxmlgenerator.h @@ -51,12 +51,6 @@ QT_BEGIN_NAMESPACE -typedef QMultiMap<QString, Node*> NodeMultiMap; -typedef QMap<QString, NodeMultiMap> NewSinceMaps; -typedef QMap<Node*, NodeMultiMap> ParentMaps; -typedef QMap<QString, const Node*> NodeMap; -typedef QMap<QString, NodeMap> NewClassMaps; - typedef QMap<QString, QString> GuidMap; typedef QMap<QString, GuidMap*> GuidMaps; @@ -418,7 +412,6 @@ class DitaXmlGenerator : public PageGenerator void findAllFunctions(const InnerNode *node); void findAllLegaleseTexts(const InnerNode *node); void findAllNamespaces(const InnerNode *node); - void findAllSince(const InnerNode *node); static int hOffset(const Node *node); static bool isThreeColumnEnumValueTable(const Atom *atom); virtual QString getLink(const Atom *atom, @@ -515,10 +508,6 @@ class DitaXmlGenerator : public PageGenerator #endif QMap<QString, NodeMap > funcIndex; QMap<Text, const Node*> legaleseTexts; - NewSinceMaps newSinceMaps; - static QString sinceTitles[]; - NewClassMaps newClassMaps; - NewClassMaps newQmlClassMaps; static int id; static QString ditaTags[]; QStack<QXmlStreamWriter*> xmlWriterStack; diff --git a/tools/qdoc3/doc.cpp b/tools/qdoc3/doc.cpp index 479931d..f1f1418 100644 --- a/tools/qdoc3/doc.cpp +++ b/tools/qdoc3/doc.cpp @@ -62,7 +62,7 @@ QT_BEGIN_NAMESPACE 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(QStringMap, null_QStringMap) Q_GLOBAL_STATIC(QStringMultiMap, null_QStringMultiMap) struct Macro @@ -828,7 +828,7 @@ void DocParser::parse(const QString& source, append(Atom::AnnotatedList, getArgument()); break; case CMD_SINCELIST: - append(Atom::SinceList, getArgument()); + append(Atom::SinceList, getRestOfLine().simplified()); break; case CMD_GENERATELIST: append(Atom::GeneratedList, getArgument()); @@ -1861,7 +1861,7 @@ void DocParser::startSection(Doc::Sections unit, int cmd) } -void DocParser::endSection(int unit, int endCmd) +void DocParser::endSection(int , int) // (int unit, int endCmd) { leavePara(); append(Atom::SectionRight, QString::number(currentSection)); diff --git a/tools/qdoc3/generator.cpp b/tools/qdoc3/generator.cpp index 3367301..355c9b2 100644 --- a/tools/qdoc3/generator.cpp +++ b/tools/qdoc3/generator.cpp @@ -77,6 +77,25 @@ QString Generator::outDir; QString Generator::project; QHash<QString, QString> Generator::outputPrefixes; +QString Generator::sinceTitles[] = + { + " New Namespaces", + " New Classes", + " New Member Functions", + " New Functions in Namespaces", + " New Global Functions", + " New Macros", + " New Enum Types", + " New Typedefs", + " New Properties", + " New Variables", + " New QML Elements", + " New QML Properties", + " New QML Signals", + " New QML Methods", + "" + }; + static void singularPlural(Text& text, const NodeList& nodes) { if (nodes.count() == 1) @@ -760,8 +779,18 @@ QString Generator::typeString(const Node *node) case Node::Class: return "class"; case Node::Fake: - default: - return "documentation"; + { + switch (node->subType()) { + case Node::QmlClass: + return "element"; + case Node::QmlPropertyGroup: + return "property group"; + case Node::QmlBasicType: + return "type"; + default: + return "documentation"; + } + } case Node::Enum: return "enum"; case Node::Typedef: @@ -770,6 +799,8 @@ QString Generator::typeString(const Node *node) return "function"; case Node::Property: return "property"; + default: + return "documentation"; } } @@ -783,10 +814,13 @@ QString Generator::imageFileName(const Node *relative, const QString& fileBase) if (filePath.isEmpty()) return QString(); - return QLatin1String("images/") - + Config::copyFile(relative->doc().location(), - filePath, userFriendlyFilePath, - outputDir() + QLatin1String("/images")); + QString path = Config::copyFile(relative->doc().location(), + filePath, + userFriendlyFilePath, + outputDir() + QLatin1String("/images")); + if (path[0] != '/') + return QLatin1String("images/") + path; + return QLatin1String("images") + path; } void Generator::setImageFileExtensions(const QStringList& extensions) @@ -1091,11 +1125,21 @@ void Generator::generateSince(const Node *node, CodeMarker *marker) text << " was introduced or modified in "; else text << " was introduced in "; - if (project.isEmpty()) - text << "version"; - else - text << project; - text << " " << node->since() << "." << Atom::ParaRight; + + QStringList since = node->since().split(" "); + if (since.count() == 1) { + // Handle legacy use of \since <version>. + if (project.isEmpty()) + text << "version"; + else + text << project; + text << " " << since[0]; + } else { + // Reconstruct the <project> <version> string. + text << " " << since.join(" "); + } + + text << "." << Atom::ParaRight; generateText(text, node, marker); } } @@ -1346,4 +1390,91 @@ QStringList Generator::getMetadataElements(const InnerNode* inner, const QString return s; } +/*! + For generating the "New Classes... in 4.6" section on the + What's New in 4.6" page. + */ +void Generator::findAllSince(const InnerNode *node) +{ + NodeList::const_iterator child = node->childNodes().constBegin(); + + // Traverse the tree, starting at the node supplied. + + while (child != node->childNodes().constEnd()) { + + QString sinceString = (*child)->since(); + + if (((*child)->access() != Node::Private) && !sinceString.isEmpty()) { + + // Insert a new entry into each map for each new since string found. + NewSinceMaps::iterator nsmap = newSinceMaps.find(sinceString); + if (nsmap == newSinceMaps.end()) + nsmap = newSinceMaps.insert(sinceString,NodeMultiMap()); + + NewClassMaps::iterator ncmap = newClassMaps.find(sinceString); + if (ncmap == newClassMaps.end()) + ncmap = newClassMaps.insert(sinceString,NodeMap()); + + NewClassMaps::iterator nqcmap = newQmlClassMaps.find(sinceString); + if (nqcmap == newQmlClassMaps.end()) + nqcmap = newQmlClassMaps.insert(sinceString,NodeMap()); + + if ((*child)->type() == Node::Function) { + // Insert functions into the general since map. + FunctionNode *func = static_cast<FunctionNode *>(*child); + if ((func->status() > Node::Obsolete) && + (func->metaness() != FunctionNode::Ctor) && + (func->metaness() != FunctionNode::Dtor)) { + nsmap.value().insert(func->name(),(*child)); + } + } + else if ((*child)->url().isEmpty()) { + if ((*child)->type() == Node::Class && !(*child)->doc().isEmpty()) { + // Insert classes into the since and class maps. + 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)); + ncmap.value().insert(className,(*child)); + } + else if ((*child)->subType() == Node::QmlClass) { + // Insert QML elements into the since and element maps. + 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 if ((*child)->type() == Node::QmlProperty) { + // Insert QML properties into the since map. + QString propertyName = (*child)->name(); + nsmap.value().insert(propertyName,(*child)); + } + } + else { + // Insert external documents into the general since map. + QString name = (*child)->name(); + if ((*child)->parent() && + (*child)->parent()->type() == Node::Namespace && + !(*child)->parent()->name().isEmpty()) + name = (*child)->parent()->name()+"::"+name; + + nsmap.value().insert(name,(*child)); + } + + // Find child nodes with since commands. + if ((*child)->isInnerNode()) { + findAllSince(static_cast<InnerNode *>(*child)); + } + } + ++child; + } +} + QT_END_NAMESPACE diff --git a/tools/qdoc3/generator.h b/tools/qdoc3/generator.h index e5e9747..e66915b 100644 --- a/tools/qdoc3/generator.h +++ b/tools/qdoc3/generator.h @@ -57,6 +57,12 @@ QT_BEGIN_NAMESPACE +typedef QMap<QString, const Node*> NodeMap; +typedef QMultiMap<QString, Node*> NodeMultiMap; +typedef QMap<QString, NodeMultiMap> NewSinceMaps; +typedef QMap<Node*, NodeMultiMap> ParentMaps; +typedef QMap<QString, NodeMap> NewClassMaps; + class ClassNode; class Config; class CodeMarker; @@ -152,6 +158,7 @@ class Generator QString getMetadataElement(const InnerNode* inner, const QString& t); QStringList getMetadataElements(const InnerNode* inner, const QString& t); + void findAllSince(const InnerNode *node); private: void generateReimplementedFrom(const FunctionNode *func, @@ -180,6 +187,11 @@ class Generator const NodeList& subs, CodeMarker *marker); + static QString sinceTitles[]; + NewSinceMaps newSinceMaps; + NewClassMaps newClassMaps; + NewClassMaps newQmlClassMaps; + private: QString amp; QString lt; diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 52da178..85ce9ac 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -66,25 +66,6 @@ bool HtmlGenerator::debugging_on = false; QString HtmlGenerator::divNavTop = ""; -QString HtmlGenerator::sinceTitles[] = - { - " New Namespaces", - " New Classes", - " New Member Functions", - " New Functions in Namespaces", - " New Global Functions", - " New Macros", - " New Enum Types", - " New Typedefs", - " New Properties", - " New Variables", - " New QML Elements", - " New QML Properties", - " New QML Signals", - " New QML Methods", - "" - }; - static bool showBrokenLinks = false; static QRegExp linkTag("(<@link node=\"([^\"]+)\">).*(</@link>)"); @@ -180,6 +161,9 @@ void HtmlGenerator::initializeGenerator(const Config &config) pleaseGenerateMacRef = config.getBool(HtmlGenerator::format() + Config::dot + HTMLGENERATOR_GENERATEMACREFS); + noBreadCrumbs = config.getBool(HtmlGenerator::format() + + Config::dot + + HTMLGENERATOR_NOBREADCRUMBS); project = config.getString(CONFIG_PROJECT); @@ -276,6 +260,7 @@ void HtmlGenerator::generateTree(const Tree *tree) generatePageIndex(outputDir() + "/" + fileBase + ".pageindex"); helpProjectWriter->generate(myTree); + generateManifestFiles(); } void HtmlGenerator::startText(const Node * /* relative */, @@ -331,8 +316,10 @@ int HtmlGenerator::generateAtom(const Atom *atom, break; case Atom::BriefLeft: if (relative->type() == Node::Fake) { - skipAhead = skipAtoms(atom, Atom::BriefRight); - break; + if (relative->subType() != Node::Example) { + skipAhead = skipAtoms(atom, Atom::BriefRight); + break; + } } out() << "<p>"; @@ -606,14 +593,18 @@ int HtmlGenerator::generateAtom(const Atom *atom, 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; + for (int i=0; i<LastSinceType; ++i) sections.append(Section(sinceTitle(i),QString(),QString(),QString())); NodeMultiMap::const_iterator n = nsmap.value().constBegin(); + while (n != nsmap.value().constEnd()) { + const Node* node = n.value(); switch (node->type()) { case Node::Fake: @@ -765,6 +756,15 @@ int HtmlGenerator::generateAtom(const Atom *atom, out() << " alt=\"" << protectEnc(text) << "\""; out() << " />"; helpProjectWriter->addExtraFile(fileName); + if ((relative->type() == Node::Fake) && + (relative->subType() == Node::Example)) { + const ExampleNode* cen = static_cast<const ExampleNode*>(relative); + if (cen->imageFileName().isEmpty()) { + ExampleNode* en = const_cast<ExampleNode*>(cen); + en->setImageFileName(fileName); + ExampleNode::exampleNodeMap.insert(en->title(),en); + } + } } if (atom->type() == Atom::Image) out() << "</p>"; @@ -1346,6 +1346,7 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) // Generate brief text and status for modules. generateBrief(fake, marker); generateStatus(fake, marker); + generateSince(fake, marker); if (moduleNamespaceMap.contains(fake->name())) { out() << "<a name=\"" << registerRef("namespaces") << "\"></a>" << divNavTop << "\n"; @@ -1362,6 +1363,7 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) // Generate brief text and status for modules. generateBrief(fake, marker); generateStatus(fake, marker); + generateSince(fake, marker); out() << "<ul>\n"; @@ -1393,6 +1395,7 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) generateQmlInherits(qml_cn, marker); generateQmlInheritedBy(qml_cn, marker); generateQmlInstantiates(qml_cn, marker); + generateSince(qml_cn, marker); QString allQmlMembersLink = generateAllQmlMembersFile(qml_cn, marker); if (!allQmlMembersLink.isEmpty()) { @@ -1504,8 +1507,10 @@ void HtmlGenerator::generateBreadCrumbs(const QString &title, const Node *node, CodeMarker *marker) { + if (noBreadCrumbs) + return; + Text breadcrumbs; - if (node->type() == Node::Class) { const ClassNode *cn = static_cast<const ClassNode *>(node); QString name = node->moduleName(); @@ -1792,7 +1797,6 @@ void HtmlGenerator::generateTableOfContents(const Node *node, toc = node->doc().tableOfContents(); if (toc.isEmpty() && !sections && (node->subType() != Node::Module)) return; - bool debug = false; QStringList sectionNumber; int detailsBase = 0; @@ -2242,9 +2246,6 @@ void HtmlGenerator::generateCompactList(const Node *relative, for (int i=0; i<NumParagraphs; i++) // i = 0..36 paragraphOffset[i+1] = paragraphOffset[i] + paragraph[i].count(); - int curParNr = 0; - int curParOffset = 0; - /* Output the alphabet as a row of links. */ @@ -2262,8 +2263,12 @@ void HtmlGenerator::generateCompactList(const Node *relative, Output a <div> element to contain all the <dl> elements. */ out() << "<div class=\"flowListDiv\">\n"; + numTableRows = 0; - for (int i=0; i<classMap.count()-1; i++) { + int curParNr = 0; + int curParOffset = 0; + + for (int i=0; i<classMap.count(); i++) { while ((curParNr < NumParagraphs) && (curParOffset == paragraph[curParNr].count())) { ++curParNr; @@ -2324,7 +2329,9 @@ void HtmlGenerator::generateCompactList(const Node *relative, out() << "</dd>\n"; curParOffset++; } - out() << "</dl>\n"; + if (classMap.count() > 0) + out() << "</dl>\n"; + out() << "</div>\n"; } @@ -3357,70 +3364,6 @@ void HtmlGenerator::findAllClasses(const InnerNode *node) } } -/*! - For generating the "New Classes... in 4.6" section on the - What's New in 4.6" page. - */ -void HtmlGenerator::findAllSince(const InnerNode *node) -{ - NodeList::const_iterator child = node->childNodes().constBegin(); - while (child != node->childNodes().constEnd()) { - QString sinceVersion = (*child)->since(); - if (((*child)->access() != Node::Private) && !sinceVersion.isEmpty()) { - NewSinceMaps::iterator nsmap = newSinceMaps.find(sinceVersion); - if (nsmap == newSinceMaps.end()) - nsmap = newSinceMaps.insert(sinceVersion,NodeMultiMap()); - 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); - if ((func->status() > Node::Obsolete) && - (func->metaness() != FunctionNode::Ctor) && - (func->metaness() != FunctionNode::Dtor)) { - nsmap.value().insert(func->name(),(*child)); - } - } - else if ((*child)->url().isEmpty()) { - if ((*child)->type() == Node::Class && !(*child)->doc().isEmpty()) { - 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)); - 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(); - if ((*child)->parent() && - (*child)->parent()->type() == Node::Namespace && - !(*child)->parent()->name().isEmpty()) - name = (*child)->parent()->name()+"::"+name; - nsmap.value().insert(name,(*child)); - } - if ((*child)->isInnerNode()) { - findAllSince(static_cast<InnerNode *>(*child)); - } - } - ++child; - } -} - void HtmlGenerator::findAllFunctions(const InnerNode *node) { NodeList::ConstIterator c = node->childNodes().begin(); @@ -3779,8 +3722,6 @@ void HtmlGenerator::endLink() inObsoleteLink = false; } -#ifdef QDOC_QML - /*! Generates the summary for the \a section. Only used for sections of QML element documentation. @@ -3837,7 +3778,8 @@ void HtmlGenerator::generateDetailedQmlMember(const Node *node, out() << "<a name=\"" + refForNode(qpn) + "\"></a>"; - if (!qpn->isWritable(myTree)) { + const ClassNode* cn = qpn->declarativeCppNode(); + if (cn && !qpn->isWritable(myTree)) { out() << "<span class=\"qmlreadonly\">read-only</span>"; } if (qpgn->isDefault()) @@ -4266,7 +4208,6 @@ QString HtmlGenerator::fullDocumentLocation(const Node *node) return ""; } else if (node->type() == Node::Fake) { -#ifdef QDOC_QML if ((node->subType() == Node::QmlClass) || (node->subType() == Node::QmlBasicType)) { QString fb = node->fileBase(); @@ -4274,9 +4215,9 @@ QString HtmlGenerator::fullDocumentLocation(const Node *node) return fb + ".html"; else return Generator::outputPrefix(QLatin1String("QML")) + node->fileBase() + QLatin1String(".html"); - } else -#endif - parentName = node->fileBase() + ".html"; + } + else + parentName = node->fileBase() + ".html"; } else if (node->fileBase().isEmpty()) return ""; @@ -4387,6 +4328,165 @@ QString HtmlGenerator::fullDocumentLocation(const Node *node) return parentName.toLower() + anchorRef; } -#endif +/*! + This function outputs one or more manifest files in XML. + They are used by Creator. + */ +void HtmlGenerator::generateManifestFiles() +{ + generateManifestFile("examples", "example"); + generateManifestFile("demos", "demo"); + ExampleNode::exampleNodeMap.clear(); +} + +/*! + This function is called by generaqteManiferstFile(), once + for each manifest file to be generated. \a manifest is the + type of manifest file. + */ +void HtmlGenerator::generateManifestFile(QString manifest, QString element) +{ + if (ExampleNode::exampleNodeMap.isEmpty()) + return; + QString fileName = manifest +"-manifest.xml"; + QFile file(outputDir() + "/" + fileName); + if (!file.open(QFile::WriteOnly | QFile::Text)) + return ; + bool demos = false; + if (manifest == "demos") + demos = true; + + bool proceed = false; + ExampleNodeMap::Iterator i = ExampleNode::exampleNodeMap.begin(); + while (i != ExampleNode::exampleNodeMap.end()) { + const ExampleNode* en = i.value(); + if (demos) { + if (en->name().startsWith("demos")) { + proceed = true; + break; + } + } + else if (!en->name().startsWith("demos")) { + proceed = true; + break; + } + ++i; + } + if (!proceed) + return; + + QXmlStreamWriter writer(&file); + writer.setAutoFormatting(true); + writer.writeStartDocument(); + writer.writeStartElement("instructionals"); + writer.writeAttribute("module", project); + writer.writeStartElement(manifest); + + i = ExampleNode::exampleNodeMap.begin(); + while (i != ExampleNode::exampleNodeMap.end()) { + const ExampleNode* en = i.value(); + if (demos) { + if (!en->name().startsWith("demos")) { + ++i; + continue; + } + } + else if (en->name().startsWith("demos")) { + ++i; + continue; + } + writer.writeStartElement(element); + writer.writeAttribute("name", en->title()); + //QString docUrl = projectUrl + "/" + en->fileBase() + ".html"; + QString docUrl = "%REPLACEME%/" + en->fileBase() + ".html"; + writer.writeAttribute("docUrl", docUrl); + foreach (const Node* child, en->childNodes()) { + if (child->subType() == Node::File) { + QString file = child->name(); + if (file.endsWith(".pro") || file.endsWith(".qmlproject")) { + if (file.startsWith("demos/")) + file = file.mid(6); + writer.writeAttribute("projectPath", file); + break; + } + } + } + //writer.writeAttribute("imageUrl", projectUrl + "/" + en->imageFileName()); + writer.writeAttribute("imageUrl", "%REPLACEME%/" + en->imageFileName()); + writer.writeStartElement("description"); + Text brief = en->doc().briefText(); + if (!brief.isEmpty()) + writer.writeCDATA(brief.toString()); + else + writer.writeCDATA(QString("No description available")); + writer.writeEndElement(); // description + QStringList tags = en->title().toLower().split(" "); + if (!tags.isEmpty()) { + writer.writeStartElement("tags"); + bool wrote_one = false; + for (int n=0; n<tags.size(); ++n) { + QString tag = tags.at(n); + if (tag.at(0).isDigit()) + continue; + if (tag.at(0) == '-') + continue; + if (tag.startsWith("example")) + continue; + if (tag.startsWith("chapter")) + continue; + if (tag.endsWith(":")) + tag.chop(1); + if (n>0 && wrote_one) + writer.writeCharacters(","); + writer.writeCharacters(tag); + wrote_one = true; + } + writer.writeEndElement(); // tags + } + + QString ename = en->name().mid(en->name().lastIndexOf('/')+1); + QSet<QString> usedNames; + foreach (const Node* child, en->childNodes()) { + if (child->subType() == Node::File) { + QString file = child->name(); + QString fileName = file.mid(file.lastIndexOf('/')+1); + QString baseName = fileName; + if ((fileName.count(QChar('.')) > 0) && + (fileName.endsWith(".cpp") || + fileName.endsWith(".h") || + fileName.endsWith(".qml"))) + baseName.truncate(baseName.lastIndexOf(QChar('.'))); + if (baseName.toLower() == ename) { + if (!usedNames.contains(fileName)) { + writer.writeStartElement("fileToOpen"); + if (file.startsWith("demos/")) + file = file.mid(6); + writer.writeCharacters(file); + writer.writeEndElement(); // fileToOpen + usedNames.insert(fileName); + } + } + else if (fileName.toLower().endsWith("main.cpp") || + fileName.toLower().endsWith("main.qml")) { + if (!usedNames.contains(fileName)) { + writer.writeStartElement("fileToOpen"); + if (file.startsWith("demos/")) + file = file.mid(6); + writer.writeCharacters(file); + writer.writeEndElement(); // fileToOpen + usedNames.insert(fileName); + } + } + } + } + writer.writeEndElement(); // example + ++i; + } + + writer.writeEndElement(); // examples + writer.writeEndElement(); // instructionals + writer.writeEndDocument(); + file.close(); +} QT_END_NAMESPACE diff --git a/tools/qdoc3/htmlgenerator.h b/tools/qdoc3/htmlgenerator.h index 70ec0b7..62a7f605 100644 --- a/tools/qdoc3/htmlgenerator.h +++ b/tools/qdoc3/htmlgenerator.h @@ -56,12 +56,6 @@ QT_BEGIN_NAMESPACE -typedef QMultiMap<QString, Node*> NodeMultiMap; -typedef QMap<QString, NodeMultiMap> NewSinceMaps; -typedef QMap<Node*, NodeMultiMap> ParentMaps; -typedef QMap<QString, const Node*> NodeMap; -typedef QMap<QString, NodeMap> NewClassMaps; - class HelpProjectWriter; class HtmlGenerator : public PageGenerator @@ -93,6 +87,7 @@ class HtmlGenerator : public PageGenerator virtual void terminateGenerator(); virtual QString format(); virtual void generateTree(const Tree *tree); + void generateManifestFiles(); QString protectEnc(const QString &string); static QString protect(const QString &string, const QString &encoding = "ISO-8859-1"); @@ -112,6 +107,8 @@ class HtmlGenerator : public PageGenerator virtual QString linkForNode(const Node *node, const Node *relative); virtual QString refForAtom(Atom *atom, const Node *node); + void generateManifestFile(QString manifest, QString element); + private: enum SubTitleSize { SmallSubTitle, LargeSubTitle }; enum ExtractionMarkType { @@ -224,7 +221,6 @@ class HtmlGenerator : public PageGenerator void findAllFunctions(const InnerNode *node); void findAllLegaleseTexts(const InnerNode *node); void findAllNamespaces(const InnerNode *node); - void findAllSince(const InnerNode *node); static int hOffset(const Node *node); static bool isThreeColumnEnumValueTable(const Atom *atom); virtual QString getLink(const Atom *atom, @@ -273,6 +269,7 @@ class HtmlGenerator : public PageGenerator QString footer; QString address; bool pleaseGenerateMacRef; + bool noBreadCrumbs; QString project; QString projectDescription; QString projectUrl; @@ -292,10 +289,6 @@ class HtmlGenerator : public PageGenerator NodeMap qmlClasses; QMap<QString, NodeMap > funcIndex; QMap<Text, const Node *> legaleseTexts; - NewSinceMaps newSinceMaps; - static QString sinceTitles[]; - NewClassMaps newClassMaps; - NewClassMaps newQmlClassMaps; static int id; public: static bool debugging_on; @@ -307,6 +300,7 @@ class HtmlGenerator : public PageGenerator #define HTMLGENERATOR_GENERATEMACREFS "generatemacrefs" // ### document me #define HTMLGENERATOR_POSTHEADER "postheader" #define HTMLGENERATOR_POSTPOSTHEADER "postpostheader" +#define HTMLGENERATOR_NOBREADCRUMBS "nobreadcrumbs" QT_END_NAMESPACE diff --git a/tools/qdoc3/node.cpp b/tools/qdoc3/node.cpp index 94b51f0..709f03f 100644 --- a/tools/qdoc3/node.cpp +++ b/tools/qdoc3/node.cpp @@ -51,6 +51,8 @@ QT_BEGIN_NAMESPACE +ExampleNodeMap ExampleNode::exampleNodeMap; + /*! \class Node \brief The Node class is a node in the Tree. @@ -157,6 +159,16 @@ void Node::setLink(LinkType linkType, const QString &link, const QString &desc) } /*! + Sets the information about the project and version a node was introduced + in. The string is simplified, removing excess whitespace before being + stored. +*/ +void Node::setSince(const QString &since) +{ + sinc = since.simplified(); +} + +/*! Returns a string representing the access specifier. */ QString Node::accessString() const @@ -307,6 +319,38 @@ QString Node::ditaXmlHref() } /*! + If this node is a QML class node, return a pointer to it. + If it is a child of a QML class node, return a pointer to + the QML class node. Otherwise, return 0; + */ +const QmlClassNode* Node::qmlClassNode() const +{ + if (isQmlNode()) { + const Node* n = this; + while (n && n->subType() != Node::QmlClass) + n = n->parent(); + if (n && n->subType() == Node::QmlClass) + return static_cast<const QmlClassNode*>(n); + } + return 0; +} + +/*! + If this node is a QML node, find its QML class node, + and return a pointer to the C++ class node from the + QML class node. That pointer will be null if the QML + class node is a component. It will be non-null if + the QML class node is a QML element. + */ +const ClassNode* Node::declarativeCppNode() const +{ + const QmlClassNode* qcn = qmlClassNode(); + if (qcn) + return qcn->classNode(); + return 0; +} + +/*! \class InnerNode */ @@ -1063,6 +1107,16 @@ QString FakeNode::subTitle() const } /*! + The constructor calls the FakeNode constructor with + \a parent, \a name, and Node::Example. + */ +ExampleNode::ExampleNode(InnerNode* parent, const QString& name) + : FakeNode(parent, name, Node::Example) +{ + // nothing +} + +/*! \class EnumNode */ diff --git a/tools/qdoc3/node.h b/tools/qdoc3/node.h index e1e9440..a08151a 100644 --- a/tools/qdoc3/node.h +++ b/tools/qdoc3/node.h @@ -58,7 +58,15 @@ QT_BEGIN_NAMESPACE +class Node; +class ClassNode; class InnerNode; +class ExampleNode; +class QmlClassNode; + +typedef QMap<QString, const Node*> NodeMap; +typedef QMultiMap<QString, Node*> NodeMultiMap; +typedef QMap<QString, const ExampleNode*> ExampleNodeMap; class Node { @@ -151,7 +159,7 @@ class Node void setDoc(const Doc& doc, bool replace = false); void setStatus(Status status) { sta = status; } void setThreadSafeness(ThreadSafeness safeness) { saf = safeness; } - void setSince(const QString &since) { sinc = since; } + void setSince(const QString &since); void setRelates(InnerNode* pseudoParent); void setModuleName(const QString &module) { mod = module; } void setLink(LinkType linkType, const QString &link, const QString &desc); @@ -194,6 +202,8 @@ class Node QString guid() const; QString ditaXmlHref(); QString extractClassName(const QString &string) const; + const QmlClassNode* qmlClassNode() const; + const ClassNode* declarativeCppNode() const; protected: Node(Type type, InnerNode* parent, const QString& name); @@ -380,8 +390,10 @@ class FakeNode : public InnerNode virtual QString title() const; virtual QString fullTitle() const; virtual QString subTitle() const; + virtual QString imageFileName() const { return QString(); } const NodeList &groupMembers() const { return gr; } virtual QString nameForLists() const { return title(); } + virtual void setImageFileName(const QString& ) { } private: SubType sub; @@ -390,7 +402,21 @@ class FakeNode : public InnerNode NodeList gr; }; -#ifdef QDOC_QML +class ExampleNode : public FakeNode +{ + public: + ExampleNode(InnerNode* parent, const QString& name); + virtual ~ExampleNode() { } + virtual QString imageFileName() const { return imageFileName_; } + virtual void setImageFileName(const QString& ifn) { imageFileName_ = ifn; } + + public: + static ExampleNodeMap exampleNodeMap; + + private: + QString imageFileName_; +}; + class QmlClassNode : public FakeNode { public: @@ -482,7 +508,6 @@ class QmlPropertyNode : public LeafNode Trool wri; bool att; }; -#endif class EnumItem { diff --git a/tools/qvfb/qvfb.pro b/tools/qvfb/qvfb.pro index df68c97..ca8f4f4 100644 --- a/tools/qvfb/qvfb.pro +++ b/tools/qvfb/qvfb.pro @@ -19,7 +19,10 @@ HEADERS = qvfb.h \ gammaview.h \ qvfbprotocol.h \ qvfbshmem.h \ - qvfbmmap.h + qvfbmmap.h \ + ../../src/gui/embedded/qlock_p.h \ + ../../src/gui/embedded/qwslock_p.h \ + ../../src/gui/embedded/qwssignalhandler_p.h SOURCES = qvfb.cpp \ qvfbview.cpp \ @@ -28,7 +31,10 @@ SOURCES = qvfb.cpp \ qanimationwriter.cpp \ qvfbprotocol.cpp \ qvfbshmem.cpp \ - qvfbmmap.cpp + qvfbmmap.cpp \ + ../../src/gui/embedded/qlock.cpp \ + ../../src/gui/embedded/qwslock.cpp \ + ../../src/gui/embedded/qwssignalhandler.cpp !embedded { DEFINES += QT_NO_QWS_SIGNALHANDLER |