changeset 13345:01eb3fd5faf5

Added some syntax highlighting.
author Jacob Dawid <jacob.dawid@googlemail.com>
date Wed, 06 Apr 2011 17:00:49 +0200
parents 0a3a2d4e3d86
children 381b7413c652
files gui//terminalhighlighter.cpp gui//terminalhighlighter.h
diffstat 2 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/gui//terminalhighlighter.cpp
+++ b/gui//terminalhighlighter.cpp
@@ -25,7 +25,6 @@
     HighlightingRule rule;
 
     keywordFormat.setForeground(Qt::darkRed);
-    keywordFormat.setFontWeight(QFont::Bold);
     QStringList keywordPatterns;
     keywordPatterns << "\\bOctave\\b" << "\\bGNU\\b";
 
@@ -35,6 +34,17 @@
         highlightingRules.append(rule);
     }
 
+    promptFormat.setForeground(Qt::darkGreen);
+    rule.pattern = QRegExp("\\boctave:[0-9]+>");
+    rule.format = promptFormat;
+    highlightingRules.append(rule);
+
+    errorFormat.setForeground(Qt::red);
+    errorFormat.setFontWeight(QFont::Bold);
+    rule.pattern = QRegExp("\\berror:");
+    rule.format = errorFormat;
+    highlightingRules.append(rule);
+
     numberFormat.setForeground(Qt::darkGreen);
     numberFormat.setFontWeight(QFont::Bold);
     rule.pattern = QRegExp("\\b[0-9\\.]+[i]?\\b");
--- a/gui//terminalhighlighter.h
+++ b/gui//terminalhighlighter.h
@@ -47,6 +47,8 @@
     QTextCharFormat quotationFormat;
     QTextCharFormat numberFormat;
     QTextCharFormat urlFormat;
+    QTextCharFormat errorFormat;
+    QTextCharFormat promptFormat;
 };
 
 #endif // TERMINALHIGHLIGHTER_H