aboutsummaryrefslogtreecommitdiff
path: root/desktop-utilities/lumina-textedit
diff options
context:
space:
mode:
Diffstat (limited to 'desktop-utilities/lumina-textedit')
-rw-r--r--desktop-utilities/lumina-textedit/MainUI.cpp46
-rw-r--r--desktop-utilities/lumina-textedit/MainUI.h10
-rw-r--r--desktop-utilities/lumina-textedit/MainUI.ui45
-rw-r--r--desktop-utilities/lumina-textedit/PlainTextEditor.cpp33
-rw-r--r--desktop-utilities/lumina-textedit/PlainTextEditor.h4
-rw-r--r--desktop-utilities/lumina-textedit/syntaxSupport.cpp101
-rw-r--r--desktop-utilities/lumina-textedit/syntaxSupport.h7
7 files changed, 212 insertions, 34 deletions
diff --git a/desktop-utilities/lumina-textedit/MainUI.cpp b/desktop-utilities/lumina-textedit/MainUI.cpp
index f3e29d30..53fa0ca6 100644
--- a/desktop-utilities/lumina-textedit/MainUI.cpp
+++ b/desktop-utilities/lumina-textedit/MainUI.cpp
@@ -10,12 +10,15 @@
#include "syntaxSupport.h"
#include <LuminaXDG.h>
+#include <LuminaUtils.h>
#include <QFileDialog>
#include <QDir>
MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI){
ui->setupUi(this);
+ settings = new QSettings("lumina-desktop","lumina-textedit");
+ Custom_Syntax::SetupDefaultColors(settings); //pre-load any color settings as needed
this->setWindowTitle(tr("Text Editor"));
ui->tabWidget->clear();
//Update the menu of available syntax highlighting modes
@@ -23,17 +26,25 @@ MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI){
for(int i=0; i<smodes.length(); i++){
ui->menuSyntax_Highlighting->addAction(smodes[i]);
}
+ ui->actionLine_Numbers->setChecked( settings->value("showLineNumbers",true).toBool() );
//Setup any connections
connect(ui->actionClose, SIGNAL(triggered()), this, SLOT(close()) );
connect(ui->actionNew_File, SIGNAL(triggered()), this, SLOT(NewFile()) );
connect(ui->actionOpen_File, SIGNAL(triggered()), this, SLOT(OpenFile()) );
+ connect(ui->actionClose_File, SIGNAL(triggered()), this, SLOT(CloseFile()) );
connect(ui->actionSave_File, SIGNAL(triggered()), this, SLOT(SaveFile()) );
connect(ui->actionSave_File_As, SIGNAL(triggered()), this, SLOT(SaveFileAs()) );
connect(ui->menuSyntax_Highlighting, SIGNAL(triggered(QAction*)), this, SLOT(UpdateHighlighting(QAction*)) );
connect(ui->tabWidget, SIGNAL(currentChanged(int)), this, SLOT(tabChanged()) );
connect(ui->tabWidget, SIGNAL(tabCloseRequested(int)), this, SLOT(tabClosed(int)) );
connect(ui->actionLine_Numbers, SIGNAL(toggled(bool)), this, SLOT(showLineNumbers(bool)) );
+ connect(ui->actionCustomize_Colors, SIGNAL(triggered()), this, SLOT(ModifyColors()) );
updateIcons();
+ //Now load the initial size of the window
+ QSize lastSize = settings->value("lastSize",QSize()).toSize();
+ if(lastSize.width() > this->sizeHint().width() && lastSize.height() > this->sizeHint().height() ){
+ this->resize(lastSize);
+ }
}
MainUI::~MainUI(){
@@ -42,24 +53,23 @@ MainUI::~MainUI(){
void MainUI::LoadArguments(QStringList args){ //CLI arguments
for(int i=0; i<args.length(); i++){
-
+ OpenFile( LUtils::PathToAbsolute(args[i]) );
}
-
- /*if(ui->tabWidget->count()<1){
- NewFile();
- }*/
}
// =================
// PUBLIC SLOTS
//=================
void MainUI::updateIcons(){
+ this->setWindowIcon( LXDG::findIcon("document-edit") );
ui->actionClose->setIcon(LXDG::findIcon("application-exit") );
ui->actionNew_File->setIcon(LXDG::findIcon("document-new") );
ui->actionOpen_File->setIcon(LXDG::findIcon("document-open") );
+ ui->actionClose_File->setIcon(LXDG::findIcon("document-close") );
ui->actionSave_File->setIcon(LXDG::findIcon("document-save") );
ui->actionSave_File_As->setIcon(LXDG::findIcon("document-save-as") );
ui->menuSyntax_Highlighting->setIcon( LXDG::findIcon("format-text-color") );
+ ui->actionCustomize_Colors->setIcon( LXDG::findIcon("format-fill-color") );
}
@@ -100,7 +110,7 @@ void MainUI::OpenFile(QString file){
files << file;
}
for(int i=0; i<files.length(); i++){
- PlainTextEditor *edit = new PlainTextEditor(this);
+ PlainTextEditor *edit = new PlainTextEditor(settings, this);
connect(edit, SIGNAL(FileLoaded(QString)), this, SLOT(updateTab(QString)) );
connect(edit, SIGNAL(UnsavedChanges(QString)), this, SLOT(updateTab(QString)) );
ui->tabWidget->addTab(edit, files[i].section("/",-1));
@@ -112,6 +122,11 @@ void MainUI::OpenFile(QString file){
}
}
+void MainUI::CloseFile(){
+ int index = ui->tabWidget->currentIndex();
+ if(index>=0){ tabClosed(index); }
+}
+
void MainUI::SaveFile(){
PlainTextEditor *cur = currentEditor();
if(cur==0){ return; }
@@ -131,18 +146,31 @@ void MainUI::UpdateHighlighting(QAction *act){
}
void MainUI::showLineNumbers(bool show){
+ settings->setValue("showLineNumbers",show);
for(int i=0; i<ui->tabWidget->count(); i++){
PlainTextEditor *edit = static_cast<PlainTextEditor*>(ui->tabWidget->widget(i));
edit->showLineNumbers(show);
}
}
+void MainUI::ModifyColors(){
+
+}
+
void MainUI::updateTab(QString file){
- PlainTextEditor *cur = currentEditor();
+ PlainTextEditor *cur = 0;
+ int index = -1;
+ for(int i=0; i<ui->tabWidget->count(); i++){
+ PlainTextEditor *tmp = static_cast<PlainTextEditor*>(ui->tabWidget->widget(i));
+ if(tmp->currentFile()==file){
+ cur = tmp;
+ index = i;
+ break;
+ }
+ }
if(cur==0){ return; } //should never happen
- int index = ui->tabWidget->currentIndex();
- if(index<0){ index = 0; } //FALLBACK - use the first tab
bool changes = cur->hasChange();
+ //qDebug() << "Update Tab:" << file << cur << changes;
ui->tabWidget->setTabText(index,(changes ? "*" : "") + file.section("/",-1));
ui->actionSave_File->setEnabled(changes);
ui->actionSave_File_As->setEnabled(changes);
diff --git a/desktop-utilities/lumina-textedit/MainUI.h b/desktop-utilities/lumina-textedit/MainUI.h
index 9d16933d..3bb92295 100644
--- a/desktop-utilities/lumina-textedit/MainUI.h
+++ b/desktop-utilities/lumina-textedit/MainUI.h
@@ -9,6 +9,7 @@
#include <QMainWindow>
#include <QStringList>
+#include <QSettings>
#include "PlainTextEditor.h"
@@ -29,6 +30,7 @@ public slots:
private:
Ui::MainUI *ui;
+ QSettings *settings;
//Simplification functions
PlainTextEditor* currentEditor();
@@ -38,17 +40,23 @@ private slots:
//Main Actions
void NewFile();
void OpenFile(QString file = "");
+ void CloseFile(); //current file only
void SaveFile();
void SaveFileAs();
//Other Menu Actions
void UpdateHighlighting(QAction*);
void showLineNumbers(bool);
+ void ModifyColors();
//Tab Interactions
void updateTab(QString);
void tabChanged();
void tabClosed(int);
+protected:
+ void resizeEvent(QResizeEvent *ev){
+ settings->setValue("lastSize", ev->size());
+ }
};
-#endif \ No newline at end of file
+#endif
diff --git a/desktop-utilities/lumina-textedit/MainUI.ui b/desktop-utilities/lumina-textedit/MainUI.ui
index 56598ce4..024d1b74 100644
--- a/desktop-utilities/lumina-textedit/MainUI.ui
+++ b/desktop-utilities/lumina-textedit/MainUI.ui
@@ -62,6 +62,7 @@
</property>
<addaction name="actionNew_File"/>
<addaction name="actionOpen_File"/>
+ <addaction name="actionClose_File"/>
<addaction name="separator"/>
<addaction name="actionSave_File"/>
<addaction name="actionSave_File_As"/>
@@ -81,6 +82,8 @@
</widget>
<addaction name="menuSyntax_Highlighting"/>
<addaction name="actionLine_Numbers"/>
+ <addaction name="separator"/>
+ <addaction name="actionCustomize_Colors"/>
</widget>
<addaction name="menuFile"/>
<addaction name="menuView"/>
@@ -114,7 +117,7 @@
<bool>true</bool>
</property>
<property name="text">
- <string>Line Numbers</string>
+ <string>Show Line Numbers</string>
</property>
</action>
<action name="action_syntax_none">
@@ -126,16 +129,34 @@
<property name="text">
<string>New File</string>
</property>
+ <property name="shortcut">
+ <string>Ctrl+N</string>
+ </property>
+ <property name="shortcutContext">
+ <enum>Qt::ApplicationShortcut</enum>
+ </property>
</action>
<action name="actionOpen_File">
<property name="text">
<string>Open File</string>
</property>
+ <property name="shortcut">
+ <string>Ctrl+O</string>
+ </property>
+ <property name="shortcutContext">
+ <enum>Qt::ApplicationShortcut</enum>
+ </property>
</action>
<action name="actionSave_File">
<property name="text">
<string>Save File</string>
</property>
+ <property name="shortcut">
+ <string>Ctrl+S</string>
+ </property>
+ <property name="shortcutContext">
+ <enum>Qt::ApplicationShortcut</enum>
+ </property>
</action>
<action name="actionSave_File_As">
<property name="text">
@@ -146,6 +167,28 @@
<property name="text">
<string>Close</string>
</property>
+ <property name="shortcut">
+ <string>Ctrl+Q</string>
+ </property>
+ <property name="shortcutContext">
+ <enum>Qt::ApplicationShortcut</enum>
+ </property>
+ </action>
+ <action name="actionClose_File">
+ <property name="text">
+ <string>Close File</string>
+ </property>
+ <property name="shortcut">
+ <string>Ctrl+W</string>
+ </property>
+ <property name="shortcutContext">
+ <enum>Qt::ApplicationShortcut</enum>
+ </property>
+ </action>
+ <action name="actionCustomize_Colors">
+ <property name="text">
+ <string>Customize Colors</string>
+ </property>
</action>
</widget>
<resources/>
diff --git a/desktop-utilities/lumina-textedit/PlainTextEditor.cpp b/desktop-utilities/lumina-textedit/PlainTextEditor.cpp
index 51bb2ed5..2c1473c8 100644
--- a/desktop-utilities/lumina-textedit/PlainTextEditor.cpp
+++ b/desktop-utilities/lumina-textedit/PlainTextEditor.cpp
@@ -10,18 +10,21 @@
#include <QPainter>
#include <QTextBlock>
#include <QFileDialog>
+#include <QDebug>
#include <LuminaUtils.h>
//==============
// PUBLIC
//==============
-PlainTextEditor::PlainTextEditor(QWidget *parent) : QPlainTextEdit(parent){
+PlainTextEditor::PlainTextEditor(QSettings *set, QWidget *parent) : QPlainTextEdit(parent){
+ settings = set;
LNW = new LNWidget(this);
showLNW = true;
hasChanges = false;
+ lastSaveContents.clear();
matchleft = matchright = -1;
- SYNTAX = new Custom_Syntax(this->document());
+ SYNTAX = new Custom_Syntax(settings, this->document());
connect(this, SIGNAL(blockCountChanged(int)), this, SLOT(LNW_updateWidth()) );
connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(LNW_highlightLine()) );
connect(this, SIGNAL(updateRequest(const QRect&, int)), this, SLOT(LNW_update(const QRect&, int)) );
@@ -51,22 +54,26 @@ void PlainTextEditor::LoadFile(QString filepath){
this->setWhatsThis(filepath);
this->clear();
SYNTAX->loadRules( Custom_Syntax::ruleForFile(filepath.section("/",-1)) );
- this->setPlainText( LUtils::readFile(filepath).join("\n") );
+ lastSaveContents = LUtils::readFile(filepath).join("\n");
+ this->setPlainText( lastSaveContents );
hasChanges = false;
emit FileLoaded(this->whatsThis());
}
void PlainTextEditor::SaveFile(bool newname){
+ //qDebug() << "Save File:" << this->whatsThis();
if( !this->whatsThis().startsWith("/") || newname ){
//prompt for a filename/path
QString file = QFileDialog::getSaveFileName(this, tr("Save File"), this->whatsThis(), tr("Text File (*)"));
if(file.isEmpty()){ return; }
- else{ this->setWhatsThis(file); }
+ this->setWhatsThis(file);
+ SYNTAX->loadRules( Custom_Syntax::ruleForFile(this->whatsThis().section("/",-1)) );
+ SYNTAX->rehighlight();
}
bool ok = LUtils::writeFile(this->whatsThis(), this->toPlainText().split("\n"), true);
- if(ok){ emit FileLoaded(this->whatsThis()); }
- SYNTAX->loadRules( Custom_Syntax::ruleForFile(this->whatsThis().section("/",-1)) );
- SYNTAX->rehighlight();
+ hasChanges = !ok;
+ if(ok){ lastSaveContents = this->toPlainText(); emit FileLoaded(this->whatsThis()); }
+ //qDebug() << " - Success:" << ok << hasChanges;
}
QString PlainTextEditor::currentFile(){
@@ -84,7 +91,7 @@ int PlainTextEditor::LNWWidth(){
if(lines<1){ lines = 1; }
int chars = 1;
while(lines>=10){ chars++; lines/=10; }
- return (this->fontMetrics().width("9")*chars + 4); //make sure to add a tiny bit of padding
+ return (this->fontMetrics().width("9")*chars); //make sure to add a tiny bit of padding
}
void PlainTextEditor::paintLNW(QPaintEvent *ev){
@@ -211,10 +218,12 @@ void PlainTextEditor::checkMatchChar(){
//Functions for notifying the parent widget of changes
void PlainTextEditor::textChanged(){
- if(!hasChanges){
- hasChanges = true;
- emit UnsavedChanges( this->whatsThis() );
- }
+ //qDebug() << " - Got Text Changed signal";
+ bool changed = (lastSaveContents != this->toPlainText());
+ if(changed == hasChanges){ return; } //no change
+ hasChanges = changed; //save for reading later
+ if(hasChanges){ emit UnsavedChanges( this->whatsThis() ); }
+ else{ emit FileLoaded(this->whatsThis()); }
}
//==================
diff --git a/desktop-utilities/lumina-textedit/PlainTextEditor.h b/desktop-utilities/lumina-textedit/PlainTextEditor.h
index e90243dd..e2eb1a3e 100644
--- a/desktop-utilities/lumina-textedit/PlainTextEditor.h
+++ b/desktop-utilities/lumina-textedit/PlainTextEditor.h
@@ -18,7 +18,7 @@
class PlainTextEditor : public QPlainTextEdit{
Q_OBJECT
public:
- PlainTextEditor(QWidget *parent = 0);
+ PlainTextEditor(QSettings *set, QWidget *parent = 0);
~PlainTextEditor();
//Functions for setting up the editor
@@ -39,6 +39,8 @@ public:
private:
QWidget *LNW; //Line Number Widget
bool showLNW;
+ QSettings *settings;
+ QString lastSaveContents;
//Syntax Highlighting class
Custom_Syntax *SYNTAX;
diff --git a/desktop-utilities/lumina-textedit/syntaxSupport.cpp b/desktop-utilities/lumina-textedit/syntaxSupport.cpp
index 093ca52a..521a194f 100644
--- a/desktop-utilities/lumina-textedit/syntaxSupport.cpp
+++ b/desktop-utilities/lumina-textedit/syntaxSupport.cpp
@@ -10,12 +10,34 @@ QStringList Custom_Syntax::availableRules(){
QStringList avail;
avail << "C++";
avail << "Python";
+ avail << "reST";
return avail;
}
+QStringList Custom_Syntax::knownColors(){
+ //Note: All these colors should be prefixed with "colors/" when accessing them from the settings file
+ QStringList avail;
+ //Standard colors
+ avail << "keyword" << "altkeyword" << "class" << "text" << "function" << "comment";
+
+ return avail;
+}
+
+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() );
+}
+
QString Custom_Syntax::ruleForFile(QString filename){
QString suffix = filename.section(".",-1);
if(suffix=="cpp" || suffix=="hpp" || suffix=="c" || suffix=="h"){ return "C++"; }
+ else if(suffix=="py" || suffix=="pyc"){ return "Python"; }
+ else if(suffix=="rst"){ return "reST"; }
return "";
}
@@ -32,27 +54,27 @@ void Custom_Syntax::loadRules(QString type){
<< "typedef" << "typename" << "union" << "unsigned" << "virtual" << "void" << "volatile";
SyntaxRule rule;
- rule.format.setForeground(Qt::darkBlue);
+ rule.format.setForeground( QColor(settings->value("colors/keyword").toString()) );
rule.format.setFontWeight(QFont::Bold);
for(int i=0; i<keywords.length(); i++){
rule.pattern = QRegExp("\\b"+keywords[i]+"\\b"); //turn each keyword into a QRegExp and insert the rule
rules << rule;
}
//Class Names
- rule.format.setForeground(Qt::darkMagenta);
+ rule.format.setForeground( QColor(settings->value("colors/class").toString()) );
rule.pattern = QRegExp("\\bQ[A-Za-z]+\\b");
rules << rule;
//Quotes
- rule.format.setForeground(Qt::red);
+ rule.format.setForeground( QColor(settings->value("colors/text").toString()) );
rule.format.setFontWeight(QFont::Normal);
rule.pattern = QRegExp("\".*\"");
rules << rule;
//Functions
- rule.format.setForeground(Qt::blue);
+ rule.format.setForeground( QColor(settings->value("colors/function").toString()) );
rule.pattern = QRegExp("\\b[A-Za-z0-9_]+(?=\\()");
rules << rule;
//Comment (single line)
- rule.format.setForeground(Qt::green);
+ rule.format.setForeground( QColor(settings->value("colors/comment").toString()) );
rule.pattern = QRegExp("//[^\n]*");
rules << rule;
//Comment (multi-line)
@@ -71,7 +93,7 @@ void Custom_Syntax::loadRules(QString type){
<< "or" << "pass" << "print" << "raise" << "return" << "try" << "while" << "with" << "yield";
SyntaxRule rule;
- rule.format.setForeground(Qt::darkBlue);
+ rule.format.setForeground( QColor(settings->value("colors/keyword").toString()) );
rule.format.setFontWeight(QFont::Bold);
for(int i=0; i<keywords.length(); i++){
rule.pattern = QRegExp("\\b"+keywords[i]+"\\b"); //turn each keyword into a QRegExp and insert the rule
@@ -82,16 +104,16 @@ void Custom_Syntax::loadRules(QString type){
//rule.pattern = QRegExp("\\bQ[A-Za-z]+\\b");
//rules << rule;
//Quotes
- rule.format.setForeground(Qt::red);
+ rule.format.setForeground( QColor(settings->value("colors/text").toString()) );
rule.format.setFontWeight(QFont::Normal);
rule.pattern = QRegExp("\".*\"");
rules << rule;
//Functions
- rule.format.setForeground(Qt::blue);
+ rule.format.setForeground( QColor(settings->value("colors/function").toString()) );
rule.pattern = QRegExp("\\b[A-Za-z0-9_]+(?=\\()");
rules << rule;
//Comment (single line)
- rule.format.setForeground(Qt::green);
+ rule.format.setForeground( QColor(settings->value("colors/comment").toString()) );
rule.pattern = QRegExp("#[^\n]*");
rules << rule;
//Comment (multi-line)
@@ -100,5 +122,66 @@ void Custom_Syntax::loadRules(QString type){
//srule.startPattern = QRegExp("/\\*");
//srule.endPattern = QRegExp("\\*/");
//splitrules << srule;
+
+ }else if(type=="reST"){
+ //Keywords
+ QStringList keywords;
+ keywords << "emphasis" << "strong" << "literal" << "subscript" << "superscript" << "title-reference";
+ SyntaxRule rule;
+ rule.format.setForeground( QColor(settings->value("colors/keyword").toString()) );
+ rule.format.setFontWeight(QFont::Bold);
+ for(int i=0; i<keywords.length(); i++){
+ rule.pattern = QRegExp("\\b"+keywords[i]+"\\b"); //turn each keyword into a QRegExp and insert the rule
+ rules << rule;
+ }
+ //Directives
+ /*keywords.clear();
+ keywords << "image" << "figure" << "contents" << "container" << "rubric" << "topic" << "sidebar" \
+ << "parsed-literal" << "epigraph" << "highlights" << "pull-quote" << "compound" << "table" << "csv-table" \
+ << "list-table" << "raw" << "include"<< "class" << "meta" << "title" << "default-role" << "role";
+ rule.format.setForeground( QColor(settings->value("colors/altkeyword").toString()) );
+ for(int i=0; i<keywords.length(); i++){
+ rule.pattern = QRegExp("\\b"+keywords[i]+"::\\b"); //turn each keyword into a QRegExp and insert the rule
+ rules << rule;
+ }*/
+ //Reset the font color
+ // Emphasis
+ /*rule.format = QTextCharFormat();
+ rule.format.setFontItalic(true);
+ rule.pattern = QRegExp("\\b\\**\\*\\b");
+ rules << rule;
+ // Strong Emphasis
+ rule.format.setFontItalic(false);
+ rule.format.setFontWeight(QFont::Bold);
+ rule.pattern = QRegExp("\\b\\*\\**\\*\\*\\b");
+ rules << rule;
+ // Code Sample
+ rule.format.setFontWeight(QFont::Light);
+ rule.format.setFontFixedPitch(true);
+ rule.pattern = QRegExp("\\b\\`\\`*\\`\\`\\b");
+ rules << rule;
+ //Class Names
+ //rule.format.setForeground( QColor(settings->value("colors/class").toString()) );
+ //rule.pattern = QRegExp("\\bQ[A-Za-z]+\\b");
+ //rules << rule;
+ //Quotes
+ rule.format.setForeground( QColor(settings->value("colors/text").toString()) );
+ rule.format.setFontWeight(QFont::Normal);
+ rule.pattern = QRegExp("\".*\"");
+ rules << rule;
+ //Functions
+ rule.format.setForeground( QColor(settings->value("colors/function").toString()) );
+ rule.pattern = QRegExp("\\b[A-Za-z0-9_]+(?=\\()");
+ rules << rule;*/
+ //Comment (single line)
+ //rule.format.setForeground( QColor(settings->value("colors/comment").toString()) );
+ //rule.pattern = QRegExp("\\b\\.\\.\\ [^\n]*");
+ //rules << rule;
+ //Comment (multi-line)
+ //SyntaxRuleSplit srule;
+ //srule.format = rule.format; //re-use the single-line comment format
+ //srule.startPattern = QRegExp("/\\*");
+ //srule.endPattern = QRegExp("\\*/");
+ //splitrules << srule;
}
} \ No newline at end of file
diff --git a/desktop-utilities/lumina-textedit/syntaxSupport.h b/desktop-utilities/lumina-textedit/syntaxSupport.h
index a4f36822..e258aafe 100644
--- a/desktop-utilities/lumina-textedit/syntaxSupport.h
+++ b/desktop-utilities/lumina-textedit/syntaxSupport.h
@@ -11,6 +11,7 @@
#include <QTextDocument>
#include <QTextCharFormat>
#include <QString>
+#include <QSettings>
//Simple syntax rules
struct SyntaxRule{
@@ -26,15 +27,19 @@ struct SyntaxRuleSplit{
class Custom_Syntax : public QSyntaxHighlighter{
Q_OBJECT
private:
+ QSettings *settings;
QVector<SyntaxRule> rules;
QVector<SyntaxRuleSplit> splitrules;
public:
- Custom_Syntax(QTextDocument *parent = 0) : QSyntaxHighlighter(parent){
+ Custom_Syntax(QSettings *set, QTextDocument *parent = 0) : QSyntaxHighlighter(parent){
+ settings = set;
}
~Custom_Syntax(){}
static QStringList availableRules();
+ static QStringList knownColors();
+ static void SetupDefaultColors(QSettings *settings);
static QString ruleForFile(QString filename);
void loadRules(QString type);
protected:
bgstack15