private static void AddIncludePaths(Project project, ProFileOption option, string includePaths) { if (QtProject.GetFormatVersion(project) >= Resources.qtMinFormatVersion_ClProperties) { return; } if (includePaths == null) { return; } var versionManager = QtVersionManager.The(); var qtDir = versionManager.GetInstallPath(project); if (qtDir == null) { qtDir = Environment.GetEnvironmentVariable("QTDIR"); } if (qtDir == null) { qtDir = ""; } qtDir = HelperFunctions.NormalizeRelativeFilePath(qtDir); foreach (var s in includePaths.Split(';', ',')) { var d = HelperFunctions.NormalizeRelativeFilePath(s); if (!d.StartsWith("$(qtdir)\\include", StringComparison.OrdinalIgnoreCase) && !d.StartsWith(qtDir + "\\include", StringComparison.OrdinalIgnoreCase) && !d.EndsWith("win32-msvc2005", StringComparison.OrdinalIgnoreCase)) { var vcConfig = project.ConfigurationManager.ActiveConfiguration.Object as VCConfiguration; if (vcConfig != null) { HelperFunctions.ExpandString(ref d, vcConfig); } if (HelperFunctions.IsAbsoluteFilePath(d)) { d = HelperFunctions.GetRelativePath(project.FullName, d); } if (!HelperFunctions.IsAbsoluteFilePath(d)) { option.List.Add(HelperFunctions.ChangePathFormat(d)); } } } }
public static void RunlRelease(EnvDTE.Project project) { var qtPro = QtProject.Create(project); if (qtPro == null) { return; } var ts = Filters.TranslationFiles(); var tsFilter = qtPro.FindFilterFromGuid(ts.UniqueIdentifier); if (tsFilter == null) { return; } var files = tsFilter.Files as IVCCollection; foreach (VCFile vcFile in files) { if (HelperFunctions.IsTranslationFile(vcFile.Name)) { if (!RunlRelease(vcFile)) { return; } } } }
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.TranslateFilterNames(); QtVSIPSettings.SaveUicDirectory(qtProject.Project, QtVSIPSettings.GetUicDirectory()); QtVSIPSettings.SaveRccDirectory(qtProject.Project, QtVSIPSettings.GetRccDirectory()); // 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 */ } }
static void RunTranslationTarget( BuildAction buildAction, EnvDTE.Project project, IEnumerable <string> selectedFiles = null) { ThreadHelper.ThrowIfNotOnUIThread(); using (WaitDialog.Start( "Qt Visual Studio Tools", "Running translation tool...")) { var qtPro = QtProject.Create(project); if (project == null || qtPro == null) { Messages.Print( "translation: Error accessing project interface"); return; } if (qtPro.FormatVersion < Resources.qtMinFormatVersion_Settings) { Messages.Print("translation: Legacy project format"); try { Legacy_RunTranslation(buildAction, qtPro, selectedFiles); } catch (Exception e) { Messages.Print( e.Message + "\r\n\r\nStacktrace:\r\n" + e.StackTrace); } return; } var activeConfig = project.ConfigurationManager?.ActiveConfiguration; if (activeConfig == null) { Messages.Print( "translation: Error accessing build interface"); return; } var activeConfigId = string.Format("{0}|{1}", activeConfig.ConfigurationName, activeConfig.PlatformName); var target = "QtTranslation"; var properties = new Dictionary <string, string>(); switch (buildAction) { case BuildAction.Update: properties["QtTranslationForceUpdate"] = "true"; break; case BuildAction.Release: properties["QtTranslationForceRelease"] = "true"; break; } if (selectedFiles != null) { properties["SelectedFiles"] = string.Join(";", selectedFiles); } QtProjectBuild.StartBuild( project, project.FullName, activeConfigId, properties, new[] { target }); } }
private string AddProjectItemCpp(string location, string pch) { var cppFile = Path.GetTempFileName(); using (var tmp = new StreamWriter(cppFile)) { tmp.Write("#include \"%INCLUDE%\"\r\n\r\n" + "%NAMESPACE_BEGIN%%CLASS%::%CLASS%(%CTORSIG%)%BASECLASS%\r\n" + "{\r\n}\r\n\r\n" + "%CLASS%::~%CLASS%()\r\n" + "{\r\n}\r\n" + "%NAMESPACE_END%"); } cppFile = QtProject.CopyFileToFolder(cppFile, location, data.ClassSourceFile); if (!string.IsNullOrEmpty(pch)) { QtProject.ReplaceTokenInFile(cppFile, "%INCLUDE%", pch + "\"\r\n#include \"%INCLUDE%"); } QtProject.ReplaceTokenInFile(cppFile, "%INCLUDE%", data.ClassHeaderFile); QtProject.ReplaceTokenInFile(cppFile, "%CLASS%", data.ClassName); QtProject.ReplaceTokenInFile(cppFile, "%BASECLASS%", string.IsNullOrEmpty(data .ConstructorSignature) ? "" : "\r\n : " + data.BaseClass + "(parent)"); QtProject.ReplaceTokenInFile(cppFile, "%CTORSIG%", data.ConstructorSignature); return(cppFile); }
void debugStartEvents_BeforeExecute(string Guid, int ID, object CustomIn, object CustomOut, ref bool CancelDefault) { ThreadHelper.ThrowIfNotOnUIThread(); var debugger = dte.Debugger; if (debugger != null && debugger.CurrentMode != dbgDebugMode.dbgDesignMode) { return; } var selectedProject = HelperFunctions.GetSelectedQtProject(dte); if (selectedProject != null) { if (QtProject.GetFormatVersion(selectedProject) >= Resources.qtMinFormatVersion_Settings) { return; } var qtProject = QtProject.Create(selectedProject); if (qtProject != null) { qtProject.SetQtEnvironment(); var qtVersion = qtProject.GetQtVersion(); var versionInfo = QtVersionManager.The().GetVersionInfo(qtVersion); if (!string.IsNullOrEmpty(versionInfo.Namespace())) { QtVsToolsPackage.Instance.CopyNatvisFiles(versionInfo.Namespace()); } } } }
public bool SaveProjectQtVersion(EnvDTE.Project project, string version, string platform) { if (!IsVersionAvailable(version) && version != "$(DefaultQtVersion)") { return(false); } if (QtProject.GetFormatVersion(project) >= Resources.qtMinFormatVersion_Settings) { var vcPro = project.Object as VCProject; if (vcPro == null) { return(false); } #if VS2017 || VS2019 foreach (VCConfiguration3 config in (IVCCollection)vcPro.Configurations) { config.SetPropertyValue(Resources.projLabelQtSettings, true, "QtInstall", version); } #endif return(true); } var key = "Qt5Version " + platform; if (!project.Globals.get_VariableExists(key) || project.Globals[key].ToString() != version) { project.Globals[key] = version; } if (!project.Globals.get_VariablePersists(key)) { project.Globals.set_VariablePersists(key, true); } return(true); }
public static void RunlUpdate(EnvDTE.Project project) { QtProject qtPro = QtProject.Create(project); if (qtPro == null) { return; } FakeFilter ts = Filters.TranslationFiles(); VCFilter tsFilter = qtPro.FindFilterFromGuid(ts.UniqueIdentifier); if (tsFilter == null) { return; } IVCCollection files = tsFilter.Files as IVCCollection; foreach (VCFile file in files) { VCFile vcFile = file as VCFile; if (HelperFunctions.IsTranslationFile(vcFile)) { if (!RunlUpdate(vcFile, project)) { return; } } } }
public static void CreateNewTranslationFile(EnvDTE.Project project) { if (project == null) { return; } AddTranslationDialog transDlg = new AddTranslationDialog(project); if (transDlg.ShowDialog() == DialogResult.OK) { try { QtProject qtPro = QtProject.Create(project); VCFile file = qtPro.AddFileInFilter(Filters.TranslationFiles(), transDlg.TranslationFile, true); Translation.RunlUpdate(file, project); } catch (QtVSException e) { Messages.DisplayErrorMessage(e.Message); } catch (System.Exception ex) { Messages.DisplayErrorMessage(ex.Message); } } }
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 static bool SolutionToQtMsBuild() { var solution = Vsix.Instance.Dte.Solution; if (solution == null) { return(ErrorMessage(string.Format(SR.GetString("ErrorConvertingProject"), ""))); } List <EnvDTE.Project> projects = new List <EnvDTE.Project>(); var allProjects = solution.Projects; if (allProjects.Count == 0) { return(WarningMessage(SR.GetString("NoProjectsToConvert"))); } foreach (EnvDTE.Project project in allProjects) { if ((HelperFunctions.IsQtProject(project) || HelperFunctions.IsQMakeProject(project)) && !QtProject.IsQtMsBuildEnabled(project)) { projects.Add(project); } } if (projects.Count == 0) { return(WarningMessage(SR.GetString("NoProjectsToConvert"))); } if (MessageBox.Show( SR.GetString("ConvertAllConfirmation"), SR.GetString("ConvertTitle"), MessageBoxButtons.YesNo) != DialogResult.Yes) { return(WarningMessage(SR.GetString("CancelConvertingProject"))); } if (projects.Where(project => project.IsDirty).Any()) { if (MessageBox.Show( SR.GetString("ConvertSaveConfirmation"), SR.GetString("ConvertTitle"), MessageBoxButtons.YesNo) != DialogResult.Yes) { return(WarningMessage(SR.GetString("CancelConvertingProject"))); } } foreach (var project in projects) { if (!ProjectToQtMsBuild(project, false)) { return(false); } } return(true); }
public void SetProject(Project pro) { project = pro; qtProject = QtProject.Create(project); InitModules(); qtSettings = new ProjectQtSettings(project); OptionsPropertyGrid.SelectedObject = qtSettings; }
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 (oldQtVersion != newQtVersion) { var newProjectCreated = false; var versionChanged = qtPro.ChangeQtVersion(oldQtVersion, newQtVersion, ref newProjectCreated); if (versionChanged && newProjectCreated) { project = qtPro.Project; } } }
private static void AddLibraries(Project project, ProFileOption option, string paths, string deps) { if (QtProject.GetFormatVersion(project) < Resources.qtMinFormatVersion_ClProperties) { return; } var versionManager = QtVersionManager.The(); var qtDir = versionManager.GetInstallPath(project); if (qtDir == null) { qtDir = Environment.GetEnvironmentVariable("QTDIR"); } if (qtDir == null) { qtDir = ""; } qtDir = HelperFunctions.NormalizeRelativeFilePath(qtDir); ThreadHelper.ThrowIfNotOnUIThread(); if (paths != null) { foreach (var s in paths.Split(';', ',')) { var d = HelperFunctions.NormalizeRelativeFilePath(s); if (!d.StartsWith("$(qtdir)\\lib", StringComparison.OrdinalIgnoreCase) && !d.StartsWith(qtDir + "\\lib", StringComparison.OrdinalIgnoreCase)) { if (HelperFunctions.IsAbsoluteFilePath(d)) { d = HelperFunctions.GetRelativePath(project.FullName, d); } if (!HelperFunctions.IsAbsoluteFilePath(d)) { option.List.Add("-L\"" + HelperFunctions.ChangePathFormat(d) + "\""); } } } } if (deps != null) { foreach (var d in deps.Split(' ')) { if (d.Length > 0 && !d.StartsWith("$(qtdir)\\lib", StringComparison.OrdinalIgnoreCase) && !d.StartsWith(qtDir + "\\lib", StringComparison.OrdinalIgnoreCase) && !d.StartsWith("qt", StringComparison.OrdinalIgnoreCase) && !d.StartsWith(".\\qt", StringComparison.OrdinalIgnoreCase) && d != ".") { option.List.Add("-l" + HelperFunctions.ChangePathFormat(d).Replace(".lib", "")); } } } }
public void UseSelectedProject(EnvDTE.DTE app) { pro = HelperFunctions.GetSelectedQtProject(app); if (pro == null) { throw new QtVSException("Can't find a selected project"); } qtPro = QtProject.Create(pro); }
public void OnBuildProjConfigBegin(string projectName, string projectConfig, string platform, string solutionConfig) { if (currentBuildAction != vsBuildAction.vsBuildActionBuild && currentBuildAction != vsBuildAction.vsBuildActionRebuildAll) { return; // Don't do anything, if we're not building. } Project project = null; foreach (var p in HelperFunctions.ProjectsInSolution(dte)) { if (p.UniqueName == projectName) { project = p; break; } } if (project == null || !HelperFunctions.IsQtProject(project)) { return; } if (QtProject.GetFormatVersion(project) >= Resources.qtMinFormatVersion_Settings) { return; } var qtpro = QtProject.Create(project); var versionManager = QtVersionManager.The(); var qtVersion = versionManager.GetProjectQtVersion(project, platform); if (qtVersion == null) { Messages.DisplayCriticalErrorMessage(SR.GetString("ProjectQtVersionNotFoundError", projectName, projectConfig, platform)); dte.ExecuteCommand("Build.Cancel", ""); return; } if (!QtVSIPSettings.GetDisableAutoMocStepsUpdate()) { if (qtpro.ConfigurationRowNamesChanged) { qtpro.UpdateMocSteps(QtVSIPSettings.GetMocDirectory(project)); } } // Solution config is given to function to get QTDIR property // set correctly also during batch build qtpro.SetQtEnvironment(qtVersion, solutionConfig, true); if (QtVSIPSettings.GetLUpdateOnBuild(project)) { Translation.RunlUpdate(project); } }
private string AddProjectItemUi(string location) { var uiFile = Path.GetTempFileName(); using (var tmp = new StreamWriter(uiFile)) { tmp.Write( "<UI version=\"4.0\" >\r\n" + " <class>%CLASS%</class>\r\n" + " <widget class=\"%BASECLASS%\" name=\"%CLASS%\" >\r\n" + " <property name=\"objectName\" >\r\n" + " <string notr=\"true\">%CLASS%</string>\r\n" + " </property>\r\n" + " <property name=\"geometry\" >\r\n" + " <rect>\r\n" + " <x>0</x>\r\n" + " <y>0</y>\r\n" + " <width>400</width>\r\n" + " <height>300</height>\r\n" + " </rect>\r\n" + " </property>\r\n" + " <property name=\"windowTitle\" >\r\n" + " <string>%CLASS%</string>\r\n" + " </property>%CENTRAL_WIDGET%\r\n" + " </widget>\r\n" + " <layoutDefault spacing=\"6\" margin=\"11\" />\r\n" + " <pixmapfunction></pixmapfunction>\r\n" + " <resources/>\r\n" + " <connections/>\r\n" + "</UI>\r\n"); } uiFile = QtProject.CopyFileToFolder(uiFile, location, data.UiFile); QtProject.ReplaceTokenInFile(uiFile, "%CLASS%", data.ClassName); QtProject.ReplaceTokenInFile(uiFile, "%BASECLASS%", data.BaseClass); if (data.BaseClass == "QMainWindow") { QtProject.ReplaceTokenInFile(uiFile, "%CENTRAL_WIDGET%", "\r\n <widget class=\"QMenuBar\" name=\"menuBar\" />" + "\r\n <widget class=\"QToolBar\" name=\"mainToolBar\" />" + "\r\n <widget class=\"QWidget\" name=\"centralWidget\" />" + "\r\n <widget class=\"QStatusBar\" name=\"statusBar\" />"); } else if (data.BaseClass == "QDockWidget") { QtProject.ReplaceTokenInFile(uiFile, "%CENTRAL_WIDGET%", "\r\n <widget class=\"QWidget\" name=\"widget\" />"); } else { QtProject.ReplaceTokenInFile(uiFile, "%CENTRAL_WIDGET%", string.Empty); } return(uiFile); }
public static bool ToolsAvailable(EnvDTE.Project project) { if (QtProject.GetPropertyValue(project, "ApplicationType") == "Linux") { return(true); } var qtToolsPath = QtProject.GetPropertyValue(project, "QtToolsPath"); return(File.Exists(Path.Combine(qtToolsPath, "lupdate.exe")) && File.Exists(Path.Combine(qtToolsPath, "lrelease.exe"))); }
void debugStartWithoutDebuggingEvents_BeforeExecute(string Guid, int ID, object CustomIn, object CustomOut, ref bool CancelDefault) { EnvDTE.Project selectedProject = HelperFunctions.GetSelectedQtProject(dte); if (selectedProject != null) { QtProject qtProject = QtProject.Create(selectedProject); if (qtProject != null) { qtProject.SetQtEnvironment(); } } }
void ProjectItemsEvents_ItemRemoved(ProjectItem ProjectItem) { var pro = HelperFunctions.GetSelectedQtProject(Vsix.Instance.Dte); if (pro == null) { return; } var qtPro = QtProject.Create(pro); qtPro.RemoveGeneratedFiles(ProjectItem.Name); }
void ProjectItemsEvents_ItemRemoved(ProjectItem ProjectItem) { Project pro = HelperFunctions.GetSelectedQtProject(VSPackage.dte); if (pro == null) { return; } QtProject qtPro = QtProject.Create(pro); qtPro.RemoveGeneratedFiles(ProjectItem.Name); }
private static void ApplyPostImportSteps(QtProject qtProject) { qtProject.RemoveResFilesFromGeneratedFilesFilter(); qtProject.TranslateFilterNames(); // 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 static void ReplaceNamespaceToken(string file, string nsBegin, string nsEnd) { if (!string.IsNullOrEmpty(nsBegin)) { nsBegin += System.Environment.NewLine; } QtProject.ReplaceTokenInFile(file, "%NAMESPACE_BEGIN%", nsBegin); if (!string.IsNullOrEmpty(nsEnd)) { nsEnd = System.Environment.NewLine + nsEnd; } QtProject.ReplaceTokenInFile(file, "%NAMESPACE_END%", nsEnd); }
private void changeSolutionQtVersion(object sender, EventArgs e) { var manager = QtVersionManager.The(); if (formChangeQtVersion == null) { formChangeQtVersion = new FormChangeQtVersion(); } formChangeQtVersion.UpdateContent(ChangeFor.Solution); if (formChangeQtVersion.ShowDialog() == DialogResult.OK) { var newQtVersion = formChangeQtVersion.GetSelectedQtVersion(); if (newQtVersion != null) { string currentPlatform = null; try { //SolutionConfiguration config = VSPackage.dte.Solution.SolutionBuild.ActiveConfiguration; //SolutionConfiguration2 config2 = config as SolutionConfiguration2; //currentPlatform = config2.PlatformName; Project prj = VSPackage.dte.Solution.Projects.Item(1); Configuration config = prj.ConfigurationManager.ActiveConfiguration; currentPlatform = config.PlatformName; } catch { } if (string.IsNullOrEmpty(currentPlatform)) { return; } foreach (var project in HelperFunctions.ProjectsInSolution(VSPackage.dte)) { if (HelperFunctions.IsQtProject(project)) { string OldQtVersion = manager.GetProjectQtVersion(project, currentPlatform); if (OldQtVersion == null) { OldQtVersion = manager.GetDefaultVersion(); } var qtProject = QtProject.Create(project); var newProjectCreated = false; qtProject.ChangeQtVersion(OldQtVersion, newQtVersion, ref newProjectCreated); } } manager.SaveSolutionQtVersion(VSPackage.dte.Solution, newQtVersion); } } }
protected override void BeforeTemplateExpansion() { Parameter[NewClass.SourceFileName] = WizardData.ClassSourceFile; Parameter[NewClass.HeaderFileName] = WizardData.ClassHeaderFile; var array = WizardData.ClassName.Split(new[] { "::" }, StringSplitOptions.RemoveEmptyEntries); var className = array.LastOrDefault(); var baseClass = WizardData.BaseClass; Parameter[NewQtItem.ClassName] = className; Parameter[NewQtItem.BaseClass] = baseClass; var include = new StringBuilder(); var pro = HelperFunctions.GetSelectedQtProject(Dte); if (pro != null) { var qtProject = QtProject.Create(pro); if (qtProject != null && qtProject.UsesPrecompiledHeaders()) { include.AppendLine(string.Format("#include \"{0}\"", qtProject .GetPrecompiledHeaderThrough())); } } include.AppendLine(string.Format("#include \"{0}\"", WizardData.ClassHeaderFile)); Parameter[NewQtItem.Include] = FormatParam(include); if (!string.IsNullOrEmpty(baseClass)) { Parameter[NewQtItem.QObject] = WizardData.InsertQObjectMacro ? "\r\n Q_OBJECT\r\n" : ""; Parameter[NewQtItem.BaseClassDecl] = " : public " + baseClass; Parameter[NewQtItem.Signature] = WizardData.ConstructorSignature; Parameter[NewQtItem.BaseClassInclude] = "#include <" + baseClass + ">\r\n\r\n"; Parameter[NewQtItem.BaseClassWithParent] = string.IsNullOrEmpty(WizardData .ConstructorSignature) ? "" : "\r\n : " + baseClass + "(parent)"; } string nsBegin = string.Empty, nsEnd = string.Empty; for (var i = 0; i < array.Length - 1; ++i) { nsBegin += "namespace " + array[i] + " {\r\n"; nsEnd = "} // namespace " + array[i] + "\r\n" + nsEnd; } Parameter[Meta.NamespaceBegin] = nsBegin; Parameter[Meta.NamespaceEnd] = nsEnd; }
void ProjectItemsEvents_ItemRemoved(ProjectItem ProjectItem) { ThreadHelper.ThrowIfNotOnUIThread(); var pro = HelperFunctions.GetSelectedQtProject(QtVsToolsPackage.Instance.Dte); if (pro == null) { return; } var qtPro = QtProject.Create(pro); qtPro.RemoveGeneratedFiles(ProjectItem.Name); }
void debugStartWithoutDebuggingEvents_BeforeExecute(string Guid, int ID, object CustomIn, object CustomOut, ref bool CancelDefault) { var selectedProject = HelperFunctions.GetSelectedQtProject(dte); if (selectedProject != null) { if (QtProject.GetFormatVersion(selectedProject) >= Resources.qtMinFormatVersion_Settings) { return; } var qtProject = QtProject.Create(selectedProject); if (qtProject != null) { qtProject.SetQtEnvironment(); } } }
void ProjectItemsEvents_ItemRenamed(ProjectItem ProjectItem, string OldName) { if (OldName == null) { return; } var pro = HelperFunctions.GetSelectedQtProject(Vsix.Instance.Dte); if (pro == null) { return; } var qtPro = QtProject.Create(pro); qtPro.RemoveGeneratedFiles(OldName); ProjectItemsEvents_ItemAdded(ProjectItem); }
void ProjectItemsEvents_ItemRenamed(ProjectItem ProjectItem, string OldName) { if (OldName == null) { return; } Project pro = HelperFunctions.GetSelectedQtProject(VSPackage.dte); if (pro == null) { return; } QtProject qtPro = QtProject.Create(pro); qtPro.RemoveGeneratedFiles(OldName); ProjectItemsEvents_ItemAdded(ProjectItem); }
private void ImportSolution(FileInfo mainInfo, string qtVersion) { ThreadHelper.ThrowIfNotOnUIThread(); var versionInfo = QtVersionManager.The().GetVersionInfo(qtVersion); var VCInfo = RunQmake(mainInfo, ".sln", true, versionInfo); if (null == VCInfo) { return; } ImportQMakeSolution(VCInfo, versionInfo); try { if (CheckQtVersion(versionInfo)) { dteObject.Solution.Open(VCInfo.FullName); if (qtVersion != null) { QtVersionManager.The().SaveSolutionQtVersion(dteObject.Solution, qtVersion); foreach (var prj in HelperFunctions.ProjectsInSolution(dteObject)) { QtVersionManager.The().SaveProjectQtVersion(prj, qtVersion); var qtPro = QtProject.Create(prj); qtPro.SetQtEnvironment(); ApplyPostImportSteps(qtPro); } } } Messages.Print("--- (Import): Finished opening " + VCInfo.Name); } catch (Exception e) { Messages.DisplayCriticalErrorMessage(e); } }