From a53b98f9269e6ee0b524fe7477e8fb46f189f9d3 Mon Sep 17 00:00:00 2001 From: Jerome Pasion Date: Tue, 3 Aug 2010 09:49:14 +0200 Subject: Made changes to qdoc to allow it to accept a "style level" flag --- tools/qdoc3/config.h | 1 + tools/qdoc3/main.cpp | 48 +++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 48 insertions(+), 1 deletion(-) diff --git a/tools/qdoc3/config.h b/tools/qdoc3/config.h index b087b1c..7665f1a 100644 --- a/tools/qdoc3/config.h +++ b/tools/qdoc3/config.h @@ -119,6 +119,7 @@ class Config }; #define CONFIG_ALIAS "alias" +#define CONFIG_APPLICATION "application" #define CONFIG_BASE "base" // ### don't document for now #define CONFIG_CODEINDENT "codeindent" #define CONFIG_DEFINES "defines" diff --git a/tools/qdoc3/main.cpp b/tools/qdoc3/main.cpp index 616ae2f..44f9572 100644 --- a/tools/qdoc3/main.cpp +++ b/tools/qdoc3/main.cpp @@ -105,6 +105,8 @@ static bool showInternal = false; static bool obsoleteLinks = false; static QStringList defines; static QHash trees; +static QString application = "base"; //application +static bool applicationArg = 0; //if 1, then the argument is provided and it will override the qdocconf file /*! Find the Tree for language \a lang and return a pointer to it. @@ -192,6 +194,38 @@ static void processQdocconfFile(const QString &fileName) config.load(fileName); /* + Set the application to which qdoc will create the output. + The three applications are: + base: simple, basic html output. Best suited for offline viewing + creator: additional formatting. + online: full-featured online version with search and links to Qt topics + + Note: This will override the offline, online, creator defines. + */ + if(applicationArg == false){ + + QString appConfig = config.getString(CONFIG_APPLICATION); + if (!appConfig.isEmpty()){ + application = appConfig; + } + } + if(application == "online"){ + config.setStringList(CONFIG_ONLINE, QStringList("true")); + config.setStringList(CONFIG_OFFLINE, QStringList("false")); + config.setStringList(CONFIG_CREATOR, QStringList("false")); + } + else if(application == "creator"){ + config.setStringList(CONFIG_ONLINE, QStringList("false")); + config.setStringList(CONFIG_OFFLINE, QStringList("true")); + config.setStringList(CONFIG_CREATOR, QStringList("false")); + } + else if(application == "base"){ + config.setStringList(CONFIG_ONLINE, QStringList("false")); + config.setStringList(CONFIG_OFFLINE, QStringList("false")); + config.setStringList(CONFIG_CREATOR, QStringList("true")); + } + + /* Add the defines to the configuration variables. */ QStringList defs = defines + config.getStringList(CONFIG_DEFINES); @@ -462,12 +496,24 @@ int main(int argc, char **argv) else if (opt == "-obsoletelinks") { obsoleteLinks = true; } + else if (opt == "-base") { + application = "base"; + applicationArg = true; + } + else if (opt == "-creator") { + application = "creator"; + applicationArg = true; + } + else if (opt == "-online") { + application = "online"; + applicationArg = true; + } else { qdocFiles.append(opt); } } - if (qdocFiles.isEmpty()) { + if (qdocFiles.isEmpty()) { printHelp(); return EXIT_FAILURE; } -- cgit v0.12