/// <summary> /// Checks if an add-on qt module is installed /// </summary> /// <param name="moduleName">the module to find /// </param> public bool IsModuleInstalled(string moduleName) { QtVersionManager versionManager = QtVersionManager.The(); string qtVersion = versionManager.GetDefaultVersion(); if (qtVersion == null) { throw new Qt4VSException("Unable to find a Qt build!\r\n" + "To solve this problem specify a Qt build"); } string install_path = versionManager.GetInstallPath(qtVersion); if (moduleName.StartsWith("Qt")) { moduleName = "Qt4" + moduleName.Substring(2); } string full_path = install_path + "\\lib\\" + moduleName + ".lib"; System.IO.FileInfo fi = new System.IO.FileInfo(full_path); return(fi.Exists); }
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"); } }