]> git.siccegge.de Git - frida/frida.git/blobdiff - src/gui/Mainwindow.cxx
Properly implement plane selection
[frida/frida.git] / src / gui / Mainwindow.cxx
index 764eb0376d1ca4acb12f56fb0faa7b37c27c98d1..8a62ef8d2257386cf17b6df7074d48b82a414c29 100644 (file)
@@ -4,11 +4,8 @@
 
 #include "widgets/CFGScene.hxx"
 #include "dialogs/NewFunctionDialog.hxx"
-#include <iostream>
-#include <sstream>
-#include <map>
 
-#include <QtGui>
+#include <sstream>
 
 namespace {
        BasicBlockWidget *
@@ -54,7 +51,7 @@ Mainwindow::Mainwindow(InformationManager* mgr)
        setCentralWidget(stackedWidget);
 
        connect(listWidget, SIGNAL(currentRowChanged(int)),
-               stackedWidget, SLOT(setCurrentIndex(int)));
+               this, SLOT(switchMainPlane(int)));
 
        setWindowTitle(tr("FRIDA"));
 
@@ -83,6 +80,10 @@ void Mainwindow::open() {
        manager->reset(fileName.toStdString());
 }
 
+void Mainwindow::switchMainPlane(int index) {
+       stackedWidget->setCurrentWidget(objects_list[listWidget->currentItem()]);
+}
+
 void Mainwindow::showListContextMenu(const QPoint& point) {
        QListWidgetItem * item = listWidget->itemAt(point);
        if (item) {
@@ -140,8 +141,9 @@ void Mainwindow::addFunction(Function* fun) {
 
        w->addTab(t, "Listing");
 
-       listWidget->addItem(fun->getName().c_str());
+       QListWidgetItem * item = new QListWidgetItem(fun->getName().c_str(), listWidget);
        stackedWidget->addWidget(w);
+       objects_list.insert(std::make_pair(item, w));
 }
 
 namespace {