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 <hbpushbutton.h> |
|
53 #include <hbinputmethod.h> |
51 #include <hbinputmethod.h> |
54 #include <hbinputsettingproxy.h> |
52 #include <hbinputsettingproxy.h> |
55 #include <hbinpututils.h> |
53 #include <hbinpututils.h> |
56 #include <hbinputdef.h> |
54 #include <hbinputdef.h> |
57 #include <hbinputvkbhost.h> |
55 #include <hbinputvkbhost.h> |
58 #include <hbinputvkbhostbridge.h> |
56 #include <hbinputvkbhostbridge.h> |
59 #include <hbinputsettingwidget.h> |
|
60 #include <hbinputcommondialogs.h> |
57 #include <hbinputcommondialogs.h> |
61 #include <hbinputkeymap.h> |
58 #include <hbinputkeymap.h> |
62 #include <hbinputkeymapfactory.h> |
59 #include <hbinputkeymapfactory.h> |
63 #include <hbwidgetfeedback.h> |
60 #include <hbwidgetfeedback.h> |
64 #include <hbinputpredictionfactory.h> |
61 #include <hbinputpredictionfactory.h> |
71 |
68 |
72 #include "hbinputsettinglist.h" |
69 #include "hbinputsettinglist.h" |
73 #include "hbinputmodeindicator.h" |
70 #include "hbinputmodeindicator.h" |
74 #include "hbinputsmileypicker.h" |
71 #include "hbinputsmileypicker.h" |
75 #include "hbinputscreenshotwidget.h" |
72 #include "hbinputscreenshotwidget.h" |
|
73 #include "hbinputsettingpopup.h" |
76 |
74 |
77 const int HB_DIGIT_LATIN_START_VALUE = 0x0030; |
75 const int HB_DIGIT_LATIN_START_VALUE = 0x0030; |
78 const int HB_DIGIT_ARABIC_INDIC_START_VALUE = 0x0660; |
76 const int HB_DIGIT_ARABIC_INDIC_START_VALUE = 0x0660; |
79 const int HB_DIGIT_EASTERN_ARABIC_START_VALUE = 0x06F0; |
77 const int HB_DIGIT_EASTERN_ARABIC_START_VALUE = 0x06F0; |
80 const int HB_DIGIT_DEVANAGARI_START_VALUE = 0x0966; |
78 const int HB_DIGIT_DEVANAGARI_START_VALUE = 0x0966; |
81 |
|
82 const int HbTitlePaneHeight = 20; |
|
83 |
79 |
84 const qreal HbPortraitSmileyPickerHeightInUnits = 43.7; |
80 const qreal HbPortraitSmileyPickerHeightInUnits = 43.7; |
85 const qreal HbPortraitSmileyPickerWidthInUnits = 47.8; |
81 const qreal HbPortraitSmileyPickerWidthInUnits = 47.8; |
86 const qreal HbLandscapeSmileyPickerHeightInUnits = 31.9; |
82 const qreal HbLandscapeSmileyPickerHeightInUnits = 31.9; |
87 const qreal HbLandscapeSmileyPickerWidthInUnits = 83.4; |
83 const qreal HbLandscapeSmileyPickerWidthInUnits = 83.4; |
88 const qreal HbSmileyPickerMarginInUnits = 0.9; |
84 const qreal HbSmileyPickerMarginInUnits = 0.9; |
89 |
85 |
90 |
86 |
91 /*! |
87 /*! |
92 @proto |
88 @stable |
93 @hbinput |
89 @hbinput |
94 \class HbInputVkbWidget |
90 \class HbInputVkbWidget |
95 \brief A base class for touch keypads. |
91 \brief A base class for touch keypads. |
96 |
92 |
97 This class implements default mechanisms for opening and closing touch keypads. |
93 This class implements default mechanisms for opening and closing touch keypads. |
98 It know how to operate in landscape and in portait modes and it know how |
94 It know how to operate in landscape and in portait modes and it know how |
99 implement split view -mechasnism for S60 QT UI's Hb library. It also implements |
95 implement split view -mechasnism for S60 QT UI's Hb library. It also implements |
100 closing mechansim, where used is able to close the touch keypad by sliding it downwards |
96 closing mechanism, where used is able to close the touch keypad by sliding it downwards |
101 with a finger. This class also implements background drawing for touch keypads. |
97 with a finger. This class also implements background drawing for touch keypads. |
102 */ |
98 */ |
103 |
99 |
104 /// @cond |
100 /// @cond |
105 |
101 |
139 mAnimateWhenDialogCloses(false), |
135 mAnimateWhenDialogCloses(false), |
140 mKeyboardSize(HbQwerty4x10), |
136 mKeyboardSize(HbQwerty4x10), |
141 mCloseHandleHeight(0), |
137 mCloseHandleHeight(0), |
142 mCloseHandle(0), |
138 mCloseHandle(0), |
143 mKeyboardDimmed(false), |
139 mKeyboardDimmed(false), |
144 mSettingView(0), |
|
145 mSettingPopup(0) |
140 mSettingPopup(0) |
146 { |
141 { |
147 mScreenshotTimeLine.setUpdateInterval(16); |
142 mScreenshotTimeLine.setUpdateInterval(16); |
148 } |
143 } |
149 |
144 |
150 |
145 |
151 HbInputVkbWidgetPrivate::~HbInputVkbWidgetPrivate() |
146 HbInputVkbWidgetPrivate::~HbInputVkbWidgetPrivate() |
152 { |
147 { |
153 delete mSettingList; |
148 delete mSettingList; |
154 delete mSettingPopup; |
|
155 delete mBackgroundDrawer; |
149 delete mBackgroundDrawer; |
156 delete mIconDrawer; |
150 delete mIconDrawer; |
157 delete mSmileyPicker; |
151 delete mSmileyPicker; |
158 delete mScreenshotWidget; |
152 delete mScreenshotWidget; |
159 } |
153 } |
423 Q_Q(HbInputVkbWidget); |
417 Q_Q(HbInputVkbWidget); |
424 |
418 |
425 if (!descriptor.isEmpty() && mOwner) { |
419 if (!descriptor.isEmpty() && mOwner) { |
426 // Set as active input method. |
420 // Set as active input method. |
427 HbInputSettingProxy::instance()->setPreferredInputMethod(q->mainWindow()->orientation(), descriptor, customData); |
421 HbInputSettingProxy::instance()->setPreferredInputMethod(q->mainWindow()->orientation(), descriptor, customData); |
428 // Activate immediately. |
422 if (HbInputSettingProxy::instance()->globalInputLanguage().language() == QLocale::Chinese && |
429 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 } |
430 } |
434 } |
431 } |
435 } |
432 |
436 |
433 void HbInputVkbWidgetPrivate::_q_smileyPickerClosed() |
437 void HbInputVkbWidgetPrivate::_q_smileyPickerClosed() |
434 { |
438 { |
853 Q_D(HbInputVkbWidget); |
857 Q_D(HbInputVkbWidget); |
854 |
858 |
855 d->mSettingsDialogsOpen++; |
859 d->mSettingsDialogsOpen++; |
856 closeSettingList(); |
860 closeSettingList(); |
857 |
861 |
858 d->mSettingPopup = new HbDialog(); |
862 d->mSettingPopup = new HbInputSettingPopup(); |
859 |
863 |
860 HbPushButton *button = new HbPushButton(); |
864 connect(d->mSettingPopup, SIGNAL(dialogClosed()), this, SLOT(closeSettingsView())); |
861 HbIcon backIcon = HbIcon("qtg_mono_back"); |
|
862 button->setIcon(backIcon); |
|
863 button->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); |
|
864 connect(button, SIGNAL(clicked()), this, SLOT(closeSettingsView())); |
|
865 d->mSettingView = new HbView(); |
|
866 QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical); |
|
867 HbDataForm *dataForm = new HbDataForm(); |
|
868 HbInputSettingWidget *settingWidget = new HbInputSettingWidget(dataForm, d->mSettingView); |
|
869 settingWidget->initializeWidget(); |
|
870 |
|
871 layout->addItem(button); |
|
872 layout->setAlignment(button, Qt::AlignRight); |
|
873 layout->addItem(dataForm); |
|
874 d->mSettingView->setLayout(layout); |
|
875 HbInputRegionCollector::instance()->attach(d->mSettingView); |
|
876 |
|
877 d->mSettingPopup->setContentWidget(d->mSettingView); |
|
878 d->mSettingPopup->setModal(true); |
|
879 d->mSettingPopup->setPreferredPos(QPoint(0,HbTitlePaneHeight)); |
|
880 d->mSettingPopup->setPreferredSize(QSize(mainWindow()->width(), mainWindow()->height()-HbTitlePaneHeight)); |
|
881 QSizeF popupSize = static_cast<QSizeF>(HbDeviceProfile::profile(mainWindow()).logicalSize()); |
|
882 |
|
883 d->mSettingPopup->setPreferredSize(popupSize); |
|
884 d->mSettingPopup->setDismissPolicy(HbPopup::NoDismiss); |
|
885 d->mSettingPopup->setTimeout(HbPopup::NoTimeout); |
|
886 d->mSettingPopup->show(); |
865 d->mSettingPopup->show(); |
887 } |
866 } |
888 |
867 |
889 /*! |
868 /*! |
890 Closes settings view and returns to previous view |
869 Closes settings view and returns to previous view |
891 */ |
870 */ |
892 void HbInputVkbWidget::closeSettingsView() |
871 void HbInputVkbWidget::closeSettingsView() |
893 { |
872 { |
894 Q_D(HbInputVkbWidget); |
873 Q_D(HbInputVkbWidget); |
895 HbInputRegionCollector::instance()->detach(d->mSettingView); |
|
896 d->mSettingPopup->close(); |
|
897 d->mSettingPopup->deleteLater(); |
874 d->mSettingPopup->deleteLater(); |
898 d->mSettingPopup = 0; |
875 d->mSettingPopup = 0; |
899 d->mSettingsDialogsOpen--; |
876 d->mSettingsDialogsOpen--; |
900 if (!d->mSettingsDialogsOpen){ |
877 if (!d->mSettingsDialogsOpen){ |
901 if (d->mAnimateWhenDialogCloses) { |
878 if (d->mAnimateWhenDialogCloses) { |
1041 // get the smiley list from editor interface smiley theme. |
1018 // get the smiley list from editor interface smiley theme. |
1042 QStringList smileys = focusObject->editorInterface().smileyTheme().smileys(); |
1019 QStringList smileys = focusObject->editorInterface().smileyTheme().smileys(); |
1043 |
1020 |
1044 if (!smileys.isEmpty()) { |
1021 if (!smileys.isEmpty()) { |
1045 d->mSmileyPicker = new HbInputSmileyPicker(rows, columns, 0, smileys); |
1022 d->mSmileyPicker = new HbInputSmileyPicker(rows, columns, 0, smileys); |
|
1023 // workaround start |
|
1024 QEvent event(QEvent::Polish); |
|
1025 QApplication::sendEvent(d->mSmileyPicker, &event); |
|
1026 // workaround end |
1046 d->mSmileyPicker->setObjectName("vkbwidget_smiley_picker"); |
1027 d->mSmileyPicker->setObjectName("vkbwidget_smiley_picker"); |
1047 connect(d->mSmileyPicker, SIGNAL(selected(QString)), this, SIGNAL(smileySelected(QString))); |
1028 connect(d->mSmileyPicker, SIGNAL(selected(QString)), this, SIGNAL(smileySelected(QString))); |
1048 } |
1029 } |
1049 } |
1030 } |
1050 |
1031 |
1241 return; |
1222 return; |
1242 } |
1223 } |
1243 |
1224 |
1244 if (HbSwipeGesture *gesture = qobject_cast<HbSwipeGesture *>(event->gesture(Qt::SwipeGesture))) { |
1225 if (HbSwipeGesture *gesture = qobject_cast<HbSwipeGesture *>(event->gesture(Qt::SwipeGesture))) { |
1245 if (gesture->state() == Qt::GestureFinished) { |
1226 if (gesture->state() == Qt::GestureFinished) { |
1246 HbWidgetFeedback::triggered(this, Hb::InstantFlicked); |
|
1247 // vertical swipes |
1227 // vertical swipes |
1248 if (gesture->sceneVerticalDirection() == QSwipeGesture::Down) { |
1228 if (gesture->sceneVerticalDirection() == QSwipeGesture::Down) { |
1249 d->mFlickDirection = HbFlickDirectionDown; |
1229 d->mFlickDirection = HbFlickDirectionDown; |
|
1230 HbWidgetFeedback::triggered(this, Hb::InstantFlicked); |
1250 emit flickEvent(d->mFlickDirection); |
1231 emit flickEvent(d->mFlickDirection); |
1251 emit keypadCloseEventDetected(HbVkbCloseMethodCloseGesture); |
1232 emit keypadCloseEventDetected(HbVkbCloseMethodCloseGesture); |
1252 } else if (gesture->sceneVerticalDirection() != QSwipeGesture::Up) { |
1233 } else if (gesture->sceneVerticalDirection() != QSwipeGesture::Up) { |
1253 d->mFlickDirection = (HbInputVkbWidget::HbFlickDirection)gesture->sceneHorizontalDirection(); |
1234 d->mFlickDirection = (HbInputVkbWidget::HbFlickDirection)gesture->sceneHorizontalDirection(); |
1254 // horizontal swipes |
1235 // horizontal swipes |