diff options
-rw-r--r-- | src/qdoc/main.cpp | 3 | ||||
-rw-r--r-- | src/qdoc/qdoccommandlineparser.cpp | 36 | ||||
-rw-r--r-- | src/qdoc/qdoccommandlineparser.h | 2 | ||||
-rw-r--r-- | src/qdoc/qdocglobals.cpp | 51 | ||||
-rw-r--r-- | src/qdoc/qdocglobals.h | 9 |
5 files changed, 59 insertions, 42 deletions
diff --git a/src/qdoc/main.cpp b/src/qdoc/main.cpp index 3ce7ef9ea..39ad0c9a2 100644 --- a/src/qdoc/main.cpp +++ b/src/qdoc/main.cpp @@ -581,7 +581,8 @@ int main(int argc, char **argv) // Set the globals declared at the top of this file: QDocCommandLineParser parser; - parser.process(app.arguments(), qdocGlobals); + parser.process(app.arguments()); + qdocGlobals.setOptions(parser); config.setOptions(parser); postProcess(parser); diff --git a/src/qdoc/qdoccommandlineparser.cpp b/src/qdoc/qdoccommandlineparser.cpp index be8513e4b..33009c512 100644 --- a/src/qdoc/qdoccommandlineparser.cpp +++ b/src/qdoc/qdoccommandlineparser.cpp @@ -28,7 +28,6 @@ #include "qdoccommandlineparser.h" -#include "config.h" #include "loggingcategory.h" #include "utilities.h" @@ -179,44 +178,11 @@ static QStringList argumentsFromCommandLineAndFile(const QStringList &arguments) return allArguments; } -void QDocCommandLineParser::process(const QStringList &arguments, QDocGlobals &qdocGlobals) +void QDocCommandLineParser::process(const QStringList &arguments) { auto allArguments = argumentsFromCommandLineAndFile(arguments); QCommandLineParser::process(allArguments); - qdocGlobals.addDefine(values(defineOption)); - qdocGlobals.dependModules() += values(dependsOption); - qdocGlobals.enableHighlighting(isSet(highlightingOption)); - qdocGlobals.setShowInternal(isSet(showInternalOption)); - qdocGlobals.setSingleExec(isSet(singleExecOption)); - qdocGlobals.setWriteQaPages(isSet(writeQaPagesOption)); - qdocGlobals.setRedirectDocumentationToDevNull(isSet(redirectDocumentationToDevNullOption)); - - const auto indexDirs = values(indexDirOption); - for (const auto &indexDir : indexDirs) { - if (QFile::exists(indexDir)) - qdocGlobals.appendToIndexDirs(indexDir); - else - qDebug() << "Cannot find index directory" << indexDir; - } - qdocGlobals.setObsoleteLinks(isSet(obsoleteLinksOption)); - qdocGlobals.setNoLinkErrors(isSet(noLinkErrorsOption) || qEnvironmentVariableIsSet("QDOC_NOLINKERRORS")); - qdocGlobals.setAutolinkErrors(isSet(autoLinkErrorsOption)); - if (isSet(singleExecOption) && isSet(indexDirOption)) qDebug("WARNING: -indexdir option ignored: Index files are not used in single-exec mode."); - - QDir currentDir = QDir::current(); - const auto paths = values(includePathOption); - for (const auto &i : paths) - qdocGlobals.addIncludePath("-I", currentDir.absoluteFilePath(i)); - -#ifdef QDOC_PASS_ISYSTEM - const auto paths2 = values(includePathSystemOption); - for (const auto &i : paths2) - qdocGlobals.addIncludePath("-isystem", currentDir.absoluteFilePath(i)); -#endif - const auto paths3 = values(frameworkOption); - for (const auto &i : paths3) - qdocGlobals.addIncludePath("-F", currentDir.absoluteFilePath(i)); } diff --git a/src/qdoc/qdoccommandlineparser.h b/src/qdoc/qdoccommandlineparser.h index e669765a6..8756b6f54 100644 --- a/src/qdoc/qdoccommandlineparser.h +++ b/src/qdoc/qdoccommandlineparser.h @@ -38,7 +38,7 @@ QT_BEGIN_NAMESPACE struct QDocCommandLineParser : public QCommandLineParser { QDocCommandLineParser(); - void process(const QStringList &arguments, QDocGlobals &qdocGlobals); + void process(const QStringList &arguments); QCommandLineOption defineOption, dependsOption, highlightingOption; QCommandLineOption showInternalOption, redirectDocumentationToDevNullOption; diff --git a/src/qdoc/qdocglobals.cpp b/src/qdoc/qdocglobals.cpp index a79d47405..22e9beb70 100644 --- a/src/qdoc/qdocglobals.cpp +++ b/src/qdoc/qdocglobals.cpp @@ -27,10 +27,11 @@ ****************************************************************************/ #include "qdocglobals.h" +#include "qdoccommandlineparser.h" -QDocGlobals::QDocGlobals() -{ -} +#include <QtCore/qdebug.h> +#include <QtCore/qdir.h> +#include <QtCore/qfile.h> bool QDocGlobals::highlighting() { @@ -166,3 +167,47 @@ 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 index c849df19b..d1198db37 100644 --- a/src/qdoc/qdocglobals.h +++ b/src/qdoc/qdocglobals.h @@ -34,11 +34,12 @@ #include <QtCore/qtranslator.h> QT_BEGIN_NAMESPACE + +struct QDocCommandLineParser; + class QDocGlobals { public: - QDocGlobals(); - bool highlighting(); void enableHighlighting(bool value); @@ -80,8 +81,12 @@ public: QString previousCurrentDir(); 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; |