43 #include <hbwidget.h> |
43 #include <hbwidget.h> |
44 #include <hbdialog.h> |
44 #include <hbdialog.h> |
45 #include <hbeffect.h> |
45 #include <hbeffect.h> |
46 #include <hbframedrawer.h> |
46 #include <hbframedrawer.h> |
47 #include <hbevent.h> |
47 #include <hbevent.h> |
48 #include <hbdataform.h> |
|
49 #include <hbinputregioncollector_p.h> |
48 #include <hbinputregioncollector_p.h> |
50 #include <hbfeedbackmanager.h> |
49 #include <hbfeedbackmanager.h> |
51 |
50 |
52 #include <hbinputmethod.h> |
51 #include <hbinputmethod.h> |
53 #include <hbinputsettingproxy.h> |
52 #include <hbinputsettingproxy.h> |
54 #include <hbinpututils.h> |
53 #include <hbinpututils.h> |
55 #include <hbinputdef.h> |
54 #include <hbinputdef.h> |
56 #include <hbinputvkbhost.h> |
55 #include <hbinputvkbhost.h> |
57 #include <hbinputvkbhostbridge.h> |
56 #include <hbinputvkbhostbridge.h> |
58 #include <hbinputsettingwidget.h> |
|
59 #include <hbinputcommondialogs.h> |
57 #include <hbinputcommondialogs.h> |
60 #include <hbinputkeymap.h> |
58 #include <hbinputkeymap.h> |
61 #include <hbinputkeymapfactory.h> |
59 #include <hbinputkeymapfactory.h> |
62 #include <hbwidgetfeedback.h> |
60 #include <hbwidgetfeedback.h> |
63 #include <hbinputpredictionfactory.h> |
61 #include <hbinputpredictionfactory.h> |
84 const qreal HbLandscapeSmileyPickerWidthInUnits = 83.4; |
83 const qreal HbLandscapeSmileyPickerWidthInUnits = 83.4; |
85 const qreal HbSmileyPickerMarginInUnits = 0.9; |
84 const qreal HbSmileyPickerMarginInUnits = 0.9; |
86 |
85 |
87 |
86 |
88 /*! |
87 /*! |
89 @proto |
88 @stable |
90 @hbinput |
89 @hbinput |
91 \class HbInputVkbWidget |
90 \class HbInputVkbWidget |
92 \brief A base class for touch keypads. |
91 \brief The HbInputVkbWidget class is a base class for touch keypads. |
93 |
92 |
94 This class implements default mechanisms for opening and closing touch keypads. |
93 This class implements default mechanisms for opening and closing touch keypads. |
95 It know how to operate in landscape and in portait modes and it know how |
94 It supports landscape and portrait modes, and splitting the view into |
96 implement split view -mechasnism for S60 QT UI's Hb library. It also implements |
95 the application and touch keypad sections. It also implements a closing mechanism |
97 closing mechansim, where used is able to close the touch keypad by sliding it downwards |
96 where the user can close the touch keypad by swiping it downwards with a finger. |
98 with a finger. This class also implements background drawing for touch keypads. |
97 This class also implements background drawing for touch keypads. |
99 */ |
98 */ |
100 |
99 |
101 /// @cond |
100 /// @cond |
102 |
101 |
103 inline HbWidget *hbwidget_cast(QGraphicsItem *item) |
102 inline HbWidget *hbwidget_cast(QGraphicsItem *item) |
130 mMostRecentlyAccessedButton(0), |
129 mMostRecentlyAccessedButton(0), |
131 mMostRecentlyClickedLocation(0.0, 0.0), |
130 mMostRecentlyClickedLocation(0.0, 0.0), |
132 mFocusedObject(0), |
131 mFocusedObject(0), |
133 mCurrentFocusedObject(0), |
132 mCurrentFocusedObject(0), |
134 mFlickAnimation(false), |
133 mFlickAnimation(false), |
135 mSettingsListOpen(false), |
134 mSettingsDialogsOpen(0), |
136 mAnimateWhenDialogCloses(false), |
135 mAnimateWhenDialogCloses(false), |
137 mKeyboardSize(HbQwerty4x10), |
136 mKeyboardSize(HbQwerty4x10), |
138 mCloseHandleHeight(0), |
137 mCloseHandleHeight(0), |
139 mCloseHandle(0), |
138 mCloseHandle(0), |
140 mSettingView(0), |
|
141 mCurrentView(0), |
|
142 mKeyboardDimmed(false), |
139 mKeyboardDimmed(false), |
143 mSettingWidget(0) |
140 mSettingPopup(0) |
144 { |
141 { |
145 mScreenshotTimeLine.setUpdateInterval(16); |
142 mScreenshotTimeLine.setUpdateInterval(16); |
146 } |
143 } |
147 |
144 |
148 |
145 |
368 QRectF rect = QRectF(position.x(), position.y() + mCloseHandleHeight, q->boundingRect().width(), q->boundingRect().height() - mCloseHandleHeight); |
365 QRectF rect = QRectF(position.x(), position.y() + mCloseHandleHeight, q->boundingRect().width(), q->boundingRect().height() - mCloseHandleHeight); |
369 QTransform rotateTrans; |
366 QTransform rotateTrans; |
370 rotateTrans = q->mainWindow()->viewportTransform(); |
367 rotateTrans = q->mainWindow()->viewportTransform(); |
371 QRectF transRect = rotateTrans.mapRect(rect); |
368 QRectF transRect = rotateTrans.mapRect(rect); |
372 QPixmap pixmap; |
369 QPixmap pixmap; |
373 pixmap = QPixmap::grabWidget(q->mainWindow(), (int)transRect.x(), (int)transRect.y(), (int)transRect.width(), (int)transRect.height()); |
370 pixmap = QPixmap::grabWidget(q->mainWindow(), (int)transRect.x(), (int)transRect.y()+2, (int)transRect.width(), (int)transRect.height()); |
374 pixmap = pixmap.transformed(rotateTrans.inverted()); |
371 pixmap = pixmap.transformed(rotateTrans.inverted()); |
|
372 mScreenshotWidget->hide(); |
375 mScreenshotWidget->setScreenshot(pixmap); |
373 mScreenshotWidget->setScreenshot(pixmap); |
376 } |
374 } |
377 |
375 |
378 |
376 |
379 void HbInputVkbWidgetPrivate::updateMouseHitItem(HbTouchKeypadButton *button, QPointF position) |
377 void HbInputVkbWidgetPrivate::updateMouseHitItem(HbTouchKeypadButton *button, QPointF position) |
419 Q_Q(HbInputVkbWidget); |
417 Q_Q(HbInputVkbWidget); |
420 |
418 |
421 if (!descriptor.isEmpty() && mOwner) { |
419 if (!descriptor.isEmpty() && mOwner) { |
422 // Set as active input method. |
420 // Set as active input method. |
423 HbInputSettingProxy::instance()->setPreferredInputMethod(q->mainWindow()->orientation(), descriptor, customData); |
421 HbInputSettingProxy::instance()->setPreferredInputMethod(q->mainWindow()->orientation(), descriptor, customData); |
424 // Activate immediately. |
422 if (HbInputSettingProxy::instance()->globalInputLanguage().language() == QLocale::Chinese && |
425 mOwner->activateInputMethod(descriptor); |
423 q->mainWindow()->orientation() == Qt::Vertical) { |
|
424 HbInputLanguage primaryInputLanguage = HbInputSettingProxy::instance()->globalInputLanguage(); |
|
425 mOwner->activateState(HbInputState(HbInputModeDefault, |
|
426 HbTextCaseAutomatic, |
|
427 HbKeyboardTouchPortrait, |
|
428 primaryInputLanguage)); |
|
429 HbInputMethod::activeInputMethod()->activateInputMethod(descriptor); |
|
430 } else { |
|
431 // Activate immediately. |
|
432 mOwner->activateInputMethod(descriptor); |
|
433 } |
426 } |
434 } |
427 } |
435 } |
428 |
436 |
429 void HbInputVkbWidgetPrivate::_q_smileyPickerClosed() |
437 void HbInputVkbWidgetPrivate::_q_smileyPickerClosed() |
430 { |
438 { |
494 } |
503 } |
495 |
504 |
496 /// @endcond |
505 /// @endcond |
497 |
506 |
498 /*! |
507 /*! |
499 Costructs the object. |
508 \enum HbInputVkbWidget::HbFlickDirection |
|
509 Describes the direction of the flick (swipe) gesture. |
|
510 */ |
|
511 |
|
512 /*! |
|
513 \var HbInputVkbWidget::HbFlickDirectionNone |
|
514 No direction for a flick gesture. |
|
515 */ |
|
516 |
|
517 /*! |
|
518 \var HbInputVkbWidget::HbFlickDirectionLeft |
|
519 Flick gesture to the left. |
|
520 */ |
|
521 |
|
522 /*! |
|
523 \var HbInputVkbWidget::HbFlickDirectionRight |
|
524 Flick gesture to the right. |
|
525 */ |
|
526 |
|
527 /*! |
|
528 \var HbInputVkbWidget::HbFlickDirectionUp |
|
529 Flick gesture upwards. |
|
530 */ |
|
531 |
|
532 /*! |
|
533 \var HbInputVkbWidget::HbFlickDirectionDown |
|
534 Flick gesture downwards. |
|
535 */ |
|
536 |
|
537 /*! |
|
538 \enum HbInputVkbWidget::HbVkbCloseMethod |
|
539 Describes the different closing methods for the virtual keyboard. |
|
540 */ |
|
541 |
|
542 /*! |
|
543 \var HbInputVkbWidget::HbVkbCloseMethodButtonDrag |
|
544 Keypad closed by dragging a button. |
|
545 */ |
|
546 |
|
547 /*! |
|
548 \var HbInputVkbWidget::HbVkbCloseMethodCloseButton |
|
549 Keypad closed with the close button. |
|
550 */ |
|
551 |
|
552 /*! |
|
553 \var HbInputVkbWidget::HbVkbCloseMethodCloseButtonDrag |
|
554 Keypad closed with a button. |
|
555 */ |
|
556 |
|
557 /*! |
|
558 \var HbInputVkbWidget::HbVkbCloseMethodCloseGesture |
|
559 Keypad closed with a downward flick (swipe) gesture. |
|
560 */ |
|
561 |
|
562 /*! |
|
563 \enum HbInputVkbWidget::HbSctView |
|
564 Defines the view mode for the special character view. |
|
565 */ |
|
566 |
|
567 /*! |
|
568 \var HbInputVkbWidget::HbSctViewSpecialCharacter |
|
569 View mode with the table of special characters. |
|
570 */ |
|
571 |
|
572 /*! |
|
573 \var HbInputVkbWidget::HbSctViewSmiley |
|
574 View mode with the table of smileys. |
|
575 */ |
|
576 |
|
577 /*! |
|
578 Constructor. |
500 */ |
579 */ |
501 HbInputVkbWidget::HbInputVkbWidget(QGraphicsItem *parent) |
580 HbInputVkbWidget::HbInputVkbWidget(QGraphicsItem *parent) |
502 : HbWidget(*new HbInputVkbWidgetPrivate, parent) |
581 : HbWidget(*new HbInputVkbWidgetPrivate, parent) |
503 { |
582 { |
504 Q_D(HbInputVkbWidget); |
583 Q_D(HbInputVkbWidget); |
645 } |
715 } |
646 return item; |
716 return item; |
647 } |
717 } |
648 |
718 |
649 /*! |
719 /*! |
650 \deprecated HbInputVkbWidget::setRockerVisible(bool) |
720 Returns the active keypad mode. Possible values are EModeAbc and EModeNumeric. |
651 is deprecated. |
|
652 |
|
653 Sets virtual rocker visibility. |
|
654 */ |
|
655 void HbInputVkbWidget::setRockerVisible(bool visible) |
|
656 { |
|
657 Q_UNUSED(visible); |
|
658 } |
|
659 |
|
660 /*! |
|
661 \deprecated HbInputVkbWidget::isRockerVisible() const |
|
662 is deprecated. |
|
663 |
|
664 Returns true if virtual rocker is allowed to be visible. |
|
665 */ |
|
666 bool HbInputVkbWidget::isRockerVisible() const |
|
667 { |
|
668 return false; |
|
669 } |
|
670 |
|
671 /*! |
|
672 Returns active keypad mode. Possible values are EModeAbc, EModeNumeric and EModeSct. |
|
673 */ |
721 */ |
674 HbKeypadMode HbInputVkbWidget::mode() const |
722 HbKeypadMode HbInputVkbWidget::mode() const |
675 { |
723 { |
676 Q_D(const HbInputVkbWidget); |
724 Q_D(const HbInputVkbWidget); |
677 return d->mMode; |
725 return d->mMode; |
678 } |
726 } |
679 |
727 |
680 /*! |
728 /*! |
681 Returns active keypad modifiers. |
729 Returns the active keypad modifiers as a set of flags for shift, chr, and fn keys |
|
730 (see details in file <tt>inputdef.h</tt>). |
682 */ |
731 */ |
683 HbModifiers HbInputVkbWidget::modifiers() const |
732 HbModifiers HbInputVkbWidget::modifiers() const |
684 { |
733 { |
685 Q_D(const HbInputVkbWidget); |
734 Q_D(const HbInputVkbWidget); |
686 return d->mModifiers; |
735 return d->mModifiers; |
687 } |
736 } |
688 |
737 |
689 /*! |
738 /*! |
690 Sets the keypad to given mode. Possible values are EModeAbc, EModeNumeric and EModeSct. |
739 Sets the keypad to given \a mode. Possible values are EModeAbc and EModeNumeric. |
|
740 \a modifiers is a set of flags for shift, chr, and fn keys (see details in file |
|
741 <tt>inputdef.h</tt>). |
691 */ |
742 */ |
692 void HbInputVkbWidget::setMode(HbKeypadMode mode, HbModifiers modifiers) |
743 void HbInputVkbWidget::setMode(HbKeypadMode mode, HbModifiers modifiers) |
693 { |
744 { |
694 Q_D(HbInputVkbWidget); |
745 Q_D(HbInputVkbWidget); |
695 d->mMode = mode; |
746 d->mMode = mode; |
773 buttonGroup->setEnabled(!dimmed); |
824 buttonGroup->setEnabled(!dimmed); |
774 } |
825 } |
775 } |
826 } |
776 |
827 |
777 /*! |
828 /*! |
778 Shows settings list |
829 Shows the setting list. |
779 */ |
830 */ |
780 void HbInputVkbWidget::showSettingList() |
831 void HbInputVkbWidget::showSettingList() |
781 { |
832 { |
782 Q_D(HbInputVkbWidget); |
833 Q_D(HbInputVkbWidget); |
783 HbPredictionFactory *predFactory = HbPredictionFactory::instance(); |
834 HbPredictionFactory *predFactory = HbPredictionFactory::instance(); |
784 |
835 |
785 d->mSettingsListOpen = true; |
836 d->mSettingsDialogsOpen++; |
786 d->captureScreenshot(); |
837 d->captureScreenshot(); |
787 |
838 |
788 if (!d->mSettingList) { |
839 if (!d->mSettingList) { |
789 d->mSettingList = new HbInputSettingList(); |
840 d->mSettingList = new HbInputSettingList(); |
790 connect(d->mSettingList, SIGNAL(inputSettingsButtonClicked()), this, SLOT(showSettingsView())); |
841 connect(d->mSettingList, SIGNAL(inputSettingsButtonClicked()), this, SLOT(showSettingsView())); |
824 d->mSettingList->updateSettingList(); |
875 d->mSettingList->updateSettingList(); |
825 d->mSettingList->open(this, SLOT(_q_settingsClosed(HbAction*))); |
876 d->mSettingList->open(this, SLOT(_q_settingsClosed(HbAction*))); |
826 } |
877 } |
827 |
878 |
828 /*! |
879 /*! |
829 Slot which is called when settings list is closed. |
880 This slot is called when the setting list is closed. |
830 */ |
881 */ |
831 void HbInputVkbWidget::settingsClosed() |
882 void HbInputVkbWidget::settingsClosed() |
832 { |
883 { |
833 Q_D(HbInputVkbWidget); |
884 Q_D(HbInputVkbWidget); |
834 |
|
835 HbInputButtonGroup *buttonGroup = static_cast<HbInputButtonGroup *>(contentItem()); |
885 HbInputButtonGroup *buttonGroup = static_cast<HbInputButtonGroup *>(contentItem()); |
836 if (buttonGroup) { |
886 if (buttonGroup) { |
837 HbInputButton *item = buttonGroup->button(HbInputButton::ButtonKeyCodeSettings); |
887 HbInputButton *item = buttonGroup->button(HbInputButton::ButtonKeyCodeSettings); |
838 if (item) { |
888 if (item) { |
839 item->setState(HbInputButton::ButtonStateReleased); |
889 item->setState(HbInputButton::ButtonStateReleased); |
840 buttonGroup->setButton(item, HbInputButton::ButtonKeyCodeSettings); |
890 buttonGroup->setButton(item, HbInputButton::ButtonKeyCodeSettings); |
841 } |
891 } |
842 } |
892 } |
843 |
893 emit settingsListClosed(); |
844 d->mSettingsListOpen = false; |
894 d->mSettingsDialogsOpen--; |
845 if (d->mAnimateWhenDialogCloses) { |
895 if (!d->mSettingsDialogsOpen){ |
846 animKeyboardChange(); |
896 if (d->mAnimateWhenDialogCloses) { |
847 d->mAnimateWhenDialogCloses = false; |
897 animKeyboardChange(); |
848 } else if (d->mScreenshotTimeLine.state() != QTimeLine::Running) { |
898 d->mAnimateWhenDialogCloses = false; |
849 keypadLanguageChangeFinished(); |
899 } else if (d->mScreenshotTimeLine.state() != QTimeLine::Running) { |
850 } |
900 keypadLanguageChangeFinished(); |
851 } |
901 } |
852 |
902 } |
853 /*! |
903 } |
854 Closes settings list |
904 |
|
905 /*! |
|
906 Closes the setting list. |
855 */ |
907 */ |
856 void HbInputVkbWidget::closeSettingList() |
908 void HbInputVkbWidget::closeSettingList() |
857 { |
909 { |
858 Q_D(HbInputVkbWidget); |
910 Q_D(HbInputVkbWidget); |
859 d->mSettingList->close(); |
911 d->mSettingList->close(); |
860 } |
912 } |
861 |
913 |
862 /*! |
914 /*! |
863 Shows settings view |
915 Shows the Control Panel input settings content in a popup widget. |
864 */ |
916 */ |
865 void HbInputVkbWidget::showSettingsView() |
917 void HbInputVkbWidget::showSettingsView() |
866 { |
918 { |
867 Q_D(HbInputVkbWidget); |
919 Q_D(HbInputVkbWidget); |
868 |
920 |
869 /* |
921 d->mSettingsDialogsOpen++; |
870 Added for vanilla input |
|
871 When settings dialog is launched, keypad is not closed. |
|
872 */ |
|
873 HbInputFocusObject *focusObject = 0; |
|
874 if (!d->mOwner || !(focusObject = d->mOwner->focusObject())) { |
|
875 return; |
|
876 } |
|
877 HbVkbHost *vkbHost = focusObject->editorInterface().vkbHost(); |
|
878 if (vkbHost && vkbHost->keypadStatus() != HbVkbHost::HbVkbStatusClosed) { |
|
879 vkbHost->closeKeypad(); |
|
880 } |
|
881 d->mCurrentFocusedObject = focusObject->object(); |
|
882 |
|
883 closeSettingList(); |
922 closeSettingList(); |
884 if(!d->mSettingView) { |
923 |
885 d->mSettingView = new HbView(this); |
924 d->mSettingPopup = new HbInputSettingPopup(); |
886 HbAction *backAction = new HbAction(Hb::BackNaviAction, d->mSettingView); |
925 |
887 backAction->setText(tr("Back")); |
926 connect(d->mSettingPopup, SIGNAL(dialogClosed()), this, SLOT(closeSettingsView())); |
888 connect(backAction, SIGNAL(triggered(bool)), this, SLOT(closeSettingsView())); |
927 d->mSettingPopup->show(); |
889 d->mSettingView->setNavigationAction(backAction); |
928 } |
890 HbDataForm *dataForm = new HbDataForm(); |
929 |
891 d->mSettingView->setWidget(dataForm); |
930 /*! |
892 d->mSettingWidget = new HbInputSettingWidget(dataForm, d->mSettingView); |
931 Closes the input settings popup and returns to the previous view. |
893 } |
|
894 d->mSettingWidget->initializeWidget(); |
|
895 HbInputRegionCollector::instance()->attach(d->mSettingView); |
|
896 d->mSettingView->setTitle(tr("Input Settings")); |
|
897 mainWindow()->addView(d->mSettingView); |
|
898 d->mCurrentView = mainWindow()->currentView(); |
|
899 mainWindow()->setCurrentView(d->mSettingView); |
|
900 } |
|
901 |
|
902 /*! |
|
903 Closes settings view and returns to previous view |
|
904 */ |
932 */ |
905 void HbInputVkbWidget::closeSettingsView() |
933 void HbInputVkbWidget::closeSettingsView() |
906 { |
934 { |
907 Q_D(HbInputVkbWidget); |
935 Q_D(HbInputVkbWidget); |
908 |
936 d->mSettingPopup->deleteLater(); |
909 mainWindow()->setCurrentView(d->mCurrentView); |
937 d->mSettingPopup = 0; |
910 mainWindow()->removeView(d->mSettingView); |
938 d->mSettingsDialogsOpen--; |
911 if (d->mSettingView->scene()) { |
939 if (!d->mSettingsDialogsOpen){ |
912 d->mSettingView->scene()->removeItem(d->mSettingView); |
940 if (d->mAnimateWhenDialogCloses) { |
913 } |
941 animKeyboardChange(); |
914 HbInputRegionCollector::instance()->detach(d->mSettingView); |
942 d->mAnimateWhenDialogCloses = false; |
915 d->mSettingWidget->resetWidget(); |
943 } else if (d->mScreenshotTimeLine.state() != QTimeLine::Running) { |
916 |
944 keypadLanguageChangeFinished(); |
917 if (d->mCurrentFocusedObject) { |
945 } |
918 HbInputFocusObject *focusObject = new HbInputFocusObject(d->mCurrentFocusedObject); |
|
919 d->mOwner->setFocusObject(focusObject); |
|
920 d->mCurrentFocusedObject = 0; |
|
921 } |
946 } |
922 } |
947 } |
923 |
948 |
924 /*! |
949 /*! |
925 \deprecated HbInputVkbWidget::executeMethodDialog() |
950 \deprecated HbInputVkbWidget::executeMethodDialog() |
984 |
1009 |
985 return ret; |
1010 return ret; |
986 } |
1011 } |
987 |
1012 |
988 /*! |
1013 /*! |
989 \deprecated HbInputVkbWidget::rockerPosition() |
1014 Sets the status of the background drawing. This method can be used to optimize |
990 is deprecated. |
1015 virtual keyboard widget drawing. If it is known that the widget will cover |
991 |
1016 the whole virtual keyboard area and there are no places where the background |
992 Returns the virtual rocker position. The default position is in the middle |
1017 shows through, then the background drawing can be turned off to speed up |
993 of keypad button area. |
1018 the paint() function. |
994 */ |
|
995 QPointF HbInputVkbWidget::rockerPosition() |
|
996 { |
|
997 return QPointF(); |
|
998 } |
|
999 |
|
1000 /*! |
|
1001 Sets the status of the background drawing. This method can be used to |
|
1002 optimize vkb widget drawing. If it is known that the widget will cover whole |
|
1003 vkb area and there are no places where the background shows through, then the background |
|
1004 drawing can be turned off to speed up paint method. |
|
1005 */ |
1019 */ |
1006 void HbInputVkbWidget::setBackgroundDrawing(bool backgroundEnabled) |
1020 void HbInputVkbWidget::setBackgroundDrawing(bool backgroundEnabled) |
1007 { |
1021 { |
1008 Q_D(HbInputVkbWidget); |
1022 Q_D(HbInputVkbWidget); |
1009 d->mDrawbackground = backgroundEnabled; |
1023 d->mDrawbackground = backgroundEnabled; |
1010 } |
1024 } |
1011 |
1025 |
1012 |
1026 /*! |
1013 /*! |
1027 Returns all the possible keys that the user could have intended to press |
1014 Returns all possible keys that the user could have intended to press |
1028 for the last registered touch along with their corresponding probabilities. |
1015 for the last registered touch along with their corresponding probability. |
|
1016 */ |
1029 */ |
1017 QList<HbKeyPressProbability> HbInputVkbWidget::probableKeypresses() |
1030 QList<HbKeyPressProbability> HbInputVkbWidget::probableKeypresses() |
1018 { |
1031 { |
1019 QList<HbKeyPressProbability> probabilities; |
1032 QList<HbKeyPressProbability> probabilities; |
1020 HbInputButtonGroup *buttonGroup = static_cast<HbInputButtonGroup *>(contentItem()); |
1033 HbInputButtonGroup *buttonGroup = static_cast<HbInputButtonGroup *>(contentItem()); |
1187 d->mScreenshotWidget->setPos(position.x() + direction * rect.width(), position.y()); |
1201 d->mScreenshotWidget->setPos(position.x() + direction * rect.width(), position.y()); |
1188 setPos(position); |
1202 setPos(position); |
1189 } |
1203 } |
1190 } |
1204 } |
1191 |
1205 |
|
1206 /*! |
|
1207 Cleans up at the end of an animation when the keypad language is changed. |
|
1208 */ |
1192 void HbInputVkbWidget::keypadLanguageChangeFinished() |
1209 void HbInputVkbWidget::keypadLanguageChangeFinished() |
1193 { |
1210 { |
1194 Q_D(HbInputVkbWidget); |
1211 Q_D(HbInputVkbWidget); |
1195 delete d->mScreenshotWidget; |
1212 delete d->mScreenshotWidget; |
1196 d->mScreenshotWidget = 0; |
1213 d->mScreenshotWidget = 0; |
1197 d->mFlickDirection = HbFlickDirectionNone; |
1214 d->mFlickDirection = HbFlickDirectionNone; |
1198 } |
1215 } |
1199 |
1216 |
|
1217 /*! |
|
1218 Controls the start of an animation when the keyboard is changed. |
|
1219 */ |
1200 void HbInputVkbWidget::animKeyboardChange() |
1220 void HbInputVkbWidget::animKeyboardChange() |
1201 { |
1221 { |
1202 Q_D(HbInputVkbWidget); |
1222 Q_D(HbInputVkbWidget); |
1203 if (mainWindow()) { |
1223 if (mainWindow()) { |
1204 if (d->mSettingsListOpen) { |
1224 if (d->mSettingsDialogsOpen) { |
1205 d->mAnimateWhenDialogCloses = true; |
1225 d->mAnimateWhenDialogCloses = true; |
1206 } else { |
1226 } else { |
1207 if (!d->mAnimateWhenDialogCloses) { |
1227 if (!d->mAnimateWhenDialogCloses) { |
1208 d->captureScreenshot(); |
1228 d->captureScreenshot(); |
1209 } |
1229 } |
1210 connect(&d->mScreenshotTimeLine, SIGNAL(valueChanged(qreal)), this, SLOT(keypadLanguageChangeAnimationUpdate(qreal))); |
1230 connect(&d->mScreenshotTimeLine, SIGNAL(valueChanged(qreal)), this, SLOT(keypadLanguageChangeAnimationUpdate(qreal))); |
1211 connect(&d->mScreenshotTimeLine, SIGNAL(finished()), this, SLOT(keypadLanguageChangeFinished())); |
1231 connect(&d->mScreenshotTimeLine, SIGNAL(finished()), this, SLOT(keypadLanguageChangeFinished())); |
|
1232 d->mScreenshotWidget->show(); |
1212 d->mScreenshotTimeLine.start(); |
1233 d->mScreenshotTimeLine.start(); |
1213 } |
1234 } |
1214 } |
1235 } |
1215 } |
1236 } |
1216 |
1237 |
1254 } |
1275 } |
1255 HbWidget::changeEvent(event); |
1276 HbWidget::changeEvent(event); |
1256 } |
1277 } |
1257 |
1278 |
1258 /*! |
1279 /*! |
1259 \reimp |
1280 Handles gesture events. |
1260 */ |
1281 */ |
1261 void HbInputVkbWidget::gestureEvent(QGestureEvent *event) |
1282 void HbInputVkbWidget::gestureEvent(QGestureEvent *event) |
1262 { |
1283 { |
1263 Q_D(HbInputVkbWidget); |
1284 Q_D(HbInputVkbWidget); |
|
1285 |
|
1286 // Ignore gesture events if previous flick event is being handled |
|
1287 if (d->mFlickDirection != HbFlickDirectionNone) { |
|
1288 return; |
|
1289 } |
1264 |
1290 |
1265 if (HbSwipeGesture *gesture = qobject_cast<HbSwipeGesture *>(event->gesture(Qt::SwipeGesture))) { |
1291 if (HbSwipeGesture *gesture = qobject_cast<HbSwipeGesture *>(event->gesture(Qt::SwipeGesture))) { |
1266 if (gesture->state() == Qt::GestureFinished) { |
1292 if (gesture->state() == Qt::GestureFinished) { |
1267 HbWidgetFeedback::triggered(this, Hb::InstantFlicked); |
|
1268 // vertical swipes |
1293 // vertical swipes |
1269 if (gesture->sceneVerticalDirection() == QSwipeGesture::Down) { |
1294 if (gesture->sceneVerticalDirection() == QSwipeGesture::Down) { |
1270 d->mFlickDirection = HbFlickDirectionDown; |
1295 d->mFlickDirection = HbFlickDirectionDown; |
|
1296 HbWidgetFeedback::triggered(this, Hb::InstantFlicked); |
1271 emit flickEvent(d->mFlickDirection); |
1297 emit flickEvent(d->mFlickDirection); |
1272 emit keypadCloseEventDetected(HbVkbCloseMethodCloseGesture); |
1298 emit keypadCloseEventDetected(HbVkbCloseMethodCloseGesture); |
1273 } else if (gesture->sceneVerticalDirection() == QSwipeGesture::Up) { |
1299 } else if (gesture->sceneVerticalDirection() != QSwipeGesture::Up) { |
1274 d->mFlickDirection = HbFlickDirectionUp; |
|
1275 emit flickEvent(d->mFlickDirection); |
|
1276 d->mCurrentHost->openKeypad(d->mCurrentHost->activeKeypad(), d->mOwner); |
|
1277 } else { |
|
1278 d->mFlickDirection = (HbInputVkbWidget::HbFlickDirection)gesture->sceneHorizontalDirection(); |
1300 d->mFlickDirection = (HbInputVkbWidget::HbFlickDirection)gesture->sceneHorizontalDirection(); |
1279 // horizontal swipes |
1301 // horizontal swipes |
1280 if (d->mFlickAnimation) { |
1302 if (d->mFlickAnimation) { |
1281 animKeyboardChange(); |
1303 animKeyboardChange(); |
1282 } |
1304 } |
1283 emit flickEvent(d->mFlickDirection); |
1305 emit flickEvent(d->mFlickDirection); |
|
1306 // If keyboard change is not animated, flick direction should |
|
1307 // be set to none immediately since otherwise it won't be changed |
|
1308 if (!d->mFlickAnimation) { |
|
1309 d->mFlickDirection = HbFlickDirectionNone; |
|
1310 } |
1284 } |
1311 } |
1285 } |
1312 } |
1286 } else if (HbTapGesture *gesture = qobject_cast<HbTapGesture *>(event->gesture(Qt::TapGesture))) { |
1313 } |
1287 if (gesture->state() == Qt::GestureFinished) { |
1314 } |
1288 // if keypad is minimized, open it |
1315 |
1289 if (d->mCurrentHost && d->mCurrentHost->keypadStatus() == HbVkbHost::HbVkbStatusMinimized) { |
1316 /*! |
1290 d->mCurrentHost->openKeypad(this, d->mOwner); |
1317 Returns the icon drawer of the object. |
1291 } |
1318 */ |
1292 } |
1319 HbFrameDrawer* HbInputVkbWidget::iconDrawer() |
1293 } |
1320 { |
1294 } |
1321 Q_D(HbInputVkbWidget); |
1295 |
1322 return d->mIconDrawer; |
|
1323 } |
|
1324 |
|
1325 /*! |
|
1326 \fn void HbInputVkbWidget::keypadCloseEventDetected(HbInputVkbWidget::HbVkbCloseMethod closeMethod) |
|
1327 This signal informs that a closing event for the touch keypad was detected. |
|
1328 */ |
|
1329 |
|
1330 /*! |
|
1331 \fn void HbInputVkbWidget::flickEvent(HbInputVkbWidget::HbFlickDirection direction) |
|
1332 This signal is emitted when a flick (swipe) gesture is detected. |
|
1333 */ |
|
1334 |
|
1335 /*! |
|
1336 \fn void HbInputVkbWidget::smileySelected(QString text) |
|
1337 This signal informs that a smiley was selected. |
|
1338 */ |
|
1339 |
|
1340 /*! |
|
1341 \fn void HbInputVkbWidget::mouseMovedOutOfButton() |
|
1342 This signal informs that the mouse was moved out of the pressed button. |
|
1343 */ |
|
1344 |
|
1345 /*! |
|
1346 \fn void HbInputVkbWidget::aboutToActivateCustomAction(HbAction *custAction) |
|
1347 This signal is emitted when the user presses the editor-specific custom button. |
|
1348 */ |
|
1349 |
|
1350 /*! |
|
1351 \fn void HbInputVkbWidget::settingsListClosed() |
|
1352 This signal is emitted when the setting list is closed. |
|
1353 */ |
1296 #include "moc_hbinputvkbwidget.cpp" |
1354 #include "moc_hbinputvkbwidget.cpp" |
1297 |
1355 |
1298 // End of file |
1356 // End of file |