src/tools/uic3/main.cpp
branchRCL_3
changeset 5 d3bac044e0f0
parent 4 3b1da2848fc7
--- a/src/tools/uic3/main.cpp	Fri Feb 19 23:40:16 2010 +0200
+++ b/src/tools/uic3/main.cpp	Fri Mar 12 15:46:37 2010 +0200
@@ -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()) {