diff --git a/src/HelpText.cpp b/src/HelpText.cpp
index 29149585a..404c53dd6 100644
--- a/src/HelpText.cpp
+++ b/src/HelpText.cpp
@@ -387,12 +387,13 @@ const wxString VerCheckArgs(){
}
// Text of hyperlink to check versions.
-const wxString VerCheckHtml(){
+const wxString VerCheckHtml()
+{
wxStringOutputStream o;
wxTextOutputStream s(o);
s
<< "
[["
- << VerCheckUrl()
+ << VerCheckUrl().GET()
<< "|"
<< XO("Check Online")
<< "]]\n";
@@ -400,7 +401,8 @@ const wxString VerCheckHtml(){
}
// Url with Version check args attached.
-const wxString VerCheckUrl(){
+const URLString VerCheckUrl()
+{
//The version we intend to use for live Audacity.
#define VER_CHECK_URL "https://www.audacityteam.org/download/?"
//For testing of our scriptlet.
diff --git a/src/HelpText.h b/src/HelpText.h
index ee2ea39e1..2565f2002 100644
--- a/src/HelpText.h
+++ b/src/HelpText.h
@@ -13,12 +13,17 @@
class TranslatableString;
class wxString;
+#include "Identifier.h"
+
+struct URLStringTag;
+//! Distinct type for URLs
+using URLString = TaggedIdentifier< URLStringTag >;
AUDACITY_DLL_API wxString HelpText( const wxString & Key );
AUDACITY_DLL_API TranslatableString TitleText( const wxString & Key );
extern AUDACITY_DLL_API const wxString VerCheckArgs();
-extern AUDACITY_DLL_API const wxString VerCheckUrl();
+extern AUDACITY_DLL_API const URLString VerCheckUrl();
extern AUDACITY_DLL_API const wxString VerCheckHtml();
extern AUDACITY_DLL_API wxString FormatHtmlText( const wxString & Text );
diff --git a/src/widgets/HelpSystem.cpp b/src/widgets/HelpSystem.cpp
index 0104ed5aa..9898a2ae6 100644
--- a/src/widgets/HelpSystem.cpp
+++ b/src/widgets/HelpSystem.cpp
@@ -236,8 +236,8 @@ void HelpSystem::ShowHtmlText(wxWindow *pParent,
// Shows help in browser, or possibly in own dialog.
void HelpSystem::ShowHelp(wxWindow *parent,
- const wxString &localFileName,
- const wxString &remoteURL,
+ const FilePath &localFileName,
+ const URLString &remoteURL,
bool bModal,
bool alwaysDefaultBrowser)
{
@@ -289,7 +289,7 @@ void HelpSystem::ShowHelp(wxWindow *parent,
// I can't find it'.
// Use Built-in browser to suggest you use the remote url.
wxString Text = HelpText( wxT("remotehelp") );
- Text.Replace( wxT("*URL*"), remoteURL );
+ Text.Replace( wxT("*URL*"), remoteURL.GET() );
// Always make the 'help on the internet' dialog modal.
// Fixes Bug 1411.
ShowHtmlText( parent, XO("Help on the Internet"), Text, false, true );
@@ -297,7 +297,7 @@ void HelpSystem::ShowHelp(wxWindow *parent,
else if( HelpMode == wxT("Local") || alwaysDefaultBrowser)
{
// Local file, External browser
- OpenInDefaultBrowser( wxString(wxT("file:"))+localFileName );
+ OpenInDefaultBrowser( L"file:" + localFileName );
}
else
{
@@ -310,7 +310,7 @@ void HelpSystem::ShowHelp(wxWindow *parent,
const wxString &PageName,
bool bModal)
{
- wxString localHelpPage;
+ FilePath localHelpPage;
wxString webHelpPath;
wxString webHelpPage;
wxString releasePageName;
@@ -515,9 +515,9 @@ void BrowserDialog::UpdateButtons()
}
}
-void OpenInDefaultBrowser(const wxHtmlLinkInfo& link)
+void OpenInDefaultBrowser(const URLString& link)
{
- wxURI uri(link.GetHref());
+ wxURI uri(link.GET());
wxLaunchDefaultBrowser(uri.BuildURI());
}
@@ -555,7 +555,7 @@ void LinkingHtmlWindow::OnLinkClicked(const wxHtmlLinkInfo& link)
}
else if( href.StartsWith(wxT("mailto:")) || href.StartsWith(wxT("file:")) )
{
- OpenInDefaultBrowser( link );
+ OpenInDefaultBrowser( link.GetHref() );
return;
}
else if( !href.StartsWith( wxT("http:")) && !href.StartsWith( wxT("https:")) )
@@ -564,7 +564,7 @@ void LinkingHtmlWindow::OnLinkClicked(const wxHtmlLinkInfo& link)
}
else
{
- OpenInDefaultBrowser(link);
+ OpenInDefaultBrowser(link.GetHref());
return;
}
wxFrame * pFrame = GetRelatedFrame();
diff --git a/src/widgets/HelpSystem.h b/src/widgets/HelpSystem.h
index 195ce1546..1493e612d 100644
--- a/src/widgets/HelpSystem.h
+++ b/src/widgets/HelpSystem.h
@@ -25,6 +25,7 @@
#include
#include "wxPanelWrapper.h" // to inherit
+#include "../HelpText.h"
class AudacityProject;
@@ -62,21 +63,25 @@ public:
/// OR else links to the internet. Generally using this outside this class
/// is depreciated in favour of the "smarter" overload below, unless there
/// is a good reason for using this form.
+ /// @param parent Parent window for the dialog
/// @param localFileName Name and path of the file on the local machine
/// file system to be opened. file.name#anchor syntax is allowed, and therefore
/// file names containing a '#' are not (on any platform).
+ /// @param remoteURL use instead of file if nonempty, and user preferences specify remote,
+ /// or localFileName is invalid
/// @param bModal Whether the resulting dialogue should be modal or not.
/// Default is modeless dialogue
/// @param alwaysDefaultBrowser Force use of default web browser.
/// Default allows built in browser for local files.
static void ShowHelp(wxWindow *parent,
- const wxString &localFileName,
- const wxString &remoteURL,
+ const FilePath &localFileName,
+ const URLString &remoteURL,
bool bModal = false,
bool alwaysDefaultBrowser = false);
/// Displays a page from the Audacity manual in your browser, if
/// it's available locally, OR else links to the internet.
+ /// @param parent Parent window for the dialog
/// @param PageName The name of the manual page to display as it is in
/// _development version_ of the manual (i.e. in MediaWiki), _not_ the
/// converted file name used for offline and released manuals.
@@ -115,7 +120,7 @@ class ShuttleGui;
#include "HtmlWindow.h" // to inherit
-AUDACITY_DLL_API void OpenInDefaultBrowser(const wxHtmlLinkInfo& link);
+AUDACITY_DLL_API void OpenInDefaultBrowser(const URLString& link);
/// \brief An HtmlWindow that handles linked clicked - usually the