Audacity 3.2.0
IncompatiblePluginsDialog.cpp
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 @file IncompatiblePluginsDialog.cpp
6
7 @author Vitaly Sverchinsky
8
9**********************************************************************/
11
12#include <wx/sizer.h>
13#include <wx/stattext.h>
14#include <wx/textctrl.h>
15#include <wx/button.h>
16
17#include "Internat.h"
18#include "BasicUI.h"
19#include "MenuCreator.h"
21
23 wxWindow* parent,
24 wxWindowID id,
25 enum ScanType scanType,
26 const std::vector<wxString>& plugins,
27 const wxPoint& pos,
28 const wxSize& size)
29 : wxDialogWrapper(parent, id, XO("New Plugins"), pos, size, wxDEFAULT_DIALOG_STYLE, XO("New Plugins"))
30 , m_scanType(scanType)
31{
32 SetSize(635, 414);
33 auto layout = std::make_unique<wxBoxSizer>(wxVERTICAL);
34
35 layout->AddSpacer(40);
36
37 auto header = safenew wxStaticText(this, wxID_ANY, _("Incompatible plugin(s) found"));
38 header->SetFont(wxFont(wxFontInfo(12).Bold(true)));
39 layout->Add(header, 0, wxLEFT | wxRIGHT, 40);
40 layout->AddSpacer(10);
41
42 mText = safenew wxStaticText(this, wxID_ANY, wxEmptyString);
43 mText->SetFont(wxFont(wxFontInfo(10)));
44
45 layout->Add(mText, 0, wxLEFT | wxRIGHT, 40);
46 layout->AddSpacer(40);
47
48 mPluginList = safenew wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY | wxTE_MULTILINE | wxNO_BORDER);
49 layout->Add(mPluginList, 1, wxEXPAND | wxLEFT | wxRIGHT, 40);
50
51 auto buttonsLayout = std::make_unique<wxBoxSizer>(wxHORIZONTAL);
52
54 {
55 auto pluginManagerButton = safenew wxButton(this, wxID_ANY, _("&Manage Plugins"));
56 pluginManagerButton->Bind(wxEVT_BUTTON, &IncompatiblePluginsDialog::OnPluginManagerClicked, this);
57 buttonsLayout->Add(pluginManagerButton);
58
59 buttonsLayout->AddSpacer(15);
60 }
61
62 auto continueButton = safenew wxButton(this, wxID_OK,
64 ? _("C&ontinue")
65 : _("&OK")
66 );
67 continueButton->SetDefault();
68 continueButton->SetFocusFromKbd();
69
70 buttonsLayout->Add(continueButton);
71 layout->Add(buttonsLayout.release(), 0, wxALIGN_RIGHT | wxALL, 15);
72
73 if(!plugins.empty())
74 SetPlugins(plugins);
75
76 SetSizer(layout.release());
77}
78
79void IncompatiblePluginsDialog::SetPlugins(const std::vector<wxString>& plugins)
80{
82 {
83 mText->SetLabelText(XO(
84 "Audacity has found %d incompatible plugins which could "\
85 "not be loaded. We have disabled these plugins to avoid any "\
86 "stalling or crashes. If you would still like to attempt "\
87 "to use these plugins, you can enable them using "\
88 "\"Manage Plugins\". Otherwise, select \"Continue\".")
89 .Format(static_cast<int>(plugins.size())).Translation());
90 }
91 else
92 {
93 mText->SetLabelText(XO(
94 "Audacity has found %d incompatible plugins which could "\
95 "not be loaded. We have disabled these plugins to avoid any "\
96 "stalling or crashes.")
97 .Format(static_cast<int>(plugins.size())).Translation());
98 }
99 mText->Wrap(GetClientSize().GetWidth() - 80);
100
101 wxString pluginListText;
102 for(const auto& path : plugins)
103 pluginListText += path + "\n";
104
105 mPluginList->SetValue(pluginListText);
106}
107
109{
110 Destroy();
112 {
113 PluginRegistrationDialog dlg(nullptr);
114 if(dlg.ShowModal() == wxID_OK)
116 });
117}
118
120{
121 Close();
122}
Toolkit-neutral facade for basic user interface services.
XO("Cut/Copy/Paste")
#define _(s)
Definition: Internat.h:73
#define safenew
Definition: MemoryX.h:10
int id
Abstract base class used in importing a file.
void OnContinueClicked(wxCommandEvent &)
void OnPluginManagerClicked(wxCommandEvent &)
void SetPlugins(const std::vector< wxString > &plugins)
IncompatiblePluginsDialog(wxWindow *parent, wxWindowID id, ScanType scanType, const std::vector< wxString > &plugins={ }, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize)
static void RebuildAllMenuBars()
void CallAfter(Action action)
Schedule an action to be done later, and in the main thread.
Definition: BasicUI.cpp:214