diff options
author | Ken Moore <ken@ixsystems.com> | 2017-06-11 05:17:35 -0400 |
---|---|---|
committer | Ken Moore <ken@ixsystems.com> | 2017-06-11 05:17:35 -0400 |
commit | 123f0cb39e9670e9e89a2f62e2d5657c3e74aaa7 (patch) | |
tree | f59e5c1975ad6455e3bba569602002d23127ecd2 /src-qt5/desktop-utils/lumina-textedit/syntaxSupport.cpp | |
parent | Darken up the emblem icons in the "-dark" theme a bit more, there still was n... (diff) | |
download | lumina-123f0cb39e9670e9e89a2f62e2d5657c3e74aaa7.tar.gz lumina-123f0cb39e9670e9e89a2f62e2d5657c3e74aaa7.tar.bz2 lumina-123f0cb39e9670e9e89a2f62e2d5657c3e74aaa7.zip |
Add support for a new "file_regex" flag in the JSON syntax manifests that can be used when looking for matching file type support.
Diffstat (limited to 'src-qt5/desktop-utils/lumina-textedit/syntaxSupport.cpp')
-rw-r--r-- | src-qt5/desktop-utils/lumina-textedit/syntaxSupport.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src-qt5/desktop-utils/lumina-textedit/syntaxSupport.cpp b/src-qt5/desktop-utils/lumina-textedit/syntaxSupport.cpp index 87592e6c..e5286e7b 100644 --- a/src-qt5/desktop-utils/lumina-textedit/syntaxSupport.cpp +++ b/src-qt5/desktop-utils/lumina-textedit/syntaxSupport.cpp @@ -77,10 +77,12 @@ void SyntaxFile::SetupDocument(QPlainTextEdit* editor){ bool SyntaxFile::supportsFile(QString file){ if(metaObj.contains("file_suffix")){ return metaObj.value("file_suffix").toArray().contains( file.section("/",-1).section(".",-1) ); + }else if(metaObj.contains("file_regex")){ + return (QRegExp( metaObj.value("file_regex").toString() ).indexIn(file.section("/",-1) ) >=0 ); } return false; } - + bool SyntaxFile::LoadFile(QString file, QSettings *settings){ QStringList contents = LUtils::readFile(file); //Now trim the extra non-JSON off the beginning of the file @@ -108,7 +110,7 @@ bool SyntaxFile::LoadFile(QString file, QSettings *settings){ //First load the rule //qDebug() << "Load Rule:" << rule.keys(); if(rule.contains("words")){} //valid option - handled at the end though - else if(rule.contains("regex")){ + else if(rule.contains("regex")){ tmp.pattern = QRegExp(rule.value("regex").toString()); }else if(rule.contains("regex_start") && rule.contains("regex_end")){ tmp.startPattern = QRegExp(rule.value("regex_start").toString()); |