diff options
author | Paul Wicking <paul.wicking@qt.io> | 2019-08-09 06:25:01 +0200 |
---|---|---|
committer | Paul Wicking <paul.wicking@qt.io> | 2019-09-26 09:53:46 +0000 |
commit | 0407495a027b8e662c773eafb50ab66fd4638962 (patch) | |
tree | e6a1814255a1a2476524feef876946254c5ec84c | |
parent | 537a49e19c720c13bbd9df03b66ac406be8e95c5 (diff) |
QDoc: Move setting of configuration strings from main to Config
This change moves the setting of configuration values from main's
processQdocconfFile() to an overload of Config::setOptions(). This is
done as a first step in a move to set configuration values in the
Config class, without going via the QDocGlobal class. Thus, we can
eliminate large parts, if not all, use of the QDocGlobals class.
As a nice side-effect, this also saves redundantly repeating the same
transcribing of data from globals to config, once or twice as many
times as there are qdocFiles.
Change-Id: Iaa11008b9c67781f7ff004a8be4675a02610f58f
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
-rw-r--r-- | src/qdoc/config.cpp | 15 | ||||
-rw-r--r-- | src/qdoc/config.h | 2 | ||||
-rw-r--r-- | src/qdoc/main.cpp | 10 |
3 files changed, 18 insertions, 9 deletions
diff --git a/src/qdoc/config.cpp b/src/qdoc/config.cpp index e41810f7b..25c97af70 100644 --- a/src/qdoc/config.cpp +++ b/src/qdoc/config.cpp @@ -326,6 +326,21 @@ void Config::insertStringList(const QString &var, const QStringList &values) } /*! + Set configuration options from \a qdocGlobals. + */ +void Config::setOptions(const QDocGlobals &qdocGlobals) +{ + setStringList(CONFIG_SYNTAXHIGHLIGHTING, QStringList(qdocGlobals.highlighting() ? "true" : "false")); + setStringList(CONFIG_SHOWINTERNAL, QStringList(qdocGlobals.showInternal() ? "true" : "false")); + setStringList(CONFIG_SINGLEEXEC, QStringList(qdocGlobals.singleExec() ? "true" : "false")); + setStringList(CONFIG_WRITEQAPAGES, QStringList(qdocGlobals.writeQaPages() ? "true" : "false")); + setStringList(CONFIG_REDIRECTDOCUMENTATIONTODEVNULL, QStringList(qdocGlobals.redirectDocumentationToDevNull() ? "true" : "false")); + setStringList(CONFIG_NOLINKERRORS, QStringList(qdocGlobals.noLinkErrors() ? "true" : "false")); + setStringList(CONFIG_AUTOLINKERRORS, QStringList(qdocGlobals.autolinkErrors() ? "true" : "false")); + setStringList(CONFIG_OBSOLETELINKS, QStringList(qdocGlobals.obsoleteLinks() ? "true" : "false")); +} + +/*! Set configuration options from \a parser. */ void Config::setOptions(const QDocCommandLineParser &parser) diff --git a/src/qdoc/config.h b/src/qdoc/config.h index 06c1253b1..71ad6dc3b 100644 --- a/src/qdoc/config.h +++ b/src/qdoc/config.h @@ -35,6 +35,7 @@ #include "location.h" #include "qdoccommandlineparser.h" +#include "qdocglobals.h" #include <QtCore/qmap.h> #include <QtCore/qpair.h> @@ -83,6 +84,7 @@ public: void setStringList(const QString &var, const QStringList &values); void insertStringList(const QString &var, const QStringList &values); + void setOptions(const QDocGlobals &qdocGlobals); void setOptions(const QDocCommandLineParser &parser); const QString &programName() const { return prog; } const Location &location() const { return loc; } diff --git a/src/qdoc/main.cpp b/src/qdoc/main.cpp index b8bee56d5..364cfb63f 100644 --- a/src/qdoc/main.cpp +++ b/src/qdoc/main.cpp @@ -205,15 +205,6 @@ static void loadIndexFiles(Config &config, const QSet<QString> &formats) */ static void processQdocconfFile(const QString &fileName, Config &config) { - config.setStringList(CONFIG_SYNTAXHIGHLIGHTING, QStringList(qdocGlobals.highlighting() ? "true" : "false")); - config.setStringList(CONFIG_SHOWINTERNAL, QStringList(qdocGlobals.showInternal() ? "true" : "false")); - config.setStringList(CONFIG_SINGLEEXEC, QStringList(qdocGlobals.singleExec() ? "true" : "false")); - config.setStringList(CONFIG_WRITEQAPAGES, QStringList(qdocGlobals.writeQaPages() ? "true" : "false")); - config.setStringList(CONFIG_REDIRECTDOCUMENTATIONTODEVNULL, QStringList(qdocGlobals.redirectDocumentationToDevNull() ? "true" : "false")); - config.setStringList(CONFIG_NOLINKERRORS, QStringList(qdocGlobals.noLinkErrors() ? "true" : "false")); - config.setStringList(CONFIG_AUTOLINKERRORS, QStringList(qdocGlobals.autolinkErrors() ? "true" : "false")); - config.setStringList(CONFIG_OBSOLETELINKS, QStringList(qdocGlobals.obsoleteLinks() ? "true" : "false")); - qdocGlobals.setPreviousCurrentDir(QDir::currentPath()); /* @@ -582,6 +573,7 @@ int main(int argc, char **argv) qdocGlobals.setOptions(parser); config.setOptions(parser); postProcess(parser); + config.setOptions(qdocGlobals); // Get the list of files to act on: QStringList qdocFiles = parser.positionalArguments(); |