public void ProjectFinishedGenerating(Project project) { var qtProject = QtProject.Create(project); QtVSIPSettings.SaveUicDirectory(project, null); QtVSIPSettings.SaveMocDirectory(project, null); QtVSIPSettings.SaveMocOptions(project, null); QtVSIPSettings.SaveRccDirectory(project, null); QtVSIPSettings.SaveLUpdateOnBuild(project); QtVSIPSettings.SaveLUpdateOptions(project, null); QtVSIPSettings.SaveLReleaseOptions(project, null); var vm = QtVersionManager.The(); var qtVersion = vm.GetDefaultVersion(); var vi = VersionInformation.Get(vm.GetInstallPath(qtVersion)); if (vi.GetVSPlatformName() != "Win32") { qtProject.SelectSolutionPlatform(vi.GetVSPlatformName()); } vm.SaveProjectQtVersion(project, qtVersion); qtProject.MarkAsQtProject("v1.0"); qtProject.AddDirectories(); var type = TemplateType.Application | TemplateType.ConsoleSystem; qtProject.WriteProjectBasicConfigurations(type, false); foreach (VCFile file in (IVCCollection)qtProject.VCProject.Files) { qtProject.AdjustWhitespace(file.FullPath); } qtProject.AddModule(QtModule.Main); foreach (var module in data.Modules) { qtProject.AddModule(QtModules.Instance.ModuleIdByName(module)); } qtProject.SetQtEnvironment(qtVersion); qtProject.Finish(); // Collapses all project nodes. }
public void ProjectFinishedGenerating(Project project) { var qtProject = QtProject.Create(project); QtVSIPSettings.SaveUicDirectory(project, null); QtVSIPSettings.SaveMocDirectory(project, null); QtVSIPSettings.SaveMocOptions(project, null); QtVSIPSettings.SaveRccDirectory(project, null); QtVSIPSettings.SaveLUpdateOnBuild(project); QtVSIPSettings.SaveLUpdateOptions(project, null); QtVSIPSettings.SaveLReleaseOptions(project, null); var vm = QtVersionManager.The(); var qtVersion = vm.GetDefaultVersion(); var vi = VersionInformation.Get(vm.GetInstallPath(qtVersion)); if (vi.GetVSPlatformName() != "Win32") { qtProject.SelectSolutionPlatform(vi.GetVSPlatformName()); } vm.SaveProjectQtVersion(project, qtVersion); qtProject.MarkAsQtProject("v1.0"); qtProject.AddDirectories(); var type = TemplateType.Application | TemplateType.GUISystem; qtProject.WriteProjectBasicConfigurations(type, data.UsePrecompiledHeader); qtProject.AddModule(QtModule.Main); foreach (var module in data.Modules) { qtProject.AddModule(QtModules.Instance.ModuleIdByName(module)); } var vcProject = qtProject.VCProject; var files = vcProject.GetFilesWithItemType(@"None") as IVCCollection; foreach (var vcFile in files) { vcProject.RemoveFile(vcFile); } if (data.UsePrecompiledHeader) { qtProject.AddFileToProject(@"stdafx.cpp", Filters.SourceFiles()); qtProject.AddFileToProject(@"stdafx.h", Filters.HeaderFiles()); } qtProject.AddFileToProject(data.ClassSourceFile, Filters.SourceFiles()); qtProject.AddFileToProject(data.ClassHeaderFile, Filters.HeaderFiles()); qtProject.AddFileToProject(data.UiFile, Filters.FormFiles()); var qrc = qtProject.CreateQrcFile(data.ClassName, data.QrcFile); qtProject.AddFileToProject(qrc, Filters.ResourceFiles()); if (data.AddDefaultAppIcon) { try { var icon = vcProject.ProjectDirectory + "\\" + vcProject.ItemName + ".ico"; if (!File.Exists(icon)) { File.Move(vcProject.ProjectDirectory + "\\gui.ico", icon); var attribs = File.GetAttributes(icon); File.SetAttributes(icon, attribs & (~FileAttributes.ReadOnly)); } var rcFile = vcProject.ProjectDirectory + "\\" + vcProject.ItemName + ".rc"; if (!File.Exists(rcFile)) { FileStream fs = null; try { fs = File.Create(rcFile); using (var sw = new StreamWriter(fs)) { fs = null; sw.WriteLine("IDI_ICON1\t\tICON\t\tDISCARDABLE\t\"" + vcProject.ItemName + ".ico\"" + sw.NewLine); } } finally { if (fs != null) { fs.Dispose(); } } vcProject.AddFile(rcFile); } } catch { } } foreach (VCFile file in (IVCCollection)qtProject.VCProject.Files) { qtProject.AdjustWhitespace(file.FullPath); } qtProject.SetQtEnvironment(qtVersion); qtProject.Finish(); // Collapses all project nodes. }
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 (oldDesignerOptions != newDesignerOptions) { QtVSIPSettings.SaveDesignerOptions(project, newDesignerOptions); } if (oldLinguistOptions != newLinguistOptions) { QtVSIPSettings.SaveLinguistOptions(project, newLinguistOptions); } if (oldAssistantOptions != newAssistantOptions) { QtVSIPSettings.SaveAssistantOptions(project, newAssistantOptions); } if (oldQtVersion != newQtVersion) { bool newProjectCreated = false; bool versionChanged = qtPro.ChangeQtVersion(oldQtVersion, newQtVersion, ref newProjectCreated); if (versionChanged && newProjectCreated) { project = qtPro.Project; } } }
public void ProjectFinishedGenerating(Project project) { var qtProject = QtProject.Create(project); QtVSIPSettings.SaveUicDirectory(project, null); QtVSIPSettings.SaveMocDirectory(project, null); QtVSIPSettings.SaveMocOptions(project, null); QtVSIPSettings.SaveRccDirectory(project, null); QtVSIPSettings.SaveLUpdateOnBuild(project); QtVSIPSettings.SaveLUpdateOptions(project, null); QtVSIPSettings.SaveLReleaseOptions(project, null); var vm = QtVersionManager.The(); var qtVersion = vm.GetDefaultVersion(); var vi = VersionInformation.Get(vm.GetInstallPath(qtVersion)); if (vi.GetVSPlatformName() != "Win32") { qtProject.SelectSolutionPlatform(vi.GetVSPlatformName()); } vm.SaveProjectQtVersion(project, qtVersion); qtProject.MarkAsQtProject("v1.0"); qtProject.AddDirectories(); var type = TemplateType.GUISystem | (data.CreateStaticLibrary ? TemplateType.StaticLibrary : TemplateType.DynamicLibrary); qtProject.WriteProjectBasicConfigurations(type, data.UsePrecompiledHeader); qtProject.AddModule(QtModule.Main); foreach (var module in data.Modules) { qtProject.AddModule(QtModules.Instance.ModuleIdByName(module)); } var vcProject = qtProject.VCProject; var files = vcProject.GetFilesWithItemType(@"None") as IVCCollection; foreach (var vcFile in files) { vcProject.RemoveFile(vcFile); } if (data.UsePrecompiledHeader) { qtProject.AddFileToProject(@"stdafx.cpp", Filters.SourceFiles()); qtProject.AddFileToProject(@"stdafx.h", Filters.HeaderFiles()); } foreach (VCFile file in (IVCCollection)qtProject.VCProject.Files) { qtProject.AdjustWhitespace(file.FullPath); } qtProject.AddDefine(projectDefine, BuildConfig.Both); if (data.CreateStaticLibrary) { qtProject.AddDefine("BUILD_STATIC", BuildConfig.Both); } qtProject.SetQtEnvironment(qtVersion); qtProject.Finish(); // Collapses all project nodes. }
public void SaveSettings() { var updateMoc = false; var 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 (oldQmlDebug != QmlDebug) { QtVSIPSettings.SaveQmlDebug(project, QmlDebug); } if (oldQtVersion != newQtVersion) { if (qtPro.PromptChangeQtVersion(oldQtVersion, newQtVersion)) { var newProjectCreated = false; var versionChanged = qtPro.ChangeQtVersion( oldQtVersion, newQtVersion, ref newProjectCreated); if (versionChanged && newProjectCreated) { project = qtPro.Project; } } } }