]>
git.siccegge.de Git - frida/frida.git/blob - src/gui/widgets/BasicBlockWidget.cxx
1 #include "BasicBlockWidget.hxx"
3 BasicBlockWidget::BasicBlockWidget(const QString
& name
, BasicBlock
* block
)
4 : width(270), height(45)
5 , name(name
), block(block
) {
6 next
[0] = NULL
; next
[1] = NULL
;
8 _widget
.setGridStyle(Qt::NoPen
);
9 _widget
.setShowGrid(false);
10 _widget
.setWordWrap(false);
11 _widget
.setMinimumHeight(_widget
.rowHeight(0) + 10);
12 _widget
.setMaximumHeight(20);
13 _widget
.resizeColumnToContents(0);
14 _widget
.resizeColumnToContents(1);
15 _widget
.resizeColumnToContents(2);
16 _widget
.updateGeometry();
17 _widget
.setMaximumWidth(260);
18 _widget
.setColumnCount(3);
19 _widget
.verticalHeader()->hide();
20 _widget
.horizontalHeader()->hide();
21 width
= _widget
.rowHeight(0) + 20;
22 if (width
< 270) width
= 270;
25 void BasicBlockWidget::addItem(uint8_t* bytes
, size_t num_bytes
,
26 const QString
& line
) {
27 size_t current_row
= _widget
.rowCount();
32 for (size_t i(0); i
< num_bytes
; ++i
) {
33 const char * hexdigits
= "0123456789ABCDEF";
34 bytestring
+= hexdigits
[(bytes
[i
] >> 4) & 0xF];
35 bytestring
+= hexdigits
[bytes
[i
] & 0xF];
39 _widget
.setRowCount(current_row
+ 1);
41 _widget
.setItem(current_row
, 0, new QTableWidgetItem(bytestring
));
42 _widget
.setItem(current_row
, 1, new QTableWidgetItem(line
));
43 _widget
.setItem(current_row
, 2, new QTableWidgetItem(""));
44 _widget
.updateGeometry();
46 _widget
.resizeColumnToContents(0);
47 _widget
.resizeColumnToContents(1);
48 _widget
.resizeColumnToContents(2);
50 _widget
.resizeRowToContents(current_row
);
53 _widget
.columnWidth(0) +
54 _widget
.columnWidth(1) +
55 _widget
.columnWidth(2) +
58 _widget
.setMinimumWidth(column_width
);
59 _widget
.setMinimumHeight((1 + _widget
.rowHeight(0)) * (_widget
.rowCount()) + 2);
60 _widget
.setMaximumHeight((1 + _widget
.rowHeight(0)) * (_widget
.rowCount()) + 2);
63 height
= (1 + _widget
.rowHeight(0)) * (_widget
.rowCount()) + 25;
64 width
= column_width
+ 10;
65 if (width
< 270) width
= 270;