videditor/ManualVideoEditor/src/StoryboardItems.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 // System includes
       
    23 #include <fbs.h>
       
    24 
       
    25 // User includes
       
    26 #include "StoryboardItems.h"
       
    27 
       
    28 // local constants
       
    29 const TInt KNoThumbnailFrameWidth = 8;
       
    30 
       
    31 
       
    32 // ================= MEMBER FUNCTIONS =======================
       
    33 
       
    34 /* **********************************************************************
       
    35  * CStoryboardVideoItem
       
    36  * **********************************************************************/
       
    37 CStoryboardVideoItem* CStoryboardVideoItem::NewL( const CFbsBitmap& aStartIcon, 
       
    38                                                   const CFbsBitmap& aStartIconMask, 
       
    39                                                   const TDesC& aFilename,
       
    40                                                   TBool aIsFile,
       
    41                                                   const TDesC& aAlbum )
       
    42     {
       
    43     CStoryboardVideoItem* self = CStoryboardVideoItem::NewLC( aStartIcon,
       
    44         aStartIconMask, aFilename, aIsFile, aAlbum );
       
    45     CleanupStack::Pop( self );
       
    46     return self;
       
    47     }
       
    48 
       
    49 CStoryboardVideoItem* CStoryboardVideoItem::NewLC( const CFbsBitmap& aStartIcon, 
       
    50                                                    const CFbsBitmap& aStartIconMask, 
       
    51                                                    const TDesC& aFilename, 
       
    52                                                    TBool aIsFile,
       
    53                                                    const TDesC& aAlbum )
       
    54     {
       
    55     CStoryboardVideoItem* self = new( ELeave )CStoryboardVideoItem();
       
    56     CleanupStack::PushL( self );
       
    57     self->ConstructL( aStartIcon, aStartIconMask, aFilename, aIsFile, aAlbum );
       
    58     return self;
       
    59     }
       
    60 
       
    61 CStoryboardVideoItem::~CStoryboardVideoItem()
       
    62     {
       
    63     if ( iFilename )
       
    64         {
       
    65         delete iFilename;
       
    66         }
       
    67 
       
    68     if ( iAlbumName )
       
    69         {
       
    70         delete iAlbumName;
       
    71         }
       
    72 
       
    73     delete iIconBitmap;
       
    74     delete iIconMask;
       
    75 
       
    76     delete iLastFrameBitmap;
       
    77     delete iLastFrameMask;
       
    78 
       
    79     delete iTimelineBitmap;
       
    80     delete iTimelineMask;
       
    81     }
       
    82 
       
    83 CStoryboardVideoItem::CStoryboardVideoItem()
       
    84     {
       
    85     }
       
    86 
       
    87 void CStoryboardVideoItem::InsertLastFrameL( const CFbsBitmap& aBitmap, const CFbsBitmap& aMask )
       
    88     {
       
    89     delete iLastFrameBitmap;
       
    90     iLastFrameBitmap = NULL;
       
    91     delete iLastFrameMask;
       
    92     iLastFrameMask = NULL;
       
    93 
       
    94     CFbsBitmap* icon = new( ELeave )CFbsBitmap;
       
    95     icon->Duplicate( aBitmap.Handle());
       
    96     CFbsBitmap* mask = new( ELeave )CFbsBitmap;
       
    97     mask->Duplicate( aMask.Handle());
       
    98 
       
    99     iLastFrameBitmap = icon;
       
   100     iLastFrameMask = mask;
       
   101     }
       
   102 
       
   103 void CStoryboardVideoItem::InsertFirstFrameL( const CFbsBitmap& aBitmap, const CFbsBitmap& aMask )
       
   104     {
       
   105     delete iIconBitmap;
       
   106     iIconBitmap = NULL;
       
   107     delete iIconMask;
       
   108     iIconMask = NULL;
       
   109 
       
   110     CFbsBitmap* icon = new( ELeave )CFbsBitmap;
       
   111     icon->Duplicate( aBitmap.Handle());
       
   112     CFbsBitmap* mask = new( ELeave )CFbsBitmap;
       
   113     mask->Duplicate( aMask.Handle());
       
   114 
       
   115     iIconBitmap = icon;
       
   116     iIconMask = mask;
       
   117     }
       
   118 
       
   119 void CStoryboardVideoItem::InsertTimelineFrameL( const CFbsBitmap& aBitmap, const CFbsBitmap& aMask )
       
   120     {
       
   121     delete iTimelineBitmap;
       
   122     iTimelineBitmap = NULL;
       
   123     delete iTimelineMask;
       
   124     iTimelineMask = NULL;
       
   125 
       
   126     CFbsBitmap* icon = new( ELeave )CFbsBitmap;
       
   127     icon->Duplicate( aBitmap.Handle());
       
   128     CFbsBitmap* mask = new( ELeave )CFbsBitmap;
       
   129     mask->Duplicate( aMask.Handle());
       
   130 
       
   131     iTimelineBitmap = icon;
       
   132     iTimelineMask = mask;
       
   133     }
       
   134 
       
   135 void CStoryboardVideoItem::ConstructL( const CFbsBitmap& aStartIcon, 
       
   136                                        const CFbsBitmap& aStartIconMask, 
       
   137                                        const TDesC& aFilename,
       
   138                                        TBool aIsFile,
       
   139                                        const TDesC& aAlbum )
       
   140     {
       
   141     CFbsBitmap* icon = new( ELeave )CFbsBitmap;
       
   142     icon->Duplicate( aStartIcon.Handle());
       
   143     CFbsBitmap* mask = new( ELeave )CFbsBitmap;
       
   144     mask->Duplicate( aStartIconMask.Handle());
       
   145 
       
   146     TSize thumbResolution;
       
   147 	thumbResolution.iWidth = ( aStartIcon.SizeInPixels() ).iWidth-KNoThumbnailFrameWidth;
       
   148 	thumbResolution.iHeight = ( aStartIcon.SizeInPixels() ).iHeight-KNoThumbnailFrameWidth;
       
   149 
       
   150     iIconSize = thumbResolution;
       
   151     iIconBitmap = icon;
       
   152     iIconMask = mask;
       
   153 
       
   154     iFilename = HBufC::NewL( aFilename.Length());
       
   155     *iFilename = aFilename;
       
   156 
       
   157     iAlbumName = HBufC::NewL( aAlbum.Length());
       
   158     *iAlbumName = aAlbum;
       
   159 
       
   160     iDateModified.HomeTime();
       
   161     iIsFile = aIsFile;
       
   162     }
       
   163 
       
   164 /* **********************************************************************
       
   165  * CStoryboardAudioItem
       
   166  * **********************************************************************/
       
   167 
       
   168 CStoryboardAudioItem* CStoryboardAudioItem::NewLC( TBool aRecordedAudio, 
       
   169                                                    const TDesC& aFilename )
       
   170     {
       
   171     CStoryboardAudioItem* self = new( ELeave )CStoryboardAudioItem(
       
   172                                      aRecordedAudio );
       
   173     CleanupStack::PushL( self );
       
   174     self->ConstructL( aFilename );
       
   175     return self;
       
   176     }
       
   177 
       
   178 
       
   179 CStoryboardAudioItem::~CStoryboardAudioItem()
       
   180     {
       
   181     delete iFilename;
       
   182     }
       
   183 
       
   184 
       
   185 CStoryboardAudioItem::CStoryboardAudioItem(TBool aRecordedAudio)
       
   186                                             : iRecordedAudio(aRecordedAudio)
       
   187     {
       
   188     }
       
   189 
       
   190 void CStoryboardAudioItem::ConstructL( const TDesC& aFilename )
       
   191     {
       
   192     iFilename = HBufC::NewL( aFilename.Length());
       
   193     *iFilename = aFilename;
       
   194     }
       
   195 
       
   196 // End of File