17#include <wx/checkbox.h>
19#include <wx/statline.h>
20#include <wx/stattext.h>
47 if (identifier.
empty())
50 return wxString::Format(
"/cloud/audiocom/%s/skip", identifier.
GET());
58 mDialogSizer->AddStretchSpacer(1);
64 wxSizerFlags {}.Border(wxTOP, 16).Expand());
65 mDialogSizer->AddSpacer(8);
68 mDialogSizer->AddSpacer(16);
71 mButtonSizer, wxSizerFlags {}.Border(wxLEFT | wxRIGHT, 16).Expand());
72 mDialogSizer->AddSpacer(8);
74 SetSizerAndFit(mDialogSizer);
79 if (!mOptionalPrefsIdentifier.empty())
82 return mEscButtonIdentifier;
89 wxWindowDisabler disabler {
this };
98 if (
auto result = poller(); !result.empty())
104 if (
auto parent = GetParent())
109 return mResultButtonIdentifier.empty() ? mEscButtonIdentifier :
110 mResultButtonIdentifier;
115 return { L
"Cancel" };
123 XO(
"Save to audio.com") :
124 XO(
"Open from audio.com") }
127 optionalPrefsIdentifier) }
128 , mDialogSizer { new wxBoxSizer(wxVERTICAL) }
129 , mButtonSizer { new wxBoxSizer(wxHORIZONTAL) }
134 const auto skipDialog =
138 safenew wxCheckBox {
this, wxID_ANY,
139 XO(
"Don't show this again").Translation() };
141 checkbox->SetValue(skipDialog);
143 mButtonSizer->Add(checkbox, wxSizerFlags {}.CenterVertical());
147 [
this, checkbox](
auto&)
160 if (!IsEscapeKey(evt))
172 auto font = GetFont().Bold();
174 font.SetFractionalPointSize(font.GetFractionalPointSize() * 1.5f);
176 auto statText =
safenew wxStaticText {
this, wxID_ANY,
title.Translation() };
178 statText->SetFont(font);
181 mDialogSizer->Add(statText, wxSizerFlags {}.Border(wxLEFT | wxRIGHT, 16));
190 mDialogSizer->Add(statText, wxSizerFlags {}.Border(wxLEFT | wxRIGHT, 16));
200 mButtonSizer->Add(button, wxSizerFlags {}.Border(wxLEFT, 8));
206 wxEVT_BUTTON, [
this, identifier = std::move(identifier)](
auto&)
210 button->SetDefault();
255 for (
auto it =
Items.begin(); it !=
Items.end();)
261 auto swapFlag =
finally([
this] { IdlerLocked =
false; });
264 it =
Items.erase(it);
274 std::function<
bool()> condition, std::function<
void()> dialogFactory)
278 idler.Items.push_back({ std::move(condition), std::move(dialogFactory) });
void SetupAccessibility(wxWindow *window)
audacity::BasicSettings * gPrefs
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
const wxString & GET() const
Explicit conversion to wxString, meant to be ugly-looking and demanding of a comment why it's correct...
A move-only handle representing a connection to a Publisher.
static ProjectWindow & Get(AudacityProject &project)
Holds a msgid for the translation catalog; may also bind format arguments.
wxString Translation() const
virtual bool Flush() noexcept=0
virtual bool Write(const wxString &key, bool value)=0
bool ReadBool(const wxString &key, bool defaultValue) const
DialogIdentifier mOptionalPrefsIdentifier
virtual bool HasSeparator() const
void AddTitle(const TranslatableString &title)
void AddButton(DialogButtonIdentifier identifier, const TranslatableString &text, int type=None)
DialogButtonIdentifier ShowDialog(std::function< DialogButtonIdentifier()> poller={})
DialogButtonIdentifier mResultButtonIdentifier
wxBoxSizer * mDialogSizer
DialogButtonIdentifier mEscButtonIdentifier
AudioComDialogBase(const AudacityProject *project, const DialogIdentifier &optionalPrefsIdentifier={}, DialogMode dialogMode=DialogMode::Saving)
wxBoxSizer * mButtonSizer
void AddParagraph(const TranslatableString ¶graph)
void SetDialogTitle(const TranslatableString &dialog)
void EndDialog(DialogButtonIdentifier identifier)
static DialogButtonIdentifier CancelButtonIdentifier()
void SetTitle(const TranslatableString &title)
Observer::Subscription OnAppIdle(std::function< void()> callback)
IMPORT_EXPORT_API ExportResult Show(ExportTask exportTask)
wxString GetOptionalPrefsIdentifier(const DialogIdentifier &identifier)
wxWindow * GetProjectWindow(const AudacityProject *project)
TaggedIdentifier< DialogButtonIdentifierTag > DialogButtonIdentifier
void ShowDialogOn(std::function< bool()> condition, std::function< void()> dialogFactory)
std::function< void()> DialogFactory
std::function< bool()> Condition
Observer::Subscription Subsctiption
std::list< IdleItem > Items