summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI/QtTextEdit.h')
-rw-r--r--Swift/QtUI/QtTextEdit.h95
1 files changed, 50 insertions, 45 deletions
diff --git a/Swift/QtUI/QtTextEdit.h b/Swift/QtUI/QtTextEdit.h
index 67826ba..228aa9e 100644
--- a/Swift/QtUI/QtTextEdit.h
+++ b/Swift/QtUI/QtTextEdit.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010-2015 Isode Limited.
+ * Copyright (c) 2010-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -9,7 +9,6 @@
#include <QPointer>
#include <QTextEdit>
-#include <Swift/Controllers/SettingConstants.h>
#include <Swift/Controllers/Settings/SettingsProvider.h>
#include <SwifTools/SpellParser.h>
@@ -17,47 +16,53 @@
#include <Swift/QtUI/QtSpellCheckHighlighter.h>
namespace Swift {
- class SpellChecker;
- class QtSpellCheckerWindow;
-
- class QtTextEdit : public QTextEdit {
- Q_OBJECT
- public:
- QtTextEdit(SettingsProvider* settings, QWidget* parent = 0);
- virtual ~QtTextEdit();
- virtual QSize sizeHint() const;
-
- signals:
- void wordCorrected(QString& word);
- void returnPressed();
- void unhandledKeyPressEvent(QKeyEvent* event);
- void receivedFocus();
- void lostFocus();
-
- public slots:
- void handleSettingChanged(const std::string& settings);
-
- protected:
- virtual void keyPressEvent(QKeyEvent* event);
- virtual void focusInEvent(QFocusEvent* event);
- virtual void focusOutEvent(QFocusEvent* event);
- virtual void contextMenuEvent(QContextMenuEvent* event);
-
- private slots:
- void handleTextChanged();
-
- private:
- void addSuggestions(QMenu* menu, QContextMenuEvent* event);
- void replaceMisspelledWord(const QString& word, int cursorPosition);
- void setUpSpellChecker();
- void spellCheckerSettingsWindow();
- PositionPair getWordFromCursor(int cursorPosition);
-
- private:
- SpellChecker* checker_;
- QtSpellCheckHighlighter* highlighter_;
- std::vector<QAction*> replaceWordActions_;
- SettingsProvider* settings_;
- QPointer<QtSpellCheckerWindow> spellCheckerWindow_;
- };
+ class SpellChecker;
+ class QtSpellCheckerWindow;
+
+ class QtTextEdit : public QTextEdit {
+ Q_OBJECT
+ public:
+ QtTextEdit(SettingsProvider* settings, QWidget* parent = nullptr);
+ virtual ~QtTextEdit();
+ virtual QSize sizeHint() const;
+
+ void setEmphasiseFocus(bool emphasise);
+ void setCorrectionHighlight(bool coorectionHighlight);
+
+ signals:
+ void wordCorrected(QString& word);
+ void returnPressed();
+ void unhandledKeyPressEvent(QKeyEvent* event);
+ void receivedFocus();
+ void lostFocus();
+
+ public slots:
+ void handleSettingChanged(const std::string& settings);
+
+ protected:
+ virtual void keyPressEvent(QKeyEvent* event);
+ virtual void focusInEvent(QFocusEvent* event);
+ virtual void focusOutEvent(QFocusEvent* event);
+ virtual void contextMenuEvent(QContextMenuEvent* event);
+
+ private slots:
+ void handleTextChanged();
+
+ private:
+ void addSuggestions(QMenu* menu, QContextMenuEvent* event);
+ void replaceMisspelledWord(const QString& word, int cursorPosition);
+ void setUpSpellChecker();
+ void spellCheckerSettingsWindow();
+ PositionPair getWordFromCursor(int cursorPosition);
+ void updateStyleSheet();
+
+ private:
+ SpellChecker* checker_;
+ QtSpellCheckHighlighter* highlighter_;
+ std::vector<QAction*> replaceWordActions_;
+ SettingsProvider* settings_;
+ QPointer<QtSpellCheckerWindow> spellCheckerWindow_;
+ bool emphasiseFocus_ = false;
+ bool correctionHighlight_ = false;
+ };
}