A type distinction for strings that are URLs, and some Doxygen
This commit is contained in:
parent
6fe7a7dfa1
commit
3c50935484
|
@ -387,12 +387,13 @@ const wxString VerCheckArgs(){
|
||||||
}
|
}
|
||||||
|
|
||||||
// Text of hyperlink to check versions.
|
// Text of hyperlink to check versions.
|
||||||
const wxString VerCheckHtml(){
|
const wxString VerCheckHtml()
|
||||||
|
{
|
||||||
wxStringOutputStream o;
|
wxStringOutputStream o;
|
||||||
wxTextOutputStream s(o);
|
wxTextOutputStream s(o);
|
||||||
s
|
s
|
||||||
<< "<center>[["
|
<< "<center>[["
|
||||||
<< VerCheckUrl()
|
<< VerCheckUrl().GET()
|
||||||
<< "|"
|
<< "|"
|
||||||
<< XO("Check Online")
|
<< XO("Check Online")
|
||||||
<< "]]</center>\n";
|
<< "]]</center>\n";
|
||||||
|
@ -400,7 +401,8 @@ const wxString VerCheckHtml(){
|
||||||
}
|
}
|
||||||
|
|
||||||
// Url with Version check args attached.
|
// Url with Version check args attached.
|
||||||
const wxString VerCheckUrl(){
|
const URLString VerCheckUrl()
|
||||||
|
{
|
||||||
//The version we intend to use for live Audacity.
|
//The version we intend to use for live Audacity.
|
||||||
#define VER_CHECK_URL "https://www.audacityteam.org/download/?"
|
#define VER_CHECK_URL "https://www.audacityteam.org/download/?"
|
||||||
//For testing of our scriptlet.
|
//For testing of our scriptlet.
|
||||||
|
|
|
@ -13,12 +13,17 @@
|
||||||
|
|
||||||
class TranslatableString;
|
class TranslatableString;
|
||||||
class wxString;
|
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 wxString HelpText( const wxString & Key );
|
||||||
AUDACITY_DLL_API TranslatableString TitleText( const wxString & Key );
|
AUDACITY_DLL_API TranslatableString TitleText( const wxString & Key );
|
||||||
|
|
||||||
extern AUDACITY_DLL_API const wxString VerCheckArgs();
|
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 const wxString VerCheckHtml();
|
||||||
extern AUDACITY_DLL_API wxString FormatHtmlText( const wxString & Text );
|
extern AUDACITY_DLL_API wxString FormatHtmlText( const wxString & Text );
|
||||||
|
|
||||||
|
|
|
@ -236,8 +236,8 @@ void HelpSystem::ShowHtmlText(wxWindow *pParent,
|
||||||
|
|
||||||
// Shows help in browser, or possibly in own dialog.
|
// Shows help in browser, or possibly in own dialog.
|
||||||
void HelpSystem::ShowHelp(wxWindow *parent,
|
void HelpSystem::ShowHelp(wxWindow *parent,
|
||||||
const wxString &localFileName,
|
const FilePath &localFileName,
|
||||||
const wxString &remoteURL,
|
const URLString &remoteURL,
|
||||||
bool bModal,
|
bool bModal,
|
||||||
bool alwaysDefaultBrowser)
|
bool alwaysDefaultBrowser)
|
||||||
{
|
{
|
||||||
|
@ -289,7 +289,7 @@ void HelpSystem::ShowHelp(wxWindow *parent,
|
||||||
// I can't find it'.
|
// I can't find it'.
|
||||||
// Use Built-in browser to suggest you use the remote url.
|
// Use Built-in browser to suggest you use the remote url.
|
||||||
wxString Text = HelpText( wxT("remotehelp") );
|
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.
|
// Always make the 'help on the internet' dialog modal.
|
||||||
// Fixes Bug 1411.
|
// Fixes Bug 1411.
|
||||||
ShowHtmlText( parent, XO("Help on the Internet"), Text, false, true );
|
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)
|
else if( HelpMode == wxT("Local") || alwaysDefaultBrowser)
|
||||||
{
|
{
|
||||||
// Local file, External browser
|
// Local file, External browser
|
||||||
OpenInDefaultBrowser( wxString(wxT("file:"))+localFileName );
|
OpenInDefaultBrowser( L"file:" + localFileName );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -310,7 +310,7 @@ void HelpSystem::ShowHelp(wxWindow *parent,
|
||||||
const wxString &PageName,
|
const wxString &PageName,
|
||||||
bool bModal)
|
bool bModal)
|
||||||
{
|
{
|
||||||
wxString localHelpPage;
|
FilePath localHelpPage;
|
||||||
wxString webHelpPath;
|
wxString webHelpPath;
|
||||||
wxString webHelpPage;
|
wxString webHelpPage;
|
||||||
wxString releasePageName;
|
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());
|
wxLaunchDefaultBrowser(uri.BuildURI());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -555,7 +555,7 @@ void LinkingHtmlWindow::OnLinkClicked(const wxHtmlLinkInfo& link)
|
||||||
}
|
}
|
||||||
else if( href.StartsWith(wxT("mailto:")) || href.StartsWith(wxT("file:")) )
|
else if( href.StartsWith(wxT("mailto:")) || href.StartsWith(wxT("file:")) )
|
||||||
{
|
{
|
||||||
OpenInDefaultBrowser( link );
|
OpenInDefaultBrowser( link.GetHref() );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if( !href.StartsWith( wxT("http:")) && !href.StartsWith( wxT("https:")) )
|
else if( !href.StartsWith( wxT("http:")) && !href.StartsWith( wxT("https:")) )
|
||||||
|
@ -564,7 +564,7 @@ void LinkingHtmlWindow::OnLinkClicked(const wxHtmlLinkInfo& link)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
OpenInDefaultBrowser(link);
|
OpenInDefaultBrowser(link.GetHref());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
wxFrame * pFrame = GetRelatedFrame();
|
wxFrame * pFrame = GetRelatedFrame();
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
|
|
||||||
#include <wx/defs.h>
|
#include <wx/defs.h>
|
||||||
#include "wxPanelWrapper.h" // to inherit
|
#include "wxPanelWrapper.h" // to inherit
|
||||||
|
#include "../HelpText.h"
|
||||||
|
|
||||||
class AudacityProject;
|
class AudacityProject;
|
||||||
|
|
||||||
|
@ -62,21 +63,25 @@ public:
|
||||||
/// OR else links to the internet. Generally using this outside this class
|
/// OR else links to the internet. Generally using this outside this class
|
||||||
/// is depreciated in favour of the "smarter" overload below, unless there
|
/// is depreciated in favour of the "smarter" overload below, unless there
|
||||||
/// is a good reason for using this form.
|
/// 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
|
/// @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 system to be opened. file.name#anchor syntax is allowed, and therefore
|
||||||
/// file names containing a '#' are not (on any platform).
|
/// 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.
|
/// @param bModal Whether the resulting dialogue should be modal or not.
|
||||||
/// Default is modeless dialogue
|
/// Default is modeless dialogue
|
||||||
/// @param alwaysDefaultBrowser Force use of default web browser.
|
/// @param alwaysDefaultBrowser Force use of default web browser.
|
||||||
/// Default allows built in browser for local files.
|
/// Default allows built in browser for local files.
|
||||||
static void ShowHelp(wxWindow *parent,
|
static void ShowHelp(wxWindow *parent,
|
||||||
const wxString &localFileName,
|
const FilePath &localFileName,
|
||||||
const wxString &remoteURL,
|
const URLString &remoteURL,
|
||||||
bool bModal = false,
|
bool bModal = false,
|
||||||
bool alwaysDefaultBrowser = false);
|
bool alwaysDefaultBrowser = false);
|
||||||
|
|
||||||
/// Displays a page from the Audacity manual in your browser, if
|
/// Displays a page from the Audacity manual in your browser, if
|
||||||
/// it's available locally, OR else links to the internet.
|
/// 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
|
/// @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
|
/// _development version_ of the manual (i.e. in MediaWiki), _not_ the
|
||||||
/// converted file name used for offline and released manuals.
|
/// converted file name used for offline and released manuals.
|
||||||
|
@ -115,7 +120,7 @@ class ShuttleGui;
|
||||||
|
|
||||||
#include "HtmlWindow.h" // to inherit
|
#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
|
/// \brief An HtmlWindow that handles linked clicked - usually the
|
||||||
|
|
Loading…
Reference in New Issue