diff options
| author | Carl Hetherington <cth@carlh.net> | 2016-08-24 16:45:34 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2016-08-24 16:45:34 +0100 |
| commit | 73407f943ba25e2a0df2c98b3a9a938132876e9f (patch) | |
| tree | 3f50da759546b4e15bbb076bfafd8afe4509421b /src/lib | |
| parent | 8e7bdee30563e9e334bc99387315124557ad0227 (diff) | |
Add a basic management dialogue for templates.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/config.cc | 14 | ||||
| -rw-r--r-- | src/lib/config.h | 4 |
2 files changed, 16 insertions, 2 deletions
diff --git a/src/lib/config.cc b/src/lib/config.cc index 8f9cfab4b..1d9cce64e 100644 --- a/src/lib/config.cc +++ b/src/lib/config.cc @@ -597,7 +597,7 @@ Config::save_template (shared_ptr<const Film> film, string name) const } list<string> -Config::template_names () const +Config::templates () const { list<string> n; for (boost::filesystem::directory_iterator i (path("templates")); i != boost::filesystem::directory_iterator(); ++i) { @@ -617,3 +617,15 @@ Config::template_path (string name) const { return path("templates") / tidy_for_filename (name); } + +void +Config::rename_template (string old_name, string new_name) const +{ + boost::filesystem::rename (template_path (old_name), template_path (new_name)); +} + +void +Config::delete_template (string name) const +{ + boost::filesystem::remove (template_path (name)); +} diff --git a/src/lib/config.h b/src/lib/config.h index 213c13a83..e18cd3312 100644 --- a/src/lib/config.h +++ b/src/lib/config.h @@ -517,8 +517,10 @@ public: void save_template (boost::shared_ptr<const Film> film, std::string name) const; bool existing_template (std::string name) const; - std::list<std::string> template_names () const; + std::list<std::string> templates () const; boost::filesystem::path template_path (std::string name) const; + void rename_template (std::string old_name, std::string new_name) const; + void delete_template (std::string name) const; static Config* instance (); static void drop (); |
