예제 #1
0
파일: LabelDialog.cpp 프로젝트: anat/medusa
LabelDialog::LabelDialog(QWidget * pParent, medusa::Medusa& rCore, medusa::Address const& rAddress)
  : QDialog(pParent), m_rCore(rCore), m_rAddress(rAddress)
{
  this->setupUi(this);
  connect(ButtonBox, SIGNAL(accepted()), SLOT(SetLabel()));
  connect(ButtonBox, SIGNAL(rejected()), SLOT(close()));

  medusa::Label const& rCurLbl = rCore.GetDocument().GetLabelFromAddress(rAddress);
  LabelName->setText(QString::fromStdString(rCurLbl.GetName()));

  switch (rCurLbl.GetType() & medusa::Label::CellMask)
  {
  default:
  case medusa::Label::Data:     DataButton->setChecked(true);   break;
  case medusa::Label::Code:     CodeButton->setChecked(true);   break;
  case medusa::Label::String:   StringButton->setChecked(true); break;
  case medusa::Label::Function: FunctionButton->setChecked(true); break;
  }

  switch (rCurLbl.GetType() & medusa::Label::AccessMask)
  {
  default:
  case medusa::Label::Local:  LocalButton->setChecked(true);  break;
  case medusa::Label::Global: GlobalButton->setChecked(true); break;
  }
}
예제 #2
0
MemoryAreaView::MemoryAreaView(QWidget * parent, medusa::Medusa &core)
  : QTreeView(parent)
  , View(medusa::Document::Subscriber::MemoryAreaUpdated, core.GetDocument())
  , _core(core)
{
  qRegisterMetaType<medusa::MemoryArea*>("MemoryArea");
  setEditTriggers(QAbstractItemView::NoEditTriggers);
  auto model = new QStandardItemModel(this);
  model->setColumnCount(4);
  model->setHeaderData(0, Qt::Horizontal, "Name");
  model->setHeaderData(1, Qt::Horizontal, "Address");
  model->setHeaderData(2, Qt::Horizontal, "Size");
  model->setHeaderData(3, Qt::Horizontal, "Access");
  setModel(model);
  connect(this, SIGNAL(doubleClicked(QModelIndex const&)), this, SLOT(onDoubleClickMemoryArea(QModelIndex const&)));
  connect(this, SIGNAL(memoryAreaAdded(medusa::MemoryArea const&)), this, SLOT(onAddMemoryArea(medusa::MemoryArea const&)));
}
예제 #3
0
LabelView::LabelView(QWidget * parent, medusa::Medusa &core)
  : QTreeView(parent), View(medusa::Document::Subscriber::LabelUpdated, core.GetDocument())
  , _core(core)
{
  setUniformRowHeights(false);
  qRegisterMetaType<medusa::Address>("Address");
  qRegisterMetaType<medusa::Label>("Label");
  setEditTriggers(QAbstractItemView::NoEditTriggers);
  auto model = new QStandardItemModel(this);
  model->setColumnCount(3);
  model->setHeaderData(0, Qt::Horizontal, "Name");
  model->setHeaderData(1, Qt::Horizontal, "Type");
  model->setHeaderData(2, Qt::Horizontal, "Address");
  setModel(model);
  connect(this, SIGNAL(doubleClicked(QModelIndex const&)),  this, SLOT(onDoubleClickLabel(QModelIndex const&)));
  connect(this, SIGNAL(labelAdded(medusa::Address const&, medusa::Label const&)),   this, SLOT(onAddLabel(medusa::Address const&, medusa::Label const&)));
  connect(this, SIGNAL(labelRemoved(medusa::Address const&, medusa::Label const&)), this, SLOT(onRemoveLabel(medusa::Address const&, medusa::Label const&)));
}