summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2024-06-09 20:20:13 +0200
committerCarl Hetherington <cth@carlh.net>2024-06-09 20:20:13 +0200
commit9625bcb0a56b864efaf3773cd20446b4091c5778 (patch)
tree90d078064132614308c8d748751c33622b8ca636
parent20d5f98f1b72ad2152bfdceb2d18c3d593e6202a (diff)
Stop weird names appearing when the user clicks "copy as name" twice.
-rw-r--r--src/wx/dcp_panel.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/wx/dcp_panel.cc b/src/wx/dcp_panel.cc
index 5ee65804d..4d2ee12b9 100644
--- a/src/wx/dcp_panel.cc
+++ b/src/wx/dcp_panel.cc
@@ -998,6 +998,13 @@ DCPPanel::add_audio_panel_to_grid ()
void
DCPPanel::copy_isdcf_name_button_clicked ()
{
+ auto name = _film->name();
+ if (name.length() > 20 && std::count(name.begin(), name.end(), '_') > 6) {
+ /* At a guess, the existing film name is itself an ISDCF name, so chop
+ * off the actual name part first.
+ */
+ _film->set_name(name.substr(0, name.find("_")));
+ }
_film->set_name (_film->isdcf_name (true));
_film->set_use_isdcf_name (false);
}