aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen Moore <ken@ixsystems.com>2018-05-21 15:23:07 -0400
committerKen Moore <ken@ixsystems.com>2018-05-21 15:23:07 -0400
commitebe83b1f96ca2df76d0d7e41e853911625c9c25f (patch)
tree688bd68a8ac27b0d83aec9c464fc13917f38f165
parentCouple quick updates to lumina-textedit: (diff)
downloadlumina-ebe83b1f96ca2df76d0d7e41e853911625c9c25f.tar.gz
lumina-ebe83b1f96ca2df76d0d7e41e853911625c9c25f.tar.bz2
lumina-ebe83b1f96ca2df76d0d7e41e853911625c9c25f.zip
A couple more cleanup operations for lumina textedit
Main change being that when opening the file select dialog it will automatically re-highlight the current file.
-rw-r--r--src-qt5/desktop-utils/lumina-textedit/ColorDialog.h8
-rw-r--r--src-qt5/desktop-utils/lumina-textedit/MainUI.cpp9
-rw-r--r--src-qt5/desktop-utils/lumina-textedit/MainUI.h1
-rw-r--r--src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.cpp7
4 files changed, 17 insertions, 8 deletions
diff --git a/src-qt5/desktop-utils/lumina-textedit/ColorDialog.h b/src-qt5/desktop-utils/lumina-textedit/ColorDialog.h
index 2cddd7cf..0608e381 100644
--- a/src-qt5/desktop-utils/lumina-textedit/ColorDialog.h
+++ b/src-qt5/desktop-utils/lumina-textedit/ColorDialog.h
@@ -25,9 +25,9 @@ private:
public:
ColorDialog(QSettings *set, QWidget *parent);
~ColorDialog(){}
-
+
void LoadColors();
-
+
public slots:
void updateIcons();
@@ -44,5 +44,5 @@ protected:
this->hide();
}
};
-
-#endif \ No newline at end of file
+
+#endif
diff --git a/src-qt5/desktop-utils/lumina-textedit/MainUI.cpp b/src-qt5/desktop-utils/lumina-textedit/MainUI.cpp
index 50b83ee8..71c4d173 100644
--- a/src-qt5/desktop-utils/lumina-textedit/MainUI.cpp
+++ b/src-qt5/desktop-utils/lumina-textedit/MainUI.cpp
@@ -194,6 +194,13 @@ PlainTextEditor* MainUI::currentEditor(){
return static_cast<PlainTextEditor*>( tabWidget->currentWidget() );
}
+QString MainUI::currentFile(){
+ PlainTextEditor* cur = currentEditor();
+ if(cur!=0){
+ return cur->currentFile();
+ }
+ return "";
+}
QString MainUI::currentFileDir(){
PlainTextEditor* cur = currentEditor();
QString dir;
@@ -228,7 +235,7 @@ void MainUI::OpenFile(QString file){
QStringList files;
if(file.isEmpty()){
//Prompt for a file to open
- files = QFileDialog::getOpenFileNames(this, tr("Open File(s)"), currentFileDir(), tr("Text Files (*)") );
+ files = QFileDialog::getOpenFileNames(this, tr("Open File(s)"), currentFile(), tr("Text Files (*)") );
if(files.isEmpty()){ return; } //cancelled
}else{
files << file;
diff --git a/src-qt5/desktop-utils/lumina-textedit/MainUI.h b/src-qt5/desktop-utils/lumina-textedit/MainUI.h
index c9c4e534..600cd917 100644
--- a/src-qt5/desktop-utils/lumina-textedit/MainUI.h
+++ b/src-qt5/desktop-utils/lumina-textedit/MainUI.h
@@ -46,6 +46,7 @@ private:
//Simplification functions
PlainTextEditor* currentEditor();
+ QString currentFile();
QString currentFileDir();
QStringList unsavedFiles();
diff --git a/src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.cpp b/src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.cpp
index f96efef1..69dc2eab 100644
--- a/src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.cpp
+++ b/src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.cpp
@@ -53,21 +53,22 @@ void PlainTextEditor::showLineNumbers(bool show){
}
void PlainTextEditor::LoadSyntaxRule(QString type){
- qDebug() << "Load SyntaxRule";
+ //qDebug() << "Load SyntaxRule";
QList<SyntaxFile> files = SyntaxFile::availableFiles(settings);
for(int i=0; i<files.length(); i++){
if(files[i].name() == type){
files[i].SetupDocument(this);
SYNTAX->loadRules(files[i]);
break;
+ }else if(i==files.length()-1){
+ SyntaxFile dummy; SYNTAX->loadRules(dummy);
}
- if(i==files.length()-1){ SyntaxFile dummy; SYNTAX->loadRules(dummy); }
}
SYNTAX->rehighlight();
}
void PlainTextEditor::updateSyntaxColors(){
- qDebug() << "Update Syntax Colors";
+ //qDebug() << "Update Syntax Colors";
SYNTAX->reloadRules();
SYNTAX->rehighlight();
}
bgstack15