summaryrefslogtreecommitdiffstats
path: root/tools/qdoc3/generator.cpp
diff options
context:
space:
mode:
authorMartin Smith <msmith@trolltech.com>2009-12-04 14:01:49 (GMT)
committerMartin Smith <msmith@trolltech.com>2009-12-04 14:01:49 (GMT)
commit77f274672480e5980d9f42e4fd94c9770279543b (patch)
tree159b4e4238d8e9ec6d5c056db4c8090a164850cb /tools/qdoc3/generator.cpp
parent271936b063fb261293e3f77f7a2273e3a4dbb5d6 (diff)
downloadQt-77f274672480e5980d9f42e4fd94c9770279543b.zip
Qt-77f274672480e5980d9f42e4fd94c9770279543b.tar.gz
Qt-77f274672480e5980d9f42e4fd94c9770279543b.tar.bz2
doc: Example page now lists images used by the example
It just links to an empty page at the moment, i.e., it doesn't load the images. But I will add that. Task-number: QTBUG-4484
Diffstat (limited to 'tools/qdoc3/generator.cpp')
-rw-r--r--tools/qdoc3/generator.cpp94
1 files changed, 71 insertions, 23 deletions
diff --git a/tools/qdoc3/generator.cpp b/tools/qdoc3/generator.cpp
index f7569ce..9389268 100644
--- a/tools/qdoc3/generator.cpp
+++ b/tools/qdoc3/generator.cpp
@@ -138,14 +138,15 @@ void Generator::initialize(const Config &config)
while (g != generators.end()) {
if (outputFormats.contains((*g)->format())) {
(*g)->initializeGenerator(config);
- QStringList extraImages = config.getStringList(CONFIG_EXTRAIMAGES +
- Config::dot +
- (*g)->format());
+ QStringList extraImages =
+ config.getStringList(CONFIG_EXTRAIMAGES+Config::dot+(*g)->format());
QStringList::ConstIterator e = extraImages.begin();
while (e != extraImages.end()) {
QString userFriendlyFilePath;
QString filePath = Config::findFile(config.lastLocation(),
- imageFiles, imageDirs, *e,
+ imageFiles,
+ imageDirs,
+ *e,
imgFileExts[(*g)->format()],
userFriendlyFilePath);
if (!filePath.isEmpty())
@@ -529,33 +530,80 @@ void Generator::generateInheritedBy(const ClassNode *classe,
}
}
-void Generator::generateExampleFiles(const FakeNode *fake, CodeMarker *marker)
+void Generator::generateFileList(const FakeNode* fake,
+ CodeMarker* marker,
+ Node::SubType subtype,
+ const QString& tag)
{
- if (fake->childNodes().isEmpty())
- return;
-
+ int count = 0;
+ Text text;
OpenedList openedList(OpenedList::Bullet);
- Text text;
- text << Atom::ParaLeft << "Files:" << Atom::ParaRight
+ text << Atom::ParaLeft << tag << Atom::ParaRight
<< Atom(Atom::ListLeft, openedList.styleString());
- foreach (const Node *child, fake->childNodes()) {
- QString exampleFile = child->name();
- openedList.next();
- text << Atom(Atom::ListItemNumber, openedList.numberString())
- << Atom(Atom::ListItemLeft, openedList.styleString())
- << Atom::ParaLeft
- << Atom(Atom::Link, exampleFile)
- << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK)
- << exampleFile
- << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK)
- << Atom::ParaRight
- << Atom(Atom::ListItemRight, openedList.styleString());
+
+ foreach (const Node* child, fake->childNodes()) {
+ if (child->subType() == subtype) {
+ ++count;
+ QString file = child->name();
+
+ if (file == "network/qftp/images/dir.png")
+ qDebug() << "FILE:" << file;
+
+ openedList.next();
+ text << Atom(Atom::ListItemNumber, openedList.numberString())
+ << Atom(Atom::ListItemLeft, openedList.styleString())
+ << Atom::ParaLeft
+ << Atom(Atom::Link, file)
+ << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK)
+ << file
+ << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK)
+ << Atom::ParaRight
+ << Atom(Atom::ListItemRight, openedList.styleString());
+ }
}
text << Atom(Atom::ListRight, openedList.styleString());
- generateText(text, fake, marker);
+ if (count > 0)
+ generateText(text, fake, marker);
}
+void Generator::generateExampleFiles(const FakeNode *fake, CodeMarker *marker)
+{
+ if (fake->childNodes().isEmpty())
+ return;
+ generateFileList(fake, marker, Node::File, QString("Files:"));
+ generateFileList(fake, marker, Node::Image, QString("Images:"));
+}
+
+#if 0
+ QList<Generator *>::ConstIterator g = generators.begin();
+ while (g != generators.end()) {
+ if (outputFormats.contains((*g)->format())) {
+ (*g)->initializeGenerator(config);
+ QStringList extraImages =
+ config.getStringList(CONFIG_EXTRAIMAGES+Config::dot+(*g)->format());
+ QStringList::ConstIterator e = extraImages.begin();
+ while (e != extraImages.end()) {
+ QString userFriendlyFilePath;
+ QString filePath = Config::findFile(config.lastLocation(),
+ imageFiles,
+ imageDirs,
+ *e,
+ imgFileExts[(*g)->format()],
+ userFriendlyFilePath);
+ if (!filePath.isEmpty())
+ Config::copyFile(config.lastLocation(),
+ filePath,
+ userFriendlyFilePath,
+ (*g)->outputDir() +
+ "/images");
+ ++e;
+ }
+ }
+ ++g;
+ }
+#endif
+
void Generator::generateModuleWarning(const ClassNode *classe,
CodeMarker *marker)
{