X-Git-Url: https://git.siccegge.de//index.cgi?p=frida%2Ffrida.git;a=blobdiff_plain;f=src%2Fgui%2FMainwindow.cxx;h=be86cac4477c13db986082e9b78081207e7f23dc;hp=412c42400f4170d06457edc400efebd70bd7b9ff;hb=a904a4c9d983eb93896f74208d2c0a44b735d7f5;hpb=37e3e9570967efad39ba74213f51bd12aebe4c8c diff --git a/src/gui/Mainwindow.cxx b/src/gui/Mainwindow.cxx index 412c424..be86cac 100644 --- a/src/gui/Mainwindow.cxx +++ b/src/gui/Mainwindow.cxx @@ -1,14 +1,12 @@ -#include "Mainwindow.h++" +#include "Mainwindow.hxx" +#include "widgets/BasicBlockWidget.hxx" +#include "qt.hxx" #include #include #include -namespace { - -} - Mainwindow::Mainwindow() { openAction = new QAction(tr("&Open"), this); @@ -61,9 +59,7 @@ void Mainwindow::open() { std::vector symbols = curBin->getSymbols(); if (0 == symbols.size()) populateSymbolInformation(".text"); - for (std::vector::iterator it = symbols.begin(); - it != symbols.end(); - ++it) { + for (auto it = symbols.begin(); it != symbols.end(); ++it) { populateSymbolInformation(*it); } } @@ -75,7 +71,7 @@ void Mainwindow::populateSymbolInformation(const std::string& sym) { // Listing QTableWidget * t = new QTableWidget(); t->setColumnCount(3); - t->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents); + t->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents); curBin->for_each_instruction(sym, [&t](long add, std::string bytes, std::string mnemonic) { int row = t->rowCount(); std::stringstream s; @@ -92,12 +88,29 @@ void Mainwindow::populateSymbolInformation(const std::string& sym) { // CFG QGraphicsScene * scene = new QGraphicsScene; - QGraphicsRectItem *rect = scene->addRect(QRectF(0, 0, 100, 100)); - rect->setFlag(QGraphicsItem::ItemIsMovable); - QGraphicsView * view = new QGraphicsView(scene); - w->addTab(view, "CFG"); + BasicBlockWidget * s1 = new BasicBlockWidget; + scene->addItem(s1); + s1->setFlag(QGraphicsItem::ItemIsMovable, true); + + BasicBlockWidget * s2 = new BasicBlockWidget; + scene->addItem(s2); + s2->setFlag(QGraphicsItem::ItemIsMovable, true); + s2->moveBy(-200, 350); + BasicBlockWidget * s3 = new BasicBlockWidget; + scene->addItem(s3); + s3->setFlag(QGraphicsItem::ItemIsMovable, true); + s3->moveBy(100, 350); + + BasicBlockWidget * s4 = new BasicBlockWidget; + scene->addItem(s4); + s4->setFlag(QGraphicsItem::ItemIsMovable, true); + s4->moveBy(400, 350); + + + QGraphicsView * view = new QGraphicsView(scene); + w->addTab(view, "CFG"); listWidget->addItem(sym.c_str()); stackedWidget->addWidget(w);