diff options
| author | Carl Hetherington <cth@carlh.net> | 2025-01-26 00:35:30 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2025-01-26 02:21:16 +0100 |
| commit | 811e70bdd09a618f8b0a512950a7f3254c591614 (patch) | |
| tree | df0247233e5c34fa83316aa8d61717cc5a650a90 | |
| parent | d0fd28941427f30c0b844c429b7c92e8031b49d5 (diff) | |
Extract some logic to a separate method.
| -rw-r--r-- | src/wx/content_panel.cc | 54 |
1 files changed, 33 insertions, 21 deletions
diff --git a/src/wx/content_panel.cc b/src/wx/content_panel.cc index 8938ef0fd..98eb88ee7 100644 --- a/src/wx/content_panel.cc +++ b/src/wx/content_panel.cc @@ -881,6 +881,36 @@ ContentPanel::film_content_changed (int property) } +static +wxString +text_for_content(shared_ptr<Content> content, bool& alert) +{ + bool const valid = content->paths_valid(); + + auto dcp = dynamic_pointer_cast<DCPContent>(content); + bool const needs_kdm = dcp && dcp->needs_kdm(); + bool const needs_assets = dcp && dcp->needs_assets(); + + auto s = std_to_wx(content->summary()); + + if (!valid) { + s = _("MISSING: ") + s; + } + + if (needs_kdm) { + s = _("NEEDS KDM: ") + s; + } + + if (needs_assets) { + s = _("NEEDS OV: ") + s; + } + + alert = !valid || needs_kdm || needs_assets; + + return s; +} + + void ContentPanel::setup () { @@ -896,27 +926,9 @@ ContentPanel::setup () vector<ContentListCtrl::Item> items; for (auto i: content) { - bool const valid = i->paths_valid (); - - auto dcp = dynamic_pointer_cast<DCPContent> (i); - bool const needs_kdm = dcp && dcp->needs_kdm (); - bool const needs_assets = dcp && dcp->needs_assets (); - - auto s = std_to_wx (i->summary ()); - - if (!valid) { - s = _("MISSING: ") + s; - } - - if (needs_kdm) { - s = _("NEEDS KDM: ") + s; - } - - if (needs_assets) { - s = _("NEEDS OV: ") + s; - } - - items.push_back({s, i, !valid || needs_kdm || needs_assets}); + bool alert = false; + wxString const s = text_for_content(i, alert); + items.push_back({s, i, alert}); } _content->set(items); |
