Commit 129a6160 authored by Thomas Friedrichsmeier's avatar Thomas Friedrichsmeier
Browse files

Add "step into" and "finish current" in debugger window, simplify code.

parent 72a10314
Pipeline #175925 passed with stage
in 3 minutes and 45 seconds
TODOs:
- More tolerant handshake on Windows? Simply a matter of allowing more time?
--- Version 0.7.4 - May-30-2022
- Support "step into" and "finish current" modes in the R debugger window
- When directly upgrading from very old versions (pre 0.6.3, currently), discard existing config settings
- Plugin maps with the same id are grouped together, and the most recent version is used, automatically
- Added functionality to install add-on packages directly from git (formerly available as external plugin rk.gitInstall)
......
/*
rkdebugconsole - This file is part of RKWard (https://rkward.kde.org). Created: Wed Oct 19 2011
SPDX-FileCopyrightText: 2011 by Thomas Friedrichsmeier <thomas.friedrichsmeier@kdemail.net>
SPDX-FileCopyrightText: 2011-2022 by Thomas Friedrichsmeier <thomas.friedrichsmeier@kdemail.net>
SPDX-FileContributor: The RKWard Team <rkward-devel@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
......@@ -41,21 +41,17 @@ RKDebugConsole::RKDebugConsole (QWidget *parent, bool tool_window, const char *n
QVBoxLayout *button_layout = new QVBoxLayout ();
upper_layout->addLayout (button_layout);
step_button = new QPushButton (i18n ("Next"), this);
connect (step_button, &QPushButton::clicked, this, &RKDebugConsole::stepButtonClicked);
button_layout->addWidget (step_button);
step_out_button = new QPushButton (i18n ("Step out"), this);
connect (step_out_button, &QPushButton::clicked, this, &RKDebugConsole::stepOutButtonClicked);
RKCommonFunctions::setTips (i18n ("<p>Continue until the caller of this function is reached (unless another debug statement is hit, earlier)</p>"
"<p><b>Note:</b> In some cases, the calling function will never be reached, because the call was the last step in the caller. "
"In these cases, the behavior is identical to 'Continue'.</p>"), step_out_button);
button_layout->addWidget (step_out_button);
continue_button = new QPushButton (i18n ("Continue"), this);
connect (continue_button, &QPushButton::clicked, this, &RKDebugConsole::continueButtonClicked);
button_layout->addWidget (continue_button);
cancel_button = new QPushButton (i18n ("Cancel"), this);
connect (cancel_button, &QPushButton::clicked, this, &RKDebugConsole::cancelButtonClicked);
button_layout->addWidget (cancel_button);
button_layout->addWidget(addButton("n\n", i18n("Next (step over)"), i18n("Evaluate the next statement, stepping over function calls.")));
button_layout->addWidget(addButton("s\n", i18n("Next (step into)"), i18n("Evaluate the next statement, stepping into function calls.")));
button_layout->addWidget(addButton("browserSetDebug(1)\ncont\n", i18n("Step out"), i18n(
"<p>Continue until the caller of this function is reached (unless another debug statement is hit, earlier)</p>"
"<p><b>Note:</b> In some cases, the calling function will never be reached, because the call was the last step in the caller. "
"In these cases, the behavior is identical to 'Continue'.</p>")
));
button_layout->addWidget(addButton("f\n", i18n("Finish current"), i18n("Finish current loop or function.")));
button_layout->addWidget(addButton("cont\n", i18n("Continue"), i18n("Continue evaluation.")));
button_layout->addStretch ();
button_layout->addWidget(addButton("Q\n", i18n("Cancel"), i18n("Exit debugger and return to top-level statement.")));
button_layout->addStretch ();
QHBoxLayout *lower_layout = new QHBoxLayout ();
......@@ -82,6 +78,14 @@ RKDebugConsole::~RKDebugConsole () {
RK_TRACE (APP);
}
QPushButton* RKDebugConsole::addButton(const QString& command, const QString& text, const QString& tip) {
QPushButton *button = new QPushButton(text);
connect(button, &QPushButton::clicked, this, [this, command]() { this->sendReply(command); } );
buttons.append(button);
RKCommonFunctions::setTips(tip, button);
return button;
}
void RKDebugConsole::newDebugState () {
RK_TRACE (APP);
......@@ -107,11 +111,8 @@ void RKDebugConsole::newDebugState () {
activate (true);
}
setEnabled (true);
step_button->setEnabled (enable);
step_out_button->setEnabled (enable);
continue_button->setEnabled (enable);
cancel_button->setEnabled (enable);
setEnabled(true);
for (int i = 0; i < buttons.size(); ++i) buttons[i]->setEnabled(enable);
}
void RKDebugConsole::sendReplySlot () {
......@@ -123,30 +124,6 @@ void RKDebugConsole::sendReplySlot () {
reply_edit->clear ();
}
void RKDebugConsole::stepOutButtonClicked () {
RK_TRACE (APP);
sendReply ("browserSetDebug(1)\ncont\n");
}
void RKDebugConsole::stepButtonClicked () {
RK_TRACE (APP);
sendReply ("n\n");
}
void RKDebugConsole::continueButtonClicked () {
RK_TRACE (APP);
sendReply ("cont\n");
}
void RKDebugConsole::cancelButtonClicked () {
RK_TRACE (APP);
RKDebugHandler::instance ()->sendCancel ();
}
void RKDebugConsole::sendReply (const QString &reply) {
RK_TRACE (APP);
......
/*
rkdebugconsole - This file is part of the RKWard project. Created: Wed Oct 19 2011
SPDX-FileCopyrightText: 2011 by Thomas Friedrichsmeier <thomas.friedrichsmeier@kdemail.net>
SPDX-FileCopyrightText: 2011-2022 by Thomas Friedrichsmeier <thomas.friedrichsmeier@kdemail.net>
SPDX-FileContributor: The RKWard Team <rkward-devel@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
......@@ -30,21 +30,15 @@ public slots:
void newDebugState ();
private slots:
void sendReplySlot ();
void stepButtonClicked ();
void stepOutButtonClicked ();
void continueButtonClicked ();
void cancelButtonClicked ();
private:
QPushButton* addButton(const QString &command, const QString &text, const QString &tip);
void sendReply (const QString &reply);
QTextEdit* context_view;
KHistoryComboBox* reply_edit;
QLabel* prompt_label;
QPushButton* step_button;
QPushButton* step_out_button;
QPushButton* continue_button;
QPushButton* cancel_button;
QList<QPushButton*> buttons;
friend class RKWardMainWindow;
static RKDebugConsole *_instance;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment