57
|
1 |
/*
|
|
2 |
* Copyright (c) 2008 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 the License "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: CVcxHgMyVideosVideoListItem class implementation*
|
|
15 |
*/
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
// INCLUDE FILES
|
|
21 |
#include <mpxmedia.h>
|
|
22 |
#include <collate.h>
|
|
23 |
#include <mpxmediageneraldefs.h>
|
|
24 |
#include <mpxmediageneralextdefs.h>
|
|
25 |
#include "vcxhgmyvideosvideolistitem.h"
|
|
26 |
|
|
27 |
// ============================ MEMBER FUNCTIONS ===============================
|
|
28 |
|
|
29 |
// -----------------------------------------------------------------------------
|
|
30 |
// CVcxHgMyVideosVideoListItem::NewL()
|
|
31 |
// -----------------------------------------------------------------------------
|
|
32 |
//
|
|
33 |
CVcxHgMyVideosVideoListItem* CVcxHgMyVideosVideoListItem::NewL( CMPXMedia* aMPXMedia )
|
|
34 |
{
|
|
35 |
CVcxHgMyVideosVideoListItem* self =
|
|
36 |
CVcxHgMyVideosVideoListItem::NewLC( aMPXMedia );
|
|
37 |
CleanupStack::Pop( self );
|
|
38 |
return self;
|
|
39 |
}
|
|
40 |
|
|
41 |
// -----------------------------------------------------------------------------
|
|
42 |
// CVcxHgMyVideosVideoListItem::NewLC()
|
|
43 |
// -----------------------------------------------------------------------------
|
|
44 |
//
|
|
45 |
CVcxHgMyVideosVideoListItem* CVcxHgMyVideosVideoListItem::NewLC( CMPXMedia* aMPXMedia )
|
|
46 |
{
|
|
47 |
CVcxHgMyVideosVideoListItem* self =
|
|
48 |
new (ELeave) CVcxHgMyVideosVideoListItem( aMPXMedia );
|
|
49 |
CleanupStack::PushL( self );
|
|
50 |
self->ConstructL();
|
|
51 |
return self;
|
|
52 |
}
|
|
53 |
|
|
54 |
// -----------------------------------------------------------------------------
|
|
55 |
// CVcxHgMyVideosVideoListItem::CVcxHgMyVideosVideoListItem()
|
|
56 |
// -----------------------------------------------------------------------------
|
|
57 |
//
|
|
58 |
CVcxHgMyVideosVideoListItem::CVcxHgMyVideosVideoListItem( CMPXMedia* aMPXMedia ) :
|
|
59 |
iMedia( aMPXMedia )
|
|
60 |
{
|
|
61 |
}
|
|
62 |
|
|
63 |
// -----------------------------------------------------------------------------
|
|
64 |
// CVcxHgMyVideosVideoListItem::ConstructL()
|
|
65 |
// -----------------------------------------------------------------------------
|
|
66 |
//
|
|
67 |
void CVcxHgMyVideosVideoListItem::ConstructL()
|
|
68 |
{
|
|
69 |
// No implementation required.
|
|
70 |
}
|
|
71 |
|
|
72 |
// -----------------------------------------------------------------------------
|
|
73 |
// CVcxHgMyVideosVideoListItem::~CVcxHgMyVideosVideoListItem()
|
|
74 |
// -----------------------------------------------------------------------------
|
|
75 |
//
|
|
76 |
CVcxHgMyVideosVideoListItem::~CVcxHgMyVideosVideoListItem()
|
|
77 |
{
|
|
78 |
delete iMedia;
|
|
79 |
}
|
|
80 |
|
|
81 |
// -----------------------------------------------------------------------------
|
|
82 |
// CVcxHgMyVideosVideoListItem::CompareBySize()
|
|
83 |
// -----------------------------------------------------------------------------
|
|
84 |
//
|
|
85 |
TInt CVcxHgMyVideosVideoListItem::CompareBySize(
|
|
86 |
const CVcxHgMyVideosVideoListItem& aNewVideo,
|
|
87 |
const CVcxHgMyVideosVideoListItem& aVideoInArray )
|
|
88 |
{
|
|
89 |
TInt result( 0 );
|
|
90 |
|
|
91 |
TInt64 newItemsSize = aNewVideo.iMedia->ValueTObjectL<TInt64>( KMPXMediaGeneralExtSizeInt64 );
|
|
92 |
TInt64 arrayItemsSize = aVideoInArray.iMedia->ValueTObjectL<TInt64>( KMPXMediaGeneralExtSizeInt64 );
|
|
93 |
|
|
94 |
if ( arrayItemsSize > newItemsSize )
|
|
95 |
{
|
|
96 |
result = -1;
|
|
97 |
}
|
|
98 |
else if ( arrayItemsSize < newItemsSize )
|
|
99 |
{
|
|
100 |
result = 1;
|
|
101 |
}
|
|
102 |
return result;
|
|
103 |
}
|
|
104 |
|
|
105 |
// -----------------------------------------------------------------------------
|
|
106 |
// CVcxHgMyVideosVideoListItem::CompareByName()
|
|
107 |
// -----------------------------------------------------------------------------
|
|
108 |
//
|
|
109 |
TInt CVcxHgMyVideosVideoListItem::CompareByName(
|
|
110 |
const CVcxHgMyVideosVideoListItem& aNewVideo,
|
|
111 |
const CVcxHgMyVideosVideoListItem& aVideoInArray )
|
|
112 |
{
|
|
113 |
TPtrC newVideoName( aNewVideo.iMedia->ValueText( KMPXMediaGeneralTitle ) );
|
|
114 |
TPtrC videoInArrayName( aVideoInArray.iMedia->ValueText( KMPXMediaGeneralTitle ));
|
|
115 |
|
|
116 |
TCollationMethod collationMethod = *Mem::CollationMethodByIndex( 0 ); // get the standard method
|
|
117 |
collationMethod.iFlags |= TCollationMethod::EFoldCase;
|
|
118 |
|
|
119 |
return newVideoName.CompareC( videoInArrayName, 3, &collationMethod );
|
|
120 |
}
|
|
121 |
|
|
122 |
// -----------------------------------------------------------------------------
|
|
123 |
// CVcxHgMyVideosVideoListItem::CompareByDate()
|
|
124 |
// -----------------------------------------------------------------------------
|
|
125 |
//
|
|
126 |
TInt CVcxHgMyVideosVideoListItem::CompareByDate(
|
|
127 |
const CVcxHgMyVideosVideoListItem& aNewVideo,
|
|
128 |
const CVcxHgMyVideosVideoListItem& aVideoInArray )
|
|
129 |
{
|
|
130 |
TInt result( 0 );
|
|
131 |
|
|
132 |
TInt64 newItemsDate = aNewVideo.iMedia->ValueTObjectL<TInt64>( KMPXMediaGeneralDate );
|
|
133 |
TInt64 arrayItemsDate = aVideoInArray.iMedia->ValueTObjectL<TInt64>( KMPXMediaGeneralDate );
|
|
134 |
|
|
135 |
if ( arrayItemsDate > newItemsDate )
|
|
136 |
{
|
|
137 |
result = 1;
|
|
138 |
}
|
|
139 |
else if ( arrayItemsDate < newItemsDate )
|
|
140 |
{
|
|
141 |
result = -1;
|
|
142 |
}
|
|
143 |
return result;
|
|
144 |
}
|
|
145 |
|
|
146 |
// -----------------------------------------------------------------------------
|
|
147 |
// CVcxHgMyVideosVideoListItem::Media()
|
|
148 |
// -----------------------------------------------------------------------------
|
|
149 |
//
|
|
150 |
CMPXMedia* CVcxHgMyVideosVideoListItem::Media()
|
|
151 |
{
|
|
152 |
return iMedia;
|
|
153 |
}
|