Show an example filename in the main export dialog

git-svn-id: svn://localhost/ardour2/branches/3.0@11383 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Sakari Bergen 2012-01-29 20:55:44 +00:00
parent b34e9155db
commit dba601eeab
8 changed files with 121 additions and 34 deletions

View file

@ -22,11 +22,14 @@
#include "ardour/export_format_specification.h"
#include "pbd/filesystem.h"
#include "gui_thread.h"
#include "utils.h"
#include "i18n.h"
using namespace ARDOUR;
using namespace PBD;
ExportFileNotebook::ExportFileNotebook () :
page_counter (1)
@ -88,6 +91,16 @@ ExportFileNotebook::sync_with_manager ()
CriticalSelectionChanged ();
}
void
ExportFileNotebook::update_example_filenames()
{
int i = 0;
FilePage * page;
while ((page = dynamic_cast<FilePage *> (get_nth_page (i++)))) {
page->update_example_filename();
}
}
std::string
ExportFileNotebook::get_nth_format_name (uint32_t n)
{
@ -203,8 +216,10 @@ ExportFileNotebook::FilePage::FilePage (Session * s, ManagerPtr profile_manager,
format_selector.FormatRemoved.connect (sigc::mem_fun (*profile_manager, &ExportProfileManager::remove_format_profile));
format_selector.NewFormat.connect (sigc::mem_fun (*profile_manager, &ExportProfileManager::get_new_format));
format_selector.CriticalSelectionChanged.connect (sigc::mem_fun (*this, &ExportFileNotebook::FilePage::update_tab_label));
filename_selector.CriticalSelectionChanged.connect (CriticalSelectionChanged.make_slot());
format_selector.CriticalSelectionChanged.connect (
sigc::mem_fun (*this, &ExportFileNotebook::FilePage::critical_selection_changed));
filename_selector.CriticalSelectionChanged.connect (
sigc::mem_fun (*this, &ExportFileNotebook::FilePage::critical_selection_changed));
/* Tab widget */
@ -216,6 +231,7 @@ ExportFileNotebook::FilePage::FilePage (Session * s, ManagerPtr profile_manager,
tab_widget.pack_end (tab_close_alignment, false, false, 0);
tab_widget.show_all_children ();
update_tab_label ();
update_example_filename();
/* Done */
@ -251,5 +267,27 @@ void
ExportFileNotebook::FilePage::update_tab_label ()
{
tab_label.set_text (string_compose ("Format %1: %2", tab_number, get_format_name()));
}
void
ExportFileNotebook::FilePage::update_example_filename()
{
if (profile_manager) {
std::string example = profile_manager->get_sample_filename_for_format (
filename_state->filename, format_state->format);
if (example != "") {
sys::path path(example);
filename_selector.set_example_filename(path.leaf());
} else {
filename_selector.set_example_filename("");
}
}
}
void
ExportFileNotebook::FilePage::critical_selection_changed ()
{
update_tab_label();
update_example_filename();
CriticalSelectionChanged();
}