MCPcopy Create free account
hub / github.com/audacity/audacity / OnOK

Method OnOK

src/PluginRegistrationDialog.cpp:351–392  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

349}
350
351void PluginRegistrationDialog::OnOK(wxCommandEvent & WXUNUSED(evt))
352{
353 auto result = ProgressResult::Success;
354 {
355 // Make sure the progress dialog is deleted before we call EndModal() or
356 // we will leave the project window in an unusable state on OSX.
357 // See bug #1192.
358 std::unique_ptr<ProgressDialog> dialog;
359 wxArrayString last3;
360 auto updateProgress = [&](int num, int denom, const wxString& msg)
361 {
362 last3.insert(last3.begin(), msg);
363 if(last3.size() > 3)
364 last3.pop_back();
365 if(!dialog)
366 {
367 dialog = std::make_unique<ProgressDialog>(
368 Verbatim( GetTitle() ),
369 TranslatableString {},
370 pdlgHideStopButton
371 );
372 dialog->CenterOnParent();
373 }
374 result = dialog->Update(
375 num,
376 denom,
377 TranslatableString(wxJoin(last3, '\n'), {})
378 );
379 return result == ProgressResult::Success;
380 };
381 auto onError = [](const TranslatableString& error) {
382 AudacityMessageBox(error);
383 };
384
385 mPluginsModel->ApplyChanges(updateProgress, onError);
386 }
387 if(result == ProgressResult::Success)
388 EndModal(wxID_OK);
389 else
390 ReloadModel();
391
392}
393
394void PluginRegistrationDialog::OnCancel(wxCommandEvent & WXUNUSED(evt))
395{

Callers

nothing calls this directly

Calls 8

VerbatimFunction · 0.85
AudacityMessageBoxFunction · 0.85
ApplyChangesMethod · 0.80
TranslatableStringClass · 0.70
insertMethod · 0.45
beginMethod · 0.45
sizeMethod · 0.45
UpdateMethod · 0.45

Tested by

no test coverage detected