Exemple #1
0
        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);
                }
            }
        }
Exemple #2
0
        public void SaveSettings()
        {
            QtVSIPSettings.SaveMocDirectory(newMocDir);
            QtVSIPSettings.SaveMocOptions(newMocOptions);
            QtVSIPSettings.SaveUicDirectory(newUicDir);
            QtVSIPSettings.SaveRccDirectory(newRccDir);
            QtVSIPSettings.SaveLUpdateOnBuild(newLUpdateOnBuild);
            QtVSIPSettings.SaveLUpdateOptions(newLUpdateOptions);
            QtVSIPSettings.SaveLReleaseOptions(newLReleaseOptions);
            QtVSIPSettings.SaveAskBeforeCheckoutFile(newAskBeforeCheckoutFile);
            QtVSIPSettings.SaveDisableCheckoutFiles(newDisableCheckoutFiles);
            QtVSIPSettings.SaveDisableAutoMocStepsUpdate(newDisableAutoMOCStepsUpdate);

            var settingsManager = new ShellSettingsManager(Vsix.Instance);
            var store           = settingsManager.GetWritableSettingsStore(SettingsScope.UserSettings);

#if VS2013
            store.CreateCollection(Statics.QmlClassifierPath);
            store.SetBoolean(Statics.QmlClassifierPath, Statics.QmlClassifierKey,
                             EnableQmlClassifier);
#else
            store.CreateCollection(Statics.QmlTextMatePath);
            store.SetBoolean(Statics.QmlTextMatePath, Statics.QmlTextMateKey, EnableQmlTextMate);
#endif
        }
        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;
                }
            }
        }
Exemple #4
0
 public void SaveSettings()
 {
     QtVSIPSettings.SaveMocDirectory(newMocDir);
     QtVSIPSettings.SaveMocOptions(newMocOptions);
     QtVSIPSettings.SaveUicDirectory(newUicDir);
     QtVSIPSettings.SaveRccDirectory(newRccDir);
     QtVSIPSettings.SaveLUpdateOnBuild(newLUpdateOnBuild);
     QtVSIPSettings.SaveLUpdateOptions(newLUpdateOptions);
     QtVSIPSettings.SaveLReleaseOptions(newLReleaseOptions);
     QtVSIPSettings.SaveAskBeforeCheckoutFile(newAskBeforeCheckoutFile);
     QtVSIPSettings.SaveDisableCheckoutFiles(newDisableCheckoutFiles);
     QtVSIPSettings.SaveDisableAutoMocStepsUpdate(newDisableAutoMOCStepsUpdate);
 }
Exemple #5
0
        public void ProjectFinishedGenerating(Project project)
        {
            var qtProject = QtProject.Create(project);

            QtVSIPSettings.SaveUicDirectory(project, null);
            QtVSIPSettings.SaveMocDirectory(project, null);
            QtVSIPSettings.SaveMocOptions(project, null);
            QtVSIPSettings.SaveRccDirectory(project, null);
            QtVSIPSettings.SaveLUpdateOnBuild(project);
            QtVSIPSettings.SaveLUpdateOptions(project, null);
            QtVSIPSettings.SaveLReleaseOptions(project, null);

            var vm        = QtVersionManager.The();
            var qtVersion = vm.GetDefaultVersion();
            var vi        = VersionInformation.Get(vm.GetInstallPath(qtVersion));

            if (vi.GetVSPlatformName() != "Win32")
            {
                qtProject.SelectSolutionPlatform(vi.GetVSPlatformName());
            }
            vm.SaveProjectQtVersion(project, qtVersion);

            qtProject.MarkAsQtProject("v1.0");
            qtProject.AddDirectories();

            var type = TemplateType.Application | TemplateType.ConsoleSystem;

            qtProject.WriteProjectBasicConfigurations(type, false);

            foreach (VCFile file in (IVCCollection)qtProject.VCProject.Files)
            {
                qtProject.AdjustWhitespace(file.FullPath);
            }

            qtProject.AddModule(QtModule.Main);
            foreach (var module in data.Modules)
            {
                qtProject.AddModule(QtModules.Instance.ModuleIdByName(module));
            }
            qtProject.SetQtEnvironment(qtVersion);
            qtProject.Finish(); // Collapses all project nodes.
        }
