mmsharing/mmshui/src/musuilivesharingviewcontainer.cpp
branchRCL_3
changeset 33 bc78a40cd63c
child 41 755f0370535b
equal deleted inserted replaced
32:73a1feb507fb 33:bc78a40cd63c
       
     1 /*
       
     2 * Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  The MUS application's UI class.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "musuidefinitions.h"
       
    20 #include "musuilivesharingviewcontainer.h"
       
    21 #include "musuieventcontroller.h"
       
    22 #include "musuigeneralview.h"
       
    23 #include "musuilivesharingview.h"
       
    24 #include "musuiappui.h"
       
    25 #include "musuilevelindicator.h"
       
    26 #include "musuidialogutil.h"
       
    27 #include "musui.hrh"
       
    28 #include "muslogger.h" // debug logging
       
    29 #include "mussettings.h"
       
    30 #include <musui.rsg>
       
    31 
       
    32 #include <AknsDrawUtils.h>
       
    33 #include <AknDef.h>
       
    34 
       
    35 
       
    36 // -----------------------------------------------------------------------------
       
    37 //
       
    38 // -----------------------------------------------------------------------------
       
    39 //
       
    40 void CMusUiLiveSharingViewContainer::ConstructL( CMusUiGeneralView* aView,
       
    41                                                  const TRect& aRect )
       
    42     {
       
    43     MUS_LOG( "mus: [MUSUI ]  -> CMusUiLiveSharingViewContainer::ConstructL" );
       
    44     
       
    45     CMusUiSendViewContainer::ConstructL( aView, 
       
    46                                          aRect,
       
    47                                          EAknOrientationVertical );
       
    48     // check if operator specific functionality is needed  
       
    49     iOperatorSpecificFunctionality = 
       
    50         ( MultimediaSharingSettings::OperatorVariantSettingL() == 
       
    51                                         MusSettingsKeys::EOperatorSpecific );
       
    52 
       
    53     MUS_LOG( "mus: [MUSUI ]  <- CMusUiLiveSharingViewContainer::ConstructL" );
       
    54     }
       
    55 
       
    56 
       
    57 // -----------------------------------------------------------------------------
       
    58 //
       
    59 // -----------------------------------------------------------------------------
       
    60 //
       
    61 CMusUiLiveSharingViewContainer::~CMusUiLiveSharingViewContainer()
       
    62     {
       
    63     MUS_LOG( "mus: [MUSUI ]  -> CMusUiLiveSharingViewContainer::~CMusUiLiveSharingViewContainer" );
       
    64     // NOP
       
    65     MUS_LOG( "mus: [MUSUI ]  <- CMusUiLiveSharingViewContainer::~CMusUiLiveSharingViewContainer" );
       
    66     }
       
    67 
       
    68 
       
    69 // -----------------------------------------------------------------------------
       
    70 //
       
    71 // -----------------------------------------------------------------------------
       
    72 //
       
    73 void CMusUiLiveSharingViewContainer::SetZoomValues( TInt aMinZoom, TInt aMaxZoom )
       
    74     {
       
    75     iIndicator->SetRange( aMinZoom, aMaxZoom, ETrue );
       
    76     }
       
    77 
       
    78 
       
    79 // -----------------------------------------------------------------------------
       
    80 //
       
    81 // -----------------------------------------------------------------------------
       
    82 //
       
    83 void CMusUiLiveSharingViewContainer::SetBrightnessValues( TInt aMinBrightness, 
       
    84                                                           TInt aMaxBrightness )
       
    85     {
       
    86     iIndicator->SetRange( aMinBrightness, aMaxBrightness, ETrue );
       
    87     }
       
    88 
       
    89 
       
    90 // -----------------------------------------------------------------------------
       
    91 //
       
    92 // -----------------------------------------------------------------------------
       
    93 //
       
    94 void CMusUiLiveSharingViewContainer::SetZoomL( TInt aZoomLevel )
       
    95     {
       
    96     MUS_LOG( "mus: [MUSUI ]  -> CMusUiLiveSharingViewContainer::SetZoomL" )
       
    97 
       
    98     iIndicator->SetLevelL( EMusUiIndicatorTypeZoom, 
       
    99                            aZoomLevel, 
       
   100                            ETrue /* use timer */ );
       
   101                           
       
   102     MUS_LOG( "mus: [MUSUI ]  <- CMusUiLiveSharingViewContainer::SetZoomL" )
       
   103     }
       
   104 
       
   105 
       
   106 // -----------------------------------------------------------------------------
       
   107 //
       
   108 // -----------------------------------------------------------------------------
       
   109 //
       
   110 void CMusUiLiveSharingViewContainer::SetBrightnessL( TInt aBrightnessLevel )
       
   111     {
       
   112     MUS_LOG( "mus: [MUSUI ]  -> CMusUiLiveSharingViewContainer::SetBrightnessL" )
       
   113     
       
   114     iIndicator->SetLevelL( EMusUiIndicatorTypeBrightness, 
       
   115                            aBrightnessLevel, 
       
   116                            ETrue /* use timer */ );
       
   117                           
       
   118     MUS_LOG( "mus: [MUSUI ]  <- CMusUiLiveSharingViewContainer::SetBrightnessL" )
       
   119     }
       
   120 
       
   121 
       
   122 // -----------------------------------------------------------------------------
       
   123 //
       
   124 // -----------------------------------------------------------------------------
       
   125 //
       
   126 void CMusUiLiveSharingViewContainer::SetZoomVisible(  TBool aVisible )
       
   127     {
       
   128     iIndicator->SetIndicatorType( EMusUiIndicatorTypeZoom );
       
   129     MakeVisible( aVisible );
       
   130     SetGloballyCapturing( aVisible );
       
   131     SetPointerCapture( aVisible );  
       
   132     }
       
   133 
       
   134 
       
   135 // -----------------------------------------------------------------------------
       
   136 //
       
   137 // -----------------------------------------------------------------------------
       
   138 //
       
   139 void CMusUiLiveSharingViewContainer::SetBrightnessVisible( TBool aVisible)
       
   140     {
       
   141     iIndicator->SetIndicatorType(EMusUiIndicatorTypeBrightness);
       
   142     MakeVisible( aVisible );
       
   143     SetGloballyCapturing( aVisible );
       
   144     SetPointerCapture( aVisible );  
       
   145     }
       
   146 
       
   147 
       
   148 // -----------------------------------------------------------------------------
       
   149 //
       
   150 // -----------------------------------------------------------------------------
       
   151 //
       
   152 TMusUiIndicatorType CMusUiLiveSharingViewContainer::GetIndicatorType()
       
   153 	{
       
   154 	return iIndicator->GetIndicatorType();
       
   155 	}
       
   156 
       
   157 
       
   158 // -----------------------------------------------------------------------------
       
   159 // Called by framework when to retrieve the no. of controls.
       
   160 // -----------------------------------------------------------------------------
       
   161 //
       
   162 TInt CMusUiLiveSharingViewContainer::CountComponentControls() const
       
   163     {
       
   164     return 1; // return nbr of controls inside this container
       
   165     }
       
   166 
       
   167 
       
   168 // -----------------------------------------------------------------------------
       
   169 // Called by framework to retrieve the control specified by index.
       
   170 // -----------------------------------------------------------------------------
       
   171 //
       
   172 CCoeControl* CMusUiLiveSharingViewContainer::ComponentControl( TInt aIndex ) const
       
   173     {
       
   174     CCoeControl* control = NULL;
       
   175     switch ( aIndex )
       
   176         {
       
   177         case 0:
       
   178             control = iIndicator;
       
   179             break;
       
   180         default:
       
   181             break;
       
   182         }
       
   183     return control;
       
   184     }
       
   185 
       
   186 
       
   187 // -----------------------------------------------------------------------------
       
   188 // Called by framework to act on key events if required.
       
   189 // -----------------------------------------------------------------------------
       
   190 //
       
   191 TKeyResponse CMusUiLiveSharingViewContainer::OfferKeyEventL(
       
   192     const TKeyEvent& aKeyEvent,
       
   193     TEventCode /*aType*/ )
       
   194     {
       
   195     MUS_LOG1( "mus: [MUSUI ]  -> CMusUiLiveSharingViewContainer::OfferKeyEventL: %d",
       
   196               aKeyEvent.iCode );
       
   197     MUS_LOG1( "mus: [MUSUI ]  -> CMusUiLiveSharingViewContainer::OfferKeyEventL: %d",
       
   198               aKeyEvent.iScanCode );
       
   199             
       
   200     TKeyResponse ret( EKeyWasNotConsumed );
       
   201 
       
   202     if ( MUS_NO_TOOLBAR )
       
   203         {
       
   204         CMusUiLiveSharingView* view = 
       
   205             static_cast< CMusUiLiveSharingView* >( MusUiView() );      
       
   206         switch ( aKeyEvent.iCode )
       
   207             {
       
   208             case EKeyLeftArrow:
       
   209                 {
       
   210                 view->HandleCommandL( EMusuiCmdViewVolumeDown );
       
   211                 ret = EKeyWasConsumed;
       
   212                 break;
       
   213                 }
       
   214             case EKeyRightArrow:
       
   215                 {
       
   216                 view->HandleCommandL( EMusuiCmdViewVolumeUp );
       
   217                 ret = EKeyWasConsumed;
       
   218                 break;
       
   219                 }
       
   220             case EKeyUpArrow:
       
   221                 {
       
   222                 view->HandleKeyUpArrowL();
       
   223                 ret = EKeyWasConsumed;
       
   224                 break;
       
   225                 }
       
   226             case EKeyDownArrow:
       
   227                 {
       
   228                 view->HandleKeyDownArrowL();
       
   229                 ret = EKeyWasConsumed;
       
   230                 break;
       
   231                 }
       
   232             default:
       
   233                 break;
       
   234             }
       
   235         }
       
   236 
       
   237     MUS_LOG( "mus: [MUSUI ]  <- CMusUiLiveSharingViewContainer::OfferKeyEventL" );
       
   238     return ret;
       
   239     }
       
   240 
       
   241 // -----------------------------------------------------------------------------
       
   242 //
       
   243 // -----------------------------------------------------------------------------
       
   244 //
       
   245 void CMusUiLiveSharingViewContainer::HandlePointerEventL( 
       
   246                                             const TPointerEvent& aPointerEvent)
       
   247     {
       
   248         // Forward to base class in order to use slider
       
   249         CCoeControl::HandlePointerEventL( aPointerEvent );
       
   250 	    
       
   251 	if ( !Rect().Contains( aPointerEvent.iPosition ) )
       
   252         {
       
   253         MakeVisible( EFalse );
       
   254         }
       
   255     }
       
   256 
       
   257 
       
   258 // end of file