summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/qdoc/config.cpp130
-rw-r--r--src/qdoc/config.h34
-rw-r--r--src/qdoc/main.cpp110
-rw-r--r--src/qdoc/qdoc.pro2
-rw-r--r--src/qdoc/qdocglobals.cpp213
-rw-r--r--src/qdoc/qdocglobals.h109
-rw-r--r--tests/auto/qdoc/qdoc.pro3
-rw-r--r--tests/auto/qdoc/qdocglobals/qdocglobals.pro9
-rw-r--r--tests/auto/qdoc/qdocglobals/tst_qdocglobals.cpp205
9 files changed, 165 insertions, 650 deletions
diff --git a/src/qdoc/config.cpp b/src/qdoc/config.cpp
index 7b96ebdd7..1ffcdd39a 100644
--- a/src/qdoc/config.cpp
+++ b/src/qdoc/config.cpp
@@ -261,12 +261,14 @@ QMap<QString, QStringList> Config::includeFilesMap_;
/*!
The constructor sets the \a programName and initializes all
- internal state variables to empty values.
+ internal state variables to either default values or to ones
+ defined in command line arguments \a args.
*/
-Config::Config(const QString &programName)
+Config::Config(const QString &programName, const QStringList &args)
: prog(programName)
{
numInstances++;
+ processCommandLineOptions(args);
reset();
}
@@ -299,26 +301,51 @@ void Config::reset()
setStringList(CONFIG_LANGUAGE, QStringList("Cpp")); // i.e. C++
setStringList(CONFIG_OUTPUTFORMATS, QStringList("HTML"));
setStringList(CONFIG_TABSIZE, QStringList("8"));
+
+ // Publish options from the command line as config variables
+ const auto setListFlag = [this](const QString &key, bool test) {
+ setStringList(key, QStringList(test ? QStringLiteral("true") : QStringLiteral("false")));
+ };
+#define SET(opt, test) setListFlag(opt, m_parser.isSet(m_parser.test))
+ SET(CONFIG_SYNTAXHIGHLIGHTING, highlightingOption);
+ SET(CONFIG_SHOWINTERNAL, showInternalOption);
+ SET(CONFIG_SINGLEEXEC, singleExecOption);
+ SET(CONFIG_WRITEQAPAGES, writeQaPagesOption);
+ SET(CONFIG_REDIRECTDOCUMENTATIONTODEVNULL, redirectDocumentationToDevNullOption);
+ SET(CONFIG_AUTOLINKERRORS, autoLinkErrorsOption);
+ SET(CONFIG_OBSOLETELINKS, obsoleteLinksOption);
+#undef SET
+ setListFlag(CONFIG_NOLINKERRORS,
+ m_parser.isSet(m_parser.noLinkErrorsOption)
+ || qEnvironmentVariableIsSet("QDOC_NOLINKERRORS"));
+
+ // CONFIG_DEFINES and CONFIG_INCLUDEPATHS are set in load()
}
/*!
Loads and parses the qdoc configuration file \a fileName.
- This function first resets the Config instance, then
- calls the other load() function, which does the loading,
- parsing, and processing of the configuration file.
-
- Intializes the location variables returned by location()
- and lastLocation().
+ If a previous project was loaded, this function first resets the
+ Config instance. Then it calls the other load() function, which
+ does the loading, parsing, and processing of the configuration file.
*/
void Config::load(const QString &fileName)
{
- reset();
+ // Reset if a previous project was loaded
+ if (configVars_.contains(CONFIG_PROJECT))
+ reset();
+
load(Location::null, fileName);
if (loc.isEmpty())
loc = Location(fileName);
else
loc.setEtc(true);
lastLocation_ = Location::null;
+
+ // Add defines and includepaths from command line to their
+ // respective configuration variables. Values set here are
+ // always added to what's defined in configuration file.
+ insertStringList(CONFIG_DEFINES, m_defines);
+ insertStringList(CONFIG_INCLUDEPATHS, m_includePaths);
}
/*!
@@ -339,40 +366,77 @@ void Config::insertStringList(const QString &var, const QStringList &values)
}
/*!
- Set configuration options from \a qdocGlobals.
+ Process and store variables from the command line.
*/
-void Config::setOptions(const QDocGlobals &qdocGlobals)
+void Config::processCommandLineOptions(const QStringList &args)
{
- 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"));
-}
+ m_parser.process(args);
-/*!
- Set configuration options from \a parser.
- */
-void Config::setOptions(const QDocCommandLineParser &parser)
-{
- generateExamples = !parser.isSet(parser.noExamplesOption);
- if (parser.isSet(parser.installDirOption))
- installDir = parser.value(parser.installDirOption);
- if (parser.isSet(parser.outputDirOption))
- overrideOutputDir = parser.value(parser.outputDirOption);
+ m_defines = m_parser.values(m_parser.defineOption);
+ m_dependModules = m_parser.values(m_parser.dependsOption);
+ setIndexDirs();
+ setIncludePaths();
+
+ generateExamples = !m_parser.isSet(m_parser.noExamplesOption);
+ if (m_parser.isSet(m_parser.installDirOption))
+ installDir = m_parser.value(m_parser.installDirOption);
+ if (m_parser.isSet(m_parser.outputDirOption))
+ overrideOutputDir = m_parser.value(m_parser.outputDirOption);
- const auto outputFormats = parser.values(parser.outputFormatOption);
+ const auto outputFormats = m_parser.values(m_parser.outputFormatOption);
for (const auto &format : outputFormats)
overrideOutputFormats.insert(format);
- debug_ = parser.isSet(parser.debugOption);
+ debug_ = m_parser.isSet(m_parser.debugOption);
+
+ // TODO: Make Generator use Config instead of storing these separately
+ if (m_parser.isSet(m_parser.prepareOption))
+ Generator::setQDocPass(Generator::Prepare);
+ if (m_parser.isSet(m_parser.generateOption))
+ Generator::setQDocPass(Generator::Generate);
+ if (m_parser.isSet(m_parser.singleExecOption))
+ Generator::setSingleExec();
+ if (m_parser.isSet(m_parser.writeQaPagesOption))
+ Generator::setWriteQaPages();
+ if (m_parser.isSet(m_parser.logProgressOption))
+ Location::startLoggingProgress();
+ if (m_parser.isSet(m_parser.timestampsOption))
+ Generator::setUseTimestamps();
+}
+
+void Config::setIncludePaths()
+{
+ QDir currentDir = QDir::current();
+ const auto addIncludePaths = [this, currentDir](const char *flag, const QStringList &paths) {
+ for (const auto &path : paths)
+ m_includePaths << currentDir.absoluteFilePath(path).insert(0, flag);
+ };
+
+ addIncludePaths("-I", m_parser.values(m_parser.includePathOption));
+#ifdef QDOC_PASS_ISYSTEM
+ addIncludePaths("-isystem", m_parser.values(m_parser.includePathSystemOption));
+#endif
+ addIncludePaths("-F", m_parser.values(m_parser.frameworkOption));
+}
+
+/*!
+ Stores paths from -indexdir command line option(s).
+ */
+void Config::setIndexDirs()
+{
+ m_indexDirs = m_parser.values(m_parser.indexDirOption);
+ auto it = std::remove_if(m_indexDirs.begin(), m_indexDirs.end(),
+ [](const QString &s) { return !QFile::exists(s); });
+
+ std::for_each(it, m_indexDirs.end(),
+ [](const QString &s) {
+ Location::logToStdErrAlways(tr("Cannot find index directory: %1").arg(s));
+ });
+ m_indexDirs.erase(it, m_indexDirs.end());
}
/*!
- Looks up the configuarion variable \a var in the string
+ Looks up the configuration variable \a var in the string
map and returns the boolean value.
*/
bool Config::getBool(const QString &var) const
diff --git a/src/qdoc/config.h b/src/qdoc/config.h
index 615387f73..61ed53d87 100644
--- a/src/qdoc/config.h
+++ b/src/qdoc/config.h
@@ -35,7 +35,6 @@
#include "location.h"
#include "qdoccommandlineparser.h"
-#include "qdocglobals.h"
#include <QtCore/qmap.h>
#include <QtCore/qpair.h>
@@ -75,7 +74,7 @@ class Config
Q_DECLARE_TR_FUNCTIONS(QDoc::Config)
public:
- Config(const QString &programName);
+ Config(const QString &programName, const QStringList &args);
~Config();
bool getDebug() const { return debug_; }
@@ -86,8 +85,8 @@ 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);
+ void showHelp(int exitCode = 0) { m_parser.showHelp(exitCode); }
+ QStringList qdocFiles() const { return m_parser.positionalArguments(); }
const QString &programName() const { return prog; }
const Location &location() const { return loc; }
const Location &lastLocation() const { return lastLocation_; }
@@ -146,7 +145,28 @@ public:
static QString overrideOutputDir;
static QSet<QString> overrideOutputFormats;
+ inline bool singleExec() const;
+ QStringList &defines() { return m_defines; }
+ QStringList &dependModules() { return m_dependModules; }
+ QStringList &includePaths() { return m_includePaths; }
+ QStringList &indexDirs() { return m_indexDirs; }
+ QString currentDir() const { return m_currentDir; }
+ void setCurrentDir(const QString &path) { m_currentDir = path; }
+ QString previousCurrentDir() const { return m_previousCurrentDir; }
+ void setPreviousCurrentDir(const QString &path) { m_previousCurrentDir = path; }
+
private:
+ void processCommandLineOptions(const QStringList &args);
+ void setIncludePaths();
+ void setIndexDirs();
+
+ QStringList m_dependModules;
+ QStringList m_defines;
+ QStringList m_includePaths;
+ QStringList m_indexDirs;
+ QString m_currentDir;
+ QString m_previousCurrentDir;
+
static bool debug_;
static bool isMetaKeyChar(QChar ch);
void load(Location location, const QString &fileName);
@@ -161,6 +181,7 @@ private:
static int numInstances;
static QStack<QString> workingDirs_;
static QMap<QString, QStringList> includeFilesMap_;
+ QDocCommandLineParser m_parser;
};
struct ConfigStrings
@@ -326,6 +347,11 @@ struct ConfigStrings
#define CONFIG_WARNINGLIMIT ConfigStrings::WARNINGLIMIT
#define CONFIG_WRITEQAPAGES ConfigStrings::WRITEQAPAGES
+inline bool Config::singleExec() const
+{
+ return getBool(CONFIG_SINGLEEXEC);
+}
+
QT_END_NAMESPACE
#endif
diff --git a/src/qdoc/main.cpp b/src/qdoc/main.cpp
index e2ae550c1..48166257d 100644
--- a/src/qdoc/main.cpp
+++ b/src/qdoc/main.cpp
@@ -38,9 +38,7 @@
#include "location.h"
#include "loggingcategory.h"
#include "puredocparser.h"
-#include "qdoccommandlineparser.h"
#include "qdocdatabase.h"
-#include "qdocglobals.h"
#include "qmlcodemarker.h"
#include "qmlcodeparser.h"
#include "utilities.h"
@@ -79,7 +77,6 @@ static QList<Translator> translators;
#endif
static ClangCodeParser* clangParser_ = nullptr;
-static QDocGlobals qdocGlobals;
/*!
Read some XML indexes containing definitions from other
@@ -103,8 +100,8 @@ static void loadIndexFiles(Config &config, const QSet<QString> &formats)
Location::null.warning(QString("Index file not found: %1").arg(index));
}
- qdocGlobals.dependModules() += config.getStringList(CONFIG_DEPENDS);
- qdocGlobals.dependModules().removeDuplicates();
+ config.dependModules() += config.getStringList(CONFIG_DEPENDS);
+ config.dependModules().removeDuplicates();
QSet<QString> subDirs;
for (const auto &format : formats) {
@@ -118,41 +115,41 @@ static void loadIndexFiles(Config &config, const QSet<QString> &formats)
}
}
- if (qdocGlobals.dependModules().size() > 0) {
- if (qdocGlobals.indexDirs().size() > 0) {
- for (int i = 0; i < qdocGlobals.indexDirs().size(); i++) {
- if (qdocGlobals.indexDirs()[i].startsWith("..")) {
- const QString prefix(QDir(qdocGlobals.currentDir()).relativeFilePath(qdocGlobals.previousCurrentDir()));
+ if (config.dependModules().size() > 0) {
+ if (config.indexDirs().size() > 0) {
+ for (int i = 0; i < config.indexDirs().size(); i++) {
+ if (config.indexDirs()[i].startsWith("..")) {
+ const QString prefix(QDir(config.currentDir()).relativeFilePath(config.previousCurrentDir()));
if (!prefix.isEmpty())
- qdocGlobals.indexDirs()[i].prepend(prefix + QLatin1Char('/'));
+ config.indexDirs()[i].prepend(prefix + QLatin1Char('/'));
}
}
/*
Add all subdirectories of the indexdirs as dependModules,
when an asterisk is used in the 'depends' list.
*/
- if (qdocGlobals.dependModules().contains("*")) {
- qdocGlobals.dependModules().removeOne("*");
- for (int i = 0; i < qdocGlobals.indexDirs().size(); i++) {
- QDir scanDir = QDir(qdocGlobals.indexDirs()[i]);
+ if (config.dependModules().contains("*")) {
+ config.dependModules().removeOne("*");
+ for (int i = 0; i < config.indexDirs().size(); i++) {
+ QDir scanDir = QDir(config.indexDirs()[i]);
scanDir.setFilter(QDir::Dirs | QDir::NoDotAndDotDot);
QFileInfoList dirList = scanDir.entryInfoList();
for (int j = 0; j < dirList.size(); j++) {
if (dirList[j].fileName().toLower() != config.getString(CONFIG_PROJECT).toLower())
- qdocGlobals.dependModules().append(dirList[j].fileName());
+ config.dependModules().append(dirList[j].fileName());
}
}
}
- for (int i = 0; i < qdocGlobals.dependModules().size(); i++) {
+ for (int i = 0; i < config.dependModules().size(); i++) {
QString indexToAdd;
QList<QFileInfo> foundIndices;
// Always look in module-specific subdir, even with *.nosubdirs config
- subDirs << qdocGlobals.dependModules()[i];
- for (int j = 0; j < qdocGlobals.indexDirs().size(); j++) {
+ subDirs << config.dependModules()[i];
+ for (int j = 0; j < config.indexDirs().size(); j++) {
for (const auto &subDir : subDirs) {
- QString fileToLookFor = qdocGlobals.indexDirs()[j]
+ QString fileToLookFor = config.indexDirs()[j]
+ QLatin1Char('/') + subDir
- + QLatin1Char('/') + qdocGlobals.dependModules()[i] + ".index";
+ + QLatin1Char('/') + config.dependModules()[i] + ".index";
if (QFile::exists(fileToLookFor)) {
QFileInfo tempFileInfo(fileToLookFor);
if (!foundIndices.contains(tempFileInfo))
@@ -160,7 +157,7 @@ static void loadIndexFiles(Config &config, const QSet<QString> &formats)
}
}
}
- subDirs.remove(qdocGlobals.dependModules()[i]);
+ subDirs.remove(config.dependModules()[i]);
std::sort(foundIndices.begin(), foundIndices.end(), creationTimeBefore);
if (foundIndices.size() > 1) {
/*
@@ -173,10 +170,10 @@ static void loadIndexFiles(Config &config, const QSet<QString> &formats)
for (const auto &found : qAsConst(foundIndices))
indexPaths << found.absoluteFilePath();
Location::null.warning(QString("Multiple index files found for dependency \"%1\":\n%2").arg(
- qdocGlobals.dependModules()[i], indexPaths.join('\n')));
+ config.dependModules()[i], indexPaths.join('\n')));
Location::null.warning(QString("Using %1 as index file for dependency \"%2\"").arg(
foundIndices[foundIndices.size() - 1].absoluteFilePath(),
- qdocGlobals.dependModules()[i]));
+ config.dependModules()[i]));
indexToAdd = foundIndices[foundIndices.size() - 1].absoluteFilePath();
}
else if (foundIndices.size() == 1) {
@@ -188,7 +185,7 @@ static void loadIndexFiles(Config &config, const QSet<QString> &formats)
}
else {
Location::null.warning(QString("\"%1\" Cannot locate index file for dependency \"%2\"").arg(
- config.getString(CONFIG_PROJECT), qdocGlobals.dependModules()[i]));
+ config.getString(CONFIG_PROJECT), config.dependModules()[i]));
}
}
}
@@ -206,7 +203,7 @@ static void loadIndexFiles(Config &config, const QSet<QString> &formats)
*/
static void processQdocconfFile(const QString &fileName, Config &config)
{
- qdocGlobals.setPreviousCurrentDir(QDir::currentPath());
+ config.setPreviousCurrentDir(QDir::currentPath());
/*
With the default configuration values in place, load
@@ -224,16 +221,11 @@ static void processQdocconfFile(const QString &fileName, Config &config)
Location::logToStdErrAlways(QLatin1String("qdoc can't run; no project set in qdocconf file"));
exit(1);
}
- /*
- Add the defines and includepaths to their respective configuration variables.
- */
- config.insertStringList(CONFIG_DEFINES, qdocGlobals.defines());
- config.insertStringList(CONFIG_INCLUDEPATHS, qdocGlobals.includesPaths());
Location::terminate();
- qdocGlobals.setCurrentDir(QFileInfo(fileName).path());
- if (!qdocGlobals.currentDir().isEmpty())
- QDir::setCurrent(qdocGlobals.currentDir());
+ config.setCurrentDir(QFileInfo(fileName).path());
+ if (!config.currentDir().isEmpty())
+ QDir::setCurrent(config.currentDir());
QString phase = " in ";
if (Generator::singleExec())
@@ -344,9 +336,9 @@ static void processQdocconfFile(const QString &fileName, Config &config)
else
clangParser_->setModuleHeader(project);
- qdocGlobals.dependModules() = config.getStringList(CONFIG_DEPENDS);
- qdocGlobals.dependModules().removeDuplicates();
- qdb->setSearchOrder(qdocGlobals.dependModules());
+ config.dependModules() = config.getStringList(CONFIG_DEPENDS);
+ config.dependModules().removeDuplicates();
+ qdb->setSearchOrder(config.dependModules());
// Store the title of the index (landing) page
NamespaceNode *root = qdb->primaryTreeRoot();
@@ -500,31 +492,11 @@ static void processQdocconfFile(const QString &fileName, Config &config)
Doc::terminate();
Tokenizer::terminate();
Location::terminate();
- QDir::setCurrent(qdocGlobals.previousCurrentDir());
+ QDir::setCurrent(config.previousCurrentDir());
qCDebug(lcQdoc, "qdoc classes terminated");
}
-/* This method is an extremely ugly hack;
- some or all of these settings must be set before the call to
- various initialize() methods in main's processQdocconfFile().
-*/
-void postProcess(const QDocCommandLineParser &parser)
-{
- if (parser.isSet(parser.prepareOption))
- Generator::setQDocPass(Generator::Prepare);
- if (parser.isSet(parser.generateOption))
- Generator::setQDocPass(Generator::Generate);
- if (parser.isSet(parser.singleExecOption))
- Generator::setSingleExec();
- if (parser.isSet(parser.writeQaPagesOption))
- Generator::setWriteQaPages();
- if (parser.isSet(parser.logProgressOption))
- Location::startLoggingProgress();
- if (parser.isSet(parser.timestampsOption))
- Generator::setUseTimestamps();
-}
-
QT_END_NAMESPACE
int main(int argc, char **argv)
@@ -566,41 +538,33 @@ int main(int argc, char **argv)
HtmlGenerator htmlGenerator;
WebXMLGenerator webXMLGenerator;
- Config config(QCoreApplication::translate("QDoc", "qdoc"));
-
- // Set the globals declared at the top of this file:
- QDocCommandLineParser parser;
- parser.process(app.arguments());
- qdocGlobals.setOptions(parser);
- config.setOptions(parser);
- postProcess(parser);
- config.setOptions(qdocGlobals);
+ Config config(QCoreApplication::translate("QDoc", "qdoc"), app.arguments());
// Get the list of files to act on:
- QStringList qdocFiles = parser.positionalArguments();
+ QStringList qdocFiles = config.qdocFiles();
if (qdocFiles.isEmpty())
- parser.showHelp();
+ config.showHelp();
- if (qdocGlobals.singleExec())
+ if (config.singleExec())
qdocFiles = Config::loadMaster(qdocFiles.at(0));
if (Generator::singleExec()) {
// single qdoc process for prepare and generate phases
Generator::setQDocPass(Generator::Prepare);
for (const auto &file : qAsConst(qdocFiles)) {
- qdocGlobals.dependModules().clear();
+ config.dependModules().clear();
processQdocconfFile(file, config);
}
Generator::setQDocPass(Generator::Generate);
QDocDatabase::qdocDB()->processForest();
for (const auto &file : qAsConst(qdocFiles)) {
- qdocGlobals.dependModules().clear();
+ config.dependModules().clear();
processQdocconfFile(file, config);
}
} else {
// separate qdoc processes for prepare and generate phases
for (const auto &file : qAsConst(qdocFiles)) {
- qdocGlobals.dependModules().clear();
+ config.dependModules().clear();
processQdocconfFile(file, config);
}
}
diff --git a/src/qdoc/qdoc.pro b/src/qdoc/qdoc.pro
index 0f9159bc7..df9123b09 100644
--- a/src/qdoc/qdoc.pro
+++ b/src/qdoc/qdoc.pro
@@ -59,7 +59,6 @@ HEADERS += atom.h \
tokenizer.h \
tree.h \
webxmlgenerator.h \
- qdocglobals.h \
qdoccommandlineparser.h \
utilities.h
@@ -93,7 +92,6 @@ SOURCES += atom.cpp \
tree.cpp \
yyindent.cpp \
webxmlgenerator.cpp \
- qdocglobals.cpp \
qdoccommandlineparser.cpp \
utilities.cpp
diff --git a/src/qdoc/qdocglobals.cpp b/src/qdoc/qdocglobals.cpp
deleted file mode 100644
index 05fa3a96f..000000000
--- a/src/qdoc/qdocglobals.cpp
+++ /dev/null
@@ -1,213 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qdocglobals.h"
-#include "qdoccommandlineparser.h"
-
-#include <QtCore/qdebug.h>
-#include <QtCore/qdir.h>
-#include <QtCore/qfile.h>
-
-bool QDocGlobals::highlighting() const
-{
- return m_highlighting;
-}
-
-void QDocGlobals::enableHighlighting(bool value)
-{
- m_highlighting = value;
-}
-
-bool QDocGlobals::showInternal() const
-{
- return m_showInternal;
-}
-
-void QDocGlobals::setShowInternal(bool value)
-{
- m_showInternal = value;
-}
-
-bool QDocGlobals::singleExec() const
-{
- return m_singleExec;
-}
-void QDocGlobals::setSingleExec(bool value)
-{
- m_singleExec = value;
-}
-
-bool QDocGlobals::writeQaPages() const
-{
- return m_writeQaPages;
-}
-void QDocGlobals::setWriteQaPages(bool value)
-{
- m_writeQaPages = value;
-}
-
-bool QDocGlobals::redirectDocumentationToDevNull() const
-{
- return m_redirectDocumentationToDevNull;
-}
-
-void QDocGlobals::setRedirectDocumentationToDevNull(bool value)
-{
- m_redirectDocumentationToDevNull = value;
-}
-
-bool QDocGlobals::noLinkErrors() const
-{
- return m_noLinkErrors;
-}
-
-void QDocGlobals::setNoLinkErrors(bool value)
-{
- m_noLinkErrors = value;
-}
-
-bool QDocGlobals::autolinkErrors() const
-{
- return m_autolinkErrors;
-}
-
-void QDocGlobals::setAutolinkErrors(bool value)
-{
- m_autolinkErrors = value;
-}
-
-bool QDocGlobals::obsoleteLinks() const
-{
- return m_obsoleteLinks;
-}
-
-void QDocGlobals::setObsoleteLinks(bool value)
-{
- m_obsoleteLinks = value;
-}
-
-QStringList QDocGlobals::defines() const
-{
- return m_defines;
-}
-
-void QDocGlobals::addDefine(const QStringList &valueList)
-{
- m_defines += valueList;
-}
-
-QStringList QDocGlobals::includesPaths() const
-{
- return m_includesPaths;
-}
-
-void QDocGlobals::addIncludePath(const QString &flag, const QString &path)
-{
- QString includePath = flag + path;
- m_includesPaths << includePath;
-}
-
-QStringList &QDocGlobals::dependModules()
-{
- return m_dependModules;
-}
-
-QStringList QDocGlobals::indexDirs() const
-{
- return m_indexDirs;
-}
-
-void QDocGlobals::appendToIndexDirs(const QString &path)
-{
- m_indexDirs += path;
-}
-
-QString QDocGlobals::currentDir() const
-{
- return m_currentDir;
-}
-
-void QDocGlobals::setCurrentDir(const QString &path)
-{
- m_currentDir = path;
-}
-
-QString QDocGlobals::previousCurrentDir() const
-{
- return m_previousCurrentDir;
-}
-
-void QDocGlobals::setPreviousCurrentDir(const QString &path)
-{
- m_previousCurrentDir = path;
-}
-
-void QDocGlobals::setIncludePaths(const QDocCommandLineParser &parser)
-{
- QDir currentDir = QDir::current();
- auto includePaths = parser.values(parser.includePathOption);
- for (const auto &path : qAsConst(includePaths))
- addIncludePath("-I", currentDir.absoluteFilePath(path));
-
-#ifdef QDOC_PASS_ISYSTEM
- includePaths = parser.values(parser.includePathSystemOption);
- for (const auto &path : qAsConst(includePaths))
- addIncludePath("-isystem", currentDir.absoluteFilePath(path));
-#endif
- includePaths = parser.values(parser.frameworkOption);
- for (const auto &path : qAsConst(includePaths))
- addIncludePath("-F", currentDir.absoluteFilePath(path));
-}
-
-void QDocGlobals::setIndexDirs(const QDocCommandLineParser &parser)
-{
- const auto indexDirs = parser.values(parser.indexDirOption);
- for (const auto &indexDir : indexDirs) {
- if (QFile::exists(indexDir))
- appendToIndexDirs(indexDir);
- else
- qDebug() << "Cannot find index directory" << indexDir;
- }
-}
-
-void QDocGlobals::setOptions(const QDocCommandLineParser &parser)
-{
- addDefine(parser.values(parser.defineOption));
- m_dependModules += parser.values(parser.dependsOption);
- enableHighlighting(parser.isSet(parser.highlightingOption));
- setShowInternal(parser.isSet(parser.showInternalOption));
- setSingleExec(parser.isSet(parser.singleExecOption));
- setWriteQaPages(parser.isSet(parser.writeQaPagesOption));
- setRedirectDocumentationToDevNull(parser.isSet(parser.redirectDocumentationToDevNullOption));
- setIndexDirs(parser);
- setObsoleteLinks(parser.isSet(parser.obsoleteLinksOption));
- setNoLinkErrors(parser.isSet(parser.noLinkErrorsOption) ||
- qEnvironmentVariableIsSet("QDOC_NOLINKERRORS"));
- setAutolinkErrors(parser.isSet(parser.autoLinkErrorsOption));
- setIncludePaths(parser);
-}
diff --git a/src/qdoc/qdocglobals.h b/src/qdoc/qdocglobals.h
deleted file mode 100644
index 640dd6bf6..000000000
--- a/src/qdoc/qdocglobals.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QDOCGLOBALS_H
-#define QDOCGLOBALS_H
-
-#include <QtCore/qstringlist.h>
-#include <QtCore/qhash.h>
-#include <QtCore/qtranslator.h>
-
-QT_BEGIN_NAMESPACE
-
-struct QDocCommandLineParser;
-
-class QDocGlobals
-{
-public:
- bool highlighting() const;
- void enableHighlighting(bool value);
-
- bool showInternal() const;
- void setShowInternal(bool value);
-
- bool singleExec() const;
- void setSingleExec(bool value);
-
- bool writeQaPages() const;
- void setWriteQaPages(bool value);
-
- bool redirectDocumentationToDevNull() const;
- void setRedirectDocumentationToDevNull(bool value);
-
- bool noLinkErrors() const;
- void setNoLinkErrors(bool value);
-
- bool autolinkErrors() const;
- void setAutolinkErrors(bool value);
-
- bool obsoleteLinks() const;
- void setObsoleteLinks(bool value);
-
- QStringList defines() const;
- void addDefine(const QStringList &valueList);
-
- QStringList includesPaths() const;
- void addIncludePath(const QString &flag, const QString &path);
-
- QStringList &dependModules();
-
- QStringList indexDirs() const;
- void appendToIndexDirs(const QString &path);
-
- QString currentDir() const;
- void setCurrentDir(const QString &path);
-
- QString previousCurrentDir() const;
- void setPreviousCurrentDir(const QString &path);
-
- void setOptions(const QDocCommandLineParser &parser);
-
-private:
- void setIncludePaths(const QDocCommandLineParser &parser);
- void setIndexDirs(const QDocCommandLineParser &parser);
-
- bool m_highlighting = false;
- bool m_showInternal = false;
- bool m_singleExec = false;
- bool m_writeQaPages = false;
- bool m_redirectDocumentationToDevNull = false;
- bool m_noLinkErrors = false;
- bool m_autolinkErrors = false;
- bool m_obsoleteLinks = false;
-
- QStringList m_defines;
- QStringList m_includesPaths;
- QStringList m_dependModules;
- QStringList m_indexDirs;
- QString m_currentDir;
- QString m_previousCurrentDir;
-};
-
-QT_END_NAMESPACE
-
-#endif // QDOCGLOBALS_H
diff --git a/tests/auto/qdoc/qdoc.pro b/tests/auto/qdoc/qdoc.pro
index 74c6e7787..97117dc6f 100644
--- a/tests/auto/qdoc/qdoc.pro
+++ b/tests/auto/qdoc/qdoc.pro
@@ -1,5 +1,4 @@
TEMPLATE = subdirs
SUBDIRS = \
- generatedoutput \
- qdocglobals
+ generatedoutput
diff --git a/tests/auto/qdoc/qdocglobals/qdocglobals.pro b/tests/auto/qdoc/qdocglobals/qdocglobals.pro
deleted file mode 100644
index fa7ddb8e0..000000000
--- a/tests/auto/qdoc/qdocglobals/qdocglobals.pro
+++ /dev/null
@@ -1,9 +0,0 @@
-CONFIG += testcase
-QT = core testlib
-TARGET = tst_qdocglobals
-INCLUDEPATH += $$PWD/../../../../src/qdoc
-
-HEADERS += $$PWD/../../../../src/qdoc/qdocglobals.h
-
-SOURCES += $$PWD/../../../../src/qdoc/qdocglobals.cpp \
- tst_qdocglobals.cpp
diff --git a/tests/auto/qdoc/qdocglobals/tst_qdocglobals.cpp b/tests/auto/qdoc/qdocglobals/tst_qdocglobals.cpp
deleted file mode 100644
index fca46911f..000000000
--- a/tests/auto/qdoc/qdocglobals/tst_qdocglobals.cpp
+++ /dev/null
@@ -1,205 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2018 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the tools applications of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qdocglobals.h"
-
-#include <QtCore/qhash.h>
-#include <QtCore/qstringlist.h>
-#include <QtTest/QtTest>
-
-class testQDocGlobals : public QObject
-{
- Q_OBJECT
-
-private slots:
- void testClassMembersInitializeToFalseOrEmpty();
- void testEnableHighlighting();
- void testSetShowInternal();
- void testSetSingleExec();
- void testSetWriteQaPages();
- void testRedirectDocumentationToDevNull();
- void testSetNoLinkErrors();
- void testSetAutoLinkErrors();
- void testSetObsoleteLinks();
-
- void testAddDefine();
- void testAddIncludePath();
- void testDependModules();
- void testAppendToIndexDirs();
- void testSetCurrentDir();
- void testPreviousCurrentDir();
-};
-
-void testQDocGlobals::testClassMembersInitializeToFalseOrEmpty()
-{
- QDocGlobals qdocTestGlobals;
- QCOMPARE(qdocTestGlobals.highlighting(), false);
- QCOMPARE(qdocTestGlobals.showInternal(), false);
- QCOMPARE(qdocTestGlobals.singleExec(), false);
- QCOMPARE(qdocTestGlobals.writeQaPages(), false);
- QCOMPARE(qdocTestGlobals.redirectDocumentationToDevNull(), false);
- QCOMPARE(qdocTestGlobals.noLinkErrors(), false);
- QCOMPARE(qdocTestGlobals.autolinkErrors(), false);
- QCOMPARE(qdocTestGlobals.obsoleteLinks(), false);
-
- QVERIFY(qdocTestGlobals.defines().isEmpty());
- QVERIFY(qdocTestGlobals.includesPaths().isEmpty());
- QVERIFY(qdocTestGlobals.dependModules().isEmpty());
- QVERIFY(qdocTestGlobals.indexDirs().isEmpty());
- QVERIFY(qdocTestGlobals.currentDir().isEmpty());
- QVERIFY(qdocTestGlobals.previousCurrentDir().isEmpty());
-}
-
-void testQDocGlobals::testEnableHighlighting()
-{
- QDocGlobals qdocTestGlobals;
- qdocTestGlobals.enableHighlighting(true);
- QVERIFY(qdocTestGlobals.highlighting());
-}
-
-void testQDocGlobals::testSetShowInternal()
-{
- QDocGlobals qdocTestGlobals;
- qdocTestGlobals.setShowInternal(true);
- QVERIFY(qdocTestGlobals.showInternal());
-}
-
-void testQDocGlobals::testSetSingleExec()
-{
- QDocGlobals qdocTestGlobals;
- qdocTestGlobals.setSingleExec(true);
- QVERIFY(qdocTestGlobals.singleExec());
-}
-
-void testQDocGlobals::testSetWriteQaPages()
-{
- QDocGlobals qdocTestGlobals;
- qdocTestGlobals.setWriteQaPages(true);
- QVERIFY(qdocTestGlobals.writeQaPages());
-}
-
-void testQDocGlobals::testRedirectDocumentationToDevNull()
-{
- QDocGlobals qdocTestGlobals;
- qdocTestGlobals.setRedirectDocumentationToDevNull(true);
- QVERIFY(qdocTestGlobals.redirectDocumentationToDevNull());
-}
-
-void testQDocGlobals::testSetNoLinkErrors()
-{
- QDocGlobals qdocTestGlobals;
- qdocTestGlobals.setNoLinkErrors(true);
- QVERIFY(qdocTestGlobals.noLinkErrors());
-}
-
-void testQDocGlobals::testSetAutoLinkErrors()
-{
- QDocGlobals qdocTestGlobals;
- qdocTestGlobals.setAutolinkErrors(true);
- QVERIFY(qdocTestGlobals.autolinkErrors());
-}
-
-void testQDocGlobals::testSetObsoleteLinks()
-{
- QDocGlobals qdocTestGlobals;
- qdocTestGlobals.setObsoleteLinks(true);
- QVERIFY(qdocTestGlobals.obsoleteLinks());
-}
-
-void testQDocGlobals::testAddDefine()
-{
- QDocGlobals qdocTestGlobals;
- QStringList defineTestList1 = { QStringLiteral("qtforpython") };
- QStringList defineTestList2 = { QStringLiteral("example") };
- QStringList expected;
- expected << defineTestList1 << defineTestList2;
-
- qdocTestGlobals.addDefine(defineTestList1);
- QCOMPARE(qdocTestGlobals.defines().size(), 1);
- qdocTestGlobals.addDefine(defineTestList2);
- QCOMPARE(qdocTestGlobals.defines().size(), 2);
- QCOMPARE(qdocTestGlobals.defines(), expected);
-}
-
-void testQDocGlobals::testAddIncludePath()
-{
- QDocGlobals qdocTestGlobals;
- QString testFlag = "-I";
- QString testPath0 = "/qt5/qtdoc/doc/.";
- QString testPath1 = "/qt5/qtbase/mkspecs/linux-g++";
- QStringList expected = { "-I/qt5/qtdoc/doc/.",
- "-I/qt5/qtbase/mkspecs/linux-g++" };
-
- qdocTestGlobals.addIncludePath(testFlag, testPath0);
- qdocTestGlobals.addIncludePath(testFlag, testPath1);
- QStringList result = qdocTestGlobals.includesPaths();
- QCOMPARE(result, expected);
-}
-
-void testQDocGlobals::testDependModules()
-{
- QDocGlobals qdocTestGlobals;
- QStringList expected = { "qdoc", "qmake", "qtcore", "qthelp", "qtqml" };
-
- qdocTestGlobals.dependModules() = expected;
- QCOMPARE(qdocTestGlobals.dependModules().size(), 5);
- QCOMPARE(qdocTestGlobals.dependModules(), expected);
-}
-
-void testQDocGlobals::testAppendToIndexDirs()
-{
- QDocGlobals qdocTestGlobals;
- QString testPath = "/qt5/qtbase/doc";
- QStringList expected;
- expected << testPath;
-
- qdocTestGlobals.appendToIndexDirs(testPath);
- QCOMPARE(qdocTestGlobals.indexDirs(), expected);
-}
-
-void testQDocGlobals::testSetCurrentDir()
-{
- QDocGlobals qdocTestGlobals;
- QString expected = "/qt5/qtdoc/doc/config";
-
- qdocTestGlobals.setCurrentDir(expected);
- QCOMPARE(qdocTestGlobals.currentDir(), expected);
-}
-
-void testQDocGlobals::testPreviousCurrentDir()
-{
- QDocGlobals qdocTestGlobals;
- QString expected = "/qt5/qtdoc/doc";
-
- qdocTestGlobals.setCurrentDir(expected);
- QCOMPARE(qdocTestGlobals.currentDir(), expected);
-}
-
-QTEST_APPLESS_MAIN(testQDocGlobals)
-
-#include "tst_qdocglobals.moc"