From f5f7942f7d45bf14c4e4a5cd739a35db0f6a1e46 Mon Sep 17 00:00:00 2001
From: hjk <qtc-committer@nokia.com>
Date: Thu, 4 Feb 2010 14:03:07 +0100
Subject: [PATCH] debugger: add some time stamps to input pane, too

---
 src/plugins/debugger/debuggeroutputwindow.cpp | 42 ++++++++++++++++++-
 src/plugins/debugger/gdb/gdbengine.cpp        |  4 ++
 2 files changed, 44 insertions(+), 2 deletions(-)

diff --git a/src/plugins/debugger/debuggeroutputwindow.cpp b/src/plugins/debugger/debuggeroutputwindow.cpp
index 3957d05137c..397d4578821 100644
--- a/src/plugins/debugger/debuggeroutputwindow.cpp
+++ b/src/plugins/debugger/debuggeroutputwindow.cpp
@@ -82,6 +82,7 @@ static LogChannel channelForChar(QChar c)
     }
 }
 
+
 /////////////////////////////////////////////////////////////////////
 //
 // OutputHighlighter
@@ -132,9 +133,37 @@ private:
     QPlainTextEdit *m_parent;
 };
 
+
 /////////////////////////////////////////////////////////////////////
 //
-// InputPane
+// InputHighlighter
+//
+/////////////////////////////////////////////////////////////////////
+
+class InputHighlighter : public QSyntaxHighlighter
+{
+public:
+    InputHighlighter(QPlainTextEdit *parent)
+        : QSyntaxHighlighter(parent->document()), m_parent(parent)
+    {}
+
+private:
+    void highlightBlock(const QString &text)
+    {
+        if (text.size() > 3 && text.at(2) == QLatin1Char(':')) {
+            QTextCharFormat format;
+            format.setForeground(Qt::darkRed);
+            setFormat(1, text.size(), format);
+        }
+    }
+
+    QPlainTextEdit *m_parent;
+};
+
+
+/////////////////////////////////////////////////////////////////////
+//
+// DebbuggerPane base class
 //
 /////////////////////////////////////////////////////////////////////
 
@@ -181,13 +210,22 @@ public:
     QAction *m_saveContentsAction;
 };
 
+
+/////////////////////////////////////////////////////////////////////
+//
+// InputPane
+//
+/////////////////////////////////////////////////////////////////////
+
 class InputPane : public DebuggerPane
 {
     Q_OBJECT
 public:
     InputPane(QWidget *parent)
         : DebuggerPane(parent)
-    {}
+    {
+        (void) new InputHighlighter(this);
+    }
 
 signals:
     void clearContentsRequested();
diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp
index 4354b63e472..3621d114fd8 100644
--- a/src/plugins/debugger/gdb/gdbengine.cpp
+++ b/src/plugins/debugger/gdb/gdbengine.cpp
@@ -1904,6 +1904,8 @@ void GdbEngine::setTokenBarrier()
     }
     PENDING_DEBUG("\n--- token barrier ---\n");
     gdbInputAvailable(LogMisc, _("--- token barrier ---"));
+    if (theDebuggerBoolSetting(LogTimeStamps))
+        gdbInputAvailable(LogMisc, currentTime());
     m_oldestAcceptableToken = currentToken();
 }
 
@@ -3163,6 +3165,8 @@ void GdbEngine::rebuildModel()
     if (!isSynchroneous())
         m_processedNames.clear();
     PENDING_DEBUG("REBUILDING MODEL" << count);
+    if (theDebuggerBoolSetting(LogTimeStamps))
+        gdbInputAvailable(LogMisc, currentTime());
     gdbInputAvailable(LogStatus, _("<Rebuild Watchmodel %1>").arg(count));
     showStatusMessage(tr("Finished retrieving data."), 400);
     manager()->watchHandler()->endCycle();
-- 
GitLab