videditor/VideoEditorCommon/src/VeiSettings.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 // INCLUDE FILES
       
    21 
       
    22 // User includes
       
    23 #include "VeiSettings.h"
       
    24 
       
    25 #ifdef SETTINGS_TO_CENREP
       
    26 #include <centralrepository.h>
       
    27 #include "VideoEditorInternalCRKeys.h"
       
    28 #endif
       
    29 
       
    30 EXPORT_C TDes& TVeiSettings::DefaultSnapshotName() 
       
    31 	{
       
    32 	return iDefaultSnapshotName;
       
    33 	}
       
    34 
       
    35 EXPORT_C TPtrC TVeiSettings::DefaultSnapshotName() const
       
    36 	{
       
    37 	return iDefaultSnapshotName;
       
    38 	}
       
    39 
       
    40 EXPORT_C TDes& TVeiSettings::DefaultVideoName()
       
    41 	{
       
    42 	return iDefaultVideoName;
       
    43 	}
       
    44 
       
    45 EXPORT_C TPtrC TVeiSettings::DefaultVideoName() const
       
    46 	{
       
    47 	return iDefaultVideoName;
       
    48 	}
       
    49 
       
    50 EXPORT_C CAknMemorySelectionDialog::TMemory& TVeiSettings::MemoryInUse()
       
    51 	{
       
    52 	return iMemoryInUse;
       
    53 	}
       
    54 
       
    55 EXPORT_C const CAknMemorySelectionDialog::TMemory& TVeiSettings::MemoryInUse() const
       
    56 	{
       
    57 	return iMemoryInUse;
       
    58 	}
       
    59 
       
    60 EXPORT_C TInt& TVeiSettings::SaveQuality()
       
    61     {
       
    62     return (TInt&)iSaveQuality;
       
    63     }
       
    64 
       
    65 EXPORT_C TInt TVeiSettings::SaveQuality() const
       
    66     {
       
    67     return (TInt)iSaveQuality;
       
    68     }
       
    69 
       
    70 EXPORT_C void TVeiSettings::ExternalizeL(RWriteStream& aStream) const 
       
    71 	{
       
    72     aStream << iDefaultVideoName;
       
    73 
       
    74     aStream.WriteUint8L( static_cast<TUint8>(iSaveQuality) );
       
    75 
       
    76     aStream << iDefaultSnapshotName;
       
    77 
       
    78     aStream.WriteUint8L( static_cast<TUint8>(iMemoryInUse) );
       
    79 	}
       
    80 
       
    81 EXPORT_C void TVeiSettings::InternalizeL(RReadStream& aStream) 
       
    82 	{
       
    83     aStream >> iDefaultVideoName;
       
    84 
       
    85     iSaveQuality = static_cast<TSaveQuality>(aStream.ReadUint8L());
       
    86 
       
    87     aStream >> iDefaultSnapshotName;
       
    88 
       
    89     iMemoryInUse = static_cast<CAknMemorySelectionDialog ::TMemory> (aStream.ReadUint8L());
       
    90 	}
       
    91 
       
    92 #ifdef SETTINGS_TO_CENREP
       
    93 
       
    94 void TVeiSettings::LoadL()
       
    95 	{
       
    96 	CRepository* repository = NULL;
       
    97 	User::LeaveIfError( repository = CRepository::NewLC(KCRUidVideoEditor) );
       
    98 	
       
    99 	TInt saveQuality = 0;
       
   100 	repository->Get(KVedSaveQuality, saveQuality);
       
   101 	SetSaveQuality( (TSaveQuality)saveQuality );
       
   102 
       
   103 	TInt memoryInUse = 0;
       
   104 	repository->Get(KVedMemoryInUse, memoryInUse);
       
   105 	SetMemoryInUse( (CAknMemorySelectionDialog::TMemory)memoryInUse );
       
   106 
       
   107 	repository->Get(KVedDefaultVideoName, iDefaultVideoName);
       
   108 
       
   109 	repository->Get(KVedDefaultSnapshotName, iDefaultSnapshotName);
       
   110 
       
   111 	CleanupStack::PopAndDestroy(repository);	
       
   112 	}
       
   113 
       
   114 void TVeiSettings::SaveL() const
       
   115 	{
       
   116 	CRepository* repository = CRepository::NewLC(KCRUidVideoEditor);
       
   117 	
       
   118 	repository->Set(KVedSaveQuality, (TInt)iSaveQuality);
       
   119 
       
   120 	repository->Set(KVedMemoryInUse, (TInt)iMemoryInUse);
       
   121 
       
   122 	repository->Set(KVedDefaultVideoName, iDefaultVideoName);
       
   123 
       
   124 	repository->Set(KVedDefaultSnapshotName, iDefaultSnapshotName);
       
   125 
       
   126 	CleanupStack::PopAndDestroy(repository);
       
   127 	}
       
   128 
       
   129 #endif
       
   130 
       
   131 // End of File