summaryrefslogtreecommitdiff
path: root/src/lib/send_kdm_email_job.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2020-05-07 00:02:26 +0200
committerCarl Hetherington <cth@carlh.net>2020-05-07 00:02:26 +0200
commit47e29203daec51d313ed8ab8ef759752bce18d45 (patch)
tree2b34f05ffe9ad73c49225e82d91a8dede9f3d6de /src/lib/send_kdm_email_job.cc
parente81c5eb9e8ff875240dde9fdaaab0a46f99af615 (diff)
parent581797d640af1572f884ddf4395924894b745b3a (diff)
Add a new "Add DKDM" dialogue (#1637).
The basic motivation here is to avoid having to tell people to "just" create a cinema with a screen in it just to be able to make a DKDM. Here you can just have a recipient, with emails etc. and make DKDMs for them. I hope this makes things clearer from the user POV even if it does muddy the waters a bit with respect to DKDMs just being KDMs (really).
Diffstat (limited to 'src/lib/send_kdm_email_job.cc')
-rw-r--r--src/lib/send_kdm_email_job.cc39
1 files changed, 28 insertions, 11 deletions
diff --git a/src/lib/send_kdm_email_job.cc b/src/lib/send_kdm_email_job.cc
index 1b476fa63..55a171811 100644
--- a/src/lib/send_kdm_email_job.cc
+++ b/src/lib/send_kdm_email_job.cc
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2013 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2013-2020 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
@@ -20,8 +20,8 @@
#include "send_kdm_email_job.h"
#include "compose.hpp"
+#include "kdm_with_metadata.h"
#include "film.h"
-#include "cinema_kdms.h"
#include <list>
#include "i18n.h"
@@ -29,26 +29,43 @@
using std::string;
using std::list;
using boost::shared_ptr;
+using boost::optional;
-/** @param cinema_kdms KDMs to email.
+SendKDMEmailJob::SendKDMEmailJob (
+ list<KDMWithMetadataPtr> kdms,
+ dcp::NameFormat container_name_format,
+ dcp::NameFormat filename_format,
+ string cpl_name
+ )
+ : Job (shared_ptr<Film>())
+ , _container_name_format (container_name_format)
+ , _filename_format (filename_format)
+ , _cpl_name (cpl_name)
+{
+ BOOST_FOREACH (KDMWithMetadataPtr i, kdms) {
+ list<KDMWithMetadataPtr> s;
+ s.push_back (i);
+ _kdms.push_back (s);
+ }
+}
+
+/** @param kdms KDMs to email.
* @param container_name_format Format to ues for folders / ZIP files.
* @param filename_format Format to use for filenames.
* @param name_values Values to substitute into \p container_name_format and \p filename_format.
* @param cpl_name Name of the CPL that the KDMs are for.
*/
SendKDMEmailJob::SendKDMEmailJob (
- list<CinemaKDMs> cinema_kdms,
+ list<list<KDMWithMetadataPtr> > kdms,
dcp::NameFormat container_name_format,
dcp::NameFormat filename_format,
- dcp::NameFormat::Map name_values,
string cpl_name
)
: Job (shared_ptr<Film>())
, _container_name_format (container_name_format)
, _filename_format (filename_format)
- , _name_values (name_values)
, _cpl_name (cpl_name)
- , _cinema_kdms (cinema_kdms)
+ , _kdms (kdms)
{
}
@@ -61,12 +78,12 @@ SendKDMEmailJob::~SendKDMEmailJob ()
string
SendKDMEmailJob::name () const
{
- dcp::NameFormat::Map::const_iterator i = _name_values.find ('f');
- if (i == _name_values.end() || i->second.empty ()) {
+ optional<string> f = _kdms.front().front()->get('f');
+ if (!f || f->empty()) {
return _("Email KDMs");
}
- return String::compose (_("Email KDMs for %1"), i->second);
+ return String::compose (_("Email KDMs for %2"), *f);
}
string
@@ -79,7 +96,7 @@ void
SendKDMEmailJob::run ()
{
set_progress_unknown ();
- CinemaKDMs::email (_cinema_kdms, _container_name_format, _filename_format, _name_values, _cpl_name);
+ email (_kdms, _container_name_format, _filename_format, _cpl_name);
set_progress (1);
set_state (FINISHED_OK);
}