diff options
author | Ken Moore <ken@ixsystems.com> | 2018-08-16 08:16:54 -0400 |
---|---|---|
committer | Ken Moore <ken@ixsystems.com> | 2018-08-16 08:19:13 -0400 |
commit | aaa7241a3fc617d97663f87bc155d65fcb864ae6 (patch) | |
tree | e602701c61b0cf1f83e33a994db65ba481df0dee /src-qt5/desktop-utils | |
parent | Chase even more port flavor changes in FreeBSD.... (diff) | |
download | lumina-aaa7241a3fc617d97663f87bc155d65fcb864ae6.tar.gz lumina-aaa7241a3fc617d97663f87bc155d65fcb864ae6.tar.bz2 lumina-aaa7241a3fc617d97663f87bc155d65fcb864ae6.zip |
De-activate all the hunspell integrations in lumina-text-editor.
They do not work (crash as soon as calling the hunspell library).
The hunspell functions are just commented out at the moment so that the library is not needed for the build until such time as the hunspell integration works.
Diffstat (limited to 'src-qt5/desktop-utils')
5 files changed, 46 insertions, 35 deletions
diff --git a/src-qt5/desktop-utils/lumina-textedit/MainUI.cpp b/src-qt5/desktop-utils/lumina-textedit/MainUI.cpp index bc08e521..298fedde 100644 --- a/src-qt5/desktop-utils/lumina-textedit/MainUI.cpp +++ b/src-qt5/desktop-utils/lumina-textedit/MainUI.cpp @@ -277,7 +277,7 @@ void MainUI::OpenFile(QString file){ edit->document()->setDefaultFont(font); /*QStringList applicationDirs = LXDG::systemApplicationDirs();*/ if(ui->actionEnable_Spellcheck->isChecked()) { - QStringList dirs = QString(getenv("XDG_DATA_DIRS")).split(":"); + /*QStringList dirs = QString(getenv("XDG_DATA_DIRS")).split(":"); foreach(QString dir, dirs) { if(QDir(dir).exists("hunspell")) { //Default to US English Dictionary @@ -285,7 +285,7 @@ void MainUI::OpenFile(QString file){ hunspell = new Hunspell(QString(hunspellPath + "en_US.aff").toLocal8Bit(), QString(hunspellPath + "en_US.dic").toLocal8Bit()); edit->setDictionary(hunspell); } - } + }*/ } } tabWidget->setCurrentWidget(edit); @@ -413,7 +413,7 @@ void MainUI::ModifyColors(){ } void MainUI::SetLanguage() { - QDir dir(hunspellPath); + /*QDir dir(hunspellPath); QStringList files = dir.entryList(QStringList() << "*.dic", QDir::Files); QStringList items; int defaultDic = 0; @@ -431,7 +431,7 @@ void MainUI::SetLanguage() { hunspell = new Hunspell(QString(hunspellPath+dic+".aff").toLocal8Bit(), QString(hunspellPath+dic+".dic").toLocal8Bit()); - checkSpelling(-1); + checkSpelling(-1);*/ } void MainUI::showPopupWarnings(bool show){ @@ -439,13 +439,13 @@ void MainUI::showPopupWarnings(bool show){ } void MainUI::enableSpellcheck(bool show){ - qDebug() << "Enabling Spellcheck"; + /*qDebug() << "Enabling Spellcheck"; settings->setValue("enableSpellcheck",show); if(currentEditor() != NULL and hunspell == NULL) { - /*QStringList applicationDirs = LXDG::systemApplicationDirs();*/ + //QStringList applicationDirs = LXDG::systemApplicationDirs(); hunspell = new Hunspell(QString(hunspellPath + "en_US.aff").toLocal8Bit(), QString(hunspellPath + "en_US.dic").toLocal8Bit()); qDebug() << "Hunspell Created"; - } + }*/ } void MainUI::showToolbar(bool show){ @@ -621,22 +621,30 @@ PlainTextEditor *cur = currentEditor(); } void MainUI::checkWord(QTextBlock block) { - PlainTextEditor *cur = currentEditor(); + /*PlainTextEditor *cur = currentEditor(); if(cur==0){ return; } + if(block.text().simplified().isEmpty()){ return; } foreach(Word *word, wordList) { - if(word->blockNum == block.blockNumber()) + if(word->blockNum == block.blockNumber()){ + qDebug() << "Remove Word"; wordList.removeOne(word); + } } QStringList words = block.text().split(QRegExp("\\W+")); + qDebug() << "Got Words:" << words; QTextCursor cursor(block); foreach(QString word, words) { + qDebug() << "Check Word:" << word; if(!hunspell->spell(word.toStdString())) { - QList<QString> suggestions; - foreach(std::string newWord, hunspell->suggest(word.toStdString())) + qDebug() << "Not a word"; + QStringList suggestions; + foreach(std::string newWord, hunspell->suggest(word.toStdString())){ suggestions.append(QString::fromStdString(newWord)); + } + qDebug() << "Got Suggestions:" << suggestions; QTextEdit::ExtraSelection sel; sel.format.setBackground(QColor("Red")); sel.cursor = cur->document()->find(word, cursor.position()); @@ -644,27 +652,31 @@ void MainUI::checkWord(QTextBlock block) { wordList.append(wordC); } cursor.movePosition(QTextCursor::NextWord, QTextCursor::MoveAnchor); - } + }*/ } void MainUI::checkSpelling(int bpos, int epos) { - //qDebug() << "Checking spelling on"; + qDebug() << "Checking spelling on" << bpos << epos; PlainTextEditor *cur = currentEditor(); if(cur==0){ return; } static int numBlocks = cur->blockCount(); - - if(bpos == -1 or numBlocks != cur->blockCount()) { //When opening a file or loading a new dictionary - for(QTextBlock block = cur->document()->begin(); block != cur->document()->end(); block = block.next()) + //qDebug() << " - numblocks:" << numBlocks; + if(bpos == -1 || numBlocks != cur->blockCount()) { //When opening a file or loading a new dictionary + for(QTextBlock block = cur->document()->begin(); block != cur->document()->end(); block = block.next()){ + //qDebug() << " - Check Block:" << block.text(); checkWord(block); + } numBlocks = cur->blockCount(); }else if(epos == -1){ //Normal checking of one block from typing QTextBlock block = cur->document()->findBlock(bpos); + //qDebug() << " - Check Block:" << block.text(); checkWord(block); }else { //Check blocks after copy/paste for(QTextBlock block = cur->document()->findBlock(0); block != cur->document()->findBlock(epos); block = block.next()) { checkWord(block); } } + //qDebug() << " - set Word List:" << wordList; cur->setWordList(wordList); } diff --git a/src-qt5/desktop-utils/lumina-textedit/MainUI.h b/src-qt5/desktop-utils/lumina-textedit/MainUI.h index 90222cb3..38a742dd 100644 --- a/src-qt5/desktop-utils/lumina-textedit/MainUI.h +++ b/src-qt5/desktop-utils/lumina-textedit/MainUI.h @@ -21,7 +21,7 @@ #include "DnDTabBar.h" #include "Word.h" -#include <hunspell/hunspell.hxx> +//#include <hunspell/hunspell.hxx> namespace Ui{ class MainUI; @@ -46,16 +46,16 @@ private: QShortcut *closeFindS, *nextTabS, *prevTabS; QSpinBox *fontSizes; QAction *label_readonly; - Hunspell *hunspell; - QList<Word*> wordList; - QString hunspellPath; + //Hunspell *hunspell; + QList<Word*> wordList; + QString hunspellPath; //Simplification functions PlainTextEditor* currentEditor(); - QString currentFile(); + QString currentFile(); QString currentFileDir(); QStringList unsavedFiles(); - void checkWord(QTextBlock); + void checkWord(QTextBlock); private slots: //Main Actions @@ -70,8 +70,8 @@ private slots: void updateStatusTip(); void changeFontSize(int newFontSize); void changeTabsLocation(QAction*); - void checkSpelling(int bpos, int epos = -1); - void SetLanguage(); + void checkSpelling(int bpos, int epos = -1); + void SetLanguage(); //Other Menu Actions void UpdateHighlighting(QAction *act = 0); @@ -88,8 +88,8 @@ private slots: void tabClosed(int); void tabDetached(int); void tabDraggedOut(int, Qt::DropAction); - void nextTab(); - void prevTab(); + void nextTab(); + void prevTab(); //Find/Replace functions void closeFindReplace(); diff --git a/src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.cpp b/src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.cpp index d1f29974..07b99f27 100644 --- a/src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.cpp +++ b/src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.cpp @@ -291,7 +291,6 @@ void PlainTextEditor::LNW_updateWidth(){ void PlainTextEditor::LNW_highlightLine(){ QList<QTextEdit::ExtraSelection> sels; - foreach(Word *word, wordList) { sels.append(word->sel); }; if(this->isReadOnly()){ return; } QColor highC = QColor(0,0,0,50); //just darken the line a bit diff --git a/src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.h b/src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.h index 8ca8037d..8f174d4b 100644 --- a/src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.h +++ b/src-qt5/desktop-utils/lumina-textedit/PlainTextEditor.h @@ -13,7 +13,7 @@ #include <QPaintEvent> #include <QFileSystemWatcher> -#include <hunspell/hunspell.hxx> +//#include <hunspell/hunspell.hxx> #include "syntaxSupport.h" #include "Word.h" @@ -34,7 +34,7 @@ public: void LoadFile(QString filepath); bool SaveFile(bool newname = false); QString currentFile(); - Word *wordAtPosition(int, int); + Word *wordAtPosition(int, int); bool hasChange(); bool readOnlyFile(); @@ -43,10 +43,10 @@ public: int LNWWidth(); //replacing the LNW size hint detection void paintLNW(QPaintEvent *ev); //forwarded from the LNW paint event void updateLNW(); - void setWordList(QList<Word*> _wordList) { wordList = _wordList; } - void setDictionary(Hunspell *_hunspell) { hunspell = _hunspell; } + void setWordList(QList<Word*> _wordList) { wordList = _wordList; } + //void setDictionary(Hunspell *_hunspell) { hunspell = _hunspell; } - QFontMetrics *metrics; + QFontMetrics *metrics; private: QWidget *LNW; //Line Number Widget @@ -54,10 +54,10 @@ private: QSettings *settings; QString lastSaveContents; QFileSystemWatcher *watcher; - QList<Word*> wordList; + QList<Word*> wordList; //Syntax Highlighting class Custom_Syntax *SYNTAX; - Hunspell *hunspell; + //Hunspell *hunspell; //Bracket/Perentheses matching functions int matchleft, matchright; //positions within the document diff --git a/src-qt5/desktop-utils/lumina-textedit/lumina-textedit.pro b/src-qt5/desktop-utils/lumina-textedit/lumina-textedit.pro index 5ebbd9d0..a69fc0c2 100644 --- a/src-qt5/desktop-utils/lumina-textedit/lumina-textedit.pro +++ b/src-qt5/desktop-utils/lumina-textedit/lumina-textedit.pro @@ -27,7 +27,7 @@ SOURCES += main.cpp \ FORMS += MainUI.ui \ ColorDialog.ui -LIBS += -lhunspell-1.6 +#LIBS += -lhunspell-1.6 TRANSLATIONS = i18n/l-te_af.ts \ i18n/l-te_ar.ts \ |