]>
git.siccegge.de Git - frida/frida.git/blob - src/gui/widgets/BasicBlockWidget.cxx
eccb679f35e971a2749d9a721c3153334be84bd7
1 #include "BasicBlockWidget.hxx"
2 #include "gui/Mainwindow.hxx"
4 BasicBlockWidget::BasicBlockWidget(const QString
& name
, BasicBlock
* block
,
5 Mainwindow
* mainwindow
)
6 : width(270), height(45)
8 , _table(NULL
), name(name
)
9 , block(block
), mainwindow(mainwindow
) {
10 next
[0] = NULL
; next
[1] = NULL
;
11 _widget
.setTextInteractionFlags(Qt::TextSelectableByMouse
|
12 Qt::LinksAccessibleByMouse
);
14 _widget
.setPos(5, 20);
16 if (width
< 250) width
= 250;
19 void BasicBlockWidget::addItem(uint8_t* bytes
, size_t num_bytes
,
20 QString line
, const QString
& href
) {
26 _table
->appendRows(1);
29 QTextTableFormat format
;
30 format
.setBorderStyle(QTextFrameFormat::BorderStyle_None
);
32 _table
= _widget
.textCursor().insertTable(1, 3, format
);
35 for (size_t i(0); i
< num_bytes
; ++i
) {
36 const char * hexdigits
= "0123456789ABCDEF";
37 bytestring
+= hexdigits
[(bytes
[i
] >> 4) & 0xF];
38 bytestring
+= hexdigits
[bytes
[i
] & 0xF];
42 _table
->cellAt(row
, 0).firstCursorPosition().insertText(bytestring
);
44 line
= line
.replace('\t', ' ').toHtmlEscaped();
46 line
= "<a href=\"" + href
+ "\">" + line
+ "</a>";
49 _table
->cellAt(row
, 1).firstCursorPosition().insertHtml(line
);
51 QObject::connect(&_widget
, &QGraphicsTextItem::linkActivated
,
53 if (str
.startsWith("function:")) {
54 QString address
= str
.remove("function:");
55 mainwindow
->switchMainPlaneToAddress(address
.toInt(NULL
, 16));
59 width
= 10 + _widget
.boundingRect().width();
60 height
= 25 + _widget
.boundingRect().height();
62 if (width
< 250) width
= 250;