21 ** If you have questions regarding the use of this file, please contact |
21 ** If you have questions regarding the use of this file, please contact |
22 ** Nokia at developer.feedback@nokia.com. |
22 ** Nokia at developer.feedback@nokia.com. |
23 ** |
23 ** |
24 ****************************************************************************/ |
24 ****************************************************************************/ |
25 |
25 |
26 #ifndef HB_PREDICTION_ENGINE_H |
26 #ifndef HB_INPUT_PREDICTION_ENGINE_H |
27 #define HB_PREDICTION_ENGINE_H |
27 #define HB_INPUT_PREDICTION_ENGINE_H |
28 |
28 |
29 #include <QStringList> |
29 #include <QStringList> |
30 #include <QKeyEvent> |
30 #include <QKeyEvent> |
31 |
31 |
32 #include <hbinputlanguage.h> |
32 #include <hbinputlanguage.h> |
72 protected: |
72 protected: |
73 HbPredictionBase(); |
73 HbPredictionBase(); |
74 |
74 |
75 public: |
75 public: |
76 virtual QList<HbInputLanguage> languages() const = 0; |
76 virtual QList<HbInputLanguage> languages() const = 0; |
77 virtual void setWord(const QString& word, HbPredictionCallback* callback = 0) = 0; |
77 virtual void setWord(const QString &word, HbPredictionCallback *callback = 0) = 0; |
78 virtual void updateCandidates(int& bestGuessLocation, bool& noMoreCandidates) = 0; |
78 virtual void updateCandidates(int &bestGuessLocation, bool &noMoreCandidates) = 0; |
79 virtual bool updateCandidates(int& bestGuessLocation) = 0; |
79 virtual bool updateCandidates(int &bestGuessLocation) = 0; |
80 virtual void appendKeyPress(const int keycode, const Qt::KeyboardModifiers modifiers, const HbTextCase textCase = HbTextCaseNone, HbPredictionCallback* callback = 0) = 0; |
80 virtual void appendKeyPress(const int keycode, const Qt::KeyboardModifiers modifiers, const HbTextCase textCase = HbTextCaseNone, HbPredictionCallback *callback = 0) = 0; |
81 virtual void deleteKeyPress(HbPredictionCallback* callback = 0) = 0; |
81 virtual void deleteKeyPress(HbPredictionCallback *callback = 0) = 0; |
82 virtual void commit(const QString &word = QString()) = 0; |
82 virtual void commit(const QString &word = QString()) = 0; |
83 virtual void clear() = 0; |
83 virtual void clear() = 0; |
84 virtual void addUsedWord(const QString& word) = 0; |
84 virtual void addUsedWord(const QString &word) = 0; |
85 virtual HbInputPredictionFeature features() const = 0; |
85 virtual HbInputPredictionFeature features() const = 0; |
86 virtual QString vendorIdString() const = 0; |
86 virtual QString vendorIdString() const = 0; |
87 virtual QString engineVersion() const = 0; |
87 virtual QString engineVersion() const = 0; |
88 virtual bool supportsKeyboardType(const HbInputLanguage& language, HbKeyboardType keyboard) const = 0; |
88 virtual bool supportsKeyboardType(const HbInputLanguage &language, HbKeyboardType keyboard) const = 0; |
89 |
89 |
90 virtual HbUserDictionary* userDictionary() const; |
90 virtual HbUserDictionary *userDictionary() const; |
91 virtual void setExtraUserDictionary(int id); |
91 virtual void setExtraUserDictionary(int id); |
92 virtual void setExtraUserDictionaries(const QList<int>& idList); |
92 virtual void setExtraUserDictionaries(const QList<int>& idList); |
93 virtual bool setLanguage(const HbInputLanguage &language, HbInputModeType inputMode = HbInputModeNone); |
93 virtual bool setLanguage(const HbInputLanguage &language, HbInputModeType inputMode = HbInputModeNone); |
94 virtual HbInputLanguage language() const; |
94 virtual HbInputLanguage language() const; |
95 virtual void setKeyboard(HbKeyboardType keyboardType) = 0; |
95 virtual void setKeyboard(HbKeyboardType keyboardType) = 0; |
109 HbErrorCorrectionLevelMedium, |
109 HbErrorCorrectionLevelMedium, |
110 HbErrorCorrectionLevelHigh |
110 HbErrorCorrectionLevelHigh |
111 }; |
111 }; |
112 |
112 |
113 public: |
113 public: |
114 virtual void setCandidateList(QStringList* candidateList) = 0; |
114 virtual void setCandidateList(QStringList *candidateList) = 0; |
115 virtual QStringList candidateList() = 0; |
115 virtual QStringList candidateList() = 0; |
116 virtual QStringList candidates() = 0; |
116 virtual QStringList candidates() = 0; |
117 virtual int inputLength() = 0; |
117 virtual int inputLength() = 0; |
118 virtual void appendCharacter(const QChar character, const HbTextCase textCase = HbTextCaseNone, HbPredictionCallback* callback = 0) = 0; |
118 virtual void appendCharacter(const QChar character, const HbTextCase textCase = HbTextCaseNone, HbPredictionCallback *callback = 0) = 0; |
119 |
119 |
120 virtual QStringList nextWordCandidateList(HbPredictionCallback* callback = 0); |
120 virtual QStringList nextWordCandidateList(HbPredictionCallback *callback = 0); |
121 virtual bool setErrorCorrectionLevel(HbErrorCorrectionLevel level); |
121 virtual bool setErrorCorrectionLevel(HbErrorCorrectionLevel level); |
122 virtual HbErrorCorrectionLevel errorCorrectionLevel() const; |
122 virtual HbErrorCorrectionLevel errorCorrectionLevel() const; |
123 virtual bool setSecondaryLanguage(const HbInputLanguage& language); |
123 virtual bool setSecondaryLanguage(const HbInputLanguage &language); |
124 virtual HbInputLanguage secondaryLanguage() const; |
124 virtual HbInputLanguage secondaryLanguage() const; |
125 virtual QString currentWord() const; |
125 virtual QString currentWord() const; |
126 virtual bool enableFeature(HbInputPredictionFeature feature); |
126 virtual bool enableFeature(HbInputPredictionFeature feature); |
127 virtual bool isFeatureEnabled(HbInputPredictionFeature feature); |
127 virtual bool isFeatureEnabled(HbInputPredictionFeature feature); |
128 virtual bool disableFeature(HbInputPredictionFeature feature); |
128 virtual bool disableFeature(HbInputPredictionFeature feature); |
140 virtual QStringList allSpellings() = 0; |
140 virtual QStringList allSpellings() = 0; |
141 virtual int spellingCount() const = 0; |
141 virtual int spellingCount() const = 0; |
142 |
142 |
143 virtual QStringList getCandidates(int startIndex, int count) = 0; |
143 virtual QStringList getCandidates(int startIndex, int count) = 0; |
144 virtual bool selectCandidate(int index) = 0; |
144 virtual bool selectCandidate(int index) = 0; |
145 virtual bool selectCandidate(const QString& candidate) = 0; |
145 virtual bool selectCandidate(const QString &candidate) = 0; |
146 virtual bool candidateExist(int index) = 0; |
146 virtual bool candidateExist(int index) = 0; |
147 |
147 |
148 virtual bool pressKey(const int keycode, const Qt::KeyboardModifiers modifiers, const int textCase = 0) = 0; |
148 virtual bool pressKey(const int keycode, const Qt::KeyboardModifiers modifiers, const int textCase = 0) = 0; |
149 virtual bool isInputModeSupported(HbInputModeType imMode) = 0; |
149 virtual bool isInputModeSupported(HbInputModeType imMode) = 0; |
150 // used for hwr engine |
150 // used for hwr engine |
151 virtual bool addStroke(const QList<QPointF>& traceData) = 0; |
151 virtual bool addStroke(const QList<QPointF>& traceData) = 0; |
152 virtual bool inlineSpelling(int idx, QString &out) = 0; |
152 virtual bool inlineSpelling(int idx, QString &out) = 0; |
153 }; |
153 }; |
154 |
154 |
155 #endif // HB_PREDICTION_ENGINE |
155 #endif // HB_INPUT_PREDICTION_ENGINE_H |
156 |
156 |
157 // End of file |
157 // End of file |