From ebe83b1f96ca2df76d0d7e41e853911625c9c25f Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Mon, 21 May 2018 15:23:07 -0400 Subject: 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. --- src-qt5/desktop-utils/lumina-textedit/ColorDialog.h | 8 ++++---- src-qt5/desktop-utils/lumina-textedit/MainUI.cpp | 9 ++++++++- src-qt5/desktop-utils/lumina-textedit/MainUI.h | 1 + src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.cpp | 7 ++++--- 4 files changed, 17 insertions(+), 8 deletions(-) (limited to 'src-qt5/desktop-utils/lumina-textedit') 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( 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 files = SyntaxFile::availableFiles(settings); for(int i=0; iloadRules(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(); } -- cgit