In export format dialog, show preview of generated part of description. Fix to #0004941

git-svn-id: svn://localhost/ardour2/branches/3.0@12911 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Sakari Bergen 2012-06-24 11:36:33 +00:00
parent e58e614f20
commit 04416e2d1d
6 changed files with 57 additions and 7 deletions

View file

@ -36,6 +36,7 @@ ExportFormatDialog::ExportFormatDialog (FormatPtr format, bool new_dialog) :
applying_changes_from_engine (0), applying_changes_from_engine (0),
name_label (_("Label: "), Gtk::ALIGN_LEFT), name_label (_("Label: "), Gtk::ALIGN_LEFT),
name_generated_part ("", Gtk::ALIGN_LEFT),
normalize_checkbox (_("Normalize to:")), normalize_checkbox (_("Normalize to:")),
normalize_adjustment (0.00, -90.00, 0.00, 0.1, 0.2), normalize_adjustment (0.00, -90.00, 0.00, 0.1, 0.2),
@ -72,16 +73,22 @@ ExportFormatDialog::ExportFormatDialog (FormatPtr format, bool new_dialog) :
/* Pack containers in dialog */ /* Pack containers in dialog */
get_vbox()->pack_start (name_hbox, false, false, 0);
get_vbox()->pack_start (silence_table, false, false, 6); get_vbox()->pack_start (silence_table, false, false, 6);
get_vbox()->pack_start (format_table, false, false, 6); get_vbox()->pack_start (format_table, false, false, 6);
get_vbox()->pack_start (encoding_options_vbox, false, false, 0); get_vbox()->pack_start (encoding_options_vbox, false, false, 0);
get_vbox()->pack_start (cue_toc_vbox, false, false, 0); get_vbox()->pack_start (cue_toc_vbox, false, false, 0);
get_vbox()->pack_start (name_hbox, false, false, 6);
/* Name, new and remove */ /* Name, new and remove */
name_hbox.pack_start (name_label, false, false, 0); name_hbox.pack_start (name_label, false, false, 0);
name_hbox.pack_start (name_entry, true, true, 0); name_hbox.pack_start (name_entry, false, false, 0);
name_hbox.pack_start (name_generated_part, true, true, 0);
name_entry.set_width_chars(20);
update_description();
manager.DescriptionChanged.connect(
*this, invalidator (*this),
boost::bind (&ExportFormatDialog::update_description, this), gui_context());
/* Normalize */ /* Normalize */
@ -710,6 +717,16 @@ ExportFormatDialog::update_with_toc ()
manager.select_with_toc (with_toc.get_active()); manager.select_with_toc (with_toc.get_active());
} }
void
ExportFormatDialog::update_description()
{
std::string text;
if (format->is_complete()) {
text = ": " + format->description(false);
}
name_generated_part.set_text(text);
}
void void
ExportFormatDialog::update_name () ExportFormatDialog::update_name ()
{ {

View file

@ -110,6 +110,8 @@ class ExportFormatDialog : public ArdourDialog, public PBD::ScopedConnectionList
void change_compatibility (bool compatibility, boost::weak_ptr<T> w_ptr, Glib::RefPtr<Gtk::ListStore> & list, ColsT & cols, void change_compatibility (bool compatibility, boost::weak_ptr<T> w_ptr, Glib::RefPtr<Gtk::ListStore> & list, ColsT & cols,
std::string const & c_incompatible = "red", std::string const & c_compatible = "white"); std::string const & c_incompatible = "red", std::string const & c_compatible = "white");
void update_description();
uint32_t applying_changes_from_engine; uint32_t applying_changes_from_engine;
/*** Non-interactive selections ***/ /*** Non-interactive selections ***/
@ -151,6 +153,7 @@ class ExportFormatDialog : public ArdourDialog, public PBD::ScopedConnectionList
Gtk::Label name_label; Gtk::Label name_label;
Gtk::Entry name_entry; Gtk::Entry name_entry;
Gtk::Label name_generated_part;
/* Normalize */ /* Normalize */

View file

@ -85,6 +85,7 @@ class ExportFormatManager : public PBD::ScopedConnectionList
/* Signals */ /* Signals */
PBD::Signal1<void,bool> CompleteChanged; PBD::Signal1<void,bool> CompleteChanged;
PBD::Signal0<void> DescriptionChanged;
/* Access to lists */ /* Access to lists */
@ -142,6 +143,7 @@ class ExportFormatManager : public PBD::ScopedConnectionList
bool pending_selection_change; bool pending_selection_change;
void selection_changed (); void selection_changed ();
void check_for_description_change ();
/* Formats and compatibilities */ /* Formats and compatibilities */
@ -154,13 +156,15 @@ class ExportFormatManager : public PBD::ScopedConnectionList
ExportFormatBasePtr get_compatibility_intersection (); ExportFormatBasePtr get_compatibility_intersection ();
ExportFormatBasePtr universal_set; ExportFormatBasePtr universal_set;
ExportFormatSpecPtr current_selection; ExportFormatSpecPtr current_selection;
CompatList compatibilities; CompatList compatibilities;
QualityList qualities; QualityList qualities;
FormatList formats; FormatList formats;
SampleRateList sample_rates; SampleRateList sample_rates;
std::string prev_description;
}; };
} // namespace ARDOUR } // namespace ARDOUR

