| | |
| | | /****************************************************************************
|
| | | **
|
| | | ** Copyright (C) 2020 The Qt Company Ltd.
|
| | | ** Copyright (C) 2022 The Qt Company Ltd.
|
| | | ** Contact: https://www.qt.io/licensing/
|
| | | **
|
| | | ** This file is part of the Qt VS Tools.
|
| | |
| | | using System.ComponentModel;
|
| | | using System.Globalization;
|
| | | using System.Linq;
|
| | | using Microsoft.Win32;
|
| | | using System.Linq.Expressions;
|
| | | using System.Reflection;
|
| | | using Microsoft.Build.Framework;
|
| | | using Microsoft.VisualStudio.Shell;
|
| | | using Microsoft.VisualStudio.Shell.Interop;
|
| | | using Microsoft.Build.Framework;
|
| | | using Microsoft.Win32;
|
| | | using EnvDTE;
|
| | | using QtVsTools.Core;
|
| | | using QtVsTools.Common;
|
| | | using QtVsTools.VisualStudio;
|
| | | using System.Reflection;
|
| | | using System.Linq.Expressions;
|
| | |
|
| | | namespace QtVsTools.Options
|
| | | {
|
| | | using static EnumExt;
|
| | | using Core;
|
| | | using VisualStudio;
|
| | |
|
| | | using static Common.EnumExt;
|
| | |
|
| | | public class QtOptionsPage : DialogPage, IQtVsToolsOptions
|
| | | {
|
| | |
| | | [String("BkgBuild_RunQtTools")] RunQtTools,
|
| | | [String("BkgBuild_DebugInfo")] DebugInfo,
|
| | | [String("BkgBuild_LoggerVerbosity")] LoggerVerbosity,
|
| | | }
|
| | |
|
| | | public enum Notifications
|
| | | {
|
| | | [String("Notifications_Installed")] Installed,
|
| | | }
|
| | |
|
| | | public enum Natvis
|
| | | {
|
| | | [String("LinkNatvis")] Link,
|
| | | }
|
| | |
|
| | | public enum Timeout : uint { Disabled = 0 }
|
| | |
| | | object value,
|
| | | Type destinationType)
|
| | | {
|
| | | if (value.GetType() == typeof(bool) && destinationType == typeof(string))
|
| | | return ((bool)value) ? "Enable" : "Disable";
|
| | | if (value is bool b && destinationType == typeof(string))
|
| | | return b ? "Enable" : "Disable";
|
| | | return base.ConvertTo(context, culture, value, destinationType);
|
| | | }
|
| | | }
|
| | |
| | | [DisplayName("Keyboard shortcut")]
|
| | | [Description("To change keyboard mapping, go to: Tools > Options > Keyboard")]
|
| | | [ReadOnly(true)]
|
| | | public string QtHelpKeyBinding { get; set; }
|
| | | private string QtHelpKeyBinding { get; set; }
|
| | |
|
| | | [Category("Help")]
|
| | | [DisplayName("Preferred source")]
|
| | |
| | | [Description("Configure verbosity level of background build log.")]
|
| | | public LoggerVerbosity BuildLoggerVerbosity { get; set; }
|
| | |
|
| | | [Category("Notifications")]
|
| | | [DisplayName("New version installed")]
|
| | | [Description("Show notification when a new version was recently installed.")]
|
| | | [TypeConverter(typeof(EnableDisableConverter))]
|
| | | public bool NotifyInstalled { get; set; }
|
| | |
|
| | | [Category("Natvis")]
|
| | | [DisplayName("Embed .natvis file into PDB")]
|
| | | [Description("Embeds the debugger visualizations (.natvis file) into the PDB file"
|
| | | + "generated by LINK. While setting this option, the embedded Natvis file will"
|
| | | + "take precedence over user-specific Natvis files(for example the files"
|
| | | + "located in %USERPROFILE%\\Documents\\Visual Studio 2022\\Visualizers).")]
|
| | | [TypeConverter(typeof(EnableDisableConverter))]
|
| | | public bool LinkNatvis { get; set; }
|
| | |
|
| | | public override void ResetSettings()
|
| | | {
|
| | | ThreadHelper.ThrowIfNotOnUIThread();
|
| | |
|
| | | QtMsBuildPath = "";
|
| | | QmlDebuggerEnabled = true;
|
| | | QmlDebuggerTimeout = (Timeout)60000;
|
| | |
| | | BuildRunQtTools = ProjectTracking = true;
|
| | | BuildDebugInformation = false;
|
| | | BuildLoggerVerbosity = LoggerVerbosity.Quiet;
|
| | | NotifyInstalled = true;
|
| | | LinkNatvis = true;
|
| | |
|
| | | ////////
|
| | | // Get Qt Help keyboard shortcut
|
| | |
| | |
|
| | | public override void LoadSettingsFromStorage()
|
| | | {
|
| | | ThreadHelper.ThrowIfNotOnUIThread();
|
| | |
|
| | | ResetSettings();
|
| | | try {
|
| | | QtMsBuildPath = Environment.GetEnvironmentVariable("QTMSBUILD");
|
| | |
| | | Load(() => BuildRunQtTools, key, BkgBuild.RunQtTools);
|
| | | Load(() => BuildDebugInformation, key, BkgBuild.DebugInfo);
|
| | | Load(() => BuildLoggerVerbosity, key, BkgBuild.LoggerVerbosity);
|
| | | Load(() => NotifyInstalled, key, Notifications.Installed);
|
| | | Load(() => LinkNatvis, key, Natvis.Link);
|
| | | }
|
| | | } catch (Exception exception) {
|
| | | Messages.Print(
|
| | | exception.Message + "\r\n\r\nStacktrace:\r\n" + exception.StackTrace);
|
| | | exception.Log();
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | Save(QmlDebuggerEnabled, key, QmlDebug.Enable);
|
| | | Save(QmlDebuggerTimeout, key, QmlDebug.Timeout);
|
| | | Save(HelpPreference, key, Help.Preference);
|
| | | Save(TryQtHelpOnF1Pressed, key, Help.Preference);
|
| | | Save(TryQtHelpOnF1Pressed, key, Help.TryOnF1Pressed);
|
| | | Save(DesignerDetached, key, Designer.Detached);
|
| | | Save(LinguistDetached, key, Linguist.Detached);
|
| | | Save(ResourceEditorDetached, key, ResEditor.Detached);
|
| | |
| | | Save(BuildRunQtTools, key, BkgBuild.RunQtTools);
|
| | | Save(BuildDebugInformation, key, BkgBuild.DebugInfo);
|
| | | Save(BuildLoggerVerbosity, key, BkgBuild.LoggerVerbosity);
|
| | | Save(NotifyInstalled, key, Notifications.Installed);
|
| | | Save(LinkNatvis, key, Natvis.Link);
|
| | | }
|
| | | } catch (Exception exception) {
|
| | | Messages.Print(
|
| | | exception.Message + "\r\n\r\nStacktrace:\r\n" + exception.StackTrace);
|
| | | exception.Log();
|
| | | }
|
| | | }
|
| | |
|