Ejemplo n.º 1
0
        public static bool RunlRelease(VCFile vcFile)
        {
            bool success = true;

            try
            {
                VCProject vcProject = vcFile.project as VCProject;
                string    cmdLine   = "";
                if (HelperFunctions.IsQtProject(vcProject))
                {
                    string options = QtVSIPSettings.GetLReleaseOptions();
                    if (!string.IsNullOrEmpty(options))
                    {
                        cmdLine += options + " ";
                    }
                }
                EnvDTE.Project project = vcProject.Object as EnvDTE.Project;
                Messages.PaneMessage(project.DTE,
                                     "--- (lrelease) file: " + vcFile.FullPath);

                cmdLine += vcFile.RelativePath;
                HelperFunctions.StartExternalQtApplication(Resources.lreleaseCommand, cmdLine,
                                                           vcProject.ProjectDirectory, HelperFunctions.GetSelectedQtProject(project.DTE), true,
                                                           null);
            }
            catch (QtVSException e)
            {
                success = false;
                Messages.DisplayErrorMessage(e.Message);
            }

            return(success);
        }
Ejemplo n.º 2
0
        public static bool RunlRelease(VCFile vcFile)
        {
            if (vcFile == null)
            {
                return(false);
            }

            var success = true;

            try {
                var vcProject = vcFile.project as VCProject;
                var cmdLine   = string.Empty;
                if (HelperFunctions.IsQtProject(vcProject))
                {
                    var options = QtVSIPSettings.GetLReleaseOptions();
                    if (!string.IsNullOrEmpty(options))
                    {
                        cmdLine += options + " ";
                    }
                }
                var project = vcProject.Object as EnvDTE.Project;
                Messages.PaneMessage(project.DTE,
                                     "--- (lrelease) file: " + vcFile.FullPath);

                cmdLine += vcFile.RelativePath.Quoute();
                StartProcess(Resources.lreleaseCommand, cmdLine, vcProject.ProjectDirectory,
                             HelperFunctions.GetSelectedQtProject(project.DTE));
            } catch (QtVSException e) {
                success = false;
                Messages.DisplayErrorMessage(e.Message);
            }

            return(success);
        }
Ejemplo n.º 3
0
 public VSQtSettings()
 {
     newMocDir                    = QtVSIPSettings.GetMocDirectory();
     newMocOptions                = QtVSIPSettings.GetMocOptions();
     newRccDir                    = QtVSIPSettings.GetRccDirectory();
     newUicDir                    = QtVSIPSettings.GetUicDirectory();
     newLUpdateOnBuild            = QtVSIPSettings.GetLUpdateOnBuild();
     newLUpdateOptions            = QtVSIPSettings.GetLUpdateOptions();
     newLReleaseOptions           = QtVSIPSettings.GetLReleaseOptions();
     newAskBeforeCheckoutFile     = QtVSIPSettings.GetAskBeforeCheckoutFile();
     newDisableCheckoutFiles      = QtVSIPSettings.GetDisableCheckoutFiles();
     newDisableAutoMOCStepsUpdate = QtVSIPSettings.GetDisableAutoMocStepsUpdate();
 }
Ejemplo n.º 4
0
 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);
 }
Ejemplo n.º 5
0
        public VSQtSettings()
        {
            newMocDir                    = QtVSIPSettings.GetMocDirectory();
            newMocOptions                = QtVSIPSettings.GetMocOptions();
            newRccDir                    = QtVSIPSettings.GetRccDirectory();
            newUicDir                    = QtVSIPSettings.GetUicDirectory();
            newLUpdateOnBuild            = QtVSIPSettings.GetLUpdateOnBuild();
            newLUpdateOptions            = QtVSIPSettings.GetLUpdateOptions();
            newLReleaseOptions           = QtVSIPSettings.GetLReleaseOptions();
            newAskBeforeCheckoutFile     = QtVSIPSettings.GetAskBeforeCheckoutFile();
            newDisableCheckoutFiles      = QtVSIPSettings.GetDisableCheckoutFiles();
            newDisableAutoMOCStepsUpdate = QtVSIPSettings.GetDisableAutoMocStepsUpdate();

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

#if VS2013
            EnableQmlClassifier = store.GetBoolean(Statics.QmlClassifierPath,
                                                   Statics.QmlClassifierKey, true);
#else
            EnableQmlTextMate = store.GetBoolean(Statics.QmlTextMatePath,
                                                 Statics.QmlTextMateKey, true);
#endif
        }
Ejemplo n.º 6
0
        static void Legacy_RunTranslation(
            BuildAction buildAction,
            QtProject qtProject,
            string tsFile,
            ref string tempFile)
        {
            var qtVersion     = qtProject.GetQtVersion();
            var qtInstallPath = QtVersionManager.The().GetInstallPath(qtVersion);

            if (string.IsNullOrEmpty(qtInstallPath))
            {
                Messages.Print("translation: Error accessing Qt installation");
                return;
            }

            var procInfo = new ProcessStartInfo
            {
                WorkingDirectory       = qtProject.ProjectDir,
                CreateNoWindow         = true,
                UseShellExecute        = false,
                RedirectStandardError  = true,
                RedirectStandardOutput = true,
                Arguments = ""
            };

            switch (buildAction)
            {
            case BuildAction.Update:
                Messages.Print("\r\n--- (lupdate) file: " + tsFile);
                procInfo.FileName = Path.Combine(qtInstallPath, "bin", "lupdate.exe");
                var options = QtVSIPSettings.GetLUpdateOptions();
                if (!string.IsNullOrEmpty(options))
                {
                    procInfo.Arguments += options + " ";
                }
                if (tempFile == null)
                {
                    var inputFiles = GetProjectFiles(qtProject.Project, FilesToList.FL_HFiles)
                                     .Union(GetProjectFiles(qtProject.Project, FilesToList.FL_CppFiles))
                                     .Union(GetProjectFiles(qtProject.Project, FilesToList.FL_UiFiles))
                                     .Union(GetProjectFiles(qtProject.Project, FilesToList.FL_QmlFiles));
                    tempFile = Path.GetTempFileName();
                    File.WriteAllLines(tempFile, inputFiles);
                }
                procInfo.Arguments += string.Format("\"@{0}\" -ts \"{1}\"", tempFile, tsFile);
                break;

            case BuildAction.Release:
                Messages.Print("\r\n--- (lrelease) file: " + tsFile);
                procInfo.FileName = Path.Combine(qtInstallPath, "bin", "lrelease.exe");
                options           = QtVSIPSettings.GetLReleaseOptions();
                if (!string.IsNullOrEmpty(options))
                {
                    procInfo.Arguments += options + " ";
                }
                procInfo.Arguments += string.Format("\"{0}\"", tsFile);
                break;
            }
            using (var proc = Process.Start(procInfo)) {
                proc.OutputDataReceived += (object sender, DataReceivedEventArgs e) =>
                {
                    if (!string.IsNullOrEmpty(e.Data))
                    {
                        Messages.Print(e.Data);
                    }
                };
                proc.ErrorDataReceived += (object sender, DataReceivedEventArgs e) =>
                {
                    if (!string.IsNullOrEmpty(e.Data))
                    {
                        Messages.Print(e.Data);
                    }
                };
                proc.BeginOutputReadLine();
                proc.BeginErrorReadLine();
                proc.WaitForExit();
                switch (proc.ExitCode)
                {
                case 0:
                    Messages.Print("translation: ok");
                    break;

                default:
                    Messages.Print(string.Format("translation: ERROR {0}", proc.ExitCode));
                    break;
                }
            }
        }