mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-22 21:06:10 +00:00
4b454e086e
* Add shift-F12 shortcut for strings widget. * change strings shortcut to use global map * add Shift-I shortcut for Imports * add Shift-E shortcut for Exports * add Shift-G shortcut for Graph view * add widgets shortcuts map file * update widget checkboxes when using shortcuts
41 lines
1.5 KiB
C++
41 lines
1.5 KiB
C++
#include "MainWindow.h"
|
|
#include "GraphWidget.h"
|
|
#include "DisassemblerGraphView.h"
|
|
#include "WidgetShortcuts.h"
|
|
|
|
GraphWidget::GraphWidget(MainWindow *main, QAction *action) :
|
|
CutterDockWidget(main, action)
|
|
{
|
|
this->setObjectName("Graph");
|
|
this->setAllowedAreas(Qt::AllDockWidgetAreas);
|
|
this->graphView = new DisassemblerGraphView(this);
|
|
this->setWidget(graphView);
|
|
|
|
// getting the name of the class is implementation defined, and cannot be
|
|
// used reliably across different compilers.
|
|
//QShortcut *toggle_shortcut = new QShortcut(widgetShortcuts[typeid(this).name()], main);
|
|
|
|
QShortcut *toggle_shortcut = new QShortcut(widgetShortcuts["GraphWidget"], main);
|
|
connect(toggle_shortcut, &QShortcut::activated, this, [=] (){
|
|
toggleDockWidget(true);
|
|
main->updateDockActionChecked(action);
|
|
} );
|
|
|
|
connect(this, &QDockWidget::visibilityChanged, this, [](bool visibility) {
|
|
if (visibility) {
|
|
Core()->setMemoryWidgetPriority(CutterCore::MemoryWidgetType::Graph);
|
|
}
|
|
});
|
|
|
|
connect(Core(), &CutterCore::raisePrioritizedMemoryWidget,
|
|
this, [ = ](CutterCore::MemoryWidgetType type) {
|
|
bool emptyGraph = (type == CutterCore::MemoryWidgetType::Graph && Core()->isGraphEmpty());
|
|
if (type == CutterCore::MemoryWidgetType::Graph && !emptyGraph) {
|
|
this->raise();
|
|
this->graphView->setFocus();
|
|
}
|
|
});
|
|
}
|
|
|
|
GraphWidget::~GraphWidget() {}
|