src/hbfeedback/player/hbfeedbackplayer_symbian.cpp
changeset 1 f7ac710697a9
parent 0 16d8024aca5e
child 2 06ff229162e9
equal deleted inserted replaced
0:16d8024aca5e 1:f7ac710697a9
    59     inline TTouchLogicalFeedback convertToSymbian(HbFeedback::InstantEffect effect);
    59     inline TTouchLogicalFeedback convertToSymbian(HbFeedback::InstantEffect effect);
    60     inline TTacticonType convertTacticonToSymbian(HbFeedback::InstantEffect effect);
    60     inline TTacticonType convertTacticonToSymbian(HbFeedback::InstantEffect effect);
    61     inline TTacticonType convertTacticonToSymbian(HbFeedback::TacticonEffect effect);
    61     inline TTacticonType convertTacticonToSymbian(HbFeedback::TacticonEffect effect);
    62     inline TTouchContinuousFeedback convertToSymbian(HbFeedback::ContinuousEffect effect);
    62     inline TTouchContinuousFeedback convertToSymbian(HbFeedback::ContinuousEffect effect);
    63     inline TTouchEventType convertToSymbian(HbFeedback::HitAreaType hitAreaType);
    63     inline TTouchEventType convertToSymbian(HbFeedback::HitAreaType hitAreaType);
       
    64     inline TTouchFeedbackType convertToSymbian(HbFeedback::Modalities modalities);
    64 			
    65 			
    65 public:
    66 public:
    66     MTouchFeedback *iFeedback;
    67     MTouchFeedback *iFeedback;
    67     RTacticon iTacticon;
    68     RTacticon iTacticon;
    68     TBool iTacticonReady;
    69     TBool iTacticonReady;
   207         instantFeedbackSymbian = ETouchFeedbackBasic; // Effects changing in 10.1 are mapped to basic.
   208         instantFeedbackSymbian = ETouchFeedbackBasic; // Effects changing in 10.1 are mapped to basic.
   208         break;
   209         break;
   209     case HbFeedback::PopUp:
   210     case HbFeedback::PopUp:
   210         instantFeedbackSymbian = ETouchFeedbackPopUp;
   211         instantFeedbackSymbian = ETouchFeedbackPopUp;
   211         break;
   212         break;
       
   213     case HbFeedback::LongPress:
       
   214         instantFeedbackSymbian = ETouchFeedbackBasic; // Effects changing in 10.1 are mapped to basic.
       
   215         break;
   212     default:
   216     default:
   213         break;
   217         break;
   214     }
   218     }
   215     return instantFeedbackSymbian;
   219     return instantFeedbackSymbian;
   216 }
   220 }
   296         touchEventType = ETouchEventStylusDown;
   300         touchEventType = ETouchEventStylusDown;
   297     }
   301     }
   298     return touchEventType;
   302     return touchEventType;
   299 }
   303 }
   300 
   304 
   301 
   305 TTouchFeedbackType HbFeedbackBasePlayerPrivate::convertToSymbian(HbFeedback::Modalities modalities)
   302 CCoeControl* HbFeedbackBasePlayerPrivate::convertToSymbian(QWidget* window) {
   306 {
   303 
   307     int symbianFeedbackType = 0;
       
   308 
       
   309     if(modalities == HbFeedback::All) {
       
   310         // enable all modalities
       
   311         symbianFeedbackType |= ETouchFeedbackAudio;
       
   312         symbianFeedbackType |= ETouchFeedbackVibra;
       
   313     } else {
       
   314         // enable individual modalities
       
   315         if(modalities & HbFeedback::Audio)   symbianFeedbackType |= ETouchFeedbackAudio;
       
   316         if(modalities & HbFeedback::Tactile) symbianFeedbackType |= ETouchFeedbackVibra;
       
   317     }
       
   318     return TTouchFeedbackType(symbianFeedbackType);
       
   319 }
       
   320 
       
   321 CCoeControl* HbFeedbackBasePlayerPrivate::convertToSymbian(QWidget* window)
       
   322 {
   304     CCoeControl* control = 0;
   323     CCoeControl* control = 0;
   305     
   324     
   306     if ( window && window->winId()) {
   325     if ( window && window->winId()) {
   307         control = reinterpret_cast<CCoeControl*>(window->winId());
   326         control = reinterpret_cast<CCoeControl*>(window->winId());
   308     }
   327     }
   346 
   365 
   347     d->ongoingContinuousFeedbacks.clear();
   366     d->ongoingContinuousFeedbacks.clear();
   348 }
   367 }
   349 
   368 
   350 void HbFeedbackBasePlayer::playInstantFeedback(const HbInstantFeedback& feedback) {
   369 void HbFeedbackBasePlayer::playInstantFeedback(const HbInstantFeedback& feedback) {
       
   370     TPointerEvent pointerEvent;
   351 
   371 
   352     if (d->iFeedback) {
   372     if (d->iFeedback) {
   353         // If the effect is a tacticon, use the tacticon playing mechanism of the feedback player
   373         // If the effect is a tacticon, use the tacticon playing mechanism of the feedback player
   354         if (feedback.instantEffect() == HbFeedback::PositiveTacticon ||
   374         if (feedback.instantEffect() == HbFeedback::PositiveTacticon ||
   355             feedback.instantEffect() == HbFeedback::NeutralTacticon  ||
   375             feedback.instantEffect() == HbFeedback::NeutralTacticon  ||
   358                 d->iTacticon.PlayTacticon(d->convertTacticonToSymbian(feedback.instantEffect()));
   378                 d->iTacticon.PlayTacticon(d->convertTacticonToSymbian(feedback.instantEffect()));
   359             }
   379             }
   360         } else {
   380         } else {
   361             CCoeControl* control = d->convertToSymbian(feedback.window());
   381             CCoeControl* control = d->convertToSymbian(feedback.window());
   362             if (control) {
   382             if (control) {
   363                 d->iFeedback->InstantFeedback(control, d->convertToSymbian(feedback.instantEffect()));
   383                 d->iFeedback->InstantFeedback(control, d->convertToSymbian(feedback.instantEffect()),
   364             }
   384                                               d->convertToSymbian(feedback.modalities()),pointerEvent);
   365             else {
   385             } else {
   366                 d->iFeedback->InstantFeedback(d->convertToSymbian(feedback.instantEffect()));
   386                 d->iFeedback->InstantFeedback(d->convertToSymbian(feedback.instantEffect()));
   367             }
   387             }
   368         }
   388         }
   369     }
   389     }
   370 }
   390 }