Commit aeebb26e authored by hjk's avatar hjk Committed by hjk
Browse files

debugger: make entering commands in log input pane more convenient



Change-Id: Ic50053e5b8f8acfc06529c8006cb68e8d38bd69c
Reviewed-by: default avatarhjk <qthjk@ovi.com>
parent 49426923
...@@ -244,6 +244,7 @@ public: ...@@ -244,6 +244,7 @@ public:
} }
signals: signals:
void executeLineRequested();
void clearContentsRequested(); void clearContentsRequested();
void statusMessageRequested(const QString &, int); void statusMessageRequested(const QString &, int);
void commandSelected(int); void commandSelected(int);
...@@ -252,7 +253,7 @@ private: ...@@ -252,7 +253,7 @@ private:
void keyPressEvent(QKeyEvent *ev) void keyPressEvent(QKeyEvent *ev)
{ {
if (ev->modifiers() == Qt::ControlModifier && ev->key() == Qt::Key_Return) if (ev->modifiers() == Qt::ControlModifier && ev->key() == Qt::Key_Return)
debuggerCore()->executeDebuggerCommand(textCursor().block().text()); emit executeLineRequested();
else if (ev->modifiers() == Qt::ControlModifier && ev->key() == Qt::Key_R) else if (ev->modifiers() == Qt::ControlModifier && ev->key() == Qt::Key_R)
emit clearContentsRequested(); emit clearContentsRequested();
else else
...@@ -344,6 +345,8 @@ LogWindow::LogWindow(QWidget *parent) ...@@ -344,6 +345,8 @@ LogWindow::LogWindow(QWidget *parent)
setWindowTitle(tr("Debugger Log")); setWindowTitle(tr("Debugger Log"));
setObjectName("Log"); setObjectName("Log");
m_ignoreNextInputEcho = false;
QSplitter *m_splitter = new Core::MiniSplitter(Qt::Horizontal); QSplitter *m_splitter = new Core::MiniSplitter(Qt::Horizontal);
m_splitter->setParent(this); m_splitter->setParent(this);
...@@ -407,10 +410,18 @@ LogWindow::LogWindow(QWidget *parent) ...@@ -407,10 +410,18 @@ LogWindow::LogWindow(QWidget *parent)
m_combinedText, SLOT(gotoResult(int))); m_combinedText, SLOT(gotoResult(int)));
connect(m_commandEdit, SIGNAL(returnPressed()), connect(m_commandEdit, SIGNAL(returnPressed()),
SLOT(sendCommand())); SLOT(sendCommand()));
connect(m_inputText, SIGNAL(executeLineRequested()),
SLOT(executeLine()));
setMinimumHeight(60); setMinimumHeight(60);
} }
void LogWindow::executeLine()
{
m_ignoreNextInputEcho = true;
debuggerCore()->executeDebuggerCommand(m_inputText->textCursor().block().text());
}
void LogWindow::sendCommand() void LogWindow::sendCommand()
{ {
debuggerCore()->executeDebuggerCommand(m_commandEdit->text()); debuggerCore()->executeDebuggerCommand(m_commandEdit->text());
...@@ -447,6 +458,14 @@ void LogWindow::showOutput(int channel, const QString &output) ...@@ -447,6 +458,14 @@ void LogWindow::showOutput(int channel, const QString &output)
void LogWindow::showInput(int channel, const QString &input) void LogWindow::showInput(int channel, const QString &input)
{ {
Q_UNUSED(channel) Q_UNUSED(channel)
if (m_ignoreNextInputEcho) {
m_ignoreNextInputEcho = false;
QTextCursor cursor = m_inputText->textCursor();
cursor.movePosition(QTextCursor::Down);
cursor.movePosition(QTextCursor::EndOfLine);
m_inputText->setTextCursor(cursor);
return;
}
if (debuggerCore()->boolSetting(LogTimeStamps)) if (debuggerCore()->boolSetting(LogTimeStamps))
m_inputText->appendPlainText(logTimeStamp()); m_inputText->appendPlainText(logTimeStamp());
m_inputText->appendPlainText(input); m_inputText->appendPlainText(input);
......
...@@ -64,6 +64,7 @@ public: ...@@ -64,6 +64,7 @@ public:
public slots: public slots:
void clearContents(); void clearContents();
void sendCommand(); void sendCommand();
void executeLine();
void showOutput(int channel, const QString &output); void showOutput(int channel, const QString &output);
void showInput(int channel, const QString &input); void showInput(int channel, const QString &input);
...@@ -76,6 +77,7 @@ private: ...@@ -76,6 +77,7 @@ private:
QPlainTextEdit *m_inputText; // scriptable input alone QPlainTextEdit *m_inputText; // scriptable input alone
QLineEdit *m_commandEdit; QLineEdit *m_commandEdit;
QLabel *m_commandLabel; QLabel *m_commandLabel;
bool m_ignoreNextInputEcho;
}; };
......
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