videditor/TrimForMms/src/TrimForMmsAppui.cpp
branchRCL_3
changeset 3 e0b5df5c0969
parent 0 951a5db380a0
child 5 4c409de21d23
equal deleted inserted replaced
0:951a5db380a0 3:e0b5df5c0969
     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  * File: TrimForMmsAppUi.cpp
       
    22  * Created: 04/18/06
       
    23  * Author: 
       
    24  * 
       
    25  * ==================================================================== */
       
    26 
       
    27 #include <avkon.hrh>
       
    28 #include <aknnotewrappers.h> 
       
    29 #include <trimformms.rsg>
       
    30 
       
    31 #include "TrimForMms.pan"
       
    32 #include "TrimForMmsAppUi.h"
       
    33 #include "VeiSettings.h"
       
    34 #include "VeiTrimForMmsView.h"
       
    35 #include "TrimForMms.hrh"
       
    36 #include "VideoEditorCommon.h"
       
    37 #include "VideoEditorDebugUtils.h"
       
    38 
       
    39 #include <sendui.h>
       
    40 
       
    41 // ConstructL is called by the application framework
       
    42 void CTrimForMmsAppUi::ConstructL()
       
    43     {
       
    44 
       
    45     BaseConstructL(EAppOrientationAutomatic|EAknEnableSkin);
       
    46 
       
    47     iSendUi = CSendUi::NewL();
       
    48 
       
    49     iTrimForMmsView = CVeiTrimForMmsView::NewL(*iSendUi);
       
    50 
       
    51     AddViewL (iTrimForMmsView);    // transfers ownership
       
    52 
       
    53     }
       
    54 
       
    55 CTrimForMmsAppUi::CTrimForMmsAppUi()                              
       
    56     {
       
    57 	// no implementation required
       
    58     }
       
    59 
       
    60 CTrimForMmsAppUi::~CTrimForMmsAppUi()
       
    61     {
       
    62     if (iTrimForMmsView)
       
    63         {
       
    64         delete iTrimForMmsView;
       
    65         iTrimForMmsView = NULL;
       
    66         }
       
    67         
       
    68     delete iSendUi;
       
    69     }
       
    70 
       
    71 // handle any menu commands
       
    72 void CTrimForMmsAppUi::HandleCommandL(TInt aCommand)
       
    73     {
       
    74     switch(aCommand)
       
    75         {
       
    76         case EEikCmdExit:
       
    77         case EAknSoftkeyExit:
       
    78             Exit();
       
    79             break;
       
    80 
       
    81         default:
       
    82             Panic(ETrimForMmsBasicUi);
       
    83             break;
       
    84         }
       
    85     }
       
    86 
       
    87 //=============================================================================
       
    88 void CTrimForMmsAppUi::ReadSettingsL( TVeiSettings& aSettings ) 
       
    89 	{
       
    90 	LOG(KVideoEditorLogFile, "CTrimForMmsAppUi::ReadSettingsL: in");
       
    91 	CDictionaryStore* store = Application()->OpenIniFileLC( iCoeEnv->FsSession() );
       
    92 
       
    93 	TBool storePresent = store->IsPresentL( KUidVideoEditor );	// UID has an associated stream?
       
    94 
       
    95 	if( storePresent ) 
       
    96 		{
       
    97 		RDictionaryReadStream readStream;
       
    98 		readStream.OpenLC( *store, KUidVideoEditor );
       
    99 
       
   100 		readStream >> aSettings;	// Internalize data to TVeiSettings.
       
   101 		
       
   102 		CleanupStack::PopAndDestroy( readStream ); 
       
   103 		}
       
   104 	else 
       
   105 		{
       
   106 		/* Read the default filenames from resources */
       
   107 		HBufC*	videoName = iEikonEnv->AllocReadResourceLC( R_VEI_SETTINGS_VIEW_SETTINGS_ITEM_VALUE );
       
   108 
       
   109 		const CFont* myFont = AknLayoutUtils::FontFromId( EAknLogicalFontSecondaryFont );
       
   110 
       
   111 		aSettings.DefaultVideoName() = AknTextUtils::ChooseScalableText(videoName->Des(), *myFont, 400 );	
       
   112 		CleanupStack::PopAndDestroy( videoName );
       
   113 
       
   114 		HBufC*	snapshotName = iEikonEnv->AllocReadResourceLC( R_VEI_SETTINGS_VIEW_SETTINGS_ITEM2_VALUE );
       
   115 		aSettings.DefaultSnapshotName() = AknTextUtils::ChooseScalableText(snapshotName->Des(), *myFont, 400 );
       
   116 		CleanupStack::PopAndDestroy( snapshotName );
       
   117 
       
   118 		/* Memory card is used as a default target */
       
   119 		aSettings.MemoryInUse() = CAknMemorySelectionDialog::EMemoryCard;
       
   120 
       
   121          /* Set save quality to "Auto" by default. */
       
   122         aSettings.SaveQuality() = TVeiSettings::EAuto;
       
   123 
       
   124 		RDictionaryWriteStream writeStream;
       
   125 		writeStream.AssignLC( *store, KUidVideoEditor );
       
   126 
       
   127 		writeStream << aSettings;
       
   128 
       
   129 		writeStream.CommitL();
       
   130 
       
   131 		store->CommitL();
       
   132 		
       
   133 		CleanupStack::PopAndDestroy( writeStream );	
       
   134 		}
       
   135 	CleanupStack::PopAndDestroy( store );
       
   136 	LOG(KVideoEditorLogFile, "CTrimForMmsAppUi::ReadSettingsL: out");
       
   137 	}
       
   138 
       
   139 //=============================================================================
       
   140 /*void CTrimForMmsAppUi::HandleScreenDeviceChangedL()
       
   141 	{
       
   142 	LOG(KVideoEditorLogFile, "CVeiAppUi::HandleScreenDeviceChangedL: In");
       
   143 	CAknAppUi::HandleScreenDeviceChangedL(); 
       
   144 	if ( iTrimForMmsView )
       
   145 		{
       
   146 		iTrimForMmsView->HandleScreenDeviceChangedL();
       
   147 		}
       
   148 	LOG(KVideoEditorLogFile, "CVeiAppUi::HandleScreenDeviceChangedL: Out");
       
   149 	}*/
       
   150 
       
   151 //=============================================================================
       
   152 void CTrimForMmsAppUi::HandleResourceChangeL(TInt aType)
       
   153 	{
       
   154 	LOG(KVideoEditorLogFile, "CTrimForMmsAppUi::HandleResourceChangeL: In");
       
   155 	CAknAppUi::HandleResourceChangeL(aType);
       
   156 	if ( iTrimForMmsView )
       
   157 		{
       
   158 		iTrimForMmsView->HandleResourceChange(aType);
       
   159 		}
       
   160 	LOG(KVideoEditorLogFile, "CTrimForMmsAppUi::HandleResourceChangeL: Out");
       
   161 	}
       
   162 
       
   163 // End of File