13
0

Allow removing the timespan name from the export-filename:

- if only one timespan is exported
and
- if at least one other name option is set.
This commit is contained in:
Robin Gareus 2016-02-11 20:53:32 +01:00
parent 2c2002ee9c
commit 8179efab25
3 changed files with 57 additions and 4 deletions

View File

@ -308,6 +308,12 @@ void
ExportFileNotebook::FilePage::update_example_filename()
{
if (profile_manager) {
if (profile_manager->get_timespans().size() > 1
|| profile_manager->get_timespans().front()->timespans->size() > 1) {
filename_selector.require_timespan (true);
} else {
filename_selector.require_timespan (false);
}
std::string example;
if (format_state->format) {

View File

@ -31,12 +31,14 @@ ExportFilenameSelector::ExportFilenameSelector () :
label_label (_("Label:"), Gtk::ALIGN_LEFT),
session_checkbox (_("Session Name")),
timespan_checkbox (_("Timespan Name")),
revision_checkbox (_("Revision:")),
path_label (_("Folder:"), Gtk::ALIGN_LEFT),
browse_button (_("Browse")),
example_filename_label ("", Gtk::ALIGN_LEFT)
example_filename_label ("", Gtk::ALIGN_LEFT),
_require_timespan (false)
{
include_label.set_markup (_("<i>Build filename(s) from these components:</i>"));
@ -45,13 +47,14 @@ ExportFilenameSelector::ExportFilenameSelector () :
pack_start (include_hbox, false, false, 0);
pack_start (example_filename_label, false, false, 12);
include_hbox.pack_start (session_checkbox, false, false, 3);
include_hbox.pack_start (timespan_checkbox, false, false, 3);
include_hbox.pack_start (label_label, false, false, 3);
include_hbox.pack_start (label_entry, false, false, 3);
include_hbox.pack_start (session_checkbox, false, false, 3);
include_hbox.pack_start (date_format_combo, false, false, 3);
include_hbox.pack_start (time_format_combo, false, false, 3);
include_hbox.pack_start (revision_checkbox, false, false, 3);
include_hbox.pack_start (revision_spinbutton, false, false, 3);
include_hbox.pack_start (date_format_combo, false, false, 3);
include_hbox.pack_start (time_format_combo, false, false, 3);
label_entry.set_activates_default ();
@ -95,6 +98,7 @@ ExportFilenameSelector::ExportFilenameSelector () :
path_entry.signal_activate().connect (sigc::mem_fun (*this, &ExportFilenameSelector::check_folder), false);
session_checkbox.signal_toggled().connect (sigc::mem_fun (*this, &ExportFilenameSelector::change_session_selection));
timespan_checkbox.signal_toggled().connect (sigc::mem_fun (*this, &ExportFilenameSelector::change_timespan_selection));
revision_checkbox.signal_toggled().connect (sigc::mem_fun (*this, &ExportFilenameSelector::change_revision_selection));
revision_spinbutton.signal_value_changed().connect (sigc::mem_fun (*this, &ExportFilenameSelector::change_revision_value));
@ -116,6 +120,7 @@ ExportFilenameSelector::load_state ()
label_entry.set_text (filename->include_label ? filename->get_label() : "");
session_checkbox.set_active (filename->include_session);
timespan_checkbox.set_active (filename->include_timespan);
revision_checkbox.set_active (filename->include_revision);
revision_spinbutton.set_value (filename->get_revision());
path_entry.set_text (filename->get_folder());
@ -276,6 +281,42 @@ ExportFilenameSelector::change_time_format ()
CriticalSelectionChanged();
}
void
ExportFilenameSelector::require_timespan (bool r)
{
_require_timespan = r;
update_timespan_sensitivity ();
}
void
ExportFilenameSelector::update_timespan_sensitivity ()
{
bool implicit = _require_timespan;
if (!implicit
&& !filename->include_session
&& !filename->include_label
&& !filename->include_revision
&& !filename->include_channel_config
&& !filename->include_channel
&& !filename->include_date
&& !filename->include_format_name) {
implicit = true;
}
timespan_checkbox.set_inconsistent (implicit);
}
void
ExportFilenameSelector::change_timespan_selection ()
{
if (!filename) {
return;
}
filename->include_timespan = timespan_checkbox.get_active();
CriticalSelectionChanged();
}
void
ExportFilenameSelector::change_session_selection ()
{

View File

@ -38,6 +38,7 @@ class ExportFilenameSelector : public Gtk::VBox, public ARDOUR::SessionHandlePtr
void set_state (ARDOUR::ExportProfileManager::FilenameStatePtr state_, ARDOUR::Session * session_);
void set_example_filename (std::string filename);
void require_timespan (bool);
/* Compatibility with other elements */
@ -55,6 +56,7 @@ class ExportFilenameSelector : public Gtk::VBox, public ARDOUR::SessionHandlePtr
void change_time_format ();
void change_session_selection ();
void change_timespan_selection ();
void change_revision_selection ();
void change_revision_value ();
@ -72,6 +74,7 @@ class ExportFilenameSelector : public Gtk::VBox, public ARDOUR::SessionHandlePtr
Gtk::Entry label_entry;
Gtk::CheckButton session_checkbox;
Gtk::CheckButton timespan_checkbox;
Gtk::CheckButton revision_checkbox;
Gtk::SpinButton revision_spinbutton;
@ -115,6 +118,9 @@ class ExportFilenameSelector : public Gtk::VBox, public ARDOUR::SessionHandlePtr
Glib::RefPtr<Gtk::ListStore> time_format_list;
Gtk::ComboBox time_format_combo;
/* timespan logic */
void update_timespan_sensitivity ();
bool _require_timespan;
};
#endif /* __export_filename_selector_h__ */