tools/qdoc3/main.cpp
changeset 37 758a864f9613
parent 33 3e2da88830cd
equal deleted inserted replaced
36:ef0373b55136 37:758a864f9613
   103 static bool slow = false;
   103 static bool slow = false;
   104 static bool showInternal = false;
   104 static bool showInternal = false;
   105 static bool obsoleteLinks = false;
   105 static bool obsoleteLinks = false;
   106 static QStringList defines;
   106 static QStringList defines;
   107 static QHash<QString, Tree *> trees;
   107 static QHash<QString, Tree *> trees;
       
   108 static QString appArg; // application
   108 
   109 
   109 /*!
   110 /*!
   110   Find the Tree for language \a lang and return a pointer to it.
   111   Find the Tree for language \a lang and return a pointer to it.
   111   If there is no Tree for language \a lang in the Tree table, add
   112   If there is no Tree for language \a lang in the Tree table, add
   112   a new one. The Tree table is indexed by \a lang strings.
   113   a new one. The Tree table is indexed by \a lang strings.
   145 /*!
   146 /*!
   146   Prints the qdoc version number to stdout.
   147   Prints the qdoc version number to stdout.
   147  */
   148  */
   148 static void printVersion()
   149 static void printVersion()
   149 {
   150 {
   150     QString s = QString(tr("qdoc version ")) + QString(QT_VERSION_STR);
   151     QString s = tr("qdoc version %1").arg(QT_VERSION_STR);
   151     Location::information(s);
   152     Location::information(s);
   152 }
   153 }
   153 
   154 
   154 /*!
   155 /*!
   155   Processes the qdoc config file \a fileName. This is the
   156   Processes the qdoc config file \a fileName. This is the
   188       in the file being processed, mainly for error reporting
   189       in the file being processed, mainly for error reporting
   189       purposes.
   190       purposes.
   190      */
   191      */
   191     Location::initialize(config);
   192     Location::initialize(config);
   192     config.load(fileName);
   193     config.load(fileName);
       
   194 
       
   195     /*
       
   196       Set the application to which qdoc will create the output.
       
   197       The two applications are:
       
   198 
       
   199       creator: additional formatting for viewing in
       
   200       the Creator application.
       
   201 
       
   202       online: full-featured online version with search and
       
   203       links to Qt topics
       
   204     */
       
   205     if (appArg.isEmpty()) {
       
   206         qDebug() << "Warning: Application flag not specified on"
       
   207                  << "command line. Options are -creator (default)"
       
   208                  << "and -online.";
       
   209         appArg = "creator";
       
   210     }
       
   211     config.setStringList(CONFIG_APPLICATION, QStringList(appArg));
   193 
   212 
   194     /*
   213     /*
   195       Add the defines to the configuration variables.
   214       Add the defines to the configuration variables.
   196      */
   215      */
   197     QStringList defs = defines + config.getStringList(CONFIG_DEFINES);
   216     QStringList defs = defines + config.getStringList(CONFIG_DEFINES);
   460             showInternal = true;
   479             showInternal = true;
   461         }
   480         }
   462         else if (opt == "-obsoletelinks") {
   481         else if (opt == "-obsoletelinks") {
   463             obsoleteLinks = true;
   482             obsoleteLinks = true;
   464         }
   483         }
       
   484 	else if (opt == "-creator")
       
   485 		appArg = "creator";
       
   486 	else if (opt == "-online")
       
   487 		appArg = "online";
   465         else {
   488         else {
   466 	    qdocFiles.append(opt);
   489 	    qdocFiles.append(opt);
   467 	}
   490 	}
   468     }
   491     }
   469 
   492 
   470     if (qdocFiles.isEmpty()) {
   493 	if (qdocFiles.isEmpty()) {
   471         printHelp();
   494         printHelp();
   472         return EXIT_FAILURE;
   495         return EXIT_FAILURE;
   473     }
   496     }
   474 
   497 
   475     /*
   498     /*
   476       Main loop.
   499       Main loop.
   477      */
   500      */
   478     foreach (QString qf, qdocFiles)
   501     foreach (QString qf, qdocFiles) {
       
   502         //qDebug() << "PROCESSING:" << qf;
   479 	processQdocconfFile(qf);
   503 	processQdocconfFile(qf);
       
   504     }
   480 
   505 
   481     qDeleteAll(trees);
   506     qDeleteAll(trees);
   482     return EXIT_SUCCESS;
   507     return EXIT_SUCCESS;
   483 }
   508 }
   484 
   509