56 #include <hbinputcommondialogs.h> |
53 #include <hbinputcommondialogs.h> |
57 #include <hbinputkeymap.h> |
54 #include <hbinputkeymap.h> |
58 #include <hbinputkeymapfactory.h> |
55 #include <hbinputkeymapfactory.h> |
59 #include <hbwidgetfeedback.h> |
56 #include <hbwidgetfeedback.h> |
60 #include <hbinputpredictionfactory.h> |
57 #include <hbinputpredictionfactory.h> |
|
58 #include <hbinputbuttongroup.h> |
|
59 #include <hbinputbutton.h> |
61 #include <HbSwipeGesture> |
60 #include <HbSwipeGesture> |
62 #include <HbTapGesture> |
61 #include <HbTapGesture> |
63 #include "hbinputvirtualrocker.h" |
62 #include "hbinputvirtualrocker.h" |
64 #include "hbinputvkbwidget.h" |
63 #include "hbinputvkbwidget.h" |
65 #include "hbinputvkbwidget_p.h" |
64 #include "hbinputvkbwidget_p.h" |
66 #include "hbinputtouchkeypadbutton.h" |
|
67 #include "hbinputsettinglist.h" |
65 #include "hbinputsettinglist.h" |
68 #include "hbinputmodeindicator.h" |
66 #include "hbinputmodeindicator.h" |
69 #include <hbfeedbackmanager.h> |
67 #include <hbfeedbackmanager.h> |
70 #include "hbinputsmileypicker.h" |
68 #include "hbinputsmileypicker.h" |
71 #include "hbinputscreenshotwidget.h" |
69 #include "hbinputscreenshotwidget.h" |
72 const qreal HbMouseDragDelta = 0.4; |
70 |
73 const qreal HbRockerWidth = 50.0; |
71 const qreal HbRockerWidth = 50.0; |
74 |
|
75 const int MaxSweepTime = 500; |
|
76 const int SweepLength = 150; |
|
77 |
72 |
78 |
73 |
79 /*! |
74 /*! |
80 @proto |
75 @proto |
81 @hbinput |
76 @hbinput |
240 void HbInputVkbWidgetPrivate::redirectMouseReleaseEvent(QGraphicsSceneMouseEvent *aEvent) |
255 void HbInputVkbWidgetPrivate::redirectMouseReleaseEvent(QGraphicsSceneMouseEvent *aEvent) |
241 { |
256 { |
242 q_ptr->mouseReleaseEvent(aEvent); |
257 q_ptr->mouseReleaseEvent(aEvent); |
243 } |
258 } |
244 |
259 |
245 void HbInputVkbWidgetPrivate::applyEditorConstraints() { |
260 void HbInputVkbWidgetPrivate::applyEditorConstraints() |
|
261 { |
246 // no default implementaiton as of now. |
262 // no default implementaiton as of now. |
|
263 } |
|
264 |
|
265 void HbInputVkbWidgetPrivate::updateKeyCodes() |
|
266 { |
|
267 Q_Q(HbInputVkbWidget); |
|
268 |
|
269 HbInputButtonGroup *buttonGroup = static_cast<HbInputButtonGroup*>(q->contentItem()); |
|
270 if (buttonGroup) { |
|
271 int key = 0; |
|
272 QList<HbInputButton*> buttons = buttonGroup->buttons(); |
|
273 for (int i = 0; i < buttons.count(); ++i) { |
|
274 if (keyCode(i) == HbInputButton::ButtonKeyCodeCharacter) { |
|
275 HbInputButton *item = buttons.at(i); |
|
276 |
|
277 const HbKeyboardMap *keyboardMap = mKeymap->keyboard(q->keyboardType()); |
|
278 if (keyboardMap && key < keyboardMap->keys.count()) { |
|
279 item->setKeyCode(keyboardMap->keys.at(key)->keycode.unicode()); |
|
280 } else { |
|
281 item->setKeyCode(-1); |
|
282 } |
|
283 ++key; |
|
284 } |
|
285 } |
|
286 } |
|
287 } |
|
288 |
|
289 void HbInputVkbWidgetPrivate::updateButtons() |
|
290 { |
|
291 Q_Q(HbInputVkbWidget); |
|
292 |
|
293 HbInputButtonGroup *buttonGroup = static_cast<HbInputButtonGroup*>(q->contentItem()); |
|
294 if (buttonGroup) { |
|
295 int key = 0; |
|
296 QList<HbInputButton*> buttons = buttonGroup->buttons(); |
|
297 for (int i = 0; i < buttons.count(); ++i) { |
|
298 if (keyCode(i) == HbInputButton::ButtonKeyCodeCharacter) { |
|
299 HbInputButton *item = buttons.at(i); |
|
300 |
|
301 const HbKeyboardMap *keyboardMap = mKeymap->keyboard(q->keyboardType()); |
|
302 if (keyboardMap && key < keyboardMap->keys.count()) { |
|
303 QString keydata = keyboardMap->keys.at(key)->characters(mModifiers); |
|
304 item->setText(keydata.at(0), HbInputButton::ButtonTextIndexPrimary); |
|
305 |
|
306 QString mappedCharacters; |
|
307 keydata.append(keyboardMap->keys.at(key)->characters(mModifiers | HbModifierFnPressed)); |
|
308 for (int i = 0; i < keydata.length(); ++i) { |
|
309 if (mOwner->focusObject() && |
|
310 mOwner->focusObject()->characterAllowedInEditor(keydata.at(i))) { |
|
311 mappedCharacters.append(keydata.at(i)); |
|
312 } |
|
313 } |
|
314 item->setMappedCharacters(mappedCharacters); |
|
315 } else { |
|
316 item->setText("", HbInputButton::ButtonTextIndexPrimary); |
|
317 item->setMappedCharacters(""); |
|
318 } |
|
319 ++key; |
|
320 } |
|
321 } |
|
322 buttonGroup->setButtons(buttons); |
|
323 } |
|
324 } |
|
325 |
|
326 void HbInputVkbWidgetPrivate::settingListPosition(QPointF &position, HbPopup::Placement &placement) |
|
327 { |
|
328 Q_Q(HbInputVkbWidget); |
|
329 |
|
330 HbInputButtonGroup *buttonGroup = static_cast<HbInputButtonGroup*>(q->contentItem()); |
|
331 if (buttonGroup) { |
|
332 HbInputButton *item = buttonGroup->button(HbInputButton::ButtonKeyCodeSettings); |
|
333 if (item) { |
|
334 position.setX(buttonGroup->scenePos().x() + item->boundingRect().x() + item->boundingRect().width()); |
|
335 position.setY(buttonGroup->scenePos().y() + item->boundingRect().y()); |
|
336 placement = HbPopup::BottomRightCorner; |
|
337 } |
|
338 } |
247 } |
339 } |
248 |
340 |
249 void HbInputVkbWidgetPrivate::setRockerPosition() |
341 void HbInputVkbWidgetPrivate::setRockerPosition() |
250 { |
342 { |
251 Q_Q(HbInputVkbWidget); |
343 Q_Q(HbInputVkbWidget); |
457 QRectF rect = boundingRect(); |
517 QRectF rect = boundingRect(); |
458 if (d->mDrawbackground) { |
518 if (d->mDrawbackground) { |
459 d->mBackgroundDrawer->paint(painter, rect); |
519 d->mBackgroundDrawer->paint(painter, rect); |
460 } |
520 } |
461 |
521 |
462 rect.setLeft(rect.width()/2 - d->mCloseHandleHeight*3); |
522 painter->save(); |
463 rect.setWidth(d->mCloseHandleHeight*6); |
523 painter->translate(rect.width() / 2 - d->mCloseHandleWidth / 2, 0); |
|
524 rect.setWidth(d->mCloseHandleWidth); |
464 rect.setHeight(d->mCloseHandleHeight); |
525 rect.setHeight(d->mCloseHandleHeight); |
465 d->mIconDrawer->paint(painter, rect); |
526 d->mIconDrawer->paint(painter, rect); |
|
527 painter->restore(); |
|
528 } |
|
529 |
|
530 /*! |
|
531 Sets the content item which will fill the content area of this widget. Content item is |
|
532 a single input button group by default. |
|
533 If null is given then the old content item is deleted and content area is cleared. |
|
534 Takes ownership of the given item. |
|
535 |
|
536 \sa updateKeyCodes |
|
537 \sa updateButtons |
|
538 \sa setKeyboardDimmed |
|
539 \sa probableKeypresses |
|
540 */ |
|
541 void HbInputVkbWidget::setContentItem(QGraphicsLayoutItem *item) |
|
542 { |
|
543 Q_D(HbInputVkbWidget); |
|
544 if (d->mLayout->count() > 1) { |
|
545 QGraphicsLayoutItem *oldItem = d->mLayout->itemAt(d->mLayout->count() - 1); |
|
546 d->mLayout->removeItem(oldItem); |
|
547 delete oldItem; |
|
548 } |
|
549 if (item) { |
|
550 d->mLayout->addItem(item); |
|
551 } |
|
552 } |
|
553 |
|
554 /*! |
|
555 Returns current content item or null if not set. |
|
556 Ownership is not transferred. |
|
557 */ |
|
558 QGraphicsLayoutItem *HbInputVkbWidget::contentItem() const |
|
559 { |
|
560 Q_D(const HbInputVkbWidget); |
|
561 |
|
562 QGraphicsLayoutItem *item(0); |
|
563 if (d->mLayout->count() > 1) { |
|
564 item = d->mLayout->itemAt(d->mLayout->count() - 1); |
|
565 } |
|
566 return item; |
466 } |
567 } |
467 |
568 |
468 /*! |
569 /*! |
469 Sets virtual rocker visibility. |
570 Sets virtual rocker visibility. |
470 */ |
571 */ |
818 { |
892 { |
819 Q_D(HbInputVkbWidget); |
893 Q_D(HbInputVkbWidget); |
820 d->mDrawbackground = backgroundEnabled; |
894 d->mDrawbackground = backgroundEnabled; |
821 } |
895 } |
822 |
896 |
|
897 |
823 /*! |
898 /*! |
824 Returns all possible keys those the user could have intended to press |
899 Returns all possible keys those the user could have intended to press |
825 for the last registered touch along with their corresponding probability. |
900 for the last registered touch along with their corresponding probability. |
826 One issue of thecurrent API implementation is that it does not always |
|
827 sum up the probabilities to 1.0, but sometimes it returns.999999899 etc. |
|
828 Need to be careful about it! |
|
829 */ |
901 */ |
830 QList<HbKeyPressProbability> HbInputVkbWidget::probableKeypresses() |
902 QList<HbKeyPressProbability> HbInputVkbWidget::probableKeypresses() |
831 { |
903 { |
832 Q_D(HbInputVkbWidget); |
904 QList<HbKeyPressProbability> probabilities; |
833 |
905 HbInputButtonGroup *buttonGroup = static_cast<HbInputButtonGroup*>(contentItem()); |
834 QList<HbKeyPressProbability> probableKeys; |
906 if (buttonGroup) { |
835 int totalItems = d->mButtonLayout->count(); |
907 probabilities = buttonGroup->buttonProbabilities(); |
836 QRectF buttonRect = d->mMostRecentlyAccessedButton->geometry(); |
908 } |
837 //The overlaying rectangle is the test rectangle that is used for finding |
909 return probabilities; |
838 //intersactions with other buttons. |
|
839 QRectF overlayingRect(d->mMostRecentlyClickedLocation.x()-buttonRect.width()/2,d->mMostRecentlyClickedLocation.y()-buttonRect.height()/2, buttonRect.width(), buttonRect.height()); |
|
840 QPainterPath path(overlayingRect.topLeft()); |
|
841 path.addRect(overlayingRect); |
|
842 for(int count=0; count < totalItems; count++) { |
|
843 QGraphicsItem *item = d->mButtonLayout->itemAt(count)->graphicsItem(); |
|
844 QPainterPath testPath = item->mapFromScene(path); |
|
845 HbTouchKeypadButton *buttonItem = 0; |
|
846 if(item->isWidget()){ |
|
847 buttonItem = qobject_cast<HbTouchKeypadButton *>(static_cast<QGraphicsWidget *>(item)); |
|
848 } |
|
849 if(!buttonItem) { |
|
850 continue; |
|
851 } |
|
852 |
|
853 //Checkif the button collides with the path, if yes,it means that the colliding |
|
854 //key also could have been clicked by the user. The probability of the button being |
|
855 //clickedin that case willdependon the area of the intersaction rectangle. |
|
856 if(buttonItem->collidesWithPath(testPath)) { |
|
857 //Initiallylet the intersaction be same as the overlaying rectangle,later we will |
|
858 //shrink the rectangle and find the actual intersected rectangle. |
|
859 QRectF intersactionRect = overlayingRect; |
|
860 //The overlaying rectangle is in scene coordinates, map it to the item coordinates. |
|
861 intersactionRect.moveTopLeft(buttonItem->mapFromScene(overlayingRect.topLeft())); |
|
862 int width = (int)intersactionRect.width(); |
|
863 int height = (int)intersactionRect.height(); |
|
864 qreal probability = 0.0; |
|
865 //Shrink based on the size of the intersaction |
|
866 if (intersactionRect.topLeft().x() > 0) { |
|
867 width -= (int)intersactionRect.topLeft().x(); |
|
868 } else { |
|
869 width += (int)intersactionRect.topLeft().x(); |
|
870 } |
|
871 if (intersactionRect.topLeft().y() > 0) { |
|
872 height -= (int)intersactionRect.topLeft().y(); |
|
873 } else { |
|
874 height += (int)intersactionRect.topLeft().y(); |
|
875 } |
|
876 //The probabilty of the key is based on the intersaction area. |
|
877 probability = (height * width) / (intersactionRect.width()* intersactionRect.height()); |
|
878 HbKeyPressProbability probablekey; |
|
879 probablekey.keycode = d->keyCode(buttonItem); |
|
880 probablekey.probability = probability; |
|
881 |
|
882 if(probablekey.keycode && (probablekey.probability>0)) { |
|
883 probableKeys.append(probablekey); |
|
884 } |
|
885 } |
|
886 } |
|
887 //Normalize makes sure that all probability summation is 1.0. |
|
888 d->normalizeProbabilities(probableKeys); |
|
889 return probableKeys; |
|
890 } |
|
891 |
|
892 /*! |
|
893 \deprecated HbInputVkbWidget::setupToolCluster() |
|
894 is deprecated. |
|
895 */ |
|
896 void HbInputVkbWidget::setupToolCluster() |
|
897 { |
|
898 Q_D(HbInputVkbWidget); |
|
899 if(!d->mOwner || !d->mOwner->focusObject()) { |
|
900 return; |
|
901 } |
|
902 |
|
903 // Create settings button if it does not exist |
|
904 if (!d->mSettingsButton) { |
|
905 d->mSettingsButton = new HbTouchKeypadButton(this, QString("")); |
|
906 d->mInputModeIndicator = new HbInputModeIndicator(*d->mSettingsButton, this); |
|
907 d->mSettingsButton->setButtonType(HbTouchKeypadButton::HbTouchButtonFunction); |
|
908 d->mSettingsButton->setBackgroundAttributes(HbTouchKeypadButton::HbTouchButtonReleased); |
|
909 |
|
910 connect(d->mSettingsButton, SIGNAL(clicked()), this, SLOT(showSettingList())); |
|
911 |
|
912 connect(d->mSettingsButton, SIGNAL(pressed()), d->mPressMapper, SLOT(map())); |
|
913 connect(d->mSettingsButton, SIGNAL(released()), d->mReleaseMapper, SLOT(map())); |
|
914 d->mPressMapper->setMapping(d->mSettingsButton, -1); |
|
915 d->mReleaseMapper->setMapping(d->mSettingsButton, -1); |
|
916 } else { |
|
917 d->mInputModeIndicator->updateIndicator(); |
|
918 } |
|
919 |
|
920 // If there's a application specific button defined, create new button with the properties |
|
921 // or update the existing one. Otherwise create an empty button or clean the properties of an existing one. |
|
922 if (!d->mOwner->focusObject()->editorInterface().actions().isEmpty()) { |
|
923 QList<HbAction*> actions = d->mOwner->focusObject()->editorInterface().actions(); |
|
924 if (d->mApplicationButtonAction != actions.first()) { |
|
925 if (d->mApplicationButton) { |
|
926 d->mApplicationButton->setText(actions.first()->text()); |
|
927 d->mApplicationButton->setIcon(actions.first()->icon()); |
|
928 d->mApplicationButton->disconnect(SIGNAL(clicked())); |
|
929 d->mApplicationButton->disconnect(SIGNAL(pressed())); |
|
930 d->mApplicationButton->disconnect(SIGNAL(released())); |
|
931 |
|
932 // disconnects old signal |
|
933 disconnect(d->mApplicationButtonAction, SIGNAL(changed()), this, SLOT(refreshApplicationButton())); |
|
934 disconnect(d->mApplicationButton, SIGNAL(clicked()), d->mApplicationButtonAction, SLOT(trigger())); |
|
935 } else { |
|
936 d->mApplicationButton = new HbTouchKeypadButton(this, actions.first()->icon(), actions.first()->text()); |
|
937 } |
|
938 d->mApplicationButtonAction = actions.first(); |
|
939 // Connect to enabling signal and check its value |
|
940 connect(actions.first(), SIGNAL(changed()), this, SLOT(refreshApplicationButton())); |
|
941 |
|
942 if (actions.first()->isEnabled()) { |
|
943 // action is enabled |
|
944 connect(d->mApplicationButton, SIGNAL(clicked()), d->mApplicationButtonAction, SLOT(trigger())); |
|
945 |
|
946 connect(d->mApplicationButton, SIGNAL(pressed()), d->mPressMapper, SLOT(map())); |
|
947 connect(d->mApplicationButton, SIGNAL(released()), d->mReleaseMapper, SLOT(map())); |
|
948 d->mPressMapper->setMapping(d->mApplicationButton, -1); |
|
949 d->mReleaseMapper->setMapping(d->mApplicationButton, -1); |
|
950 |
|
951 d->mApplicationButton->setToolTip(actions.first()->toolTip()); |
|
952 d->mApplicationButton->setButtonType(HbTouchKeypadButton::HbTouchButtonFunction); |
|
953 d->mApplicationButton->setBackgroundAttributes(HbTouchKeypadButton::HbTouchButtonReleased); |
|
954 } else { |
|
955 // action is disabled |
|
956 d->mApplicationButton->setButtonType(HbTouchKeypadButton::HbTouchButtonFnInActive); |
|
957 d->mApplicationButton->setBackgroundAttributes(HbTouchKeypadButton::HbTouchButtonPressed); |
|
958 } |
|
959 d->mApplicationButton->setToolTip(actions.first()->toolTip()); |
|
960 } |
|
961 } else { |
|
962 if (d->mApplicationButton) { |
|
963 if (d->mApplicationButtonAction) { |
|
964 disconnect(d->mApplicationButtonAction, SIGNAL(changed()), this, SLOT(refreshApplicationButton())); |
|
965 } |
|
966 d->mApplicationButton->disconnect(SIGNAL(clicked())); |
|
967 d->mApplicationButton->disconnect(SIGNAL(pressed())); |
|
968 d->mApplicationButton->disconnect(SIGNAL(released())); |
|
969 d->mApplicationButton->setText(QString()); |
|
970 d->mApplicationButton->setIcon(HbIcon()); |
|
971 d->mApplicationButton->setToolTip(QString()); |
|
972 d->mApplicationButtonAction = 0; |
|
973 } else { |
|
974 d->mApplicationButton = new HbTouchKeypadButton(this, QString()); |
|
975 d->mApplicationButton->setButtonType(HbTouchKeypadButton::HbTouchButtonFunction); |
|
976 d->mApplicationButton->setBackgroundAttributes(HbTouchKeypadButton::HbTouchButtonReleased); |
|
977 } |
|
978 d->mApplicationButtonAction = 0; |
|
979 } |
|
980 } |
910 } |
981 |
911 |
982 /*! |
912 /*! |
983 Refines the bounding rect. This function is used for collision detection |
913 Refines the bounding rect. This function is used for collision detection |
984 and hit test. |
914 and hit test. |
1032 |
962 |
1033 if (d->mSmileyPicker) { |
963 if (d->mSmileyPicker) { |
1034 d->mSmileyPicker->setGeometry(QRectF(0, pos().y(), geometry().width(), |
964 d->mSmileyPicker->setGeometry(QRectF(0, pos().y(), geometry().width(), |
1035 geometry().height())); |
965 geometry().height())); |
1036 d->mSmileyPicker->show(); |
966 d->mSmileyPicker->show(); |
1037 } |
967 |
1038 } |
968 HbInputButtonGroup *buttonGroup = static_cast<HbInputButtonGroup*>(contentItem()); |
1039 |
969 if (buttonGroup) { |
1040 /*! |
970 buttonGroup->cancelButtonPress(); |
1041 \deprecated HbInputVkbWidget::flickDirection() |
971 } |
1042 is deprecated. |
972 } |
1043 */ |
973 } |
|
974 |
1044 HbInputVkbWidget::HbFlickDirection HbInputVkbWidget::flickDirection() |
975 HbInputVkbWidget::HbFlickDirection HbInputVkbWidget::flickDirection() |
1045 { |
976 { |
1046 Q_D(HbInputVkbWidget); |
977 Q_D(HbInputVkbWidget); |
1047 return d->mFlickDirection; |
978 return d->mFlickDirection; |
1048 } |
979 } |
1049 |
980 |
1050 /*! |
981 /*! |
1051 \deprecated HbInputVkbWidget::refreshApplicationButton() |
982 Sends key event to owning input method. |
1052 is deprecated. |
983 */ |
1053 */ |
984 void HbInputVkbWidget::sendKeyPressEvent(const QKeyEvent &event) |
1054 void HbInputVkbWidget::refreshApplicationButton() |
985 { |
1055 { |
986 Q_D(HbInputVkbWidget); |
1056 Q_D(HbInputVkbWidget); |
987 |
1057 |
988 if (d->mOwner) { |
1058 d->mApplicationButton->setText(d->mApplicationButtonAction->text()); |
989 d->mOwner->filterEvent(&event); |
1059 d->mApplicationButton->setIcon(d->mApplicationButtonAction->icon()); |
990 } |
1060 |
991 } |
1061 if (d->mApplicationButton->getButtonType() == HbTouchKeypadButton::HbTouchButtonFnInActive |
992 |
1062 && d->mApplicationButtonAction->isEnabled()) { |
993 /*! |
1063 // action has been enabled |
994 Sends key event to owning input method. |
1064 connect(d->mApplicationButton, SIGNAL(clicked()), d->mApplicationButtonAction, SLOT(trigger())); |
995 */ |
1065 d->mApplicationButton->setToolTip(d->mApplicationButtonAction->toolTip()); |
996 void HbInputVkbWidget::sendKeyDoublePressEvent(const QKeyEvent &event) |
1066 d->mApplicationButton->setFade(false); |
997 { |
1067 } else if (d->mApplicationButton->getButtonType() == HbTouchKeypadButton::HbTouchButtonFunction |
998 Q_D(HbInputVkbWidget); |
1068 && !d->mApplicationButtonAction->isEnabled()) { |
999 |
1069 // action has been disabled |
1000 if (d->mOwner) { |
1070 d->mApplicationButton->disconnect(SIGNAL(clicked())); |
1001 d->mOwner->filterEvent(&event); |
1071 d->mApplicationButton->setFade(true); |
1002 } |
|
1003 } |
|
1004 |
|
1005 /*! |
|
1006 Sends key event to owning input method. |
|
1007 */ |
|
1008 void HbInputVkbWidget::sendKeyReleaseEvent(const QKeyEvent &event) |
|
1009 { |
|
1010 Q_D(HbInputVkbWidget); |
|
1011 |
|
1012 if (event.key() == HbInputButton::ButtonKeyCodeSettings) { |
|
1013 showSettingList(); |
|
1014 } else { |
|
1015 if (d->mOwner) { |
|
1016 d->mOwner->filterEvent(&event); |
|
1017 } |
|
1018 } |
|
1019 } |
|
1020 |
|
1021 /*! |
|
1022 Sends key event to owning input method. |
|
1023 */ |
|
1024 void HbInputVkbWidget::sendLongPressEvent(const QKeyEvent &event) |
|
1025 { |
|
1026 Q_D(HbInputVkbWidget); |
|
1027 |
|
1028 if (d->mOwner) { |
|
1029 d->mOwner->filterEvent(&event); |
|
1030 } |
|
1031 } |
|
1032 |
|
1033 /*! |
|
1034 Sends key event to owning input method. |
|
1035 Releae event is ignored. |
|
1036 */ |
|
1037 void HbInputVkbWidget::sendKeyChangeEvent(const QKeyEvent &releaseEvent, const QKeyEvent &pressEvent) |
|
1038 { |
|
1039 Q_D(HbInputVkbWidget); |
|
1040 Q_UNUSED(releaseEvent); |
|
1041 |
|
1042 if (d->mOwner) { |
|
1043 d->mOwner->filterEvent(&pressEvent); |
1072 } |
1044 } |
1073 } |
1045 } |
1074 |
1046 |
1075 void HbInputVkbWidget::keypadLanguageChangeAnimationUpdate(qreal value) |
1047 void HbInputVkbWidget::keypadLanguageChangeAnimationUpdate(qreal value) |
1076 { |
1048 { |
1077 Q_D(HbInputVkbWidget); |
1049 Q_D(HbInputVkbWidget); |
1078 |
1050 |
1079 int direction = 1; |
1051 int direction = 1; |
1080 if (flickDirection() == HbFlickDirectionLeft) { |
1052 if (d->mFlickDirection == HbFlickDirectionLeft) { |
1081 direction = -1; |
1053 direction = -1; |
1082 } |
1054 } |
1083 |
1055 |
1084 QRectF rect = boundingRect(); |
1056 QRectF rect = boundingRect(); |
1085 QPointF position = pos(); |
1057 QPointF position = pos(); |
1165 |
1137 |
1166 if(HbSwipeGesture *gesture = qobject_cast<HbSwipeGesture *>(event->gesture(Qt::SwipeGesture))) { |
1138 if(HbSwipeGesture *gesture = qobject_cast<HbSwipeGesture *>(event->gesture(Qt::SwipeGesture))) { |
1167 if (gesture->state() == Qt::GestureFinished) { |
1139 if (gesture->state() == Qt::GestureFinished) { |
1168 HbWidgetFeedback::triggered(this, Hb::InstantFlicked); |
1140 HbWidgetFeedback::triggered(this, Hb::InstantFlicked); |
1169 // vertical swipes |
1141 // vertical swipes |
1170 if (gesture->sceneSwipeAngle() > 250 && gesture->sceneSwipeAngle() < 290 && |
1142 if (gesture->sceneVerticalDirection() == QSwipeGesture::Down) { |
1171 gesture->sceneVerticalDirection() == QSwipeGesture::Down) { |
|
1172 d->mFlickDirection = HbFlickDirectionDown; |
1143 d->mFlickDirection = HbFlickDirectionDown; |
|
1144 emit flickEvent(d->mFlickDirection); |
1173 emit keypadCloseEventDetected(HbVkbCloseMethodCloseGesture); |
1145 emit keypadCloseEventDetected(HbVkbCloseMethodCloseGesture); |
1174 } else if (gesture->sceneSwipeAngle() > 70 && gesture->sceneSwipeAngle() < 110 && |
1146 } else if (gesture->sceneVerticalDirection() == QSwipeGesture::Up) { |
1175 gesture->sceneVerticalDirection() == QSwipeGesture::Up) { |
|
1176 d->mFlickDirection = HbFlickDirectionUp; |
1147 d->mFlickDirection = HbFlickDirectionUp; |
|
1148 emit flickEvent(d->mFlickDirection); |
1177 d->mCurrentHost->openKeypad(d->mCurrentHost->activeKeypad(), d->mOwner); |
1149 d->mCurrentHost->openKeypad(d->mCurrentHost->activeKeypad(), d->mOwner); |
1178 } else { |
1150 } else { |
1179 d->mFlickDirection = (HbInputVkbWidget::HbFlickDirection)gesture->sceneHorizontalDirection(); |
1151 d->mFlickDirection = (HbInputVkbWidget::HbFlickDirection)gesture->sceneHorizontalDirection(); |
1180 // horizontal swipes |
1152 // horizontal swipes |
1181 if (d->mFlickAnimation){ |
1153 if (d->mFlickAnimation){ |