Пример #1
0
        public static void ImportPriFile(EnvDTE.Project project, string fileName)
        {
            VCProject vcproj;

            if (!HelperFunctions.IsQtProject(project))
            {
                return;
            }

            vcproj = project.Object as VCProject;
            if (vcproj == null)
            {
                return;
            }

            QtVersionManager vm    = QtVersionManager.The();
            string           qtDir = vm.GetInstallPath(vm.GetDefaultVersion());

            if (qtDir == null)
            {
                Messages.DisplayErrorMessage(SR.GetString("CannotFindQMake"));
                return;
            }

            FileInfo priFileInfo = new FileInfo(fileName);

            QMakeWrapper qmake = new QMakeWrapper();

            qmake.setQtDir(qtDir);
            if (qmake.readFile(priFileInfo.FullName))
            {
                bool          flat      = qmake.isFlat();
                List <string> priFiles  = ResolveFilesFromQMake(qmake.sourceFiles(), project, priFileInfo.DirectoryName);
                List <string> projFiles = HelperFunctions.GetProjectFiles(project, FilesToList.FL_CppFiles);
                projFiles = ProjectExporter.ConvertFilesToFullPath(projFiles, vcproj.ProjectDirectory);
                ProjectExporter.SyncIncludeFiles(vcproj, priFiles, projFiles, project.DTE, flat, Filters.SourceFiles());

                priFiles  = ResolveFilesFromQMake(qmake.headerFiles(), project, priFileInfo.DirectoryName);
                projFiles = HelperFunctions.GetProjectFiles(project, FilesToList.FL_HFiles);
                projFiles = ProjectExporter.ConvertFilesToFullPath(projFiles, vcproj.ProjectDirectory);
                ProjectExporter.SyncIncludeFiles(vcproj, priFiles, projFiles, project.DTE, flat, Filters.HeaderFiles());

                priFiles  = ResolveFilesFromQMake(qmake.formFiles(), project, priFileInfo.DirectoryName);
                projFiles = HelperFunctions.GetProjectFiles(project, FilesToList.FL_UiFiles);
                projFiles = ProjectExporter.ConvertFilesToFullPath(projFiles, vcproj.ProjectDirectory);
                ProjectExporter.SyncIncludeFiles(vcproj, priFiles, projFiles, project.DTE, flat, Filters.FormFiles());

                priFiles  = ResolveFilesFromQMake(qmake.resourceFiles(), project, priFileInfo.DirectoryName);
                projFiles = HelperFunctions.GetProjectFiles(project, FilesToList.FL_Resources);
                projFiles = ProjectExporter.ConvertFilesToFullPath(projFiles, vcproj.ProjectDirectory);
                ProjectExporter.SyncIncludeFiles(vcproj, priFiles, projFiles, project.DTE, flat, Filters.ResourceFiles());
            }
            else
            {
                Messages.PaneMessage(project.DTE, "--- (Importing .pri file) file: "
                                     + priFileInfo + " could not be read.");
            }
        }
Пример #2
0
        public static void ImportPriFile(EnvDTE.Project project, string fileName)
        {
            VCProject vcproj;

            if (!HelperFunctions.IsQtProject(project))
                return;

            vcproj = project.Object as VCProject;
            if (vcproj == null)
                return;

            QtVersionManager vm = QtVersionManager.The();
            string qtDir = vm.GetInstallPath(vm.GetDefaultVersion());
            if (qtDir == null)
            {
                Messages.DisplayErrorMessage(SR.GetString("CannotFindQMake"));
                return;
            }

            FileInfo priFileInfo = new FileInfo(fileName);

            QMakeWrapper qmake = new QMakeWrapper();
            qmake.setQtDir(qtDir);
            if (qmake.readFile(priFileInfo.FullName))
            {
                bool flat = qmake.isFlat();
                List<string> priFiles = ResolveFilesFromQMake(qmake.sourceFiles(), project, priFileInfo.DirectoryName);
                List<string> projFiles = HelperFunctions.GetProjectFiles(project, FilesToList.FL_CppFiles);
                projFiles = ProjectExporter.ConvertFilesToFullPath(projFiles, vcproj.ProjectDirectory);
                ProjectExporter.SyncIncludeFiles(vcproj, priFiles, projFiles, project.DTE, flat, Filters.SourceFiles());

                priFiles = ResolveFilesFromQMake(qmake.headerFiles(), project, priFileInfo.DirectoryName);
                projFiles = HelperFunctions.GetProjectFiles(project, FilesToList.FL_HFiles);
                projFiles = ProjectExporter.ConvertFilesToFullPath(projFiles, vcproj.ProjectDirectory);
                ProjectExporter.SyncIncludeFiles(vcproj, priFiles, projFiles, project.DTE, flat, Filters.HeaderFiles());

                priFiles = ResolveFilesFromQMake(qmake.formFiles(), project, priFileInfo.DirectoryName);
                projFiles = HelperFunctions.GetProjectFiles(project, FilesToList.FL_UiFiles);
                projFiles = ProjectExporter.ConvertFilesToFullPath(projFiles, vcproj.ProjectDirectory);
                ProjectExporter.SyncIncludeFiles(vcproj, priFiles, projFiles, project.DTE, flat, Filters.FormFiles());

                priFiles = ResolveFilesFromQMake(qmake.resourceFiles(), project, priFileInfo.DirectoryName);
                projFiles = HelperFunctions.GetProjectFiles(project, FilesToList.FL_Resources);
                projFiles = ProjectExporter.ConvertFilesToFullPath(projFiles, vcproj.ProjectDirectory);
                ProjectExporter.SyncIncludeFiles(vcproj, priFiles, projFiles, project.DTE, flat, Filters.ResourceFiles());
            }
            else
            {
                Messages.PaneMessage(project.DTE, "--- (Importing .pri file) file: "
                    + priFileInfo + " could not be read.");
            }
        }