Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        private string GetWinCEPlatformName(string qtVersion, QtVersionManager versionManager)
        {
            VersionInformation vi = versionManager.GetVersionInfo(qtVersion);

            try
            {
                return(vi.GetVSPlatformName());
            }
            catch
            {
                return("(unknown platform)");
            }
        }
Esempio n. 3
0
        private static void SetTargetMachine(VCLinkerTool linker, VersionInformation versionInfo)
        {
            String qMakeLFlagsWindows = versionInfo.GetQMakeConfEntry("QMAKE_LFLAGS_WINDOWS");
            Regex rex = new Regex("/MACHINE:(\\S+)");
            Match match = rex.Match(qMakeLFlagsWindows);
            if (match.Success)
            {
                linker.TargetMachine = HelperFunctions.TranslateMachineType(match.Groups[1].Value);
            }
            else
            {
                string platformName = versionInfo.GetVSPlatformName();
                if (platformName == "Win32")
                    linker.TargetMachine = machineTypeOption.machineX86;
                else if (platformName == "x64")
                    linker.TargetMachine = machineTypeOption.machineAMD64;
                else
                    linker.TargetMachine = machineTypeOption.machineNotSet;
            }

            String subsystemOption = "";
            String linkerOptions = linker.AdditionalOptions;
            if (linkerOptions == null)
                linkerOptions = "";

            rex = new Regex("(/SUBSYSTEM:\\S+)");
            match = rex.Match(qMakeLFlagsWindows);
            if (match.Success)
                subsystemOption = match.Groups[1].Value;

            match = rex.Match(linkerOptions);
            if (match.Success)
            {
                linkerOptions = rex.Replace(linkerOptions, subsystemOption);
            }
            else
            {
                if (linkerOptions.Length > 0)
                    linkerOptions += " ";
                linkerOptions += subsystemOption;
            }
            linker.AdditionalOptions = linkerOptions;
        }
Esempio n. 4
0
        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()));
            }
        }
        private void okButton_Click(object sender, EventArgs e)
        {
            QtVersionManager vm = QtVersionManager.The();
            VersionInformation versionInfo = null;
            try
            {
                versionInfo = new VersionInformation(pathBox.Text);
            }
            catch (Exception exception)
            {
                if (nameBox.Text == "$(QTDIR)")
                {
                    string defaultVersion = vm.GetDefaultVersion();
                    versionInfo = vm.GetVersionInfo(defaultVersion);
                }
                else
                {
                    Messages.DisplayErrorMessage(exception.Message);
                    return;
                }
            }

            if (versionInfo.IsWinCEVersion())
            {
                // check whether we have an SDK installed for this platform
                string platformName = versionInfo.GetVSPlatformName();
                if (!HelperFunctions.IsPlatformAvailable(Connect._applicationObject, platformName))
                {
                    MessageBox.Show(SR.GetString("AddQtVersionDialog_PlatformNotFoundError", platformName),
                                    null, MessageBoxButtons.OK,
                                    MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
                    return;
                }
            }

            string makefileGenerator = versionInfo.GetQMakeConfEntry("MAKEFILE_GENERATOR");
            if (makefileGenerator != "MSVC.NET" && makefileGenerator != "MSBUILD")
            {
                MessageBox.Show(SR.GetString("AddQtVersionDialog_IncorrectMakefileGenerator", makefileGenerator),
                                            null, MessageBoxButtons.OK,
                                            MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
                return;
            }
            vm.SaveVersion(nameBox.Text, pathBox.Text);
            DialogResult = DialogResult.OK;
            Close();
        }