Ask to scan for missing plugins

When plugins have not been scanned, and a session with
missing plugins is opened, ask to scan plugins.

This also consolidates translatable strings with plugin-selector.
This commit is contained in:
Robin Gareus 2021-07-07 00:17:17 +02:00
parent e5de39c861
commit 95bf443735
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04
4 changed files with 50 additions and 18 deletions

View file

@ -50,6 +50,7 @@
#include "ardour/audioengine.h" #include "ardour/audioengine.h"
#include "ardour/filename_extensions.h" #include "ardour/filename_extensions.h"
#include "ardour/plugin_manager.h"
#include "ardour/profile.h" #include "ardour/profile.h"
#include "ardour/session.h" #include "ardour/session.h"
#include "ardour/session_utils.h" #include "ardour/session_utils.h"
@ -62,6 +63,7 @@
#include "missing_filesource_dialog.h" #include "missing_filesource_dialog.h"
#include "missing_plugin_dialog.h" #include "missing_plugin_dialog.h"
#include "opts.h" #include "opts.h"
#include "plugin_scan_dialog.h"
#include "public_editor.h" #include "public_editor.h"
#include "save_as_dialog.h" #include "save_as_dialog.h"
#include "session_dialog.h" #include "session_dialog.h"
@ -480,9 +482,17 @@ ARDOUR_UI::load_session_stage_two (const std::string& path, const std::string& s
} }
{ {
list<string> const u = new_session->unknown_processors (); list<string> const u = new_session->unknown_processors ();
bool scan_now = false;
if (!u.empty()) { if (!u.empty()) {
MissingPluginDialog d (_session, u); MissingPluginDialog d (_session, u, PluginManager::instance ().cache_valid ());
d.run (); if (d.run () == RESPONSE_YES) {
scan_now = true;
}
}
if (scan_now) {
PluginScanDialog psd (false, true);
psd.start ();
show_plugin_manager ();
} }
} }

View file

@ -20,7 +20,10 @@
*/ */
#include <gtkmm/label.h> #include <gtkmm/label.h>
#include "pbd/compose.h"
#include "missing_plugin_dialog.h" #include "missing_plugin_dialog.h"
#include "pbd/i18n.h" #include "pbd/i18n.h"
using namespace Gtk; using namespace Gtk;
@ -28,7 +31,7 @@ using namespace std;
using namespace ARDOUR; using namespace ARDOUR;
using namespace PBD; using namespace PBD;
MissingPluginDialog::MissingPluginDialog (Session * s, list<string> const & plugins) MissingPluginDialog::MissingPluginDialog (Session* s, list<string> const & plugins, bool cache_valid)
: ArdourDialog (_("Missing Plugins"), true, false) : ArdourDialog (_("Missing Plugins"), true, false)
{ {
/* This dialog is always shown programatically. Center the window.*/ /* This dialog is always shown programatically. Center the window.*/
@ -36,22 +39,34 @@ MissingPluginDialog::MissingPluginDialog (Session * s, list<string> const & plug
set_session (s); set_session (s);
add_button (_("OK"), RESPONSE_OK);
set_default_response (RESPONSE_OK);
Label* m = manage (new Label);
stringstream t; stringstream t;
t << _("This session contains the following plugins that cannot be found on this system:\n\n"); t << _("This session contains the following plugins that cannot be found on this system:\n\n");
for (list<string>::const_iterator i = plugins.begin(); i != plugins.end(); ++i) { for (list<string>::const_iterator i = plugins.begin(); i != plugins.end(); ++i) {
t << *i << "\n"; t << *i << "\n";
} }
t << _("\nThose plugins will be replaced with inactive stubs.\n");
t << _("\nThose plugins will be replaced with inactive stubs.\n" if (cache_valid) {
"It is recommended that you install the missing plugins and re-load the session.\n" add_button (_("OK"), RESPONSE_OK);
"(also check the blacklist, Window > Log and Preferences > Plugins)"); set_default_response (RESPONSE_OK);
t << _("It is recommended that you install the missing plugins and re-load the session.\n");
} else {
t << _("Third party plugins have not yet been indexed.\n");
t << string_compose (_("Scan %1 plugins now?"),
#ifdef __APPLE__
_("AudioUnit and VST")
#else
_("VST")
#endif
);
add_button (_("Yes"), RESPONSE_YES);
add_button (_("No"), RESPONSE_NO);
set_default_response (RESPONSE_YES);
}
Label* m = manage (new Label);
m->set_markup (t.str ()); m->set_markup (t.str ());
get_vbox()->pack_start (*m, false, false); get_vbox()->pack_start (*m, false, false);

View file

@ -30,7 +30,7 @@ namespace ARDOUR {
class MissingPluginDialog : public ArdourDialog class MissingPluginDialog : public ArdourDialog
{ {
public: public:
MissingPluginDialog (ARDOUR::Session *, std::list<std::string> const &); MissingPluginDialog (ARDOUR::Session*, std::list<std::string> const &, bool);
}; };
#endif /* __gtk_ardour_missing_plugin_dialog_h__ */ #endif /* __gtk_ardour_missing_plugin_dialog_h__ */

View file

@ -1237,15 +1237,22 @@ PluginSelector::show_manager ()
#endif #endif
, false, MESSAGE_QUESTION, BUTTONS_YES_NO); , false, MESSAGE_QUESTION, BUTTONS_YES_NO);
q.set_title (string_compose (_("Discover %1 Plugins?"),
#ifdef __APPLE__ #ifdef __APPLE__
q.set_title (_("Discover VST/AU Plugins?")); _("VST/AU")
q.set_secondary_text (_("Third party plugins have not yet been indexed. AudioUnit and VST plugins have to be scanned before they can be used. This can also be done manually from Preferences > Plugins. Depending on the number of installed plugins the process can take several minutes."));
#else
q.set_title (_("Discover VST Plugins?"));
q.set_secondary_text (_("Third party plugins have not yet been indexed. VST plugins have to be scanned before they can be used. This can also be done manually from Preferences > Plugins. Depending on the number of installed plugins the process can take several minutes."));
#endif #endif
_("VST")
));
if (q.run () == RESPONSE_YES) { q.set_secondary_text (string_compose (_("Third party plugins have not yet been indexed. %1 plugins have to be scanned before they can be used. This can also be done manually from Window > Plugin Manager. Depending on the number of installed plugins the process can take several minutes."),
#ifdef __APPLE__
_("AudioUnit and VST")
#else
_("VST")
#endif
));
if (q.run () == RESPONSE_YES) {
scan_now = true; scan_now = true;
} }
} }