GUI support to re-locate missing external (abs-path) files

This commit is contained in:
Robin Gareus 2017-02-22 10:38:43 +01:00
parent cdc8807728
commit 8e1c68eb63
2 changed files with 14 additions and 1 deletions

View file

@ -35,6 +35,7 @@ using namespace PBD;
MissingFileDialog::MissingFileDialog (Session* s, const std::string& path, DataType type) MissingFileDialog::MissingFileDialog (Session* s, const std::string& path, DataType type)
: ArdourDialog (_("Missing File"), true, false) : ArdourDialog (_("Missing File"), true, false)
, filetype (type) , filetype (type)
, is_absolute_path (Glib::path_is_absolute (path))
, chooser (_("Select a folder to search"), FILE_CHOOSER_ACTION_SELECT_FOLDER) , chooser (_("Select a folder to search"), FILE_CHOOSER_ACTION_SELECT_FOLDER)
, use_chosen (_("Add chosen folder to search path, and try again")) , use_chosen (_("Add chosen folder to search path, and try again"))
, choice_group (use_chosen.get_group()) , choice_group (use_chosen.get_group())
@ -121,6 +122,12 @@ MissingFileDialog::MissingFileDialog (Session* s, const std::string& path, DataT
chooser.set_create_folders (false); chooser.set_create_folders (false);
} }
void
MissingFileDialog::set_absolute ()
{
_session->set_missing_file_replacement (chooser.get_filename ());
}
void void
MissingFileDialog::add_chosen () MissingFileDialog::add_chosen ()
{ {
@ -167,7 +174,11 @@ int
MissingFileDialog::get_action () MissingFileDialog::get_action ()
{ {
if (use_chosen.get_active ()) { if (use_chosen.get_active ()) {
add_chosen (); if (is_absolute_path) {
set_absolute ();
} else {
add_chosen ();
}
return 0; return 0;
} }

View file

@ -42,6 +42,7 @@ public:
private: private:
ARDOUR::DataType filetype; ARDOUR::DataType filetype;
bool is_absolute_path;
Gtk::FileChooserButton chooser; Gtk::FileChooserButton chooser;
Gtk::RadioButton use_chosen; Gtk::RadioButton use_chosen;
@ -53,6 +54,7 @@ private:
Gtk::Label msg; Gtk::Label msg;
void add_chosen (); void add_chosen ();
void set_absolute ();
}; };
#endif /* __gtk_ardour_missing_file_dialog_h__ */ #endif /* __gtk_ardour_missing_file_dialog_h__ */