diff options
author | Ken Moore <ken@ixsystems.com> | 2017-06-08 21:50:09 -0400 |
---|---|---|
committer | Ken Moore <ken@ixsystems.com> | 2017-06-08 21:50:09 -0400 |
commit | 21a0f25bcf3859b1d7294e0842e4f06a203fdee6 (patch) | |
tree | 5086c98cf3bef461716766b6f7c5725dc19bd5b8 /src-qt5/desktop-utils/lumina-textedit/syntaxSupport.h | |
parent | Start the prep-work for a new way of loading syntax highlighting rules in LTE. (diff) | |
download | lumina-21a0f25bcf3859b1d7294e0842e4f06a203fdee6.tar.gz lumina-21a0f25bcf3859b1d7294e0842e4f06a203fdee6.tar.bz2 lumina-21a0f25bcf3859b1d7294e0842e4f06a203fdee6.zip |
Get a lot more of the new plugin-based syntax highlighting system setup (not integrated/tested yet).
Diffstat (limited to 'src-qt5/desktop-utils/lumina-textedit/syntaxSupport.h')
-rw-r--r-- | src-qt5/desktop-utils/lumina-textedit/syntaxSupport.h | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/src-qt5/desktop-utils/lumina-textedit/syntaxSupport.h b/src-qt5/desktop-utils/lumina-textedit/syntaxSupport.h index f834e275..ba4c211a 100644 --- a/src-qt5/desktop-utils/lumina-textedit/syntaxSupport.h +++ b/src-qt5/desktop-utils/lumina-textedit/syntaxSupport.h @@ -13,10 +13,15 @@ #include <QString> #include <QSettings> #include <QDebug> +#include <QDateTime> +#include <QJsonObject> +#include <QPlainTextEdit> + //Simple syntax rules struct SyntaxRule{ - QRegExp pattern; + QRegExp pattern; //single-line rule + QRegExp startPattern, endPattern; //multi-line rules QTextCharFormat format; }; //Complicated/multi-line rules @@ -25,6 +30,32 @@ struct SyntaxRuleSplit{ QTextCharFormat format; }; +class SyntaxFile{ +private: + QJsonObject metaObj; + QJsonObject formatObj; + + QColor colorFromOption(QString opt, QSettings *settings); + +public: + QVector<SyntaxRule> rules; + QDateTime lastLoaded; + QString fileLoaded; + + SyntaxFile(){} + + QString name(); + int char_limit(); + bool highlight_excess_whitespace(); + + void SetupDocument(QPlainTextEdit *editor); + bool supportsFile(QString file); //does this syntax set support the file? + + //Main Loading routine (run this before other functions) + bool LoadFile(QString file, QSettings *settings); + +}; + class Custom_Syntax : public QSyntaxHighlighter{ Q_OBJECT private: |