diff --git a/src/img/icons/media-stop_light.svg b/src/img/icons/media-stop_light.svg index 6c57c202..27e2a031 100644 --- a/src/img/icons/media-stop_light.svg +++ b/src/img/icons/media-stop_light.svg @@ -1,3 +1,3 @@ - + \ No newline at end of file diff --git a/src/img/icons/play_light_attach.svg b/src/img/icons/play_light_attach.svg index b3bd9944..1ccba97b 100644 --- a/src/img/icons/play_light_attach.svg +++ b/src/img/icons/play_light_attach.svg @@ -1,5 +1,5 @@ - + A diff --git a/src/img/icons/play_light_debug.svg b/src/img/icons/play_light_debug.svg index 6a387a1c..ad6a8ba6 100644 --- a/src/img/icons/play_light_debug.svg +++ b/src/img/icons/play_light_debug.svg @@ -1,5 +1,5 @@ - + D diff --git a/src/img/icons/play_light_emul.svg b/src/img/icons/play_light_emul.svg index 174bca74..2011f2e9 100644 --- a/src/img/icons/play_light_emul.svg +++ b/src/img/icons/play_light_emul.svg @@ -1,5 +1,5 @@ - + E diff --git a/src/img/icons/spin_light.svg b/src/img/icons/spin_light.svg index dcb250e2..9984d2e1 100644 --- a/src/img/icons/spin_light.svg +++ b/src/img/icons/spin_light.svg @@ -1,6 +1,6 @@ - + diff --git a/src/widgets/DebugToolbar.cpp b/src/widgets/DebugToolbar.cpp index 6d91a971..f225cf6c 100644 --- a/src/widgets/DebugToolbar.cpp +++ b/src/widgets/DebugToolbar.cpp @@ -29,23 +29,38 @@ DebugToolbar::DebugToolbar(MainWindow *main, QWidget *parent) : QIcon stepOutIcon = QIcon(":/img/icons/step_out_light.svg"); QIcon restartIcon = QIcon(":/img/icons/spin_light.svg"); + // define action labels + QString startDebugLabel = tr("Start debug"); + QString startEmulLabel = tr("Start emulation"); + QString startAttachLabel = tr("Attach to process"); + QString stopDebugLabel = tr("Stop debug"); + QString stopEmulLabel = tr("Stop emulation"); + QString restartDebugLabel = tr("Restart program"); + QString restartEmulLabel = tr("Restart emulation"); + QString continueLabel = tr("Continue"); + QString continueUMLabel = tr("Continue until main"); + QString continueUCLabel = tr("Continue until call"); + QString continueUSLabel = tr("Continue until syscall"); + QString stepLabel = tr("Step"); + QString stepOverLabel = tr("Step over"); + QString stepOutLabel = tr("Step out"); + // define actions - actionStart = new QAction(startDebugIcon, tr("Start debug"), parent); + actionStart = new QAction(startDebugIcon, startDebugLabel, parent); actionStart->setShortcut(QKeySequence(Qt::Key_F9)); - actionStartEmul = new QAction(startEmulIcon, tr("Start emulation"), parent); - actionAttach = new QAction(startAttachIcon, tr("Attach to process"), parent); - actionStop = new QAction(stopIcon, tr("Stop debug"), parent); - actionContinue = new QAction(continueIcon, tr("Continue"), parent); + actionStartEmul = new QAction(startEmulIcon, startEmulLabel, parent); + actionAttach = new QAction(startAttachIcon, startAttachLabel, parent); + actionStop = new QAction(stopIcon, stopDebugLabel, parent); + actionContinue = new QAction(continueIcon, continueLabel, parent); actionContinue->setShortcut(QKeySequence(Qt::Key_F5)); - actionContinueUntilMain = new QAction(continueUntilMainIcon, tr("Continue until main"), parent); - actionContinueUntilCall = new QAction(continueUntilCallIcon, tr("Continue until call"), parent); - actionContinueUntilSyscall = new QAction(continueUntilSyscallIcon, tr("Continue until syscall"), - parent); - actionStep = new QAction(stepIcon, tr("Step"), parent); + actionContinueUntilMain = new QAction(continueUntilMainIcon, continueUMLabel, parent); + actionContinueUntilCall = new QAction(continueUntilCallIcon, continueUCLabel, parent); + actionContinueUntilSyscall = new QAction(continueUntilSyscallIcon, continueUSLabel, parent); + actionStep = new QAction(stepIcon, stepLabel, parent); actionStep->setShortcut(QKeySequence(Qt::Key_F7)); - actionStepOver = new QAction(stepOverIcon, tr("Step over"), parent); + actionStepOver = new QAction(stepOverIcon, stepOverLabel, parent); actionStepOver->setShortcut(QKeySequence(Qt::Key_F8)); - actionStepOut = new QAction(stepOutIcon, tr("Step out"), parent); + actionStepOut = new QAction(stepOutIcon, stepOutLabel, parent); actionStepOut->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_F8)); QToolButton *startButton = new QToolButton; @@ -87,37 +102,31 @@ DebugToolbar::DebugToolbar(MainWindow *main, QWidget *parent) : connect(actionStop, &QAction::triggered, Core(), &CutterCore::stopDebug); connect(actionStop, &QAction::triggered, [ = ]() { - actionContinue->setVisible(true); actionStart->setVisible(true); actionStartEmul->setVisible(true); actionAttach->setVisible(true); - actionContinueUntilMain->setVisible(true); - actionStepOut->setVisible(true); - this->colorToolbar(false); - actionStop->setText("Stop session"); - actionStart->setText("Start debug"); - actionStartEmul->setText("Start emulation"); + actionStop->setText(stopDebugLabel); + actionStart->setText(startDebugLabel); actionStart->setIcon(startDebugIcon); + actionStartEmul->setText(startEmulLabel); actionStartEmul->setIcon(startEmulIcon); - colorToolbar(false); setAllActionsVisible(false); }); connect(actionStep, &QAction::triggered, Core(), &CutterCore::stepDebug); connect(actionStart, &QAction::triggered, [ = ]() { - setAllActionsVisible(true); - + // check if file is executable before starting debug QString filename = Core()->getConfig("file.path").split(" ").first(); QFileInfo info(filename); if (!Core()->currentlyDebugging && !info.isExecutable()) { QMessageBox msgBox; - msgBox.setText(QString("File '%1' does not have executable permissions.").arg(filename)); + msgBox.setText(tr("File '%1' does not have executable permissions.").arg(filename)); msgBox.exec(); return; } - colorToolbar(true); + setAllActionsVisible(true); actionAttach->setVisible(false); actionStartEmul->setVisible(false); - actionStart->setText("Restart program"); + actionStart->setText(restartDebugLabel); actionStart->setIcon(restartIcon); Core()->startDebug(); }); @@ -131,10 +140,9 @@ DebugToolbar::DebugToolbar(MainWindow *main, QWidget *parent) : actionContinueUntilMain->setVisible(false); actionStepOut->setVisible(false); continueUntilButton->setDefaultAction(actionContinueUntilSyscall); - actionStartEmul->setText("Restart emulation"); + actionStartEmul->setText(restartEmulLabel); actionStartEmul->setIcon(restartIcon); - actionStop->setText("Stop emulation"); - colorToolbar(true); + actionStop->setText(stopEmulLabel); }); connect(actionStepOver, &QAction::triggered, Core(), &CutterCore::stepOverDebug); connect(actionStepOut, &QAction::triggered, Core(), &CutterCore::stepOutDebug); @@ -146,16 +154,7 @@ DebugToolbar::DebugToolbar(MainWindow *main, QWidget *parent) : void DebugToolbar::continueUntilMain() { - Core()->continueUntilDebug(tr("main")); -} - -void DebugToolbar::colorToolbar(bool p) -{ - if (p) { - setStyleSheet("QToolBar {background: green;}"); - } else { - setStyleSheet(""); - } + Core()->continueUntilDebug("main"); } void DebugToolbar::attachProcessDialog() @@ -171,7 +170,7 @@ void DebugToolbar::attachProcessDialog() } else { success = false; QMessageBox msgBox; - msgBox.setText("Error attaching. No process selected!"); + msgBox.setText(tr("Error attaching. No process selected!")); msgBox.exec(); } } @@ -181,12 +180,12 @@ void DebugToolbar::attachProcessDialog() void DebugToolbar::attachProcess(int pid) { + QString stopAttachLabel = tr("Detach from process"); // hide unwanted buttons setAllActionsVisible(true); - colorToolbar(true); actionStart->setVisible(false); actionStartEmul->setVisible(false); - actionStop->setText("Detach from process"); + actionStop->setText(stopAttachLabel); // attach Core()->attachDebug(pid); } diff --git a/src/widgets/DebugToolbar.h b/src/widgets/DebugToolbar.h index 2ff8556e..0033e263 100644 --- a/src/widgets/DebugToolbar.h +++ b/src/widgets/DebugToolbar.h @@ -30,7 +30,6 @@ private: private slots: void continueUntilMain(); - void colorToolbar(bool p); void attachProcessDialog(); void attachProcess(int pid); void setAllActionsVisible(bool visible);