2018-06-12 08:43:14 +00:00
|
|
|
#include "DebugToolbar.h"
|
|
|
|
#include "MainWindow.h"
|
|
|
|
|
|
|
|
#include <QAction>
|
|
|
|
#include <QPainter>
|
2018-06-13 23:02:16 +00:00
|
|
|
#include <QToolButton>
|
|
|
|
#include <QMenu>
|
2018-06-12 08:43:14 +00:00
|
|
|
|
|
|
|
DebugToolbar::DebugToolbar(MainWindow *main, QWidget *parent) :
|
|
|
|
QToolBar(parent),
|
|
|
|
main(main)
|
|
|
|
{
|
|
|
|
setObjectName("debugToolbar");
|
|
|
|
QIcon startIcon = QIcon(":/img/icons/play_light.svg");
|
2018-06-12 15:42:38 +00:00
|
|
|
QIcon stopIcon = QIcon(":/img/icons/media-stop_light.svg");
|
2018-06-12 08:43:14 +00:00
|
|
|
QIcon continueIcon = QIcon(":/img/icons/media-skip-forward_light.svg");
|
2018-06-13 23:02:16 +00:00
|
|
|
QIcon continueUntilMainIcon = QIcon(":/img/icons/continue_until_main.svg");
|
|
|
|
QIcon continueUntilCallIcon = QIcon(":/img/icons/continue_until_call.svg");
|
|
|
|
QIcon continueUntilSyscallIcon = QIcon(":/img/icons/continue_until_syscall.svg");
|
2018-06-12 08:43:14 +00:00
|
|
|
QIcon stepIcon = QIcon(":/img/icons/step_light.svg");
|
|
|
|
QIcon stepOverIcon = QIcon(":/img/icons/step_over_light.svg");
|
|
|
|
|
|
|
|
QAction *actionStart = new QAction(startIcon, tr("Start debug"), parent);
|
2018-06-12 15:42:38 +00:00
|
|
|
QAction *actionStop = new QAction(stopIcon, tr("Stop debug"), parent);
|
2018-06-12 08:43:14 +00:00
|
|
|
QAction *actionContinue = new QAction(continueIcon, tr("Continue"), parent);
|
2018-06-13 23:02:16 +00:00
|
|
|
QAction *actionContinueUntilMain = new QAction(continueUntilMainIcon, tr("Continue until main"), parent);
|
|
|
|
QAction *actionContinueUntilCall = new QAction(continueUntilCallIcon, tr("Continue until call"), parent);
|
|
|
|
QAction *actionContinueUntilSyscall = new QAction(continueUntilSyscallIcon, tr("Continue until syscall"), parent);
|
2018-06-12 08:43:14 +00:00
|
|
|
QAction *actionStep = new QAction(stepIcon, tr("Step"), parent);
|
|
|
|
QAction *actionStepOver = new QAction(stepOverIcon, tr("Step over"), parent);
|
2018-06-13 23:02:16 +00:00
|
|
|
|
|
|
|
QToolButton *continueUntilButton = new QToolButton;
|
|
|
|
continueUntilButton->setPopupMode(QToolButton::MenuButtonPopup);
|
|
|
|
connect(continueUntilButton, &QToolButton::triggered, continueUntilButton, &QToolButton::setDefaultAction);
|
|
|
|
|
|
|
|
QMenu *continueUntilMenu = new QMenu;
|
|
|
|
continueUntilMenu->addAction(actionContinueUntilMain);
|
|
|
|
continueUntilMenu->addAction(actionContinueUntilCall);
|
|
|
|
continueUntilMenu->addAction(actionContinueUntilSyscall);
|
|
|
|
continueUntilButton->setMenu(continueUntilMenu);
|
|
|
|
continueUntilButton->setDefaultAction(actionContinueUntilMain);
|
|
|
|
|
2018-06-12 08:43:14 +00:00
|
|
|
addAction(actionStart);
|
2018-06-12 15:42:38 +00:00
|
|
|
addAction(actionStop);
|
2018-06-12 08:43:14 +00:00
|
|
|
addAction(actionContinue);
|
2018-06-13 23:02:16 +00:00
|
|
|
addWidget(continueUntilButton);
|
2018-06-12 08:43:14 +00:00
|
|
|
addAction(actionStep);
|
|
|
|
addAction(actionStepOver);
|
|
|
|
|
2018-06-12 15:42:38 +00:00
|
|
|
connect(actionStop, &QAction::triggered, Core(), &CutterCore::stopDebug);
|
2018-06-12 08:43:14 +00:00
|
|
|
connect(actionStep, &QAction::triggered, Core(), &CutterCore::stepDebug);
|
|
|
|
connect(actionStart, &QAction::triggered, Core(), &CutterCore::startDebug);
|
|
|
|
connect(actionStepOver, &QAction::triggered, Core(), &CutterCore::stepOverDebug);
|
|
|
|
connect(actionContinue, &QAction::triggered, Core(), &CutterCore::continueDebug);
|
|
|
|
connect(actionContinueUntilMain, &QAction::triggered, this, &DebugToolbar::continueUntilMain);
|
2018-06-13 23:02:16 +00:00
|
|
|
connect(actionContinueUntilCall, &QAction::triggered, Core(), &CutterCore::continueUntilCall);
|
|
|
|
connect(actionContinueUntilSyscall, &QAction::triggered, Core(),&CutterCore::continueUntilSyscall);
|
2018-06-12 08:43:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void DebugToolbar::continueUntilMain()
|
|
|
|
{
|
|
|
|
Core()->continueUntilDebug(tr("main"));
|
|
|
|
}
|