forked from qt-creator/qt-creator
Debugger: Move handling of 'Log timestamps' into outputwindow.
Remove some unused leftovers from DebuggerOuputWindow.
This commit is contained in:
@@ -34,6 +34,7 @@
|
|||||||
|
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
#include <QtCore/QFile>
|
#include <QtCore/QFile>
|
||||||
|
#include <QtCore/QTime>
|
||||||
|
|
||||||
#include <QtGui/QAction>
|
#include <QtGui/QAction>
|
||||||
#include <QtGui/QHBoxLayout>
|
#include <QtGui/QHBoxLayout>
|
||||||
@@ -411,6 +412,9 @@ void DebuggerOutputWindow::showOutput(int channel, const QString &output)
|
|||||||
QTextCursor cursor = oldCursor;
|
QTextCursor cursor = oldCursor;
|
||||||
cursor.movePosition(QTextCursor::End);
|
cursor.movePosition(QTextCursor::End);
|
||||||
bool atEnd = oldCursor.position() == cursor.position();
|
bool atEnd = oldCursor.position() == cursor.position();
|
||||||
|
|
||||||
|
if (theDebuggerBoolSetting(LogTimeStamps))
|
||||||
|
m_combinedText->appendPlainText(charForChannel(LogTime) + logTimeStamp());
|
||||||
foreach (QString line, output.split('\n')) {
|
foreach (QString line, output.split('\n')) {
|
||||||
// FIXME: QTextEdit asserts on really long lines...
|
// FIXME: QTextEdit asserts on really long lines...
|
||||||
const int n = 30000;
|
const int n = 30000;
|
||||||
@@ -431,6 +435,8 @@ void DebuggerOutputWindow::showOutput(int channel, const QString &output)
|
|||||||
void DebuggerOutputWindow::showInput(int channel, const QString &input)
|
void DebuggerOutputWindow::showInput(int channel, const QString &input)
|
||||||
{
|
{
|
||||||
Q_UNUSED(channel)
|
Q_UNUSED(channel)
|
||||||
|
if (theDebuggerBoolSetting(LogTimeStamps))
|
||||||
|
m_inputText->appendPlainText(logTimeStamp());
|
||||||
m_inputText->appendPlainText(input);
|
m_inputText->appendPlainText(input);
|
||||||
QTextCursor cursor = m_inputText->textCursor();
|
QTextCursor cursor = m_inputText->textCursor();
|
||||||
cursor.movePosition(QTextCursor::End);
|
cursor.movePosition(QTextCursor::End);
|
||||||
@@ -461,4 +467,27 @@ QString DebuggerOutputWindow::inputContents() const
|
|||||||
return m_inputText->toPlainText();
|
return m_inputText->toPlainText();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString DebuggerOutputWindow::logTimeStamp()
|
||||||
|
{
|
||||||
|
// Cache the last log time entry by ms. If time progresses,
|
||||||
|
// report the difference to the last time stamp in ms.
|
||||||
|
static const QString logTimeFormat(QLatin1String("hh:mm:ss.zzz"));
|
||||||
|
static QTime lastTime = QTime::currentTime();
|
||||||
|
static QString lastTimeStamp = lastTime.toString(logTimeFormat);
|
||||||
|
|
||||||
|
const QTime currentTime = QTime::currentTime();
|
||||||
|
if (currentTime != lastTime) {
|
||||||
|
const int elapsedMS = lastTime.msecsTo(currentTime);
|
||||||
|
lastTime = currentTime;
|
||||||
|
lastTimeStamp = lastTime.toString(logTimeFormat);
|
||||||
|
// Append time elapsed
|
||||||
|
QString rc = lastTimeStamp;
|
||||||
|
rc += QLatin1String(" [");
|
||||||
|
rc += QString::number(elapsedMS);
|
||||||
|
rc += QLatin1String("ms]");
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
return lastTimeStamp;
|
||||||
|
}
|
||||||
|
|
||||||
#include "debuggeroutputwindow.moc"
|
#include "debuggeroutputwindow.moc"
|
||||||
|
@@ -46,20 +46,15 @@ class DebuggerOutputWindow : public QWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DebuggerOutputWindow(QWidget *parent = 0);
|
explicit DebuggerOutputWindow(QWidget *parent = 0);
|
||||||
|
|
||||||
QWidget *outputWidget(QWidget *) { return this; }
|
|
||||||
QList<QWidget*> toolBarWidgets() const { return QList<QWidget *>(); }
|
|
||||||
|
|
||||||
QString name() const { return windowTitle(); }
|
|
||||||
void visibilityChanged(bool /*visible*/) {}
|
|
||||||
|
|
||||||
void bringPaneToForeground() { emit showPage(); }
|
|
||||||
void setCursor(const QCursor &cursor);
|
void setCursor(const QCursor &cursor);
|
||||||
|
|
||||||
QString combinedContents() const;
|
QString combinedContents() const;
|
||||||
QString inputContents() const;
|
QString inputContents() const;
|
||||||
|
|
||||||
|
static QString logTimeStamp();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void clearContents();
|
void clearContents();
|
||||||
void showOutput(int channel, const QString &output);
|
void showOutput(int channel, const QString &output);
|
||||||
|
@@ -66,6 +66,7 @@
|
|||||||
#include "sourcefileswindow.h"
|
#include "sourcefileswindow.h"
|
||||||
|
|
||||||
#include "debuggerdialogs.h"
|
#include "debuggerdialogs.h"
|
||||||
|
#include "debuggeroutputwindow.h"
|
||||||
|
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <utils/fancymainwindow.h>
|
#include <utils/fancymainwindow.h>
|
||||||
@@ -312,25 +313,19 @@ void GdbEngine::readDebugeeOutput(const QByteArray &data)
|
|||||||
|
|
||||||
void GdbEngine::handleResponse(const QByteArray &buff)
|
void GdbEngine::handleResponse(const QByteArray &buff)
|
||||||
{
|
{
|
||||||
static QTime lastTime;
|
|
||||||
|
|
||||||
if (theDebuggerBoolSetting(LogTimeStamps))
|
|
||||||
showMessage(currentTime(), LogTime);
|
|
||||||
showMessage(QString::fromLocal8Bit(buff, buff.length()), LogOutput);
|
showMessage(QString::fromLocal8Bit(buff, buff.length()), LogOutput);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
static QTime lastTime;
|
||||||
qDebug() // << "#### start response handling #### "
|
qDebug() // << "#### start response handling #### "
|
||||||
<< currentTime()
|
|
||||||
<< lastTime.msecsTo(QTime::currentTime()) << "ms,"
|
<< lastTime.msecsTo(QTime::currentTime()) << "ms,"
|
||||||
<< "buf:" << buff.left(1500) << "..."
|
<< "buf:" << buff.left(1500) << "..."
|
||||||
//<< "buf:" << buff
|
//<< "buf:" << buff
|
||||||
<< "size:" << buff.size();
|
<< "size:" << buff.size();
|
||||||
|
lastTime = QTime::currentTime();
|
||||||
#else
|
#else
|
||||||
//qDebug() << "buf:" << buff;
|
//qDebug() << "buf:" << buff;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
lastTime = QTime::currentTime();
|
|
||||||
|
|
||||||
if (buff.isEmpty() || buff == "(gdb) ")
|
if (buff.isEmpty() || buff == "(gdb) ")
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -2013,7 +2008,7 @@ void GdbEngine::setTokenBarrier()
|
|||||||
PENDING_DEBUG("\n--- token barrier ---\n");
|
PENDING_DEBUG("\n--- token barrier ---\n");
|
||||||
showMessage(_("--- token barrier ---"), LogMiscInput);
|
showMessage(_("--- token barrier ---"), LogMiscInput);
|
||||||
if (theDebuggerBoolSetting(LogTimeStamps))
|
if (theDebuggerBoolSetting(LogTimeStamps))
|
||||||
showMessage(currentTime(), LogMiscInput);
|
showMessage(DebuggerOutputWindow::logTimeStamp(), LogMiscInput);
|
||||||
m_oldestAcceptableToken = currentToken();
|
m_oldestAcceptableToken = currentToken();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3369,7 +3364,7 @@ void GdbEngine::rebuildWatchModel()
|
|||||||
m_processedNames.clear();
|
m_processedNames.clear();
|
||||||
PENDING_DEBUG("REBUILDING MODEL" << count);
|
PENDING_DEBUG("REBUILDING MODEL" << count);
|
||||||
if (theDebuggerBoolSetting(LogTimeStamps))
|
if (theDebuggerBoolSetting(LogTimeStamps))
|
||||||
showMessage(currentTime(), LogMiscInput);
|
showMessage(DebuggerOutputWindow::logTimeStamp(), LogMiscInput);
|
||||||
showMessage(_("<Rebuild Watchmodel %1>").arg(count), LogMiscInput);
|
showMessage(_("<Rebuild Watchmodel %1>").arg(count), LogMiscInput);
|
||||||
showStatusMessage(tr("Finished retrieving data"), 400);
|
showStatusMessage(tr("Finished retrieving data"), 400);
|
||||||
watchHandler()->endCycle();
|
watchHandler()->endCycle();
|
||||||
|
Reference in New Issue
Block a user