diff options
author | Thiago Macieira <thiago.macieira@nokia.com> | 2009-12-26 19:49:55 (GMT) |
---|---|---|
committer | Thiago Macieira <thiago.macieira@nokia.com> | 2009-12-26 19:49:55 (GMT) |
commit | 24270550463fbc81c7725595719e6e21eade2819 (patch) | |
tree | 4e7c118ed3c4b42e43403960365a2672441ea05e /tools/qdoc3 | |
parent | 4376f8871b4422830e9ffb7f3acbc29766d8d218 (diff) | |
parent | 444fb94e02308bedc7b37a702adb95b740168a94 (diff) | |
download | Qt-24270550463fbc81c7725595719e6e21eade2819.zip Qt-24270550463fbc81c7725595719e6e21eade2819.tar.gz Qt-24270550463fbc81c7725595719e6e21eade2819.tar.bz2 |
Merge branch '4.6'
Conflicts:
examples/webkit/fancybrowser/main.cpp
src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
tools/assistant/tools/assistant/bookmarkmanager.cpp
Diffstat (limited to 'tools/qdoc3')
-rw-r--r-- | tools/qdoc3/cppcodeparser.cpp | 6 | ||||
-rw-r--r-- | tools/qdoc3/generator.cpp | 45 | ||||
-rw-r--r-- | tools/qdoc3/generator.h | 2 | ||||
-rw-r--r-- | tools/qdoc3/htmlgenerator.cpp | 4 |
4 files changed, 50 insertions, 7 deletions
diff --git a/tools/qdoc3/cppcodeparser.cpp b/tools/qdoc3/cppcodeparser.cpp index 41a2456..9ec7fdf 100644 --- a/tools/qdoc3/cppcodeparser.cpp +++ b/tools/qdoc3/cppcodeparser.cpp @@ -2318,9 +2318,9 @@ void CppCodeParser::createExampleFileNodes(FakeNode *fake) exampleFile.mid(sizeOfBoringPartOfName), Node::File); foreach (const QString &imageFile, imageFiles) { - FakeNode* newFake = new FakeNode(fake, - imageFile.mid(sizeOfBoringPartOfName), - Node::Image); + new FakeNode(fake, + imageFile.mid(sizeOfBoringPartOfName), + Node::Image); } } diff --git a/tools/qdoc3/generator.cpp b/tools/qdoc3/generator.cpp index 9389268..56fca06 100644 --- a/tools/qdoc3/generator.cpp +++ b/tools/qdoc3/generator.cpp @@ -65,6 +65,8 @@ QMap<QString, QStringList> Generator::imgFileExts; QSet<QString> Generator::outputFormats; QStringList Generator::imageFiles; QStringList Generator::imageDirs; +QStringList Generator::exampleDirs; +QStringList Generator::exampleImgExts; QString Generator::outDir; QString Generator::project; @@ -120,12 +122,19 @@ void Generator::initialize(const Config &config) if (!dirInfo.mkdir(outDir + "/images")) config.lastLocation().fatal(tr("Cannot create output directory '%1'") .arg(outDir + "/images")); + if (!dirInfo.mkdir(outDir + "/images/used-in-examples")) + config.lastLocation().fatal(tr("Cannot create output directory '%1'") + .arg(outDir + "/images/used-in-examples")); } imageFiles = config.getStringList(CONFIG_IMAGES); imageDirs = config.getStringList(CONFIG_IMAGEDIRS); + exampleDirs = config.getStringList(CONFIG_EXAMPLEDIRS); + exampleImgExts = config.getStringList(CONFIG_EXAMPLES + Config::dot + + CONFIG_IMAGEEXTENSIONS); - QString imagesDotFileExtensions = CONFIG_IMAGES + Config::dot + CONFIG_FILEEXTENSIONS; + QString imagesDotFileExtensions = + CONFIG_IMAGES + Config::dot + CONFIG_FILEEXTENSIONS; QSet<QString> formats = config.subVars(imagesDotFileExtensions); QSet<QString>::ConstIterator f = formats.begin(); while (f != formats.end()) { @@ -323,7 +332,7 @@ void Generator::generateBody(const Node *node, CodeMarker *marker) const FakeNode *fake = static_cast<const FakeNode *>(node); if (fake->subType() == Node::Example) generateExampleFiles(fake, marker); - else if (fake->subType() == Node::File) + else if ((fake->subType() == Node::File) || (fake->subType() == Node::Image)) quiet = true; } @@ -530,6 +539,13 @@ void Generator::generateInheritedBy(const ClassNode *classe, } } +/*! + This function is called when the documentation for an + example is being formatted. It outputs the list of source + files comprising the example, and the list of images used + by the example. The images are copied into a subtree of + \c{...doc/html/images/used-in-examples/...} + */ void Generator::generateFileList(const FakeNode* fake, CodeMarker* marker, Node::SubType subtype, @@ -546,9 +562,30 @@ void Generator::generateFileList(const FakeNode* fake, if (child->subType() == subtype) { ++count; QString file = child->name(); + if (subtype == Node::Image) { + if (!file.isEmpty()) { + QDir dirInfo; + QString userFriendlyFilePath; + QString srcPath = Config::findFile(fake->location(), + QStringList(), + exampleDirs, + file, + exampleImgExts, + userFriendlyFilePath); + userFriendlyFilePath.truncate(userFriendlyFilePath.lastIndexOf('/')); + + QString imgOutDir = outDir + "/images/used-in-examples/" + userFriendlyFilePath; + if (!dirInfo.mkpath(imgOutDir)) + fake->location().fatal(tr("Cannot create output directory '%1'") + .arg(imgOutDir)); + + QString imgOutName = Config::copyFile(fake->location(), + srcPath, + file, + imgOutDir); + } - if (file == "network/qftp/images/dir.png") - qDebug() << "FILE:" << file; + } openedList.next(); text << Atom(Atom::ListItemNumber, openedList.numberString()) diff --git a/tools/qdoc3/generator.h b/tools/qdoc3/generator.h index 7667789..cc1ea25 100644 --- a/tools/qdoc3/generator.h +++ b/tools/qdoc3/generator.h @@ -183,6 +183,8 @@ class Generator static QSet<QString> outputFormats; static QStringList imageFiles; static QStringList imageDirs; + static QStringList exampleDirs; + static QStringList exampleImgExts; static QString outDir; static QString project; }; diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 8711c6b..ae7bd81 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -3429,6 +3429,8 @@ QString HtmlGenerator::fileName(const Node *node) if (node->type() == Node::Fake) { if (static_cast<const FakeNode *>(node)->subType() == Node::ExternalPage) return node->name(); + if (static_cast<const FakeNode *>(node)->subType() == Node::Image) + return node->name(); } return PageGenerator::fileName(node); } @@ -4000,6 +4002,8 @@ QString HtmlGenerator::getLink(const Atom *atom, if (path.isEmpty()) { link = linkForNode(*node, relative); + if (*node && (*node)->subType() == Node::Image) + link = "images/used-in-examples/" + link; if (targetAtom) link += "#" + refForAtom(targetAtom, *node); } |