diff options
author | Martin Smith <martin.smith@digia.com> | 2013-09-09 13:08:55 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-10 16:11:15 +0200 |
commit | 3260dfc0be3e41cec4a444b9b5841ac468332d50 (patch) | |
tree | 92ca470f4f002c57ed5fd4a7c542f5fb545468d4 /src | |
parent | cdc26c9316eb32c5c57ecc07ad3fb8c67c87fc35 (diff) |
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>
Diffstat (limited to 'src')
-rw-r--r-- | src/tools/qdoc/generator.cpp | 63 | ||||
-rw-r--r-- | src/tools/qdoc/qdocdatabase.cpp | 14 | ||||
-rw-r--r-- | src/tools/qdoc/qdocindexfiles.cpp | 3 |
3 files changed, 44 insertions, 36 deletions
diff --git a/src/tools/qdoc/generator.cpp b/src/tools/qdoc/generator.cpp index 5583600bf6..cfea6235d3 100644 --- a/src/tools/qdoc/generator.cpp +++ b/src/tools/qdoc/generator.cpp @@ -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"))); + } + } + } + else if (node->subType() == Node::QmlModule) { + base.append("-qmlmodule"); } - if (node->subType() == Node::Module) { + 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: diff --git a/src/tools/qdoc/qdocdatabase.cpp b/src/tools/qdoc/qdocdatabase.cpp index a1e06c8020..f1a92c2eb3 100644 --- a/src/tools/qdoc/qdocdatabase.cpp +++ b/src/tools/qdoc/qdocdatabase.cpp @@ -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) { diff --git a/src/tools/qdoc/qdocindexfiles.cpp b/src/tools/qdoc/qdocindexfiles.cpp index 3283e978f4..cb387a9452 100644 --- a/src/tools/qdoc/qdocindexfiles.cpp +++ b/src/tools/qdoc/qdocindexfiles.cpp @@ -195,7 +195,8 @@ 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"); - qdb_->addToQmlModule(qmlModuleName + " " + qmlModuleVersion, qcn); + if (!qmlModuleName.isEmpty()) + qdb_->addToQmlModule(qmlModuleName + " " + qmlModuleVersion, qcn); QString qmlFullBaseName = element.attribute("qml-base-type"); if (!qmlFullBaseName.isEmpty()) qcn->setQmlBaseName(qmlFullBaseName); |