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:
parent
b34e9155db
commit
dba601eeab
|
@ -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
|
||||
|
|
|
@ -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 ();
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
@ -204,6 +207,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 ()
|
||||
{
|
||||
|
|
|
@ -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 */
|
||||
|
||||
|
|
|
@ -232,6 +232,8 @@ class ExportProfileManager
|
|||
FilenameStatePtr duplicate_filename_state (FilenameStatePtr state);
|
||||
void remove_filename_state (FilenameStatePtr state);
|
||||
|
||||
std::string get_sample_filename_for_format (ExportFilenamePtr filename, ExportFormatSpecPtr format);
|
||||
|
||||
private:
|
||||
|
||||
FilenameStateList filenames;
|
||||
|
@ -261,6 +263,10 @@ class ExportProfileManager
|
|||
|
||||
/* Utilities */
|
||||
|
||||
void build_filenames(std::list<std::string> & result, ExportFilenamePtr filename,
|
||||
TimespanListPtr timespans, ExportChannelConfigPtr channel_config,
|
||||
ExportFormatSpecPtr format);
|
||||
|
||||
/* Element state lists should never be empty, this is used to check them */
|
||||
template<typename T>
|
||||
std::list<T> const &
|
||||
|
|
|
@ -711,6 +711,19 @@ ExportProfileManager::remove_filename_state (FilenameStatePtr state)
|
|||
}
|
||||
}
|
||||
|
||||
std::string
|
||||
ExportProfileManager::get_sample_filename_for_format (ExportFilenamePtr filename, ExportFormatSpecPtr format)
|
||||
{
|
||||
if (channel_configs.empty()) { return ""; }
|
||||
|
||||
std::list<string> filenames;
|
||||
build_filenames (filenames, filename, timespans.front()->timespans,
|
||||
channel_configs.front()->config, format);
|
||||
|
||||
if (filenames.empty()) { return ""; }
|
||||
return filenames.front();
|
||||
}
|
||||
|
||||
bool
|
||||
ExportProfileManager::init_filenames (XMLNodeList nodes)
|
||||
{
|
||||
|
@ -815,34 +828,17 @@ ExportProfileManager::check_config (boost::shared_ptr<Warnings> warnings,
|
|||
|
||||
// filename->include_timespan = (timespans->size() > 1); Disabled for now...
|
||||
|
||||
for (std::list<ExportTimespanPtr>::iterator timespan_it = timespans->begin(); timespan_it != timespans->end(); ++timespan_it) {
|
||||
filename->set_timespan (*timespan_it);
|
||||
std::list<string> paths;
|
||||
build_filenames(paths, filename, timespans, channel_config, format);
|
||||
|
||||
if (channel_config->get_split()) {
|
||||
filename->include_channel = true;
|
||||
for (std::list<string>::const_iterator path_it = paths.begin(); path_it != paths.end(); ++path_it) {
|
||||
|
||||
for (uint32_t chan = 1; chan <= channel_config->get_n_chans(); ++chan) {
|
||||
filename->set_channel (chan);
|
||||
string path = *path_it;
|
||||
|
||||
string path = filename->get_path (format);
|
||||
|
||||
if (sys::exists (sys::path (path))) {
|
||||
warnings->conflicting_filenames.push_back (path);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
filename->include_channel = false;
|
||||
string path = filename->get_path (format);
|
||||
|
||||
if (sys::exists (sys::path (path))) {
|
||||
warnings->conflicting_filenames.push_back (path);
|
||||
}
|
||||
if (sys::exists (sys::path (path))) {
|
||||
warnings->conflicting_filenames.push_back (path);
|
||||
}
|
||||
|
||||
// TODO check what happens with split channel configs...
|
||||
string path = filename->get_path (format);
|
||||
|
||||
if (format->with_toc()) {
|
||||
string marker_file = handler->get_cd_marker_filename(path, CDMarkerTOC);
|
||||
if (sys::exists (sys::path (marker_file))) {
|
||||
|
@ -882,4 +878,28 @@ ExportProfileManager::check_sndfile_format (ExportFormatSpecPtr format, unsigned
|
|||
return (sf_format_check (&sf_info) == SF_TRUE ? true : false);
|
||||
}
|
||||
|
||||
void
|
||||
ExportProfileManager::build_filenames(std::list<std::string> & result, ExportFilenamePtr filename,
|
||||
TimespanListPtr timespans, ExportChannelConfigPtr channel_config,
|
||||
ExportFormatSpecPtr format)
|
||||
{
|
||||
for (std::list<ExportTimespanPtr>::iterator timespan_it = timespans->begin();
|
||||
timespan_it != timespans->end(); ++timespan_it) {
|
||||
filename->set_timespan (*timespan_it);
|
||||
|
||||
if (channel_config->get_split()) {
|
||||
filename->include_channel = true;
|
||||
|
||||
for (uint32_t chan = 1; chan <= channel_config->get_n_chans(); ++chan) {
|
||||
filename->set_channel (chan);
|
||||
result.push_back(filename->get_path (format));
|
||||
}
|
||||
|
||||
} else {
|
||||
filename->include_channel = false;
|
||||
result.push_back(filename->get_path (format));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}; // namespace ARDOUR
|
||||
|
|
Loading…
Reference in New Issue