diff options
author | Vlad Voicu <vladvoic@gmail.com> | 2011-11-28 16:37:32 (GMT) |
---|---|---|
committer | Vlad Voicu <vladvoic@gmail.com> | 2013-03-15 09:21:52 (GMT) |
commit | 2061b06eccca67595c50edd81c44c5b961bf108b (patch) | |
tree | 7fdc9e4cc80a9d8ddbe5364a531ef3449f72ab2b /Swift/QtUI/QtTextEdit.h | |
parent | a069a0df0f51a948a86e34d99f952a33eecd97ba (diff) | |
download | swift-2061b06eccca67595c50edd81c44c5b961bf108b.zip swift-2061b06eccca67595c50edd81c44c5b961bf108b.tar.bz2 |
Spell checker implementation using Hunspell
Change-Id: Ia15b6532edf6eef7c45bdfb273e77f65ce998f13
License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details
Diffstat (limited to 'Swift/QtUI/QtTextEdit.h')
-rw-r--r-- | Swift/QtUI/QtTextEdit.h | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/Swift/QtUI/QtTextEdit.h b/Swift/QtUI/QtTextEdit.h index 075728b..a8df4d3 100644 --- a/Swift/QtUI/QtTextEdit.h +++ b/Swift/QtUI/QtTextEdit.h @@ -5,20 +5,46 @@ */ #pragma once + +#include <SwifTools/SpellParser.h> + +#include <Swift/Controllers/Settings/SettingsProvider.h> +#include <Swift/Controllers/SettingConstants.h> + #include <QTextEdit> +#include <QPointer> namespace Swift { + class SpellChecker; + class QtSpellCheckerWindow; class QtTextEdit : public QTextEdit { Q_OBJECT public: - QtTextEdit(QWidget* parent = 0); + QtTextEdit(SettingsProvider* settings, QWidget* parent = 0); + virtual ~QtTextEdit(); virtual QSize sizeHint() const; signals: + void wordCorrected(QString& word); void returnPressed(); void unhandledKeyPressEvent(QKeyEvent* event); + public slots: + void handleSettingChanged(const std::string& settings); protected: virtual void keyPressEvent(QKeyEvent* event); + virtual void contextMenuEvent(QContextMenuEvent* event); private slots: void handleTextChanged(); + private: + SpellChecker *checker_; + std::vector<QAction*> replaceWordActions_; + PositionPairList misspelledPositions_; + SettingsProvider *settings_; + QPointer<QtSpellCheckerWindow> spellCheckerWindow_; + void addSuggestions(QMenu* menu, QContextMenuEvent* event); + void replaceMisspelledWord(const QString& word, int cursorPosition); + void setUpSpellChecker(); + void underlineMisspells(); + void spellCheckerSettingsWindow(); + PositionPair getWordFromCursor(int cursorPosition); }; } |