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
Signed by: rgareus
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/filename_extensions.h"
#include "ardour/plugin_manager.h"
#include "ardour/profile.h"
#include "ardour/session.h"
#include "ardour/session_utils.h"
@ -62,6 +63,7 @@
#include "missing_filesource_dialog.h"
#include "missing_plugin_dialog.h"
#include "opts.h"
#include "plugin_scan_dialog.h"
#include "public_editor.h"
#include "save_as_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 ();
bool scan_now = false;
if (!u.empty()) {
MissingPluginDialog d (_session, u);
d.run ();
MissingPluginDialog d (_session, u, PluginManager::instance ().cache_valid ());
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 "pbd/compose.h"
#include "missing_plugin_dialog.h"
#include "pbd/i18n.h"
using namespace Gtk;
@ -28,7 +31,7 @@ using namespace std;
using namespace ARDOUR;
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)
{
/* This dialog is always shown programatically. Center the window.*/
@ -36,22 +39,34 @@ MissingPluginDialog::MissingPluginDialog (Session * s, list<string> const & plug
set_session (s);
add_button (_("OK"), RESPONSE_OK);
set_default_response (RESPONSE_OK);
Label* m = manage (new Label);
stringstream t;
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) {
t << *i << "\n";
}
t << _("\nThose plugins will be replaced with inactive stubs.\n");
t << _("\nThose plugins will be replaced with inactive stubs.\n"
"It is recommended that you install the missing plugins and re-load the session.\n"
"(also check the blacklist, Window > Log and Preferences > Plugins)");
if (cache_valid) {
add_button (_("OK"), RESPONSE_OK);
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 ());
get_vbox()->pack_start (*m, false, false);

View File

@ -30,7 +30,7 @@ namespace ARDOUR {
class MissingPluginDialog : public ArdourDialog
{
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__ */

View File

@ -1237,15 +1237,22 @@ PluginSelector::show_manager ()
#endif
, false, MESSAGE_QUESTION, BUTTONS_YES_NO);
q.set_title (string_compose (_("Discover %1 Plugins?"),
#ifdef __APPLE__
q.set_title (_("Discover VST/AU Plugins?"));
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."));
_("VST/AU")
#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;
}
}