private void UpdateListBox(string defaultQtVersionDir)
 {
     listView.Items.Clear();
     foreach (string version in versionManager.GetVersions())
     {
         string path = null;
         if (defaultQtVersionDir != null && version == "$(DefaultQtVersion)")
         {
             path = defaultQtVersionDir;
         }
         else
         {
             path = versionManager.GetInstallPath(version);
         }
         if (path == null && version != "$(QTDIR)")
         {
             continue;
         }
         ListViewItem itm = new ListViewItem();
         itm.Tag  = version;
         itm.Text = version;
         itm.SubItems.Add(path);
         listView.Items.Add(itm);
     }
 }
示例#2
0
 public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
 {
     string[] versions = versionManager.GetVersions();
     Array.Resize(ref versions, versions.Length + 1);
     versions[versions.Length - 1] = "$(DefaultQtVersion)";
     return(new StandardValuesCollection(versions));
 }
        public QtVersionDialog(EnvDTE.DTE dte)
        {
            dteObj = dte;
            QtVersionManager vM = QtVersionManager.The();

            InitializeComponent();

            this.cancelButton.Text = SR.GetString(SR.Cancel);
            this.okButton.Text     = SR.GetString(SR.OK);
            this.groupBox1.Text    = SR.GetString("QtVersionDialog_BoxTitle");
            this.Text = SR.GetString("QtVersionDialog_Title");

            this.versionComboBox.Items.AddRange(vM.GetVersions());
            if (this.versionComboBox.Items.Count > 0)
            {
                string defVersion = vM.GetSolutionQtVersion(dteObj.Solution);
                if (defVersion != null && defVersion.Length > 0)
                {
                    this.versionComboBox.Text = defVersion;
                }
                else if (dte.Solution != null && HelperFunctions.ProjectsInSolution(dte) != null)
                {
                    IEnumerator prjEnum = HelperFunctions.ProjectsInSolution(dte).GetEnumerator();
                    prjEnum.Reset();
                    if (prjEnum.MoveNext())
                    {
                        EnvDTE.Project prj = prjEnum.Current as EnvDTE.Project;
                        defVersion = vM.GetProjectQtVersion(prj);
                    }
                }
                if (defVersion != null && defVersion.Length > 0)
                {
                    this.versionComboBox.Text = defVersion;
                }
                else
                {
                    this.versionComboBox.Text = (string)this.versionComboBox.Items[0];
                }
            }

            //if (SR.LanguageName == "ja")
            //{
            //    this.cancelButton.Location = new System.Drawing.Point(224, 72);
            //    this.cancelButton.Size = new Size(80, 22);
            //    this.okButton.Location = new System.Drawing.Point(138, 72);
            //    this.okButton.Size = new Size(80, 22);
            //}
            this.KeyPress += new KeyPressEventHandler(this.QtVersionDialog_KeyPress);
        }
        public void UpdateContent(ChangeFor change)
        {
            lbQtVersions.Items.Clear();
            QtVersionManager vm = QtVersionManager.The();

            foreach (string versionName in vm.GetVersions())
            {
                lbQtVersions.Items.Add(versionName);
            }
            lbQtVersions.Items.Add("$(DefaultQtVersion)");
            string qtVer = null;

            if (change == ChangeFor.Solution)
            {
                qtVer = vm.GetSolutionQtVersion(Connect._applicationObject.Solution);
                if (qtVer == null)
                {
                    qtVer = vm.GetDefaultVersion();
                }
                if (qtVer != null)
                {
                    lbQtVersions.SelectedItem = qtVer;
                }
                this.Text = SR.GetString("SolutionQtVersion");
            }
            else
            {
                Project pro = HelperFunctions.GetSelectedProject(Connect._applicationObject);
                qtVer = vm.GetProjectQtVersion(pro);
                if (qtVer == null)
                {
                    qtVer = vm.GetDefaultVersion();
                }
                if (qtVer != null)
                {
                    lbQtVersions.SelectedItem = qtVer;
                }
                this.Text = SR.GetString("ProjectQtVersion");
            }
        }