summaryrefslogtreecommitdiffstats
path: root/src/tools/qdoc
diff options
context:
space:
mode:
authorMartin Smith <martin.smith@digia.com>2012-10-25 14:01:11 +0200
committerMartin Smith <martin.smith@digia.com>2012-10-25 14:19:53 +0200
commitaca24f114627b66e902b4621326cf2b8bc8dbcf6 (patch)
treeac2ad363e58085bbe7f512cc2b5bfaf8833a1676 /src/tools/qdoc
parent34d2a7e6b68cfff59c29018b4aea1a7af38512da (diff)
qdoc: Adding the -log-progress option
qdoc now sends progress log messages to stderr only if -log-progress appears on the command line. The progress messages are not printed to stderr if -log-progress is not used. i.e., -log-progress is off by default. Task number: QTBUG-27707 Change-Id: Id605d943506ab38639730bf16473b156d061dc53 Reviewed-by: Jerome Pasion <jerome.pasion@digia.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com> Reviewed-by: Martin Smith <martin.smith@digia.com>
Diffstat (limited to 'src/tools/qdoc')
-rw-r--r--src/tools/qdoc/location.cpp10
-rw-r--r--src/tools/qdoc/location.h3
-rw-r--r--src/tools/qdoc/main.cpp9
-rw-r--r--src/tools/qdoc/qdocindexfiles.cpp4
4 files changed, 18 insertions, 8 deletions
diff --git a/src/tools/qdoc/location.cpp b/src/tools/qdoc/location.cpp
index 48e5d6153c..ca6521c002 100644
--- a/src/tools/qdoc/location.cpp
+++ b/src/tools/qdoc/location.cpp
@@ -57,6 +57,7 @@ QT_STATIC_CONST_IMPL Location Location::null;
int Location::tabSize;
QString Location::programName;
QRegExp *Location::spuriousRegExp = 0;
+bool Location::logProgress_ = false;
/*!
\class Location
@@ -336,12 +337,15 @@ void Location::information(const QString& message)
}
/*!
- Prints \a message to \c stderr followed by a \c{'\n'}.
+ Prints \a message to \c stderr followed by a \c{'\n'},
+ but only if the -log-progress option is set.
*/
void Location::logToStdErr(const QString& message)
{
- fprintf(stderr, "%s\n", message.toLatin1().data());
- fflush(stderr);
+ if (logProgress_) {
+ fprintf(stderr, "LOG: %s\n", message.toLatin1().data());
+ fflush(stderr);
+ }
}
/*!
diff --git a/src/tools/qdoc/location.h b/src/tools/qdoc/location.h
index 71492e619f..0d22e94b46 100644
--- a/src/tools/qdoc/location.h
+++ b/src/tools/qdoc/location.h
@@ -97,6 +97,8 @@ public:
static void information(const QString& message);
static void internalError(const QString& hint);
static void logToStdErr(const QString& message);
+ static void startLoggingProgress() { logProgress_ = true; }
+ static void stopLoggingProgress() { logProgress_ = false; }
private:
enum MessageType { Warning, Error };
@@ -124,6 +126,7 @@ private:
static int tabSize;
static QString programName;
static QRegExp *spuriousRegExp;
+ static bool logProgress_;
};
QT_END_NAMESPACE
diff --git a/src/tools/qdoc/main.cpp b/src/tools/qdoc/main.cpp
index d46580bbea..c70160f6ec 100644
--- a/src/tools/qdoc/main.cpp
+++ b/src/tools/qdoc/main.cpp
@@ -293,10 +293,10 @@ static void processQdocconfFile(const QString &fileName)
QString phase;
if (Generator::runPrepareOnly())
- phase = "in -prepare mode ";
+ phase = " in -prepare mode ";
else if (Generator::runGenerateOnly())
- phase = "in -generate mode ";
- QString msg = "Running qdoc " + phase + "for " + config.getString(CONFIG_PROJECT);
+ phase = " in -generate mode ";
+ QString msg = "Running qdoc for " + config.getString(CONFIG_PROJECT) + phase;
Location::logToStdErr(msg);
/*
@@ -617,6 +617,9 @@ int main(int argc, char **argv)
else if (opt == "-generate") {
Generator::setQDocPass(Generator::Generate);
}
+ else if (opt == "-log-progress") {
+ Location::startLoggingProgress();
+ }
else {
qdocFiles.append(opt);
}
diff --git a/src/tools/qdoc/qdocindexfiles.cpp b/src/tools/qdoc/qdocindexfiles.cpp
index 6d697c61b0..33b489d6d0 100644
--- a/src/tools/qdoc/qdocindexfiles.cpp
+++ b/src/tools/qdoc/qdocindexfiles.cpp
@@ -111,7 +111,7 @@ void QDocIndexFiles::destroyQDocIndexFiles()
void QDocIndexFiles::readIndexes(const QStringList& indexFiles)
{
foreach (const QString& indexFile, indexFiles) {
- QString msg = " Loading index file: " + indexFile;
+ QString msg = "Loading index file: " + indexFile;
Location::logToStdErr(msg);
readIndexFile(indexFile);
}
@@ -1052,7 +1052,7 @@ void QDocIndexFiles::generateIndex(const QString& fileName,
if (!file.open(QFile::WriteOnly | QFile::Text))
return;
- QString msg = " Writing index file: " + fileName;
+ QString msg = "Writing index file: " + fileName;
Location::logToStdErr(msg);
gen_ = g;