From: Carl Hetherington Date: Thu, 7 Jul 2022 13:21:19 +0000 (+0200) Subject: Basic release notes support (#2282). X-Git-Tag: v2.16.19~4 X-Git-Url: https://git.carlh.net/gitweb/?p=dcpomatic.git;a=commitdiff_plain;h=f706bbb9afd10472e81a051cd5db601d6404377c Basic release notes support (#2282). --- diff --git a/src/lib/config.cc b/src/lib/config.cc index aacc71edf..cb2ec8885 100644 --- a/src/lib/config.cc +++ b/src/lib/config.cc @@ -193,6 +193,7 @@ Config::set_defaults () _default_kdm_type = dcp::Formulation::MODIFIED_TRANSITIONAL_1; _default_kdm_duration = RoughDuration(1, RoughDuration::Unit::WEEKS); _auto_crop_threshold = 0.1; + _last_release_notes_version = boost::none; _allowed_dcp_frame_rates.clear (); _allowed_dcp_frame_rates.push_back (24); @@ -593,6 +594,7 @@ try _default_kdm_duration = RoughDuration(1, RoughDuration::Unit::WEEKS); } _auto_crop_threshold = f.optional_number_child("AutoCropThreshold").get_value_or(0.1); + _last_release_notes_version = f.optional_string_child("LastReleaseNotesVersion"); _export.read(f.optional_node_child("Export")); @@ -1034,6 +1036,9 @@ Config::write_config () const root->add_child("EmailKDMs")->add_child_text(_email_kdms ? "1" : "0"); root->add_child("DefaultKDMType")->add_child_text(dcp::formulation_to_string(_default_kdm_type)); root->add_child("AutoCropThreshold")->add_child_text(raw_convert(_auto_crop_threshold)); + if (_last_release_notes_version) { + root->add_child("LastReleaseNotesVersion")->add_child_text(*_last_release_notes_version); + } _export.write(root->add_child("Export")); diff --git a/src/lib/config.h b/src/lib/config.h index f53b8986e..9727bac1a 100644 --- a/src/lib/config.h +++ b/src/lib/config.h @@ -586,6 +586,10 @@ public: return _auto_crop_threshold; } + boost::optional last_release_notes_version () const { + return _last_release_notes_version; + } + /* SET (mostly) */ void set_master_encoding_threads (int n) { @@ -1122,6 +1126,10 @@ public: maybe_set (_auto_crop_threshold, threshold, AUTO_CROP_THRESHOLD); } + void set_last_release_notes_version (std::string version) { + maybe_set (_last_release_notes_version, version); + } + ExportConfig& export_config() { return _export; } @@ -1349,6 +1357,7 @@ private: dcp::Formulation _default_kdm_type; RoughDuration _default_kdm_duration; double _auto_crop_threshold; + boost::optional _last_release_notes_version; ExportConfig _export; diff --git a/src/lib/release_notes.cc b/src/lib/release_notes.cc new file mode 100644 index 000000000..b1eb95257 --- /dev/null +++ b/src/lib/release_notes.cc @@ -0,0 +1,55 @@ +/* + Copyright (C) 2022 Carl Hetherington + + 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 . + +*/ + + +#include "config.h" +#include "release_notes.h" +#include "version.h" + +#include "i18n.h" + + +using std::string; +using boost::optional; + + +optional +find_release_notes() +{ + auto last = Config::instance()->last_release_notes_version(); + auto current = string(dcpomatic_version); + if (last && *last == current) { + return {}; + } + + Config::instance()->set_last_release_notes_version(current); + + const string header = String::compose("

DCP-o-matic %1 release notes

", current); + + if (current == "2.16.18") { + return header + + _("In this version there are changes to the way that subtitles are positioned. " + "Positioning should now be more correct, with respect to the standards, but you " + "should check any subtitles in your project to make sure that they are placed " + "where you want them."); + } + + return {}; +} diff --git a/src/lib/release_notes.h b/src/lib/release_notes.h new file mode 100644 index 000000000..36f66d257 --- /dev/null +++ b/src/lib/release_notes.h @@ -0,0 +1,26 @@ +/* + Copyright (C) 2022 Carl Hetherington + + 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 . + +*/ + + +#include +#include + + +extern boost::optional find_release_notes(); diff --git a/src/lib/wscript b/src/lib/wscript index 8d3bb8eb5..b566a960c 100644 --- a/src/lib/wscript +++ b/src/lib/wscript @@ -152,6 +152,7 @@ sources = """ ratio.cc raw_image_proxy.cc reel_writer.cc + release_notes.cc render_text.cc resampler.cc rgba.cc diff --git a/src/tools/dcpomatic.cc b/src/tools/dcpomatic.cc index ebcd05a68..6f55b1771 100644 --- a/src/tools/dcpomatic.cc +++ b/src/tools/dcpomatic.cc @@ -78,6 +78,7 @@ #include "lib/kdm_with_metadata.h" #include "lib/log.h" #include "lib/make_dcp.h" +#include "lib/release_notes.h" #include "lib/screen.h" #include "lib/send_kdm_email_job.h" #include "lib/signal_manager.h" @@ -1686,6 +1687,14 @@ private: if (Config::instance()->check_for_updates ()) { UpdateChecker::instance()->run (); } + + auto release_notes = find_release_notes(); + if (release_notes) { + auto notes = new HTMLDialog(nullptr, _("Release notes"), std_to_wx(*release_notes), true); + notes->Centre(); + notes->ShowModal(); + notes->Destroy(); + } } catch (exception& e) {