mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-08 07:45:00 +01:00
Inflate template archives rather in .config/ardour5/ than in ...
`.config/ardour5/(templates|route_templates)`. We put as toplevel directory of the archive `templates` or `route_templates`. Then no matter if the user imports a session template or a route template archives, we always put them into the correct folder. As now the user can also import route templates while the SessionTemplateManager is visible and vice versa, we need to signal the successful import to the corresponding template manager. Therfor we introduce the signal TemplatesImported.
This commit is contained in:
parent
46501da220
commit
0da2d7bf8a
2 changed files with 13 additions and 8 deletions
|
|
@ -36,6 +36,9 @@
|
|||
#include "pbd/i18n.h"
|
||||
#include "pbd/xml++.h"
|
||||
|
||||
#include "gtkmm2ext/gui_thread.h"
|
||||
|
||||
#include "ardour/filesystem_paths.h"
|
||||
#include "ardour/template_utils.h"
|
||||
|
||||
#include "template_dialog.h"
|
||||
|
|
@ -64,6 +67,9 @@ TemplateDialog::TemplateDialog ()
|
|||
|
||||
session_tm->init ();
|
||||
route_tm->init ();
|
||||
|
||||
session_tm->TemplatesImported.connect (*this, invalidator (*this), boost::bind (&RouteTemplateManager::init, route_tm), gui_context ());
|
||||
route_tm->TemplatesImported.connect (*this, invalidator (*this), boost::bind (&SessionTemplateManager::init, session_tm), gui_context ());
|
||||
}
|
||||
|
||||
TemplateManager::TemplateManager ()
|
||||
|
|
@ -260,7 +266,7 @@ TemplateManager::export_all_templates ()
|
|||
return;
|
||||
}
|
||||
|
||||
PBD::copy_recurse (templates_dir (), tmpdir);
|
||||
PBD::copy_recurse (templates_dir (), Glib::build_filename (tmpdir, Glib::path_get_basename (templates_dir ())));
|
||||
|
||||
vector<string> files;
|
||||
PBD::find_files_matching_regex (files, tmpdir, string ("\\.template$"), /* recurse = */ true);
|
||||
|
|
@ -315,17 +321,12 @@ TemplateManager::import_template_set ()
|
|||
return;
|
||||
}
|
||||
|
||||
if (!g_file_test (templates_dir().c_str(), G_FILE_TEST_IS_DIR)) {
|
||||
cout << "making " << templates_dir() << endl;
|
||||
g_mkdir (templates_dir().c_str(), 0755);
|
||||
}
|
||||
|
||||
_current_action = _("Importing templates");
|
||||
|
||||
FileArchive ar (dialog.get_filename ());
|
||||
PBD::ScopedConnectionList progress_connection;
|
||||
ar.progress.connect_same_thread (progress_connection, boost::bind (&_set_progress, this, _1, _2));
|
||||
ar.inflate (templates_dir());
|
||||
ar.inflate (user_config_directory ());
|
||||
|
||||
vector<string> files;
|
||||
PBD::find_files_matching_regex (files, templates_dir (), string ("\\.template$"), /* recurse = */ true);
|
||||
|
|
@ -346,6 +347,7 @@ TemplateManager::import_template_set ()
|
|||
}
|
||||
|
||||
init ();
|
||||
TemplatesImported (); /* emit signal */
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
|||
|
|
@ -37,7 +37,8 @@ namespace ARDOUR {
|
|||
class XMLTree;
|
||||
class XMLNode;
|
||||
|
||||
class TemplateDialog : public ArdourDialog
|
||||
class TemplateDialog : public ArdourDialog,
|
||||
public PBD::ScopedConnectionList
|
||||
{
|
||||
public:
|
||||
TemplateDialog ();
|
||||
|
|
@ -51,6 +52,8 @@ public:
|
|||
virtual ~TemplateManager () {}
|
||||
virtual void init () = 0;
|
||||
|
||||
PBD::Signal0<void> TemplatesImported;
|
||||
|
||||
protected:
|
||||
TemplateManager ();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue