private void CreateWinCEProject(EnvDTE.DTE app, string proName, string proPath, string slnName, bool exclusive, string qtVersion, uint projType, bool usePrecompiledHeaders) { FakeFilter[] filters = { Filters.SourceFiles(), Filters.HeaderFiles(), Filters.FormFiles(), Filters.ResourceFiles(), Filters.GeneratedFiles() }; QtVersionManager versionManager = QtVersionManager.The(); if (qtVersion == null) { qtVersion = versionManager.GetDefaultWinCEVersion(); } VersionInformation qtVersionInfo = versionManager.GetVersionInfo(qtVersion); string platformName = null; try { platformName = qtVersionInfo.GetVSPlatformName(); } catch { // fallback to some standard platform... platformName = "Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"; } CreateProject(app, proName, proPath, slnName, exclusive, filters, qtVersion, platformName); qtPro.WriteProjectBasicConfigurations(projType, usePrecompiledHeaders, qtVersionInfo); qtPro.AddModule(QtModule.Main); }
static public QtVersionManager The() { if (instance == null) { instance = new QtVersionManager(); } return(instance); }
static public QtVersionManager The(string platform = null) { if (instance == null) { instance = new QtVersionManager(); } if (platform != null) { instance.strPlatform = platform; } return(instance); }
public ProjectQtSettings(EnvDTE.Project proj) { versionManager = QtVersionManager.The(); project = proj; newMocDir = oldMocDir = QtVSIPSettings.GetMocDirectory(project); newMocOptions = oldMocOptions= QtVSIPSettings.GetMocOptions(project); newRccDir = oldRccDir = QtVSIPSettings.GetRccDirectory(project); newUicDir = oldUicDir = QtVSIPSettings.GetUicDirectory(project); newLUpdateOnBuild = oldLUpdateOnBuild = QtVSIPSettings.GetLUpdateOnBuild(project); newLUpdateOptions = oldLUpdateOptions = QtVSIPSettings.GetLUpdateOptions(project); newLReleaseOptions = oldLReleaseOptions = QtVSIPSettings.GetLReleaseOptions(project); newQtVersion = oldQtVersion = versionManager.GetProjectQtVersion(project); }
private string GetWinCEPlatformName(string qtVersion, QtVersionManager versionManager) { VersionInformation vi = versionManager.GetVersionInfo(qtVersion); try { return(vi.GetVSPlatformName()); } catch { return("(unknown platform)"); } }
public FormVSQtSettings() { InitializeComponent(); foreach (var control in Controls) { ComboBox comboBox = control as ComboBox; if (comboBox != null) { comboBox.Resize += (sender, e) => { if (!comboBox.Focused) comboBox.SelectionLength = 0; }; } } versionManager = QtVersionManager.The(); this.Text = SR.GetString("VSQtOptionsButtonText"); listView.Columns.Add(SR.GetString("BuildOptionsPage_Name"), 100, HorizontalAlignment.Left); listView.Columns.Add(SR.GetString("BuildOptionsPage_Path"), 260, HorizontalAlignment.Left); addButton.Text = SR.GetString(SR.Add); deleteButton.Text = SR.GetString(SR.Delete); labelX86.Text = SR.GetString("BuildOptionsPage_DefaultQtX86Version"); labelX64.Text = SR.GetString("BuildOptionsPage_DefaultQtX64Version"); labelWinCE.Text = SR.GetString("BuildOptionsPage_WinCEQtVersion"); okButton.Text = SR.GetString("OK"); cancelButton.Text = SR.GetString("Cancel"); tabControl1.TabPages[0].Text = SR.GetString("BuildOptionsPage_Title"); tabControl1.TabPages[1].Text = SR.GetString("QtDefaultSettings"); #if !ENABLE_WINCE // Just hide the Windows CE specific combobox and occupy the released screen space. labelWinCE.Hide(); winCECombo.Hide(); tableLayoutPanel2.RowCount -= 1; tableLayoutPanel2.RowStyles.RemoveAt(tableLayoutPanel2.RowCount); #endif SetupVersionComboBox(defaultX86Combo, null, new VIBoolPredicate(isDesktopQt)); SetupVersionComboBox(defaultX64Combo, null, new VIBoolPredicate(isDesktopQt)); SetupWinCEVersionComboBox(null); UpdateListBox(); vsQtSettings = new VSQtSettings(); optionsPropertyGrid.SelectedObject = vsQtSettings; this.KeyPress += new KeyPressEventHandler(this.FormQtVersions_KeyPress); this.Shown += new EventHandler(FormQtVersions_Shown); }
/// <summary> /// Returns the Windows CE Qt builds which are available. /// </summary> /// <returns>List of string</returns> public ArrayList GetQtWinCEVersions(EnvDTE.DTE dte) { ArrayList list = new ArrayList(); QtVersionManager vm = QtVersionManager.The(); foreach (string qtVersion in vm.GetVersions()) { VersionInformation vi = vm.GetVersionInfo(qtVersion); string platformName = GetWinCEPlatformName(qtVersion, vm); if (vi.IsWinCEVersion() && HelperFunctions.IsPlatformAvailable(dte, platformName)) { list.Add(qtVersion); } } return(list); }
public FormVSQtSettings() { InitializeComponent(); versionManager = QtVersionManager.The(); this.Text = SR.GetString("VSQtOptionsButtonText"); listView.Columns.Add(SR.GetString("BuildOptionsPage_Name"), 100, HorizontalAlignment.Left); listView.Columns.Add(SR.GetString("BuildOptionsPage_Path"), 180, HorizontalAlignment.Left); addButton.Text = SR.GetString(SR.Add); deleteButton.Text = SR.GetString(SR.Delete); label2.Text = SR.GetString("BuildOptionsPage_DefaultQtVersion"); label3.Text = SR.GetString("BuildOptionsPage_WinCEQtVersion"); okButton.Text = SR.GetString("OK"); cancelButton.Text = SR.GetString("Cancel"); tabControl1.TabPages[0].Text = SR.GetString("BuildOptionsPage_Title"); tabControl1.TabPages[1].Text = SR.GetString("QtDefaultSettings"); #if !ENABLE_WINCE // Just hide the Windows CE specific combobox and occupy the released screen space. int distance = label3.Top - label2.Top; label3.Hide(); winCECombo.Hide(); label2.Top = label3.Top; defaultCombo.Top = winCECombo.Top; System.Drawing.Rectangle rect = listView.Bounds; rect.Height += distance; listView.Bounds = rect; #endif SetupDefaultVersionComboBox(null); SetupWinCEVersionComboBox(null); UpdateListBox(); FormBorderStyle = FormBorderStyle.FixedDialog; vsQtSettings = new VSQtSettings(); optionsPropertyGrid.SelectedObject = vsQtSettings; this.KeyPress += new KeyPressEventHandler(this.FormQtVersions_KeyPress); this.Shown += new EventHandler(FormQtVersions_Shown); }
/// <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 QtVSException("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 = "Qt5" + 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 ImportSolution(FileInfo mainInfo, string qtVersion) { var versionInfo = QtVersionManager.The().GetVersionInfo(qtVersion); var VCInfo = RunQmake(mainInfo, ".sln", true, versionInfo); if (null == VCInfo) { return; } ReplaceAbsoluteQtDirInSolution(VCInfo); try { if (CheckQtVersion(versionInfo)) { dteObject.Solution.Open(VCInfo.FullName); if (qtVersion != null) { QtVersionManager.The().SaveSolutionQtVersion(dteObject.Solution, qtVersion); foreach (Project prj in HelperFunctions.ProjectsInSolution(dteObject)) { QtVersionManager.The().SaveProjectQtVersion(prj, qtVersion); QtProject qtPro = QtProject.Create(prj); qtPro.SetQtEnvironment(); ApplyPostImportSteps(qtPro); } } } Messages.PaneMessage(dteObject, "--- (Import): Finished opening " + VCInfo.Name); } catch (Exception e) { Messages.DisplayCriticalErrorMessage(e); } }
public void ImportProject(FileInfo mainInfo, string qtVersion) { VersionInformation versionInfo = QtVersionManager.The().GetVersionInfo(qtVersion); FileInfo VCInfo = RunQmake(mainInfo, projectFileExtension, false, versionInfo); if (null == VCInfo) { return; } ReplaceAbsoluteQtDirInProject(VCInfo); try { if (CheckQtVersion(versionInfo)) { // no need to add the project again if it's already there... if (!HelperFunctions.IsProjectInSolution(dteObject, VCInfo.FullName)) { try { dteObject.Solution.AddFromFile(VCInfo.FullName, false); } catch (Exception /*exception*/) { Messages.PaneMessage(dteObject, "--- (Import): Generated project could not be loaded."); Messages.PaneMessage(dteObject, "--- (Import): Please look in the output above for errors and warnings."); return; } Messages.PaneMessage(dteObject, "--- (Import): Added " + VCInfo.Name + " to Solution"); } else { Messages.PaneMessage(dteObject, "Project already in Solution"); } EnvDTE.Project pro = null; foreach (EnvDTE.Project p in HelperFunctions.ProjectsInSolution(dteObject)) { if (p.FullName.ToLower() == VCInfo.FullName.ToLower()) { pro = p; break; } } if (pro != null) { QtProject qtPro = QtProject.Create(pro); qtPro.SetQtEnvironment(); string platformName = versionInfo.GetVSPlatformName(); if (qtVersion != null) { QtVersionManager.The().SaveProjectQtVersion(pro, qtVersion, platformName); } if (!qtPro.SelectSolutionPlatform(platformName) || !qtPro.HasPlatform(platformName)) { bool newProject = false; qtPro.CreatePlatform("Win32", platformName, null, versionInfo, ref newProject); if (!qtPro.SelectSolutionPlatform(platformName)) { Messages.PaneMessage(dteObject, "Can't select the platform " + platformName + "."); } } // try to figure out if the project is a plugin project try { string activeConfig = pro.ConfigurationManager.ActiveConfiguration.ConfigurationName; VCConfiguration config = (VCConfiguration)((IVCCollection)qtPro.VCProject.Configurations).Item(activeConfig); if (config.ConfigurationType == ConfigurationTypes.typeDynamicLibrary) { CompilerToolWrapper compiler = CompilerToolWrapper.Create(config); VCLinkerTool linker = (VCLinkerTool)((IVCCollection)config.Tools).Item("VCLinkerTool"); if (compiler.GetPreprocessorDefinitions().IndexOf("QT_PLUGIN") > -1 && compiler.GetPreprocessorDefinitions().IndexOf("QDESIGNER_EXPORT_WIDGETS") > -1 && compiler.GetAdditionalIncludeDirectories().IndexOf("QtDesigner") > -1 && linker.AdditionalDependencies.IndexOf("QtDesigner") > -1) { qtPro.MarkAsDesignerPluginProject(); } } } catch (Exception) { } ApplyPostImportSteps(qtPro); } } } catch (Exception e) { Messages.DisplayCriticalErrorMessage(SR.GetString("ExportProject_ProjectOrSolutionCorrupt", e.ToString())); } }
public static QtVersionManager The() { if (instance == null) instance = new QtVersionManager(); return instance; }
private string GetWinCEPlatformName(string qtVersion, QtVersionManager versionManager) { VersionInformation vi = versionManager.GetVersionInfo(qtVersion); try { return vi.GetVSPlatformName(); } catch { return "(unknown platform)"; } }
static public QtVersionManager The() { return(instance = instance ?? new QtVersionManager()); }
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 = versionManager.GetDefaultVersion(); } if (qtVersion == null) { throw new QtVSException("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); if (platformName != "Win32") { qtPro.SelectSolutionPlatform(platformName); } versionManager.SaveProjectQtVersion(pro, qtVersion); qtPro.MarkAsQtProject("v1.0"); qtPro.AddDirectories(); if (!string.IsNullOrEmpty(slnName) && (exclusive == true)) { newSolution.SaveAs(solutionPath + "\\" + slnName + ".sln"); } }
public string GetWinCEPlatformName(string qtVersion) { return(GetWinCEPlatformName(qtVersion, QtVersionManager.The())); }
public string GetDefaultWinCEVersion() { QtVersionManager vm = QtVersionManager.The(); return(vm.GetDefaultWinCEVersion()); }
public VersionConverter() { versionManager = QtVersionManager.The(); }
public static QtVersionManager The(string platform = null) { if (instance == null) instance = new QtVersionManager(); if (platform != null) instance.strPlatform = platform; return instance; }