Add colors to debug toolbar and string translation (#758)
* Added colors to debug toolbar icons * Translate debug toolbar strings
@ -1,3 +1,3 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="8" height="8" viewBox="0 0 8 8">
|
||||
<path d="M0 0v6h6v-6h-6z" transform="translate(1 1)" fill="#aaacaf" />
|
||||
<path d="M0 0v6h6v-6h-6z" transform="translate(1 1)" fill="#b15858" />
|
||||
</svg>
|
Before Width: | Height: | Size: 159 B After Width: | Height: | Size: 159 B |
@ -1,5 +1,5 @@
|
||||
<!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'>
|
||||
<svg style="enable-background:new 0 0 24 32" xmlns="http://www.w3.org/2000/svg" xml:space="preserve" height="32px" width="24px" version="1.1" y="0px" x="0px" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 32">
|
||||
<polygon points="0 0 24 16 0 32" fill="#aaacaf"/>
|
||||
<polygon points="0 0 24 16 0 32" fill="#78de82"/>
|
||||
<text x="15" y="10" font-family="Helvetica, Arial, sans-serif" font-size="13" stroke-width="2" stroke="#aaacaf" fill="#aaacaf" >A</text>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 521 B After Width: | Height: | Size: 521 B |
@ -1,5 +1,5 @@
|
||||
<!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'>
|
||||
<svg style="enable-background:new 0 0 24 32" xmlns="http://www.w3.org/2000/svg" xml:space="preserve" height="32px" width="24px" version="1.1" y="0px" x="0px" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 32">
|
||||
<polygon points="0 0 24 16 0 32" fill="#aaacaf"/>
|
||||
<polygon points="0 0 24 16 0 32" fill="#78de82"/>
|
||||
<text x="15" y="10" font-family="Helvetica, Arial, sans-serif" font-size="13" stroke-width="2" stroke="#aaacaf" fill="#aaacaf" >D</text>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 521 B After Width: | Height: | Size: 521 B |
@ -1,5 +1,5 @@
|
||||
<!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'>
|
||||
<svg style="enable-background:new 0 0 24 32" xmlns="http://www.w3.org/2000/svg" xml:space="preserve" height="32px" width="24px" version="1.1" y="0px" x="0px" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 32">
|
||||
<polygon points="0 0 24 16 0 32" fill="#aaacaf"/>
|
||||
<polygon points="0 0 24 16 0 32" fill="#78de82"/>
|
||||
<text x="15" y="10" font-family="Helvetica, Arial, sans-serif" font-size="13" stroke-width="2" stroke="#aaacaf" fill="#aaacaf" >E</text>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 521 B After Width: | Height: | Size: 521 B |
@ -1,6 +1,6 @@
|
||||
<!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'>
|
||||
<svg style="enable-background:new 0 0 28 32" xmlns="http://www.w3.org/2000/svg" xml:space="preserve" height="32px" width="28px" version="1.1" y="0px" x="0px" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 28 32">
|
||||
<g fill="#aaacaf">
|
||||
<g fill="#78de82">
|
||||
<path d="m24 6.1l-2.8 2.8c2 2.1 3 4.1 3 7.1 0 5.5-4.5 10-10 10v-2l-4 4 4 4v-2c7.7 0 14-6.3 14-14 0-4-1-7.3-4-9.9z"/>
|
||||
<path d="m18 4l-4-4v2c-7.7 0-14 6.3-14 14 0 3.7 1.5 7.3 4.1 9.9l2.8-2.8c-1.9-2-2.9-4-2.9-7 0-6 4.5-10 10-10v2l4-4z"/>
|
||||
</g>
|
||||
|
Before Width: | Height: | Size: 595 B After Width: | Height: | Size: 595 B |
@ -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);
|
||||
}
|
||||
|
@ -30,7 +30,6 @@ private:
|
||||
|
||||
private slots:
|
||||
void continueUntilMain();
|
||||
void colorToolbar(bool p);
|
||||
void attachProcessDialog();
|
||||
void attachProcess(int pid);
|
||||
void setAllActionsVisible(bool visible);
|
||||
|