aboutsummaryrefslogtreecommitdiff
path: root/qtmips_gui
diff options
context:
space:
mode:
authorPavel Pisa <pisa@cmp.felk.cvut.cz>2019-07-02 18:53:21 +0200
committerPavel Pisa <pisa@cmp.felk.cvut.cz>2019-07-02 18:53:21 +0200
commit2aa33db8be7397d39080e6ec96a9158e0c1e63e5 (patch)
tree92d26b194a6eba14bcc48bd88cd6f95299ed70f1 /qtmips_gui
parent7262d30e9e689aaacd7926c90d953ab86cd9cfa7 (diff)
downloadqtmips-2aa33db8be7397d39080e6ec96a9158e0c1e63e5.tar.gz
qtmips-2aa33db8be7397d39080e6ec96a9158e0c1e63e5.tar.bz2
qtmips-2aa33db8be7397d39080e6ec96a9158e0c1e63e5.zip
Simple highlighter for assembly language added.
Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
Diffstat (limited to 'qtmips_gui')
-rw-r--r--qtmips_gui/qtmips_gui.pro6
-rw-r--r--qtmips_gui/srceditor.cpp4
-rw-r--r--qtmips_gui/srceditor.h2
3 files changed, 9 insertions, 3 deletions
diff --git a/qtmips_gui/qtmips_gui.pro b/qtmips_gui/qtmips_gui.pro
index 1075f96..ae4f525 100644
--- a/qtmips_gui/qtmips_gui.pro
+++ b/qtmips_gui/qtmips_gui.pro
@@ -74,7 +74,8 @@ SOURCES += \
hinttabledelegate.cpp \
coreview/minimux.cpp \
srceditor.cpp \
- fixmatheval.cpp
+ fixmatheval.cpp \
+ highlighter.cpp
HEADERS += \
mainwindow.h \
@@ -119,7 +120,8 @@ HEADERS += \
hinttabledelegate.h \
coreview/minimux.h \
srceditor.h \
- fixmatheval.h
+ fixmatheval.h \
+ highlighter.h
wasm: SOURCES += \
qhtml5file_html5.cpp
diff --git a/qtmips_gui/srceditor.cpp b/qtmips_gui/srceditor.cpp
index e8bdb85..bb6da16 100644
--- a/qtmips_gui/srceditor.cpp
+++ b/qtmips_gui/srceditor.cpp
@@ -40,6 +40,7 @@
#include <QTextBlock>
#include "srceditor.h"
+#include "highlighter.h"
void SrcEditor::setup_common() {
QFont font;
@@ -48,6 +49,7 @@ void SrcEditor::setup_common() {
font.setPointSize(10);
setFont(font);
tname = "Unknown";
+ highlighter = new Highlighter(document());
}
SrcEditor::SrcEditor(QWidget *parent) : Super(parent) {
@@ -59,7 +61,7 @@ SrcEditor::SrcEditor(const QString &text, QWidget *parent) : Super(text, parent)
}
SrcEditor::~SrcEditor() {
-
+ delete highlighter;
}
QString SrcEditor::filename() {
diff --git a/qtmips_gui/srceditor.h b/qtmips_gui/srceditor.h
index 9d25be7..1c2e677 100644
--- a/qtmips_gui/srceditor.h
+++ b/qtmips_gui/srceditor.h
@@ -39,6 +39,7 @@
#include <QTextEdit>
#include <QString>
#include "qtmipsmachine.h"
+#include "highlighter.h"
class SrcEditor : public QTextEdit {
Q_OBJECT
@@ -54,6 +55,7 @@ public:
bool loadByteArray(const QByteArray &content, QString filename = "");
void setCursorToLine(int ln);
private:
+ Highlighter *highlighter;
void setup_common();
QString fname;
QString tname;