From ca47896204482bf4a6979e3838bf7f09f61cebeb Mon Sep 17 00:00:00 2001
From: giy <giy@omp-system.ru>
Date: Fri, 02 Sep 2022 14:16:56 +0300
Subject: [PATCH] Обновление до версии 2.9.0

---
 QtVsTools.Package/Options/QtOptionsPage.cs |   67 +++++++++++++++++++++++++--------
 1 files changed, 50 insertions(+), 17 deletions(-)

diff --git a/QtVsTools.Package/Options/QtOptionsPage.cs b/QtVsTools.Package/Options/QtOptionsPage.cs
index 5035285..7da27ae 100644
--- a/QtVsTools.Package/Options/QtOptionsPage.cs
+++ b/QtVsTools.Package/Options/QtOptionsPage.cs
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** 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.
@@ -30,20 +30,20 @@
 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
     {
@@ -85,6 +85,16 @@
             [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 }
@@ -144,8 +154,8 @@
                 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);
             }
         }
@@ -170,7 +180,7 @@
         [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")]
@@ -222,8 +232,25 @@
         [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;
@@ -234,6 +261,8 @@
             BuildRunQtTools = ProjectTracking = true;
             BuildDebugInformation = false;
             BuildLoggerVerbosity = LoggerVerbosity.Quiet;
+            NotifyInstalled = true;
+            LinkNatvis = true;
 
             ////////
             // Get Qt Help keyboard shortcut
@@ -252,6 +281,8 @@
 
         public override void LoadSettingsFromStorage()
         {
+            ThreadHelper.ThrowIfNotOnUIThread();
+
             ResetSettings();
             try {
                 QtMsBuildPath = Environment.GetEnvironmentVariable("QTMSBUILD");
@@ -271,10 +302,11 @@
                     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();
             }
         }
 
@@ -296,7 +328,7 @@
                     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);
@@ -304,10 +336,11 @@
                     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();
             }
         }
 

--
Gitblit v1.9.1