#include <QtGui>
-Mainwindow::Mainwindow()
+Mainwindow::Mainwindow(const std::string& filename)
{
openAction = new QAction(tr("&Open"), this);
// saveAction = new QAction(tr("&Save"), this);
stackedWidget, SLOT(setCurrentIndex(int)));
setWindowTitle(tr("Notepad"));
+
+ openBinary(filename);
}
void Mainwindow::quit()
QString fileName = QFileDialog::getOpenFileName(this, tr("Open File"), "",
tr("Binaries (*)"));
- if (fileName != "") {
- disassembler.reset(new LLVMDisassembler(fileName.toStdString()));
+ openBinary(fileName.toStdString());
+}
+
+void Mainwindow::openBinary(const std::string& filename) {
+ if (filename != "") {
+ disassembler.reset(new LLVMDisassembler(filename));
// curBin = new Binary(fileName.toStdString());
// std::vector<std::string> symbols = curBin->getSymbols();