private static void ApplyPostImportSteps(QtProject qtProject) { foreach (VCConfiguration cfg in (IVCCollection)qtProject.VCProject.Configurations) { cfg.IntermediateDirectory = @"$(Platform)\$(Configuration)\"; var compilerTool = CompilerToolWrapper.Create(cfg); if (compilerTool != null) { compilerTool.ObjectFile = @"$(IntDir)"; compilerTool.ProgramDataBaseFileName = @"$(IntDir)vc$(PlatformToolsetVersion).pdb"; } } qtProject.RemoveResFilesFromGeneratedFilesFilter(); qtProject.RepairGeneratedFilesStructure(); qtProject.TranslateFilterNames(); QtVSIPSettings.SaveUicDirectory(qtProject.Project, QtVSIPSettings.GetUicDirectory()); qtProject.UpdateUicSteps(".", false); // false is to not remove given path from includes QtVSIPSettings.SaveRccDirectory(qtProject.Project, QtVSIPSettings.GetRccDirectory()); qtProject.RefreshRccSteps(); // collapse the generated files/resources filters afterwards qtProject.CollapseFilter(Filters.ResourceFiles().Name); qtProject.CollapseFilter(Filters.GeneratedFiles().Name); try { // save the project after modification qtProject.Project.Save(null); } catch { /* ignore */ } }
private void setDirectory(string dir, string value) { foreach (EnvDTE.Project project in HelperFunctions.ProjectsInSolution(dte)) { VCProject vcProject = project.Object as VCProject; if (vcProject == null || vcProject.Files == null) { continue; } QtProject qtProject = QtProject.Create(project); if (qtProject == null) { continue; } if (dir == "MocDir") { string oldMocDir = QtVSIPSettings.GetMocDirectory(project); QtVSIPSettings.SaveMocDirectory(project, value); qtProject.UpdateMocSteps(oldMocDir); } else if (dir == "RccDir") { string oldRccDir = QtVSIPSettings.GetRccDirectory(project); QtVSIPSettings.SaveRccDirectory(project, value); qtProject.RefreshRccSteps(oldRccDir); } else if (dir == "UicDir") { string oldUicDir = QtVSIPSettings.GetUicDirectory(project); QtVSIPSettings.SaveUicDirectory(project, value); qtProject.UpdateUicSteps(oldUicDir, true); } } }
public void SaveSettings() { bool updateMoc = false; QtProject qtPro = QtProject.Create(project); if (oldMocDir != newMocDir) { QtVSIPSettings.SaveMocDirectory(project, newMocDir); updateMoc = true; } if (oldMocOptions != newMocOptions) { QtVSIPSettings.SaveMocOptions(project, newMocOptions); updateMoc = true; } if (updateMoc) { qtPro.UpdateMocSteps(oldMocDir); } if (oldUicDir != newUicDir) { QtVSIPSettings.SaveUicDirectory(project, newUicDir); qtPro.UpdateUicSteps(oldUicDir, true); } if (oldRccDir != newRccDir) { QtVSIPSettings.SaveRccDirectory(project, newRccDir); qtPro.RefreshRccSteps(oldRccDir); } if (oldLUpdateOnBuild != newLUpdateOnBuild) { QtVSIPSettings.SaveLUpdateOnBuild(project, newLUpdateOnBuild); } if (oldLUpdateOptions != newLUpdateOptions) { QtVSIPSettings.SaveLUpdateOptions(project, newLUpdateOptions); } if (oldLReleaseOptions != newLReleaseOptions) { QtVSIPSettings.SaveLReleaseOptions(project, newLReleaseOptions); } if (oldQtVersion != newQtVersion) { bool newProjectCreated = false; bool versionChanged = qtPro.ChangeQtVersion(oldQtVersion, newQtVersion, ref newProjectCreated); if (versionChanged && newProjectCreated) { project = qtPro.Project; } } }