Keep CallGraph widget active when seeking to other functions

This commit is contained in:
Theofilos Pechlivanis 2022-10-29 21:57:30 +03:00 committed by karliss
parent 1ac814c1b9
commit ae1e15b7a2
4 changed files with 18 additions and 5 deletions

View File

@ -1086,6 +1086,12 @@ MemoryDockWidget *MainWindow::addNewMemoryWidget(MemoryWidgetType type, RVA addr
case MemoryWidgetType::Decompiler:
memoryWidget = new DecompilerWidget(this);
break;
case MemoryWidgetType::CallGraph:
memoryWidget = new CallGraphWidget(this, false);
break;
case MemoryWidgetType::GlobalCallGraph:
memoryWidget = new CallGraphWidget(this, true);
break;
}
auto seekable = memoryWidget->getSeekable();
seekable->setSynchronization(synchronized);

View File

@ -7,9 +7,9 @@
#include <QJsonObject>
CallGraphWidget::CallGraphWidget(MainWindow *main, bool global)
: AddressableDockWidget(main), graphView(new CallGraphView(this, main, global)), global(global)
: MemoryDockWidget(MemoryWidgetType::CallGraph, main), graphView(new CallGraphView(this, main, global)), global(global)
{
setObjectName(main->getUniqueObjectName("CallGraphWidget"));
setObjectName(main ? main->getUniqueObjectName(getWidgetType()) : getWidgetType());
this->setWindowTitle(getWindowTitle());
connect(seekable, &CutterSeekable::seekableSeekChanged, this, &CallGraphWidget::onSeekChanged);
@ -23,6 +23,11 @@ QString CallGraphWidget::getWindowTitle() const
return global ? tr("Global Callgraph") : tr("Callgraph");
}
QString CallGraphWidget::getWidgetType() const
{
return global ? tr("GlobalCallgraph") : tr("Callgraph");
}
void CallGraphWidget::onSeekChanged(RVA address)
{
if (auto function = Core()->functionIn(address)) {

View File

@ -2,7 +2,7 @@
#define CALL_GRAPH_WIDGET_H
#include "core/Cutter.h"
#include "AddressableDockWidget.h"
#include "MemoryDockWidget.h"
#include "widgets/SimpleTextGraphView.h"
#include "common/RefreshDeferrer.h"
@ -30,7 +30,7 @@ private:
RVA lastLoadedAddress = RVA_INVALID;
};
class CallGraphWidget : public AddressableDockWidget
class CallGraphWidget : public MemoryDockWidget
{
Q_OBJECT
@ -38,6 +38,8 @@ public:
explicit CallGraphWidget(MainWindow *main, bool global);
~CallGraphWidget();
QString getWidgetType() const;
protected:
QString getWindowTitle() const override;

View File

@ -7,7 +7,7 @@
#include <QAction>
/* Disassembly/Graph/Hexdump/Decompiler view priority */
enum class MemoryWidgetType { Disassembly, Graph, Hexdump, Decompiler };
enum class MemoryWidgetType { Disassembly, Graph, Hexdump, Decompiler, CallGraph, GlobalCallGraph };
class CUTTER_EXPORT MemoryDockWidget : public AddressableDockWidget
{