qdoc: Better use of versions of QML modules
Now qdoc doesn't use the QML module version number when it isn't necessary. Page names are cleaner without appending the version number to the QML module name. Also reduces the number of duplicate page warnings, but this will be updated further next time. Task-number: QTBUG-33257 Change-Id: Iba587164532bdc819523e0666f7561ac2dbd5e52 Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
This commit is contained in:
parent
cdc26c9316
commit
3260dfc0be
@ -314,34 +314,12 @@ QString Generator::fileBase(const Node *node) const
|
||||
return fileBase(ncn->currentChild());
|
||||
}
|
||||
|
||||
if (node->hasBaseName()) {
|
||||
//qDebug() << "RETURNING:" << node->baseName();
|
||||
if (node->hasBaseName())
|
||||
return node->baseName();
|
||||
}
|
||||
|
||||
QString base;
|
||||
const Node *p = node;
|
||||
|
||||
forever {
|
||||
const Node *pp = p->parent();
|
||||
base.prepend(p->name());
|
||||
if (!p->qmlModuleIdentifier().isEmpty())
|
||||
base.prepend(p->qmlModuleIdentifier()+QChar('-'));
|
||||
/*
|
||||
To avoid file name conflicts in the html directory,
|
||||
we prepend a prefix (by default, "qml-") to the file name of QML
|
||||
element doc files.
|
||||
*/
|
||||
if ((p->subType() == Node::QmlClass) ||
|
||||
(p->subType() == Node::QmlBasicType)) {
|
||||
base.prepend(outputPrefix(QLatin1String("QML")));
|
||||
}
|
||||
if (!pp || pp->name().isEmpty() || pp->type() == Node::Document)
|
||||
break;
|
||||
base.prepend(QLatin1Char('-'));
|
||||
p = pp;
|
||||
}
|
||||
if (node->type() == Node::Document) {
|
||||
base = node->name();
|
||||
if (node->subType() == Node::Collision) {
|
||||
const NameCollisionNode* ncn = static_cast<const NameCollisionNode*>(node);
|
||||
if (ncn->currentChild())
|
||||
@ -352,17 +330,42 @@ QString Generator::fileBase(const Node *node) const
|
||||
if (base.endsWith(".html"))
|
||||
base.truncate(base.length() - 5);
|
||||
|
||||
if (node->subType() == Node::QmlModule) {
|
||||
base.prepend("qmlmodule-");
|
||||
if (node->isQmlNode()) {
|
||||
if (!node->qmlModuleName().isEmpty()) {
|
||||
base.prepend(node->qmlModuleName() + QLatin1Char('-'));
|
||||
/*
|
||||
To avoid file name conflicts in the html directory,
|
||||
we prepend a prefix (by default, "qml-") to the file name of QML
|
||||
element doc files.
|
||||
*/
|
||||
if ((node->subType() == Node::QmlClass) || (node->subType() == Node::QmlBasicType)) {
|
||||
base.prepend(outputPrefix(QLatin1String("QML")));
|
||||
}
|
||||
if (node->subType() == Node::Module) {
|
||||
}
|
||||
}
|
||||
else if (node->subType() == Node::QmlModule) {
|
||||
base.append("-qmlmodule");
|
||||
}
|
||||
else if (node->subType() == Node::Module) {
|
||||
base.append("-module");
|
||||
}
|
||||
if (node->isExample() || node->isExampleFile())
|
||||
if (node->isExample() || node->isExampleFile()) {
|
||||
base.prepend(project.toLower() + QLatin1Char('-'));
|
||||
if (node->isExample())
|
||||
}
|
||||
if (node->isExample()) {
|
||||
base.append(QLatin1String("-example"));
|
||||
|
||||
}
|
||||
}
|
||||
else {
|
||||
const Node *p = node;
|
||||
forever {
|
||||
const Node *pp = p->parent();
|
||||
base.prepend(p->name());
|
||||
if (!pp || pp->name().isEmpty() || pp->type() == Node::Document)
|
||||
break;
|
||||
base.prepend(QLatin1Char('-'));
|
||||
p = pp;
|
||||
}
|
||||
}
|
||||
|
||||
// the code below is effectively equivalent to:
|
||||
|
@ -190,17 +190,19 @@ DocNode* QDocDatabase::findQmlModule(const QString& name)
|
||||
QStringList dotSplit;
|
||||
QStringList blankSplit = name.split(QLatin1Char(' '));
|
||||
QString qmid = blankSplit[0];
|
||||
QString qmlModuleName = qmid;
|
||||
if (blankSplit.size() > 1) {
|
||||
dotSplit = blankSplit[1].split(QLatin1Char('.'));
|
||||
qmid += dotSplit[0];
|
||||
}
|
||||
DocNode* dn = 0;
|
||||
if (qmlModules_.contains(qmid))
|
||||
return qmlModules_.value(qmid);
|
||||
dn = new DocNode(tree_->root(), name, Node::QmlModule, Node::OverviewPage);
|
||||
if (qmlModules_.contains(qmlModuleName))
|
||||
return qmlModules_.value(qmlModuleName);
|
||||
dn = new DocNode(tree_->root(), qmlModuleName, Node::QmlModule, Node::OverviewPage);
|
||||
dn->markNotSeen();
|
||||
dn->setQmlModuleInfo(name);
|
||||
qmlModules_.insert(qmid,dn);
|
||||
qmlModules_.insert(qmlModuleName,dn);
|
||||
masterMap_.insert(qmlModuleName,dn);
|
||||
masterMap_.insert(qmid,dn);
|
||||
masterMap_.insert(dn->name(),dn);
|
||||
return dn;
|
||||
@ -923,8 +925,10 @@ const DocNode* QDocDatabase::findDocNodeByTitle(const QString& title, const Node
|
||||
if (j != docNodesByTitle_.constEnd() && j.key() == i.key()) {
|
||||
QList<Location> internalLocations;
|
||||
while (j != docNodesByTitle_.constEnd()) {
|
||||
if (j.key() == i.key() && j.value()->url().isEmpty())
|
||||
if (j.key() == i.key() && j.value()->url().isEmpty()) {
|
||||
internalLocations.append(j.value()->location());
|
||||
break; // Just report one duplicate for now.
|
||||
}
|
||||
++j;
|
||||
}
|
||||
if (internalLocations.size() > 0) {
|
||||
|
@ -195,6 +195,7 @@ void QDocIndexFiles::readIndexSection(const QDomElement& element,
|
||||
qcn->setTitle(element.attribute("title"));
|
||||
QString qmlModuleName = element.attribute("qml-module-name");
|
||||
QString qmlModuleVersion = element.attribute("qml-module-version");
|
||||
if (!qmlModuleName.isEmpty())
|
||||
qdb_->addToQmlModule(qmlModuleName + " " + qmlModuleVersion, qcn);
|
||||
QString qmlFullBaseName = element.attribute("qml-base-type");
|
||||
if (!qmlFullBaseName.isEmpty())
|
||||
|
Loading…
Reference in New Issue
Block a user