summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Wicking <paul.wicking@qt.io>2020-02-12 15:05:19 +0100
committerPaul Wicking <paul.wicking@qt.io>2020-02-14 13:59:27 +0100
commit46e0f5fb0ce72ac8cf8776f26c3c9ff8659261a8 (patch)
tree99745486040aa078320bf6f1e7d0b64a51ff60a6
parentdcc343bcf49e560805cec8f5959fd4e4c93167df (diff)
QDoc: Let generators keep a pointer to Config
This change is a prerequisite for disentangling Config from Generator. Change-Id: Ib073bd8fcaf743530ed68271373b885fa4bef46b Reviewed-by: Topi Reiniƶ <topi.reinio@qt.io>
-rw-r--r--src/qdoc/docbookgenerator.cpp10
-rw-r--r--src/qdoc/docbookgenerator.h3
-rw-r--r--src/qdoc/htmlgenerator.cpp89
-rw-r--r--src/qdoc/htmlgenerator.h3
4 files changed, 56 insertions, 49 deletions
diff --git a/src/qdoc/docbookgenerator.cpp b/src/qdoc/docbookgenerator.cpp
index e7b53cbf3..39604ce15 100644
--- a/src/qdoc/docbookgenerator.cpp
+++ b/src/qdoc/docbookgenerator.cpp
@@ -103,19 +103,19 @@ void DocBookGenerator::initializeGenerator()
{
// Excerpts from HtmlGenerator::initializeGenerator.
Generator::initializeGenerator();
- Config &config = Config::instance();
+ config = &Config::instance();
- project = config.getString(CONFIG_PROJECT);
+ project = config->getString(CONFIG_PROJECT);
- projectDescription = config.getString(CONFIG_DESCRIPTION);
+ projectDescription = config->getString(CONFIG_DESCRIPTION);
if (projectDescription.isEmpty() && !project.isEmpty())
projectDescription = project + QLatin1String(" Reference Documentation");
- naturalLanguage = config.getString(CONFIG_NATURALLANGUAGE);
+ naturalLanguage = config->getString(CONFIG_NATURALLANGUAGE);
if (naturalLanguage.isEmpty())
naturalLanguage = QLatin1String("en");
- buildversion = config.getString(CONFIG_BUILDVERSION);
+ buildversion = config->getString(CONFIG_BUILDVERSION);
}
QString DocBookGenerator::format()
diff --git a/src/qdoc/docbookgenerator.h b/src/qdoc/docbookgenerator.h
index 285156638..806482101 100644
--- a/src/qdoc/docbookgenerator.h
+++ b/src/qdoc/docbookgenerator.h
@@ -37,6 +37,7 @@
#include <qregexp.h>
#include <qxmlstream.h>
#include "codemarker.h"
+#include "config.h"
#include "xmlgenerator.h"
#include <QtCore/qxmlstream.h>
@@ -173,6 +174,8 @@ private:
QString naturalLanguage;
QString buildversion;
QXmlStreamWriter *writer = nullptr;
+
+ Config *config;
};
QT_END_NAMESPACE
diff --git a/src/qdoc/htmlgenerator.cpp b/src/qdoc/htmlgenerator.cpp
index 0f84d9776..5ddd7ef9e 100644
--- a/src/qdoc/htmlgenerator.cpp
+++ b/src/qdoc/htmlgenerator.cpp
@@ -128,8 +128,8 @@ void HtmlGenerator::initializeGenerator()
{ nullptr, nullptr, nullptr } };
Generator::initializeGenerator();
- Config &config = Config::instance();
- obsoleteLinks = config.getBool(CONFIG_OBSOLETELINKS);
+ config = &Config::instance();
+ obsoleteLinks = config->getBool(CONFIG_OBSOLETELINKS);
setImageFileExtensions(QStringList() << "png"
<< "jpg"
<< "jpeg"
@@ -147,49 +147,50 @@ void HtmlGenerator::initializeGenerator()
i++;
}
- style = config.getString(HtmlGenerator::format() + Config::dot + CONFIG_STYLE);
- endHeader = config.getString(HtmlGenerator::format() + Config::dot + CONFIG_ENDHEADER);
- postHeader = config.getString(HtmlGenerator::format() + Config::dot + HTMLGENERATOR_POSTHEADER);
+ style = config->getString(HtmlGenerator::format() + Config::dot + CONFIG_STYLE);
+ endHeader = config->getString(HtmlGenerator::format() + Config::dot + CONFIG_ENDHEADER);
+ postHeader =
+ config->getString(HtmlGenerator::format() + Config::dot + HTMLGENERATOR_POSTHEADER);
postPostHeader =
- config.getString(HtmlGenerator::format() + Config::dot + HTMLGENERATOR_POSTPOSTHEADER);
- prologue = config.getString(HtmlGenerator::format() + Config::dot + HTMLGENERATOR_PROLOGUE);
+ config->getString(HtmlGenerator::format() + Config::dot + HTMLGENERATOR_POSTPOSTHEADER);
+ prologue = config->getString(HtmlGenerator::format() + Config::dot + HTMLGENERATOR_PROLOGUE);
- footer = config.getString(HtmlGenerator::format() + Config::dot + HTMLGENERATOR_FOOTER);
- address = config.getString(HtmlGenerator::format() + Config::dot + HTMLGENERATOR_ADDRESS);
+ footer = config->getString(HtmlGenerator::format() + Config::dot + HTMLGENERATOR_FOOTER);
+ address = config->getString(HtmlGenerator::format() + Config::dot + HTMLGENERATOR_ADDRESS);
pleaseGenerateMacRef =
- config.getBool(HtmlGenerator::format() + Config::dot + HTMLGENERATOR_GENERATEMACREFS);
+ config->getBool(HtmlGenerator::format() + Config::dot + HTMLGENERATOR_GENERATEMACREFS);
noNavigationBar =
- config.getBool(HtmlGenerator::format() + Config::dot + HTMLGENERATOR_NONAVIGATIONBAR);
- navigationSeparator = config.getString(HtmlGenerator::format() + Config::dot
- + HTMLGENERATOR_NAVIGATIONSEPARATOR);
- tocDepth = config.getInt(HtmlGenerator::format() + Config::dot + HTMLGENERATOR_TOCDEPTH);
+ config->getBool(HtmlGenerator::format() + Config::dot + HTMLGENERATOR_NONAVIGATIONBAR);
+ navigationSeparator = config->getString(HtmlGenerator::format() + Config::dot
+ + HTMLGENERATOR_NAVIGATIONSEPARATOR);
+ tocDepth = config->getInt(HtmlGenerator::format() + Config::dot + HTMLGENERATOR_TOCDEPTH);
- project = config.getString(CONFIG_PROJECT);
+ project = config->getString(CONFIG_PROJECT);
- projectDescription = config.getString(CONFIG_DESCRIPTION);
+ projectDescription = config->getString(CONFIG_DESCRIPTION);
if (projectDescription.isEmpty() && !project.isEmpty())
projectDescription = project + QLatin1String(" Reference Documentation");
- projectUrl = config.getString(CONFIG_URL);
- tagFile_ = config.getString(CONFIG_TAGFILE);
+ projectUrl = config->getString(CONFIG_URL);
+ tagFile_ = config->getString(CONFIG_TAGFILE);
#ifndef QT_NO_TEXTCODEC
- outputEncoding = config.getString(CONFIG_OUTPUTENCODING);
+ outputEncoding = config->getString(CONFIG_OUTPUTENCODING);
if (outputEncoding.isEmpty())
outputEncoding = QLatin1String("UTF-8");
outputCodec = QTextCodec::codecForName(outputEncoding.toLocal8Bit());
#endif
- naturalLanguage = config.getString(CONFIG_NATURALLANGUAGE);
+ naturalLanguage = config->getString(CONFIG_NATURALLANGUAGE);
if (naturalLanguage.isEmpty())
naturalLanguage = QLatin1String("en");
- const QSet<QString> editionNames = config.subVars(CONFIG_EDITION);
+ const QSet<QString> editionNames = config->subVars(CONFIG_EDITION);
for (const auto &editionName : editionNames) {
- QStringList editionModules = config.getStringList(CONFIG_EDITION + Config::dot + editionName
- + Config::dot + "modules");
- QStringList editionGroups = config.getStringList(CONFIG_EDITION + Config::dot + editionName
- + Config::dot + "groups");
+ QStringList editionModules = config->getStringList(CONFIG_EDITION + Config::dot
+ + editionName + Config::dot + "modules");
+ QStringList editionGroups = config->getStringList(CONFIG_EDITION + Config::dot + editionName
+ + Config::dot + "groups");
if (!editionModules.isEmpty())
editionModuleMap[editionName] = editionModules;
@@ -197,9 +198,9 @@ void HtmlGenerator::initializeGenerator()
editionGroupMap[editionName] = editionGroups;
}
- codeIndent = config.getInt(CONFIG_CODEINDENT); // QTBUG-27798
- codePrefix = config.getString(CONFIG_CODEPREFIX);
- codeSuffix = config.getString(CONFIG_CODESUFFIX);
+ codeIndent = config->getInt(CONFIG_CODEINDENT); // QTBUG-27798
+ codePrefix = config->getString(CONFIG_CODEPREFIX);
+ codeSuffix = config->getString(CONFIG_CODESUFFIX);
/*
The help file write should be allocated once and only once
@@ -211,40 +212,40 @@ void HtmlGenerator::initializeGenerator()
helpProjectWriter = new HelpProjectWriter(project.toLower() + ".qhp", this);
// Documentation template handling
- headerScripts = config.getString(HtmlGenerator::format() + Config::dot + CONFIG_HEADERSCRIPTS);
- headerStyles = config.getString(HtmlGenerator::format() + Config::dot + CONFIG_HEADERSTYLES);
+ headerScripts = config->getString(HtmlGenerator::format() + Config::dot + CONFIG_HEADERSCRIPTS);
+ headerStyles = config->getString(HtmlGenerator::format() + Config::dot + CONFIG_HEADERSTYLES);
QString prefix = CONFIG_QHP + Config::dot + project + Config::dot;
manifestDir =
- QLatin1String("qthelp://") + config.getString(prefix + QLatin1String("namespace"));
- manifestDir += QLatin1Char('/') + config.getString(prefix + QLatin1String("virtualFolder"))
+ QLatin1String("qthelp://") + config->getString(prefix + QLatin1String("namespace"));
+ manifestDir += QLatin1Char('/') + config->getString(prefix + QLatin1String("virtualFolder"))
+ QLatin1Char('/');
readManifestMetaContent();
- examplesPath = config.getString(CONFIG_EXAMPLESINSTALLPATH);
+ examplesPath = config->getString(CONFIG_EXAMPLESINSTALLPATH);
if (!examplesPath.isEmpty())
examplesPath += QLatin1Char('/');
// Retrieve the config for the navigation bar
- homepage = config.getString(CONFIG_NAVIGATION + Config::dot + CONFIG_HOMEPAGE);
+ homepage = config->getString(CONFIG_NAVIGATION + Config::dot + CONFIG_HOMEPAGE);
- hometitle = config.getString(CONFIG_NAVIGATION + Config::dot + CONFIG_HOMETITLE, homepage);
+ hometitle = config->getString(CONFIG_NAVIGATION + Config::dot + CONFIG_HOMETITLE, homepage);
- landingpage = config.getString(CONFIG_NAVIGATION + Config::dot + CONFIG_LANDINGPAGE);
+ landingpage = config->getString(CONFIG_NAVIGATION + Config::dot + CONFIG_LANDINGPAGE);
landingtitle =
- config.getString(CONFIG_NAVIGATION + Config::dot + CONFIG_LANDINGTITLE, landingpage);
+ config->getString(CONFIG_NAVIGATION + Config::dot + CONFIG_LANDINGTITLE, landingpage);
- cppclassespage = config.getString(CONFIG_NAVIGATION + Config::dot + CONFIG_CPPCLASSESPAGE);
+ cppclassespage = config->getString(CONFIG_NAVIGATION + Config::dot + CONFIG_CPPCLASSESPAGE);
- cppclassestitle = config.getString(CONFIG_NAVIGATION + Config::dot + CONFIG_CPPCLASSESTITLE,
- QLatin1String("C++ Classes"));
+ cppclassestitle = config->getString(CONFIG_NAVIGATION + Config::dot + CONFIG_CPPCLASSESTITLE,
+ QLatin1String("C++ Classes"));
- qmltypespage = config.getString(CONFIG_NAVIGATION + Config::dot + CONFIG_QMLTYPESPAGE);
+ qmltypespage = config->getString(CONFIG_NAVIGATION + Config::dot + CONFIG_QMLTYPESPAGE);
- qmltypestitle = config.getString(CONFIG_NAVIGATION + Config::dot + CONFIG_QMLTYPESTITLE,
- QLatin1String("QML Types"));
+ qmltypestitle = config->getString(CONFIG_NAVIGATION + Config::dot + CONFIG_QMLTYPESTITLE,
+ QLatin1String("QML Types"));
- buildversion = config.getString(CONFIG_BUILDVERSION);
+ buildversion = config->getString(CONFIG_BUILDVERSION);
}
/*!
diff --git a/src/qdoc/htmlgenerator.h b/src/qdoc/htmlgenerator.h
index 1c95d7349..ea50e4baf 100644
--- a/src/qdoc/htmlgenerator.h
+++ b/src/qdoc/htmlgenerator.h
@@ -42,6 +42,7 @@
QT_BEGIN_NAMESPACE
+class Config;
class HelpProjectWriter;
class HtmlGenerator : public XmlGenerator
@@ -200,6 +201,8 @@ private:
QString qflagsHref_;
int tocDepth;
+ Config *config;
+
public:
static bool debugging_on;
static QString divNavTop;