void ContactInfoDialog::Private::onContactInfoReceived(Tp::PendingOperation* op) { Tp::PendingContactInfo *ci = qobject_cast<Tp::PendingContactInfo*>(op); const Tp::ContactInfoFieldList fieldList = ci->infoFields().allFields(); for (InfoRowIndex index = (InfoRowIndex) 0; index < _InfoRowCount; index = (InfoRowIndex)(index + 1)) { QString value; Q_FOREACH(const Tp::ContactInfoField &field, fieldList) { if (field.fieldValue.count() == 0) { continue; } if (field.fieldName == InfoRows[index].fieldName) { value = field.fieldValue.first(); break; } } /* Show edits for all values when in editable mode */ if (!editable && value.isEmpty()) { continue; } addInfoRow(index, value); } }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { updating_gui = true; ui->setupUi(this); connect(&run_timer, SIGNAL(timeout()), this, SLOT(pumpCPU())); ui->registers_table->setColumnCount(2); ui->registers_table->setRowCount(0); addInfoRow("A", new ReadWriteWidgetItem(&debugger, DCPU16::RW_REGISTER_0)); addInfoRow("B", new ReadWriteWidgetItem(&debugger, DCPU16::RW_REGISTER_1)); addInfoRow("C", new ReadWriteWidgetItem(&debugger, DCPU16::RW_REGISTER_2)); addInfoRow("I", new ReadWriteWidgetItem(&debugger, DCPU16::RW_REGISTER_3)); addInfoRow("J", new ReadWriteWidgetItem(&debugger, DCPU16::RW_REGISTER_4)); addInfoRow("K", new ReadWriteWidgetItem(&debugger, DCPU16::RW_REGISTER_5)); addInfoRow("X", new ReadWriteWidgetItem(&debugger, DCPU16::RW_REGISTER_6)); addInfoRow("Y", new ReadWriteWidgetItem(&debugger, DCPU16::RW_REGISTER_7)); addInfoRow("PC", new ReadWriteWidgetItem(&debugger, DCPU16::RW_PROGRAM_COUNTER)); addInfoRow("SP", new ReadWriteWidgetItem(&debugger, DCPU16::RW_STACK_POINTER)); addInfoRow("EX", new ReadWriteWidgetItem(&debugger, DCPU16::RW_EXCESS)); addInfoRow("[A]", new ReadWriteWidgetItem(&debugger, DCPU16::RW_REGISTER_PTR_0)); addInfoRow("[B]", new ReadWriteWidgetItem(&debugger, DCPU16::RW_REGISTER_PTR_1)); addInfoRow("[C]", new ReadWriteWidgetItem(&debugger, DCPU16::RW_REGISTER_PTR_2)); addInfoRow("[I]", new ReadWriteWidgetItem(&debugger, DCPU16::RW_REGISTER_PTR_3)); addInfoRow("[J]", new ReadWriteWidgetItem(&debugger, DCPU16::RW_REGISTER_PTR_4)); addInfoRow("[K]", new ReadWriteWidgetItem(&debugger, DCPU16::RW_REGISTER_PTR_5)); addInfoRow("[X]", new ReadWriteWidgetItem(&debugger, DCPU16::RW_REGISTER_PTR_6)); addInfoRow("[Y]", new ReadWriteWidgetItem(&debugger, DCPU16::RW_REGISTER_PTR_7)); addInfoRow("[PC]", new ReadWriteWidgetItem(&debugger, DCPU16::RW_PROGRAM_COUNTER_PTR)); addInfoRow("[SP]", new ReadWriteWidgetItem(&debugger, DCPU16::RW_STACK_POINTER_PTR)); addInfoRow("Cycles", new CyclesWidgetItem(&debugger)); addInfoRow("Error", new ErrorWidgetItem(&debugger)); ui->splitter->setStretchFactor(0, 30); ui->splitter->setStretchFactor(1, 1); uint16_t prog[32] = { 0x7c01, 0x0030, 0x7de1, 0x1000, 0x0020, 0x7803, 0x1000, 0xc00d, 0x7dc1, 0x001a, 0xa861, 0x7c01, 0x2000, 0x2161, 0x2000, 0x8463, 0x806d, 0x7dc1, 0x000d, 0x9031, 0x7c10, 0x0018, 0x7dc1, 0x001a, 0x9037, 0x61c1, 0x7dc1, 0x001a }; uint16_t prog_fib[] = { 0xa031, 0x0c01, 0x7c10, 0x0007, 0x0051, 0x7dc1, 0x002a, 0x8061, 0x180c, 0x7dc1, 0x0026, 0x8461, 0x180c, 0x7dc1, 0x0028, 0x8861, 0x180c, 0x7dc1, 0x0028, 0x0061, 0x8463, 0x0071, 0x8873, 0x1da1, 0x1801, 0x7c10, 0x0007, 0x6071, 0x0031, 0x0da1, 0x1c01, 0x7c10, 0x0007, 0x6031, 0x0041, 0x0c01, 0x1002, 0x61c1, 0x8001, 0x61c1, 0x8401, 0x61c1, 0x7de1, 0x1000, 0xfff0, 0x7dc1, 0x1000, }; //debugger.loadProgram(prog, 28); debugger.loadProgram(prog_fib, sizeof(prog_fib)/sizeof(prog_fib[0])); ui->memory_view->setDebugger(&debugger); updateGUI(); updating_gui = false; }