Ejemplo n.º 1
0
void
he_value_page_c::set_sub_master_callbacks(const EbmlCallbacks &callbacks) {
  m_sub_master_callbacks = &callbacks;

  EbmlMaster *sub_master = static_cast<EbmlMaster *>(find_ebml_element_by_id(m_master, m_sub_master_callbacks->GlobalId));
  if (sub_master)
    m_element = find_ebml_element_by_id(sub_master, m_callbacks.GlobalId);
}
Ejemplo n.º 2
0
void
he_value_page_c::modify_this() {
  if (!has_this_been_modified())
    return;

  EbmlMaster *actual_master = nullptr;
  if (m_sub_master_callbacks) {
    actual_master = static_cast<EbmlMaster *>(find_ebml_element_by_id(m_master, m_sub_master_callbacks->GlobalId));

    if (!actual_master) {
      actual_master = static_cast<EbmlMaster *>(&m_sub_master_callbacks->Create());
      m_master->PushElement(*actual_master);
    }
  }

  if (!actual_master)
    actual_master = m_master;

  if (m_present && m_cb_add_or_remove->IsChecked()) {
    size_t i;
    for (i = 0; actual_master->ListSize() > i; ++i) {
      if ((*actual_master)[i]->Generic().GlobalId != m_callbacks.GlobalId)
        continue;

      EbmlElement *e = (*actual_master)[i];
      delete e;

      actual_master->Remove(i);

      break;
    }

    return;
  }

  if (!m_present) {
    m_element = &m_callbacks.Create();
    actual_master->PushElement(*m_element);
  }

  copy_value_to_element();
}
Ejemplo n.º 3
0
he_value_page_c::he_value_page_c(header_editor_frame_c *parent,
                                 he_page_base_c *toplevel_page,
                                 EbmlMaster *master,
                                 const EbmlCallbacks &callbacks,
                                 const value_type_e value_type,
                                 const translatable_string_c &title,
                                 const translatable_string_c &description)
  : he_page_base_c(parent, title)
  , m_master(master)
  , m_callbacks(callbacks)
  , m_sub_master_callbacks(nullptr)
  , m_description(description)
  , m_value_type(value_type)
  , m_present(false)
  , m_cb_add_or_remove(nullptr)
  , m_input(nullptr)
  , m_b_reset(nullptr)
  , m_element(find_ebml_element_by_id(m_master, m_callbacks.GlobalId))
  , m_toplevel_page(toplevel_page)
{
}
Ejemplo n.º 4
0
using namespace mtx::gui;

ValuePage::ValuePage(Tab &parent,
                     PageBase &topLevelPage,
                     EbmlMaster &master,
                     EbmlCallbacks const &callbacks,
                     ValueType valueType,
                     translatable_string_c const &title,
                     translatable_string_c const &description)
  : PageBase{parent, title}
  , m_master(master)
  , m_callbacks(callbacks)
  , m_description{description}
  , m_valueType{valueType}
  , m_element{find_ebml_element_by_id(&m_master, m_callbacks.GlobalId)}
  , m_present{!!m_element}
  , m_topLevelPage(topLevelPage)
{
}

ValuePage::~ValuePage() {
}

void
ValuePage::init() {
  m_lTitle = new QLabel{this};
  m_lTitle->setWordWrap(true);

  auto line = new QFrame{this};
  line->setFrameShape(QFrame::HLine);