display policy of plugin-scan progress popup-window

Only show scan-progress when discovering new plugins
(discovery can be cancelled) and optionally also show
it during 'scanning index only'
(with insensitive cancel button)
This commit is contained in:
Robin Gareus 2014-02-27 23:41:48 +01:00
parent 3cf5dcb64c
commit b8e4c44637
2 changed files with 24 additions and 11 deletions

View file

@ -3802,7 +3802,22 @@ static MessageDialog *scan_dlg = NULL;
void void
ARDOUR_UI::plugin_scan_dialog (std::string type, std::string plugin, bool can_cancel) ARDOUR_UI::plugin_scan_dialog (std::string type, std::string plugin, bool can_cancel)
{ {
if (!Config->get_show_plugin_scan_window()) { return; } if (type == X_("closeme") && !(scan_dlg && scan_dlg->is_mapped())) {
return;
}
const bool cancelled = PluginManager::instance().cancelled();
if (type != X_("closeme") && !Config->get_show_plugin_scan_window()) {
if (cancelled && scan_dlg->is_mapped()) {
scan_dlg->hide();
gui_idle_handler();
return;
}
if (cancelled || !can_cancel) {
return;
}
}
static Gtk::Button *cancel_button; static Gtk::Button *cancel_button;
if (!scan_dlg) { if (!scan_dlg) {
scan_dlg = new MessageDialog("", false, MESSAGE_INFO, BUTTONS_NONE); scan_dlg = new MessageDialog("", false, MESSAGE_INFO, BUTTONS_NONE);
@ -3823,19 +3838,16 @@ ARDOUR_UI::plugin_scan_dialog (std::string type, std::string plugin, bool can_ca
scan_dlg->set_message(type + ": " + Glib::path_get_basename(plugin)); scan_dlg->set_message(type + ": " + Glib::path_get_basename(plugin));
scan_dlg->show_all(); scan_dlg->show_all();
} }
cancel_button->set_sensitive(can_cancel); cancel_button->set_sensitive(can_cancel && !cancelled);
/* due to idle calls, gtk_events_pending() may always return true */ gui_idle_handler();
int timeout = 30;
while (gtk_events_pending() && --timeout) {
gtk_main_iteration ();
}
} }
void void
ARDOUR_UI::gui_idle_handler () ARDOUR_UI::gui_idle_handler ()
{ {
int timeout = 30; int timeout = 30;
/* due to idle calls, gtk_events_pending() may always return true */
while (gtk_events_pending() && --timeout) { while (gtk_events_pending() && --timeout) {
gtk_main_iteration (); gtk_main_iteration ();
} }

View file

@ -999,7 +999,7 @@ class PluginOptions : public OptionEditorBox
public: public:
PluginOptions (RCConfiguration* c) PluginOptions (RCConfiguration* c)
: _rc_config (c) : _rc_config (c)
, _display_plugin_scan_progress (_("Display Plugin Scan Progress")) , _display_plugin_scan_progress (_("Always Display Plugin Scan Progress"))
, _discover_vst_on_start (_("Scan for new VST Plugins on Application Start")) , _discover_vst_on_start (_("Scan for new VST Plugins on Application Start"))
{ {
Label *l; Label *l;
@ -1015,16 +1015,17 @@ public:
t->attach (*manage (new Label ("")), 0, 3, n, n+1, FILL | EXPAND); ++n; t->attach (*manage (new Label ("")), 0, 3, n, n+1, FILL | EXPAND); ++n;
t->attach (*l, 0, 2, n, n+1, FILL | EXPAND); ++n; t->attach (*l, 0, 2, n, n+1, FILL | EXPAND); ++n;
b = manage (new Button (_("Refresh Plugin List"))); b = manage (new Button (_("Scan for Plugins")));
b->signal_clicked().connect (sigc::mem_fun (*this, &PluginOptions::refresh_clicked)); b->signal_clicked().connect (sigc::mem_fun (*this, &PluginOptions::refresh_clicked));
t->attach (*b, 0, 2, n, n+1, FILL); ++n; t->attach (*b, 0, 2, n, n+1, FILL); ++n;
t->attach (_display_plugin_scan_progress, 0, 2, n, n+1); ++n; t->attach (_display_plugin_scan_progress, 0, 2, n, n+1); ++n;
_display_plugin_scan_progress.signal_toggled().connect (sigc::mem_fun (*this, &PluginOptions::display_plugin_scan_progress_toggled)); _display_plugin_scan_progress.signal_toggled().connect (sigc::mem_fun (*this, &PluginOptions::display_plugin_scan_progress_toggled));
Gtkmm2ext::UI::instance()->set_tip (_display_plugin_scan_progress, Gtkmm2ext::UI::instance()->set_tip (_display_plugin_scan_progress,
_("<b>When enabled</b> display a popup window showing plugin scan progress.")); _("<b>When enabled</b> a popup window showing plugin scan progress is displayed for indexing (cache load) and discovery (detect new plugins)"));
ss.str("");
ss << "<b>" << _("VST") << "</b>"; ss << "<b>" << _("VST") << "</b>";
l = manage (left_aligned_label (ss.str())); l = manage (left_aligned_label (ss.str()));
l->set_use_markup (true); l->set_use_markup (true);
@ -1043,7 +1044,7 @@ public:
t->attach (_discover_vst_on_start, 0, 2, n, n+1); ++n; t->attach (_discover_vst_on_start, 0, 2, n, n+1); ++n;
_discover_vst_on_start.signal_toggled().connect (sigc::mem_fun (*this, &PluginOptions::discover_vst_on_start_toggled)); _discover_vst_on_start.signal_toggled().connect (sigc::mem_fun (*this, &PluginOptions::discover_vst_on_start_toggled));
Gtkmm2ext::UI::instance()->set_tip (_discover_vst_on_start, Gtkmm2ext::UI::instance()->set_tip (_discover_vst_on_start,
_("<b>When enabled</b> VST plugins are searched and tested on application start. When disabled they a Refresh will have to be tiggered manually")); _("<b>When enabled</b> new VST plugins are searched, tested and added to the cache index on application start. When disabled new plugins will only be available after triggering a 'Scan' manually"));
#ifdef WINDOWS_VST_SUPPORT #ifdef WINDOWS_VST_SUPPORT
t->attach (*manage (left_aligned_label (_("Windows VST Path:"))), 0, 1, n, n+1); t->attach (*manage (left_aligned_label (_("Windows VST Path:"))), 0, 1, n, n+1);