From 9daab3db8481de5653e97321c7bb2aa881f0d54c Mon Sep 17 00:00:00 2001 From: Colin Fletcher Date: Fri, 23 May 2014 18:14:37 +0100 Subject: Make Soundcloud upload applicable to any export format. Add soundcloud_upload property back into ExportFormatSpecification, but instead of making it settable in the export format specification dialog, add a tick-box in each tab of ExportFileNotebook to allow setting it. --- gtk2_ardour/export_file_notebook.cc | 30 ++++++++++++++++++++++++++++++ gtk2_ardour/export_file_notebook.h | 3 +++ 2 files changed, 33 insertions(+) (limited to 'gtk2_ardour') diff --git a/gtk2_ardour/export_file_notebook.cc b/gtk2_ardour/export_file_notebook.cc index 54c0f628c7..00e2687251 100644 --- a/gtk2_ardour/export_file_notebook.cc +++ b/gtk2_ardour/export_file_notebook.cc @@ -86,9 +86,30 @@ ExportFileNotebook::sync_with_manager () } set_current_page (0); + update_soundcloud_upload (); CriticalSelectionChanged (); } +void +ExportFileNotebook::update_soundcloud_upload() +{ + int i; + ExportProfileManager::FormatStateList const & formats = profile_manager->get_formats (); + ExportProfileManager::FormatStateList::const_iterator format_it; + + for (i = 0, format_it = formats.begin(); format_it != formats.end(); ++i, ++format_it) { + FilePage * page; + std::cerr << "get_nth_soundcloud_upload " << i << std::endl; + if ((page = dynamic_cast (get_nth_page (i)))) { + (*format_it)->format->set_soundcloud_upload( page->get_soundcloud_upload () ); + // profile_manager->soundcloud_upload_list.push_back (page->get_soundcloud_upload () ); + } else { + std::cerr << "not a page!" << std::endl; + } + } + +} + void ExportFileNotebook::update_example_filenames() { @@ -177,6 +198,7 @@ ExportFileNotebook::FilePage::FilePage (Session * s, ManagerPtr profile_manager, format_label (_("Format"), Gtk::ALIGN_LEFT), filename_label (_("Location"), Gtk::ALIGN_LEFT), + soundcloud_upload_button (_("Upload to Soundcloud")), tab_number (number) { set_border_width (12); @@ -185,6 +207,7 @@ 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); format_align.add (format_selector); format_align.set_padding (6, 12, 18, 0); @@ -219,6 +242,7 @@ ExportFileNotebook::FilePage::FilePage (Session * s, ManagerPtr profile_manager, filename_selector.CriticalSelectionChanged.connect ( sigc::mem_fun (*this, &ExportFileNotebook::FilePage::critical_selection_changed)); + soundcloud_upload_button.signal_toggled().connect (sigc::mem_fun (*parent, &ExportFileNotebook::update_soundcloud_upload)); /* Tab widget */ tab_close_button.add (*Gtk::manage (new Gtk::Image (::get_icon("close")))); @@ -255,6 +279,12 @@ ExportFileNotebook::FilePage::get_format_name () const return _("No format!"); } +bool +ExportFileNotebook::FilePage::get_soundcloud_upload () const +{ + return soundcloud_upload_button.get_active (); +} + void ExportFileNotebook::FilePage::save_format_to_manager (FormatPtr format) { diff --git a/gtk2_ardour/export_file_notebook.h b/gtk2_ardour/export_file_notebook.h index 5555828e98..2d87d942e7 100644 --- a/gtk2_ardour/export_file_notebook.h +++ b/gtk2_ardour/export_file_notebook.h @@ -58,6 +58,7 @@ class ExportFileNotebook : public Gtk::Notebook, public ARDOUR::SessionHandlePtr void add_file_page (ARDOUR::ExportProfileManager::FormatStatePtr format_state, ARDOUR::ExportProfileManager::FilenameStatePtr filename_state); void remove_file_page (FilePage * page); void update_remove_file_page_sensitivity (); + void update_soundcloud_upload(); sigc::connection page_change_connection; void handle_page_change (GtkNotebookPage*, uint32_t page); @@ -80,6 +81,7 @@ class ExportFileNotebook : public Gtk::Notebook, public ARDOUR::SessionHandlePtr Gtk::Widget & get_tab_widget () { return tab_widget; } void set_remove_sensitive (bool value); std::string get_format_name () const; + bool get_soundcloud_upload () const; void update_example_filename(); @@ -108,6 +110,7 @@ class ExportFileNotebook : public Gtk::Notebook, public ARDOUR::SessionHandlePtr Gtk::Alignment filename_align; ExportFilenameSelector filename_selector; + Gtk::CheckButton soundcloud_upload_button; Gtk::HBox tab_widget; Gtk::Label tab_label; Gtk::Alignment tab_close_alignment; -- cgit v1.2.3