View file

@ -103,7 +103,7 @@ class ExportFormatSpecification : public ExportFormatBase {
PBD::UUID const & id () { return _id; } PBD::UUID const & id () { return _id; }
std::string const & name () const { return _name; } std::string const & name () const { return _name; }
std::string description (); std::string description (bool include_name = true);
bool has_broadcast_info () const { return _has_broadcast_info; } bool has_broadcast_info () const { return _has_broadcast_info; }
uint32_t channel_limit () const { return _channel_limit; } uint32_t channel_limit () const { return _channel_limit; }

View file

@ -40,6 +40,8 @@ ExportFormatManager::ExportFormatManager (ExportFormatSpecPtr specification) :
init_qualities (); init_qualities ();
init_formats (); init_formats ();
init_sample_rates (); init_sample_rates ();
prev_description = current_selection->description();
} }
ExportFormatManager::~ExportFormatManager () ExportFormatManager::~ExportFormatManager ()
@ -255,66 +257,77 @@ void
ExportFormatManager::set_name (string name) ExportFormatManager::set_name (string name)
{ {
current_selection->set_name (name); current_selection->set_name (name);
check_for_description_change ();
} }
void void
ExportFormatManager::select_src_quality (ExportFormatBase::SRCQuality value) ExportFormatManager::select_src_quality (ExportFormatBase::SRCQuality value)
{ {
current_selection->set_src_quality (value); current_selection->set_src_quality (value);
check_for_description_change ();
} }
void void
ExportFormatManager::select_with_cue (bool value) ExportFormatManager::select_with_cue (bool value)
{ {
current_selection->set_with_cue (value); current_selection->set_with_cue (value);
check_for_description_change ();
} }
void void
ExportFormatManager::select_with_toc (bool value) ExportFormatManager::select_with_toc (bool value)
{ {
current_selection->set_with_toc (value); current_selection->set_with_toc (value);
check_for_description_change ();
} }
void void
ExportFormatManager::select_trim_beginning (bool value) ExportFormatManager::select_trim_beginning (bool value)
{ {
current_selection->set_trim_beginning (value); current_selection->set_trim_beginning (value);
check_for_description_change ();
} }
void void
ExportFormatManager::select_silence_beginning (AnyTime const & time) ExportFormatManager::select_silence_beginning (AnyTime const & time)
{ {
current_selection->set_silence_beginning (time); current_selection->set_silence_beginning (time);
check_for_description_change ();
} }
void void
ExportFormatManager::select_trim_end (bool value) ExportFormatManager::select_trim_end (bool value)
{ {
current_selection->set_trim_end (value); current_selection->set_trim_end (value);
check_for_description_change ();
} }
void void
ExportFormatManager::select_silence_end (AnyTime const & time) ExportFormatManager::select_silence_end (AnyTime const & time)
{ {
current_selection->set_silence_end (time); current_selection->set_silence_end (time);
check_for_description_change ();
} }
void void
ExportFormatManager::select_normalize (bool value) ExportFormatManager::select_normalize (bool value)
{ {
current_selection->set_normalize (value); current_selection->set_normalize (value);
check_for_description_change ();
} }
void void
ExportFormatManager::select_normalize_target (float value) ExportFormatManager::select_normalize_target (float value)
{ {
current_selection->set_normalize_target (value); current_selection->set_normalize_target (value);
check_for_description_change ();
} }
void void
ExportFormatManager::select_tagging (bool tag) ExportFormatManager::select_tagging (bool tag)
{ {
current_selection->set_tag (tag); current_selection->set_tag (tag);
check_for_description_change ();
} }
void void
@ -694,15 +707,26 @@ ExportFormatManager::selection_changed ()
} }
/* Signal completeness */ /* Signal completeness and possible description change */
CompleteChanged (current_selection->is_complete()); CompleteChanged (current_selection->is_complete());
check_for_description_change ();
/* Reset pending state */ /* Reset pending state */
pending_selection_change = false; pending_selection_change = false;
} }
void
ExportFormatManager::check_for_description_change ()
{
std::string new_description = current_selection->description();
if (new_description == prev_description) { return; }
prev_description = new_description;
DescriptionChanged();
}
ExportFormatManager::QualityPtr ExportFormatManager::QualityPtr
ExportFormatManager::get_selected_quality () ExportFormatManager::get_selected_quality ()
{ {

View file

@ -524,11 +524,13 @@ ExportFormatSpecification::set_format (boost::shared_ptr<ExportFormat> format)
} }
string string
ExportFormatSpecification::description () ExportFormatSpecification::description (bool include_name)
{ {
string desc; string desc;
desc = _name + ": "; if (include_name) {
desc = _name + ": ";
}
if (_normalize) { if (_normalize) {
desc += _("normalize, "); desc += _("normalize, ");