private void InitModules() { var versionManager = QtVersionManager.The(); var qtVersion = qtProject.GetQtVersion(); var installPath = versionManager.GetInstallPath(qtVersion); var modulesList = getQtLibs(qtProject.GetQtVersion()); //var projectModules = new List<string>(); for (int i = 0; i < moduleMap.Count; ++i) { var item = moduleMap[i]; item.initialValue = qtProject.HasModule(item.moduleId); item.checkbox.Checked = item.initialValue; moduleMap[i] = item; // Disable if module not installed var info = QtModules.Instance.ModuleInformation(item.moduleId); var libraryPrefix = info.LibraryPrefix; if (libraryPrefix.StartsWith("Qt")) { libraryPrefix = "Qt5" + libraryPrefix.Substring(2); } var fullPath = installPath + "\\lib\\" + libraryPrefix + ".lib"; var isExists = System.IO.File.Exists(fullPath); item.checkbox.Enabled = isExists; //foreach (var module in modulesList) //{ // if (comparePath(fullPath, module) && item.initialValue && isExists) // { // projectModules.Add(module); // } //} // Don't disable item if qtVersion not available if (!isExists && qtVersion != null) { item.checkbox.Checked = false; } } var projectLibs = getUsedLibs(qtProject.Project); modulesListBox.Items.Clear(); foreach (var item in modulesList) { var libName = System.IO.Path.GetFileName(item); modulesListBox.Items.Add(libraryPathToName(item), projectLibs.Contains(libName)); } }
private void InitModules() { QtVersionManager versionManager = QtVersionManager.The(); string qtVersion = qtProject.GetQtVersion(); string install_path = versionManager.GetInstallPath(qtVersion); for (int i = 0; i < moduleMap.Count; ++i) { ModuleMapItem item = moduleMap[i]; item.initialValue = qtProject.HasModule(item.moduleId); item.checkbox.Checked = item.initialValue; moduleMap[i] = item; // Disable if module not installed QtModuleInfo info = QtModules.Instance.ModuleInformation(item.moduleId); string libraryPrefix = info.LibraryPrefix; if (libraryPrefix.StartsWith("Qt")) { libraryPrefix = "Qt5" + libraryPrefix.Substring(2); } string full_path = install_path + "\\lib\\" + libraryPrefix + ".lib"; System.IO.FileInfo fi = new System.IO.FileInfo(full_path); item.checkbox.Enabled = fi.Exists; if (fi.Exists == false) { // Don't disable item if qtVersion not available if (qtVersion != null) { item.checkbox.Checked = false; } } } }
private void InitModules() { var versionManager = QtVersionManager.The(); var qtVersion = qtProject.GetQtVersion(); var install_path = versionManager.GetInstallPath(qtVersion) ?? string.Empty; for (var i = 0; i < moduleMap.Count; ++i) { var item = moduleMap[i]; item.initialValue = qtProject.HasModule(item.moduleId); item.checkbox.Checked = item.initialValue; moduleMap[i] = item; // Disable if module not installed var info = QtModules.Instance.ModuleInformation(item.moduleId); var versionInfo = versionManager.GetVersionInfo(qtVersion); if (info != null && versionInfo != null) { var libraryPrefix = info.LibraryPrefix; if (libraryPrefix.StartsWith("Qt", StringComparison.Ordinal)) { libraryPrefix = "Qt5" + libraryPrefix.Substring(2); } var full_path = Path.Combine(install_path, "lib", string.Format("{0}{1}.lib", libraryPrefix, versionInfo.LibInfix())); var fi = new System.IO.FileInfo(full_path); item.checkbox.Enabled = fi.Exists; if (fi.Exists == false) { // Don't disable item if qtVersion not available if (qtVersion != null) { item.checkbox.Checked = false; } } } else { item.checkbox.Checked = false; } } }
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; } } }