X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fexport_dialog.cc;h=4ee9ddf8edd0864d8cf449102f11263007ee0b78;hb=f4203cce7ec0b8be13293e0a86f69693ec1cd977;hp=db3bbaf7968983de57804ce7289c46bd37509953;hpb=ebd00236f876125e2b548fded78aee0801f71844;p=ardour.git diff --git a/gtk2_ardour/export_dialog.cc b/gtk2_ardour/export_dialog.cc index db3bbaf796..4ee9ddf8ed 100644 --- a/gtk2_ardour/export_dialog.cc +++ b/gtk2_ardour/export_dialog.cc @@ -134,6 +134,8 @@ ExportDialog::init () cancel_button->signal_clicked().connect (sigc::mem_fun (*this, &ExportDialog::close_dialog)); export_button->signal_clicked().connect (sigc::mem_fun (*this, &ExportDialog::do_export)); + file_notebook->soundcloud_export_selector = soundcloud_selector; + /* Done! */ show_all_children (); @@ -151,6 +153,7 @@ ExportDialog::init_gui () file_format_selector->set_homogeneous (false); file_format_selector->pack_start (*preset_align, false, false, 0); file_format_selector->pack_start (*file_notebook, false, false, 0); + file_format_selector->pack_start (*soundcloud_selector, false, false, 0); export_notebook.append_page (*file_format_selector, _("File format")); export_notebook.append_page (*timespan_selector, _("Time Span")); @@ -168,13 +171,14 @@ ExportDialog::init_components () preset_selector.reset (new ExportPresetSelector ()); timespan_selector.reset (new ExportTimespanSelectorMultiple (_session, profile_manager)); channel_selector.reset (new PortExportChannelSelector (_session, profile_manager)); + soundcloud_selector.reset (new SoundcloudExportSelector ()); file_notebook.reset (new ExportFileNotebook ()); } void -ExportDialog::notify_errors () +ExportDialog::notify_errors (bool force) { - if (status->errors()) { + if (force || status->errors()) { std::string txt = _("Export has been aborted due to an error!\nSee the Log for details."); Gtk::MessageDialog msg (txt, false, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true); msg.run(); @@ -257,12 +261,41 @@ ExportDialog::show_conflicting_files () dialog.run(); } +void +ExportDialog::soundcloud_upload_progress(double total, double now, std::string title) +{ + soundcloud_selector->do_progress_callback(total, now, title); + +} + void ExportDialog::do_export () { - profile_manager->prepare_for_export (); - handler->do_export (); - show_progress (); + try { + profile_manager->prepare_for_export (); + handler->soundcloud_username = soundcloud_selector->username (); + handler->soundcloud_password = soundcloud_selector->password (); + handler->soundcloud_make_public = soundcloud_selector->make_public (); + handler->soundcloud_open_page = soundcloud_selector->open_page (); + handler->soundcloud_downloadable = soundcloud_selector->downloadable (); + + handler->SoundcloudProgress.connect_same_thread( + *this, + boost::bind(&ExportDialog::soundcloud_upload_progress, this, _1, _2, _3) + ); +#if 0 + handler->SoundcloudProgress.connect( + *this, invalidator (*this), + boost::bind(&ExportDialog::soundcloud_upload_progress, this, _1, _2, _3), + gui_context() + ); +#endif + handler->do_export (); + show_progress (); + } catch(std::exception & e) { + error << string_compose (_("Export initialization failed: %1"), e.what()) << endmsg; + notify_errors(true); + } } void @@ -285,7 +318,7 @@ ExportDialog::show_progress () if (gtk_events_pending()) { gtk_main_iteration (); } else { - usleep (10000); + Glib::usleep (10000); } } @@ -370,6 +403,7 @@ ExportRangeDialog::init_components () preset_selector.reset (new ExportPresetSelector ()); timespan_selector.reset (new ExportTimespanSelectorSingle (_session, profile_manager, range_id)); channel_selector.reset (new PortExportChannelSelector (_session, profile_manager)); + soundcloud_selector.reset (new SoundcloudExportSelector ()); file_notebook.reset (new ExportFileNotebook ()); } @@ -383,6 +417,7 @@ ExportSelectionDialog::init_components () preset_selector.reset (new ExportPresetSelector ()); timespan_selector.reset (new ExportTimespanSelectorSingle (_session, profile_manager, X_("selection"))); channel_selector.reset (new PortExportChannelSelector (_session, profile_manager)); + soundcloud_selector.reset (new SoundcloudExportSelector ()); file_notebook.reset (new ExportFileNotebook ()); } @@ -407,6 +442,7 @@ ExportRegionDialog::init_components () preset_selector.reset (new ExportPresetSelector ()); timespan_selector.reset (new ExportTimespanSelectorSingle (_session, profile_manager, loc_id)); channel_selector.reset (new RegionExportChannelSelector (_session, profile_manager, region, track)); + soundcloud_selector.reset (new SoundcloudExportSelector ()); file_notebook.reset (new ExportFileNotebook ()); } @@ -422,5 +458,6 @@ StemExportDialog::init_components () preset_selector.reset (new ExportPresetSelector ()); timespan_selector.reset (new ExportTimespanSelectorMultiple (_session, profile_manager)); channel_selector.reset (new TrackExportChannelSelector (_session, profile_manager)); + soundcloud_selector.reset (new SoundcloudExportSelector ()); file_notebook.reset (new ExportFileNotebook ()); }