mirror of
https://github.com/rizinorg/cutter.git
synced 2025-01-31 08:37:26 +00:00
Added export graph as dot (#330)
This commit is contained in:
parent
16ebe024a3
commit
7fa2b9bf61
@ -8,6 +8,8 @@
|
||||
#include <QShortcut>
|
||||
#include <QToolTip>
|
||||
#include <QTextDocument>
|
||||
#include <QFileDialog>
|
||||
#include <QFile>
|
||||
|
||||
#include "cutter.h"
|
||||
#include "utils/Colors.h"
|
||||
@ -90,6 +92,12 @@ DisassemblerGraphView::DisassemblerGraphView(QWidget *parent)
|
||||
shortcuts.append(shortcut_next_instr_arrow);
|
||||
shortcuts.append(shortcut_prev_instr_arrow);
|
||||
|
||||
//Export Graph menu
|
||||
mMenu->addSeparator();
|
||||
actionExportGraph.setText(tr("Export Graph"));
|
||||
mMenu->addAction(&actionExportGraph);
|
||||
connect(&actionExportGraph, SIGNAL(triggered(bool)), this, SLOT(on_actionExportGraph_triggered()));
|
||||
|
||||
initFont();
|
||||
colorsUpdatedSlot();
|
||||
}
|
||||
@ -710,3 +718,16 @@ void DisassemblerGraphView::blockTransitionedTo(GraphView::GraphBlock *to)
|
||||
}
|
||||
seek(to->entry);
|
||||
}
|
||||
|
||||
void DisassemblerGraphView::on_actionExportGraph_triggered()
|
||||
{
|
||||
QString fileName = QFileDialog::getSaveFileName(this,
|
||||
tr("Export Graph"), "", tr("Dot file (*.dot)"));
|
||||
QFile file(fileName);
|
||||
if (!file.open(QIODevice::WriteOnly | QIODevice::Text)){
|
||||
qWarning() << "Can't open file";
|
||||
return;
|
||||
}
|
||||
QTextStream fileOut(&file);
|
||||
fileOut << Core()->cmd("ag -");
|
||||
}
|
||||
|
@ -169,6 +169,8 @@ public slots:
|
||||
private slots:
|
||||
void seekPrev();
|
||||
|
||||
void on_actionExportGraph_triggered();
|
||||
|
||||
private:
|
||||
bool first_draw = true;
|
||||
bool transition_dont_seek = false;
|
||||
@ -216,6 +218,8 @@ private:
|
||||
QColor mCipColor;
|
||||
QColor mBreakpointColor;
|
||||
QColor mDisabledBreakpointColor;
|
||||
|
||||
QAction actionExportGraph;
|
||||
};
|
||||
|
||||
#endif // DISASSEMBLERGRAPHVIEW_H
|
||||
|
Loading…
Reference in New Issue
Block a user