videditor/ManualVideoEditor/src/VeiSettingsView.cpp
changeset 0 951a5db380a0
equal deleted inserted replaced
-1:000000000000 0:951a5db380a0
       
     1 /*
       
     2 * Copyright (c) 2010 Ixonos Plc.
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the "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 * Ixonos Plc
       
    14 *
       
    15 * Description: 
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 // INCLUDE FILES
       
    22 #include <aknviewappui.h>
       
    23 #include <avkon.hrh>
       
    24 #include <manualvideoeditor.rsg>
       
    25 #include <akncontext.h> 
       
    26 #include <akntitle.h> 
       
    27 #include <barsread.h>
       
    28 #include <s32stor.h>
       
    29 #include <aknquerydialog.h> 
       
    30 #include <s32stor.h> 
       
    31 
       
    32 // User includes 
       
    33 #include "Manualvideoeditor.hrh"
       
    34 #include "VeiSettingsView.h"
       
    35 #include "VeiSettingsContainer.h" 
       
    36 #include "VeiApp.h" 
       
    37 #include "VeiAppUi.h"
       
    38 
       
    39 
       
    40 
       
    41 // ================= MEMBER FUNCTIONS =======================
       
    42 
       
    43 CVeiSettingsView* CVeiSettingsView::NewL()
       
    44     {
       
    45     CVeiSettingsView* self = CVeiSettingsView::NewLC();
       
    46     CleanupStack::Pop( self );
       
    47 
       
    48     return self;
       
    49     }
       
    50 
       
    51 
       
    52 CVeiSettingsView* CVeiSettingsView::NewLC()
       
    53     {
       
    54     CVeiSettingsView* self = new( ELeave )CVeiSettingsView();
       
    55     CleanupStack::PushL( self );
       
    56     self->ConstructL();
       
    57 
       
    58     return self;
       
    59     }
       
    60 
       
    61 
       
    62 // ---------------------------------------------------------
       
    63 // CVeiSettingsView::ConstructL(const TRect& aRect)
       
    64 // EPOC two-phased constructor
       
    65 // ---------------------------------------------------------
       
    66 //
       
    67 void CVeiSettingsView::ConstructL()
       
    68     {
       
    69     BaseConstructL( R_VEI_SETTINGS_VIEW );
       
    70     }
       
    71 
       
    72 
       
    73 CVeiSettingsView::CVeiSettingsView()
       
    74     {
       
    75     }
       
    76 
       
    77 // ---------------------------------------------------------
       
    78 // CVeiSettingsView::~CVeiSettingsView()
       
    79 // Destructor
       
    80 // ---------------------------------------------------------
       
    81 //
       
    82 CVeiSettingsView::~CVeiSettingsView()
       
    83     {
       
    84     if ( iContainer )
       
    85         {
       
    86         AppUi()->RemoveFromViewStack( *this, iContainer );
       
    87         }
       
    88 
       
    89     delete iContainer;
       
    90     }
       
    91 
       
    92 // ---------------------------------------------------------
       
    93 // TUid CVeiSettingsView::Id()
       
    94 // Returns settings view UID
       
    95 // ---------------------------------------------------------
       
    96 //
       
    97 TUid CVeiSettingsView::Id()const
       
    98     {
       
    99     return TUid::Uid( EVeiSettingsView );
       
   100     }
       
   101 
       
   102 // ---------------------------------------------------------
       
   103 // CVeiSettingsView::HandleCommandL(TInt aCommand)
       
   104 // ---------------------------------------------------------
       
   105 //
       
   106 void CVeiSettingsView::HandleCommandL( TInt aCommand )
       
   107     {
       
   108     switch ( aCommand )
       
   109         {
       
   110         /**
       
   111          * Back
       
   112          */
       
   113         case EAknSoftkeyBack:
       
   114             // Do not force 
       
   115             // the settings view into portrait, even though it contains text input.
       
   116             //AppUi()->SetOrientationL( iOriginalOrientation );
       
   117             STATIC_CAST( CVeiAppUi* , AppUi())->WriteSettingsL( iSettings );
       
   118             // Activate Edit Video view
       
   119             AppUi()->ActivateLocalViewL( TUid::Uid( EVeiEditVideoView ));
       
   120             break;
       
   121             /**
       
   122              * Change
       
   123              */
       
   124         case EVeiCmdSettingsViewChange:
       
   125             iContainer->ChangeFocusedItemL(); // Start editing the focused item.
       
   126             break;
       
   127             /**
       
   128              * Help
       
   129              */
       
   130         case EVeiCmdSettingsViewHelp:
       
   131             AppUi()->HandleCommandL( EVeiCmdSettingsViewHelp );
       
   132             break;
       
   133             /**
       
   134              * Exit
       
   135              */
       
   136         case EEikCmdExit:
       
   137             STATIC_CAST( CVeiAppUi* , AppUi())->WriteSettingsL( iSettings );
       
   138             AppUi()->HandleCommandL( EEikCmdExit );
       
   139             break;
       
   140         default:
       
   141             AppUi()->HandleCommandL( aCommand );
       
   142             break;
       
   143         }
       
   144     }
       
   145 
       
   146 // ---------------------------------------------------------
       
   147 // CVeiSettingsView::HandleClientRectChange()
       
   148 // ---------------------------------------------------------
       
   149 //
       
   150 void CVeiSettingsView::HandleClientRectChange()
       
   151     {
       
   152     if ( iContainer )
       
   153         {
       
   154         iContainer->SetRect( ClientRect());
       
   155         }
       
   156 
       
   157     }
       
   158 
       
   159 // ---------------------------------------------------------
       
   160 // CVeiSettingsView::DoActivateL(...)
       
   161 // ---------------------------------------------------------
       
   162 //
       
   163 void CVeiSettingsView::DoActivateL( const TVwsViewId& /*aPrevViewId*/, 
       
   164                                     TUid /*aCustomMessageId*/, 
       
   165                                     const TDesC8& /*aCustomMessage*/ )
       
   166     {
       
   167     // do not force the settings view into portrait,
       
   168     //  even though it contains text input.
       
   169     // iOriginalOrientation = AppUi()->Orientation();
       
   170     //AppUi()->SetOrientationL( CAknAppUiBase::EAppUiOrientationPortrait );
       
   171 
       
   172     if ( !iContainer )
       
   173         {
       
   174         STATIC_CAST( CVeiAppUi* , AppUi())->ReadSettingsL( iSettings );
       
   175         // Read da settings.
       
   176 
       
   177         iContainer = new( ELeave )CVeiSettingsContainer;
       
   178         iContainer->SetMopParent( this );
       
   179         iContainer->ConstructL( AppUi()->ClientRect(), iSettings );
       
   180         AppUi()->AddToStackL( *this, iContainer );
       
   181         }
       
   182 
       
   183     CEikStatusPane* statusPane = (( CAknAppUi* )iEikonEnv->EikAppUi())->StatusPane();
       
   184 
       
   185     CAknTitlePane* titlePane = ( CAknTitlePane* )statusPane->ControlL( TUid::Uid( EEikStatusPaneUidTitle ));
       
   186     TResourceReader reader1;
       
   187     iCoeEnv->CreateResourceReaderLC( reader1, R_VEI_SETTINGS_VIEW_TITLE_NAME );
       
   188     titlePane->SetFromResourceL( reader1 );
       
   189     CleanupStack::PopAndDestroy(); //reader1
       
   190     }
       
   191 
       
   192 // ---------------------------------------------------------
       
   193 // CVeiSettingsView::DoDeactivate()
       
   194 // ---------------------------------------------------------
       
   195 //
       
   196 void CVeiSettingsView::DoDeactivate()
       
   197     {
       
   198     if ( iContainer )
       
   199         {
       
   200         AppUi()->RemoveFromViewStack( *this, iContainer );
       
   201         }
       
   202 
       
   203     delete iContainer;
       
   204     iContainer = NULL;
       
   205     }
       
   206 
       
   207 // End of File