aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen Moore <moorekou@gmail.com>2016-04-21 08:43:41 -0400
committerKen Moore <moorekou@gmail.com>2016-04-21 08:43:41 -0400
commitf123b66dccf1f1c0f7ba23d473448d1c6989196e (patch)
tree6464215190f6bb0a296d0d83d1050006e67c48a5
parentAdd all the translation files for lumina-textedit. (diff)
downloadlumina-f123b66dccf1f1c0f7ba23d473448d1c6989196e.tar.gz
lumina-f123b66dccf1f1c0f7ba23d473448d1c6989196e.tar.bz2
lumina-f123b66dccf1f1c0f7ba23d473448d1c6989196e.zip
Another minor change to lumina-textedit: Add a "preprocessor" syntax color, and add preprocessor line highlighting to C+++ syntax rules. Also ensure that the defined colors are always up to date, even if a new color is added at some later version.
-rw-r--r--desktop-utilities/lumina-textedit/syntaxSupport.cpp22
1 files changed, 13 insertions, 9 deletions
diff --git a/desktop-utilities/lumina-textedit/syntaxSupport.cpp b/desktop-utilities/lumina-textedit/syntaxSupport.cpp
index a5b07f5d..617cebae 100644
--- a/desktop-utilities/lumina-textedit/syntaxSupport.cpp
+++ b/desktop-utilities/lumina-textedit/syntaxSupport.cpp
@@ -25,15 +25,15 @@ QStringList Custom_Syntax::knownColors(){
}
void Custom_Syntax::SetupDefaultColors(QSettings *settings){
- if(settings->contains("colors/keyword")){ return; } //already has color info
- settings->setValue("colors/keyword", QColor(Qt::blue).name() );
- settings->setValue("colors/altkeyword", QColor(Qt::darkBlue).name() );
- settings->setValue("colors/class", QColor(Qt::darkRed).name() );
- settings->setValue("colors/text", QColor(Qt::darkMagenta).name() );
- settings->setValue("colors/function", QColor(Qt::darkCyan).name() );
- settings->setValue("colors/comment", QColor(Qt::darkGreen).name() );
- settings->setValue("colors/bracket-found", QColor(Qt::green).name() );
- settings->setValue("colors/bracket-missing", QColor(Qt::red).name() );
+ if(!settings->contains("colors/keyword")){settings->setValue("colors/keyword", QColor(Qt::blue).name() ); }
+ if(!settings->contains("colors/altkeyword")){settings->setValue("colors/altkeyword", QColor(Qt::darkBlue).name() ); }
+ if(!settings->contains("colors/class")){settings->setValue("colors/class", QColor(Qt::darkRed).name() ); }
+ if(!settings->contains("colors/text")){settings->setValue("colors/text", QColor(Qt::darkMagenta).name() ); }
+ if(!settings->contains("colors/function")){settings->setValue("colors/function", QColor(Qt::darkCyan).name() ); }
+ if(!settings->contains("colors/comment")){settings->setValue("colors/comment", QColor(Qt::darkGreen).name() ); }
+ if(!settings->contains("colors/bracket-found")){settings->setValue("colors/bracket-found", QColor(Qt::green).name() ); }
+ if(!settings->contains("colors/bracket-missing")){settings->setValue("colors/bracket-missing", QColor(Qt::red).name() ); }
+ if(!settings->contains("colors/preprocessor")){settings->setValue("colors/preprocessor", QColor(Qt::darkYellow).name() ); }
}
QString Custom_Syntax::ruleForFile(QString filename){
@@ -77,6 +77,10 @@ void Custom_Syntax::loadRules(QString type){
rule.format.setForeground( QColor(settings->value("colors/function").toString()) );
rule.pattern = QRegExp("\\b[A-Za-z0-9_]+(?=\\()");
rules << rule;
+ //Proprocessor commands
+ rule.format.setForeground( QColor(settings->value("colors/preprocessor").toString()) );
+ rule.pattern = QRegExp("^#[^\n]*");
+ rules << rule;
//Comment (single line)
rule.format.setForeground( QColor(settings->value("colors/comment").toString()) );
rule.pattern = QRegExp("//[^\n]*");
bgstack15