private static void AddModules(QtProject qtPrj, ProFileOption optionQT, ProFileOption optionCONFIG) { foreach (QtModuleInfo moduleInfo in QtModules.Instance.GetAvailableModuleInformation()) { if (!qtPrj.HasModule(moduleInfo.ModuleId)) continue; if (moduleInfo.proVarQT != null) optionQT.List.Add(moduleInfo.proVarQT); if (moduleInfo.proVarCONFIG != null) optionCONFIG.List.Add(moduleInfo.proVarCONFIG); } }
public static QtProject Create(EnvDTE.Project project) { QtProject qtProject = null; if (project != null && !instances.TryGetValue(project, out qtProject)) { qtProject = new QtProject(project); instances.Add(project, qtProject); } return qtProject; }
public static VCFile Update(QtProject qtPrj, VCFile vcFile) { qtPrj.VCProject.Save(); string prjPath = qtPrj.Project.FullName; string itemPath = vcFile.FullPath; var documents = new List<string>(); foreach (Document document in qtPrj.dte.Documents) { if (document.Path != itemPath) { documents.Add(document.Path); } } instances.Remove(qtPrj.envPro); qtPrj.dte.Solution.Remove(qtPrj.Project); qtPrj.envPro = qtPrj.dte.Solution.AddFromFile(prjPath, false); instances.Add(qtPrj.envPro, qtPrj); foreach (string document in documents) { if (document != itemPath) { qtPrj.dte.ItemOperations.OpenFile(document); } } qtPrj.dte.ItemOperations.OpenFile(itemPath); qtPrj.vcPro = qtPrj.envPro.Object as VCProject; vcFile = (qtPrj.vcPro.Files as IVCCollection).Item(itemPath) as VCFile; return vcFile; }
private static void ApplyPostImportSteps(QtProject qtProject) { foreach (VCConfiguration cfg in (IVCCollection)qtProject.VCProject.Configurations) { #if (VS2010 || VS2012 || VS2013) cfg.IntermediateDirectory = @"$(Platform)\$(Configuration)\"; #else cfg.IntermediateDirectory = @"$(PlatformName)\$(ConfigurationName)"; #endif CompilerToolWrapper compilerTool = CompilerToolWrapper.Create(cfg); if (compilerTool != null) { #if (VS2010 || VS2012 || VS2013) compilerTool.ObjectFile = @"$(IntDir)"; compilerTool.ProgramDataBaseFileName = @"$(IntDir)vc$(PlatformToolsetVersion).pdb"; #else compilerTool.ObjectFile = @"$(IntDir)\"; compilerTool.ProgramDataBaseFileName = @"$(IntDir)\vc90.pdb"; #endif } } 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 */ } }
public void UseSelectedProject(EnvDTE.DTE app) { pro = HelperFunctions.GetSelectedQtProject(app); if (pro == null) throw new Qt4VSException("Can't find a selected project"); qtPro = QtProject.Create(pro); }
private void CreateProject(EnvDTE.DTE app, string proName, string proPath, string slnName, bool exclusive, FakeFilter[] filters, string qtVersion, string platformName) { QtVersionManager versionManager = QtVersionManager.The(); if (qtVersion == null) qtVersion = "$(DefaultQtVersion)"; if (qtVersion == null) throw new Qt4VSException("Unable to find a Qt build!\r\n" + "To solve this problem specify a Qt build"); string solutionPath = ""; Solution newSolution = app.Solution; if (platformName == null) { string tmpQtVersion = versionManager.GetSolutionQtVersion(newSolution); qtVersion = tmpQtVersion != null ? tmpQtVersion : qtVersion; try { VersionInformation vi = new VersionInformation(versionManager.GetInstallPath(qtVersion)); if (vi.is64Bit()) platformName = "x64"; else platformName = "Win32"; } catch (Exception e) { Messages.DisplayErrorMessage(e); } } if (!string.IsNullOrEmpty(slnName) && (exclusive == true)) { solutionPath = proPath.Substring(0, proPath.LastIndexOf("\\")); newSolution.Create(solutionPath, slnName); } System.IO.Directory.CreateDirectory(proPath); string templatePath = HelperFunctions.CreateProjectTemplateFile(filters, true, platformName); pro = newSolution.AddFromTemplate(templatePath, proPath, proName, exclusive); HelperFunctions.ReleaseProjectTemplateFile(); qtPro = QtProject.Create(pro); QtVSIPSettings.SaveUicDirectory(pro, null); QtVSIPSettings.SaveMocDirectory(pro, null); QtVSIPSettings.SaveMocOptions(pro, null); QtVSIPSettings.SaveRccDirectory(pro, null); QtVSIPSettings.SaveLUpdateOnBuild(pro); QtVSIPSettings.SaveLUpdateOptions(pro, null); QtVSIPSettings.SaveLReleaseOptions(pro, null); QtVSIPSettings.SaveDesignerOptions(pro, null); QtVSIPSettings.SaveLinguistOptions(pro, null); QtVSIPSettings.SaveAssistantOptions(pro, null); foreach (string kPlatformName in (Array)pro.ConfigurationManager.PlatformNames) { versionManager.SaveProjectQtVersion(pro, "$(DefaultQtVersion)", kPlatformName); } qtPro.MarkAsQtProject("v1.0"); qtPro.AddDirectories(); qtPro.SelectSolutionPlatform(platformName); if (!string.IsNullOrEmpty(slnName) && (exclusive == true)) newSolution.SaveAs(solutionPath + "\\" + slnName + ".sln"); }
private void SaveModules() { qtProject = QtProject.Create(project); for (int i = 0; i < moduleMap.Count; ++i) { ModuleMapItem item = moduleMap[i]; bool isModuleChecked = item.checkbox.Checked; if (isModuleChecked != item.initialValue) { if (isModuleChecked) qtProject.AddModule(item.moduleId); else qtProject.RemoveModule(item.moduleId); } } }
public void SetProject(Project pro) { project = pro; qtProject = QtProject.Create(project); InitModules(); qtSettings = new ProjectQtSettings(project); OptionsPropertyGrid.SelectedObject = qtSettings; }