diff options
Diffstat (limited to 'src/tools')
-rw-r--r-- | src/tools/qdoc/config.cpp | 10 | ||||
-rw-r--r-- | src/tools/qdoc/helpprojectwriter.cpp | 32 | ||||
-rw-r--r-- | src/tools/qdoc/helpprojectwriter.h | 2 | ||||
-rw-r--r-- | src/tools/qdoc/main.cpp | 4 |
4 files changed, 24 insertions, 24 deletions
diff --git a/src/tools/qdoc/config.cpp b/src/tools/qdoc/config.cpp index 606bb1c619..13add73322 100644 --- a/src/tools/qdoc/config.cpp +++ b/src/tools/qdoc/config.cpp @@ -912,8 +912,10 @@ QStringList Config::loadMaster(const QString& fileName) */ void Config::load(Location location, const QString& fileName) { - pushWorkingDir(QFileInfo(fileName).path()); - QDir::setCurrent(QFileInfo(fileName).path()); + QFileInfo fileInfo(fileName); + QString path = fileInfo.canonicalPath(); + pushWorkingDir(path); + QDir::setCurrent(path); QRegExp keySyntax(QLatin1String("\\w+(?:\\.\\w+)*")); #define SKIP_CHAR() \ @@ -935,7 +937,7 @@ void Config::load(Location location, const QString& fileName) if (location.depth() > 16) location.fatal(tr("Too many nested includes")); - QFile fin(fileName); + QFile fin(fileInfo.fileName()); if (!fin.open(QFile::ReadOnly | QFile::Text)) { if (!Config::installDir.isEmpty()) { int prefix = location.filePath().length() - location.fileName().length(); @@ -1030,7 +1032,7 @@ void Config::load(Location location, const QString& fileName) /* Here is the recursive call. */ - load(location, QFileInfo(QFileInfo(fileName).dir(), includeFile).filePath()); + load(location, QFileInfo(QDir(path), includeFile).filePath()); } else { /* diff --git a/src/tools/qdoc/helpprojectwriter.cpp b/src/tools/qdoc/helpprojectwriter.cpp index 90b1d9cfe3..2ae952a962 100644 --- a/src/tools/qdoc/helpprojectwriter.cpp +++ b/src/tools/qdoc/helpprojectwriter.cpp @@ -107,13 +107,13 @@ void HelpProjectWriter::reset(const Config &config, subproject.sortPages = config.getBool(subprefix + "sortPages"); subproject.type = config.getString(subprefix + "type"); readSelectors(subproject, config.getStringList(subprefix + "selectors")); - project.subprojects[name] = subproject; + project.subprojects.append(subproject); } if (project.subprojects.isEmpty()) { SubProject subproject; readSelectors(subproject, config.getStringList(prefix + "selectors")); - project.subprojects.insert(QString(), subproject); + project.subprojects.insert(0, subproject); } projects.append(project); @@ -260,16 +260,16 @@ bool HelpProjectWriter::generateSection(HelpProject &project, // Only add nodes to the set for each subproject if they match a selector. // Those that match will be listed in the table of contents. - foreach (const QString &name, project.subprojects.keys()) { - SubProject subproject = project.subprojects[name]; + for (int i = 0; i < project.subprojects.length(); i++) { + SubProject subproject = project.subprojects[i]; // No selectors: accept all nodes. if (subproject.selectors.isEmpty()) { - project.subprojects[name].nodes[objName] = node; + project.subprojects[i].nodes[objName] = node; } else if (subproject.selectors.contains(node->type())) { // Accept only the node types in the selectors hash. if (node->type() != Node::Document) - project.subprojects[name].nodes[objName] = node; + project.subprojects[i].nodes[objName] = node; else { // Accept only fake nodes with subtypes contained in the selector's // mask. @@ -278,7 +278,7 @@ bool HelpProjectWriter::generateSection(HelpProject &project, docNode->subType() != Node::ExternalPage && !docNode->fullTitle().isEmpty()) { - project.subprojects[name].nodes[objName] = node; + project.subprojects[i].nodes[objName] = node; } } } @@ -713,8 +713,8 @@ void HelpProjectWriter::generateProject(HelpProject &project) generateSections(project, writer, rootNode); - foreach (const QString &name, project.subprojects.keys()) { - SubProject subproject = project.subprojects[name]; + for (int i = 0; i < project.subprojects.length(); i++) { + SubProject subproject = project.subprojects[i]; if (subproject.type == QLatin1String("manual")) { @@ -769,13 +769,12 @@ void HelpProjectWriter::generateProject(HelpProject &project) } else { - if (!name.isEmpty()) { - writer.writeStartElement("section"); - QString indexPath = gen_->fullDocumentLocation(qdb_->findNodeForTarget(subproject.indexTitle, 0), + writer.writeStartElement("section"); + QString indexPath = gen_->fullDocumentLocation(qdb_->findNodeForTarget(subproject.indexTitle, 0), false); - writer.writeAttribute("ref", indexPath); - writer.writeAttribute("title", subproject.title); - } + writer.writeAttribute("ref", indexPath); + writer.writeAttribute("title", subproject.title); + if (subproject.sortPages) { QStringList titles = subproject.nodes.keys(); titles.sort(); @@ -815,8 +814,7 @@ void HelpProjectWriter::generateProject(HelpProject &project) } } - if (!name.isEmpty()) - writer.writeEndElement(); // section + writer.writeEndElement(); // section } } diff --git a/src/tools/qdoc/helpprojectwriter.h b/src/tools/qdoc/helpprojectwriter.h index efc2596296..8f21238c2a 100644 --- a/src/tools/qdoc/helpprojectwriter.h +++ b/src/tools/qdoc/helpprojectwriter.h @@ -70,7 +70,7 @@ struct HelpProject QSet<QString> filterAttributes; QHash<QString, QSet<QString> > customFilters; QSet<QString> excluded; - QMap<QString, SubProject> subprojects; + QList<SubProject> subprojects; QHash<const Node *, QSet<Node::Status> > memberStatus; bool includeIndexNodes; }; diff --git a/src/tools/qdoc/main.cpp b/src/tools/qdoc/main.cpp index 74d706efe1..4a99ec39de 100644 --- a/src/tools/qdoc/main.cpp +++ b/src/tools/qdoc/main.cpp @@ -227,6 +227,8 @@ static void processQdocconfFile(const QString &fileName) config.setStringList(CONFIG_AUTOLINKERRORS, QStringList(autolinkErrors ? "true" : "false")); config.setStringList(CONFIG_OBSOLETELINKS, QStringList(obsoleteLinks ? "true" : "false")); + prevCurrentDir = QDir::currentPath(); + /* With the default configuration values in place, load the qdoc configuration file. Note that the configuration @@ -236,7 +238,6 @@ static void processQdocconfFile(const QString &fileName) in the file being processed, mainly for error reporting purposes. */ - currentDir = QFileInfo(fileName).path(); Location::initialize(config); config.load(fileName); QString project = config.getString(CONFIG_PROJECT); @@ -248,7 +249,6 @@ static void processQdocconfFile(const QString &fileName) config.setStringList(CONFIG_DEFINES,defs); Location::terminate(); - prevCurrentDir = QDir::currentPath(); currentDir = QFileInfo(fileName).path(); if (!currentDir.isEmpty()) QDir::setCurrent(currentDir); |