src/tools/uic3/main.cpp
changeset 7 f7bc934e204c
parent 0 1918ee327afb
child 30 5dc02b23752f
--- a/src/tools/uic3/main.cpp	Tue Feb 02 00:43:10 2010 +0200
+++ b/src/tools/uic3/main.cpp	Wed Mar 31 11:06:36 2010 +0300
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
 **
@@ -78,13 +78,11 @@
     QByteArray image_tmpfile;
     const char* projectName = 0;
     const char* trmacro = 0;
-    bool nofwd = false;
     bool fix = false;
     bool deps = false;
-    bool implicitIncludes = true;
+    unsigned readerOptions = Ui3Reader::ImplicitIncludes|Ui3Reader::CustomWidgetForwardDeclarations;
     QByteArray pchFile;
 
-
     QApplication app(argc, argv, false);
 
     for (int n = 1; n < argc && error == 0; n++) {
@@ -146,9 +144,11 @@
             } else if (opt == "d") {
                 deps = true;
             } else if (opt == "no-implicit-includes") {
-                implicitIncludes = false;
+                readerOptions &= ~Ui3Reader::ImplicitIncludes;
             } else if (opt == "nofwd") {
-                nofwd = true;
+                readerOptions &= ~Ui3Reader::CustomWidgetForwardDeclarations;
+            } else if (opt == "layout-names") {
+                readerOptions |= Ui3Reader::PreserveLayoutNames;
             } else if (opt == "nounload") {
                 // skip
             } else if (opt == "convert") {
@@ -253,6 +253,7 @@
                  "\t-extract qrcFile   Create resource file and extract embedded images into \"image\" dir\n"
                  "\t-pch file          Add #include \"file\" as the first statement in implementation\n"
                  "\t-nofwd             Omit forward declarations of custom classes\n"
+                 "\t-layout-names      Preserve layout names of Qt Designer 3\n"
                  "\t-no-implicit-includes Do not generate #include-directives for custom classes\n"
                  "\t-nounload          Do not unload plugins after processing\n"
                  "\t-tr func           Use func() instead of tr() for i18n\n"
@@ -289,9 +290,8 @@
 
     QTextStream out(&fileOut);
 
-    Ui3Reader ui3(out);
+    Ui3Reader ui3(out, readerOptions);
     ui3.setExtractImages(extract, qrcOutputFile);
-
     if (projectName && imagecollection) {
         out.setEncoding(QTextStream::Latin1);
         ui3.embed(projectName, images);
@@ -338,10 +338,10 @@
         QStringList globalIncludes, localIncludes;
         ui3.computeDeps(e, globalIncludes, localIncludes, impl);
 
-        foreach (QString i, globalIncludes)
+        foreach (const QString &i, globalIncludes)
             printf("%s\n", i.toLatin1().constData());
 
-        foreach (QString i, localIncludes)
+        foreach (const QString &i, localIncludes)
             printf("%s\n", i.toLatin1().constData());
 
         if (impl)
@@ -349,7 +349,7 @@
 
         return 0;
     } else if (convert) {
-        ui3.generateUi4(QFile::decodeName(fileName), QFile::decodeName(outputFile), doc, implicitIncludes);
+        ui3.generateUi4(QFile::decodeName(fileName), QFile::decodeName(outputFile), doc);
         return 0;
     }
 
@@ -388,8 +388,6 @@
         subcl,
         QString::fromUtf8(trmacro),
         QString::fromUtf8(className),
-        nofwd,
-        implicitIncludes, 
         convertedUi);
 
     if (!protector.isEmpty()) {