X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fexport_file_notebook.cc;h=a91a253b3cf2f2e430a83cb350ff2011cadf7208;hb=098b0f8a8b904313bc2e9e3147cc3c05fd83f3e6;hp=c313038e0578d1338c0ae2796663498ada2f0ba7;hpb=60349bcee6abd86a58dbbacbfe9afbff4204f8d6;p=ardour.git diff --git a/gtk2_ardour/export_file_notebook.cc b/gtk2_ardour/export_file_notebook.cc index c313038e05..a91a253b3c 100644 --- a/gtk2_ardour/export_file_notebook.cc +++ b/gtk2_ardour/export_file_notebook.cc @@ -24,9 +24,10 @@ #include "gui_thread.h" #include "utils.h" -#include "i18n.h" +#include "pbd/i18n.h" using namespace ARDOUR; +using namespace ARDOUR_UI_UTILS; using namespace PBD; ExportFileNotebook::ExportFileNotebook () : @@ -108,9 +109,20 @@ ExportFileNotebook::update_soundcloud_upload () } } } - soundcloud_export_selector->set_visible (show_credentials_entry); +} +void +ExportFileNotebook::FilePage::analysis_changed () +{ + format_state->format->set_analyse (analysis_button.get_active ()); + profile_manager->save_format_to_disk (format_state->format); +} + +void +ExportFileNotebook::FilePage::update_analysis_button () +{ + analysis_button.set_active (format_state->format->analyse()); } void @@ -180,19 +192,21 @@ ExportFileNotebook::handle_page_change (GtkNotebookPage*, uint32_t page) } else { last_visible_page = page; } + update_soundcloud_upload (); } ExportFileNotebook::FilePage::FilePage (Session * s, ManagerPtr profile_manager, ExportFileNotebook * parent, uint32_t number, ExportProfileManager::FormatStatePtr format_state, ExportProfileManager::FilenameStatePtr filename_state) : - format_state (format_state), - filename_state (filename_state), - profile_manager (profile_manager), - - format_label (_("Format"), Gtk::ALIGN_LEFT), - filename_label (_("Location"), Gtk::ALIGN_LEFT), - soundcloud_upload_button (_("Upload to Soundcloud")), - tab_number (number) + format_state (format_state), + filename_state (filename_state), + profile_manager (profile_manager), + + format_label (_("Format"), Gtk::ALIGN_LEFT), + filename_label (_("Location"), Gtk::ALIGN_LEFT), + soundcloud_upload_button (_("Upload to Soundcloud")), + analysis_button (_("Analyze Exported Audio")), + tab_number (number) { set_border_width (12); @@ -200,7 +214,14 @@ ExportFileNotebook::FilePage::FilePage (Session * s, ManagerPtr profile_manager, pack_start (format_align, false, false, 0); pack_start (filename_label, false, false, 0); pack_start (filename_align, false, false, 0); - pack_start (soundcloud_upload_button, false, false, 0); + + Gtk::HBox *hbox = Gtk::manage (new Gtk::HBox()); + hbox->set_spacing (6); +#ifndef NDEBUG // SoundCloud upload is currently b0rked, needs debugging + hbox->pack_start (soundcloud_upload_button, false, false, 0); +#endif + hbox->pack_start (analysis_button, false, false, 0); + pack_start (*hbox, false, false, 0); format_align.add (format_selector); format_align.set_padding (6, 12, 18, 0); @@ -218,7 +239,9 @@ ExportFileNotebook::FilePage::FilePage (Session * s, ManagerPtr profile_manager, /* Set states */ format_selector.set_state (format_state, s); - filename_selector.set_state (filename_state, s); + filename_selector.set_state (filename_state, s); + analysis_button.set_active (format_state->format->analyse()); + soundcloud_upload_button.set_active (format_state->format->soundcloud_upload()); /* Signals */ @@ -229,6 +252,7 @@ ExportFileNotebook::FilePage::FilePage (Session * s, ManagerPtr profile_manager, format_selector.FormatEdited.connect (sigc::mem_fun (*this, &ExportFileNotebook::FilePage::save_format_to_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.FormatReverted.connect (sigc::mem_fun (*profile_manager, &ExportProfileManager::revert_format_profile)); format_selector.CriticalSelectionChanged.connect ( sigc::mem_fun (*this, &ExportFileNotebook::FilePage::critical_selection_changed)); @@ -236,6 +260,8 @@ ExportFileNotebook::FilePage::FilePage (Session * s, ManagerPtr profile_manager, sigc::mem_fun (*this, &ExportFileNotebook::FilePage::critical_selection_changed)); soundcloud_upload_button.signal_toggled().connect (sigc::mem_fun (*parent, &ExportFileNotebook::update_soundcloud_upload)); + soundcloud_upload_button.signal_toggled().connect (sigc::mem_fun (*this, &ExportFileNotebook::FilePage::soundcloud_upload_changed)); + analysis_button.signal_toggled().connect (sigc::mem_fun (*this, &ExportFileNotebook::FilePage::analysis_changed)); /* Tab widget */ tab_close_button.add (*Gtk::manage (new Gtk::Image (::get_icon("close")))); @@ -275,9 +301,24 @@ ExportFileNotebook::FilePage::get_format_name () const bool ExportFileNotebook::FilePage::get_soundcloud_upload () const { +#ifdef NDEBUG // SoundCloud upload is currently b0rked, needs debugging + return false; +#endif return soundcloud_upload_button.get_active (); } +void +ExportFileNotebook::FilePage::soundcloud_upload_changed () +{ + profile_manager->save_format_to_disk (format_state->format); +} + +void +ExportFileNotebook::FilePage::update_soundcloud_upload_button () +{ + soundcloud_upload_button.set_active (format_state->format->soundcloud_upload()); +} + void ExportFileNotebook::FilePage::save_format_to_manager (FormatPtr format) { @@ -294,13 +335,19 @@ 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) { example = profile_manager->get_sample_filename_for_format ( filename_state->filename, format_state->format); } - + if (example != "") { filename_selector.set_example_filename(Glib::path_get_basename (example)); } else { @@ -314,5 +361,7 @@ ExportFileNotebook::FilePage::critical_selection_changed () { update_tab_label(); update_example_filename(); + update_analysis_button(); + update_soundcloud_upload_button(); CriticalSelectionChanged(); }