diff options
| author | Carl Hetherington <cth@carlh.net> | 2022-10-16 22:21:49 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2022-10-18 20:37:00 +0200 |
| commit | 93a781c8b9d34effd376537268970193b9b01479 (patch) | |
| tree | 719008d31a03a1b8904935e37b440d7aec33b8d1 | |
| parent | fecfda4c913da3f60ab4329d1f4f412bc27d19a7 (diff) | |
Fix dark mode for release notes.
| -rw-r--r-- | src/lib/release_notes.cc | 12 | ||||
| -rw-r--r-- | src/lib/release_notes.h | 2 | ||||
| -rw-r--r-- | src/tools/dcpomatic.cc | 2 | ||||
| -rw-r--r-- | src/wx/html_dialog.cc | 4 | ||||
| -rw-r--r-- | test/release_notes_test.cc | 4 |
5 files changed, 16 insertions, 8 deletions
diff --git a/src/lib/release_notes.cc b/src/lib/release_notes.cc index 236713184..d69738427 100644 --- a/src/lib/release_notes.cc +++ b/src/lib/release_notes.cc @@ -31,7 +31,7 @@ using boost::optional; optional<string> -find_release_notes(optional<string> current) +find_release_notes(bool dark, optional<string> current) { auto last = Config::instance()->last_release_notes_version(); if (!current) { @@ -43,14 +43,18 @@ find_release_notes(optional<string> current) Config::instance()->set_last_release_notes_version(*current); - const string header = String::compose("<h1>DCP-o-matic %1 release notes</h1>", *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); if (!last) { - return header + + return header + span + _("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."); + "where you want them.") + + "</span>"; } return {}; diff --git a/src/lib/release_notes.h b/src/lib/release_notes.h index a5026b432..d0837248b 100644 --- a/src/lib/release_notes.h +++ b/src/lib/release_notes.h @@ -23,4 +23,4 @@ #include <string> -extern boost::optional<std::string> find_release_notes(boost::optional<std::string> current = boost::optional<std::string>()); +extern boost::optional<std::string> find_release_notes(bool dark, boost::optional<std::string> current = boost::optional<std::string>()); diff --git a/src/tools/dcpomatic.cc b/src/tools/dcpomatic.cc index eec81d3c8..001d1859e 100644 --- a/src/tools/dcpomatic.cc +++ b/src/tools/dcpomatic.cc @@ -1746,7 +1746,7 @@ private: UpdateChecker::instance()->run (); } - auto release_notes = find_release_notes(); + auto release_notes = find_release_notes(gui_is_dark()); if (release_notes) { auto notes = new HTMLDialog(nullptr, _("Release notes"), std_to_wx(*release_notes), true); notes->Centre(); diff --git a/src/wx/html_dialog.cc b/src/wx/html_dialog.cc index 19c3aaf2a..c8138c8cd 100644 --- a/src/wx/html_dialog.cc +++ b/src/wx/html_dialog.cc @@ -52,6 +52,10 @@ HTMLDialog::HTMLDialog (wxWindow* parent, wxString title, wxString html, bool ok h->SetPage (html); sizer->Add (h, 1, wxEXPAND | wxALL, 6); + if (gui_is_dark()) { + h->SetHTMLBackgroundColour(*wxBLACK); + } + h->Bind (wxEVT_HTML_LINK_CLICKED, boost::bind(&HTMLDialog::link_clicked, this, _1)); SetSizer (sizer); diff --git a/test/release_notes_test.cc b/test/release_notes_test.cc index 394de5959..c05ad2618 100644 --- a/test/release_notes_test.cc +++ b/test/release_notes_test.cc @@ -32,7 +32,7 @@ BOOST_AUTO_TEST_CASE(release_notes_test1) { for (auto version: { "2.16.19", "2.16.20", "2.18.0", "2.18.1devel6" }) { Config::instance()->unset_last_release_notes_version(); - auto notes = find_release_notes(string(version)); + auto notes = find_release_notes(true, string(version)); BOOST_CHECK(notes.get_value_or("").find("In this version there are changes to the way that subtitles are positioned.") != string::npos); } } @@ -43,7 +43,7 @@ BOOST_AUTO_TEST_CASE(release_notes_test2) { for (auto version: { "2.16.19", "2.16.20", "2.18.0", "2.18.1devel6" }) { Config::instance()->set_last_release_notes_version("2.16.19"); - auto notes = find_release_notes(string(version)); + auto notes = find_release_notes(false, string(version)); BOOST_CHECK(!static_cast<bool>(notes)); } } |
