43 #include <hbdialog.h> |
43 #include <hbdialog.h> |
44 #include <hbeffect.h> |
44 #include <hbeffect.h> |
45 #include <hbstackedwidget.h> |
45 #include <hbstackedwidget.h> |
46 #include <hbframedrawer.h> |
46 #include <hbframedrawer.h> |
47 #include <hbevent.h> |
47 #include <hbevent.h> |
|
48 #include <hbdataform.h> |
48 |
49 |
49 #include <hbinputmethod.h> |
50 #include <hbinputmethod.h> |
50 #include <hbinputsettingproxy.h> |
51 #include <hbinputsettingproxy.h> |
51 #include <hbinpututils.h> |
52 #include <hbinpututils.h> |
52 #include <hbinputdef.h> |
53 #include <hbinputdef.h> |
53 #include <hbinputvkbhost.h> |
54 #include <hbinputvkbhost.h> |
54 #include <hbinputsettingdialog.h> |
55 #include <hbinputsettingwidget.h> |
55 #include <hbinputcommondialogs.h> |
56 #include <hbinputcommondialogs.h> |
56 #include <hbinputkeymap.h> |
57 #include <hbinputkeymap.h> |
57 #include <hbinputkeymapfactory.h> |
58 #include <hbinputkeymapfactory.h> |
58 #include <hbwidgetfeedback.h> |
59 #include <hbwidgetfeedback.h> |
59 #include <hbsmileyengine.h> |
|
60 #include <hbinputpredictionfactory.h> |
60 #include <hbinputpredictionfactory.h> |
61 |
61 #include <HbSwipeGesture> |
|
62 #include <HbTapGesture> |
62 #include "hbinputvirtualrocker.h" |
63 #include "hbinputvirtualrocker.h" |
63 #include "hbinputvkbwidget.h" |
64 #include "hbinputvkbwidget.h" |
64 #include "hbinputvkbwidget_p.h" |
65 #include "hbinputvkbwidget_p.h" |
65 #include "hbinputtouchkeypadbutton.h" |
66 #include "hbinputtouchkeypadbutton.h" |
66 #include "hbinputsettinglist.h" |
67 #include "hbinputsettinglist.h" |
394 { |
397 { |
395 Q_UNUSED(host); |
398 Q_UNUSED(host); |
396 Q_D(HbInputVkbWidget); |
399 Q_D(HbInputVkbWidget); |
397 |
400 |
398 d->mRocker->setVisible(false); |
401 d->mRocker->setVisible(false); |
|
402 d->mFlickDirection = HbFlickDirectionNone; |
399 } |
403 } |
400 |
404 |
401 /*! |
405 /*! |
402 Vkb host calls this handler when the keyboard minimize animation has finished. |
406 Vkb host calls this handler when the keyboard minimize animation has finished. |
403 |
407 |
404 \sa HbVkbHost |
408 \sa HbVkbHost |
405 */ |
409 */ |
406 void HbInputVkbWidget::keyboardMinimized(HbVkbHost *host) |
410 void HbInputVkbWidget::keyboardMinimized(HbVkbHost *host) |
407 { |
411 { |
408 Q_UNUSED(host); |
412 Q_UNUSED(host); |
409 } |
413 Q_D(HbInputVkbWidget); |
410 |
414 d->mFlickDirection = HbFlickDirectionNone; |
411 /*! |
415 } |
412 handles mouse press event. |
416 |
|
417 /*! |
|
418 \deprecated HbInputVkbWidget::mousePressEvent(QGraphicsSceneMouseEvent*) |
|
419 is deprecated. |
413 */ |
420 */ |
414 void HbInputVkbWidget::mousePressEvent(QGraphicsSceneMouseEvent* event) |
421 void HbInputVkbWidget::mousePressEvent(QGraphicsSceneMouseEvent* event) |
415 { |
422 { |
416 Q_D(HbInputVkbWidget); |
|
417 Q_UNUSED(event); |
423 Q_UNUSED(event); |
418 if (!d->mMouseButtonPressedDown) { |
424 } |
419 d->mMouseButtonPressedDown = true; |
425 |
420 d->mMousePressTime.start(); |
426 /*! |
421 } |
427 \deprecated HbInputVkbWidget::mappedKeyPress(int) |
422 } |
428 is deprecated. |
423 |
|
424 /*! |
|
425 Handles mouse release event. |
|
426 */ |
|
427 void HbInputVkbWidget::mouseReleaseEvent(QGraphicsSceneMouseEvent* event) |
|
428 { |
|
429 Q_D(HbInputVkbWidget); |
|
430 d->mFlickDirection = HbFlickDirectionNone; |
|
431 d->mMouseButtonPressedDown = false; |
|
432 |
|
433 QPointF mouseDownpoint = event->buttonDownScenePos(Qt::LeftButton); |
|
434 |
|
435 if (d->mCurrentHost && d->mCurrentHost->keypadStatus() != HbVkbHost::HbVkbStatusOpened && |
|
436 d->mCurrentHost->activeKeypad() && d->mOwner) { |
|
437 HbWidgetFeedback::triggered(this, Hb::InstantFlicked); |
|
438 d->mCurrentHost->openKeypad(d->mCurrentHost->activeKeypad(), d->mOwner); |
|
439 } else if (d->mMousePressTime.elapsed() < MaxSweepTime || mouseDownpoint.y() <= scenePos().y() + d->mCloseHandleHeight) { |
|
440 QPointF delta = event->scenePos() - mouseDownpoint; |
|
441 |
|
442 qreal height; |
|
443 if (HbInputSettingProxy::instance()->screenOrientation() == Qt::Horizontal) { |
|
444 height = geometry().height() * 0.5; |
|
445 } else { |
|
446 // For ITU-T, 40% of the scene height is considered. |
|
447 height = 0.4 * geometry().height(); |
|
448 } |
|
449 // If the user drags the mouse on keypad and the |
|
450 // delta is greater than 10% of the height, keypad is closed |
|
451 height = HbMouseDragDelta * height; |
|
452 |
|
453 if (delta.y() > height) { |
|
454 HbWidgetFeedback::triggered(this, Hb::InstantFlicked); |
|
455 d->mFlickDirection = HbFlickDirectionDown; |
|
456 emit keypadCloseEventDetected(HbVkbCloseMethodButtonDrag); |
|
457 } |
|
458 |
|
459 if (qAbs(delta.x()) > SweepLength) { |
|
460 |
|
461 d->mFlickDirection = delta.x()>0 ? HbFlickDirectionRight : HbFlickDirectionLeft; |
|
462 |
|
463 if (d->mFlickAnimation){ |
|
464 HbWidgetFeedback::triggered(this, Hb::InstantFlicked); |
|
465 animKeyboardChange(); |
|
466 } |
|
467 emit flickEvent(d->mFlickDirection); |
|
468 } |
|
469 } |
|
470 } |
|
471 |
|
472 /*! |
|
473 Handles virtual key press |
|
474 */ |
429 */ |
475 void HbInputVkbWidget::mappedKeyPress(int buttonid) |
430 void HbInputVkbWidget::mappedKeyPress(int buttonid) |
476 { |
431 { |
477 Q_D(HbInputVkbWidget); |
432 Q_D(HbInputVkbWidget); |
478 d->handleStandardButtonPress(buttonid); |
433 d->handleStandardButtonPress(buttonid); |
479 } |
434 } |
480 |
435 |
481 /*! |
436 /*! |
482 Handles virtual key release |
437 \deprecated HbInputVkbWidget::mappedKeyRelease(int) |
|
438 is deprecated. |
483 */ |
439 */ |
484 void HbInputVkbWidget::mappedKeyRelease(int buttonid) |
440 void HbInputVkbWidget::mappedKeyRelease(int buttonid) |
485 { |
441 { |
486 Q_D(HbInputVkbWidget); |
442 Q_D(HbInputVkbWidget); |
487 d->handleStandardButtonRelease(buttonid); |
443 d->handleStandardButtonRelease(buttonid); |
660 d->mSettingsListOpen = true; |
615 d->mSettingsListOpen = true; |
661 d->captureScreenshot(); |
616 d->captureScreenshot(); |
662 |
617 |
663 if (!d->mSettingList) { |
618 if (!d->mSettingList) { |
664 d->mSettingList = new HbInputSettingList(); |
619 d->mSettingList = new HbInputSettingList(); |
665 connect(d->mSettingList, SIGNAL(aboutToClose()), this, SLOT(settingsClosed())); |
620 connect(d->mSettingList, SIGNAL(inputSettingsButtonClicked()), this, SLOT(showSettingsView())); |
666 connect(d->mSettingList, SIGNAL(inputSettingsButtonClicked()), this, SLOT(executeSettingsDialog())); |
|
667 connect(d->mSettingList, SIGNAL(inputMethodsButtonClicked()), this, SLOT(executeMethodDialog())); |
621 connect(d->mSettingList, SIGNAL(inputMethodsButtonClicked()), this, SLOT(executeMethodDialog())); |
668 } |
622 } |
669 |
623 |
670 #if QT_VERSION >= 0x040600 |
|
671 HbInputFocusObject *focusObject = d->mOwner->focusObject(); |
624 HbInputFocusObject *focusObject = d->mOwner->focusObject(); |
672 if (focusObject && |
625 if (focusObject && |
673 focusObject->editorInterface().isPredictionAllowed() && |
626 focusObject->editorInterface().isPredictionAllowed() && |
674 !focusObject->editorInterface().isNumericEditor() && |
|
675 predFactory->predictionEngineForLanguage(HbInputSettingProxy::instance()->globalInputLanguage())) { |
627 predFactory->predictionEngineForLanguage(HbInputSettingProxy::instance()->globalInputLanguage())) { |
676 d->mSettingList->setPredictionSelectionEnabled(true); |
628 d->mSettingList->setPredictionSelectionEnabled(true); |
677 } else { |
629 } else { |
678 d->mSettingList->setPredictionSelectionEnabled(false); |
630 d->mSettingList->setPredictionSelectionEnabled(false); |
679 } |
631 } |
680 #endif |
|
681 |
632 |
682 d->mSettingsButton->setBackgroundAttributes(HbTouchKeypadButton::HbTouchButtonLatched); |
633 d->mSettingsButton->setBackgroundAttributes(HbTouchKeypadButton::HbTouchButtonLatched); |
683 qreal x = d->mSettingsButton->scenePos().x() + d->mSettingsButton->rect().width(); |
634 qreal x = d->mSettingsButton->scenePos().x() + d->mSettingsButton->rect().width(); |
684 qreal y = d->mSettingsButton->scenePos().y(); |
635 qreal y = d->mSettingsButton->scenePos().y(); |
685 d->mSettingList->setPreferredPos(QPointF(x, y), HbPopup::BottomRightCorner); |
636 d->mSettingList->setPreferredPos(QPointF(x, y), HbPopup::BottomRightCorner); |
686 d->mSettingList->showSettingList(); |
637 d->mSettingList->updateSettingList(); |
|
638 d->mSettingList->open(this, SLOT(settingsClosed())); |
|
639 } |
|
640 |
|
641 /*! |
|
642 Slot which is called when settings list is closed. |
|
643 */ |
|
644 void HbInputVkbWidget::settingsClosed() |
|
645 { |
|
646 Q_D(HbInputVkbWidget); |
|
647 |
|
648 d->mSettingsButton->setBackgroundAttributes(HbTouchKeypadButton::HbTouchButtonReleased); |
|
649 |
687 d->mSettingsListOpen = false; |
650 d->mSettingsListOpen = false; |
688 if ( d->mAnimateWhenDialogCloses ) { |
651 if ( d->mAnimateWhenDialogCloses ) { |
689 animKeyboardChange(); |
652 animKeyboardChange(); |
690 d->mAnimateWhenDialogCloses = false; |
653 d->mAnimateWhenDialogCloses = false; |
691 } else if(d->mScreenshotTimeLine.state() != QTimeLine::Running) { |
654 } else if(d->mScreenshotTimeLine.state() != QTimeLine::Running) { |
692 keypadLanguageChangeFinished(); |
655 keypadLanguageChangeFinished(); |
693 } |
656 } |
694 } |
657 } |
695 |
658 |
696 /*! |
659 /*! |
697 Slot to connect aboutToClose of settings list to update keyboard graphics. |
|
698 */ |
|
699 void HbInputVkbWidget::settingsClosed() |
|
700 { |
|
701 Q_D(HbInputVkbWidget); |
|
702 d->mSettingsButton->setBackgroundAttributes(HbTouchKeypadButton::HbTouchButtonReleased); |
|
703 } |
|
704 |
|
705 /*! |
|
706 Closes settings list |
660 Closes settings list |
707 */ |
661 */ |
708 void HbInputVkbWidget::closeSettingList() |
662 void HbInputVkbWidget::closeSettingList() |
709 { |
663 { |
710 Q_D(HbInputVkbWidget); |
664 Q_D(HbInputVkbWidget); |
711 d->mSettingList->close(); |
665 d->mSettingList->close(); |
712 d->mSettingsButton->setBackgroundAttributes(HbTouchKeypadButton::HbTouchButtonReleased); |
666 d->mSettingsButton->setBackgroundAttributes(HbTouchKeypadButton::HbTouchButtonReleased); |
713 } |
667 } |
714 |
668 |
715 /*! |
669 /*! |
716 Toggles prediction status. |
670 \deprecated HbInputVkbWidget::togglePredictionStatus() |
|
671 is deprecated. |
717 */ |
672 */ |
718 void HbInputVkbWidget::togglePredictionStatus() |
673 void HbInputVkbWidget::togglePredictionStatus() |
719 { |
674 { |
720 closeSettingList(); |
675 closeSettingList(); |
721 bool predictionStatus = HbInputSettingProxy::instance()->predictiveInputStatus(); |
676 HbInputSettingProxy::instance()->togglePrediction(); |
722 HbInputSettingProxy::instance()->setPredictiveInputStatus(!predictionStatus); |
|
723 update(); |
677 update(); |
724 } |
678 } |
725 |
679 |
726 /*! |
680 /*! |
727 Executes settingsDialog |
681 \deprecated HbInputVkbWidget::executeSettingsDialog() |
|
682 is deprecated. Use showSettingsView instead. |
728 */ |
683 */ |
729 void HbInputVkbWidget::executeSettingsDialog() |
684 void HbInputVkbWidget::executeSettingsDialog() |
730 { |
685 { |
|
686 } |
|
687 |
|
688 /*! |
|
689 Shows settings view |
|
690 */ |
|
691 void HbInputVkbWidget::showSettingsView() |
|
692 { |
731 Q_D(HbInputVkbWidget); |
693 Q_D(HbInputVkbWidget); |
732 |
694 |
733 closeSettingList(); |
695 closeSettingList(); |
734 HbInputSettingDialog::HbSettingItems items = HbInputSettingDialog::HbSettingItemAll; |
696 |
735 if (d->mOwner->focusObject()->editorInterface().isNumericEditor()) { |
697 d->mSettingView = new HbView(this); |
736 items &= (~HbInputSettingDialog::HbSettingItemPrediction); |
698 d->mSettingView->setTitle(tr("Input Settings")); |
737 } |
699 mainWindow()->addView(d->mSettingView); |
738 HbInputSettingDialog* settings = new HbInputSettingDialog(items); |
700 |
739 d->mSettingsListOpen = true; |
701 HbAction *backAction = new HbAction(Hb::BackNaviAction, d->mSettingView); |
740 settings->exec(); |
702 backAction->setText(tr("Back")); |
741 delete settings; |
703 connect(backAction, SIGNAL(triggered(bool)), this, SLOT(closeSettingsView())); |
742 d->mSettingsListOpen = false; |
704 d->mSettingView->setNavigationAction(backAction); |
743 if ( d->mAnimateWhenDialogCloses ) { |
705 |
744 animKeyboardChange(); |
706 HbDataForm *dataForm = new HbDataForm(); |
745 d->mAnimateWhenDialogCloses = false; |
707 d->mSettingView->setWidget(dataForm); |
746 } else { |
708 HbInputSettingWidget *settingWidget = new HbInputSettingWidget(dataForm, d->mSettingView); |
747 keypadLanguageChangeFinished(); |
709 settingWidget->initializeWidget(); |
748 } |
710 |
|
711 d->mCurrentView = mainWindow()->currentView(); |
|
712 mainWindow()->setCurrentView(d->mSettingView); |
|
713 } |
|
714 |
|
715 /*! |
|
716 Closes settings view and returns to previous view |
|
717 */ |
|
718 void HbInputVkbWidget::closeSettingsView() |
|
719 { |
|
720 Q_D(HbInputVkbWidget); |
|
721 |
|
722 mainWindow()->setCurrentView(d->mCurrentView); |
|
723 mainWindow()->removeView(d->mSettingView); |
|
724 delete d->mSettingView; |
|
725 d->mSettingView = 0; |
749 } |
726 } |
750 |
727 |
751 /*! |
728 /*! |
752 Executes input method selection dialog |
729 Executes input method selection dialog |
753 */ |
730 */ |
991 d->mApplicationButton->disconnect(SIGNAL(pressed())); |
967 d->mApplicationButton->disconnect(SIGNAL(pressed())); |
992 d->mApplicationButton->disconnect(SIGNAL(released())); |
968 d->mApplicationButton->disconnect(SIGNAL(released())); |
993 d->mApplicationButton->setText(QString()); |
969 d->mApplicationButton->setText(QString()); |
994 d->mApplicationButton->setIcon(HbIcon()); |
970 d->mApplicationButton->setIcon(HbIcon()); |
995 d->mApplicationButton->setToolTip(QString()); |
971 d->mApplicationButton->setToolTip(QString()); |
996 d->mApplicationButtonAction = 0; |
972 d->mApplicationButtonAction = 0; |
997 } else { |
973 } else { |
998 d->mApplicationButton = new HbTouchKeypadButton(this, QString()); |
974 d->mApplicationButton = new HbTouchKeypadButton(this, QString()); |
999 d->mApplicationButton->setButtonType(HbTouchKeypadButton::HbTouchButtonFunction); |
975 d->mApplicationButton->setButtonType(HbTouchKeypadButton::HbTouchButtonFunction); |
1000 d->mApplicationButton->setBackgroundAttributes(HbTouchKeypadButton::HbTouchButtonReleased); |
976 d->mApplicationButton->setBackgroundAttributes(HbTouchKeypadButton::HbTouchButtonReleased); |
1001 } |
977 } |
1002 d->mApplicationButtonAction = NULL; |
978 d->mApplicationButtonAction = 0; |
1003 } |
979 } |
1004 } |
980 } |
1005 |
981 |
1006 /*! |
982 /*! |
1007 shape function actually refines the bounding rect. This function is used for collision detection |
983 Refines the bounding rect. This function is used for collision detection |
1008 and hit test. |
984 and hit test. |
1009 */ |
985 */ |
1010 QPainterPath HbInputVkbWidget::shape() const |
986 QPainterPath HbInputVkbWidget::shape() const |
1011 { |
987 { |
1012 QRectF rect = boundingRect(); |
988 QRectF rect = boundingRect(); |
1013 QPainterPath path; |
989 QPainterPath path; |
1014 path.addRect(rect); |
990 path.addRect(rect); |
1015 return path; |
991 return path; |
1016 } |
992 } |
1017 |
993 |
|
994 /*! |
|
995 \reimp |
|
996 */ |
1018 QSizeF HbInputVkbWidget::minimizedKeyboardSize() |
997 QSizeF HbInputVkbWidget::minimizedKeyboardSize() |
1019 { |
998 { |
1020 Q_D(HbInputVkbWidget); |
999 Q_D(HbInputVkbWidget); |
1021 return QSizeF(0.0, d->mCloseHandleHeight); |
1000 return QSizeF(0.0, d->mCloseHandleHeight); |
1022 } |
1001 } |
1023 |
1002 |
|
1003 /*! |
|
1004 Shows smiley picker widget. |
|
1005 */ |
1024 void HbInputVkbWidget::showSmileyPicker(int rows, int columns) |
1006 void HbInputVkbWidget::showSmileyPicker(int rows, int columns) |
1025 { |
1007 { |
1026 Q_D(HbInputVkbWidget); |
1008 Q_D(HbInputVkbWidget); |
1027 if (!d->mOwner || !d->mOwner->focusObject()) { |
1009 if (!d->mOwner || !d->mOwner->focusObject()) { |
1028 return; |
1010 return; |
1029 } |
1011 } |
1030 // check whether the smiley recognition is enabled in the currently focused editor. |
1012 // check whether the smiley recognition is enabled in the currently focused editor. |
1031 if (!d->isSmileysEnabled()) { |
1013 if (!d->isSmileysEnabled()) { |
1032 return; |
1014 return; |
1033 } |
1015 } |
1034 HbInputFocusObject *focusObject = d->mOwner->focusObject(); |
1016 HbInputFocusObject *focusObject = d->mOwner->focusObject(); |
1035 |
1017 |
1036 if (!d->mSmileyPicker || d->mFocusedObject != focusObject) { |
1018 if (!d->mSmileyPicker || d->mFocusedObject != focusObject) { |
1037 d->mFocusedObject = focusObject; |
1019 d->mFocusedObject = focusObject; |
1038 if (d->mSmileyPicker) { |
1020 if (d->mSmileyPicker) { |
1039 delete d->mSmileyPicker; |
1021 delete d->mSmileyPicker; |
1040 } |
1022 } |
1041 // get the smiley list from editor interface smiley theme. |
1023 // get the smiley list from editor interface smiley theme. |
1042 QStringList smileys = focusObject->editorInterface().smileyTheme().smileys(); |
1024 QStringList smileys = focusObject->editorInterface().smileyTheme().smileys(); |
1043 // if the smiley list is empty and the editor is not a Hb editor, |
|
1044 // then get the default smiley list from smiley engine. |
|
1045 if (smileys.isEmpty() && !focusObject->editorInterface().editor()->inherits("HbAbstractEdit")) { |
|
1046 HbSmileyEngine smileyEngine; |
|
1047 smileys = smileyEngine.defaultTheme().smileys(); |
|
1048 } |
|
1049 |
1025 |
1050 if (!smileys.isEmpty()) { |
1026 if (!smileys.isEmpty()) { |
1051 d->mSmileyPicker = new HbInputSmileyPicker(rows, columns, 0, smileys); |
1027 d->mSmileyPicker = new HbInputSmileyPicker(rows, columns, 0, smileys); |
1052 d->mSmileyPicker->setObjectName("vkbwidget_smiley_picker"); |
1028 d->mSmileyPicker->setObjectName("vkbwidget_smiley_picker"); |
1053 connect(d->mSmileyPicker, SIGNAL(selected(QString)), this, SIGNAL(smileySelected(QString))); |
1029 connect(d->mSmileyPicker, SIGNAL(selected(QString)), this, SIGNAL(smileySelected(QString))); |
1054 } |
1030 } |
1055 } |
1031 } |
1056 |
1032 |
1057 if (d->mSmileyPicker) { |
1033 if (d->mSmileyPicker) { |
1058 d->mSmileyPicker->setGeometry(QRectF(0, pos().y(), geometry().width(), |
1034 d->mSmileyPicker->setGeometry(QRectF(0, pos().y(), geometry().width(), |
1059 geometry().height())); |
1035 geometry().height())); |
1060 d->mSmileyPicker->show(); |
1036 d->mSmileyPicker->show(); |
1061 } |
1037 } |
1062 } |
1038 } |
1063 |
1039 |
|
1040 /*! |
|
1041 \deprecated HbInputVkbWidget::flickDirection() |
|
1042 is deprecated. |
|
1043 */ |
1064 HbInputVkbWidget::HbFlickDirection HbInputVkbWidget::flickDirection() |
1044 HbInputVkbWidget::HbFlickDirection HbInputVkbWidget::flickDirection() |
1065 { |
1045 { |
1066 Q_D(HbInputVkbWidget); |
1046 Q_D(HbInputVkbWidget); |
1067 return d->mFlickDirection; |
1047 return d->mFlickDirection; |
1068 } |
1048 } |
1069 |
1049 |
1070 /*! |
1050 /*! |
1071 Intended for internal use only |
1051 \deprecated HbInputVkbWidget::refreshApplicationButton() |
|
1052 is deprecated. |
1072 */ |
1053 */ |
1073 void HbInputVkbWidget::refreshApplicationButton() |
1054 void HbInputVkbWidget::refreshApplicationButton() |
1074 { |
1055 { |
1075 Q_D(HbInputVkbWidget); |
1056 Q_D(HbInputVkbWidget); |
1076 |
1057 |
1089 d->mApplicationButton->disconnect(SIGNAL(clicked())); |
1070 d->mApplicationButton->disconnect(SIGNAL(clicked())); |
1090 d->mApplicationButton->setFade(true); |
1071 d->mApplicationButton->setFade(true); |
1091 } |
1072 } |
1092 } |
1073 } |
1093 |
1074 |
1094 void HbInputVkbWidget::keypadLanguageChangeAnimationUpdate(qreal aValue) |
1075 void HbInputVkbWidget::keypadLanguageChangeAnimationUpdate(qreal value) |
1095 { |
1076 { |
1096 Q_D(HbInputVkbWidget); |
1077 Q_D(HbInputVkbWidget); |
1097 |
1078 |
1098 int direction = 1; |
1079 int direction = 1; |
1099 if (flickDirection() == HbFlickDirectionLeft) { |
1080 if (flickDirection() == HbFlickDirectionLeft) { |
1100 direction = -1; |
1081 direction = -1; |
1101 } |
1082 } |
1102 |
1083 |
1103 QRectF rect = boundingRect(); |
1084 QRectF rect = boundingRect(); |
1104 QPointF position = pos(); |
1085 QPointF position = pos(); |
1105 position.setX(direction * (-rect.width() + rect.width() * aValue)); |
1086 position.setX(direction * (-rect.width() + rect.width() * value)); |
1106 if (d->mScreenshotWidget) { |
1087 if (d->mScreenshotWidget) { |
1107 d->mScreenshotWidget->setPos(position.x() + direction * rect.width(), position.y()); |
1088 d->mScreenshotWidget->setPos(position.x() + direction * rect.width(), position.y()); |
1108 setPos(position); |
1089 setPos(position); |
1109 } |
1090 } |
1110 } |
1091 } |
1111 |
1092 |
1112 void HbInputVkbWidget::keypadLanguageChangeFinished() |
1093 void HbInputVkbWidget::keypadLanguageChangeFinished() |
1113 { |
1094 { |
1114 Q_D(HbInputVkbWidget); |
1095 Q_D(HbInputVkbWidget); |
1115 delete d->mScreenshotWidget; |
1096 delete d->mScreenshotWidget; |
1116 d->mScreenshotWidget = NULL; |
1097 d->mScreenshotWidget = 0; |
|
1098 d->mFlickDirection = HbFlickDirectionNone; |
1117 } |
1099 } |
1118 |
1100 |
1119 void HbInputVkbWidget::animKeyboardChange() |
1101 void HbInputVkbWidget::animKeyboardChange() |
1120 { |
1102 { |
1121 Q_D(HbInputVkbWidget); |
1103 Q_D(HbInputVkbWidget); |
1169 d->mIconDrawer->themeChanged(); |
1154 d->mIconDrawer->themeChanged(); |
1170 } |
1155 } |
1171 HbWidget::changeEvent(event); |
1156 HbWidget::changeEvent(event); |
1172 } |
1157 } |
1173 |
1158 |
|
1159 /*! |
|
1160 \reimp |
|
1161 */ |
|
1162 void HbInputVkbWidget::gestureEvent(QGestureEvent *event) |
|
1163 { |
|
1164 Q_D(HbInputVkbWidget); |
|
1165 |
|
1166 if(HbSwipeGesture *gesture = qobject_cast<HbSwipeGesture *>(event->gesture(Qt::SwipeGesture))) { |
|
1167 if (gesture->state() == Qt::GestureFinished) { |
|
1168 HbWidgetFeedback::triggered(this, Hb::InstantFlicked); |
|
1169 // vertical swipes |
|
1170 if (gesture->sceneSwipeAngle() > 250 && gesture->sceneSwipeAngle() < 290 && |
|
1171 gesture->sceneVerticalDirection() == QSwipeGesture::Down) { |
|
1172 d->mFlickDirection = HbFlickDirectionDown; |
|
1173 emit keypadCloseEventDetected(HbVkbCloseMethodCloseGesture); |
|
1174 } else if (gesture->sceneSwipeAngle() > 70 && gesture->sceneSwipeAngle() < 110 && |
|
1175 gesture->sceneVerticalDirection() == QSwipeGesture::Up) { |
|
1176 d->mFlickDirection = HbFlickDirectionUp; |
|
1177 d->mCurrentHost->openKeypad(d->mCurrentHost->activeKeypad(), d->mOwner); |
|
1178 } else { |
|
1179 d->mFlickDirection = (HbInputVkbWidget::HbFlickDirection)gesture->sceneHorizontalDirection(); |
|
1180 // horizontal swipes |
|
1181 if (d->mFlickAnimation){ |
|
1182 animKeyboardChange(); |
|
1183 } |
|
1184 emit flickEvent(d->mFlickDirection); |
|
1185 } |
|
1186 } |
|
1187 } else if(HbTapGesture *gesture = qobject_cast<HbTapGesture *>(event->gesture(Qt::TapGesture))) { |
|
1188 if (gesture->state() == Qt::GestureFinished) { |
|
1189 // if keypad is minimized, open it |
|
1190 if ( d->mCurrentHost->keypadStatus() == HbVkbHost::HbVkbStatusMinimized ) { |
|
1191 d->mCurrentHost->openKeypad(this, d->mOwner); |
|
1192 } |
|
1193 } |
|
1194 } |
|
1195 } |
|
1196 |
1174 // End of file |
1197 // End of file |