GUI: headers: fix removal status text for mandatory elements with default values

Fixes #2320.
This commit is contained in:
Moritz Bunkus 2018-06-09 08:59:22 +02:00
parent 21d09d4bcd
commit 0d7d5ca3dd
No known key found for this signature in database
GPG Key ID: 74AF00ADF2E32C85
3 changed files with 8 additions and 4 deletions

View File

@ -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

View File

@ -73,8 +73,10 @@ ValuePage::init() {
auto semantic = find_ebml_semantic(KaxSegment::ClassInfos, m_callbacks.GlobalId);
if (semantic && semantic->Mandatory) {
std::unique_ptr<EbmlElement> 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.")));

View File

@ -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;