tools/qdoc3/main.cpp
changeset 37 758a864f9613
parent 33 3e2da88830cd
--- a/tools/qdoc3/main.cpp	Fri Sep 17 08:34:18 2010 +0300
+++ b/tools/qdoc3/main.cpp	Mon Oct 04 01:19:32 2010 +0300
@@ -105,6 +105,7 @@
 static bool obsoleteLinks = false;
 static QStringList defines;
 static QHash<QString, Tree *> trees;
+static QString appArg; // application
 
 /*!
   Find the Tree for language \a lang and return a pointer to it.
@@ -147,7 +148,7 @@
  */
 static void printVersion()
 {
-    QString s = QString(tr("qdoc version ")) + QString(QT_VERSION_STR);
+    QString s = tr("qdoc version %1").arg(QT_VERSION_STR);
     Location::information(s);
 }
 
@@ -192,6 +193,24 @@
     config.load(fileName);
 
     /*
+      Set the application to which qdoc will create the output.
+      The two applications are:
+
+      creator: additional formatting for viewing in
+      the Creator application.
+
+      online: full-featured online version with search and
+      links to Qt topics
+    */
+    if (appArg.isEmpty()) {
+        qDebug() << "Warning: Application flag not specified on"
+                 << "command line. Options are -creator (default)"
+                 << "and -online.";
+        appArg = "creator";
+    }
+    config.setStringList(CONFIG_APPLICATION, QStringList(appArg));
+
+    /*
       Add the defines to the configuration variables.
      */
     QStringList defs = defines + config.getStringList(CONFIG_DEFINES);
@@ -462,12 +481,16 @@
         else if (opt == "-obsoletelinks") {
             obsoleteLinks = true;
         }
+	else if (opt == "-creator")
+		appArg = "creator";
+	else if (opt == "-online")
+		appArg = "online";
         else {
 	    qdocFiles.append(opt);
 	}
     }
 
-    if (qdocFiles.isEmpty()) {
+	if (qdocFiles.isEmpty()) {
         printHelp();
         return EXIT_FAILURE;
     }
@@ -475,8 +498,10 @@
     /*
       Main loop.
      */
-    foreach (QString qf, qdocFiles)
+    foreach (QString qf, qdocFiles) {
+        //qDebug() << "PROCESSING:" << qf;
 	processQdocconfFile(qf);
+    }
 
     qDeleteAll(trees);
     return EXIT_SUCCESS;