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