forked from qt-creator/qt-creator
debugger: make entering commands in log input pane more convenient
Change-Id: Ic50053e5b8f8acfc06529c8006cb68e8d38bd69c Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
@@ -244,6 +244,7 @@ public:
|
||||
}
|
||||
|
||||
signals:
|
||||
void executeLineRequested();
|
||||
void clearContentsRequested();
|
||||
void statusMessageRequested(const QString &, int);
|
||||
void commandSelected(int);
|
||||
@@ -252,7 +253,7 @@ private:
|
||||
void keyPressEvent(QKeyEvent *ev)
|
||||
{
|
||||
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)
|
||||
emit clearContentsRequested();
|
||||
else
|
||||
@@ -344,6 +345,8 @@ LogWindow::LogWindow(QWidget *parent)
|
||||
setWindowTitle(tr("Debugger Log"));
|
||||
setObjectName("Log");
|
||||
|
||||
m_ignoreNextInputEcho = false;
|
||||
|
||||
QSplitter *m_splitter = new Core::MiniSplitter(Qt::Horizontal);
|
||||
m_splitter->setParent(this);
|
||||
|
||||
@@ -407,10 +410,18 @@ LogWindow::LogWindow(QWidget *parent)
|
||||
m_combinedText, SLOT(gotoResult(int)));
|
||||
connect(m_commandEdit, SIGNAL(returnPressed()),
|
||||
SLOT(sendCommand()));
|
||||
connect(m_inputText, SIGNAL(executeLineRequested()),
|
||||
SLOT(executeLine()));
|
||||
|
||||
setMinimumHeight(60);
|
||||
}
|
||||
|
||||
void LogWindow::executeLine()
|
||||
{
|
||||
m_ignoreNextInputEcho = true;
|
||||
debuggerCore()->executeDebuggerCommand(m_inputText->textCursor().block().text());
|
||||
}
|
||||
|
||||
void LogWindow::sendCommand()
|
||||
{
|
||||
debuggerCore()->executeDebuggerCommand(m_commandEdit->text());
|
||||
@@ -447,6 +458,14 @@ void LogWindow::showOutput(int channel, const QString &output)
|
||||
void LogWindow::showInput(int channel, const QString &input)
|
||||
{
|
||||
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))
|
||||
m_inputText->appendPlainText(logTimeStamp());
|
||||
m_inputText->appendPlainText(input);
|
||||
|
||||
@@ -64,6 +64,7 @@ public:
|
||||
public slots:
|
||||
void clearContents();
|
||||
void sendCommand();
|
||||
void executeLine();
|
||||
void showOutput(int channel, const QString &output);
|
||||
void showInput(int channel, const QString &input);
|
||||
|
||||
@@ -76,6 +77,7 @@ private:
|
||||
QPlainTextEdit *m_inputText; // scriptable input alone
|
||||
QLineEdit *m_commandEdit;
|
||||
QLabel *m_commandLabel;
|
||||
bool m_ignoreNextInputEcho;
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user