diff options
| author | Carl Hetherington <cth@carlh.net> | 2024-04-16 22:19:39 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2024-04-21 22:07:15 +0200 |
| commit | b87e2660d0776f3d1380532ff0d2f3a28ed9d764 (patch) | |
| tree | ebddcef5b9a22b4e4e7475e20abf484f8aabd671 /src/lib | |
| parent | 748b182f27eedb006cb8493e12a389fa1c5883e7 (diff) | |
Extract all uses of DCP-o-matic name to allow branding.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/analytics.cc | 18 | ||||
| -rw-r--r-- | src/lib/config.cc | 11 | ||||
| -rw-r--r-- | src/lib/create_cli.cc | 5 | ||||
| -rw-r--r-- | src/lib/cross_osx.cc | 13 | ||||
| -rw-r--r-- | src/lib/email.cc | 6 | ||||
| -rw-r--r-- | src/lib/email.h | 1 | ||||
| -rw-r--r-- | src/lib/encode_server.cc | 3 | ||||
| -rw-r--r-- | src/lib/encode_server_finder.cc | 3 | ||||
| -rw-r--r-- | src/lib/environment_info.cc | 7 | ||||
| -rw-r--r-- | src/lib/ffmpeg_content.cc | 3 | ||||
| -rw-r--r-- | src/lib/film.cc | 19 | ||||
| -rw-r--r-- | src/lib/hints.cc | 36 | ||||
| -rw-r--r-- | src/lib/job.cc | 26 | ||||
| -rw-r--r-- | src/lib/kdm_cli.cc | 13 | ||||
| -rw-r--r-- | src/lib/release_notes.cc | 3 | ||||
| -rw-r--r-- | src/lib/send_problem_report_job.cc | 11 | ||||
| -rw-r--r-- | src/lib/text_content.cc | 19 | ||||
| -rw-r--r-- | src/lib/transcode_job.cc | 6 | ||||
| -rw-r--r-- | src/lib/util.cc | 7 | ||||
| -rw-r--r-- | src/lib/variant.cc | 135 | ||||
| -rw-r--r-- | src/lib/variant.h | 48 | ||||
| -rw-r--r-- | src/lib/wscript | 1 |
22 files changed, 318 insertions, 76 deletions
diff --git a/src/lib/analytics.cc b/src/lib/analytics.cc index 3fce79749..638f59f71 100644 --- a/src/lib/analytics.cc +++ b/src/lib/analytics.cc @@ -22,6 +22,7 @@ #include "analytics.h" #include "compose.hpp" #include "exceptions.h" +#include "variant.h" #include <dcp/filesystem.h> #include <dcp/raw_convert.h> #include <dcp/warnings.h> @@ -61,17 +62,17 @@ Analytics::successful_dcp_encode () boost::bind( boost::ref(Message), _("Congratulations!"), - String::compose (_( - "<h2>You have made %1 DCPs with DCP-o-matic!</h2>" + String::compose(_( + "<h2>You have made %1 DCPs with %2!</h2>" "<img width=\"20%%\" src=\"memory:me.jpg\" align=\"center\">" "<p>Hello. I'm Carl and I'm the " - "developer of DCP-o-matic. I work on it in my spare time (with the help " + "developer of %3. I work on it in my spare time (with the help " "of a fine volunteer team of testers and translators) and I release it " "as free software." - "<p>If you find DCP-o-matic useful, please consider a donation to the " + "<p>If you find %4 useful, please consider a donation to the " "project. Financial support will help me to spend more " - "time developing DCP-o-matic and making it better!" + "time developing %5 and making it better!" "<p><ul>" "<li><a href=\"https://dcpomatic.com/donate_amount?amount=40\">Go to Paypal to donate €40</a>" @@ -79,7 +80,12 @@ Analytics::successful_dcp_encode () "<li><a href=\"https://dcpomatic.com/donate_amount?amount=10\">Go to Paypal to donate €10</a>" "</ul>" - "<p>Thank you!"), _successful_dcp_encodes + "<p>Thank you!"), + _successful_dcp_encodes, + variant::dcpomatic(), + variant::dcpomatic(), + variant::dcpomatic(), + variant::dcpomatic() ) ) ); diff --git a/src/lib/config.cc b/src/lib/config.cc index 21192ad30..fb7a413de 100644 --- a/src/lib/config.cc +++ b/src/lib/config.cc @@ -33,6 +33,7 @@ #include "log.h" #include "ratio.h" #include "unzipper.h" +#include "variant.h" #include "zipper.h" #include <dcp/certificate_chain.h> #include <dcp/name_format.h> @@ -433,7 +434,7 @@ try _kdm_bcc = f.optional_string_child ("KDMBCC").get_value_or (""); _kdm_email = f.string_child ("KDMEmail"); - _notification_subject = f.optional_string_child("NotificationSubject").get_value_or(_("DCP-o-matic notification")); + _notification_subject = f.optional_string_child("NotificationSubject").get_value_or(variant::insert_dcpomatic(_("%1 notification"))); _notification_from = f.optional_string_child("NotificationFrom").get_value_or(""); _notification_to = f.optional_string_child("NotificationTo").get_value_or(""); for (auto i: f.node_children("NotificationCC")) { @@ -1265,20 +1266,20 @@ Config::set_kdm_email_to_default () { _kdm_subject = _("KDM delivery: $CPL_NAME"); - _kdm_email = _( + _kdm_email = variant::insert_dcpomatic(_( "Dear Projectionist\n\n" "Please find attached KDMs for $CPL_NAME.\n\n" "Cinema: $CINEMA_NAME\n" "Screen(s): $SCREENS\n\n" "The KDMs are valid from $START_TIME until $END_TIME.\n\n" - "Best regards,\nDCP-o-matic" - ); + "Best regards,\n%1" + )); } void Config::set_notification_email_to_default () { - _notification_subject = _("DCP-o-matic notification"); + _notification_subject = variant::insert_dcpomatic(_("%1 notification")); _notification_email = _( "$JOB_NAME: $JOB_STATUS" diff --git a/src/lib/create_cli.cc b/src/lib/create_cli.cc index 1c2f2c635..cf903e376 100644 --- a/src/lib/create_cli.cc +++ b/src/lib/create_cli.cc @@ -26,6 +26,7 @@ #include "dcpomatic_log.h" #include "film.h" #include "ratio.h" +#include "variant.h" #include <dcp/raw_convert.h> #include <iostream> #include <string> @@ -40,8 +41,8 @@ using boost::optional; string CreateCLI::_help = - "\nSyntax: %1 [OPTION] <CONTENT> [OPTION] [<CONTENT> ...]\n" - " -v, --version show DCP-o-matic version\n" + string("\nSyntax: %1 [OPTION] <CONTENT> [OPTION] [<CONTENT> ...]\n") + + variant::insert_dcpomatic(" -v, --version show %1 version\n") + " -h, --help show this help\n" " -n, --name <name> film name\n" " -t, --template <name> template name\n" diff --git a/src/lib/cross_osx.cc b/src/lib/cross_osx.cc index 20fe9bce8..6df2f959e 100644 --- a/src/lib/cross_osx.cc +++ b/src/lib/cross_osx.cc @@ -19,12 +19,13 @@ */ -#include "cross.h" #include "compose.hpp" -#include "log.h" -#include "dcpomatic_log.h" #include "config.h" +#include "cross.h" +#include "dcpomatic_log.h" #include "exceptions.h" +#include "log.h" +#include "variant.h" #include <dcp/filesystem.h> #include <dcp/raw_convert.h> #include <glib.h> @@ -168,6 +169,8 @@ Waker::~Waker () void start_tool (string executable, string app) { + boost::algorithm::replace_all(app, " ", "\\ "); + auto exe_path = directory_containing_executable(); exe_path = exe_path.parent_path(); // Contents exe_path = exe_path.parent_path(); // DCP-o-matic 2.app @@ -191,14 +194,14 @@ start_tool (string executable, string app) void start_batch_converter () { - start_tool ("dcpomatic2_batch", "DCP-o-matic\\ 2\\ Batch\\ Converter.app"); + start_tool("dcpomatic2_batch", variant::dcpomatic_batch_converter_app()); } void start_player () { - start_tool ("dcpomatic2_player", "DCP-o-matic\\ 2\\ Player.app"); + start_tool("dcpomatic2_player", variant::dcpomatic_player_app()); } diff --git a/src/lib/email.cc b/src/lib/email.cc index 8557b40e0..bd17bdf5b 100644 --- a/src/lib/email.cc +++ b/src/lib/email.cc @@ -23,6 +23,7 @@ #include "config.h" #include "email.h" #include "exceptions.h" +#include "variant.h" #include <curl/curl.h> #include <boost/algorithm/string.hpp> #include <boost/date_time/c_local_time_adjustor.hpp> @@ -143,9 +144,8 @@ Email::send(string server, int port, EmailProtocol protocol, string user, string "Content-Type: multipart/mixed; boundary=" + boundary + "\r\n"; } - _email += "Subject: " + encode_rfc1342(_subject) + "\r\n" - "User-Agent: DCP-o-matic\r\n" - "\r\n"; + _email += "Subject: " + encode_rfc1342(_subject) + "\r\n" + + variant::insert_dcpomatic("User-Agent: %1\r\n\r\n"); if (!_attachments.empty ()) { _email += "--" + boundary + "\r\n" diff --git a/src/lib/email.h b/src/lib/email.h index 36398bfd8..ac4703453 100644 --- a/src/lib/email.h +++ b/src/lib/email.h @@ -19,6 +19,7 @@ */ +#include "types.h" #include <curl/curl.h> #include <boost/scoped_array.hpp> diff --git a/src/lib/encode_server.cc b/src/lib/encode_server.cc index b9c907e05..da5c7270e 100644 --- a/src/lib/encode_server.cc +++ b/src/lib/encode_server.cc @@ -37,6 +37,7 @@ #include "image.h" #include "log.h" #include "player_video.h" +#include "variant.h" #include "version.h" #include <dcp/raw_convert.h> #include <dcp/warnings.h> @@ -246,7 +247,7 @@ EncodeServer::run () { LOG_GENERAL ("Server %1 (%2) starting with %3 threads", dcpomatic_version, dcpomatic_git_commit, _num_threads); if (_verbose) { - cout << "DCP-o-matic server starting with " << _num_threads << " threads.\n"; + cout << variant::dcpomatic_encode_server() << " starting with " << _num_threads << " threads.\n"; } for (int i = 0; i < _num_threads; ++i) { diff --git a/src/lib/encode_server_finder.cc b/src/lib/encode_server_finder.cc index 1d4ced595..9ce9e1691 100644 --- a/src/lib/encode_server_finder.cc +++ b/src/lib/encode_server_finder.cc @@ -26,6 +26,7 @@ #include "encode_server_description.h" #include "encode_server_finder.h" #include "exceptions.h" +#include "variant.h" #include <dcp/raw_convert.h> #include <libcxml/cxml.h> #include <boost/bind/placeholders.hpp> @@ -188,7 +189,7 @@ try { new tcp::acceptor (_listen_io_service, tcp::endpoint(tcp::v4(), is_batch_converter ? BATCH_SERVER_PRESENCE_PORT : MAIN_SERVER_PRESENCE_PORT)) ); } catch (...) { - boost::throw_exception (NetworkError (_("Could not listen for remote encode servers. Perhaps another instance of DCP-o-matic is running."))); + boost::throw_exception(NetworkError(variant::insert_dcpomatic(_("Could not listen for remote encode servers. Perhaps another instance of %1 is running.")))); } start_accept (); diff --git a/src/lib/environment_info.cc b/src/lib/environment_info.cc index 2e0347c79..d6592d126 100644 --- a/src/lib/environment_info.cc +++ b/src/lib/environment_info.cc @@ -22,6 +22,7 @@ #include "compose.hpp" #include "cross.h" #include "log.h" +#include "variant.h" #include "version.h" #include <dcp/version.h> #include <dcp/warnings.h> @@ -85,7 +86,7 @@ environment_info () { list<string> info; - info.push_back (String::compose ("DCP-o-matic %1 git %2 using %3", dcpomatic_version, dcpomatic_git_commit, dependency_version_summary())); + info.push_back(String::compose("%1 %2 git %3 using %4", variant::dcpomatic(), dcpomatic_version, dcpomatic_git_commit, dependency_version_summary())); { char buffer[128]; @@ -94,9 +95,9 @@ environment_info () } #ifdef DCPOMATIC_DEBUG - info.push_back ("DCP-o-matic built in debug mode."); + info.push_back(variant::insert_dcpomatic("%1 built in debug mode.")); #else - info.push_back ("DCP-o-matic built in optimised mode."); + info.push_back(variant::insert_dcpomatic("%1 built in optimised mode.")); #endif #ifdef LIBDCP_DEBUG info.push_back ("libdcp built in debug mode."); diff --git a/src/lib/ffmpeg_content.cc b/src/lib/ffmpeg_content.cc index c80bdec69..c2bb5ffe4 100644 --- a/src/lib/ffmpeg_content.cc +++ b/src/lib/ffmpeg_content.cc @@ -34,6 +34,7 @@ #include "job.h" #include "log.h" #include "text_content.h" +#include "variant.h" #include "video_content.h" #include <dcp/raw_convert.h> #include <libcxml/cxml.h> @@ -118,7 +119,7 @@ FFmpegContent::FFmpegContent (cxml::ConstNodePtr node, int version, list<string> if (auto filter = Filter::from_id(i->content())) { _filters.push_back(*filter); } else { - notes.push_back (String::compose (_("DCP-o-matic no longer supports the `%1' filter, so it has been turned off."), i->content())); + notes.push_back(String::compose(_("%1 no longer supports the `%2' filter, so it has been turned off."), variant::dcpomatic(), i->content())); } } diff --git a/src/lib/film.cc b/src/lib/film.cc index a88e8a855..540d0b9b9 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -57,6 +57,7 @@ #include "text_content.h" #include "transcode_job.h" #include "upload_job.h" +#include "variant.h" #include "video_content.h" #include "version.h" #include <libcxml/cxml.h> @@ -507,7 +508,13 @@ Film::read_metadata (optional<boost::filesystem::path> path) { if (!path) { if (dcp::filesystem::exists(file("metadata")) && !dcp::filesystem::exists(file(metadata_file))) { - throw runtime_error (_("This film was created with an older version of DCP-o-matic, and unfortunately it cannot be loaded into this version. You will need to create a new Film, re-add your content and set it up again. Sorry!")); + throw runtime_error( + variant::insert_dcpomatic( + _("This film was created with an older version of %1, and unfortunately it cannot " + "be loaded into this version. You will need to create a new Film, re-add your " + "content and set it up again. Sorry!") + ) + ); } path = file (metadata_file); @@ -522,7 +529,7 @@ Film::read_metadata (optional<boost::filesystem::path> path) _state_version = f.number_child<int> ("Version"); if (_state_version > current_state_version) { - throw runtime_error (_("This film was created with a newer version of DCP-o-matic, and it cannot be loaded into this version. Sorry!")); + throw runtime_error(variant::insert_dcpomatic(_("This film was created with a newer version of %1, and it cannot be loaded into this version. Sorry!"))); } else if (_state_version < current_state_version) { /* This is an older version; save a copy (if we haven't already) */ auto const older = path->parent_path() / String::compose("metadata.%1.xml", _state_version); @@ -1582,7 +1589,7 @@ Film::check_settings_consistency () } else if (!atmos_rate && rate != video_frame_rate()) { atmos_rate = rate; set_video_frame_rate (rate, false); - Message (_("DCP-o-matic had to change your settings so that the film's frame rate is the same as that of your Atmos content.")); + Message(variant::insert_dcpomatic(_("%1 had to change your settings so that the film's frame rate is the same as that of your Atmos content."))); } } } @@ -1614,7 +1621,7 @@ Film::check_settings_consistency () } if (change_made) { - Message (_("DCP-o-matic had to change your settings for referring to DCPs as OV. Please review those settings to make sure they are what you want.")); + Message(variant::insert_dcpomatic(_("%1 had to change your settings for referring to DCPs as OV. Please review those settings to make sure they are what you want."))); } if (reel_type() == ReelType::CUSTOM) { @@ -1625,9 +1632,9 @@ Film::check_settings_consistency () if (too_late != boundaries.end()) { if (std::distance(too_late, boundaries.end()) > 1) { - Message(_("DCP-o-matic had to remove some of your custom reel boundaries as they no longer lie within the film.")); + Message(variant::insert_dcpomatic(_("%1 had to remove some of your custom reel boundaries as they no longer lie within the film."))); } else { - Message(_("DCP-o-matic had to remove one of your custom reel boundaries as it no longer lies within the film.")); + Message(variant::insert_dcpomatic(_("%1 had to remove one of your custom reel boundaries as it no longer lies within the film."))); } boundaries.erase(too_late, boundaries.end()); set_custom_reel_boundaries(boundaries); diff --git a/src/lib/hints.cc b/src/lib/hints.cc index bbd5ae5d5..7a6a2a4bf 100644 --- a/src/lib/hints.cc +++ b/src/lib/hints.cc @@ -35,6 +35,7 @@ #include "player.h" #include "ratio.h" #include "text_content.h" +#include "variant.h" #include "video_content.h" #include "writer.h" #include <dcp/cpl.h> @@ -107,7 +108,13 @@ void Hints::check_few_audio_channels () { if (film()->audio_channels() < 6) { - hint (_("Your DCP has fewer than 6 audio channels. This may cause problems on some projectors. You may want to set the DCP to have 6 channels. It does not matter if your content has fewer channels, as DCP-o-matic will fill the extras with silence.")); + hint( + variant::insert_dcpomatic( + _("Your DCP has fewer than 6 audio channels. This may cause problems on some projectors. " + "You may want to set the DCP to have 6 channels. It does not matter if your content has " + "fewer channels, as %1 will fill the extras with silence.") + ) + ); } } @@ -117,7 +124,12 @@ Hints::check_upmixers () { auto ap = film()->audio_processor(); if (ap && (ap->id() == "stereo-5.1-upmix-a" || ap->id() == "stereo-5.1-upmix-b")) { - hint (_("You are using DCP-o-matic's stereo-to-5.1 upmixer. This is experimental and may result in poor-quality audio. If you continue, you should listen to the resulting DCP in a cinema to make sure that it sounds good.")); + hint(variant::insert_dcpomatic( + _("You are using %1's stereo-to-5.1 upmixer. This is experimental and " + "may result in poor-quality audio. If you continue, you should listen to the " + "resulting DCP in a cinema to make sure that it sounds good.") + ) + ); } } @@ -718,16 +730,20 @@ Hints::check_certificates () switch (*bad) { case Config::BAD_SIGNER_UTF8_STRINGS: - hint(_("The certificate chain that DCP-o-matic uses for signing DCPs and KDMs contains a small error " - "which will prevent DCPs from being validated correctly on some systems. It is advisable to " - "re-create the signing certificate chain by clicking the \"Re-make certificates and key...\" " - "button in the Keys page of Preferences.")); + hint(variant::insert_dcpomatic( + _("The certificate chain that %1 uses for signing DCPs and KDMs contains a small error " + "which will prevent DCPs from being validated correctly on some systems. It is advisable to " + "re-create the signing certificate chain by clicking the \"Re-make certificates and key...\" " + "button in the Keys page of Preferences.") + )); break; case Config::BAD_SIGNER_VALIDITY_TOO_LONG: - hint(_("The certificate chain that DCP-o-matic uses for signing DCPs and KDMs has a validity period " - "that is too long. This will cause problems playing back DCPs on some systems. " - "It is advisable to re-create the signing certificate chain by clicking the " - "\"Re-make certificates and key...\" button in the Keys page of Preferences.")); + hint(variant::insert_dcpomatic( + _("The certificate chain that %1 uses for signing DCPs and KDMs has a validity period " + "that is too long. This will cause problems playing back DCPs on some systems. " + "It is advisable to re-create the signing certificate chain by clicking the " + "\"Re-make certificates and key...\" button in the Keys page of Preferences.") + )); break; default: /* Some bad situations can't happen here as DCP-o-matic would have refused to start until they are fixed */ diff --git a/src/lib/job.cc b/src/lib/job.cc index 9e685ec11..94c23aac6 100644 --- a/src/lib/job.cc +++ b/src/lib/job.cc @@ -33,6 +33,7 @@ #include "job.h" #include "log.h" #include "util.h" +#include "variant.h" #include <dcp/exceptions.h> #include <sub/exceptions.h> #include <boost/date_time/posix_time/posix_time.hpp> @@ -137,9 +138,13 @@ Job::run_wrapper () /* 32-bit */ set_error ( _("Failed to encode the DCP."), - _("This error has probably occurred because you are running the 32-bit version of DCP-o-matic and " - "trying to use too many encoding threads. Please reduce the 'number of threads DCP-o-matic should " - "use' in the General tab of Preferences and try again.") + String::compose( + _("This error has probably occurred because you are running the 32-bit version of %1 and " + "trying to use too many encoding threads. Please reduce the 'number of threads %2 should " + "use' in the General tab of Preferences and try again."), + variant::dcpomatic(), + variant::dcpomatic() + ) ); done = true; #else @@ -147,7 +152,12 @@ Job::run_wrapper () if (running_32_on_64()) { set_error ( _("Failed to encode the DCP."), - _("This error has probably occurred because you are running the 32-bit version of DCP-o-matic. Please re-install DCP-o-matic with the 64-bit installer and try again.") + String::compose( + _("This error has probably occurred because you are running the 32-bit version of %1. " + "Please re-install %2 with the 64-bit installer and try again."), + variant::dcpomatic(), + variant::dcpomatic() + ) ); done = true; } @@ -168,8 +178,8 @@ Job::run_wrapper () set_error ( String::compose (_("Could not open %1"), e.file().string()), - String::compose ( - _("DCP-o-matic could not open the file %1 (%2). Perhaps it does not exist or is in an unexpected format."), + String::compose(_("%1 could not open the file %2 (%3). Perhaps it does not exist or is in an unexpected format."), + variant::dcpomatic(), dcp::filesystem::absolute(e.file()).string(), e.what() ) @@ -183,8 +193,8 @@ Job::run_wrapper () if (e.code() == boost::system::errc::no_such_file_or_directory) { set_error ( String::compose (_("Could not open %1"), e.path1().string ()), - String::compose ( - _("DCP-o-matic could not open the file %1 (%2). Perhaps it does not exist or is in an unexpected format."), + String::compose(_("%1 could not open the file %2 (%3). Perhaps it does not exist or is in an unexpected format."), + variant::dcpomatic(), dcp::filesystem::absolute(e.path1()).string(), e.what() ) diff --git a/src/lib/kdm_cli.cc b/src/lib/kdm_cli.cc index 651ba8e26..c442cacdc 100644 --- a/src/lib/kdm_cli.cc +++ b/src/lib/kdm_cli.cc @@ -32,6 +32,7 @@ #include "film.h" #include "kdm_with_metadata.h" #include "screen.h" +#include "variant.h" #include <dcp/certificate.h> #include <dcp/decrypted_kdm.h> #include <dcp/encrypted_kdm.h> @@ -60,9 +61,9 @@ help (std::function<void (string)> out) out (String::compose("Syntax: %1 [OPTION] [COMMAND] <FILM|CPL-ID|DKDM>", program_name)); out ("Commands:"); out ("create create KDMs; default if no other command is specified"); - out ("list-cinemas list known cinemas from DCP-o-matic settings"); - out ("list-dkdm-cpls list CPLs for which DCP-o-matic has DKDMs"); - out ("add-dkdm add DKDM to DCP-o-matic's list"); + out (variant::insert_dcpomatic("list-cinemas list known cinemas from %1 settings")); + out (variant::insert_dcpomatic("list-dkdm-cpls list CPLs for which %1 has DKDMs")); + out (variant::insert_dcpomatic("add-dkdm add DKDM to %1's list")); out (" -h, --help show this help"); out (" -o, --output <path> output file or directory"); out (" -K, --filename-format <format> filename format for KDMs"); @@ -81,15 +82,15 @@ help (std::function<void (string)> out) out (" -C, --projector-certificate <file> file containing projector certificate"); out (" -T, --trusted-device-certificate <file> file containing a trusted device's certificate"); out (" --decryption-key <file> file containing the private key which can decrypt the given DKDM"); - out (" (DCP-o-matic's configured private key will be used otherwise)"); + out (variant::insert_dcpomatic(" (%1's configured private key will be used otherwise)")); out (" --cinemas-file <file> use the given file as a list of cinemas instead of the current configuration"); out (""); - out ("CPL-ID must be the ID of a CPL that is mentioned in DCP-o-matic's DKDM list."); + out (variant::insert_dcpomatic("CPL-ID must be the ID of a CPL that is mentioned in %1's DKDM list.")); out (""); out ("For example:"); out (""); out ("Create KDMs for my_great_movie to play in all of Fred's Cinema's screens for the next two weeks and zip them up."); - out ("(Fred's Cinema must have been set up in DCP-o-matic's KDM window)"); + out (variant::insert_dcpomatic("(Fred's Cinema must have been set up in %1's KDM window)")); out (""); out (String::compose("\t%1 -c \"Fred's Cinema\" -f now -d \"2 weeks\" -z my_great_movie", program_name)); } diff --git a/src/lib/release_notes.cc b/src/lib/release_notes.cc index d69738427..b12ebc030 100644 --- a/src/lib/release_notes.cc +++ b/src/lib/release_notes.cc @@ -21,6 +21,7 @@ #include "config.h" #include "release_notes.h" +#include "variant.h" #include "version.h" #include "i18n.h" @@ -46,7 +47,7 @@ find_release_notes(bool dark, optional<string> current) string const colour = dark ? "white" : "black"; auto const span = String::compose("<span style=\"color: %1\">", colour); - const string header = String::compose("<h1>%1DCP-o-matic %2 release notes</span></h1>", span, *current); + const string header = String::compose("<h1>%1%2 %3 release notes</span></h1>", span, variant::dcpomatic(), *current); if (!last) { return header + span + diff --git a/src/lib/send_problem_report_job.cc b/src/lib/send_problem_report_job.cc index 9569aca3b..ed78112e9 100644 --- a/src/lib/send_problem_report_job.cc +++ b/src/lib/send_problem_report_job.cc @@ -19,15 +19,16 @@ */ -#include "send_problem_report_job.h" #include "compose.hpp" -#include "film.h" #include "cross.h" +#include "email.h" +#include "environment_info.h" +#include "film.h" #include "film.h" #include "log.h" +#include "send_problem_report_job.h" +#include "variant.h" #include "version.h" -#include "email.h" -#include "environment_info.h" #include <libxml++/libxml++.h> #include "i18n.h" @@ -108,7 +109,7 @@ SendProblemReportJob::run () body += "---<8----\n"; } - Email email(_from, {"carl@dcpomatic.com"}, "DCP-o-matic problem report", body); + Email email(_from, {"carl@dcpomatic.com"}, variant::insert_dcpomatic("%1 problem report"), body); email.send("main.carlh.net", 2525, EmailProtocol::STARTTLS); set_progress (1); diff --git a/src/lib/text_content.cc b/src/lib/text_content.cc index cfdaabcbc..03336f15d 100644 --- a/src/lib/text_content.cc +++ b/src/lib/text_content.cc @@ -19,11 +19,12 @@ */ -#include "text_content.h" -#include "util.h" +#include "content.h" #include "exceptions.h" #include "font.h" -#include "content.h" +#include "text_content.h" +#include "util.h" +#include "variant.h" #include <dcp/raw_convert.h> #include <libcxml/cxml.h> #include <libxml++/libxml++.h> @@ -32,13 +33,13 @@ #include "i18n.h" -using std::string; -using std::vector; using std::cout; +using std::dynamic_pointer_cast; using std::list; -using std::shared_ptr; using std::make_shared; -using std::dynamic_pointer_cast; +using std::shared_ptr; +using std::string; +using std::vector; using boost::optional; using dcp::raw_convert; using namespace dcpomatic; @@ -246,9 +247,9 @@ TextContent::TextContent (Content* parent, cxml::ConstNodePtr node, int version, */ if (version <= 37) { if (!lang->content().empty()) { - notes.push_back (String::compose( + notes.push_back(String::compose( _("A subtitle or closed caption file in this project is marked with the language '%1', " - "which DCP-o-matic does not recognise. The file's language has been cleared."), lang->content())); + "which %2 does not recognise. The file's language has been cleared."), lang->content(), variant::dcpomatic())); } } else { throw; diff --git a/src/lib/transcode_job.cc b/src/lib/transcode_job.cc index b260bc44b..ba420ab94 100644 --- a/src/lib/transcode_job.cc +++ b/src/lib/transcode_job.cc @@ -37,6 +37,7 @@ #include "log.h" #include "transcode_job.h" #include "upload_job.h" +#include "variant.h" #include <iomanip> #include <iostream> @@ -110,7 +111,10 @@ TranscodeJob::run () return; case ChangedBehaviour::STOP: set_progress (1); - set_error (_("Files have changed since they were added to the project."), _("Open the project in DCP-o-matic, check the settings, then save it before trying again.")); + set_error( + _("Files have changed since they were added to the project."), + variant::insert_dcpomatic(_("Open the project in %1, check the settings, then save it before trying again.")) + ); set_state (FINISHED_ERROR); return; default: diff --git a/src/lib/util.cc b/src/lib/util.cc index ef15b90e5..60117f61d 100644 --- a/src/lib/util.cc +++ b/src/lib/util.cc @@ -49,6 +49,7 @@ #include "string_text.h" #include "text_decoder.h" #include "util.h" +#include "variant.h" #include "video_content.h" #include <dcp/atmos_asset.h> #include <dcp/decrypted_kdm.h> @@ -515,7 +516,7 @@ mo_path () boost::filesystem::path mo_path () { - return "DCP-o-matic 2.app/Contents/Resources"; + return variant::dcpomatic_app() + "/Contents/Resources"; } #endif @@ -1018,9 +1019,9 @@ decrypt_kdm_with_helpful_error (dcp::EncryptedKDM kdm) } } if (!on_chain) { - throw KDMError (_("This KDM was not made for DCP-o-matic's decryption certificate."), e.what()); + throw KDMError(variant::insert_dcpomatic(_("This KDM was not made for %1's decryption certificate.")), e.what()); } else if (kdm_subject_name != dc->leaf().subject()) { - throw KDMError (_("This KDM was made for DCP-o-matic but not for its leaf certificate."), e.what()); + throw KDMError(variant::insert_dcpomatic(_("This KDM was made for %1 but not for its leaf certificate.")), e.what()); } else { throw; } diff --git a/src/lib/variant.cc b/src/lib/variant.cc new file mode 100644 index 000000000..e69d94012 --- /dev/null +++ b/src/lib/variant.cc @@ -0,0 +1,135 @@ +/* + Copyright (C) 2024 Carl Hetherington <cth@carlh.net> + + This file is part of DCP-o-matic. + + DCP-o-matic is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + DCP-o-matic is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>. + +*/ + + +#include "variant.h" + + +static char const* _dcpomatic = "DCP-o-matic"; +static char const* _dcpomatic_player = "DCP-o-matic Player"; +static char const* _dcpomatic_kdm_creator = "DCP-o-matic KDM Creator"; +static char const* _dcpomatic_verifier = "DCP-o-matic Verifier"; +static char const* _dcpomatic_app = "DCP-o-matic 2.app"; +static char const* _dcpomatic_player_app = "DCP-o-matic 2 Player.app"; +static char const* _dcpomatic_disk_writer = "DCP-o-matic Disk Writer"; +static char const* _dcpomatic_editor = "DCP-o-matic Editor"; +static char const* _dcpomatic_encode_server = "DCP-o-matic Encode Server"; +static char const* _dcpomatic_batch_converter_app = "DCP-o-matic 2 Batch Converter.app"; +static char const* _dcpomatic_playlist_editor = "DCP-o-matic Playlist Editor"; +static char const* _dcpomatic_combiner = "DCP-o-matic Combiner"; +static char const* _dcpomatic_batch_converter = "DCP-o-matic Batch Converter"; + + +std::string +variant::dcpomatic() +{ + return _dcpomatic; +} + +std::string +variant::dcpomatic_batch_converter() +{ + return _dcpomatic_batch_converter; +} + +std::string +variant::dcpomatic_combiner() +{ + return _dcpomatic_combiner; +} + +std::string +variant::dcpomatic_disk_writer() +{ + return _dcpomatic_disk_writer; +} + +std::string +variant::dcpomatic_editor() +{ + return _dcpomatic_editor; +} + +std::string +variant::dcpomatic_encode_server() +{ + return _dcpomatic_encode_server; +} + +std::string +variant::dcpomatic_kdm_creator() +{ + return _dcpomatic_kdm_creator; +} + +std::string +variant::dcpomatic_player() +{ + return _dcpomatic_player; +} + +std::string +variant::dcpomatic_playlist_editor() +{ + return _dcpomatic_playlist_editor; +} + +std::string +variant::dcpomatic_verifier() +{ + return _dcpomatic_verifier; +} + +std::string +variant::insert_dcpomatic(std::string const& s) +{ + return String::compose(s, _dcpomatic); +} + +std::string +variant::insert_dcpomatic_encode_server(std::string const& s) +{ + return String::compose(s, _dcpomatic_encode_server); +} + +std::string +variant::insert_dcpomatic_kdm_creator(std::string const& s) +{ + return String::compose(s, _dcpomatic_kdm_creator); +} + +std::string +variant::dcpomatic_app() +{ + return _dcpomatic_app; +} + +std::string +variant::dcpomatic_batch_converter_app() +{ + return _dcpomatic_batch_converter_app; +} + +std::string +variant::dcpomatic_player_app() +{ + return _dcpomatic_player_app; +} + diff --git a/src/lib/variant.h b/src/lib/variant.h new file mode 100644 index 000000000..66b06376b --- /dev/null +++ b/src/lib/variant.h @@ -0,0 +1,48 @@ +/* + Copyright (C) 2024 Carl Hetherington <cth@carlh.net> + + This file is part of DCP-o-matic. + + DCP-o-matic is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + DCP-o-matic is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>. + +*/ + + +#include "compose.hpp" + + +namespace variant +{ + +std::string dcpomatic(); +std::string dcpomatic_batch_converter(); +std::string dcpomatic_combiner(); +std::string dcpomatic_disk_writer(); +std::string dcpomatic_editor(); +std::string dcpomatic_encode_server(); +std::string dcpomatic_kdm_creator(); +std::string dcpomatic_player(); +std::string dcpomatic_playlist_editor(); +std::string dcpomatic_verifier(); + +std::string insert_dcpomatic(std::string const& s); +std::string insert_dcpomatic_encode_server(std::string const& s); +std::string insert_dcpomatic_kdm_creator(std::string const& s); + +std::string dcpomatic_app(); +std::string dcpomatic_batch_converter_app(); +std::string dcpomatic_player_app(); + +} + diff --git a/src/lib/wscript b/src/lib/wscript index 878b503a8..4eeeb578e 100644 --- a/src/lib/wscript +++ b/src/lib/wscript @@ -206,6 +206,7 @@ sources = """ upmixer_b.cc usl.cc util.cc + variant.cc verify_dcp_job.cc video_content.cc video_decoder.cc |
