Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a Third-Party notices link to the about dialog #5508

Merged
20 commits merged into from
Apr 28, 2020
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/cascadia/TerminalApp/Resources/en-US/Resources.resw
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,10 @@
<value>Privacy Policy</value>
<comment>A hyperlink name for the Terminal's privacy policy</comment>
</data>
<data name="AboutDialog_ThirdPartyNoticesLink.Content" xml:space="preserve">
<value>Third-Party Notices</value>
<comment>A hyperlink name for the Terminal's third-party notices</comment>
</data>
<data name="ApplicationDisplayNameUnpackaged" xml:space="preserve">
<value>Windows Terminal (Unpackaged)</value>
<comment>This display name is used when the application's name cannot be determined</comment>
Expand Down
8 changes: 8 additions & 0 deletions src/cascadia/TerminalApp/TerminalPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
#include "TabRowControl.h"
#include "DebugTapConnection.h"

#include "CurrentCommitHash.h" // For the about dialog's ThirdPartyNotices link

using namespace winrt;
using namespace winrt::Windows::Foundation::Collections;
using namespace winrt::Windows::UI::Xaml;
Expand Down Expand Up @@ -254,6 +256,12 @@ namespace winrt::TerminalApp::implementation
return RS_(L"ApplicationVersionUnknown");
}

winrt::hstring TerminalPage::ThirdPartyNoticesLink()
{
winrt::hstring link{ fmt::format(std::wstring_view{ L"https://github.com/microsoft/terminal/blob/{}/NOTICE.md" }, CurrentCommitHash) };
leonMSFT marked this conversation as resolved.
Show resolved Hide resolved
return link;
}

// Method Description:
// - Displays a dialog for warnings found while closing the terminal app using
// key binding with multiple tabs opened. Display messages to warn user
Expand Down
2 changes: 2 additions & 0 deletions src/cascadia/TerminalApp/TerminalPage.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ namespace winrt::TerminalApp::implementation
winrt::hstring ApplicationDisplayName();
winrt::hstring ApplicationVersion();

winrt::hstring ThirdPartyNoticesLink();

void CloseWindow();

int32_t SetStartupCommandline(winrt::array_view<const hstring> args);
Expand Down
2 changes: 2 additions & 0 deletions src/cascadia/TerminalApp/TerminalPage.idl
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ namespace TerminalApp
String ApplicationDisplayName { get; };
String ApplicationVersion { get; };

String ThirdPartyNoticesLink { get; };

event Windows.Foundation.TypedEventHandler<Object, String> TitleChanged;
event Windows.Foundation.TypedEventHandler<Object, LastTabClosedEventArgs> LastTabClosed;
event Windows.Foundation.TypedEventHandler<Object, Windows.UI.Xaml.UIElement> SetTitleBarContent;
Expand Down
3 changes: 3 additions & 0 deletions src/cascadia/TerminalApp/TerminalPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ the MIT License. See LICENSE in the project root for license information. -->
<HyperlinkButton
x:Uid="AboutDialog_PrivacyPolicyLink"
NavigateUri="https://go.microsoft.com/fwlink/?linkid=2125418" />
<HyperlinkButton
x:Uid="AboutDialog_ThirdPartyNoticesLink"
NavigateUri="{x:Bind ThirdPartyNoticesLink}" />
</StackPanel>
</ContentDialog>

Expand Down
4 changes: 4 additions & 0 deletions src/cascadia/TerminalApp/lib/TerminalAppLib.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -330,4 +330,8 @@
<Target Name="_TerminalAppGenerateUserSettingsH" Inputs="..\userDefaults.json" Outputs="Generated Files\userDefaults.h" BeforeTargets="BeforeClCompile">
<Exec Command="powershell.exe -noprofile –ExecutionPolicy Unrestricted $(OpenConsoleDir)\tools\GenerateHeaderForJson.ps1 -JsonFile ..\userDefaults.json -OutPath '&quot;Generated Files\userDefaults.h&quot;' -VariableName UserSettingsJson" />
</Target>
<!-- Get the hash of the current git commit this build is on.-->
<Target Name="_GenerateCurrentCommitHashH" Outputs="Generated Files\CurrentCommitHash.h" BeforeTargets="BeforeClCompile">
<Exec Command="powershell.exe -noprofile -ExecutionPolicy Unrestricted $(OpenConsoleDir)\tools\GenerateCommitHashHeader.ps1" />
</Target>
</Project>
5 changes: 5 additions & 0 deletions tools/GenerateCommitHashHeader.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# This script gets the current git commit hash and places it in a header file stamped to a wstring_view

Write-Output "constexpr std::wstring_view CurrentCommitHash{ L`"" | Out-File -FilePath "Generated Files\CurrentCommitHash.h" -Encoding ASCII -NoNewline
git rev-parse HEAD | Out-File -FilePath "Generated Files\CurrentCommitHash.h" -Encoding ASCII -Append -NoNewline
Write-Output "`" };" | Out-File -FilePath "Generated Files\CurrentCommitHash.h" -Encoding ASCII -Append -NoNewline