56 enum HbPredictionInterfaceTypeFlag { |
56 enum HbPredictionInterfaceTypeFlag { |
57 HbPredInterfaceNone = 0x00000000, |
57 HbPredInterfaceNone = 0x00000000, |
58 HbPredInterfaceLatinBased = 0x00000001, |
58 HbPredInterfaceLatinBased = 0x00000001, |
59 HbPredInterfaceChinese = 0x00000002, |
59 HbPredInterfaceChinese = 0x00000002, |
60 HbPredInterfaceJapanese = 0x00000004, |
60 HbPredInterfaceJapanese = 0x00000004, |
61 HbPredInterfaceHidden = 0x00000008 /**< The engine is exluded from factory queries and must be instantiated directly */ |
61 HbPredInterfaceHidden = 0x00000008 /**< The engine is excluded from factory queries and must be instantiated directly */ |
62 }; |
62 }; |
63 |
63 |
64 Q_DECLARE_FLAGS(HbPredictionInterfaceType, HbPredictionInterfaceTypeFlag) |
64 Q_DECLARE_FLAGS(HbPredictionInterfaceType, HbPredictionInterfaceTypeFlag) |
65 |
65 |
66 |
66 |
67 class HB_CORE_EXPORT HbPredictionBase |
67 class HB_CORE_EXPORT HbPredictionBase |
68 { |
68 { |
69 public: |
69 public: |
70 virtual ~HbPredictionBase(); |
70 virtual ~HbPredictionBase(); |
71 |
71 |
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 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; |
80 virtual void deleteKeyPress(HbPredictionCallback* callback = 0) = 0; |
81 virtual void deleteKeyPress(HbPredictionCallback* callback = 0) = 0; |
81 virtual void commit(const QString &word = QString()) = 0; |
82 virtual void commit(const QString &word = QString()) = 0; |
82 virtual void clear() = 0; |
83 virtual void clear() = 0; |
83 virtual void addUsedWord(const QString& word) = 0; |
84 virtual void addUsedWord(const QString& word) = 0; |
98 |
99 |
99 class HB_CORE_EXPORT HbPredictionEngine : public HbPredictionBase |
100 class HB_CORE_EXPORT HbPredictionEngine : public HbPredictionBase |
100 { |
101 { |
101 public: |
102 public: |
102 /*! |
103 /*! |
103 Specifies error correction levels. |
104 Specifies error correction levels. |
104 */ |
105 */ |
105 enum HbErrorCorrectionLevel { |
106 enum HbErrorCorrectionLevel { |
106 HbErrorCorrectionLevelNone = 0, |
107 HbErrorCorrectionLevelNone = 0, |
107 HbErrorCorrectionLevelLow, |
108 HbErrorCorrectionLevelLow, |
108 HbErrorCorrectionLevelMedium, |
109 HbErrorCorrectionLevelMedium, |
110 }; |
111 }; |
111 |
112 |
112 public: |
113 public: |
113 virtual void setCandidateList(QStringList* candidateList) = 0; |
114 virtual void setCandidateList(QStringList* candidateList) = 0; |
114 virtual QStringList candidateList() = 0; |
115 virtual QStringList candidateList() = 0; |
|
116 virtual QStringList candidates() = 0; |
115 virtual int inputLength() = 0; |
117 virtual int inputLength() = 0; |
116 virtual void appendCharacter(const QChar aChar, const HbTextCase textCase = HbTextCaseNone, HbPredictionCallback* callback = 0) = 0; |
118 virtual void appendCharacter(const QChar character, const HbTextCase textCase = HbTextCaseNone, HbPredictionCallback* callback = 0) = 0; |
117 |
119 |
118 virtual QStringList nextWordCandidateList(HbPredictionCallback* callback = 0); |
120 virtual QStringList nextWordCandidateList(HbPredictionCallback* callback = 0); |
119 virtual bool setErrorCorrectionLevel(HbErrorCorrectionLevel level); |
121 virtual bool setErrorCorrectionLevel(HbErrorCorrectionLevel level); |
120 virtual HbErrorCorrectionLevel errorCorrectionLevel() const; |
122 virtual HbErrorCorrectionLevel errorCorrectionLevel() const; |
121 virtual bool setSecondaryLanguage(const HbInputLanguage& language); |
123 virtual bool setSecondaryLanguage(const HbInputLanguage& language); |
138 virtual QStringList allSpellings() = 0; |
140 virtual QStringList allSpellings() = 0; |
139 virtual int spellingCount() const = 0; |
141 virtual int spellingCount() const = 0; |
140 |
142 |
141 virtual QStringList getCandidates(int startIndex, int count) = 0; |
143 virtual QStringList getCandidates(int startIndex, int count) = 0; |
142 virtual bool selectCandidate(int index) = 0; |
144 virtual bool selectCandidate(int index) = 0; |
143 virtual bool selectCandidate(const QString& candidate) = 0; |
145 virtual bool selectCandidate(const QString& candidate) = 0; |
144 virtual bool candidateExist(int index) = 0; |
146 virtual bool candidateExist(int index) = 0; |
145 |
147 |
146 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; |
147 virtual bool isInputModeSupported(HbInputModeType imMode) = 0; |
149 virtual bool isInputModeSupported(HbInputModeType imMode) = 0; |
148 // used for hwr engine |
150 // used for hwr engine |