Esempio n. 1
0
void WatchWidget::ShowContextMenu()
{
  QMenu* menu = new QMenu(this);

  if (m_table->selectedItems().size())
  {
    auto row_variant = m_table->selectedItems()[0]->data(Qt::UserRole);

    if (!row_variant.isNull())
    {
      int row = row_variant.toInt();

      if (row >= 0)
      {
        // i18n: This kind of "watch" is used for watching emulated memory.
        // It's not related to timekeeping devices.
        AddAction(menu, tr("&Delete Watch"), this, [this, row] { DeleteWatch(row); });
        AddAction(menu, tr("&Add Memory Breakpoint"), this,
                  [this, row] { AddWatchBreakpoint(row); });
      }
    }
  }

  menu->addSeparator();

  AddAction(menu, tr("Update"), this, &WatchWidget::Update);

  menu->exec(QCursor::pos());
}
Esempio n. 2
0
void WatchWidget::OnItemChanged(QTableWidgetItem* item)
{
  if (m_updating || item->data(Qt::UserRole).isNull())
    return;

  int row = item->data(Qt::UserRole).toInt();
  int column = item->data(Qt::UserRole + 1).toInt();

  if (row == -1)
  {
    if (!item->text().isEmpty())
    {
      AddWatch(item->text(), 0);

      Update();
      return;
    }
  }
  else
  {
    switch (column)
    {
    // Label
    case 0:
      if (item->text().isEmpty())
        DeleteWatch(row);
      else
        PowerPC::debug_interface.UpdateWatchName(row, item->text().toStdString());
      break;
    // Address
    // Hexadecimal
    // Decimal
    case 1:
    case 2:
    case 3:
    {
      bool good;
      quint32 value = item->text().toUInt(&good, column < 3 ? 16 : 10);

      if (good)
      {
        if (column == 1)
          PowerPC::debug_interface.UpdateWatchAddress(row, value);
        else
          PowerPC::HostWrite_U32(value, PowerPC::debug_interface.GetWatch(row).address);
      }
      else
      {
        QMessageBox::critical(this, tr("Error"), tr("Invalid input provided"));
      }
      break;
    }
    }

    Update();
  }
}
Esempio n. 3
0
void DebuggerTree::OnDeleteWatch(wxCommandEvent& event)
{
    WatchTreeData* data = static_cast<WatchTreeData*>(m_pTree->GetItemData(m_pTree->GetSelection()));
    Watch* w = data ? data->m_pWatch : 0;
    if (w)
    {
        DeleteWatch(w);
        m_pTree->Delete(m_pTree->GetSelection());
    }
}
Esempio n. 4
0
void DebuggerTree::DeleteWatch(Watch* watch, bool notify)
{
    DeleteWatch(watch->keyword, watch->format, notify);
}