Added check for non-executable binary

This commit is contained in:
mandlebro 2018-07-25 09:59:40 +01:00 committed by xarkes
parent 6a87b342d7
commit 118ccbbdbf

View File

@ -6,6 +6,7 @@
#include <QPainter> #include <QPainter>
#include <QToolButton> #include <QToolButton>
#include <QMenu> #include <QMenu>
#include <QFileInfo>
DebugToolbar::DebugToolbar(MainWindow *main, QWidget *parent) : DebugToolbar::DebugToolbar(MainWindow *main, QWidget *parent) :
QToolBar(parent), QToolBar(parent),
@ -76,11 +77,19 @@ DebugToolbar::DebugToolbar(MainWindow *main, QWidget *parent) :
this->colorToolbar(false); this->colorToolbar(false);
}); });
connect(actionStep, &QAction::triggered, Core(), &CutterCore::stepDebug); connect(actionStep, &QAction::triggered, Core(), &CutterCore::stepDebug);
connect(actionStart, &QAction::triggered, Core(), &CutterCore::startDebug);
connect(actionStart, &QAction::triggered, [=]() { connect(actionStart, &QAction::triggered, [=]() {
QString filename = Core()->getConfig("file.lastpath");
QFileInfo info(filename);
if (!info.isExecutable()) {
QMessageBox msgBox;
msgBox.setText(QString("File '%1' does not have executable permissions.").arg(filename));
msgBox.exec();
return;
}
this->colorToolbar(true); this->colorToolbar(true);
actionAttach->setVisible(false); actionAttach->setVisible(false);
actionStartEmul->setVisible(false); actionStartEmul->setVisible(false);
Core()->startDebug();
}); });
connect(actionAttach, &QAction::triggered, this, &DebugToolbar::attachProcessDialog); connect(actionAttach, &QAction::triggered, this, &DebugToolbar::attachProcessDialog);
connect(actionStartEmul, &QAction::triggered, Core(), &CutterCore::startEmulation); connect(actionStartEmul, &QAction::triggered, Core(), &CutterCore::startEmulation);