Eliminate mention of wxString from ErrorDialog.h ...

... whether std::wstring is the best alternative type, or whether we should
use UTF8 encoded std::string -- I wish to defer that, and revisit it later
This commit is contained in:
Paul Licameli 2021-06-06 16:37:54 -04:00
parent 132f04d272
commit 4b02e562b3
4 changed files with 17 additions and 10 deletions

View File

@ -19,6 +19,7 @@ Paul Licameli split from AudacityProject.cpp
#include <wx/xml/xml.h> #include <wx/xml/xml.h>
#include "ActiveProjects.h" #include "ActiveProjects.h"
#include "CodeConversions.h"
#include "DBConnection.h" #include "DBConnection.h"
#include "Project.h" #include "Project.h"
#include "ProjectFileIORegistry.h" #include "ProjectFileIORegistry.h"
@ -2316,7 +2317,8 @@ void ProjectFileIO::ShowError(wxWindow *parent,
const TranslatableString &message, const TranslatableString &message,
const wxString &helpPage) const wxString &helpPage)
{ {
ShowExceptionDialog(parent, dlogTitle, message, helpPage, true, GetLastLog()); ShowExceptionDialog(parent, dlogTitle, message, helpPage, true,
audacity::ToWString(GetLastLog()));
} }
const TranslatableString &ProjectFileIO::GetLastError() const const TranslatableString &ProjectFileIO::GetLastError() const

View File

@ -17,6 +17,7 @@ Paul Licameli split from AudacityProject.cpp
#endif #endif
#include <wx/frame.h> #include <wx/frame.h>
#include "CodeConversions.h"
#include "Legacy.h" #include "Legacy.h"
#include "PlatformCompatibility.h" #include "PlatformCompatibility.h"
#include "Project.h" #include "Project.h"
@ -776,7 +777,7 @@ bool ProjectFileManager::OpenNewProject()
XO("Error opening a new empty project"), XO("Error opening a new empty project"),
"FAQ:Errors_opening_a_new_empty_project", "FAQ:Errors_opening_a_new_empty_project",
true, true,
projectFileIO.GetLastLog()); audacity::ToWString(projectFileIO.GetLastLog()));
} }
return bOK; return bOK;
} }

View File

@ -33,6 +33,7 @@
#include <wx/artprov.h> #include <wx/artprov.h>
#include "../AllThemeResources.h" #include "../AllThemeResources.h"
#include "CodeConversions.h"
#include "../ShuttleGui.h" #include "../ShuttleGui.h"
#include "../HelpText.h" #include "../HelpText.h"
#include "../Prefs.h" #include "../Prefs.h"
@ -53,7 +54,7 @@ ErrorDialog::ErrorDialog(
const TranslatableString & dlogTitle, const TranslatableString & dlogTitle,
const TranslatableString & message, const TranslatableString & message,
const ManualPageID & helpPage, const ManualPageID & helpPage,
const wxString & log, const std::wstring & log,
const bool Close, const bool modal) const bool Close, const bool modal)
: wxDialogWrapper(parent, wxID_ANY, dlogTitle, : wxDialogWrapper(parent, wxID_ANY, dlogTitle,
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
@ -155,7 +156,7 @@ void ShowErrorDialog(wxWindow *parent,
const TranslatableString &message, const TranslatableString &message,
const ManualPageID &helpPage, const ManualPageID &helpPage,
const bool Close, const bool Close,
const wxString &log) const std::wstring &log)
{ {
ErrorDialog dlog(parent, dlogTitle, message, helpPage, log, Close); ErrorDialog dlog(parent, dlogTitle, message, helpPage, log, Close);
dlog.CentreOnParent(); dlog.CentreOnParent();
@ -169,9 +170,11 @@ void ShowExceptionDialog(
const wxString& log) const wxString& log)
{ {
#ifndef HAS_SENTRY_REPORTING #ifndef HAS_SENTRY_REPORTING
ShowErrorDialog(parent, dlogTitle, message, helpPage, Close, log); ShowErrorDialog(parent, dlogTitle, message, helpPage, Close,
audacity::ToWString(log));
#else #else
ShowErrorReportDialog(parent, dlogTitle, message, helpPage, log); ShowErrorReportDialog(parent, dlogTitle, message, helpPage,
audacity::ToWString(log));
#endif // !HAS_SENTRY_REPORTING #endif // !HAS_SENTRY_REPORTING
} }
@ -181,7 +184,7 @@ void ShowModelessErrorDialog(wxWindow *parent,
const TranslatableString &message, const TranslatableString &message,
const ManualPageID &helpPage, const ManualPageID &helpPage,
const bool Close, const bool Close,
const wxString &log) const std::wstring &log)
{ {
// ensure it has some parent. // ensure it has some parent.
if( !parent ) if( !parent )

View File

@ -14,6 +14,7 @@
#include <string>
#include <wx/defs.h> #include <wx/defs.h>
#include <wx/msgdlg.h> // to inherit #include <wx/msgdlg.h> // to inherit
#include "wxPanelWrapper.h" // to inherit #include "wxPanelWrapper.h" // to inherit
@ -29,7 +30,7 @@ public:
const TranslatableString & dlogTitle, const TranslatableString & dlogTitle,
const TranslatableString & message, const TranslatableString & message,
const ManualPageID & helpPage, const ManualPageID & helpPage,
const wxString & log, const std::wstring & log,
const bool Close = true, const bool modal = true); const bool Close = true, const bool modal = true);
virtual ~ErrorDialog(){} virtual ~ErrorDialog(){}
@ -52,7 +53,7 @@ void ShowErrorDialog(wxWindow *parent,
const TranslatableString &message, const TranslatableString &message,
const ManualPageID &helpPage, const ManualPageID &helpPage,
bool Close = true, bool Close = true,
const wxString &log = {}); const std::wstring &log = {});
/// Displays an error dialog, possibly allowing to send error report. /// Displays an error dialog, possibly allowing to send error report.
AUDACITY_DLL_API AUDACITY_DLL_API
@ -67,7 +68,7 @@ void ShowModelessErrorDialog(wxWindow *parent,
const TranslatableString &message, const TranslatableString &message,
const ManualPageID &helpPage, const ManualPageID &helpPage,
bool Close = true, bool Close = true,
const wxString &log = {}); const std::wstring &log = {});
#include <wx/textdlg.h> // to inherit #include <wx/textdlg.h> // to inherit