diff options
author | Topi Reinio <topi.reinio@qt.io> | 2020-01-03 23:10:47 +0100 |
---|---|---|
committer | Topi Reinio <topi.reinio@qt.io> | 2020-01-13 10:30:34 +0100 |
commit | ccdbf30b6ac9180ead6fc22c858b6fac112d493c (patch) | |
tree | 684348bac8eae2acffe5c78545a608bbee9c62a9 /src/qdoc/htmlgenerator.cpp | |
parent | ade15563a6c7613b58201e6e05e3f67fde3f6056 (diff) | |
download | qttools-ccdbf30b6ac9180ead6fc22c858b6fac112d493c.tar.gz |
qdoc: Make Config a singleton
There is no need to pass a pointer to Config throughout
the API; the only instance of it is created in main()
so we can turn it into a singleton.
Having access to Config without API changes makes
implementation of configurable features easier.
Change-Id: Ida47e067865082dfe036a7a97f7f1ffc736db346
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Diffstat (limited to 'src/qdoc/htmlgenerator.cpp')
-rw-r--r-- | src/qdoc/htmlgenerator.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/qdoc/htmlgenerator.cpp b/src/qdoc/htmlgenerator.cpp index ac1b8ddb3..c7cfb1cbc 100644 --- a/src/qdoc/htmlgenerator.cpp +++ b/src/qdoc/htmlgenerator.cpp @@ -32,6 +32,7 @@ #include "htmlgenerator.h" +#include "config.h" #include "codemarker.h" #include "codeparser.h" #include "helpprojectwriter.h" @@ -105,9 +106,9 @@ HtmlGenerator::~HtmlGenerator() /*! Initializes the HTML output generator's data structures - from the configuration class \a config. + from the configuration (Config) singleton. */ -void HtmlGenerator::initializeGenerator(const Config &config) +void HtmlGenerator::initializeGenerator() { static const struct { @@ -126,7 +127,8 @@ void HtmlGenerator::initializeGenerator(const Config &config) { ATOM_FORMATTING_UNDERLINE, "<u>", "</u>" }, { nullptr, nullptr, nullptr } }; - Generator::initializeGenerator(config); + Generator::initializeGenerator(); + Config &config = Config::instance(); obsoleteLinks = config.getBool(CONFIG_OBSOLETELINKS); setImageFileExtensions(QStringList() << "png" << "jpg" @@ -204,9 +206,9 @@ void HtmlGenerator::initializeGenerator(const Config &config) per qdoc execution. */ if (helpProjectWriter) - helpProjectWriter->reset(config, project.toLower() + ".qhp", this); + helpProjectWriter->reset(project.toLower() + ".qhp", this); else - helpProjectWriter = new HelpProjectWriter(config, project.toLower() + ".qhp", this); + helpProjectWriter = new HelpProjectWriter(project.toLower() + ".qhp", this); // Documentation template handling headerScripts = config.getString(HtmlGenerator::format() + Config::dot + CONFIG_HEADERSCRIPTS); @@ -217,7 +219,7 @@ void HtmlGenerator::initializeGenerator(const Config &config) QLatin1String("qthelp://") + config.getString(prefix + QLatin1String("namespace")); manifestDir += QLatin1Char('/') + config.getString(prefix + QLatin1String("virtualFolder")) + QLatin1Char('/'); - readManifestMetaContent(config); + readManifestMetaContent(); examplesPath = config.getString(CONFIG_EXAMPLESINSTALLPATH); if (!examplesPath.isEmpty()) examplesPath += QLatin1Char('/'); @@ -4089,8 +4091,9 @@ void HtmlGenerator::generateManifestFile(const QString &manifest, const QString The manifest metacontent map is cleared immediately after the manifest files have been generated. */ -void HtmlGenerator::readManifestMetaContent(const Config &config) +void HtmlGenerator::readManifestMetaContent() { + Config &config = Config::instance(); const QStringList names = config.getStringList(CONFIG_MANIFESTMETA + Config::dot + QStringLiteral("filters")); |