mpxplugins/viewplugins/plugins/equalizerviewplugin/src/mpxequalizerviewplugin.cpp
changeset 0 ff3acec5bc43
equal deleted inserted replaced
-1:000000000000 0:ff3acec5bc43
       
     1 /*
       
     2 * Copyright (c) 2006 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:  Implementation of Equalizer view plugin
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include <mpxcustomcommandobserver.h>
       
    22 #include <mpxviewutilitycommanddef.h>
       
    23 #include "mpxequalizerview.h"
       
    24 #include "mpxequalizerviewplugin.h"
       
    25 #include "mpxlog.h"
       
    26 
       
    27 // ======== MEMBER FUNCTIONS ========
       
    28 
       
    29 // ---------------------------------------------------------------------------
       
    30 // C++ default constructor can NOT contain any code, that
       
    31 // might leave.
       
    32 // ---------------------------------------------------------------------------
       
    33 //
       
    34 CMPXEqualizerViewPlugin::CMPXEqualizerViewPlugin()
       
    35     {
       
    36     // Do nothing
       
    37     }
       
    38 
       
    39 // ---------------------------------------------------------------------------
       
    40 // Symbian 2nd phase constructor can leave.
       
    41 // ---------------------------------------------------------------------------
       
    42 //
       
    43 void CMPXEqualizerViewPlugin::ConstructL()
       
    44     {
       
    45     MPX_FUNC("CMPXEqualizerViewPlugin::ConstructL");
       
    46     // Do nothing
       
    47     }
       
    48 
       
    49 // ---------------------------------------------------------------------------
       
    50 // Two-phased constructor.
       
    51 // ---------------------------------------------------------------------------
       
    52 //
       
    53 CMPXEqualizerViewPlugin* CMPXEqualizerViewPlugin::NewL()
       
    54     {
       
    55     MPX_FUNC("CMPXEqualizerViewPlugin::NewL");
       
    56     CMPXEqualizerViewPlugin* self = new ( ELeave ) CMPXEqualizerViewPlugin();
       
    57     CleanupStack::PushL( self );
       
    58     self->ConstructL();
       
    59     CleanupStack::Pop( self );
       
    60     return self;
       
    61     }
       
    62 
       
    63 // ---------------------------------------------------------------------------
       
    64 // Destructor
       
    65 // ---------------------------------------------------------------------------
       
    66 //
       
    67 CMPXEqualizerViewPlugin::~CMPXEqualizerViewPlugin()
       
    68     {
       
    69     delete iView;
       
    70     }
       
    71 
       
    72 // ---------------------------------------------------------------------------
       
    73 // From CMPXViewPlugin
       
    74 // Interface method to create view.
       
    75 // ---------------------------------------------------------------------------
       
    76 //
       
    77 void CMPXEqualizerViewPlugin::CreateViewL()
       
    78     {
       
    79     MPX_FUNC("CMPXEqualizerViewPlugin::CreateViewL");
       
    80     if ( !iView )
       
    81         {
       
    82         iView = CMPXEqualizerView::NewL();
       
    83         }
       
    84     }
       
    85 
       
    86 // ---------------------------------------------------------------------------
       
    87 // From CMPXViewPlugin
       
    88 // Interface method to destroy view.
       
    89 // ---------------------------------------------------------------------------
       
    90 //
       
    91 void CMPXEqualizerViewPlugin::DestroyView()
       
    92     {
       
    93     MPX_FUNC("CMPXEqualizerViewPlugin::DestroyView");
       
    94     delete iView;
       
    95     iView = NULL;
       
    96     }
       
    97 
       
    98 // ---------------------------------------------------------------------------
       
    99 // From CMPXViewPlugin
       
   100 // Interface method to activate view.
       
   101 // ---------------------------------------------------------------------------
       
   102 //
       
   103 void CMPXEqualizerViewPlugin::ActivateViewL(
       
   104     const TDesC* /* aParam */ )
       
   105     {
       
   106     MPX_FUNC("CMPXEqualizerViewPlugin::ActivateViewL");
       
   107     if ( !iView )
       
   108         {
       
   109         CreateViewL();
       
   110         }
       
   111 
       
   112     iView->LaunchEqualizerL();
       
   113 
       
   114     if ( iCommandObserver )
       
   115         {
       
   116         TPckgC<TInt> selfPtr( reinterpret_cast<TInt>( this ) );    
       
   117         iCommandObserver->HandleCustomCommand( 
       
   118             TUid::Uid( KMPXViewUtilityCustomCommand ), 
       
   119             EMPXViewUtilCmdViewDeActivated,
       
   120             selfPtr );
       
   121         }    
       
   122     }
       
   123 
       
   124 // ---------------------------------------------------------------------------
       
   125 // From CMPXViewPlugin
       
   126 // Interface method to activate as default view, will not bring to foreground
       
   127 // ---------------------------------------------------------------------------
       
   128 //
       
   129 void CMPXEqualizerViewPlugin::SetAsDefaultViewL()
       
   130     {
       
   131     MPX_FUNC("CMPXEqualizerViewPlugin::SetAsDefaultViewL");
       
   132     User::Leave( KErrNotSupported );
       
   133     }
       
   134 
       
   135 // ---------------------------------------------------------------------------
       
   136 // From CMPXViewPlugin
       
   137 // Interface method to deactivate view.
       
   138 // ---------------------------------------------------------------------------
       
   139 //
       
   140 void CMPXEqualizerViewPlugin::DeactivateView()
       
   141     {
       
   142     MPX_FUNC("CMPXEqualizerViewPlugin::DeactivateView");
       
   143     if ( iCommandObserver )
       
   144         {
       
   145         TPckgC<TInt> selfPtr( reinterpret_cast<TInt>( this ) );    
       
   146         iCommandObserver->HandleCustomCommand( 
       
   147             TUid::Uid( KMPXViewUtilityCustomCommand ), 
       
   148             EMPXViewUtilCmdViewDeActivated,
       
   149             selfPtr );
       
   150         }    
       
   151     }
       
   152 
       
   153 //  End of File