void ValuePage::retranslateUi() { if (!m_bReset) return; m_lTitle->setText(Q(m_title.get_translated())); auto type = ValueType::AsciiString == m_valueType ? QY("ASCII string (no special chars like Umlaute etc)") : ValueType::String == m_valueType ? QY("String") : ValueType::UnsignedInteger == m_valueType ? QY("Unsigned integer") : ValueType::Float == m_valueType ? QY("Floating point number") : ValueType::Binary == m_valueType ? QY("Binary (displayed as hex numbers)") : ValueType::Bool == m_valueType ? QY("Boolean (yes/no, on/off etc)") : QY("unknown"); m_lTypeLabel->setText(QY("Type:")); m_lType->setText(type); if (!m_description.get_translated().empty()) { m_lDescriptionLabel->setText(QY("Description:")); m_lDescription->setText(Q(m_description.get_translated())); } m_lStatusLabel->setText(QY("Status:")); if (m_present) { auto semantic = find_ebml_semantic(KaxSegment::ClassInfos, m_callbacks.GlobalId); if (semantic && semantic->Mandatory) 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."))); m_lValueLabel->setText(QY("Current value:")); m_cbAddOrRemove->setText(QY("Remove element")); m_lOriginalValueLabel->setText(QY("Original value:")); m_lOriginalValue->setText(originalValueAsString()); } else { m_lStatus->setText(Q("%1 %2").arg(QY("This element is not currently present in the file.")).arg(QY("You can let the header editor add the element to the file."))); m_lValueLabel->setText(QY("New value:")); m_cbAddOrRemove->setText(QY("Add element")); } m_bReset->setText(QY("&Reset this value")); Util::setToolTip(m_bReset, QY("Resets the header value on this page to how it's saved in the file.")); }
void he_value_page_c::translate_ui() { if (!m_b_reset) return; m_b_reset->SetLabel(Z("&Reset")); wxString type = vt_ascii_string == m_value_type ? Z("ASCII string (no special chars like\nUmlaute etc)") : vt_string == m_value_type ? Z("String") : vt_unsigned_integer == m_value_type ? Z("Unsigned integer") : vt_signed_integer == m_value_type ? Z("Signed integer") : vt_float == m_value_type ? Z("Floating point number") : vt_binary == m_value_type ? Z("Binary (displayed as hex numbers)") : vt_bool == m_value_type ? Z("Boolean (yes/no, on/off etc)") : Z("unknown"); m_st_type_label->SetLabel(Z("Type:")); m_st_type->SetLabel(type); if (!m_description.get_translated().empty()) { m_st_description_label->SetLabel(Z("Description:")); m_st_description->SetLabel(wxU(m_description.get_translated())); } if (!m_element) { m_st_add_or_remove->SetLabel(Z("This element is not currently present in the file.\nYou can let the header editor add the element\nto the file.")); m_st_value_label->SetLabel(Z("New value:")); m_cb_add_or_remove->SetLabel(Z("Add element")); } else { m_st_add_or_remove->SetLabel(Z("This element is currently present in the file.\nYou can let the header editor remove the element\nfrom the file.")); m_st_value_label->SetLabel(Z("Current value:")); m_cb_add_or_remove->SetLabel(Z("Remove element")); const EbmlSemantic *semantic = find_ebml_semantic(KaxSegment::ClassInfos, m_callbacks.GlobalId); if (semantic && semantic->Mandatory) m_st_add_or_remove->SetLabel(Z("This element is currently present in the file.\nIt cannot be removed because it is a\nmandatory header field.")); } m_st_status->SetLabel(Z("Status:")); if (m_present) m_st_original_value->SetLabel(Z("Original value:")); }
const EbmlSemantic * change_c::get_semantic() { return find_ebml_semantic(KaxSegment::ClassInfos, m_property.m_callbacks->GlobalId); }
void ValuePage::init() { m_lTitle = new QLabel{this}; m_lTitle->setWordWrap(true); auto line = new QFrame{this}; line->setFrameShape(QFrame::HLine); line->setFrameShadow(QFrame::Sunken); m_lTypeLabel = new QLabel{this}; m_lType = new QLabel{this}; auto sizePolicy = QSizePolicy{QSizePolicy::Expanding, QSizePolicy::Preferred}; sizePolicy.setHorizontalStretch(0); sizePolicy.setVerticalStretch(0); sizePolicy.setHeightForWidth(m_lType->sizePolicy().hasHeightForWidth()); m_lType->setSizePolicy(sizePolicy); if (!m_description.get_untranslated().empty()) { m_lDescriptionLabel = new QLabel{this}; m_lDescription = new QLabel{this}; sizePolicy.setHeightForWidth(m_lDescription->sizePolicy().hasHeightForWidth()); m_lDescription->setSizePolicy(sizePolicy); m_lDescription->setWordWrap(true); } m_lStatusLabel = new QLabel{this}; m_lStatus = new QLabel{this}; m_cbAddOrRemove = new QCheckBox{this}; if (m_present) { auto semantic = find_ebml_semantic(KaxSegment::ClassInfos, m_callbacks.GlobalId); if (semantic && semantic->Mandatory) m_cbAddOrRemove->setEnabled(false); } sizePolicy.setHeightForWidth(m_lStatus->sizePolicy().hasHeightForWidth()); m_lStatus->setSizePolicy(sizePolicy); m_lStatus->setWordWrap(true); if (m_present) { m_lOriginalValueLabel = new QLabel{this}; m_lOriginalValue = new QLabel{this}; } m_lValueLabel = new QLabel{this}; m_input = createInputControl(); m_input->setEnabled(m_present); m_bReset = new QPushButton{this}; // ---------------------------------------------------------------------- auto statusLayout = new QVBoxLayout{}; statusLayout->addWidget(m_lStatus); statusLayout->addWidget(m_cbAddOrRemove); auto row = 0; auto gridLayout = new QGridLayout{}; gridLayout->addWidget(m_lTypeLabel, row, 0, 1, 1); gridLayout->addWidget(m_lType, row++, 1, 1, 1); if (!m_description.get_untranslated().empty()) { gridLayout->addWidget(m_lDescriptionLabel, row, 0, 1, 1, Qt::AlignTop); gridLayout->addWidget(m_lDescription, row++, 1, 1, 1, Qt::AlignTop); } gridLayout->addWidget(m_lStatusLabel, row, 0, 1, 1, Qt::AlignTop); gridLayout->addLayout(statusLayout, row++, 1, 1, 1, Qt::AlignTop); if (m_present) { gridLayout->addWidget(m_lOriginalValueLabel, row, 0, 1, 1); gridLayout->addWidget(m_lOriginalValue, row++, 1, 1, 1); } gridLayout->addWidget(m_lValueLabel, row, 0, 1, 1); gridLayout->addWidget(m_input, row++, 1, 1, 1); auto resetLayout = new QHBoxLayout{}; resetLayout->addItem(new QSpacerItem{0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum}); resetLayout->addWidget(m_bReset); auto widgetLayout = new QVBoxLayout{this}; widgetLayout->addWidget(m_lTitle); widgetLayout->addWidget(line); widgetLayout->addLayout(gridLayout); widgetLayout->addItem(new QSpacerItem{0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding}); widgetLayout->addLayout(resetLayout); // ---------------------------------------------------------------------- connect(m_cbAddOrRemove, SIGNAL(toggled(bool)), this, SLOT(onAddOrRemoveChecked())); connect(m_bReset, SIGNAL(clicked()), this, SLOT(onResetClicked())); // ---------------------------------------------------------------------- m_parent.appendPage(this, m_topLevelPage.m_pageIdx); m_topLevelPage.m_children << this; retranslateUi(); }
void he_value_page_c::init() { m_cb_add_or_remove = new wxCheckBox(this, ID_HE_CB_ADD_OR_REMOVE, wxEmptyString); m_input = create_input_control(); m_b_reset = new wxButton(this, ID_HE_B_RESET); wxBoxSizer *siz = new wxBoxSizer(wxVERTICAL); siz->AddSpacer(5); siz->Add(new wxStaticText(this, wxID_ANY, wxU(m_title.get_translated())), 0, wxGROW | wxLEFT | wxRIGHT, 5); siz->AddSpacer(5); siz->Add(new wxStaticLine(this), 0, wxGROW | wxLEFT | wxRIGHT, 5); siz->AddSpacer(5); wxFlexGridSizer *siz_fg = new wxFlexGridSizer(2, 5, 5); siz_fg->AddGrowableCol(1, 1); siz_fg->AddSpacer(5); siz_fg->AddSpacer(5); m_st_type_label = new wxStaticText(this, wxID_ANY, wxEmptyString); m_st_type = new wxStaticText(this, wxID_ANY, wxEmptyString); siz_fg->Add(m_st_type_label, 0, wxALIGN_TOP, 0); siz_fg->Add(m_st_type, 0, wxALIGN_TOP | wxGROW, 0); if (!m_description.get_untranslated().empty()) { m_st_description_label = new wxStaticText(this, wxID_ANY, wxEmptyString); m_st_description = new wxStaticText(this, wxID_ANY, wxEmptyString); siz_fg->Add(m_st_description_label, 0, wxALIGN_TOP, 0); siz_fg->Add(m_st_description, 0, wxALIGN_TOP | wxGROW, 0); } m_st_add_or_remove = new wxStaticText(this, wxID_ANY, wxEmptyString); if (!m_element) m_present = false; else { m_present = true; const EbmlSemantic *semantic = find_ebml_semantic(KaxSegment::ClassInfos, m_callbacks.GlobalId); if (semantic && semantic->Mandatory) m_cb_add_or_remove->Disable(); } m_st_status = new wxStaticText(this, wxID_ANY, wxEmptyString); siz_fg->Add(m_st_status, 0, wxALIGN_TOP, 0); siz_fg->Add(m_st_add_or_remove, 1, wxALIGN_TOP | wxGROW, 0); siz_fg->AddSpacer(0); siz_fg->Add(m_cb_add_or_remove, 1, wxALIGN_TOP | wxGROW, 0); if (m_present) { m_st_original_value = new wxStaticText(this, wxID_ANY, wxEmptyString); siz_fg->Add(m_st_original_value, 0, wxALIGN_TOP, 0); siz_fg->Add(new wxStaticText(this, wxID_ANY, get_original_value_as_string()), 1, wxALIGN_TOP | wxGROW, 0); } m_input->Enable(m_present); m_st_value_label = new wxStaticText(this, wxID_ANY, wxEmptyString); siz_fg->Add(m_st_value_label, 0, wxALIGN_CENTER_VERTICAL, 0); siz_fg->Add(m_input, 1, wxALIGN_CENTER_VERTICAL | wxGROW, 0); siz->Add(siz_fg, 0, wxGROW | wxLEFT | wxRIGHT, 5); siz->AddStretchSpacer(); wxBoxSizer *siz_line = new wxBoxSizer(wxHORIZONTAL); siz_line->AddStretchSpacer(); siz_line->Add(m_b_reset, 0, wxGROW, 0); siz->Add(siz_line, 0, wxGROW | wxLEFT | wxRIGHT, 5); siz->AddSpacer(5); SetSizer(siz); if (!m_toplevel_page) m_parent->append_page(this); else m_parent->append_sub_page(this, m_toplevel_page->m_page_id); m_toplevel_page->m_children.push_back(this); translate_ui(); }