607 // ----------------------------------------------------------------------------- |
623 // ----------------------------------------------------------------------------- |
608 // |
624 // |
609 void LcUiEnginePrivate::StateChanged( MLcSession& aSession ) |
625 void LcUiEnginePrivate::StateChanged( MLcSession& aSession ) |
610 { |
626 { |
611 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::StateChanged( session )" ) |
627 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::StateChanged( session )" ) |
612 |
628 doUpdate( aSession ); |
613 MLcSession::TLcSessionState newState = MLcSession::EUninitialized; |
629 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::StateChanged( session )" ) |
614 newState = aSession.LcSessionState(); |
630 } |
615 |
631 |
616 LC_QDEBUG_2( "livecomms [UI] new state=", newState ) |
632 // ----------------------------------------------------------------------------- |
617 |
633 // LcUiEnginePrivate::StateChanged |
618 if ( newState == MLcSession::EOpen ) { |
634 // ----------------------------------------------------------------------------- |
619 LC_QDEBUG( "livecomms [UI] state is MLcSession::EOpen" ) |
635 // |
620 cancelCloseTimer(); |
636 void LcUiEnginePrivate::StateChanged( MLcVideoPlayer& aPlayer ) |
621 hideNotes( false ); |
637 { |
622 if( isAllowedToShareVideo() ) { |
638 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::StateChanged( player )" ) |
623 startLocalVideo(); |
639 emitViewLayoutChanged(); |
|
640 doUpdate( aPlayer ); |
|
641 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::StateChanged( player )" ) |
|
642 } |
|
643 |
|
644 // ----------------------------------------------------------------------------- |
|
645 // LcUiEnginePrivate::Updated |
|
646 // ----------------------------------------------------------------------------- |
|
647 // |
|
648 void LcUiEnginePrivate::Updated( MLcSession& aSession ) |
|
649 { |
|
650 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::Updated( session )" ) |
|
651 emitViewLayoutChanged(); |
|
652 doUpdate( aSession ); |
|
653 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::Updated( session )" ) |
|
654 } |
|
655 |
|
656 // ----------------------------------------------------------------------------- |
|
657 // LcUiEnginePrivate::Updated |
|
658 // ----------------------------------------------------------------------------- |
|
659 // |
|
660 void LcUiEnginePrivate::Updated( MLcVideoPlayer& aPlayer ) |
|
661 { |
|
662 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::Updated( player )" ) |
|
663 emitViewLayoutChanged(); |
|
664 doUpdate( aPlayer ); |
|
665 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::Updated( player )" ) |
|
666 } |
|
667 |
|
668 // ----------------------------------------------------------------------------- |
|
669 // LcUiEnginePrivate::Failed |
|
670 // ----------------------------------------------------------------------------- |
|
671 // |
|
672 void LcUiEnginePrivate::Failed( MLcSession& /*aSession*/, TInt /*aError*/ ) |
|
673 { |
|
674 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::Failed( session )" ) |
|
675 stop(); |
|
676 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::Failed( session )" ) |
|
677 } |
|
678 |
|
679 // ----------------------------------------------------------------------------- |
|
680 // LcUiEnginePrivate::Failed |
|
681 // ----------------------------------------------------------------------------- |
|
682 // |
|
683 void LcUiEnginePrivate::Failed( MLcVideoPlayer& /*aPlayer*/, TInt /*aError*/ ) |
|
684 { |
|
685 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::Failed( player )" ) |
|
686 stop(); |
|
687 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::Failed( player )" ) |
|
688 } |
|
689 |
|
690 // ----------------------------------------------------------------------------- |
|
691 // LcUiEnginePrivate::SessionTimeChanged |
|
692 // ----------------------------------------------------------------------------- |
|
693 // |
|
694 void LcUiEnginePrivate::SessionTimeChanged( MLcSession& /*aSession*/, |
|
695 const TTimeIntervalSeconds& /*aSeconds*/ ) |
|
696 { |
|
697 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::SessionTimeChanged()" ) |
|
698 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::SessionTimeChanged()" ) |
|
699 } |
|
700 |
|
701 // ----------------------------------------------------------------------------- |
|
702 // LcUiEnginePrivate::SelectRecipient |
|
703 // ----------------------------------------------------------------------------- |
|
704 // |
|
705 TBool LcUiEnginePrivate::SelectRecipient( MDesCArray& aRecipientAddresses, |
|
706 TDes& aSelectedRecipientAddress ) |
|
707 { |
|
708 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::SelectRecipient()" ) |
|
709 aSelectedRecipientAddress = aRecipientAddresses.MdcaPoint(0); |
|
710 mRecipient = DESC_TO_QSTRING( aSelectedRecipientAddress ); |
|
711 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::SelectRecipient()" ) |
|
712 return ETrue; |
|
713 } |
|
714 |
|
715 // ----------------------------------------------------------------------------- |
|
716 // LcUiEnginePrivate::SelectRecipient |
|
717 // ----------------------------------------------------------------------------- |
|
718 // |
|
719 TBool LcUiEnginePrivate::InputRecipient( TDes& aRecipientAddress ) |
|
720 { |
|
721 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::InputRecipient()" ) |
|
722 |
|
723 TBool answered( EFalse ); |
|
724 |
|
725 if ( mRecipientQuery ) { |
|
726 mRecipient = DESC_TO_QSTRING( aRecipientAddress ); |
|
727 HbLineEdit* lineEdit = new HbLineEdit( mRecipient ); |
|
728 mRecipientQuery->setContentWidget( lineEdit ); |
|
729 mRecipientQuery->open(); |
|
730 TPtrC16 textPtr( |
|
731 reinterpret_cast< const TUint16* >( mRecipient.utf16() ) ); |
|
732 aRecipientAddress.Copy( textPtr ); |
|
733 answered = ETrue; |
|
734 } |
|
735 |
|
736 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::InputRecipient()" ) |
|
737 return answered; |
|
738 } |
|
739 |
|
740 // ----------------------------------------------------------------------------- |
|
741 // LcUiEnginePrivate::HandleForegroundStatus |
|
742 // ----------------------------------------------------------------------------- |
|
743 // |
|
744 void LcUiEnginePrivate::HandleForegroundStatus( TBool aForeground ) |
|
745 { |
|
746 LC_QDEBUG_2( "livecomms [UI] -> LcUiEnginePrivate::HandleForegroundStatus(), fg:", |
|
747 aForeground ) |
|
748 |
|
749 mActivityManager->enableActivitySimulation(aForeground); |
|
750 |
|
751 if ( aForeground && !HbInstance::instance()->allMainWindows().isEmpty() ){ |
|
752 HbInstance::instance()->allMainWindows().at(0)->show(); |
|
753 } |
|
754 XQServiceUtil::toBackground(!aForeground); |
|
755 |
|
756 mIsMinimized = !aForeground; |
|
757 |
|
758 handleEngineForegroundStatus(); |
|
759 |
|
760 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::HandleForegroundStatus()" ) |
|
761 } |
|
762 |
|
763 // ----------------------------------------------------------------------------- |
|
764 // LcUiEnginePrivate::BlockUi |
|
765 // ----------------------------------------------------------------------------- |
|
766 // |
|
767 void LcUiEnginePrivate::BlockUi( TBool aBlocked ) |
|
768 { |
|
769 LC_QDEBUG_2( "livecomms [UI] -> LcUiEnginePrivate::BlockUi, blocked:", aBlocked ) |
|
770 mBlocked = aBlocked; |
|
771 |
|
772 if ( mBlocked ){ |
|
773 emit mUiEngine.blocked(); |
|
774 } |
|
775 else{ |
|
776 emit mUiEngine.unblocked(); |
|
777 completePendingAction(); |
|
778 } |
|
779 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::BlockUi()" ) |
|
780 } |
|
781 |
|
782 // ----------------------------------------------------------------------------- |
|
783 // LcUiEnginePrivate::setViewLayout |
|
784 // ----------------------------------------------------------------------------- |
|
785 // |
|
786 LcViewLayoutHint LcUiEnginePrivate::setViewLayout() |
|
787 { |
|
788 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::setViewLayout()" ) |
|
789 |
|
790 LcViewLayoutHint hint = (LcViewLayoutHint)Lc_NoViewLayout; |
|
791 |
|
792 MLcVideoPlayer* localPlayer = visibleLocalPlayer(); |
|
793 MLcVideoPlayer* remotePlayer = visibleRemotePlayer(); |
|
794 |
|
795 if ( usingVideoTelephoneEngine() ) { |
|
796 hint = Lc_AllInOneViewLayout; |
|
797 LC_QDEBUG( "livecomms [UI] use Lc_AllInOneViewLayout" ) |
|
798 } else if ( localPlayer && remotePlayer ) { |
|
799 hint = Lc_TwowayViewLayout; |
|
800 LC_QDEBUG( "livecomms [UI] use Lc_TwowayViewLayout" ) |
|
801 } else if ( localPlayer ) { |
|
802 hint = Lc_SharedViewLayout; |
|
803 LC_QDEBUG( "livecomms [UI] use Lc_SharedViewLayout" ) |
|
804 } else if ( remotePlayer && !session().LocalVideoPlayer() ) { |
|
805 hint = Lc_ReceivedOnlyViewLayout; |
|
806 LC_QDEBUG( "livecomms [UI] use Lc_ReceivedOnlyViewLayout" ) |
|
807 } else if ( remotePlayer ) { |
|
808 hint = Lc_ReceivedViewLayout; |
|
809 LC_QDEBUG( "livecomms [UI] use Lc_ReceivedViewLayout" ) |
|
810 } else { |
|
811 hint = Lc_IdleViewLayout; |
|
812 LC_QDEBUG( "livecomms [UI] ! no players ! use Lc_IdleViewLayout" ) |
|
813 } |
|
814 |
|
815 mViewLayout = hint; |
|
816 |
|
817 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::setViewLayout()" ) |
|
818 |
|
819 return viewLayout(); |
|
820 } |
|
821 |
|
822 // ----------------------------------------------------------------------------- |
|
823 // LcUiEnginePrivate::emitViewLayoutChanged |
|
824 // ----------------------------------------------------------------------------- |
|
825 // |
|
826 void LcUiEnginePrivate::emitViewLayoutChanged() |
|
827 { |
|
828 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::emitViewLayoutChanged()" ) |
|
829 |
|
830 LcViewLayoutHint oldLayout = viewLayout(); |
|
831 LcViewLayoutHint layout = setViewLayout(); |
|
832 |
|
833 if ( layout != oldLayout ) { |
|
834 LC_QDEBUG( "livecomms [UI] layout has changed. signal" ) |
|
835 emit mUiEngine.layoutChanged(); |
|
836 } |
|
837 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::emitViewLayoutChanged()" ) |
|
838 } |
|
839 |
|
840 // ----------------------------------------------------------------------------- |
|
841 // LcUiEnginePrivate::startLiveContent |
|
842 // ----------------------------------------------------------------------------- |
|
843 // |
|
844 void LcUiEnginePrivate::startLiveContent() |
|
845 { |
|
846 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::startLiveContent()" ) |
|
847 |
|
848 if ( mInvitingNote && featureSupported( CLcEngine::ELcShowInvitingNote ) ) { |
|
849 mInvitingNote->show(); |
|
850 } |
|
851 enableSpeaker( true ); |
|
852 establishSession(); |
|
853 |
|
854 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::startLiveContent()" ) |
|
855 } |
|
856 |
|
857 // ----------------------------------------------------------------------------- |
|
858 // LcUiEnginePrivate::startPlayback |
|
859 // Utility style function to start both local and remote players if available. |
|
860 // ----------------------------------------------------------------------------- |
|
861 // |
|
862 void LcUiEnginePrivate::startPlayback() |
|
863 { |
|
864 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::startPlayback()" ) |
|
865 startLocalVideo(); |
|
866 startRemoteVideo(); |
|
867 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::startPlayback()" ) |
|
868 } |
|
869 |
|
870 // ----------------------------------------------------------------------------- |
|
871 // LcUiEnginePrivate::startRemoteVideo |
|
872 // ----------------------------------------------------------------------------- |
|
873 // |
|
874 void LcUiEnginePrivate::startRemoteVideo() |
|
875 { |
|
876 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::startRemotePlayback()" ) |
|
877 MLcVideoPlayer* remotePlayer = session().RemoteVideoPlayer(); |
|
878 if ( remotePlayer ) { |
|
879 LC_QDEBUG( "livecomms [UI] enable remote player window" ) |
|
880 enableWindow( remotePlayer, true ); |
|
881 } |
|
882 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::startRemotePlayback()" ) |
|
883 } |
|
884 // ----------------------------------------------------------------------------- |
|
885 // LcUiEnginePrivate::startCloseTimer |
|
886 // ----------------------------------------------------------------------------- |
|
887 // |
|
888 void LcUiEnginePrivate::startCloseTimer() |
|
889 { |
|
890 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::startCloseTimer()" ) |
|
891 delete mCloseTimer; |
|
892 mCloseTimer = 0; |
|
893 mCloseTimer = new QTimer(this); |
|
894 mCloseTimer->setSingleShot(true); |
|
895 connect(mCloseTimer, SIGNAL(timeout()), this, SLOT(stop())); |
|
896 mCloseTimer->start(60000); |
|
897 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::startCloseTimer()" ) |
|
898 } |
|
899 |
|
900 // ----------------------------------------------------------------------------- |
|
901 // LcUiEnginePrivate::cancelCloseTimer |
|
902 // ----------------------------------------------------------------------------- |
|
903 // |
|
904 void LcUiEnginePrivate::cancelCloseTimer() |
|
905 { |
|
906 if ( mCloseTimer && mCloseTimer->isActive()) { |
|
907 mCloseTimer->stop(); |
|
908 } |
|
909 } |
|
910 |
|
911 // ----------------------------------------------------------------------------- |
|
912 // LcUiEnginePrivate::hideNotes |
|
913 // ----------------------------------------------------------------------------- |
|
914 // |
|
915 void LcUiEnginePrivate::hideNotes( bool hideWaitingNote ) |
|
916 { |
|
917 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::hideNotes()" ) |
|
918 if ( mAcceptQuery ) { |
|
919 mAcceptQuery->hide(); |
|
920 } |
|
921 if ( mWaitingNote && hideWaitingNote ) { |
|
922 mWaitingNote->hide(); |
|
923 } |
|
924 if ( mInvitingNote ) { |
|
925 mInvitingNote->hide(); |
|
926 } |
|
927 if ( mRecipientQuery ) { |
|
928 mRecipientQuery->hide(); |
|
929 } |
|
930 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::hideNotes()" ) |
|
931 } |
|
932 |
|
933 // ----------------------------------------------------------------------------- |
|
934 // LcUiEnginePrivate::completeAction |
|
935 // Completes method passed as argument. If engine is in blocked state |
|
936 // action completion will be delayed until unblock occurs. |
|
937 // ----------------------------------------------------------------------------- |
|
938 // |
|
939 void LcUiEnginePrivate::completeAction( const char* actionMethod ) |
|
940 { |
|
941 LC_QDEBUG_2( "livecomms [UI] -> LcUiEnginePrivate::completeAction :", actionMethod ) |
|
942 if ( mBlocked ) { |
|
943 LC_QDEBUG( "livecomms [UI] Blocked, invoke later" ) |
|
944 // store action and invoke it once unblocked |
|
945 setPendingAction( actionMethod ); |
|
946 } |
|
947 else { |
|
948 QMetaObject::invokeMethod( &mUiEngine, actionMethod ); |
|
949 } |
|
950 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::completeAction" ) |
|
951 } |
|
952 |
|
953 // ----------------------------------------------------------------------------- |
|
954 // LcUiEnginePrivate::setPendingAction |
|
955 // ----------------------------------------------------------------------------- |
|
956 // |
|
957 void LcUiEnginePrivate::setPendingAction( const char* actionMethod ) |
|
958 { |
|
959 mPendingAction = actionMethod; |
|
960 } |
|
961 |
|
962 // ----------------------------------------------------------------------------- |
|
963 // LcUiEnginePrivate::completePendingAction |
|
964 // ----------------------------------------------------------------------------- |
|
965 // |
|
966 void LcUiEnginePrivate::completePendingAction() |
|
967 { |
|
968 if ( !mPendingAction.isEmpty() ) { |
|
969 completeAction( mPendingAction.toAscii().constData() ); |
|
970 mPendingAction.clear(); |
|
971 } |
|
972 } |
|
973 |
|
974 // ----------------------------------------------------------------------------- |
|
975 // LcUiEnginePrivate::videoTelephoneLayout |
|
976 // ----------------------------------------------------------------------------- |
|
977 // |
|
978 bool LcUiEnginePrivate::usingVideoTelephoneEngine() |
|
979 { |
|
980 return mEngineName == LC_VTPLUGIN_NAME; |
|
981 } |
|
982 |
|
983 // ----------------------------------------------------------------------------- |
|
984 // LcUiEnginePrivate::session |
|
985 // ----------------------------------------------------------------------------- |
|
986 // |
|
987 MLcSession& LcUiEnginePrivate::session() const |
|
988 { |
|
989 return mLiveCommsEngine->Session(); |
|
990 } |
|
991 |
|
992 // ----------------------------------------------------------------------------- |
|
993 // LcUiEnginePrivate::visibleLocalPlayer |
|
994 // ----------------------------------------------------------------------------- |
|
995 // |
|
996 MLcVideoPlayer* LcUiEnginePrivate::visibleLocalPlayer() const |
|
997 { |
|
998 // TODO: Replace TRAP with QT_TRANSLATE_SYMBIAN_LEAVE_TO_EXCEPTION (Qt4.5.2) |
|
999 MLcVideoPlayer* localPlayer = session().LocalVideoPlayer(); |
|
1000 if ( localPlayer ) { |
|
1001 bool playing( true ); |
|
1002 TRAP_IGNORE( playing = localPlayer->LcIsPlayingL() ); |
|
1003 if ( !playing ) { |
|
1004 localPlayer = 0; |
624 } |
1005 } |
625 startRemoteVideo(); |
1006 } |
626 fillRemoteInfo( true ); |
1007 return localPlayer; |
627 emitViewLayoutChanged(); |
1008 } |
628 startSessionDurationTimer(); |
1009 |
629 |
1010 // ----------------------------------------------------------------------------- |
630 } else if ( newState == MLcSession::EReceived ) { |
1011 // LcUiEnginePrivate::visibleRemotePlayer |
631 LC_QDEBUG( "livecomms [UI] state is MLcSession::EReceived" ) |
1012 // ----------------------------------------------------------------------------- |
632 mRecipient = DESC_TO_QSTRING( session().RemoteDisplayName() ); |
1013 // |
633 if ( mAcceptQuery && |
1014 MLcVideoPlayer* LcUiEnginePrivate::visibleRemotePlayer() const |
634 featureSupported( CLcEngine::ELcShowAcceptQuery ) ) { |
1015 { |
635 mAcceptQuery->show(); |
1016 MLcVideoPlayer* remotePlayer = session().RemoteVideoPlayer(); |
636 } else { |
1017 if ( remotePlayer && |
637 startReceiving(); |
1018 remotePlayer->LcVideoPlayerState() == MLcVideoPlayer::EPaused ) { |
638 } |
1019 remotePlayer = 0; |
639 } else if ( newState == MLcSession::EClosed ) { |
1020 } |
640 LC_QDEBUG( "livecomms [UI] state is MLcSession::EClosed, closing UI..." ) |
1021 return remotePlayer; |
641 emit mUiEngine.stopped(); |
1022 } |
|
1023 |
|
1024 // ----------------------------------------------------------------------------- |
|
1025 // LcUiEnginePrivate::audioControl |
|
1026 // ----------------------------------------------------------------------------- |
|
1027 // |
|
1028 MLcAudioControl* LcUiEnginePrivate::audioControl() const |
|
1029 { |
|
1030 MLcAudioControl* audioControl( 0 ); |
|
1031 if ( session().LocalVideoPlayer() ) { |
|
1032 audioControl = session().LocalVideoPlayer()->LcAudioControl(); |
|
1033 } |
|
1034 if ( !audioControl && session().RemoteVideoPlayer() ) { |
|
1035 audioControl = session().RemoteVideoPlayer()->LcAudioControl(); |
|
1036 } |
|
1037 return audioControl; |
|
1038 } |
|
1039 |
|
1040 // ----------------------------------------------------------------------------- |
|
1041 // LcUiEnginePrivate::zoomControl |
|
1042 // ----------------------------------------------------------------------------- |
|
1043 // |
|
1044 MLcZoomControl* LcUiEnginePrivate::zoomControl() const |
|
1045 { |
|
1046 MLcZoomControl* zoomControl( 0 ); |
|
1047 if ( session().LocalVideoPlayer() ) { |
|
1048 zoomControl = session().LocalVideoPlayer()->LcZoomControl(); |
|
1049 } |
|
1050 return zoomControl; |
|
1051 } |
|
1052 |
|
1053 // ----------------------------------------------------------------------------- |
|
1054 // LcUiEnginePrivate::isFeatureSupported |
|
1055 // ----------------------------------------------------------------------------- |
|
1056 // |
|
1057 bool LcUiEnginePrivate::featureSupported( CLcEngine::TLcFeature feature ) |
|
1058 { |
|
1059 bool isSupported( false ); |
|
1060 if ( mLiveCommsEngine ) { |
|
1061 isSupported = mLiveCommsEngine->IsFeatureSupported( feature ); |
|
1062 } |
|
1063 return isSupported; |
|
1064 } |
|
1065 |
|
1066 // ----------------------------------------------------------------------------- |
|
1067 // LcUiEnginePrivate::startSessionDurationTimer |
|
1068 // ----------------------------------------------------------------------------- |
|
1069 // |
|
1070 void LcUiEnginePrivate::startSessionDurationTimer() |
|
1071 { |
|
1072 const int sessionDurationTimerIntervalInMs = 1000; |
|
1073 if ( !mSessionDurationTimerId ){ |
|
1074 mSessionDurationTimerId = startTimer( sessionDurationTimerIntervalInMs ); |
|
1075 LC_QDEBUG_2( "livecomms [UI] -> duration timer id:", mSessionDurationTimerId ) |
|
1076 mSessionDurationStartTime = QTime::currentTime(); |
|
1077 } |
|
1078 } |
|
1079 |
|
1080 // ----------------------------------------------------------------------------- |
|
1081 // LcUiEnginePrivate::stopSessionDurationTimer |
|
1082 // ----------------------------------------------------------------------------- |
|
1083 // |
|
1084 void LcUiEnginePrivate::stopSessionDurationTimer() |
|
1085 { |
|
1086 if ( mSessionDurationTimerId ){ |
|
1087 killTimer( mSessionDurationTimerId ); |
|
1088 mSessionDurationTimerId = 0; |
|
1089 } |
|
1090 } |
|
1091 |
|
1092 // ----------------------------------------------------------------------------- |
|
1093 // LcUiEnginePrivate::establishSession |
|
1094 // ----------------------------------------------------------------------------- |
|
1095 // |
|
1096 int LcUiEnginePrivate::establishSession() |
|
1097 { |
|
1098 // TODO: Replace TRAP with QT_TRANSLATE_SYMBIAN_LEAVE_TO_EXCEPTION (Qt4.5.2) |
|
1099 TRAPD( err, mLiveCommsEngine->Session().EstablishLcSessionL() ); |
|
1100 if ( !err ) { |
|
1101 startCloseTimer(); |
|
1102 } |
|
1103 LC_QDEBUG_2( "livecomms [UI] LcUiEnginePrivate::establishSession, err", err ) |
|
1104 return err; |
|
1105 } |
|
1106 |
|
1107 // ----------------------------------------------------------------------------- |
|
1108 // LcUiEnginePrivate::terminateSession |
|
1109 // ----------------------------------------------------------------------------- |
|
1110 // |
|
1111 int LcUiEnginePrivate::terminateSession() |
|
1112 { |
|
1113 // TODO: Replace TRAP with QT_TRANSLATE_SYMBIAN_LEAVE_TO_EXCEPTION (Qt4.5.2) |
|
1114 TRAPD( err, mLiveCommsEngine->Session().TerminateLcSessionL() ); |
|
1115 LC_QDEBUG_2( "livecomms [UI] LcUiEnginePrivate::terminateSession, err", err ) |
|
1116 return err; |
|
1117 } |
|
1118 |
|
1119 // ----------------------------------------------------------------------------- |
|
1120 // LcUiEnginePrivate::setWindowRect |
|
1121 // ----------------------------------------------------------------------------- |
|
1122 // |
|
1123 int LcUiEnginePrivate::setWindowRect( MLcVideoPlayer* player, TRect rect ) |
|
1124 { |
|
1125 // TODO: Replace TRAP with QT_TRANSLATE_SYMBIAN_LEAVE_TO_EXCEPTION (Qt4.5.2) |
|
1126 int err( -1 ); |
|
1127 if ( player && |
|
1128 player->LcWindow() && |
|
1129 player->LcWindow()->LcWindowRect() != rect ) { |
|
1130 TRAP( err, player->LcWindow()->SetLcWindowRectL( rect ) ); |
|
1131 } |
|
1132 LC_QDEBUG_2( "livecomms [UI] LcUiEnginePrivate::setWindowRect, err", err ) |
|
1133 return err; |
|
1134 } |
|
1135 |
|
1136 // ----------------------------------------------------------------------------- |
|
1137 // LcUiEnginePrivate::enableWindow |
|
1138 // ----------------------------------------------------------------------------- |
|
1139 // |
|
1140 int LcUiEnginePrivate::enableWindow( MLcVideoPlayer* player, bool enable ) |
|
1141 { |
|
1142 // TODO: Replace TRAP with QT_TRANSLATE_SYMBIAN_LEAVE_TO_EXCEPTION (Qt4.5.2) |
|
1143 int err( -1 ); |
|
1144 if ( player && |
|
1145 player->LcWindow() ) { |
|
1146 TRAP( err, player->LcWindow()->EnableLcWindowL( enable ) ); |
|
1147 } |
|
1148 LC_QDEBUG_2( "livecomms [UI] LcUiEnginePrivate::enableWindow, err", err ) |
|
1149 return err; |
|
1150 } |
|
1151 |
|
1152 // ----------------------------------------------------------------------------- |
|
1153 // LcUiEnginePrivate::play |
|
1154 // ----------------------------------------------------------------------------- |
|
1155 // |
|
1156 int LcUiEnginePrivate::play( MLcVideoPlayer* player ) |
|
1157 { |
|
1158 // TODO: Replace TRAP with QT_TRANSLATE_SYMBIAN_LEAVE_TO_EXCEPTION (Qt4.5.2) |
|
1159 int err( -1 ); |
|
1160 if ( player ) { |
|
1161 TRAP( err, player->LcPlayL() ); |
|
1162 } |
|
1163 LC_QDEBUG_2( "livecomms [UI] LcUiEnginePrivate::play, err", err ) |
|
1164 return err; |
|
1165 } |
|
1166 |
|
1167 // ----------------------------------------------------------------------------- |
|
1168 // LcUiEnginePrivate::pause |
|
1169 // ----------------------------------------------------------------------------- |
|
1170 // |
|
1171 int LcUiEnginePrivate::pause( MLcVideoPlayer* player ) |
|
1172 { |
|
1173 // TODO: Replace TRAP with QT_TRANSLATE_SYMBIAN_LEAVE_TO_EXCEPTION (Qt4.5.2) |
|
1174 int err( -1 ); |
|
1175 if ( player ) { |
|
1176 TRAP( err, player->LcPauseL() ); |
|
1177 } |
|
1178 LC_QDEBUG_2( "livecomms [UI] LcUiEnginePrivate::pause, err", err ) |
|
1179 return err; |
|
1180 } |
|
1181 |
|
1182 // ----------------------------------------------------------------------------- |
|
1183 // LcUiEnginePrivate::enableSpeaker |
|
1184 // ----------------------------------------------------------------------------- |
|
1185 // |
|
1186 int LcUiEnginePrivate::enableSpeaker( bool enable ) |
|
1187 { |
|
1188 int err( -1 ); |
|
1189 // TODO: Replace TRAP with QT_TRANSLATE_SYMBIAN_LEAVE_TO_EXCEPTION (Qt4.5.2) |
|
1190 MLcAudioControl* audio = audioControl(); |
|
1191 if ( audio ) { |
|
1192 TRAP( err, audio->EnableLcLoudspeakerL( enable ) ); |
|
1193 } |
|
1194 LC_QDEBUG_2( "livecomms [UI] LcUiEnginePrivate::enableSpeaker, err", err ) |
|
1195 return err; |
|
1196 } |
|
1197 |
|
1198 // ----------------------------------------------------------------------------- |
|
1199 // LcUiEnginePrivate::muteMic |
|
1200 // ----------------------------------------------------------------------------- |
|
1201 // |
|
1202 int LcUiEnginePrivate::muteMic( bool mute ) |
|
1203 { |
|
1204 int err( -1 ); |
|
1205 // TODO: Replace TRAP with QT_TRANSLATE_SYMBIAN_LEAVE_TO_EXCEPTION (Qt4.5.2) |
|
1206 MLcAudioControl* audio = audioControl(); |
|
1207 if ( audio ) { |
|
1208 TRAP( err, audio->MuteLcMicL( mute ) ); |
|
1209 } |
|
1210 return err; |
|
1211 } |
|
1212 |
|
1213 // ----------------------------------------------------------------------------- |
|
1214 // LcUiEnginePrivate::fillRemoteInfo |
|
1215 // ----------------------------------------------------------------------------- |
|
1216 // |
|
1217 void LcUiEnginePrivate::fillRemoteInfo(bool informChanges) |
|
1218 { |
|
1219 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::fillRemoteInfo()" ) |
|
1220 |
|
1221 QString phoneNum = DESC_TO_QSTRING( session().RemoteDetails() ); |
|
1222 if ( phoneNum != mPhoneNumber) { |
|
1223 LC_QDEBUG_2( "remote number:", phoneNum ) |
|
1224 mPhoneNumber = phoneNum; |
|
1225 if ( informChanges ) { |
|
1226 emit mUiEngine.phoneNumberChanged(mPhoneNumber); |
|
1227 } |
|
1228 } |
|
1229 // If no recipient even at opened state and no phonenum, use unknown recipient |
|
1230 QString recipient = DESC_TO_QSTRING( session().RemoteDisplayName() ); |
|
1231 if ( recipient.isEmpty() ){ |
|
1232 recipient = mPhoneNumber; |
|
1233 } |
|
1234 if ( session().LcSessionState() == MLcSession::EOpen && recipient.isEmpty() ) { |
|
1235 recipient = hbTrId("txt_vt_custom_unknown_number"); |
|
1236 } |
|
1237 if ( recipient != mRecipient ){ |
|
1238 LC_QDEBUG_2( "remote name:", recipient ) |
|
1239 mRecipient = recipient; |
|
1240 if ( informChanges ) { |
|
1241 emit mUiEngine.recipientChanged(mRecipient); |
|
1242 } |
|
1243 } |
|
1244 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::fillRemoteInfo()" ) |
|
1245 } |
|
1246 |
|
1247 // ----------------------------------------------------------------------------- |
|
1248 // LcUiEnginePrivate::isMinimized |
|
1249 // ----------------------------------------------------------------------------- |
|
1250 // |
|
1251 bool LcUiEnginePrivate::isMinimized() const |
|
1252 { |
|
1253 return mIsMinimized; |
|
1254 } |
|
1255 |
|
1256 // ----------------------------------------------------------------------------- |
|
1257 // LcUiEnginePrivate::minimize |
|
1258 // ----------------------------------------------------------------------------- |
|
1259 // |
|
1260 void LcUiEnginePrivate::minimize() |
|
1261 { |
|
1262 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::minimize()" ) |
|
1263 |
|
1264 if ( !isMinimized() ){ |
|
1265 TRect emptyRect; |
|
1266 setWindowRect( session().LocalVideoPlayer(), emptyRect ); |
|
1267 setWindowRect( session().RemoteVideoPlayer(), emptyRect ); |
|
1268 HandleForegroundStatus(EFalse); |
|
1269 } |
|
1270 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::minimize()" ) |
|
1271 } |
|
1272 |
|
1273 // ----------------------------------------------------------------------------- |
|
1274 // LcUiEnginePrivate::maximize |
|
1275 // ----------------------------------------------------------------------------- |
|
1276 // |
|
1277 void LcUiEnginePrivate::maximize() |
|
1278 { |
|
1279 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::maximize()" ) |
|
1280 if ( isMinimized() ){ |
|
1281 setWindowRect( session().LocalVideoPlayer(), mLocalRect ); |
|
1282 setWindowRect( session().RemoteVideoPlayer(), mRemoteRect ); |
|
1283 HandleForegroundStatus(ETrue); |
|
1284 } |
|
1285 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::maximize()" ) |
|
1286 } |
|
1287 |
|
1288 // ----------------------------------------------------------------------------- |
|
1289 // LcUiEnginePrivate::setCurrentView |
|
1290 // ----------------------------------------------------------------------------- |
|
1291 // |
|
1292 void LcUiEnginePrivate::setCurrentView(HbView* view) |
|
1293 { |
|
1294 LC_QDEBUG( "livecomms [UI] <-> LcUiEnginePrivate::setCurrentView()" ) |
|
1295 mCurrentView = view; |
|
1296 } |
|
1297 |
|
1298 // ----------------------------------------------------------------------------- |
|
1299 // LcUiEnginePrivate::startStopGuardTimer |
|
1300 // ----------------------------------------------------------------------------- |
|
1301 // |
|
1302 void LcUiEnginePrivate::startStopGuardTimer() |
|
1303 { |
|
1304 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::startStopGuardTimer()" ) |
|
1305 const int stoppingGuardTimerInMs = 5000; |
|
1306 QTimer::singleShot(stoppingGuardTimerInMs, this, SLOT(stopForcefully())); |
|
1307 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::startStopGuardTimer()" ) |
|
1308 } |
|
1309 |
|
1310 // ----------------------------------------------------------------------------- |
|
1311 // LcUiEnginePrivate::handleEngineForegroundStatus |
|
1312 // ----------------------------------------------------------------------------- |
|
1313 // |
|
1314 void LcUiEnginePrivate::handleEngineForegroundStatus() |
|
1315 { |
|
1316 bool foreground = !mIsMinimized; |
|
1317 LC_QDEBUG_2( "livecomms [UI] -> LcUiEnginePrivate::handleEngineForegroundStatus(), fg:", |
|
1318 foreground ) |
|
1319 HbMainWindow *mainWindow = HbInstance::instance()->allMainWindows().at(0); |
|
1320 |
|
1321 if ( mLiveCommsEngine ){ |
|
1322 bool setStatusToEngine(true); |
|
1323 if ( foreground && mFirstForegroundSwitch ){ |
|
1324 // Have to wait that first paint has occured, otherwise video |
|
1325 // windows are shown too early. |
|
1326 // TODO: wk8 does not yet have viewReady signal so simulate it |
|
1327 // by using timer. Timer can be removed later. |
|
1328 if ( mCurrentView ){ |
|
1329 LC_QDEBUG( "livecomms [UI] Wait for first paint" ) |
|
1330 connect( mainWindow, SIGNAL(viewReady()), |
|
1331 this, SLOT(handleEngineForegroundStatus()) ); |
|
1332 setStatusToEngine = false; |
|
1333 } |
642 |
1334 |
643 } else if ( newState == MLcSession::EOpening ){ |
1335 } |
644 LC_QDEBUG( "livecomms [UI] state is MLcSession::EOpening" ) |
1336 if ( setStatusToEngine ) { |
645 } |
1337 LC_QDEBUG( "livecomms [UI] Set fg status to engine plugin" ) |
646 |
1338 session().SetForegroundStatus(foreground); |
647 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::StateChanged( session )" ) |
1339 disconnect( mainWindow, SIGNAL(viewReady()), |
648 } |
1340 this, SLOT(handleEngineForegroundStatus()) ); |
649 |
1341 } |
650 // ----------------------------------------------------------------------------- |
1342 mFirstForegroundSwitch = false; |
651 // LcUiEnginePrivate::StateChanged |
1343 } |
652 // ----------------------------------------------------------------------------- |
1344 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::handleEngineForegroundStatus()" ) |
653 // |
1345 } |
654 void LcUiEnginePrivate::StateChanged( MLcVideoPlayer& aPlayer ) |
1346 |
655 { |
1347 |
656 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::StateChanged( player )" ) |
1348 // ----------------------------------------------------------------------------- |
657 |
1349 // LcUiEnginePrivate::SendDialTone |
658 emitViewLayoutChanged(); |
1350 // ----------------------------------------------------------------------------- |
659 |
1351 // |
|
1352 bool LcUiEnginePrivate::SendDialTone(const QChar aKey) |
|
1353 { |
|
1354 if ( mLiveCommsEngine ){ |
|
1355 const TChar dialChar = static_cast<TChar>(aKey.unicode()); |
|
1356 return mLiveCommsEngine->Session().SendDialTone(dialChar); |
|
1357 } |
|
1358 return false; |
|
1359 } |
|
1360 |
|
1361 // ----------------------------------------------------------------------------- |
|
1362 // LcUiEnginePrivate::isAllowedToShareVideo |
|
1363 // ----------------------------------------------------------------------------- |
|
1364 // |
|
1365 void LcUiEnginePrivate::showSendVideoQueryWhenNecessary() |
|
1366 { |
|
1367 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::showSendVideoQueryWhenNecessary()" ) |
|
1368 if (featureSupported( CLcEngine::ELcSendVideoQuery )) { |
|
1369 if (mShareOwnVideoQuery) |
|
1370 mShareOwnVideoQuery->show(); |
|
1371 } |
|
1372 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::showSendVideoQueryWhenNecessary()" ) |
|
1373 } |
|
1374 |
|
1375 // ----------------------------------------------------------------------------- |
|
1376 // LcUiEnginePrivate::stopLocalVideo |
|
1377 // ----------------------------------------------------------------------------- |
|
1378 // |
|
1379 void LcUiEnginePrivate::stopLocalVideo() |
|
1380 { |
|
1381 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::stopLocalVideo()" ) |
|
1382 MLcVideoPlayer* localPlayer = session().LocalVideoPlayer(); |
|
1383 if( localPlayer ) { |
|
1384 pause( localPlayer ); |
|
1385 enableWindow( localPlayer, false ); |
|
1386 completeAction( lcEngSignalNameCameraDisabled ); |
|
1387 } |
|
1388 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::stopLocalVideo()" ) |
|
1389 } |
|
1390 |
|
1391 // ----------------------------------------------------------------------------- |
|
1392 // LcUiEnginePrivate::startLocalVideo |
|
1393 // ----------------------------------------------------------------------------- |
|
1394 // |
|
1395 void LcUiEnginePrivate::startLocalVideo() |
|
1396 { |
|
1397 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::startLocalVideo()" ) |
|
1398 MLcVideoPlayer* localPlayer = session().LocalVideoPlayer(); |
|
1399 if( localPlayer ){ |
|
1400 play( localPlayer ); |
|
1401 enableWindow( localPlayer, true ); |
|
1402 } |
|
1403 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::startLocalVideo()" ) |
|
1404 } |
|
1405 |
|
1406 // ----------------------------------------------------------------------------- |
|
1407 // LcUiEnginePrivate::subscribeVolumeEvents |
|
1408 // ----------------------------------------------------------------------------- |
|
1409 // |
|
1410 |
|
1411 void LcUiEnginePrivate::subscribeVolumeEvents() |
|
1412 { |
|
1413 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::subscribeVolumeEvents()" ) |
|
1414 mSettingsMgr->startMonitoring( *mEarVolumeKey, XQSettingsManager::TypeInt ); |
|
1415 mSettingsMgr->startMonitoring( *mLoudSpeakerKey, XQSettingsManager::TypeInt ); |
|
1416 connect(mSettingsMgr, |
|
1417 SIGNAL(valueChanged(const XQSettingsKey&, const QVariant&)), |
|
1418 this, SLOT(volumeLevelChanged(const XQSettingsKey&, const QVariant&))); |
|
1419 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::subscribeVolumeEvents()" ) |
|
1420 } |
|
1421 |
|
1422 |
|
1423 // ----------------------------------------------------------------------------- |
|
1424 // LcUiEnginePrivate::unSubscribeVolumeEvents |
|
1425 // ----------------------------------------------------------------------------- |
|
1426 // |
|
1427 void LcUiEnginePrivate::unSubscribeVolumeEvents() |
|
1428 { |
|
1429 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::unSubscribeVolumeEvents()") |
|
1430 mSettingsMgr->stopMonitoring( *mEarVolumeKey ); |
|
1431 mSettingsMgr->stopMonitoring( *mLoudSpeakerKey ); |
|
1432 disconnect(mSettingsMgr, |
|
1433 SIGNAL( valueChanged(const XQSettingsKey&, const QVariant& ) ), |
|
1434 this, SLOT(volumeLevelChanged(const XQSettingsKey&, const QVariant&))); |
|
1435 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::unSubscribeVolumeEvents()" ) |
|
1436 } |
|
1437 |
|
1438 |
|
1439 // ----------------------------------------------------------------------------- |
|
1440 // LcUiEnginePrivate::volumeLevelChanged |
|
1441 // ----------------------------------------------------------------------------- |
|
1442 // |
|
1443 |
|
1444 void LcUiEnginePrivate::volumeLevelChanged( const XQSettingsKey& aKey, |
|
1445 const QVariant& aValue ) |
|
1446 { |
|
1447 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::volumeLevelChanged()" ) |
|
1448 |
|
1449 // Ensure We only send value for the valid keys. |
|
1450 if ((aKey.key() == mEarVolumeKey->key() && aKey.uid() == mEarVolumeKey->uid()) || |
|
1451 (aKey.key() == mLoudSpeakerKey->key() && aKey.uid() == mLoudSpeakerKey->uid()) ) { |
|
1452 |
|
1453 emit mUiEngine.volumeChanged( aValue.toInt() ); |
|
1454 } |
|
1455 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::volumeLevelChanged()" ) |
|
1456 } |
|
1457 |
|
1458 // ----------------------------------------------------------------------------- |
|
1459 // LcUiEnginePrivate::doUpdate( MLcVideoPlayer& aPlayer ) |
|
1460 // ----------------------------------------------------------------------------- |
|
1461 // |
|
1462 |
|
1463 void LcUiEnginePrivate::doUpdate( MLcVideoPlayer& aPlayer ) |
|
1464 { |
|
1465 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::doUpdate(), videoplayer" ) |
660 if ( aPlayer.LcVideoPlayerState() == MLcVideoPlayer::EPlaying ) { |
1466 if ( aPlayer.LcVideoPlayerState() == MLcVideoPlayer::EPlaying ) { |
661 if ( &aPlayer == session().RemoteVideoPlayer() ) { |
1467 if ( &aPlayer == session().RemoteVideoPlayer() ) { |
662 if ( mWaitingNote ) { |
1468 if ( mWaitingNote ) { |
663 mWaitingNote->hide(); |
1469 mWaitingNote->hide(); |
664 } |
1470 } |
694 } |
1500 } |
695 if ( &aPlayer == session().LocalVideoPlayer() ) { |
1501 if ( &aPlayer == session().LocalVideoPlayer() ) { |
696 emit mUiEngine.localPlayerUnavailable(); |
1502 emit mUiEngine.localPlayerUnavailable(); |
697 } |
1503 } |
698 } |
1504 } |
699 |
1505 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::doUpdate(),videoplayer" ) |
700 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::StateChanged( player )" ) |
1506 } |
701 } |
1507 |
702 |
1508 // ----------------------------------------------------------------------------- |
703 // ----------------------------------------------------------------------------- |
1509 // LcUiEnginePrivate::doUpdate( MLcSession& aSession ) |
704 // LcUiEnginePrivate::Updated |
1510 // ----------------------------------------------------------------------------- |
705 // ----------------------------------------------------------------------------- |
1511 // |
706 // |
1512 |
707 void LcUiEnginePrivate::Updated( MLcSession& /*aSession*/ ) |
1513 void LcUiEnginePrivate::doUpdate( MLcSession& aSession ) |
708 { |
1514 { |
709 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::Updated( session )" ) |
1515 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::doUpdate(),session" ) |
710 emitViewLayoutChanged(); |
1516 MLcSession::TLcSessionState newState = MLcSession::EUninitialized; |
711 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::Updated( session )" ) |
1517 newState = aSession.LcSessionState(); |
712 } |
1518 LC_QDEBUG_2( "livecomms [UI] session state = ", newState ) |
713 |
1519 if ( newState == MLcSession::EOpen ) { |
714 // ----------------------------------------------------------------------------- |
1520 LC_QDEBUG( "livecomms [UI] session state is MLcSession::EOpen" ) |
715 // LcUiEnginePrivate::Updated |
1521 cancelCloseTimer(); |
716 // ----------------------------------------------------------------------------- |
1522 hideNotes( false ); |
717 // |
1523 showSendVideoQueryWhenNecessary(); |
718 void LcUiEnginePrivate::Updated( MLcVideoPlayer& /*aPlayer*/ ) |
1524 startRemoteVideo(); |
719 { |
1525 fillRemoteInfo( true ); |
720 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::Updated( player )" ) |
1526 emitViewLayoutChanged(); |
721 emitViewLayoutChanged(); |
1527 startSessionDurationTimer(); |
722 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::Updated( player )" ) |
|
723 } |
|
724 |
|
725 // ----------------------------------------------------------------------------- |
|
726 // LcUiEnginePrivate::Failed |
|
727 // ----------------------------------------------------------------------------- |
|
728 // |
|
729 void LcUiEnginePrivate::Failed( MLcSession& /*aSession*/, TInt /*aError*/ ) |
|
730 { |
|
731 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::Failed( session )" ) |
|
732 stop(); |
|
733 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::Failed( session )" ) |
|
734 } |
|
735 |
|
736 // ----------------------------------------------------------------------------- |
|
737 // LcUiEnginePrivate::Failed |
|
738 // ----------------------------------------------------------------------------- |
|
739 // |
|
740 void LcUiEnginePrivate::Failed( MLcVideoPlayer& /*aPlayer*/, TInt /*aError*/ ) |
|
741 { |
|
742 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::Failed( player )" ) |
|
743 stop(); |
|
744 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::Failed( player )" ) |
|
745 } |
|
746 |
|
747 // ----------------------------------------------------------------------------- |
|
748 // LcUiEnginePrivate::SessionTimeChanged |
|
749 // ----------------------------------------------------------------------------- |
|
750 // |
|
751 void LcUiEnginePrivate::SessionTimeChanged( MLcSession& /*aSession*/, |
|
752 const TTimeIntervalSeconds& /*aSeconds*/ ) |
|
753 { |
|
754 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::SessionTimeChanged()" ) |
|
755 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::SessionTimeChanged()" ) |
|
756 } |
|
757 |
|
758 // ----------------------------------------------------------------------------- |
|
759 // LcUiEnginePrivate::SelectRecipient |
|
760 // ----------------------------------------------------------------------------- |
|
761 // |
|
762 TBool LcUiEnginePrivate::SelectRecipient( MDesCArray& aRecipientAddresses, |
|
763 TDes& aSelectedRecipientAddress ) |
|
764 { |
|
765 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::SelectRecipient()" ) |
|
766 aSelectedRecipientAddress = aRecipientAddresses.MdcaPoint(0); |
|
767 mRecipient = DESC_TO_QSTRING( aSelectedRecipientAddress ); |
|
768 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::SelectRecipient()" ) |
|
769 return ETrue; |
|
770 } |
|
771 |
|
772 // ----------------------------------------------------------------------------- |
|
773 // LcUiEnginePrivate::SelectRecipient |
|
774 // ----------------------------------------------------------------------------- |
|
775 // |
|
776 TBool LcUiEnginePrivate::InputRecipient( TDes& aRecipientAddress ) |
|
777 { |
|
778 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::InputRecipient()" ) |
|
779 |
|
780 TBool answered( EFalse ); |
|
781 |
|
782 if ( mRecipientQuery ) { |
|
783 mRecipient = DESC_TO_QSTRING( aRecipientAddress ); |
|
784 HbLineEdit* lineEdit = new HbLineEdit( mRecipient ); |
|
785 mRecipientQuery->setContentWidget( lineEdit ); |
|
786 mRecipientQuery->open(); |
|
787 TPtrC16 textPtr( |
|
788 reinterpret_cast< const TUint16* >( mRecipient.utf16() ) ); |
|
789 aRecipientAddress.Copy( textPtr ); |
|
790 answered = ETrue; |
|
791 } |
|
792 |
|
793 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::InputRecipient()" ) |
|
794 return answered; |
|
795 } |
|
796 |
|
797 // ----------------------------------------------------------------------------- |
|
798 // LcUiEnginePrivate::HandleForegroundStatus |
|
799 // ----------------------------------------------------------------------------- |
|
800 // |
|
801 void LcUiEnginePrivate::HandleForegroundStatus( TBool aForeground ) |
|
802 { |
|
803 LC_QDEBUG_2( "livecomms [UI] -> LcUiEnginePrivate::HandleForegroundStatus(), fg:", |
|
804 aForeground ) |
|
805 |
|
806 mActivityManager->enableActivitySimulation(aForeground); |
|
807 |
|
808 if ( aForeground && !HbInstance::instance()->allMainWindows().isEmpty() ){ |
|
809 HbInstance::instance()->allMainWindows().at(0)->show(); |
|
810 } |
|
811 XQServiceUtil::toBackground(!aForeground); |
|
812 |
|
813 mIsMinimized = !aForeground; |
|
814 |
|
815 handleEngineForegroundStatus(); |
|
816 |
|
817 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::HandleForegroundStatus()" ) |
|
818 } |
|
819 |
|
820 // ----------------------------------------------------------------------------- |
|
821 // LcUiEnginePrivate::BlockUi |
|
822 // ----------------------------------------------------------------------------- |
|
823 // |
|
824 void LcUiEnginePrivate::BlockUi( TBool aBlocked ) |
|
825 { |
|
826 LC_QDEBUG_2( "livecomms [UI] -> LcUiEnginePrivate::BlockUi, blocked:", aBlocked ) |
|
827 mBlocked = aBlocked; |
|
828 |
|
829 if ( mBlocked ){ |
|
830 emit mUiEngine.blocked(); |
|
831 } |
|
832 else{ |
|
833 emit mUiEngine.unblocked(); |
|
834 completePendingAction(); |
|
835 } |
|
836 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::BlockUi()" ) |
|
837 } |
|
838 |
|
839 // ----------------------------------------------------------------------------- |
|
840 // LcUiEnginePrivate::setViewLayout |
|
841 // ----------------------------------------------------------------------------- |
|
842 // |
|
843 LcViewLayoutHint LcUiEnginePrivate::setViewLayout() |
|
844 { |
|
845 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::setViewLayout()" ) |
|
846 |
|
847 LcViewLayoutHint hint = (LcViewLayoutHint)Lc_NoViewLayout; |
|
848 |
|
849 MLcVideoPlayer* localPlayer = visibleLocalPlayer(); |
|
850 MLcVideoPlayer* remotePlayer = visibleRemotePlayer(); |
|
851 |
|
852 if ( usingVideoTelephoneEngine() ) { |
|
853 hint = Lc_AllInOneViewLayout; |
|
854 LC_QDEBUG( "livecomms [UI] use Lc_AllInOneViewLayout" ) |
|
855 } else if ( localPlayer && remotePlayer ) { |
|
856 hint = Lc_TwowayViewLayout; |
|
857 LC_QDEBUG( "livecomms [UI] use Lc_TwowayViewLayout" ) |
|
858 } else if ( localPlayer ) { |
|
859 hint = Lc_SharedViewLayout; |
|
860 LC_QDEBUG( "livecomms [UI] use Lc_SharedViewLayout" ) |
|
861 } else if ( remotePlayer && !session().LocalVideoPlayer() ) { |
|
862 hint = Lc_ReceivedOnlyViewLayout; |
|
863 LC_QDEBUG( "livecomms [UI] use Lc_ReceivedOnlyViewLayout" ) |
|
864 } else if ( remotePlayer ) { |
|
865 hint = Lc_ReceivedViewLayout; |
|
866 LC_QDEBUG( "livecomms [UI] use Lc_ReceivedViewLayout" ) |
|
867 } else { |
|
868 hint = Lc_IdleViewLayout; |
|
869 LC_QDEBUG( "livecomms [UI] ! no players ! use Lc_IdleViewLayout" ) |
|
870 } |
|
871 |
|
872 mViewLayout = hint; |
|
873 |
|
874 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::setViewLayout()" ) |
|
875 |
|
876 return viewLayout(); |
|
877 } |
|
878 |
|
879 // ----------------------------------------------------------------------------- |
|
880 // LcUiEnginePrivate::emitViewLayoutChanged |
|
881 // ----------------------------------------------------------------------------- |
|
882 // |
|
883 void LcUiEnginePrivate::emitViewLayoutChanged() |
|
884 { |
|
885 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::emitViewLayoutChanged()" ) |
|
886 |
|
887 LcViewLayoutHint oldLayout = viewLayout(); |
|
888 LcViewLayoutHint layout = setViewLayout(); |
|
889 |
|
890 if ( layout != oldLayout ) { |
|
891 LC_QDEBUG( "livecomms [UI] layout has changed. signal" ) |
|
892 emit mUiEngine.layoutChanged(); |
|
893 } |
|
894 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::emitViewLayoutChanged()" ) |
|
895 } |
|
896 |
|
897 // ----------------------------------------------------------------------------- |
|
898 // LcUiEnginePrivate::startLiveContent |
|
899 // ----------------------------------------------------------------------------- |
|
900 // |
|
901 void LcUiEnginePrivate::startLiveContent() |
|
902 { |
|
903 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::startLiveContent()" ) |
|
904 |
|
905 if ( mInvitingNote && featureSupported( CLcEngine::ELcShowInvitingNote ) ) { |
|
906 mInvitingNote->show(); |
|
907 } |
|
908 enableSpeaker( true ); |
|
909 establishSession(); |
|
910 |
1528 |
911 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::startLiveContent()" ) |
1529 } else if ( newState == MLcSession::EReceived ) { |
912 } |
1530 LC_QDEBUG( "livecomms [UI] state state is MLcSession::EReceived" ) |
913 |
1531 mRecipient = DESC_TO_QSTRING( session().RemoteDisplayName() ); |
914 // ----------------------------------------------------------------------------- |
1532 if ( mAcceptQuery && |
915 // LcUiEnginePrivate::startPlayback |
1533 featureSupported( CLcEngine::ELcShowAcceptQuery ) ) { |
916 // Utility style function to start both local and remote players if available. |
1534 mAcceptQuery->show(); |
917 // ----------------------------------------------------------------------------- |
1535 } else { |
918 // |
1536 startReceiving(); |
919 void LcUiEnginePrivate::startPlayback() |
1537 } |
920 { |
1538 } else if ( newState == MLcSession::EClosed ) { |
921 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::startPlayback()" ) |
1539 LC_QDEBUG( "livecomms [UI] state state is MLcSession::EClosed, closing UI..." ) |
922 startLocalVideo(); |
1540 emit mUiEngine.stopped(); |
923 startRemoteVideo(); |
|
924 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::startPlayback()" ) |
|
925 } |
|
926 |
|
927 // ----------------------------------------------------------------------------- |
|
928 // LcUiEnginePrivate::startRemoteVideo |
|
929 // ----------------------------------------------------------------------------- |
|
930 // |
|
931 void LcUiEnginePrivate::startRemoteVideo() |
|
932 { |
|
933 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::startRemotePlayback()" ) |
|
934 MLcVideoPlayer* remotePlayer = session().RemoteVideoPlayer(); |
|
935 if ( remotePlayer ) { |
|
936 LC_QDEBUG( "livecomms [UI] enable remote player window" ) |
|
937 enableWindow( remotePlayer, true ); |
|
938 } |
|
939 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::startRemotePlayback()" ) |
|
940 } |
|
941 // ----------------------------------------------------------------------------- |
|
942 // LcUiEnginePrivate::startCloseTimer |
|
943 // ----------------------------------------------------------------------------- |
|
944 // |
|
945 void LcUiEnginePrivate::startCloseTimer() |
|
946 { |
|
947 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::startCloseTimer()" ) |
|
948 delete mCloseTimer; |
|
949 mCloseTimer = 0; |
|
950 mCloseTimer = new QTimer(this); |
|
951 mCloseTimer->setSingleShot(true); |
|
952 connect(mCloseTimer, SIGNAL(timeout()), this, SLOT(stop())); |
|
953 mCloseTimer->start(60000); |
|
954 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::startCloseTimer()" ) |
|
955 } |
|
956 |
|
957 // ----------------------------------------------------------------------------- |
|
958 // LcUiEnginePrivate::cancelCloseTimer |
|
959 // ----------------------------------------------------------------------------- |
|
960 // |
|
961 void LcUiEnginePrivate::cancelCloseTimer() |
|
962 { |
|
963 if ( mCloseTimer && mCloseTimer->isActive()) { |
|
964 mCloseTimer->stop(); |
|
965 } |
|
966 } |
|
967 |
|
968 // ----------------------------------------------------------------------------- |
|
969 // LcUiEnginePrivate::hideNotes |
|
970 // ----------------------------------------------------------------------------- |
|
971 // |
|
972 void LcUiEnginePrivate::hideNotes( bool hideWaitingNote ) |
|
973 { |
|
974 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::hideNotes()" ) |
|
975 if ( mAcceptQuery ) { |
|
976 mAcceptQuery->hide(); |
|
977 } |
|
978 if ( mWaitingNote && hideWaitingNote ) { |
|
979 mWaitingNote->hide(); |
|
980 } |
|
981 if ( mInvitingNote ) { |
|
982 mInvitingNote->hide(); |
|
983 } |
|
984 if ( mRecipientQuery ) { |
|
985 mRecipientQuery->hide(); |
|
986 } |
|
987 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::hideNotes()" ) |
|
988 } |
|
989 |
|
990 // ----------------------------------------------------------------------------- |
|
991 // LcUiEnginePrivate::completeAction |
|
992 // Completes method passed as argument. If engine is in blocked state |
|
993 // action completion will be delayed until unblock occurs. |
|
994 // ----------------------------------------------------------------------------- |
|
995 // |
|
996 void LcUiEnginePrivate::completeAction( const char* actionMethod ) |
|
997 { |
|
998 LC_QDEBUG_2( "livecomms [UI] -> LcUiEnginePrivate::completeAction :", actionMethod ) |
|
999 if ( mBlocked ) { |
|
1000 LC_QDEBUG( "livecomms [UI] Blocked, invoke later" ) |
|
1001 // store action and invoke it once unblocked |
|
1002 setPendingAction( actionMethod ); |
|
1003 } |
|
1004 else { |
|
1005 QMetaObject::invokeMethod( &mUiEngine, actionMethod ); |
|
1006 } |
|
1007 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::completeAction" ) |
|
1008 } |
|
1009 |
|
1010 // ----------------------------------------------------------------------------- |
|
1011 // LcUiEnginePrivate::setPendingAction |
|
1012 // ----------------------------------------------------------------------------- |
|
1013 // |
|
1014 void LcUiEnginePrivate::setPendingAction( const char* actionMethod ) |
|
1015 { |
|
1016 mPendingAction = actionMethod; |
|
1017 } |
|
1018 |
|
1019 // ----------------------------------------------------------------------------- |
|
1020 // LcUiEnginePrivate::completePendingAction |
|
1021 // ----------------------------------------------------------------------------- |
|
1022 // |
|
1023 void LcUiEnginePrivate::completePendingAction() |
|
1024 { |
|
1025 if ( !mPendingAction.isEmpty() ) { |
|
1026 completeAction( mPendingAction.toAscii().constData() ); |
|
1027 mPendingAction.clear(); |
|
1028 } |
|
1029 } |
|
1030 |
|
1031 // ----------------------------------------------------------------------------- |
|
1032 // LcUiEnginePrivate::videoTelephoneLayout |
|
1033 // ----------------------------------------------------------------------------- |
|
1034 // |
|
1035 bool LcUiEnginePrivate::usingVideoTelephoneEngine() |
|
1036 { |
|
1037 return mEngineName == LC_VTPLUGIN_NAME; |
|
1038 } |
|
1039 |
|
1040 // ----------------------------------------------------------------------------- |
|
1041 // LcUiEnginePrivate::session |
|
1042 // ----------------------------------------------------------------------------- |
|
1043 // |
|
1044 MLcSession& LcUiEnginePrivate::session() const |
|
1045 { |
|
1046 return mLiveCommsEngine->Session(); |
|
1047 } |
|
1048 |
|
1049 // ----------------------------------------------------------------------------- |
|
1050 // LcUiEnginePrivate::visibleLocalPlayer |
|
1051 // ----------------------------------------------------------------------------- |
|
1052 // |
|
1053 MLcVideoPlayer* LcUiEnginePrivate::visibleLocalPlayer() const |
|
1054 { |
|
1055 // TODO: Replace TRAP with QT_TRANSLATE_SYMBIAN_LEAVE_TO_EXCEPTION (Qt4.5.2) |
|
1056 MLcVideoPlayer* localPlayer = session().LocalVideoPlayer(); |
|
1057 if ( localPlayer ) { |
|
1058 bool playing( true ); |
|
1059 TRAP_IGNORE( playing = localPlayer->LcIsPlayingL() ); |
|
1060 if ( !playing ) { |
|
1061 localPlayer = 0; |
|
1062 } |
|
1063 } |
|
1064 return localPlayer; |
|
1065 } |
|
1066 |
|
1067 // ----------------------------------------------------------------------------- |
|
1068 // LcUiEnginePrivate::visibleRemotePlayer |
|
1069 // ----------------------------------------------------------------------------- |
|
1070 // |
|
1071 MLcVideoPlayer* LcUiEnginePrivate::visibleRemotePlayer() const |
|
1072 { |
|
1073 MLcVideoPlayer* remotePlayer = session().RemoteVideoPlayer(); |
|
1074 if ( remotePlayer && |
|
1075 remotePlayer->LcVideoPlayerState() == MLcVideoPlayer::EPaused ) { |
|
1076 remotePlayer = 0; |
|
1077 } |
|
1078 return remotePlayer; |
|
1079 } |
|
1080 |
|
1081 // ----------------------------------------------------------------------------- |
|
1082 // LcUiEnginePrivate::audioControl |
|
1083 // ----------------------------------------------------------------------------- |
|
1084 // |
|
1085 MLcAudioControl* LcUiEnginePrivate::audioControl() const |
|
1086 { |
|
1087 MLcAudioControl* audioControl( 0 ); |
|
1088 if ( session().LocalVideoPlayer() ) { |
|
1089 audioControl = session().LocalVideoPlayer()->LcAudioControl(); |
|
1090 } |
|
1091 if ( !audioControl && session().RemoteVideoPlayer() ) { |
|
1092 audioControl = session().RemoteVideoPlayer()->LcAudioControl(); |
|
1093 } |
|
1094 return audioControl; |
|
1095 } |
|
1096 |
|
1097 // ----------------------------------------------------------------------------- |
|
1098 // LcUiEnginePrivate::zoomControl |
|
1099 // ----------------------------------------------------------------------------- |
|
1100 // |
|
1101 MLcZoomControl* LcUiEnginePrivate::zoomControl() const |
|
1102 { |
|
1103 MLcZoomControl* zoomControl( 0 ); |
|
1104 if ( session().LocalVideoPlayer() ) { |
|
1105 zoomControl = session().LocalVideoPlayer()->LcZoomControl(); |
|
1106 } |
|
1107 return zoomControl; |
|
1108 } |
|
1109 |
|
1110 // ----------------------------------------------------------------------------- |
|
1111 // LcUiEnginePrivate::isFeatureSupported |
|
1112 // ----------------------------------------------------------------------------- |
|
1113 // |
|
1114 bool LcUiEnginePrivate::featureSupported( CLcEngine::TLcFeature feature ) |
|
1115 { |
|
1116 bool isSupported( false ); |
|
1117 if ( mLiveCommsEngine ) { |
|
1118 isSupported = mLiveCommsEngine->IsFeatureSupported( feature ); |
|
1119 } |
|
1120 return isSupported; |
|
1121 } |
|
1122 |
|
1123 // ----------------------------------------------------------------------------- |
|
1124 // LcUiEnginePrivate::startSessionDurationTimer |
|
1125 // ----------------------------------------------------------------------------- |
|
1126 // |
|
1127 void LcUiEnginePrivate::startSessionDurationTimer() |
|
1128 { |
|
1129 const int sessionDurationTimerIntervalInMs = 1000; |
|
1130 if ( !mSessionDurationTimerId ){ |
|
1131 mSessionDurationTimerId = startTimer( sessionDurationTimerIntervalInMs ); |
|
1132 LC_QDEBUG_2( "livecomms [UI] -> duration timer id:", mSessionDurationTimerId ) |
|
1133 mSessionDurationStartTime = QTime::currentTime(); |
|
1134 } |
|
1135 } |
|
1136 |
|
1137 // ----------------------------------------------------------------------------- |
|
1138 // LcUiEnginePrivate::stopSessionDurationTimer |
|
1139 // ----------------------------------------------------------------------------- |
|
1140 // |
|
1141 void LcUiEnginePrivate::stopSessionDurationTimer() |
|
1142 { |
|
1143 if ( mSessionDurationTimerId ){ |
|
1144 killTimer( mSessionDurationTimerId ); |
|
1145 mSessionDurationTimerId = 0; |
|
1146 } |
|
1147 } |
|
1148 |
|
1149 // ----------------------------------------------------------------------------- |
|
1150 // LcUiEnginePrivate::establishSession |
|
1151 // ----------------------------------------------------------------------------- |
|
1152 // |
|
1153 int LcUiEnginePrivate::establishSession() |
|
1154 { |
|
1155 // TODO: Replace TRAP with QT_TRANSLATE_SYMBIAN_LEAVE_TO_EXCEPTION (Qt4.5.2) |
|
1156 TRAPD( err, mLiveCommsEngine->Session().EstablishLcSessionL() ); |
|
1157 if ( !err ) { |
|
1158 startCloseTimer(); |
|
1159 } |
|
1160 LC_QDEBUG_2( "livecomms [UI] LcUiEnginePrivate::establishSession, err", err ) |
|
1161 return err; |
|
1162 } |
|
1163 |
|
1164 // ----------------------------------------------------------------------------- |
|
1165 // LcUiEnginePrivate::terminateSession |
|
1166 // ----------------------------------------------------------------------------- |
|
1167 // |
|
1168 int LcUiEnginePrivate::terminateSession() |
|
1169 { |
|
1170 // TODO: Replace TRAP with QT_TRANSLATE_SYMBIAN_LEAVE_TO_EXCEPTION (Qt4.5.2) |
|
1171 TRAPD( err, mLiveCommsEngine->Session().TerminateLcSessionL() ); |
|
1172 LC_QDEBUG_2( "livecomms [UI] LcUiEnginePrivate::terminateSession, err", err ) |
|
1173 return err; |
|
1174 } |
|
1175 |
|
1176 // ----------------------------------------------------------------------------- |
|
1177 // LcUiEnginePrivate::setWindowRect |
|
1178 // ----------------------------------------------------------------------------- |
|
1179 // |
|
1180 int LcUiEnginePrivate::setWindowRect( MLcVideoPlayer* player, TRect rect ) |
|
1181 { |
|
1182 // TODO: Replace TRAP with QT_TRANSLATE_SYMBIAN_LEAVE_TO_EXCEPTION (Qt4.5.2) |
|
1183 int err( -1 ); |
|
1184 if ( player && |
|
1185 player->LcWindow() && |
|
1186 player->LcWindow()->LcWindowRect() != rect ) { |
|
1187 TRAP( err, player->LcWindow()->SetLcWindowRectL( rect ) ); |
|
1188 } |
|
1189 LC_QDEBUG_2( "livecomms [UI] LcUiEnginePrivate::setWindowRect, err", err ) |
|
1190 return err; |
|
1191 } |
|
1192 |
|
1193 // ----------------------------------------------------------------------------- |
|
1194 // LcUiEnginePrivate::enableWindow |
|
1195 // ----------------------------------------------------------------------------- |
|
1196 // |
|
1197 int LcUiEnginePrivate::enableWindow( MLcVideoPlayer* player, bool enable ) |
|
1198 { |
|
1199 // TODO: Replace TRAP with QT_TRANSLATE_SYMBIAN_LEAVE_TO_EXCEPTION (Qt4.5.2) |
|
1200 int err( -1 ); |
|
1201 if ( player && |
|
1202 player->LcWindow() ) { |
|
1203 TRAP( err, player->LcWindow()->EnableLcWindowL( enable ) ); |
|
1204 } |
|
1205 LC_QDEBUG_2( "livecomms [UI] LcUiEnginePrivate::enableWindow, err", err ) |
|
1206 return err; |
|
1207 } |
|
1208 |
|
1209 // ----------------------------------------------------------------------------- |
|
1210 // LcUiEnginePrivate::play |
|
1211 // ----------------------------------------------------------------------------- |
|
1212 // |
|
1213 int LcUiEnginePrivate::play( MLcVideoPlayer* player ) |
|
1214 { |
|
1215 // TODO: Replace TRAP with QT_TRANSLATE_SYMBIAN_LEAVE_TO_EXCEPTION (Qt4.5.2) |
|
1216 int err( -1 ); |
|
1217 if ( player ) { |
|
1218 TRAP( err, player->LcPlayL() ); |
|
1219 } |
|
1220 LC_QDEBUG_2( "livecomms [UI] LcUiEnginePrivate::play, err", err ) |
|
1221 return err; |
|
1222 } |
|
1223 |
|
1224 // ----------------------------------------------------------------------------- |
|
1225 // LcUiEnginePrivate::pause |
|
1226 // ----------------------------------------------------------------------------- |
|
1227 // |
|
1228 int LcUiEnginePrivate::pause( MLcVideoPlayer* player ) |
|
1229 { |
|
1230 // TODO: Replace TRAP with QT_TRANSLATE_SYMBIAN_LEAVE_TO_EXCEPTION (Qt4.5.2) |
|
1231 int err( -1 ); |
|
1232 if ( player ) { |
|
1233 TRAP( err, player->LcPauseL() ); |
|
1234 } |
|
1235 LC_QDEBUG_2( "livecomms [UI] LcUiEnginePrivate::pause, err", err ) |
|
1236 return err; |
|
1237 } |
|
1238 |
|
1239 // ----------------------------------------------------------------------------- |
|
1240 // LcUiEnginePrivate::enableSpeaker |
|
1241 // ----------------------------------------------------------------------------- |
|
1242 // |
|
1243 int LcUiEnginePrivate::enableSpeaker( bool enable ) |
|
1244 { |
|
1245 int err( -1 ); |
|
1246 // TODO: Replace TRAP with QT_TRANSLATE_SYMBIAN_LEAVE_TO_EXCEPTION (Qt4.5.2) |
|
1247 MLcAudioControl* audio = audioControl(); |
|
1248 if ( audio ) { |
|
1249 TRAP( err, audio->EnableLcLoudspeakerL( enable ) ); |
|
1250 } |
|
1251 LC_QDEBUG_2( "livecomms [UI] LcUiEnginePrivate::enableSpeaker, err", err ) |
|
1252 return err; |
|
1253 } |
|
1254 |
|
1255 // ----------------------------------------------------------------------------- |
|
1256 // LcUiEnginePrivate::muteMic |
|
1257 // ----------------------------------------------------------------------------- |
|
1258 // |
|
1259 int LcUiEnginePrivate::muteMic( bool mute ) |
|
1260 { |
|
1261 int err( -1 ); |
|
1262 // TODO: Replace TRAP with QT_TRANSLATE_SYMBIAN_LEAVE_TO_EXCEPTION (Qt4.5.2) |
|
1263 MLcAudioControl* audio = audioControl(); |
|
1264 if ( audio ) { |
|
1265 TRAP( err, audio->MuteLcMicL( mute ) ); |
|
1266 } |
|
1267 return err; |
|
1268 } |
|
1269 |
|
1270 // ----------------------------------------------------------------------------- |
|
1271 // LcUiEnginePrivate::fillRemoteInfo |
|
1272 // ----------------------------------------------------------------------------- |
|
1273 // |
|
1274 void LcUiEnginePrivate::fillRemoteInfo(bool informChanges) |
|
1275 { |
|
1276 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::fillRemoteInfo()" ) |
|
1277 |
|
1278 QString phoneNum = DESC_TO_QSTRING( session().RemoteDetails() ); |
|
1279 if ( phoneNum != mPhoneNumber) { |
|
1280 LC_QDEBUG_2( "remote number:", phoneNum ) |
|
1281 mPhoneNumber = phoneNum; |
|
1282 if ( informChanges ) { |
|
1283 emit mUiEngine.phoneNumberChanged(mPhoneNumber); |
|
1284 } |
|
1285 } |
|
1286 // If no recipient even at opened state and no phonenum, use unknown recipient |
|
1287 QString recipient = DESC_TO_QSTRING( session().RemoteDisplayName() ); |
|
1288 if ( recipient.isEmpty() ){ |
|
1289 recipient = mPhoneNumber; |
|
1290 } |
|
1291 if ( session().LcSessionState() == MLcSession::EOpen && recipient.isEmpty() ) { |
|
1292 recipient = hbTrId("txt_vt_custom_unknown_number"); |
|
1293 } |
|
1294 if ( recipient != mRecipient ){ |
|
1295 LC_QDEBUG_2( "remote name:", recipient ) |
|
1296 mRecipient = recipient; |
|
1297 if ( informChanges ) { |
|
1298 emit mUiEngine.recipientChanged(mRecipient); |
|
1299 } |
|
1300 } |
|
1301 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::fillRemoteInfo()" ) |
|
1302 } |
|
1303 |
|
1304 // ----------------------------------------------------------------------------- |
|
1305 // LcUiEnginePrivate::isMinimized |
|
1306 // ----------------------------------------------------------------------------- |
|
1307 // |
|
1308 bool LcUiEnginePrivate::isMinimized() const |
|
1309 { |
|
1310 return mIsMinimized; |
|
1311 } |
|
1312 |
|
1313 // ----------------------------------------------------------------------------- |
|
1314 // LcUiEnginePrivate::minimize |
|
1315 // ----------------------------------------------------------------------------- |
|
1316 // |
|
1317 void LcUiEnginePrivate::minimize() |
|
1318 { |
|
1319 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::minimize()" ) |
|
1320 |
|
1321 if ( !isMinimized() ){ |
|
1322 TRect emptyRect; |
|
1323 setWindowRect( session().LocalVideoPlayer(), emptyRect ); |
|
1324 setWindowRect( session().RemoteVideoPlayer(), emptyRect ); |
|
1325 HandleForegroundStatus(EFalse); |
|
1326 } |
|
1327 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::minimize()" ) |
|
1328 } |
|
1329 |
|
1330 // ----------------------------------------------------------------------------- |
|
1331 // LcUiEnginePrivate::maximize |
|
1332 // ----------------------------------------------------------------------------- |
|
1333 // |
|
1334 void LcUiEnginePrivate::maximize() |
|
1335 { |
|
1336 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::maximize()" ) |
|
1337 if ( isMinimized() ){ |
|
1338 setWindowRect( session().LocalVideoPlayer(), mLocalRect ); |
|
1339 setWindowRect( session().RemoteVideoPlayer(), mRemoteRect ); |
|
1340 HandleForegroundStatus(ETrue); |
|
1341 } |
|
1342 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::maximize()" ) |
|
1343 } |
|
1344 |
|
1345 // ----------------------------------------------------------------------------- |
|
1346 // LcUiEnginePrivate::setCurrentView |
|
1347 // ----------------------------------------------------------------------------- |
|
1348 // |
|
1349 void LcUiEnginePrivate::setCurrentView(HbView* view) |
|
1350 { |
|
1351 LC_QDEBUG( "livecomms [UI] <-> LcUiEnginePrivate::setCurrentView()" ) |
|
1352 mCurrentView = view; |
|
1353 } |
|
1354 |
|
1355 // ----------------------------------------------------------------------------- |
|
1356 // LcUiEnginePrivate::startStopGuardTimer |
|
1357 // ----------------------------------------------------------------------------- |
|
1358 // |
|
1359 void LcUiEnginePrivate::startStopGuardTimer() |
|
1360 { |
|
1361 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::startStopGuardTimer()" ) |
|
1362 const int stoppingGuardTimerInMs = 5000; |
|
1363 QTimer::singleShot(stoppingGuardTimerInMs, this, SLOT(stopForcefully())); |
|
1364 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::startStopGuardTimer()" ) |
|
1365 } |
|
1366 |
|
1367 // ----------------------------------------------------------------------------- |
|
1368 // LcUiEnginePrivate::handleEngineForegroundStatus |
|
1369 // ----------------------------------------------------------------------------- |
|
1370 // |
|
1371 void LcUiEnginePrivate::handleEngineForegroundStatus() |
|
1372 { |
|
1373 bool foreground = !mIsMinimized; |
|
1374 LC_QDEBUG_2( "livecomms [UI] -> LcUiEnginePrivate::handleEngineForegroundStatus(), fg:", |
|
1375 foreground ) |
|
1376 HbMainWindow *mainWindow = HbInstance::instance()->allMainWindows().at(0); |
|
1377 |
|
1378 if ( mLiveCommsEngine ){ |
|
1379 bool setStatusToEngine(true); |
|
1380 if ( foreground && mFirstForegroundSwitch ){ |
|
1381 // Have to wait that first paint has occured, otherwise video |
|
1382 // windows are shown too early. |
|
1383 // TODO: wk8 does not yet have viewReady signal so simulate it |
|
1384 // by using timer. Timer can be removed later. |
|
1385 if ( mCurrentView ){ |
|
1386 LC_QDEBUG( "livecomms [UI] Wait for first paint" ) |
|
1387 connect( mainWindow, SIGNAL(viewReady()), |
|
1388 this, SLOT(handleEngineForegroundStatus()) ); |
|
1389 setStatusToEngine = false; |
|
1390 } |
|
1391 |
1541 |
1392 } |
1542 } else if ( newState == MLcSession::EOpening ){ |
1393 if ( setStatusToEngine ) { |
1543 LC_QDEBUG( "livecomms [UI] state state is MLcSession::EOpening" ) |
1394 LC_QDEBUG( "livecomms [UI] Set fg status to engine plugin" ) |
1544 } |
1395 session().SetForegroundStatus(foreground); |
1545 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::doUpdate(),session" ) |
1396 disconnect( mainWindow, SIGNAL(viewReady()), |
|
1397 this, SLOT(handleEngineForegroundStatus()) ); |
|
1398 } |
|
1399 mFirstForegroundSwitch = false; |
|
1400 } |
|
1401 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::handleEngineForegroundStatus()" ) |
|
1402 } |
|
1403 |
|
1404 |
|
1405 // ----------------------------------------------------------------------------- |
|
1406 // LcUiEnginePrivate::SendDialTone |
|
1407 // ----------------------------------------------------------------------------- |
|
1408 // |
|
1409 bool LcUiEnginePrivate::SendDialTone(const QChar aKey) |
|
1410 { |
|
1411 if ( mLiveCommsEngine ){ |
|
1412 const TChar dialChar = static_cast<TChar>(aKey.unicode()); |
|
1413 return mLiveCommsEngine->Session().SendDialTone(dialChar); |
|
1414 } |
|
1415 return false; |
|
1416 } |
|
1417 |
|
1418 // ----------------------------------------------------------------------------- |
|
1419 // LcUiEnginePrivate::isAllowedToShareVideo |
|
1420 // ----------------------------------------------------------------------------- |
|
1421 // |
|
1422 bool LcUiEnginePrivate::isAllowedToShareVideo() |
|
1423 { |
|
1424 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::isAllowedToShareVideo()" ) |
|
1425 if (!featureSupported( CLcEngine::ELcSendVideoQuery )) //outgoing videocall |
|
1426 return true; |
|
1427 else { //incoming videocall |
|
1428 int ownVtVideoSendingSetting = vtVideoSendingSetting(); |
|
1429 if (VTSETTING_SHOW_AUTOMATICALLY == ownVtVideoSendingSetting) |
|
1430 return true; |
|
1431 else if (VTSETTING_DO_NOT_SHOW == ownVtVideoSendingSetting) |
|
1432 return false; |
|
1433 else { |
|
1434 if (mShareOwnVideoQuery) |
|
1435 mShareOwnVideoQuery->show(); |
|
1436 return false; |
|
1437 } |
|
1438 } |
|
1439 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::isAllowedToShareVideo()" ) |
|
1440 } |
|
1441 |
|
1442 // ----------------------------------------------------------------------------- |
|
1443 // LcUiEnginePrivate::vtVideoSendingSetting |
|
1444 // ----------------------------------------------------------------------------- |
|
1445 // |
|
1446 int LcUiEnginePrivate::vtVideoSendingSetting() |
|
1447 { |
|
1448 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::vtVideoSendingSetting()" ) |
|
1449 XQSettingsManager settings; |
|
1450 XQSettingsKey settingsKey(XQSettingsKey::TargetCentralRepository, |
|
1451 KCRUidTelephonySettings.iUid, |
|
1452 KSettingsVTVideoSending); |
|
1453 QVariant ownVtVideoSendingSetting = settings.readItemValue(settingsKey); |
|
1454 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::vtVideoSendingSetting()" ) |
|
1455 return ownVtVideoSendingSetting.toInt(); |
|
1456 } |
|
1457 |
|
1458 // ----------------------------------------------------------------------------- |
|
1459 // LcUiEnginePrivate::stopLocalVideo |
|
1460 // ----------------------------------------------------------------------------- |
|
1461 // |
|
1462 void LcUiEnginePrivate::stopLocalVideo() |
|
1463 { |
|
1464 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::stopLocalVideo()" ) |
|
1465 MLcVideoPlayer* localPlayer = session().LocalVideoPlayer(); |
|
1466 if( localPlayer ) { |
|
1467 pause( localPlayer ); |
|
1468 enableWindow( localPlayer, false ); |
|
1469 completeAction( lcEngSignalNameCameraDisabled ); |
|
1470 } |
|
1471 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::stopLocalVideo()" ) |
|
1472 } |
|
1473 |
|
1474 // ----------------------------------------------------------------------------- |
|
1475 // LcUiEnginePrivate::startLocalVideo |
|
1476 // ----------------------------------------------------------------------------- |
|
1477 // |
|
1478 void LcUiEnginePrivate::startLocalVideo() |
|
1479 { |
|
1480 LC_QDEBUG( "livecomms [UI] -> LcUiEnginePrivate::startLocalVideo()" ) |
|
1481 MLcVideoPlayer* localPlayer = session().LocalVideoPlayer(); |
|
1482 if( localPlayer ){ |
|
1483 play( localPlayer ); |
|
1484 enableWindow( localPlayer, true ); |
|
1485 } |
|
1486 LC_QDEBUG( "livecomms [UI] <- LcUiEnginePrivate::startLocalVideo()" ) |
|
1487 } |
1546 } |
1488 // End of File |
1547 // End of File |