Basic release notes support (#2282).
authorCarl Hetherington <cth@carlh.net>
Thu, 7 Jul 2022 13:21:19 +0000 (15:21 +0200)
committerCarl Hetherington <cth@carlh.net>
Wed, 20 Jul 2022 08:38:17 +0000 (10:38 +0200)
src/lib/config.cc
src/lib/config.h
src/lib/release_notes.cc [new file with mode: 0644]
src/lib/release_notes.h [new file with mode: 0644]
src/lib/wscript
src/tools/dcpomatic.cc

index aacc71edfc4b4ce12ac4481a441eb1e47231cac6..cb2ec8885569daf56736690c70b52b6f5b725905 100644 (file)
@@ -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<double>("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<string>(_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"));
 
index f53b8986e0ff890ebb36379ad52a9e4fca46c17f..9727bac1a16f0fc03398fa54c3643e0f3f255d57 100644 (file)
@@ -586,6 +586,10 @@ public:
                return _auto_crop_threshold;
        }
 
+       boost::optional<std::string> 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<std::string> _last_release_notes_version;
 
        ExportConfig _export;
 
diff --git a/src/lib/release_notes.cc b/src/lib/release_notes.cc
new file mode 100644 (file)
index 0000000..b1eb952
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+    Copyright (C) 2022 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 "config.h"
+#include "release_notes.h"
+#include "version.h"
+
+#include "i18n.h"
+
+
+using std::string;
+using boost::optional;
+
+
+optional<string>
+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("<h1>DCP-o-matic %1 release notes</h1>", 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 (file)
index 0000000..36f66d2
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+    Copyright (C) 2022 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 <boost/optional.hpp>
+#include <string>
+
+
+extern boost::optional<std::string> find_release_notes();
index 8d3bb8eb5df07b680e75fd740ef2322e843c609d..b566a960cf977b6f7273c1d6a30ccaa3c8a2c264 100644 (file)
@@ -152,6 +152,7 @@ sources = """
           ratio.cc
           raw_image_proxy.cc
           reel_writer.cc
+          release_notes.cc
           render_text.cc
           resampler.cc
           rgba.cc
index ebcd05a682770c20677d4ca1db22b893d3567303..6f55b1771b88f2bbbc352520aa7c7deae10005b7 100644 (file)
@@ -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)
                {