Add an option to suppress status messages in qhelpgenerator.
authorJake Petroules <jake.petroules@petroules.com>
Sat, 21 Feb 2015 03:24:24 +0000 (19:24 -0800)
committerJake Petroules <jake.petroules@petroules.com>
Wed, 25 Feb 2015 05:11:50 +0000 (05:11 +0000)
Change-Id: Idfeda72a7936f9783a76f08faf2e0eb2543aedf1
Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
src/assistant/qhelpgenerator/main.cpp
src/assistant/shared/helpgenerator.cpp
src/assistant/shared/helpgenerator.h

index 1c7b129..62c584e 100644 (file)
@@ -58,6 +58,7 @@ int main(int argc, char *argv[])
     bool showHelp = false;
     bool showVersion = false;
     bool checkLinks = false;
+    bool silent = false;
 
     // don't require a window manager even though we're a QGuiApplication
     qputenv("QT_QPA_PLATFORM", QByteArrayLiteral("minimal"));
@@ -93,6 +94,8 @@ int main(int argc, char *argv[])
             showHelp = true;
         } else if (arg == QLatin1String("-c")) {
             checkLinks = true;
+        } else if (arg == QLatin1String("-s")) {
+            silent = true;
         } else {
             QFileInfo fi(arg);
             projectFile = fi.absoluteFilePath();
@@ -117,6 +120,7 @@ int main(int argc, char *argv[])
         "                         a default name will be used.\n"
         "  -c                     Checks whether all links in HTML files\n"
         "                         point to files in this help project.\n"
+        "  -s                     Suppresses status messages.\n"
         "  -v                     Displays the version of \n"
         "                         qhelpgenerator.\n\n");
 
@@ -158,7 +162,7 @@ int main(int argc, char *argv[])
         return -1;
     }
 
-    HelpGenerator generator;
+    HelpGenerator generator(silent);
     bool success = true;
     if (checkLinks)
         success = generator.checkLinks(*helpData);
index a7a44dc..2133c66 100644 (file)
 
 QT_BEGIN_NAMESPACE
 
-HelpGenerator::HelpGenerator()
+HelpGenerator::HelpGenerator(bool silent)
 {
     generator = new QHelpGenerator(this);
-    connect(generator, SIGNAL(statusChanged(QString)),
-        this, SLOT(printStatus(QString)));
+    if (!silent) {
+        connect(generator, SIGNAL(statusChanged(QString)),
+            this, SLOT(printStatus(QString)));
+    }
     connect(generator, SIGNAL(warning(QString)),
         this, SLOT(printWarning(QString)));
 }
index 20ea482..19c21e5 100644 (file)
@@ -46,7 +46,7 @@ class HelpGenerator : public QObject
     Q_OBJECT
 
 public:
-    HelpGenerator();
+    HelpGenerator(bool silent = false);
     bool generate(QHelpDataInterface *helpData,
         const QString &outputFileName);
     bool checkLinks(const QHelpDataInterface &helpData);