diff --git a/NEWS.md b/NEWS.md index 4a96558d2..58abd4c1b 100644 --- a/NEWS.md +++ b/NEWS.md @@ -26,6 +26,9 @@ #2304. * MKVToolNix GUI: header editor: fixed a crash when saving the file fails (e.g. because it isn't writable). Fixes #2319. +* MKVToolNix GUI: header editor: the editor was wrongfully claiming that + mandatory elements with default values cannot be removed in the "status" + text. Fixes #2320. ## Other changes diff --git a/src/mkvtoolnix-gui/header_editor/value_page.cpp b/src/mkvtoolnix-gui/header_editor/value_page.cpp index b31a95542..dd86b0caa 100644 --- a/src/mkvtoolnix-gui/header_editor/value_page.cpp +++ b/src/mkvtoolnix-gui/header_editor/value_page.cpp @@ -73,8 +73,10 @@ ValuePage::init() { auto semantic = find_ebml_semantic(KaxSegment::ClassInfos, m_callbacks.GlobalId); if (semantic && semantic->Mandatory) { std::unique_ptr elt(&semantic->Create()); - m_cbAddOrRemove->setEnabled(elt->DefaultISset()); + m_mayBeRemoved = elt->DefaultISset(); } + + m_cbAddOrRemove->setEnabled(m_mayBeRemoved); } sizePolicy.setHeightForWidth(m_lStatus->sizePolicy().hasHeightForWidth()); @@ -169,8 +171,7 @@ ValuePage::retranslateUi() { m_lStatusLabel->setText(QY("Status:")); if (m_present) { - auto semantic = find_ebml_semantic(KaxSegment::ClassInfos, m_callbacks.GlobalId); - if (semantic && semantic->Mandatory) + if (!m_mayBeRemoved) m_lStatus->setText(Q("%1 %2").arg(QY("This element is currently present in the file.")).arg(QY("It cannot be removed because it is a mandatory header field."))); else m_lStatus->setText(Q("%1 %2").arg(QY("This element is currently present in the file.")).arg(QY("You can let the header editor remove the element from the file."))); diff --git a/src/mkvtoolnix-gui/header_editor/value_page.h b/src/mkvtoolnix-gui/header_editor/value_page.h index b4ac37a02..40a33c673 100644 --- a/src/mkvtoolnix-gui/header_editor/value_page.h +++ b/src/mkvtoolnix-gui/header_editor/value_page.h @@ -39,7 +39,7 @@ public: QLabel *m_lTitle{}, *m_lTypeLabel{}, *m_lType{}, *m_lDescriptionLabel{}, *m_lDescription{}, *m_lStatusLabel{}, *m_lStatus{}, *m_lOriginalValueLabel{}, *m_lOriginalValue{}, *m_lValueLabel{}; EbmlElement *m_element{}; - bool m_present{}; + bool m_present{}, m_mayBeRemoved{}; PageBase &m_topLevelPage;