1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-21 06:40:08 +02:00

re-organise the Help System functions into a class as static methods for future utility

This commit is contained in:
RichardAsh1981@gmail.com 2014-06-09 18:42:19 +00:00
parent 7e4f211c7b
commit fc3a7558ae
6 changed files with 27 additions and 18 deletions

View File

@ -5738,7 +5738,7 @@ void AudacityProject::OnHelpWelcome()
void AudacityProject::OnQuickHelp() void AudacityProject::OnQuickHelp()
{ {
ShowHelpDialog( HelpSystem::ShowHelpDialog(
this, this,
FileNames::HtmlHelpIndexFile(true), FileNames::HtmlHelpIndexFile(true),
wxT("http://manual.audacityteam.org/o/quick_help.html" )); wxT("http://manual.audacityteam.org/o/quick_help.html" ));
@ -5746,7 +5746,7 @@ void AudacityProject::OnQuickHelp()
void AudacityProject::OnManual() void AudacityProject::OnManual()
{ {
ShowHelpDialog( HelpSystem::ShowHelpDialog(
this, this,
FileNames::HtmlHelpIndexFile(false), FileNames::HtmlHelpIndexFile(false),
wxT("http://manual.audacityteam.org/o/" )); wxT("http://manual.audacityteam.org/o/" ));
@ -5773,7 +5773,7 @@ void AudacityProject::OnScreenshot()
void AudacityProject::OnAudioDeviceInfo() void AudacityProject::OnAudioDeviceInfo()
{ {
wxString info = gAudioIO->GetDeviceInfo(); wxString info = gAudioIO->GetDeviceInfo();
ShowInfoDialog( this, HelpSystem::ShowInfoDialog( this,
_("Audio Device Info"), _("Audio Device Info"),
wxT(""), wxT(""),
info, info,

View File

@ -550,7 +550,7 @@ void ExportMultiple::OnExport(wxCommandEvent& WXUNUSED(event))
FileList += '\n'; FileList += '\n';
} }
// This results dialog is a child of this dialog. // This results dialog is a child of this dialog.
ShowInfoDialog( this, HelpSystem::ShowInfoDialog( this,
_("Export Multiple"), _("Export Multiple"),
msg, msg,
FileList, FileList,

View File

@ -147,7 +147,7 @@ void ErrorDialog::OnHelp(wxCommandEvent & WXUNUSED(event))
{ {
if( dhelpURL.StartsWith(wxT("innerlink:")) ) if( dhelpURL.StartsWith(wxT("innerlink:")) )
{ {
ShowHtmlText( HelpSystem::ShowHtmlText(
this, this,
TitleText(dhelpURL.Mid( 10 ) ), TitleText(dhelpURL.Mid( 10 ) ),
HelpText( dhelpURL.Mid( 10 )), HelpText( dhelpURL.Mid( 10 )),

View File

@ -37,7 +37,7 @@
/// Mostly we use this so that we have the code for resizability /// Mostly we use this so that we have the code for resizability
/// in one place. Other considerations like screen readers are also /// in one place. Other considerations like screen readers are also
/// handled by having the code in one place. /// handled by having the code in one place.
void ShowInfoDialog( wxWindow *parent, void HelpSystem::ShowInfoDialog( wxWindow *parent,
const wxString &dlogTitle, const wxString &dlogTitle,
const wxString &shortMsg, const wxString &shortMsg,
const wxString &message, const wxString &message,
@ -77,7 +77,7 @@ void ShowInfoDialog( wxWindow *parent,
dlog.ShowModal(); dlog.ShowModal();
} }
void ShowHtmlText(wxWindow *pParent, void HelpSystem::ShowHtmlText(wxWindow *pParent,
const wxString &Title, const wxString &Title,
const wxString &HtmlText, const wxString &HtmlText,
bool bIsFile = false, bool bModal = false) bool bIsFile = false, bool bModal = false)
@ -164,7 +164,7 @@ void ShowHtmlText(wxWindow *pParent,
return; return;
} }
void ShowHelpDialog(wxWindow *parent, void HelpSystem::ShowHelpDialog(wxWindow *parent,
const wxString &localFileName, const wxString &localFileName,
const wxString &remoteURL) const wxString &remoteURL)
{ {

View File

@ -18,25 +18,34 @@
class AudacityProject; class AudacityProject;
/// Displays cutable information in a text ctrl, with an OK button. /** @brief Class which contains static methods and data needed for implementing
void ShowInfoDialog( wxWindow *parent, * help buttons
*
* This class should be the only place in the codebase where the location of
* the online copy of the Audacity manual is stored, so that it can be
* changed if required
*/
class HelpSystem
{
public:
/// Displays cutable information in a text ctrl, with an OK button.
static void ShowInfoDialog( wxWindow *parent,
const wxString &dlogTitle, const wxString &dlogTitle,
const wxString &shortMsg, const wxString &shortMsg,
const wxString &message, const wxString &message,
const int xSize, const int ySize); const int xSize, const int ySize);
/// Displays a new window with wxHTML help. /// Displays a new window with wxHTML help.
void ShowHtmlText( wxWindow * pParent, static void ShowHtmlText( wxWindow * pParent,
const wxString &Title, const wxString &Title,
const wxString &HtmlText, const wxString &HtmlText,
bool bIsFile, bool bModal); bool bIsFile, bool bModal);
/// Displays a file in your browser, if it's available locally, /// Displays a file in your browser, if it's available locally,
/// OR else links to the internet. /// OR else links to the internet.
void ShowHelpDialog(wxWindow *parent, static void ShowHelpDialog(wxWindow *parent,
const wxString &localFileName, const wxString &localFileName,
const wxString &remoteURL); const wxString &remoteURL);
};
#endif // __AUDACITY_HELPSYSTEM__ #endif // __AUDACITY_HELPSYSTEM__

View File

@ -99,7 +99,7 @@ void LinkingHtmlWindow::OnLinkClicked(const wxHtmlLinkInfo& link)
wxFileName( FileNames::HtmlHelpDir(), href.Mid( 10 ) + wxT(".htm") ).GetFullPath(); wxFileName( FileNames::HtmlHelpDir(), href.Mid( 10 ) + wxT(".htm") ).GetFullPath();
if( wxFileExists( FileName ) ) if( wxFileExists( FileName ) )
{ {
ShowHelpDialog(NULL, FileName, wxT("")); HelpSystem::ShowHelpDialog(NULL, FileName, wxT(""));
return; return;
} }
else else