]> git.siccegge.de Git - frida/frida.git/blob - src/gui/widgets/BasicBlockWidget.cxx
Whitespace cleanup
[frida/frida.git] / src / gui / widgets / BasicBlockWidget.cxx
1 #include "BasicBlockWidget.hxx"
2
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;
7 _widget.move(5, 20);
8
9 if (width < 270) width = 270;
10 }
11
12 void BasicBlockWidget::addItem(uint8_t* bytes, size_t num_bytes,
13 const QString& line) {
14 QString bytestring;
15
16 for (size_t i(0); i < num_bytes; ++i) {
17 const char * hexdigits = "0123456789ABCDEF";
18 bytestring += hexdigits[(bytes[i] >> 4) & 0xF];
19 bytestring += hexdigits[bytes[i] & 0xF];
20 bytestring += ' ';
21 }
22
23 QString old_text = _widget.text();
24 if (old_text == "") {
25 old_text = "<table style=\"background-color: #ccccff;\">";
26 }
27 QString new_text =
28 old_text.remove("</table>") +
29 "<tr><td>" + bytestring +
30 "</td><td>" + line +
31 "</td><td>" + "" +
32 "</td></tr></table>";
33
34 _widget.setText(new_text);
35 width = 12 + _widget.sizeHint().width();
36 height = 25 + _widget.sizeHint().height();
37
38 if (width < 250) width = 250;
39 }