diff options
author | Sakari Bergen <sakari.bergen@beatwaves.net> | 2012-01-29 20:55:44 +0000 |
---|---|---|
committer | Sakari Bergen <sakari.bergen@beatwaves.net> | 2012-01-29 20:55:44 +0000 |
commit | dba601eeab9054ca4fac811c6c5e414d59fdc460 (patch) | |
tree | 247c39f68f793ec0954f916182b206e53913774c /gtk2_ardour | |
parent | b34e9155db41c300c7f92af4d30351bcb98b00df (diff) |
Show an example filename in the main export dialog
git-svn-id: svn://localhost/ardour2/branches/3.0@11383 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour')
-rw-r--r-- | gtk2_ardour/export_dialog.cc | 16 | ||||
-rw-r--r-- | gtk2_ardour/export_dialog.h | 2 | ||||
-rw-r--r-- | gtk2_ardour/export_file_notebook.cc | 42 | ||||
-rw-r--r-- | gtk2_ardour/export_file_notebook.h | 5 | ||||
-rw-r--r-- | gtk2_ardour/export_filename_selector.cc | 16 | ||||
-rw-r--r-- | gtk2_ardour/export_filename_selector.h | 2 |
6 files changed, 72 insertions, 11 deletions
diff --git a/gtk2_ardour/export_dialog.cc b/gtk2_ardour/export_dialog.cc index 3dea7ee1a6..9155595b8c 100644 --- a/gtk2_ardour/export_dialog.cc +++ b/gtk2_ardour/export_dialog.cc @@ -91,13 +91,13 @@ ExportDialog::set_session (ARDOUR::Session* s) /* Warnings */ preset_selector->CriticalSelectionChanged.connect (sigc::mem_fun (*this, &ExportDialog::sync_with_manager)); - timespan_selector->CriticalSelectionChanged.connect (sigc::mem_fun (*this, &ExportDialog::update_warnings)); - channel_selector->CriticalSelectionChanged.connect (sigc::mem_fun (*this, &ExportDialog::update_warnings)); - file_notebook->CriticalSelectionChanged.connect (sigc::mem_fun (*this, &ExportDialog::update_warnings)); + timespan_selector->CriticalSelectionChanged.connect (sigc::mem_fun (*this, &ExportDialog::update_warnings_and_example_filename)); + channel_selector->CriticalSelectionChanged.connect (sigc::mem_fun (*this, &ExportDialog::update_warnings_and_example_filename)); + file_notebook->CriticalSelectionChanged.connect (sigc::mem_fun (*this, &ExportDialog::update_warnings_and_example_filename)); status->Aborting.connect (abort_connection, invalidator (*this), boost::bind (&ExportDialog::notify_errors, this), gui_context()); - update_warnings (); + update_warnings_and_example_filename (); } void @@ -226,11 +226,11 @@ ExportDialog::sync_with_manager () channel_selector->sync_with_manager(); file_notebook->sync_with_manager (); - update_warnings (); + update_warnings_and_example_filename (); } void -ExportDialog::update_warnings () +ExportDialog::update_warnings_and_example_filename () { /* Reset state */ @@ -263,7 +263,9 @@ ExportDialog::update_warnings () } } - + /* Update example filename */ + + file_notebook->update_example_filenames(); } void diff --git a/gtk2_ardour/export_dialog.h b/gtk2_ardour/export_dialog.h index a720ec0b9c..ee0f7ce269 100644 --- a/gtk2_ardour/export_dialog.h +++ b/gtk2_ardour/export_dialog.h @@ -94,7 +94,7 @@ class ExportDialog : public ArdourDialog { void close_dialog (); void sync_with_manager (); - void update_warnings (); + void update_warnings_and_example_filename (); void show_conflicting_files (); void export_rt (); diff --git a/gtk2_ardour/export_file_notebook.cc b/gtk2_ardour/export_file_notebook.cc index ef0c56f55c..959bc42a2f 100644 --- a/gtk2_ardour/export_file_notebook.cc +++ b/gtk2_ardour/export_file_notebook.cc @@ -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(); } diff --git a/gtk2_ardour/export_file_notebook.h b/gtk2_ardour/export_file_notebook.h index 9f357ab1d5..5555828e98 100644 --- a/gtk2_ardour/export_file_notebook.h +++ b/gtk2_ardour/export_file_notebook.h @@ -39,6 +39,8 @@ class ExportFileNotebook : public Gtk::Notebook, public ARDOUR::SessionHandlePtr void set_session_and_manager (ARDOUR::Session * s, boost::shared_ptr<ARDOUR::ExportProfileManager> manager); void sync_with_manager (); + void update_example_filenames(); + std::string get_nth_format_name (uint32_t n); sigc::signal<void> CriticalSelectionChanged; @@ -79,6 +81,8 @@ class ExportFileNotebook : public Gtk::Notebook, public ARDOUR::SessionHandlePtr void set_remove_sensitive (bool value); std::string get_format_name () const; + void update_example_filename(); + ARDOUR::ExportProfileManager::FormatStatePtr get_format_state () const { return format_state; } ARDOUR::ExportProfileManager::FilenameStatePtr get_filename_state () const { return filename_state; } @@ -87,6 +91,7 @@ class ExportFileNotebook : public Gtk::Notebook, public ARDOUR::SessionHandlePtr private: void save_format_to_manager (FormatPtr format); void update_tab_label (); + void critical_selection_changed (); ARDOUR::ExportProfileManager::FormatStatePtr format_state; ARDOUR::ExportProfileManager::FilenameStatePtr filename_state; diff --git a/gtk2_ardour/export_filename_selector.cc b/gtk2_ardour/export_filename_selector.cc index 789b7eb435..e2d360984c 100644 --- a/gtk2_ardour/export_filename_selector.cc +++ b/gtk2_ardour/export_filename_selector.cc @@ -38,11 +38,14 @@ ExportFilenameSelector::ExportFilenameSelector () : revision_checkbox (_("Revision:")), path_label (_("Folder:"), Gtk::ALIGN_LEFT), - browse_button (_("Browse")) + browse_button (_("Browse")), + + example_filename_label ("", Gtk::ALIGN_LEFT) { pack_start (include_label, false, false, 6); pack_start (include_hbox, false, false, 0); pack_start (path_hbox, false, false, 12); + pack_start (example_filename_label, false, false, 0); include_hbox.pack_start (label_label, false, false, 3); include_hbox.pack_start (label_entry, false, false, 3); @@ -205,6 +208,17 @@ ExportFilenameSelector::set_state (ARDOUR::ExportProfileManager::FilenameStatePt } void +ExportFilenameSelector::set_example_filename (std::string filename) +{ + if (filename == "") { + example_filename_label.set_text (_("Sorry, no example filename can be shown at the moment")); + } else { + example_filename_label.set_text (string_compose(_("Example filename: \"%1\""), + filename)); + } +} + +void ExportFilenameSelector::update_label () { if (!filename) { diff --git a/gtk2_ardour/export_filename_selector.h b/gtk2_ardour/export_filename_selector.h index 8522f79b20..f6f7551438 100644 --- a/gtk2_ardour/export_filename_selector.h +++ b/gtk2_ardour/export_filename_selector.h @@ -37,6 +37,7 @@ class ExportFilenameSelector : public Gtk::VBox, public ARDOUR::SessionHandlePtr ~ExportFilenameSelector (); void set_state (ARDOUR::ExportProfileManager::FilenameStatePtr state_, ARDOUR::Session * session_); + void set_example_filename (std::string filename); /* Compatibility with other elements */ @@ -80,6 +81,7 @@ class ExportFilenameSelector : public Gtk::VBox, public ARDOUR::SessionHandlePtr Gtk::Label path_label; Gtk::Entry path_entry; Gtk::Button browse_button; + Gtk::Label example_filename_label; /* Date combo */ |