qdoc: Fixed a qdoc error problem

When a page exists in more than one file,
qdoc was reporting this sometimes without
reference to the locations of the files.
This has now been fixed.

Change-Id: I0697acc170b94a74b15fb384556dd76f764f7792
Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
This commit is contained in:
Martin Smith 2012-05-10 10:38:42 +02:00 committed by Qt by Nokia
parent 47e6ec0736
commit 3b6b8a0f74
3 changed files with 61 additions and 63 deletions

View File

@ -695,22 +695,34 @@ Node* CppCodeParser::processTopicCommand(const Doc& doc,
}
}
else if (command == COMMAND_EXTERNALPAGE) {
return new FakeNode(tree_->root(), arg.first, Node::ExternalPage, Node::ArticlePage);
FakeNode* fn = new FakeNode(tree_->root(), arg.first, Node::ExternalPage, Node::ArticlePage);
fn->setLocation(arg.second);
return fn;
}
else if (command == COMMAND_FILE) {
return new FakeNode(tree_->root(), arg.first, Node::File, Node::NoPageType);
FakeNode* fn = new FakeNode(tree_->root(), arg.first, Node::File, Node::NoPageType);
fn->setLocation(arg.second);
return fn;
}
else if (command == COMMAND_GROUP) {
return new FakeNode(tree_->root(), arg.first, Node::Group, Node::OverviewPage);
FakeNode* fn = new FakeNode(tree_->root(), arg.first, Node::Group, Node::OverviewPage);
fn->setLocation(arg.second);
return fn;
}
else if (command == COMMAND_HEADERFILE) {
return new FakeNode(tree_->root(), arg.first, Node::HeaderFile, Node::ApiPage);
FakeNode* fn = new FakeNode(tree_->root(), arg.first, Node::HeaderFile, Node::ApiPage);
fn->setLocation(arg.second);
return fn;
}
else if (command == COMMAND_MODULE) {
return new FakeNode(tree_->root(), arg.first, Node::Module, Node::OverviewPage);
FakeNode* fn = new FakeNode(tree_->root(), arg.first, Node::Module, Node::OverviewPage);
fn->setLocation(arg.second);
return fn;
}
else if (command == COMMAND_QMLMODULE) {
return FakeNode::lookupQmlModuleNode(tree_, arg);
FakeNode* fn = FakeNode::lookupQmlModuleNode(tree_, arg);
fn->setLocation(arg.second);
return fn;
}
else if (command == COMMAND_PAGE) {
Node::PageType ptype = Node::ArticlePage;
@ -758,6 +770,7 @@ Node* CppCodeParser::processTopicCommand(const Doc& doc,
}
else if (command == COMMAND_DITAMAP) {
FakeNode* fn = new DitaMapNode(tree_->root(), arg.first);
fn->setLocation(arg.second);
return fn;
}
else if (command == COMMAND_QMLCLASS) {
@ -785,7 +798,9 @@ Node* CppCodeParser::processTopicCommand(const Doc& doc,
return qcn;
}
else if (command == COMMAND_QMLBASICTYPE) {
return new QmlBasicTypeNode(tree_->root(), arg.first);
QmlBasicTypeNode* n = new QmlBasicTypeNode(tree_->root(), arg.first);
n->setLocation(arg.second);
return n;
}
else if ((command == COMMAND_QMLSIGNAL) ||
(command == COMMAND_QMLMETHOD) ||
@ -794,41 +809,33 @@ Node* CppCodeParser::processTopicCommand(const Doc& doc,
QString module;
QString element;
QString type;
if (splitQmlMethodArg(doc,arg.first,type,module,element)) {
if (splitQmlMethodArg(arg.first,type,module,element)) {
QmlClassNode* qmlClass = tree_->findQmlClassNode(module,element);
if (qmlClass) {
bool attached = false;
Node::Type nodeType = Node::QmlMethod;
if (command == COMMAND_QMLSIGNAL)
return makeFunctionNode(doc,
arg.first,
qmlClass,
Node::QmlSignal,
false,
COMMAND_QMLSIGNAL);
else if (command == COMMAND_QMLATTACHEDSIGNAL)
return makeFunctionNode(doc,
arg.first,
qmlClass,
Node::QmlSignal,
true,
COMMAND_QMLATTACHEDSIGNAL);
nodeType = Node::QmlSignal;
else if (command == COMMAND_QMLATTACHEDSIGNAL) {
nodeType = Node::QmlSignal;
attached = true;
}
else if (command == COMMAND_QMLMETHOD) {
return makeFunctionNode(doc,
arg.first,
qmlClass,
Node::QmlMethod,
false,
COMMAND_QMLMETHOD);
// do nothing
}
else if (command == COMMAND_QMLATTACHEDMETHOD)
return makeFunctionNode(doc,
arg.
first,
qmlClass,
Node::QmlMethod,
true,
COMMAND_QMLATTACHEDMETHOD);
attached = true;
else
return 0; // never get here.
FunctionNode* fn = makeFunctionNode(doc,
arg.first,
qmlClass,
nodeType,
attached,
command);
if (fn)
fn->setLocation(arg.second);
return fn;
}
}
}
@ -854,8 +861,7 @@ Node* CppCodeParser::processTopicCommand(const Doc& doc,
\note The two elements \e{Component} and \e{QtObject} never
have a module qualifier.
*/
bool CppCodeParser::splitQmlPropertyArg(const Doc& doc,
const QString& arg,
bool CppCodeParser::splitQmlPropertyArg(const QString& arg,
QString& type,
QString& module,
QString& element,
@ -878,11 +884,11 @@ bool CppCodeParser::splitQmlPropertyArg(const Doc& doc,
return true;
}
QString msg = "Unrecognizable QML module/component qualifier for " + arg;
doc.location().warning(tr(msg.toLatin1().data()));
location().warning(tr(msg.toLatin1().data()));
}
else {
QString msg = "Missing property type for " + arg;
doc.location().warning(tr(msg.toLatin1().data()));
location().warning(tr(msg.toLatin1().data()));
}
return false;
}
@ -901,8 +907,7 @@ bool CppCodeParser::splitQmlPropertyArg(const Doc& doc,
\note The two elements \e{Component} and \e{QtObject} never
have a module qualifier.
*/
bool CppCodeParser::splitQmlMethodArg(const Doc& doc,
const QString& arg,
bool CppCodeParser::splitQmlMethodArg(const QString& arg,
QString& type,
QString& module,
QString& element)
@ -935,7 +940,7 @@ bool CppCodeParser::splitQmlMethodArg(const Doc& doc,
return true;
}
QString msg = "Unrecognizable QML module/component qualifier for " + arg;
doc.location().warning(tr(msg.toLatin1().data()));
location().warning(tr(msg.toLatin1().data()));
return false;
}
@ -945,9 +950,7 @@ bool CppCodeParser::splitQmlMethodArg(const Doc& doc,
Currently, this function is called only for \e{qmlproperty}
and \e{qmlattachedproperty}.
*/
Node *CppCodeParser::processTopicCommandGroup(const Doc& doc,
const QString& command,
const ArgList& args)
Node *CppCodeParser::processTopicCommandGroup(const QString& command, const ArgList& args)
{
QmlPropGroupNode* qmlPropGroup = 0;
if ((command == COMMAND_QMLPROPERTY) ||
@ -960,7 +963,7 @@ Node *CppCodeParser::processTopicCommandGroup(const Doc& doc,
bool attached = (command == COMMAND_QMLATTACHEDPROPERTY);
ArgList::ConstIterator argsIter = args.begin();
arg = argsIter->first;
if (splitQmlPropertyArg(doc,arg,type,module,element,property)) {
if (splitQmlPropertyArg(arg,type,module,element,property)) {
QmlClassNode* qmlClass = tree_->findQmlClassNode(module,element);
if (qmlClass) {
qmlPropGroup = new QmlPropGroupNode(qmlClass,property); //,attached);
@ -984,7 +987,7 @@ Node *CppCodeParser::processTopicCommandGroup(const Doc& doc,
++argsIter;
while (argsIter != args.end()) {
arg = argsIter->first;
if (splitQmlPropertyArg(doc,arg,type,module,element,property)) {
if (splitQmlPropertyArg(arg,type,module,element,property)) {
QmlPropertyNode* qmlPropNode = new QmlPropertyNode(qmlPropGroup,
property,
type,
@ -2296,7 +2299,7 @@ bool CppCodeParser::matchDocsAndStuff()
if ((topic == COMMAND_QMLPROPERTY) ||
(topic == COMMAND_QMLATTACHEDPROPERTY)) {
Doc nodeDoc = doc;
Node *node = processTopicCommandGroup(nodeDoc,topic,args);
Node *node = processTopicCommandGroup(topic,args);
if (node != 0) {
nodes.append(node);
docs.append(nodeDoc);

View File

@ -89,23 +89,16 @@ protected:
virtual Node *processTopicCommand(const Doc& doc,
const QString& command,
const ArgLocPair& arg);
#ifdef QDOC_QML
// might need to implement this in QsCodeParser as well.
virtual Node *processTopicCommandGroup(const Doc& doc,
const QString& command,
const ArgList& args);
bool splitQmlPropertyArg(const Doc& doc,
const QString& arg,
virtual Node *processTopicCommandGroup(const QString& command, const ArgList& args);
bool splitQmlPropertyArg(const QString& arg,
QString& type,
QString& module,
QString& element,
QString& name);
bool splitQmlMethodArg(const Doc& doc,
const QString& arg,
bool splitQmlMethodArg(const QString& arg,
QString& type,
QString& module,
QString& element);
#endif
virtual QSet<QString> otherMetaCommands();
virtual void processOtherMetaCommand(const Doc& doc,
const QString& command,

View File

@ -430,8 +430,8 @@ static const char* const suffixes[NumSuffixes] = { "", "s", "es" };
/*!
This function searches for a node with the specified \a title.
If \a relative is provided, use it to disambiguate if it has a
QML module identifier.
If \a relative node is provided, it is used to disambiguate if
it has a QML module identifier.
*/
const FakeNode* Tree::findFakeNodeByTitle(const QString& title, const Node* relative ) const
{
@ -470,14 +470,13 @@ const FakeNode* Tree::findFakeNodeByTitle(const QString& title, const Node* rela
QList<Location> internalLocations;
while (j != priv->fakeNodesByTitle.constEnd()) {
if (j.key() == i.key() && j.value()->url().isEmpty())
internalLocations.append(j.value()->doc().location());
internalLocations.append(j.value()->location());
++j;
}
if (internalLocations.size() > 0) {
i.value()->doc().location().warning(
tr("Page '%1' defined in more than one location:").arg(title));
i.value()->location().warning(tr("This page exists in more than one file: \"%1\"").arg(title));
foreach (const Location &location, internalLocations)
location.warning(tr("(defined here)"));
location.warning(tr("[It also exists here]"));
}
}
return i.value();
@ -601,6 +600,8 @@ NodeMultiMap Tree::groups() const
}
/*!
This function adds the \a group name to the list of groups
for the \a node name. It also adds the \a node to the \a group.
*/
void Tree::addToPublicGroup(Node* node, const QString& group)
{
@ -609,6 +610,7 @@ void Tree::addToPublicGroup(Node* node, const QString& group)
}
/*!
Returns the public group map.
*/
QMultiMap<QString, QString> Tree::publicGroups() const
{