summaryrefslogtreecommitdiffstats
path: root/tools/qdoc3
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2009-12-07 04:40:54 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2009-12-07 04:40:54 (GMT)
commit93a2b57c7e3c2be5b1c64d3408d27acb4aa2c8fc (patch)
tree5efe4f6c6386e25dc7d3235c7f261d3fdf5a19c3 /tools/qdoc3
parent55a3fda3baf545cc7fbfa6b2c00705be40a7319b (diff)
parent47008b211fe3b972077466e593a2a9016446bab2 (diff)
downloadQt-93a2b57c7e3c2be5b1c64d3408d27acb4aa2c8fc.zip
Qt-93a2b57c7e3c2be5b1c64d3408d27acb4aa2c8fc.tar.gz
Qt-93a2b57c7e3c2be5b1c64d3408d27acb4aa2c8fc.tar.bz2
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/qt into kinetic-declarativeui
Conflicts: src/tools/moc/generator.cpp
Diffstat (limited to 'tools/qdoc3')
-rw-r--r--tools/qdoc3/config.cpp12
-rw-r--r--tools/qdoc3/config.h1
-rw-r--r--tools/qdoc3/cppcodeparser.cpp67
-rw-r--r--tools/qdoc3/cppcodeparser.h1
-rw-r--r--tools/qdoc3/generator.cpp94
-rw-r--r--tools/qdoc3/generator.h4
-rw-r--r--tools/qdoc3/node.cpp12
-rw-r--r--tools/qdoc3/node.h1
-rw-r--r--tools/qdoc3/test/assistant.qdocconf2
-rw-r--r--tools/qdoc3/test/designer.qdocconf2
-rw-r--r--tools/qdoc3/test/linguist.qdocconf2
-rw-r--r--tools/qdoc3/test/qmake.qdocconf2
-rw-r--r--tools/qdoc3/test/qt-build-docs.qdocconf7
-rw-r--r--tools/qdoc3/test/qt.qdocconf7
14 files changed, 178 insertions, 36 deletions
diff --git a/tools/qdoc3/config.cpp b/tools/qdoc3/config.cpp
index 0fc3606..1a4e46e 100644
--- a/tools/qdoc3/config.cpp
+++ b/tools/qdoc3/config.cpp
@@ -399,6 +399,13 @@ QStringList Config::getAllFiles(const QString &filesVar,
}
/*!
+ \a fileName is the path of the file to find.
+
+ \a files and \a dirs are the lists where we must find the
+ components of \a fileName.
+
+ \a location is used for obtaining the file and line numbers
+ for report qdoc errors.
*/
QString Config::findFile(const Location& location,
const QStringList& files,
@@ -527,6 +534,11 @@ QString Config::findFile(const Location& location,
}
/*!
+ Copies the \a sourceFilePath to the file name constructed by
+ concatenating \a targetDirPath and \a userFriendlySourceFilePath.
+ \a location is for identifying the file and line number where
+ a qdoc error occurred. The constructed output file name is
+ returned.
*/
QString Config::copyFile(const Location& location,
const QString& sourceFilePath,
diff --git a/tools/qdoc3/config.h b/tools/qdoc3/config.h
index 725129a..33e5739 100644
--- a/tools/qdoc3/config.h
+++ b/tools/qdoc3/config.h
@@ -161,6 +161,7 @@ class Config
#define CONFIG_VERSIONSYM "versionsym"
#define CONFIG_FILEEXTENSIONS "fileextensions"
+#define CONFIG_IMAGEEXTENSIONS "imageextensions"
#ifdef QDOC_QML
#define CONFIG_QMLONLY "qmlonly"
diff --git a/tools/qdoc3/cppcodeparser.cpp b/tools/qdoc3/cppcodeparser.cpp
index ce71e51..41a2456 100644
--- a/tools/qdoc3/cppcodeparser.cpp
+++ b/tools/qdoc3/cppcodeparser.cpp
@@ -197,8 +197,14 @@ CppCodeParser::CppCodeParser()
*/
CppCodeParser::~CppCodeParser()
{
+ // nothing.
}
+/*!
+ The constructor initializes a map of special node types
+ for identifying important nodes. And it initializes
+ some filters for identifying certain kinds of files.
+ */
void CppCodeParser::initializeParser(const Config &config)
{
CodeParser::initializeParser(config);
@@ -220,24 +226,46 @@ void CppCodeParser::initializeParser(const Config &config)
exampleNameFilter = exampleFilePatterns.join(" ");
else
exampleNameFilter = "*.cpp *.h *.js *.xq *.svg *.xml *.ui";
+
+ QStringList exampleImagePatterns = config.getStringList(
+ CONFIG_EXAMPLES + Config::dot + CONFIG_IMAGEEXTENSIONS);
+
+ if (!exampleImagePatterns.isEmpty())
+ exampleImageFilter = exampleImagePatterns.join(" ");
+ else
+ exampleImageFilter = "*.png";
}
+/*!
+ Clear the map of common node types and call
+ the same function in the base class.
+ */
void CppCodeParser::terminateParser()
{
nodeTypeMap.clear();
CodeParser::terminateParser();
}
+/*!
+ Returns "Cpp".
+ */
QString CppCodeParser::language()
{
return "Cpp";
}
+/*!
+ Returns a list of extensions for header files.
+ */
QString CppCodeParser::headerFileNameFilter()
{
return "*.ch *.h *.h++ *.hh *.hpp *.hxx";
}
+/*!
+ Returns a list of extensions for source files, i.e. not
+ header files.
+ */
QString CppCodeParser::sourceFileNameFilter()
{
return "*.c++ *.cc *.cpp *.cxx";
@@ -299,6 +327,12 @@ void CppCodeParser::parseSourceFile(const Location& location,
fclose(in);
}
+/*!
+ This is called after all the header files have been parsed.
+ I think the most important thing it does is resolve class
+ inheritance links in the tree. But it also initializes a
+ bunch of stuff.
+ */
void CppCodeParser::doneParsingHeaderFiles(Tree *tree)
{
tree->resolveInheritance();
@@ -345,6 +379,12 @@ void CppCodeParser::doneParsingHeaderFiles(Tree *tree)
mutableAssociativeIteratorClasses.clear();
}
+/*!
+ This is called after all the source files (i.e., not the
+ header files) have been parsed. It traverses the tree to
+ resolve property links, normalize overload signatures, and
+ do other housekeeping of the tree.
+ */
void CppCodeParser::doneParsingSourceFiles(Tree *tree)
{
tree->root()->makeUndocumentedChildrenInternal();
@@ -353,6 +393,13 @@ void CppCodeParser::doneParsingSourceFiles(Tree *tree)
tree->resolveProperties();
}
+/*!
+ This function searches the \a tree to find a FunctionNode
+ for a function with the signature \a synopsis. If the
+ \a relative node is provided, the search begins there. If
+ \a fuzzy is true, base classes are searched. The function
+ node is returned, if found.
+ */
const FunctionNode *CppCodeParser::findFunctionNode(const QString& synopsis,
Tree *tree,
Node *relative,
@@ -2212,6 +2259,7 @@ void CppCodeParser::createExampleFileNodes(FakeNode *fake)
exampleDirs,
proFileName,
userFriendlyFilePath);
+
if (fullPath.isEmpty()) {
QString tmp = proFileName;
proFileName = examplePath + "/" + "qbuild.pro";
@@ -2231,8 +2279,18 @@ void CppCodeParser::createExampleFileNodes(FakeNode *fake)
int sizeOfBoringPartOfName = fullPath.size() - proFileName.size();
fullPath.truncate(fullPath.lastIndexOf('/'));
- QStringList exampleFiles = Config::getFilesHere(fullPath,
- exampleNameFilter);
+ QStringList exampleFiles = Config::getFilesHere(fullPath,exampleNameFilter);
+ QString imagesPath = fullPath + "/images";
+ QStringList imageFiles = Config::getFilesHere(imagesPath,exampleImageFilter);
+
+#if 0
+ qDebug() << "examplePath:" << examplePath;
+ qDebug() << " exampleFiles" << exampleFiles;
+ qDebug() << "imagesPath:" << imagesPath;
+ qDebug() << "fullPath:" << fullPath;
+ qDebug() << " imageFiles" << imageFiles;
+#endif
+
if (!exampleFiles.isEmpty()) {
// move main.cpp and to the end, if it exists
QString mainCpp;
@@ -2259,6 +2317,11 @@ void CppCodeParser::createExampleFileNodes(FakeNode *fake)
(void) new FakeNode(fake,
exampleFile.mid(sizeOfBoringPartOfName),
Node::File);
+ foreach (const QString &imageFile, imageFiles) {
+ FakeNode* newFake = new FakeNode(fake,
+ imageFile.mid(sizeOfBoringPartOfName),
+ Node::Image);
+ }
}
QT_END_NAMESPACE
diff --git a/tools/qdoc3/cppcodeparser.h b/tools/qdoc3/cppcodeparser.h
index e2e9d55..fff5bd9 100644
--- a/tools/qdoc3/cppcodeparser.h
+++ b/tools/qdoc3/cppcodeparser.h
@@ -185,6 +185,7 @@ class CppCodeParser : public CodeParser
static QStringList exampleFiles;
static QStringList exampleDirs;
QString exampleNameFilter;
+ QString exampleImageFilter;
};
QT_END_NAMESPACE
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)
{
diff --git a/tools/qdoc3/generator.h b/tools/qdoc3/generator.h
index 0258534..7667789 100644
--- a/tools/qdoc3/generator.h
+++ b/tools/qdoc3/generator.h
@@ -119,6 +119,10 @@ class Generator
CodeMarker *marker,
bool generate,
int& numGeneratedAtoms);
+ void generateFileList(const FakeNode* fake,
+ CodeMarker* marker,
+ Node::SubType subtype,
+ const QString& tag);
void generateExampleFiles(const FakeNode *fake, CodeMarker *marker);
void generateModuleWarning(const ClassNode *classe, CodeMarker *marker);
diff --git a/tools/qdoc3/node.cpp b/tools/qdoc3/node.cpp
index 373002c..b855823 100644
--- a/tools/qdoc3/node.cpp
+++ b/tools/qdoc3/node.cpp
@@ -767,6 +767,9 @@ FakeNode::FakeNode(InnerNode *parent, const QString& name, SubType subtype)
}
/*!
+ Returns the fake node's full title, which is usually
+ just title(), but for some SubType values is different
+ from title()
*/
QString FakeNode::fullTitle() const
{
@@ -776,6 +779,12 @@ QString FakeNode::fullTitle() const
else
return title();
}
+ else if (sub == Image) {
+ if (title().isEmpty())
+ return name().mid(name().lastIndexOf('/') + 1) + " Image File";
+ else
+ return title();
+ }
else if (sub == HeaderFile) {
if (title().isEmpty())
return name();
@@ -788,13 +797,14 @@ QString FakeNode::fullTitle() const
}
/*!
+ Returns the subtitle.
*/
QString FakeNode::subTitle() const
{
if (!stle.isEmpty())
return stle;
- if (sub == File) {
+ if ((sub == File) || (sub == Image)) {
if (title().isEmpty() && name().contains("/"))
return name();
}
diff --git a/tools/qdoc3/node.h b/tools/qdoc3/node.h
index dbdc174..223f528 100644
--- a/tools/qdoc3/node.h
+++ b/tools/qdoc3/node.h
@@ -89,6 +89,7 @@ class Node
Example,
HeaderFile,
File,
+ Image,
Group,
Module,
Page,
diff --git a/tools/qdoc3/test/assistant.qdocconf b/tools/qdoc3/test/assistant.qdocconf
index 4ddc94a..adca7b4 100644
--- a/tools/qdoc3/test/assistant.qdocconf
+++ b/tools/qdoc3/test/assistant.qdocconf
@@ -17,7 +17,7 @@ qhp.Assistant.namespace = com.trolltech.assistant.460
qhp.Assistant.virtualFolder = qdoc
qhp.Assistant.indexTitle = Qt Assistant Manual
qhp.Assistant.extraFiles = classic.css images/qt-logo.png images/trolltech-logo.png
-qhp.Assistant.filterAttributes = qt 4.6.0 tools assistant
+qhp.Assistant.filterAttributes = qt 4.6.1 tools assistant
qhp.Assistant.customFilters.Assistant.name = Qt Assistant Manual
qhp.Assistant.customFilters.Assistant.filterAttributes = qt tools assistant
qhp.Assistant.subprojects = manual examples
diff --git a/tools/qdoc3/test/designer.qdocconf b/tools/qdoc3/test/designer.qdocconf
index 9d8bd23..d30ade9 100644
--- a/tools/qdoc3/test/designer.qdocconf
+++ b/tools/qdoc3/test/designer.qdocconf
@@ -17,7 +17,7 @@ qhp.Designer.namespace = com.trolltech.designer.460
qhp.Designer.virtualFolder = qdoc
qhp.Designer.indexTitle = Qt Designer Manual
qhp.Designer.extraFiles = classic.css images/qt-logo.png images/trolltech-logo.png
-qhp.Designer.filterAttributes = qt 4.6.0 tools designer
+qhp.Designer.filterAttributes = qt 4.6.1 tools designer
qhp.Designer.customFilters.Designer.name = Qt Designer Manual
qhp.Designer.customFilters.Designer.filterAttributes = qt tools designer
qhp.Designer.subprojects = manual examples
diff --git a/tools/qdoc3/test/linguist.qdocconf b/tools/qdoc3/test/linguist.qdocconf
index f433529..f06671b 100644
--- a/tools/qdoc3/test/linguist.qdocconf
+++ b/tools/qdoc3/test/linguist.qdocconf
@@ -17,7 +17,7 @@ qhp.Linguist.namespace = com.trolltech.linguist.460
qhp.Linguist.virtualFolder = qdoc
qhp.Linguist.indexTitle = Qt Linguist Manual
qhp.Linguist.extraFiles = classic.css images/qt-logo.png images/trolltech-logo.png
-qhp.Linguist.filterAttributes = qt 4.6.0 tools linguist
+qhp.Linguist.filterAttributes = qt 4.6.1 tools linguist
qhp.Linguist.customFilters.Linguist.name = Qt Linguist Manual
qhp.Linguist.customFilters.Linguist.filterAttributes = qt tools linguist
qhp.Linguist.subprojects = manual examples
diff --git a/tools/qdoc3/test/qmake.qdocconf b/tools/qdoc3/test/qmake.qdocconf
index dcb3c9a..ad27d75 100644
--- a/tools/qdoc3/test/qmake.qdocconf
+++ b/tools/qdoc3/test/qmake.qdocconf
@@ -17,7 +17,7 @@ qhp.qmake.namespace = com.trolltech.qmake.460
qhp.qmake.virtualFolder = qdoc
qhp.qmake.indexTitle = QMake Manual
qhp.qmake.extraFiles = classic.css images/qt-logo.png images/trolltech-logo.png
-qhp.qmake.filterAttributes = qt 4.6.0 tools qmake
+qhp.qmake.filterAttributes = qt 4.6.1 tools qmake
qhp.qmake.customFilters.qmake.name = qmake Manual
qhp.qmake.customFilters.qmake.filterAttributes = qt tools qmake
qhp.qmake.subprojects = manual
diff --git a/tools/qdoc3/test/qt-build-docs.qdocconf b/tools/qdoc3/test/qt-build-docs.qdocconf
index 0848beb..09dd979 100644
--- a/tools/qdoc3/test/qt-build-docs.qdocconf
+++ b/tools/qdoc3/test/qt-build-docs.qdocconf
@@ -32,9 +32,9 @@ qhp.Qt.extraFiles = classic.css \
images/dynamiclayouts-example.png \
images/stylesheet-coffee-plastique.png
-qhp.Qt.filterAttributes = qt 4.6.0 qtrefdoc
-qhp.Qt.customFilters.Qt.name = Qt 4.6.0
-qhp.Qt.customFilters.Qt.filterAttributes = qt 4.6.0
+qhp.Qt.filterAttributes = qt 4.6.1 qtrefdoc
+qhp.Qt.customFilters.Qt.name = Qt 4.6.1
+qhp.Qt.customFilters.Qt.filterAttributes = qt 4.6.1
qhp.Qt.subprojects = classes overviews examples
qhp.Qt.subprojects.classes.title = Classes
qhp.Qt.subprojects.classes.indexTitle = Qt's Classes
@@ -97,6 +97,7 @@ excludedirs = $QT_SOURCE_TREE/src/3rdparty/clucene \
sources.fileextensions = "*.cpp *.qdoc *.mm"
examples.fileextensions = "*.cpp *.h *.js *.xq *.svg *.xml *.ui *.qhp *.qhcp"
+examples.imageextensions = "*.png"
exampledirs = $QT_SOURCE_TREE/doc/src \
$QT_SOURCE_TREE/examples \
diff --git a/tools/qdoc3/test/qt.qdocconf b/tools/qdoc3/test/qt.qdocconf
index d019bdf..6d25432 100644
--- a/tools/qdoc3/test/qt.qdocconf
+++ b/tools/qdoc3/test/qt.qdocconf
@@ -34,9 +34,9 @@ qhp.Qt.extraFiles = classic.css \
images/dynamiclayouts-example.png \
images/stylesheet-coffee-plastique.png
-qhp.Qt.filterAttributes = qt 4.6.0 qtrefdoc
-qhp.Qt.customFilters.Qt.name = Qt 4.6.0
-qhp.Qt.customFilters.Qt.filterAttributes = qt 4.6.0
+qhp.Qt.filterAttributes = qt 4.6.1 qtrefdoc
+qhp.Qt.customFilters.Qt.name = Qt 4.6.1
+qhp.Qt.customFilters.Qt.filterAttributes = qt 4.6.1
qhp.Qt.subprojects = classes overviews examples
qhp.Qt.subprojects.classes.title = Classes
qhp.Qt.subprojects.classes.indexTitle = Qt's Classes
@@ -100,6 +100,7 @@ excludedirs = $QTDIR/src/3rdparty/clucene \
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 \