[PATCH] Qt4 - fix ui rules for qmake generated vcproj

Thiago A. CorrĂȘa <[email protected]> Tue, 19 Jul 2005 19:26:48 -0300
Newsgroups gmane.comp.kde.devel.cygwin
Message-ID <[email protected]>
This should fix UIC custom build rules when using vcproj files to build.
Should be applied from %QTDIR%\qmake, I hope *smile*
Should also fix some verbose debug output I forgot to disable before sending the last patch *sigh*


Regards,
  Thiago A. Correa

_______________________________________________
kde-cygwin mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/kde-cygwin
fixuic.patch (application/octet-stream, 3.3 KB)
? fixuic.patch
Index: generators/win32/msvc_objectmodel.cpp
===================================================================
RCS file: /cvsroot/qtwin/qt-4/qmake/generators/win32/msvc_objectmodel.cpp,v
retrieving revision 1.2
diff -u -p -r1.2 msvc_objectmodel.cpp
--- generators/win32/msvc_objectmodel.cpp	10 Jul 2005 20:17:24 -0000	1.2
+++ generators/win32/msvc_objectmodel.cpp	19 Jul 2005 22:11:53 -0000
@@ -1859,52 +1859,33 @@ void VCFilter::addUICstage( QTextStream 
     useCustomBuildTool = TRUE;
 
     QString uicApp = Project->var("QMAKE_UIC");
-    QString mocApp = Project->var( "QMAKE_MOC" );
     QString fname = str.section( '\\', -1 );
-    QString mocDir = Project->var( "MOC_DIR" );
     QString uiDir = Project->var( "UI_DIR" );
     QString uiHeaders;
-    QString uiSources;
 
     // Determining the paths for the output files.
     int slash = str.lastIndexOf( '\\' );
     QString pname = ( slash != -1 ) ? str.left( slash+1 ) : QString( ".\\" );
     if( !uiDir.isEmpty() ) {
 	uiHeaders = uiDir;
-	uiSources = uiDir;
     } else {
 	uiHeaders = Project->var( "UI_HEADERS_DIR" );
-	uiSources = Project->var( "UI_SOURCES_DIR" );
 	if( uiHeaders.isEmpty() )
 	    uiHeaders = pname;
-	if( uiSources.isEmpty() )
-	    uiSources = pname;
     }
     if( !uiHeaders.endsWith( "\\" ) )
 	uiHeaders += "\\";
-    if( !uiSources.endsWith( "\\" ) )
-	uiSources += "\\";
 
     // Determine the file name.
     int dot = fname.lastIndexOf( '.' );
     if( dot != -1 )
 	fname.truncate( dot );
-
-    if ( mocDir.isEmpty() )
-	mocDir = pname;
-
+	fname.prepend("ui_");
     CustomBuildTool.Description = ("Uic'ing " + str + "...\"");
     CustomBuildTool.CommandLine += // Create .h from .ui file
 	uicApp + " " + str + " -o " + uiHeaders + fname + ".h";
-    CustomBuildTool.CommandLine += // Create .cpp from .ui file
-	uicApp + " " + str + " -i " + fname + ".h -o " + uiSources + fname + ".cpp";
-    CustomBuildTool.CommandLine += // Moc the headerfile
-	mocApp + " " + uiHeaders + fname + ".h -o " + mocDir + Option::h_moc_mod + fname + Option::h_moc_ext;
-
-    CustomBuildTool.AdditionalDependencies += mocApp;
     CustomBuildTool.AdditionalDependencies += uicApp;
-    CustomBuildTool.Outputs +=
-	uiHeaders + fname + ".h;" + uiSources + fname + ".cpp;" + mocDir + Option::h_moc_mod + fname + Option::h_moc_ext;
+    CustomBuildTool.Outputs += uiHeaders + fname + ".h;";
 }
 
 void VCFilter::modifyPCHstage( QTextStream &/*strm*/, QString str )
Index: generators/win32/msvc_vcproj.cpp
===================================================================
RCS file: /cvsroot/qtwin/qt-4/qmake/generators/win32/msvc_vcproj.cpp,v
retrieving revision 1.2
diff -u -p -r1.2 msvc_vcproj.cpp
--- generators/win32/msvc_vcproj.cpp	10 Jul 2005 20:17:25 -0000	1.2
+++ generators/win32/msvc_vcproj.cpp	19 Jul 2005 22:25:42 -0000
@@ -1466,7 +1466,7 @@ void VcprojGenerator::processPrlVariable
 
 void VcprojGenerator::outputVariables()
 {
-#if 1
+#if 0
     qDebug( "Generator: MSVC.NET: List of current variables:" );
     for ( QMap<QString, QStringList>::ConstIterator it = project->variables().begin(); it != project->variables().end(); ++it) {
 	qDebug( "Generator: MSVC.NET: %s => %s", it.key().toLatin1().constData(), it.value().join(" | ").toLatin1().constData() );