mmsharing/mmshui/src/musuilivesharingviewcontainer.cpp
changeset 0 f0cf47e981f9
child 6 c47a75a8cd72
equal deleted inserted replaced
-1:000000000000 0:f0cf47e981f9
       
     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 // Called by framework when to retrieve the no. of controls.
       
   150 // -----------------------------------------------------------------------------
       
   151 //
       
   152 TInt CMusUiLiveSharingViewContainer::CountComponentControls() const
       
   153     {
       
   154     return 1; // return nbr of controls inside this container
       
   155     }
       
   156 
       
   157 
       
   158 // -----------------------------------------------------------------------------
       
   159 // Called by framework to retrieve the control specified by index.
       
   160 // -----------------------------------------------------------------------------
       
   161 //
       
   162 CCoeControl* CMusUiLiveSharingViewContainer::ComponentControl( TInt aIndex ) const
       
   163     {
       
   164     CCoeControl* control = NULL;
       
   165     switch ( aIndex )
       
   166         {
       
   167         case 0:
       
   168             control = iIndicator;
       
   169             break;
       
   170         default:
       
   171             break;
       
   172         }
       
   173     return control;
       
   174     }
       
   175 
       
   176 
       
   177 // -----------------------------------------------------------------------------
       
   178 // Called by framework to act on key events if required.
       
   179 // -----------------------------------------------------------------------------
       
   180 //
       
   181 TKeyResponse CMusUiLiveSharingViewContainer::OfferKeyEventL(
       
   182     const TKeyEvent& aKeyEvent,
       
   183     TEventCode /*aType*/ )
       
   184     {
       
   185     MUS_LOG1( "mus: [MUSUI ]  -> CMusUiLiveSharingViewContainer::OfferKeyEventL: %d",
       
   186               aKeyEvent.iCode );
       
   187     MUS_LOG1( "mus: [MUSUI ]  -> CMusUiLiveSharingViewContainer::OfferKeyEventL: %d",
       
   188               aKeyEvent.iScanCode );
       
   189             
       
   190     TKeyResponse ret( EKeyWasNotConsumed );
       
   191 
       
   192     if ( MUS_NO_TOOLBAR )
       
   193         {
       
   194         CMusUiLiveSharingView* view = 
       
   195             static_cast< CMusUiLiveSharingView* >( MusUiView() );      
       
   196         switch ( aKeyEvent.iCode )
       
   197             {
       
   198             case EKeyLeftArrow:
       
   199                 {
       
   200                 view->HandleCommandL( EMusuiCmdViewVolumeDown );
       
   201                 ret = EKeyWasConsumed;
       
   202                 break;
       
   203                 }
       
   204             case EKeyRightArrow:
       
   205                 {
       
   206                 view->HandleCommandL( EMusuiCmdViewVolumeUp );
       
   207                 ret = EKeyWasConsumed;
       
   208                 break;
       
   209                 }
       
   210             case EKeyUpArrow:
       
   211                 {
       
   212                 view->HandleKeyUpArrowL();
       
   213                 ret = EKeyWasConsumed;
       
   214                 break;
       
   215                 }
       
   216             case EKeyDownArrow:
       
   217                 {
       
   218                 view->HandleKeyDownArrowL();
       
   219                 ret = EKeyWasConsumed;
       
   220                 break;
       
   221                 }
       
   222             default:
       
   223                 break;
       
   224             }
       
   225         }
       
   226 
       
   227     MUS_LOG( "mus: [MUSUI ]  <- CMusUiLiveSharingViewContainer::OfferKeyEventL" );
       
   228     return ret;
       
   229     }
       
   230 
       
   231 // -----------------------------------------------------------------------------
       
   232 //
       
   233 // -----------------------------------------------------------------------------
       
   234 //
       
   235 void CMusUiLiveSharingViewContainer::HandlePointerEventL( 
       
   236                                             const TPointerEvent& aPointerEvent)
       
   237     {
       
   238     if ( Rect().Contains( aPointerEvent.iPosition ) )
       
   239         {
       
   240         // Forward to base class in order to use slider
       
   241         CCoeControl::HandlePointerEventL( aPointerEvent );
       
   242         }
       
   243     else
       
   244         {
       
   245         // Tapping outside slider area means ending of zoom or brightness
       
   246         // adjustment
       
   247         SetZoomVisible( EFalse ); // This hides also the brightness slider
       
   248         CMusUiLiveSharingView* liveView = 
       
   249                                (CMusUiLiveSharingView*)this->MusUiView();
       
   250         liveView->ResetToolBarSelected();
       
   251         }
       
   252     }
       
   253 
       
   254 
       
   255 // end of file