Exemple #6
0
        public void ProjectFinishedGenerating(Project project)
        {
            var qtProject = QtProject.Create(project);

            QtVSIPSettings.SaveUicDirectory(project, null);
            QtVSIPSettings.SaveMocDirectory(project, null);
            QtVSIPSettings.SaveMocOptions(project, null);
            QtVSIPSettings.SaveRccDirectory(project, null);
            QtVSIPSettings.SaveLUpdateOnBuild(project);
            QtVSIPSettings.SaveLUpdateOptions(project, null);
            QtVSIPSettings.SaveLReleaseOptions(project, null);

            var vm        = QtVersionManager.The();
            var qtVersion = vm.GetDefaultVersion();
            var vi        = VersionInformation.Get(vm.GetInstallPath(qtVersion));

            if (vi.GetVSPlatformName() != "Win32")
            {
                qtProject.SelectSolutionPlatform(vi.GetVSPlatformName());
            }
            vm.SaveProjectQtVersion(project, qtVersion);

            qtProject.MarkAsQtProject("v1.0");
            qtProject.AddDirectories();

            var type = TemplateType.Application | TemplateType.GUISystem;

            qtProject.WriteProjectBasicConfigurations(type, data.UsePrecompiledHeader);

            qtProject.AddModule(QtModule.Main);
            foreach (var module in data.Modules)
            {
                qtProject.AddModule(QtModules.Instance.ModuleIdByName(module));
            }

            var vcProject = qtProject.VCProject;
            var files     = vcProject.GetFilesWithItemType(@"None") as IVCCollection;

            foreach (var vcFile in files)
            {
                vcProject.RemoveFile(vcFile);
            }

            if (data.UsePrecompiledHeader)
            {
                qtProject.AddFileToProject(@"stdafx.cpp", Filters.SourceFiles());
                qtProject.AddFileToProject(@"stdafx.h", Filters.HeaderFiles());
            }

            qtProject.AddFileToProject(data.ClassSourceFile, Filters.SourceFiles());
            qtProject.AddFileToProject(data.ClassHeaderFile, Filters.HeaderFiles());
            qtProject.AddFileToProject(data.UiFile, Filters.FormFiles());
            var qrc = qtProject.CreateQrcFile(data.ClassName, data.QrcFile);

            qtProject.AddFileToProject(qrc, Filters.ResourceFiles());

            if (data.AddDefaultAppIcon)
            {
                try {
                    var icon = vcProject.ProjectDirectory + "\\" + vcProject.ItemName + ".ico";
                    if (!File.Exists(icon))
                    {
                        File.Move(vcProject.ProjectDirectory + "\\gui.ico", icon);
                        var attribs = File.GetAttributes(icon);
                        File.SetAttributes(icon, attribs & (~FileAttributes.ReadOnly));
                    }

                    var rcFile = vcProject.ProjectDirectory + "\\" + vcProject.ItemName + ".rc";
                    if (!File.Exists(rcFile))
                    {
                        FileStream fs = null;
                        try {
                            fs = File.Create(rcFile);
                            using (var sw = new StreamWriter(fs)) {
                                fs = null;
                                sw.WriteLine("IDI_ICON1\t\tICON\t\tDISCARDABLE\t\""
                                             + vcProject.ItemName + ".ico\"" + sw.NewLine);
                            }
                        } finally {
                            if (fs != null)
                            {
                                fs.Dispose();
                            }
                        }
                        vcProject.AddFile(rcFile);
                    }
                } catch { }
            }

            foreach (VCFile file in (IVCCollection)qtProject.VCProject.Files)
            {
                qtProject.AdjustWhitespace(file.FullPath);
            }

            qtProject.SetQtEnvironment(qtVersion);
            qtProject.Finish(); // Collapses all project nodes.
        }
Exemple #7
0
        public void ProjectFinishedGenerating(Project project)
        {
            var qtProject = QtProject.Create(project);

            QtVSIPSettings.SaveUicDirectory(project, null);
            QtVSIPSettings.SaveMocDirectory(project, null);
            QtVSIPSettings.SaveMocOptions(project, null);
            QtVSIPSettings.SaveRccDirectory(project, null);
            QtVSIPSettings.SaveLUpdateOnBuild(project);
            QtVSIPSettings.SaveLUpdateOptions(project, null);
            QtVSIPSettings.SaveLReleaseOptions(project, null);

            var vm        = QtVersionManager.The();
            var qtVersion = vm.GetDefaultVersion();
            var vi        = VersionInformation.Get(vm.GetInstallPath(qtVersion));

            if (vi.GetVSPlatformName() != "Win32")
            {
                qtProject.SelectSolutionPlatform(vi.GetVSPlatformName());
            }
            vm.SaveProjectQtVersion(project, qtVersion);

            qtProject.MarkAsQtProject("v1.0");
            qtProject.AddDirectories();

            var type = TemplateType.GUISystem | (data.CreateStaticLibrary
                ? TemplateType.StaticLibrary : TemplateType.DynamicLibrary);

            qtProject.WriteProjectBasicConfigurations(type, data.UsePrecompiledHeader);

            qtProject.AddModule(QtModule.Main);
            foreach (var module in data.Modules)
            {
                qtProject.AddModule(QtModules.Instance.ModuleIdByName(module));
            }

            var vcProject = qtProject.VCProject;
            var files     = vcProject.GetFilesWithItemType(@"None") as IVCCollection;

            foreach (var vcFile in files)
            {
                vcProject.RemoveFile(vcFile);
            }

            if (data.UsePrecompiledHeader)
            {
                qtProject.AddFileToProject(@"stdafx.cpp", Filters.SourceFiles());
                qtProject.AddFileToProject(@"stdafx.h", Filters.HeaderFiles());
            }

            foreach (VCFile file in (IVCCollection)qtProject.VCProject.Files)
            {
                qtProject.AdjustWhitespace(file.FullPath);
            }

            qtProject.AddDefine(projectDefine, BuildConfig.Both);
            if (data.CreateStaticLibrary)
            {
                qtProject.AddDefine("BUILD_STATIC", BuildConfig.Both);
            }

            qtProject.SetQtEnvironment(qtVersion);
            qtProject.Finish(); // Collapses all project nodes.
        }