]> git.siccegge.de Git - frida/frida.git/commitdiff
Properly implement plane selection
authorChristoph Egger <Christoph.Egger@fau.de>
Thu, 22 Jan 2015 18:54:23 +0000 (19:54 +0100)
committerChristoph Egger <Christoph.Egger@fau.de>
Thu, 22 Jan 2015 18:56:36 +0000 (19:56 +0100)
Does no longer rely on proper indexes (corresponding index in the listWidget and
in the stackedWidget) but actually remebers which plane belongs to which
list entry

src/gui/Mainwindow.cxx
src/gui/Mainwindow.hxx

index d929094d618ba9533d0fe0f4a518c66273822bdd..8a62ef8d2257386cf17b6df7074d48b82a414c29 100644 (file)
@@ -51,7 +51,7 @@ Mainwindow::Mainwindow(InformationManager* mgr)
        setCentralWidget(stackedWidget);
 
        connect(listWidget, SIGNAL(currentRowChanged(int)),
        setCentralWidget(stackedWidget);
 
        connect(listWidget, SIGNAL(currentRowChanged(int)),
-               stackedWidget, SLOT(setCurrentIndex(int)));
+               this, SLOT(switchMainPlane(int)));
 
        setWindowTitle(tr("FRIDA"));
 
 
        setWindowTitle(tr("FRIDA"));
 
@@ -80,6 +80,10 @@ void Mainwindow::open() {
        manager->reset(fileName.toStdString());
 }
 
        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) {
 void Mainwindow::showListContextMenu(const QPoint& point) {
        QListWidgetItem * item = listWidget->itemAt(point);
        if (item) {
@@ -137,8 +141,9 @@ void Mainwindow::addFunction(Function* fun) {
 
        w->addTab(t, "Listing");
 
 
        w->addTab(t, "Listing");
 
-       listWidget->addItem(fun->getName().c_str());
+       QListWidgetItem * item = new QListWidgetItem(fun->getName().c_str(), listWidget);
        stackedWidget->addWidget(w);
        stackedWidget->addWidget(w);
+       objects_list.insert(std::make_pair(item, w));
 }
 
 namespace {
 }
 
 namespace {
index 953b3152b4b48221bb6f376a2ca56ae3d02f4a05..efc7d99bd10facf51483c8ba5d3831fad4f427c6 100644 (file)
@@ -40,6 +40,7 @@ private:
        QAction *openAction;
 
        std::map<uint64_t, BasicBlockWidget*> blocks;
        QAction *openAction;
 
        std::map<uint64_t, BasicBlockWidget*> blocks;
+       std::map<QListWidgetItem*, QWidget*> objects_list;
        std::set<Function*> functions;
        InformationManager* manager;
 
        std::set<Function*> functions;
        InformationManager* manager;
 
@@ -47,6 +48,7 @@ private:
 private Q_SLOTS:
        void quit();
        void open();
 private Q_SLOTS:
        void quit();
        void open();
+       void switchMainPlane(int);
        void showListContextMenu(const QPoint&);
        void requestNewFunction();
 };
        void showListContextMenu(const QPoint&);
        void requestNewFunction();
 };