GUI implementation to re-import exported file(s)

This commit is contained in:
Robin Gareus 2022-03-11 04:22:56 +01:00
parent 020051772e
commit 9c087492c7
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
4 changed files with 37 additions and 1 deletions

View File

@ -367,6 +367,12 @@ ExportDialog::do_export ()
gui_context()
);
#endif
_files_to_reimport.clear ();
Session::Exported.connect_same_thread (*this, sigc::bind (
[] (std::string, std::string fn, bool re, std::vector<std::string>* v) { if (re) { (*v).push_back (fn); } },
&_files_to_reimport));
handler->do_export ();
show_progress ();
} catch(std::exception & e) {
@ -401,6 +407,12 @@ ExportDialog::show_progress ()
status->finish (TRS_UI);
if (!status->aborted() && !_files_to_reimport.empty ()) {
timepos_t pos (0);
Editing::ImportDisposition disposition = Editing::ImportDistinctFiles;
editor.do_import (_files_to_reimport, disposition, Editing::ImportAsTrack, SrcBest, SMFTrackNumber, SMFTempoIgnore, pos);
}
if (!status->aborted() && UIConfiguration::instance().get_save_export_mixer_screenshot ()) {
ExportProfileManager::TimespanStateList const& timespans = profile_manager->get_timespans();
ExportProfileManager::FilenameStateList const& filenames = profile_manager->get_filenames ();

View File

@ -127,7 +127,7 @@ private:
PublicEditor & editor;
StatusPtr status;
std::vector<std::string> _files_to_reimport;
/* Warning area */

View File

@ -128,6 +128,19 @@ ExportFileNotebook::FilePage::update_analysis_button ()
analysis_button.set_active (format_state->format->analyse());
}
void
ExportFileNotebook::FilePage::reimport_changed ()
{
format_state->format->set_reimport(reimport_button.get_active ());
profile_manager->save_format_to_disk (format_state->format);
}
void
ExportFileNotebook::FilePage::update_reimport_button ()
{
reimport_button.set_active (format_state->format->reimport ());
}
void
ExportFileNotebook::update_example_filenames ()
{
@ -209,6 +222,7 @@ ExportFileNotebook::FilePage::FilePage (Session * s, ManagerPtr profile_manager,
filename_label (_("Location"), Gtk::ALIGN_LEFT),
soundcloud_upload_button (_("Upload to Soundcloud")),
analysis_button (_("Analyze Exported Audio")),
reimport_button (_("Re-Import Exported Audio")),
tab_number (number)
{
set_border_width (12);
@ -224,6 +238,7 @@ ExportFileNotebook::FilePage::FilePage (Session * s, ManagerPtr profile_manager,
hbox->pack_start (soundcloud_upload_button, false, false, 0);
#endif
hbox->pack_start (analysis_button, false, false, 0);
hbox->pack_start (reimport_button, false, false, 0);
pack_start (*hbox, false, false, 0);
format_align.add (format_selector);
@ -244,6 +259,7 @@ ExportFileNotebook::FilePage::FilePage (Session * s, ManagerPtr profile_manager,
format_selector.set_state (format_state, s);
filename_selector.set_state (filename_state, s);
analysis_button.set_active (format_state->format->analyse());
reimport_button.set_active (format_state->format->reimport());
soundcloud_upload_button.set_active (format_state->format->soundcloud_upload());
/* Signals */
@ -265,6 +281,7 @@ ExportFileNotebook::FilePage::FilePage (Session * s, ManagerPtr profile_manager,
soundcloud_upload_button.signal_toggled().connect (sigc::mem_fun (*parent, &ExportFileNotebook::update_soundcloud_upload));
soundcloud_button_connection = soundcloud_upload_button.signal_toggled().connect (sigc::mem_fun (*this, &ExportFileNotebook::FilePage::soundcloud_upload_changed));
analysis_button_connection = analysis_button.signal_toggled().connect (sigc::mem_fun (*this, &ExportFileNotebook::FilePage::analysis_changed));
reimport_button_connection = reimport_button.signal_toggled().connect (sigc::mem_fun (*this, &ExportFileNotebook::FilePage::reimport_changed));
/* Tab widget */
tab_close_button.add (*Gtk::manage (new Gtk::Image (::get_icon("close"))));
@ -367,10 +384,13 @@ ExportFileNotebook::FilePage::critical_selection_changed ()
soundcloud_button_connection.block ();
analysis_button_connection.block ();
reimport_button_connection.block ();
update_analysis_button();
update_reimport_button();
update_soundcloud_upload_button();
reimport_button_connection.unblock ();
analysis_button_connection.unblock ();
soundcloud_button_connection.unblock ();

View File

@ -96,6 +96,7 @@ private:
void update_example_filename();
void update_analysis_button ();
void update_reimport_button ();
void update_soundcloud_upload_button ();
ARDOUR::ExportProfileManager::FormatStatePtr get_format_state () const { return format_state; }
@ -108,6 +109,7 @@ private:
void update_tab_label ();
void critical_selection_changed ();
void analysis_changed ();
void reimport_changed ();
void soundcloud_upload_changed ();
ARDOUR::ExportProfileManager::FormatStatePtr format_state;
@ -127,6 +129,7 @@ private:
Gtk::CheckButton soundcloud_upload_button;
Gtk::CheckButton analysis_button;
Gtk::CheckButton reimport_button;
Gtk::HBox tab_widget;
Gtk::Label tab_label;
Gtk::Alignment tab_close_alignment;
@ -136,6 +139,7 @@ private:
sigc::connection soundcloud_button_connection;
sigc::connection analysis_button_connection;
sigc::connection reimport_button_connection;
};
};