mirror of
https://github.com/rizinorg/cutter.git
synced 2025-01-31 16:47: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 <QShortcut>
|
||||||
#include <QToolTip>
|
#include <QToolTip>
|
||||||
#include <QTextDocument>
|
#include <QTextDocument>
|
||||||
|
#include <QFileDialog>
|
||||||
|
#include <QFile>
|
||||||
|
|
||||||
#include "cutter.h"
|
#include "cutter.h"
|
||||||
#include "utils/Colors.h"
|
#include "utils/Colors.h"
|
||||||
@ -90,6 +92,12 @@ DisassemblerGraphView::DisassemblerGraphView(QWidget *parent)
|
|||||||
shortcuts.append(shortcut_next_instr_arrow);
|
shortcuts.append(shortcut_next_instr_arrow);
|
||||||
shortcuts.append(shortcut_prev_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();
|
initFont();
|
||||||
colorsUpdatedSlot();
|
colorsUpdatedSlot();
|
||||||
}
|
}
|
||||||
@ -710,3 +718,16 @@ void DisassemblerGraphView::blockTransitionedTo(GraphView::GraphBlock *to)
|
|||||||
}
|
}
|
||||||
seek(to->entry);
|
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:
|
private slots:
|
||||||
void seekPrev();
|
void seekPrev();
|
||||||
|
|
||||||
|
void on_actionExportGraph_triggered();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool first_draw = true;
|
bool first_draw = true;
|
||||||
bool transition_dont_seek = false;
|
bool transition_dont_seek = false;
|
||||||
@ -216,6 +218,8 @@ private:
|
|||||||
QColor mCipColor;
|
QColor mCipColor;
|
||||||
QColor mBreakpointColor;
|
QColor mBreakpointColor;
|
||||||
QColor mDisabledBreakpointColor;
|
QColor mDisabledBreakpointColor;
|
||||||
|
|
||||||
|
QAction actionExportGraph;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DISASSEMBLERGRAPHVIEW_H
|
#endif // DISASSEMBLERGRAPHVIEW_H
|
||||||
|
Loading…
Reference in New Issue
Block a user