diff options
author | Miguel Costa <miguel.costa@qt.io> | 2022-01-18 14:00:53 +0100 |
---|---|---|
committer | Miguel Costa <miguel.costa@qt.io> | 2022-01-19 11:34:21 +0000 |
commit | 58cde19f3ca1f1e57275a9c6bb92e4dc14072a77 (patch) | |
tree | e93ebd96f9e16808a666ee8f954da291957ff4a2 | |
parent | 8ee79b3bca7493281a26c1991ab49c7a7f41f8f5 (diff) |
Show notification when new version is installed
A notification message is now shown in the info-bar when a new version
of the Qt VS Tools extension is installed.
Change-Id: I798bd62e3e8ccc1c64f576edb7773c4eb1448b7a
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
-rw-r--r-- | QtVsTools.Package/Package/InfoBarMessages.cs | 29 | ||||
-rw-r--r-- | QtVsTools.Package/QtVsToolsPackage.cs | 18 |
2 files changed, 47 insertions, 0 deletions
diff --git a/QtVsTools.Package/Package/InfoBarMessages.cs b/QtVsTools.Package/Package/InfoBarMessages.cs index b1042200..b31dae9d 100644 --- a/QtVsTools.Package/Package/InfoBarMessages.cs +++ b/QtVsTools.Package/Package/InfoBarMessages.cs @@ -28,6 +28,7 @@ using System; using Microsoft.VisualStudio.Imaging; +using Microsoft.VisualStudio.Shell; namespace QtVsTools { @@ -60,5 +61,33 @@ namespace QtVsTools } } ); + + static IMessage _NotifyInstall = null; + public static IMessage NotifyInstall => _NotifyInstall ?? ( + _NotifyInstall = new Message + { + Icon = KnownMonikers.StatusWarning, + Text = new TextSpan[] + { + new TextSpan { Bold = true, Text = "Qt Visual Studio Tools" }, + new TextSpacer(2), + "\u2014", // Em dash + new TextSpacer(2), + $"Version {Version.USER_VERSION} was installed." + }, + Hyperlinks = new Hyperlink[] + { + new Hyperlink + { + Text = "Release Notes", + CloseInfoBar = false, + OnClicked= () => { + VsShellUtilities.OpenSystemBrowser( + "https://code.qt.io/cgit/qt-labs/vstools.git/tree/Changelog"); + } + } + } + } + ); } } diff --git a/QtVsTools.Package/QtVsToolsPackage.cs b/QtVsTools.Package/QtVsToolsPackage.cs index 5fec3978..4270edcd 100644 --- a/QtVsTools.Package/QtVsToolsPackage.cs +++ b/QtVsTools.Package/QtVsToolsPackage.cs @@ -326,10 +326,28 @@ namespace QtVsTools eventHandler.SolutionEvents_Opened(); } + bool TestVersionInstalled() + { + bool newVersion = false; + string versionFile = Path.Combine(PkgInstallPath, "lastversion.txt"); + if (File.Exists(versionFile)) { + string lastVersion = File.ReadAllText(versionFile); + newVersion = (lastVersion!= Version.PRODUCT_VERSION); + } else { + newVersion = true; + } + if (newVersion) + File.WriteAllText(versionFile, Version.PRODUCT_VERSION); + return newVersion; + } + public void VsMainWindowActivated() { if (QtVersionManager.The().GetVersions()?.Length == 0) InfoBarMessages.NoQtVersion.Show(); + if (TestVersionInstalled()) { + InfoBarMessages.NotifyInstall.Show(); + } } protected override int QueryClose(out bool canClose) |