mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-17 16:40:07 +02:00
MultiDialog uses ShuttleGui, and TranslatableString for title
This commit is contained in:
parent
75b3ad7c61
commit
093ffbd2f1
@ -271,9 +271,8 @@ void ModuleManager::Initialize(CommandHandler &cmdHandler)
|
|||||||
// and let the user decide for each one.
|
// and let the user decide for each one.
|
||||||
{
|
{
|
||||||
wxString ShortName = wxFileName( files[i] ).GetName();
|
wxString ShortName = wxFileName( files[i] ).GetName();
|
||||||
wxString msg;
|
auto msg = XO("Module \"%s\" found.").Format( ShortName );
|
||||||
msg.Printf(_("Module \"%s\" found."), ShortName);
|
msg += XO("\n\nOnly use modules from trusted sources");
|
||||||
msg += _("\n\nOnly use modules from trusted sources");
|
|
||||||
const TranslatableStrings buttons{
|
const TranslatableStrings buttons{
|
||||||
XO("Yes"), XO("No"),
|
XO("Yes"), XO("No"),
|
||||||
}; // could add a button here for 'yes and remember that', and put it into the cfg file. Needs more thought.
|
}; // could add a button here for 'yes and remember that', and put it into the cfg file. Needs more thought.
|
||||||
|
@ -55,7 +55,7 @@ int ProjectFSCK(
|
|||||||
This error message is about the tags that hold the sequence information.
|
This error message is about the tags that hold the sequence information.
|
||||||
The error message is confusing to users in English, and could just say
|
The error message is confusing to users in English, and could just say
|
||||||
"Found problems with <sequence> when checking project file." */
|
"Found problems with <sequence> when checking project file." */
|
||||||
wxString msg = _("Project check read faulty Sequence tags.");
|
auto msg = XO("Project check read faulty Sequence tags.");
|
||||||
const TranslatableStrings buttons{
|
const TranslatableStrings buttons{
|
||||||
XO("Close project immediately with no changes"),
|
XO("Close project immediately with no changes"),
|
||||||
XO("Continue with repairs noted in log, and check for more errors. This will save the project in its current state, unless you \"Close project immediately\" on further error alerts.")
|
XO("Continue with repairs noted in log, and check for more errors. This will save the project in its current state, unless you \"Close project immediately\" on further error alerts.")
|
||||||
@ -95,8 +95,8 @@ int ProjectFSCK(
|
|||||||
action = 2;
|
action = 2;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxString msgA =
|
auto msg =
|
||||||
_("Project check of \"%s\" folder \
|
XO("Project check of \"%s\" folder \
|
||||||
\ndetected %lld missing external audio file(s) \
|
\ndetected %lld missing external audio file(s) \
|
||||||
\n('aliased files'). There is no way for Audacity \
|
\n('aliased files'). There is no way for Audacity \
|
||||||
\nto recover these files automatically. \
|
\nto recover these files automatically. \
|
||||||
@ -107,9 +107,10 @@ _("Project check of \"%s\" folder \
|
|||||||
\nmay not show silence. \
|
\nmay not show silence. \
|
||||||
\n\nIf you choose the third option, this will save the \
|
\n\nIf you choose the third option, this will save the \
|
||||||
\nproject in its current state, unless you \"Close \
|
\nproject in its current state, unless you \"Close \
|
||||||
\nproject immediately\" on further error alerts.");
|
\nproject immediately\" on further error alerts.")
|
||||||
wxString msg;
|
.Format(
|
||||||
msg.Printf(msgA, dm.GetProjectName(), (long long) missingAliasFilesPathHash.size());
|
dm.GetProjectName(),
|
||||||
|
(long long) missingAliasFilesPathHash.size() );
|
||||||
const TranslatableStrings buttons{
|
const TranslatableStrings buttons{
|
||||||
XO("Close project immediately with no changes"),
|
XO("Close project immediately with no changes"),
|
||||||
XO("Treat missing audio as silence (this session only)"),
|
XO("Treat missing audio as silence (this session only)"),
|
||||||
@ -181,13 +182,13 @@ _("Project check of \"%s\" folder \
|
|||||||
action = 0;
|
action = 0;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxString msgA =
|
auto msg =
|
||||||
_("Project check of \"%s\" folder \
|
XO("Project check of \"%s\" folder \
|
||||||
\ndetected %lld missing alias (.auf) blockfile(s). \
|
\ndetected %lld missing alias (.auf) blockfile(s). \
|
||||||
\nAudacity can fully regenerate these files \
|
\nAudacity can fully regenerate these files \
|
||||||
\nfrom the current audio in the project.");
|
\nfrom the current audio in the project.")
|
||||||
wxString msg;
|
.Format(
|
||||||
msg.Printf(msgA, dm.GetProjectName(), (long long) missingAUFHash.size());
|
dm.GetProjectName(), (long long) missingAUFHash.size() );
|
||||||
const TranslatableStrings buttons{
|
const TranslatableStrings buttons{
|
||||||
XO("Regenerate alias summary files (safe and recommended)"),
|
XO("Regenerate alias summary files (safe and recommended)"),
|
||||||
XO("Fill in silence for missing display data (this session only)"),
|
XO("Fill in silence for missing display data (this session only)"),
|
||||||
@ -248,8 +249,8 @@ _("Project check of \"%s\" folder \
|
|||||||
action = 2;
|
action = 2;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxString msgA =
|
auto msg =
|
||||||
_("Project check of \"%s\" folder \
|
XO("Project check of \"%s\" folder \
|
||||||
\ndetected %lld missing audio data (.au) blockfile(s), \
|
\ndetected %lld missing audio data (.au) blockfile(s), \
|
||||||
\nprobably due to a bug, system crash, or accidental \
|
\nprobably due to a bug, system crash, or accidental \
|
||||||
\ndeletion. There is no way for Audacity to recover \
|
\ndeletion. There is no way for Audacity to recover \
|
||||||
@ -258,9 +259,9 @@ _("Project check of \"%s\" folder \
|
|||||||
\nyou can try to find and restore the missing files \
|
\nyou can try to find and restore the missing files \
|
||||||
\nto their previous location. \
|
\nto their previous location. \
|
||||||
\n\nNote that for the second option, the waveform \
|
\n\nNote that for the second option, the waveform \
|
||||||
\nmay not show silence.");
|
\nmay not show silence.")
|
||||||
wxString msg;
|
.Format(
|
||||||
msg.Printf(msgA, dm.GetProjectName(), (long long) missingAUHash.size());
|
dm.GetProjectName(), (long long) missingAUHash.size() );
|
||||||
const TranslatableStrings buttons{
|
const TranslatableStrings buttons{
|
||||||
XO("Close project immediately with no further changes"),
|
XO("Close project immediately with no further changes"),
|
||||||
XO("Treat missing audio as silence (this session only)"),
|
XO("Treat missing audio as silence (this session only)"),
|
||||||
@ -325,14 +326,13 @@ _("Project check of \"%s\" folder \
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxString msgA =
|
auto msg =
|
||||||
_("Project check of \"%s\" folder \
|
XO("Project check of \"%s\" folder \
|
||||||
\nfound %d orphan block file(s). These files are \
|
\nfound %d orphan block file(s). These files are \
|
||||||
\nunused by this project, but might belong to \
|
\nunused by this project, but might belong to \
|
||||||
other projects. \
|
other projects. \
|
||||||
\nThey are doing no harm and are small.");
|
\nThey are doing no harm and are small.")
|
||||||
wxString msg;
|
.Format( dm.GetProjectName(), (int)orphanFilePathArray.size() );
|
||||||
msg.Printf(msgA, dm.GetProjectName(), (int)orphanFilePathArray.size());
|
|
||||||
|
|
||||||
const TranslatableStrings buttons{
|
const TranslatableStrings buttons{
|
||||||
XO("Continue without deleting; ignore the extra files this session"),
|
XO("Continue without deleting; ignore the extra files this session"),
|
||||||
|
@ -21,6 +21,8 @@ for each problem encountered, since there can be many orphans.
|
|||||||
#include "../Audacity.h"
|
#include "../Audacity.h"
|
||||||
#include "MultiDialog.h"
|
#include "MultiDialog.h"
|
||||||
|
|
||||||
|
#include "../ShuttleGui.h"
|
||||||
|
|
||||||
#include <wx/app.h>
|
#include <wx/app.h>
|
||||||
#include <wx/button.h>
|
#include <wx/button.h>
|
||||||
#include <wx/dialog.h>
|
#include <wx/dialog.h>
|
||||||
@ -39,7 +41,7 @@ class MultiDialog final : public wxDialogWrapper
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MultiDialog(wxWindow * pParent,
|
MultiDialog(wxWindow * pParent,
|
||||||
wxString message,
|
const TranslatableString &message,
|
||||||
const TranslatableString &title,
|
const TranslatableString &title,
|
||||||
const TranslatableStrings &buttons,
|
const TranslatableStrings &buttons,
|
||||||
const TranslatableString &boxMsg, bool log);
|
const TranslatableString &boxMsg, bool log);
|
||||||
@ -62,7 +64,7 @@ BEGIN_EVENT_TABLE(MultiDialog, wxDialogWrapper)
|
|||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
MultiDialog::MultiDialog(wxWindow * pParent,
|
MultiDialog::MultiDialog(wxWindow * pParent,
|
||||||
wxString message,
|
const TranslatableString &message,
|
||||||
const TranslatableString &title,
|
const TranslatableString &title,
|
||||||
const TranslatableStrings &buttons,
|
const TranslatableStrings &buttons,
|
||||||
const TranslatableString &boxMsg, bool log)
|
const TranslatableString &boxMsg, bool log)
|
||||||
@ -72,27 +74,25 @@ MultiDialog::MultiDialog(wxWindow * pParent,
|
|||||||
{
|
{
|
||||||
SetName();
|
SetName();
|
||||||
|
|
||||||
wxBoxSizer *mainSizer;
|
ShuttleGui S{ this, eIsCreating };
|
||||||
{
|
{
|
||||||
auto uMainSizer = std::make_unique<wxBoxSizer>(wxVERTICAL);
|
S.SetBorder( 5 );
|
||||||
mainSizer = uMainSizer.get();
|
S.StartVerticalLay( 0 );
|
||||||
|
|
||||||
{
|
{
|
||||||
auto vSizer = std::make_unique<wxBoxSizer>(wxVERTICAL);
|
S.StartHorizontalLay(wxALIGN_LEFT | wxALL, 0);
|
||||||
{
|
{
|
||||||
auto iconAndTextSizer = std::make_unique<wxBoxSizer>(wxHORIZONTAL);
|
S.SetBorder( 0 );
|
||||||
|
|
||||||
wxBitmap bitmap = wxArtProvider::GetIcon(wxART_WARNING,
|
wxBitmap bitmap = wxArtProvider::GetIcon(wxART_WARNING,
|
||||||
wxART_MESSAGE_BOX);
|
wxART_MESSAGE_BOX);
|
||||||
wxStaticBitmap *icon = safenew wxStaticBitmap(this, -1, bitmap);
|
auto icon = safenew wxStaticBitmap(S.GetParent(), -1, bitmap);
|
||||||
iconAndTextSizer->Add(icon, 0, wxCENTER);
|
S
|
||||||
|
.Position( wxCENTER )
|
||||||
|
.AddWindow( icon );
|
||||||
|
|
||||||
wxStaticText *statText = safenew wxStaticText(this, -1, message);
|
S.SetBorder( 15 );
|
||||||
statText->SetName(message); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs)
|
S.Prop(1).AddVariableText( message, false, wxCENTER | wxLEFT );
|
||||||
iconAndTextSizer->Add(statText, 1, wxCENTER | wxLEFT, 15);
|
|
||||||
|
|
||||||
vSizer->Add(iconAndTextSizer.release(), 0, wxALIGN_LEFT | wxALL, 5);
|
|
||||||
}
|
}
|
||||||
|
S.EndHorizontalLay();
|
||||||
|
|
||||||
const auto buttonLabels = transform_container<wxArrayStringEx>(
|
const auto buttonLabels = transform_container<wxArrayStringEx>(
|
||||||
buttons, std::mem_fn( &TranslatableString::Translation ) );
|
buttons, std::mem_fn( &TranslatableString::Translation ) );
|
||||||
@ -101,46 +101,45 @@ MultiDialog::MultiDialog(wxWindow * pParent,
|
|||||||
|
|
||||||
const auto boxStr = boxMsg.Translation();
|
const auto boxStr = boxMsg.Translation();
|
||||||
|
|
||||||
mRadioBox = safenew wxRadioBox(this, -1,
|
S.SetBorder( 5 );
|
||||||
|
|
||||||
|
mRadioBox = safenew wxRadioBox(S.GetParent(), -1,
|
||||||
boxStr,
|
boxStr,
|
||||||
wxDefaultPosition, wxDefaultSize,
|
wxDefaultPosition, wxDefaultSize,
|
||||||
count, count ? &buttonLabels[0] : nullptr,
|
count, count ? &buttonLabels[0] : nullptr,
|
||||||
1, wxRA_SPECIFY_COLS);
|
1, wxRA_SPECIFY_COLS);
|
||||||
mRadioBox->SetName(boxStr);
|
|
||||||
mRadioBox->SetSelection(0);
|
mRadioBox->SetSelection(0);
|
||||||
vSizer->Add(mRadioBox, 1, wxEXPAND | wxALL, 5);
|
S.Prop( 1 )
|
||||||
|
.Name( boxMsg )
|
||||||
|
.Position(wxEXPAND | wxALL)
|
||||||
|
.AddWindow( mRadioBox );
|
||||||
|
|
||||||
|
|
||||||
|
S.StartHorizontalLay(wxALIGN_CENTER | wxALL, 0);
|
||||||
{
|
{
|
||||||
auto buttonSizer = std::make_unique<wxBoxSizer>(wxHORIZONTAL);
|
|
||||||
|
|
||||||
wxButton* pButton;
|
|
||||||
if (log)
|
if (log)
|
||||||
{
|
{
|
||||||
pButton = safenew wxButton(this, ID_SHOW_LOG_BUTTON, _("Show Log for Details"));
|
S
|
||||||
buttonSizer->Add(pButton, 0, wxALIGN_LEFT | wxALL, 5);
|
.Id( ID_SHOW_LOG_BUTTON )
|
||||||
pButton->SetDefault(); // Encourage user to look at files.
|
.AddButton(
|
||||||
|
XO("Show Log for Details"), wxALIGN_LEFT | wxALL,
|
||||||
|
// set default to encourage user to look at files.
|
||||||
|
true );
|
||||||
|
|
||||||
buttonSizer->AddSpacer(40);
|
S.AddSpace( 40, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
pButton = safenew wxButton(this, wxID_OK, _("OK"));
|
auto pButton = S.Id( wxID_OK )
|
||||||
if (!log)
|
.AddButton( XO("OK"), wxALIGN_CENTER, !log );
|
||||||
pButton->SetDefault();
|
|
||||||
buttonSizer->Add(pButton, 0, wxALL, 5);
|
|
||||||
|
|
||||||
vSizer->Add(buttonSizer.release(), 0, wxALIGN_CENTER | wxALL, 5);
|
|
||||||
}
|
}
|
||||||
|
S.EndHorizontalLay();
|
||||||
mainSizer->Add(vSizer.release(), 0, wxALL, 5);
|
}
|
||||||
|
S.EndVerticalLay();
|
||||||
}
|
}
|
||||||
|
|
||||||
SetAutoLayout(true);
|
SetAutoLayout(true);
|
||||||
SetSizer(uMainSizer.release());
|
GetSizer()->Fit(this);
|
||||||
}
|
GetSizer()->SetSizeHints(this);
|
||||||
|
|
||||||
mainSizer->Fit(this);
|
|
||||||
mainSizer->SetSizeHints(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MultiDialog::OnOK(wxCommandEvent & WXUNUSED(event))
|
void MultiDialog::OnOK(wxCommandEvent & WXUNUSED(event))
|
||||||
@ -157,7 +156,7 @@ void MultiDialog::OnShowLog(wxCommandEvent & WXUNUSED(event))
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int ShowMultiDialog(const wxString &message,
|
int ShowMultiDialog(const TranslatableString &message,
|
||||||
const TranslatableString &title,
|
const TranslatableString &title,
|
||||||
const TranslatableStrings &buttons,
|
const TranslatableStrings &buttons,
|
||||||
const TranslatableString &boxMsg, bool log)
|
const TranslatableString &boxMsg, bool log)
|
||||||
|
@ -24,7 +24,7 @@ const TranslatableString &DefaultMultiDialogMessage();
|
|||||||
|
|
||||||
// Display a dialog with radio buttons.
|
// Display a dialog with radio buttons.
|
||||||
// Return the zero-based index of the chosen button.
|
// Return the zero-based index of the chosen button.
|
||||||
int ShowMultiDialog(const wxString &message,
|
int ShowMultiDialog(const TranslatableString &message,
|
||||||
const TranslatableString &title,
|
const TranslatableString &title,
|
||||||
const TranslatableStrings &buttons,
|
const TranslatableStrings &buttons,
|
||||||
const TranslatableString &boxMsg
|
const TranslatableString &boxMsg
|
||||||
|
Loading…
x
Reference in New Issue
Block a user