author | hgs |
Wed, 06 Oct 2010 14:49:39 +0530 | |
changeset 71 | 27f2d7aec52a |
parent 69 | 45459746d5e8 |
permissions | -rw-r--r-- |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1 |
/* |
69 | 2 |
* Copyright (c) 2009 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 "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: ?Description |
|
15 |
* |
|
16 |
*/ |
|
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
17 |
|
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
18 |
#include <glxmediamodel.h> |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
19 |
#include <hbicon.h> |
40 | 20 |
#include <qimage.h> |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
21 |
#include <glxmodelparm.h> |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
22 |
#include <QCache> |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
23 |
#include <QDebug> |
40 | 24 |
#include <glxmlwrapper.h> |
45 | 25 |
#include"glxdrmutilitywrapper.h" |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
26 |
|
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
27 |
#include <glxfiltergeneraldefs.h> |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
28 |
|
45 | 29 |
#include <glximageviewermanager.h> |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
30 |
//#define GLXPERFORMANCE_LOG |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
31 |
#include <glxperformancemacro.h> |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
32 |
|
24
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
33 |
#include "glxicondefs.h" //Contains the icon names/Ids |
54 | 34 |
#include "glxcollectionpluginall.hrh" |
35 |
#include "glxviewids.h" |
|
36 |
||
37 |
#define DELTA_IMAGE 5 |
|
38 |
#define INITIAL_POPULATE_IMAGE_COUNT 30 |
|
24
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
39 |
|
69 | 40 |
GlxMediaModel::GlxMediaModel( GlxModelParm & modelParm ) |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
41 |
{ |
69 | 42 |
qDebug( "GlxMediaModel::GlxMediaModel" ); |
43 |
||
44 |
thumbnailPopulatedFlag = modelParm.collection() == KGlxCollectionPluginAllImplementationUid |
|
45 |
? false : true; |
|
46 |
mPaintPage = modelParm.collection() == KGlxCollectionPluginAllImplementationUid ? true : false; |
|
47 |
mMLWrapper = new GlxMLWrapper( modelParm.collection(), 0, modelParm.filterType(), NULL, |
|
48 |
modelParm.fetcherFiterType() ); |
|
49 |
mMLWrapper->setContextMode( modelParm.contextMode() ); |
|
50 |
mContextMode = modelParm.contextMode(); |
|
51 |
mDRMUtilityWrapper = new GlxDRMUtilityWrapper(); |
|
52 |
||
53 |
int err = connect( mMLWrapper, SIGNAL(updateItem(int, GlxTBContextType)), this, |
|
54 |
SLOT(itemUpdated(int, GlxTBContextType)) ); |
|
55 |
qDebug( "updateItem() connection status %d", err ); |
|
56 |
err = connect( mMLWrapper, SIGNAL(itemCorrupted(int)), this, SLOT(itemCorrupted(int)) ); |
|
57 |
qDebug( "itemCorrupted() connection status %d", err ); |
|
58 |
err = connect( mMLWrapper, SIGNAL(insertItems(int, int)), this, SLOT(itemsAdded(int, int)) ); |
|
59 |
qDebug( "updateItem() connection status %d", err ); |
|
60 |
err = connect( mMLWrapper, SIGNAL(removeItems(int, int)), this, SLOT(itemsRemoved(int, int)) ); |
|
61 |
qDebug( "updateItem() connection status %d", err ); |
|
62 |
err = connect( this, SIGNAL(iconAvailable(int, HbIcon*, GlxTBContextType)), this, |
|
63 |
SLOT(updateItemIcon(int, HbIcon*, GlxTBContextType)) ); |
|
64 |
qDebug( "iconAvailable() connection status %d", err ); |
|
65 |
err = connect( mMLWrapper, SIGNAL(updateAlbumTitle(QString)), this, |
|
66 |
SLOT(albumTitleUpdated(QString)) ); |
|
67 |
qDebug( "updateAlbumTitle() connection status %d", err ); |
|
68 |
err = connect( mMLWrapper, SIGNAL(populated()), this, SLOT(modelpopulated()) ); |
|
69 |
err = connect( mMLWrapper, SIGNAL(updateDetails()), this, SLOT(updateDetailItems()) ); |
|
70 |
||
71 |
itemIconCache.setMaxCost( 20 ); //Changed While Doing Media Wall |
|
72 |
itemFsIconCache.setMaxCost( 5 ); |
|
73 |
||
74 |
m_DefaultIcon = new HbIcon( GLXICON_DEFAULT ); |
|
75 |
m_CorruptIcon = new HbIcon( GLXICON_CORRUPT ); |
|
76 |
mFocusIndex = -1; |
|
77 |
mSubState = -1; |
|
78 |
mTempVisibleWindowIndex = 0; |
|
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
79 |
} |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
80 |
|
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
81 |
GlxMediaModel::~GlxMediaModel() |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
82 |
{ |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
83 |
//itemadded.clear(); |
69 | 84 |
qDebug( "GlxMediaModel::~GlxMediaModel" ); |
85 |
itemIconCache.clear(); |
|
86 |
itemFsIconCache.clear(); |
|
87 |
delete m_DefaultIcon; |
|
88 |
m_DefaultIcon = NULL; |
|
89 |
delete m_CorruptIcon; |
|
90 |
m_CorruptIcon = NULL; |
|
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
91 |
delete mMLWrapper; |
69 | 92 |
delete mDRMUtilityWrapper; |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
93 |
} |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
94 |
|
44 | 95 |
//------------------------------------------------------------------------------------------------------------ |
96 |
//setContextMode |
|
97 |
//------------------------------------------------------------------------------------------------------------ |
|
69 | 98 |
void GlxMediaModel::setContextMode( GlxContextMode contextMode ) |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
99 |
{ |
69 | 100 |
if ( contextMode == GlxContextComment ) { |
101 |
mMLWrapper->setContextMode( contextMode ); |
|
102 |
} |
|
103 |
else { |
|
104 |
if ( mContextMode != contextMode ) { |
|
105 |
||
106 |
itemFsIconCache.clear(); |
|
107 |
mMLWrapper->setContextMode( contextMode ); |
|
108 |
mContextMode = contextMode; |
|
109 |
if ( mContextMode == GlxContextLsGrid || mContextMode == GlxContextPtGrid ) { |
|
110 |
itemIconCache.clear(); |
|
111 |
//emit dataChanged( index( 0, 0), index( rowCount() - 1, 0) ); // Not Needed for HgWidget |
|
112 |
} |
|
44 | 113 |
} |
69 | 114 |
} |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
115 |
} |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
116 |
|
44 | 117 |
//------------------------------------------------------------------------------------------------------------ |
118 |
//removeContextMode |
|
119 |
//------------------------------------------------------------------------------------------------------------ |
|
69 | 120 |
void GlxMediaModel::removeContextMode( GlxContextMode contextMode ) |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
121 |
{ |
69 | 122 |
mMLWrapper->removeContextMode( contextMode ); |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
123 |
} |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
124 |
|
69 | 125 |
int GlxMediaModel::rowCount( const QModelIndex &parent ) const |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
126 |
{ |
69 | 127 |
Q_UNUSED(parent); |
128 |
qDebug( "GlxMediaModel::rowCount %d", mMLWrapper->getItemCount() ); |
|
129 |
return mMLWrapper->getItemCount(); |
|
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
130 |
} |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
131 |
|
69 | 132 |
int GlxMediaModel::columnCount( const QModelIndex &parent ) const |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
133 |
{ |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
134 |
Q_UNUSED(parent); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
135 |
return 1; |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
136 |
} |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
137 |
|
69 | 138 |
QModelIndex GlxMediaModel::parent( const QModelIndex &child ) const |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
139 |
{ |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
140 |
Q_UNUSED(child); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
141 |
|
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
142 |
//returns always invalid model index |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
143 |
return QModelIndex(); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
144 |
} |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
145 |
|
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
146 |
|
69 | 147 |
QVariant GlxMediaModel::itemImageData( const QModelIndex &index, int role ) const |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
148 |
{ |
69 | 149 |
HbIcon* itemIcon = NULL; |
150 |
QImage itemImage; |
|
151 |
int itemIndex = index.row(); |
|
42 | 152 |
|
69 | 153 |
if ( role == Qt::DisplayRole ) { |
154 |
return QVariant(); |
|
26
c499df2dbb33
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
155 |
} |
c499df2dbb33
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
156 |
|
40 | 157 |
if ( role == GlxHgVisibilityRole ) { |
158 |
return TRUE; |
|
159 |
} |
|
69 | 160 |
|
161 |
if ( role == GlxDefaultImage ) { |
|
162 |
// this image Creation is Slow. But what to do, Q class's Does not undersatnd our Localised File names |
|
163 |
return m_DefaultIcon->pixmap().toImage().convertToFormat( QImage::Format_ARGB32_Premultiplied ); |
|
164 |
} |
|
165 |
||
166 |
qDebug( "GlxMediaModel::data buffer concept index %d role %d", index.row(), role ); |
|
167 |
if ( ( !index.isValid() ) || ( index.row() >= rowCount() ) ) { |
|
40 | 168 |
return QVariant(); |
169 |
} |
|
170 |
||
69 | 171 |
//retrieve Data from Media List |
50 | 172 |
if ( role == Qt::DecorationRole ) { |
69 | 173 |
itemIcon = GetGridIconItem( itemIndex, GlxTBContextGrid ); |
174 |
if ( itemIcon == NULL || itemIcon->isNull() ) { |
|
50 | 175 |
itemIcon = getCorruptDefaultIcon( index ); |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
176 |
} |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
177 |
return *itemIcon; |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
178 |
} |
69 | 179 |
|
180 |
if ( role == GlxQImageSmall ) { |
|
181 |
return mMLWrapper->retrieveItemImage( itemIndex, GlxTBContextGrid ); |
|
50 | 182 |
} |
40 | 183 |
|
69 | 184 |
if ( role == GlxFsImageRole ) { |
185 |
return getFullScreenIcon( itemIndex ); |
|
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
186 |
} |
69 | 187 |
|
188 |
if ( role == GlxQImageLarge ) { |
|
189 |
return getFullScreenImage( itemIndex ); |
|
50 | 190 |
} |
40 | 191 |
|
69 | 192 |
if ( role == GlxHdmiBitmap ) { |
193 |
return mMLWrapper->RetrieveBitmap( itemIndex ); |
|
194 |
} |
|
195 |
||
196 |
return QVariant(); |
|
197 |
} |
|
198 |
||
199 |
QVariant GlxMediaModel::collectionProperty( int role ) const |
|
200 |
{ |
|
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
201 |
QModelIndex idx; |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
202 |
if ( GlxFocusIndexRole == role ) { |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
203 |
idx = getFocusIndex(); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
204 |
return idx.row(); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
205 |
} |
50 | 206 |
|
69 | 207 |
if ( role == GlxSubStateRole ) { |
208 |
return mSubState; |
|
209 |
} |
|
210 |
||
211 |
if ( role == GlxPopulated ) { |
|
212 |
return mMLWrapper->IsPopulated(); |
|
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
213 |
} |
50 | 214 |
|
69 | 215 |
if ( role == GlxViewTitle ) { |
216 |
return mMLWrapper->retrieveViewTitle(); |
|
217 |
} |
|
218 |
||
219 |
if ( role == GlxVisualWindowIndex ) { |
|
220 |
return mMLWrapper->getVisibleWindowIndex(); |
|
62 | 221 |
} |
69 | 222 |
|
223 |
if ( role == GlxPaintPageFlag ) { |
|
224 |
return mPaintPage; |
|
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
225 |
} |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
226 |
|
69 | 227 |
return QVariant(); |
228 |
} |
|
229 |
||
230 |
QVariant GlxMediaModel::itemProperty( const QModelIndex &index, int role ) const |
|
231 |
{ |
|
232 |
if ( ( !index.isValid() ) || ( index.row() >= rowCount() ) ) { |
|
233 |
return QVariant(); |
|
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
234 |
} |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
235 |
|
69 | 236 |
int itemIndex = index.row(); |
237 |
||
238 |
if ( role == GlxFrameCount ) { |
|
239 |
return ( mMLWrapper->retrieveItemFrameCount( itemIndex ) ); |
|
24
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
240 |
} |
50 | 241 |
|
242 |
if ( role == GlxImageCorruptRole ) { |
|
243 |
return mMLWrapper->isCorruptedImage( itemIndex ); |
|
244 |
} |
|
69 | 245 |
|
246 |
if ( role == GlxUriRole ) { |
|
247 |
return ( mMLWrapper->retrieveItemUri( itemIndex ) ); |
|
248 |
} |
|
44 | 249 |
|
69 | 250 |
if ( role == GlxSizeRole ) { |
251 |
return mMLWrapper->retrieveItemSize( itemIndex ); |
|
252 |
} |
|
253 |
||
254 |
if ( role == GlxImageTitle ) { |
|
255 |
return mMLWrapper->retrieveListTitle( itemIndex ); |
|
256 |
} |
|
257 |
||
258 |
if ( role == GlxDimensionsRole ) { |
|
259 |
return ( mMLWrapper->retrieveItemDimension( itemIndex ) ); |
|
260 |
} |
|
261 |
||
262 |
if ( role == GlxDateRole ) { |
|
263 |
return ( mMLWrapper->retrieveItemDate( itemIndex ) ); |
|
264 |
} |
|
265 |
||
266 |
if ( role == GlxTimeRole ) { |
|
267 |
return mMLWrapper->retrieveItemTime( itemIndex ); |
|
44 | 268 |
} |
69 | 269 |
|
270 |
if ( role == GlxDescRole ) { |
|
271 |
return mMLWrapper->retrieveListDesc( itemIndex ); |
|
272 |
} |
|
273 |
||
274 |
return QVariant(); |
|
44 | 275 |
|
69 | 276 |
} |
277 |
||
278 |
QVariant GlxMediaModel::data( const QModelIndex &index, int role ) const |
|
279 |
{ |
|
280 |
if ( role < GlxItemImageDataEnd ) { |
|
281 |
return itemImageData( index, role ); |
|
282 |
} |
|
283 |
||
284 |
if ( role < GlxCollectionPropertyEnd ) { |
|
285 |
return collectionProperty( role ); |
|
286 |
} |
|
287 |
||
288 |
if ( role < GlxItemPropertyEnd ) { |
|
289 |
return itemProperty( index, role); |
|
290 |
} |
|
291 |
||
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
292 |
return QVariant(); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
293 |
} |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
294 |
|
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
295 |
//GetGridIconItem |
69 | 296 |
HbIcon* GlxMediaModel::GetGridIconItem( int itemIndex, GlxTBContextType tbContextType ) const |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
297 |
{ |
69 | 298 |
HbIcon* itemIcon = itemIconCache[ itemIndex ]; //Initialize icon from the Cache will be NULL if Item not present |
299 |
if ( !itemIcon ) { |
|
300 |
itemIcon = mMLWrapper->retrieveItemIcon( itemIndex, tbContextType ); |
|
301 |
if ( itemIcon ) { |
|
302 |
emit iconAvailable( itemIndex, itemIcon, GlxTBContextGrid ); |
|
303 |
} |
|
304 |
itemIcon = itemIconCache[ itemIndex ]; |
|
305 |
} |
|
306 |
return itemIcon; |
|
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
307 |
|
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
308 |
} |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
309 |
|
69 | 310 |
HbIcon* GlxMediaModel::GetFsIconItem( int itemIndex, GlxTBContextType tbContextType ) const |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
311 |
{ |
69 | 312 |
HbIcon* itemIcon = NULL; //Initialize icon from the Cache will be NULL if Item not present |
45 | 313 |
|
69 | 314 |
bool drmProtected = mMLWrapper->IsDrmProtected( itemIndex ); |
315 |
if ( drmProtected ) { |
|
316 |
QString imagePath = mMLWrapper->retrieveItemUri( itemIndex ); |
|
317 |
bool rightValid = mMLWrapper->IsDrmValid( itemIndex ); |
|
318 |
if ( !rightValid ) { |
|
45 | 319 |
//show error note here |
69 | 320 |
if ( itemIndex == mFocusIndex ) { |
321 |
mDRMUtilityWrapper->ShowRightsInfo( imagePath ); |
|
45 | 322 |
} |
69 | 323 |
return itemIcon; |
324 |
} |
|
325 |
else { |
|
45 | 326 |
//consumeDrmRights(imagePath); |
69 | 327 |
mDRMUtilityWrapper->ConsumeRights( imagePath ); |
328 |
bool rightValid = mDRMUtilityWrapper->ItemRightsValidityCheck( imagePath, true ); |
|
329 |
mMLWrapper->setDrmValid( itemIndex, rightValid ); |
|
330 |
} |
|
331 |
} |
|
332 |
||
333 |
itemIcon = itemFsIconCache[ itemIndex ]; //Initialize icon from the Cache will be NULL if Item not present |
|
334 |
if ( !itemIcon ) { |
|
335 |
itemIcon = mMLWrapper->retrieveItemIcon( itemIndex, tbContextType ); |
|
336 |
if ( itemIcon ) { |
|
337 |
emit iconAvailable( itemIndex, itemIcon, tbContextType ); |
|
45 | 338 |
} |
69 | 339 |
itemIcon = itemFsIconCache[ itemIndex ]; |
340 |
} |
|
341 |
return itemIcon; |
|
342 |
} |
|
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
343 |
|
69 | 344 |
HbIcon GlxMediaModel::gridToFullscreenIcon( HbIcon * icon, int itemIndex ) const |
345 |
{ |
|
346 |
qDebug( "GlxMediaModel::gridToFullscreenIcon" ); |
|
347 |
QPixmap tempPixmap = icon->qicon().pixmap( 128, 128 ); |
|
348 |
QSize itemSize = mMLWrapper->retrieveItemDimension( itemIndex ); |
|
349 |
QSize sz = ( mContextMode == GlxContextLsFs ) ? QSize( 640, 360 ) : QSize( 360, 640 ); |
|
350 |
if ( !( ( itemSize.width() < sz.width() ) && ( itemSize.height() < sz.height() ) ) ) { |
|
351 |
itemSize.scale( sz, Qt::KeepAspectRatio ); |
|
352 |
} |
|
353 |
tempPixmap = tempPixmap.scaled( itemSize, Qt::IgnoreAspectRatio ); |
|
354 |
return HbIcon( QIcon( tempPixmap ) ); |
|
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
355 |
} |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
356 |
|
69 | 357 |
HbIcon GlxMediaModel::getFullScreenIcon( int itemIndex ) const |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
358 |
{ |
69 | 359 |
HbIcon* itemIcon = NULL; |
360 |
if ( mContextMode == GlxContextLsFs ) { |
|
361 |
itemIcon = GetFsIconItem( itemIndex, GlxTBContextLsFs ); |
|
362 |
} |
|
363 |
else if ( mContextMode == GlxContextPtFs ) { |
|
364 |
itemIcon = GetFsIconItem( itemIndex, GlxTBContextPtFs ); |
|
365 |
} |
|
366 |
||
367 |
if ( itemIcon == NULL ) { |
|
368 |
HbIcon* tempIcon = GetGridIconItem( itemIndex, GlxTBContextGrid ); |
|
369 |
if ( tempIcon && !tempIcon->isNull() ) { |
|
370 |
HbIcon tmp = gridToFullscreenIcon( tempIcon, itemIndex ); |
|
371 |
if ( !tmp.isNull() ) { |
|
372 |
return tmp; |
|
373 |
} |
|
374 |
} |
|
375 |
} |
|
376 |
||
377 |
if ( itemIcon == NULL || itemIcon->isNull() ) { |
|
378 |
itemIcon = getCorruptDefaultIcon( index( itemIndex, 0 ) ); |
|
379 |
} |
|
380 |
return *itemIcon; |
|
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
381 |
} |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
382 |
|
69 | 383 |
QImage GlxMediaModel::getFullScreenImage( int itemIndex ) const |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
384 |
{ |
69 | 385 |
QImage itemImage; |
386 |
if ( mContextMode == GlxContextLsFs ) { |
|
387 |
itemImage = mMLWrapper->retrieveItemImage( itemIndex, GlxTBContextLsFs ); |
|
388 |
} |
|
389 |
else { |
|
390 |
itemImage = mMLWrapper->retrieveItemImage( itemIndex, GlxTBContextPtFs ); |
|
391 |
} |
|
392 |
if ( !itemImage.isNull() ) { |
|
393 |
return itemImage; |
|
394 |
} |
|
395 |
else { |
|
396 |
itemImage = mMLWrapper->retrieveItemImage( itemIndex, GlxTBContextGrid ); |
|
397 |
if ( !itemImage.isNull() ) { |
|
398 |
QSize sz = ( mContextMode == GlxContextLsFs ) ? QSize( 640, 360 ) : QSize( 360, 640 ); |
|
399 |
itemImage = itemImage.scaled( sz, Qt::KeepAspectRatio ); |
|
400 |
} |
|
401 |
return itemImage; |
|
402 |
} |
|
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
403 |
} |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
404 |
|
71 | 405 |
void GlxMediaModel::itemUpdated( int itemIndex, GlxTBContextType tbContextType ) |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
406 |
{ |
71 | 407 |
qDebug( "GlxMediaModel::itemUpdated %d", itemIndex ); |
69 | 408 |
//clear the grid and FS cache if they have any icons with them for that index |
409 |
if ( tbContextType == GlxTBContextGrid ) { |
|
410 |
if ( !thumbnailPopulatedFlag ) { |
|
71 | 411 |
thumbnailPopulatedCheck( itemIndex ); |
69 | 412 |
} |
71 | 413 |
itemIconCache.remove( itemIndex ); |
414 |
emit dataChanged( index( itemIndex, 0 ), index( itemIndex, 0 ) ); |
|
69 | 415 |
} |
416 |
if ( tbContextType == GlxTBContextLsFs || tbContextType == GlxTBContextPtFs ) { |
|
71 | 417 |
itemFsIconCache.remove( itemIndex ); |
418 |
emit fullScreenDataChanged( index( itemIndex, 0 ), index( itemIndex, 0 ) ); |
|
69 | 419 |
} |
420 |
} |
|
421 |
||
422 |
void GlxMediaModel::itemCorrupted( int itemIndex ) |
|
423 |
{ |
|
424 |
qDebug( "GlxMediaModel::itemCorrupted %d", itemIndex ); |
|
54 | 425 |
if ( !thumbnailPopulatedFlag ) { |
69 | 426 |
thumbnailPopulatedCheck( itemIndex ); |
54 | 427 |
} |
69 | 428 |
emit dataChanged( index( itemIndex, 0 ), index( itemIndex, 0 ) ); |
71 | 429 |
emit fullScreenDataChanged( index( itemIndex, 0 ), index( itemIndex, 0 ) ); |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
430 |
} |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
431 |
|
42 | 432 |
void GlxMediaModel::modelpopulated() |
433 |
{ |
|
69 | 434 |
if ( mTempVisibleWindowIndex != -1 ) { |
50 | 435 |
//Set the visible Window index only ff the index stored in the activity manager is not out of range |
69 | 436 |
if ( rowCount() > mTempVisibleWindowIndex && mTempVisibleWindowIndex > 0 ) { |
437 |
mMLWrapper->setVisibleWindowIndex( mTempVisibleWindowIndex ); |
|
50 | 438 |
} |
439 |
else { |
|
69 | 440 |
mMLWrapper->setVisibleWindowIndex( 0 ); |
50 | 441 |
} |
45 | 442 |
mTempVisibleWindowIndex = -1; |
50 | 443 |
} |
42 | 444 |
emit populated(); |
445 |
} |
|
446 |
||
44 | 447 |
//------------------------------------------------------------------------------------------------------------ |
448 |
//updateDetailItems |
|
449 |
//------------------------------------------------------------------------------------------------------------ |
|
450 |
void GlxMediaModel::updateDetailItems() |
|
451 |
{ |
|
69 | 452 |
qDebug( "GlxMediaModel::updateDetailItems" ); |
44 | 453 |
emit updateDetailsView(); |
454 |
} |
|
455 |
||
69 | 456 |
void GlxMediaModel::itemsAdded( int startIndex, int endIndex ) |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
457 |
{ |
69 | 458 |
qDebug( "GlxMediaModel::itemsAdded %d %d", startIndex, endIndex ); |
459 |
mFocusIndex = -1; |
|
460 |
beginInsertRows( QModelIndex(), startIndex, endIndex ); |
|
461 |
itemIconCache.clear(); |
|
462 |
itemFsIconCache.clear(); |
|
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
463 |
endInsertRows(); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
464 |
} |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
465 |
|
69 | 466 |
void GlxMediaModel::itemsRemoved( int startIndex, int endIndex ) |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
467 |
{ |
69 | 468 |
qDebug( "GlxMediaModel::itemsRemoved %d %d", startIndex, endIndex ); |
469 |
mFocusIndex = -1; |
|
470 |
beginRemoveRows( QModelIndex(), startIndex, endIndex ); |
|
471 |
itemIconCache.clear(); |
|
472 |
itemFsIconCache.clear(); |
|
473 |
endRemoveRows(); |
|
474 |
} |
|
475 |
||
476 |
void GlxMediaModel::updateItemIcon( int itemIndex, HbIcon* itemIcon, GlxTBContextType tbContextType ) |
|
477 |
{ |
|
478 |
qDebug( "GlxMediaModel::updateItemIcon %d", itemIndex ); |
|
479 |
if ( tbContextType == GlxTBContextGrid ) { |
|
480 |
itemIconCache.insert( itemIndex, itemIcon ); |
|
481 |
} |
|
482 |
else if ( tbContextType == GlxTBContextLsFs || tbContextType == GlxTBContextPtFs ) { |
|
483 |
itemFsIconCache.insert( itemIndex, itemIcon ); |
|
484 |
} |
|
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
485 |
} |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
486 |
|
69 | 487 |
void GlxMediaModel::albumTitleUpdated( QString aTitle ) |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
488 |
{ |
69 | 489 |
emit albumTitleAvailable( aTitle ); |
42 | 490 |
} |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
491 |
|
69 | 492 |
void GlxMediaModel::setFocusIndex( const QModelIndex &index ) |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
493 |
{ |
69 | 494 |
qDebug( "GlxMediaModel::setFocusIndex%d", index.row() ); |
495 |
||
496 |
int itemIndex = index.row(); |
|
497 |
if ( itemIndex < rowCount() && itemIndex >= 0 ) { |
|
498 |
mMLWrapper->setFocusIndex( itemIndex ); |
|
499 |
mFocusIndex = itemIndex; |
|
500 |
} |
|
501 |
else if ( rowCount() > 0 ){ |
|
502 |
||
503 |
mMLWrapper->setFocusIndex( 0 ); |
|
504 |
mFocusIndex = itemIndex = 0; |
|
505 |
} |
|
506 |
||
507 |
if ( mSubState != IMAGEVIEWER_S ) { |
|
508 |
if ( mMLWrapper->IsDrmProtected( itemIndex ) && ( !mMLWrapper->IsDrmValid( itemIndex ) ) ) { |
|
509 |
QString imagePath = mMLWrapper->retrieveItemUri( itemIndex ); |
|
510 |
mDRMUtilityWrapper->ShowRightsInfo( imagePath ); |
|
511 |
} |
|
512 |
} |
|
513 |
else { |
|
45 | 514 |
CGlxImageViewerManager* CGlxImageViewerManager = CGlxImageViewerManager::InstanceL(); |
515 |
const TDesC& title = CGlxImageViewerManager->ImageUri()->Des(); |
|
69 | 516 |
QString imagePath = QString::fromUtf16( title.Ptr(), title.Length() ); |
517 |
mDRMUtilityWrapper->ShowRightsInfo( imagePath ); |
|
518 |
} |
|
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
519 |
} |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
520 |
|
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
521 |
QModelIndex GlxMediaModel::getFocusIndex() const |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
522 |
{ |
69 | 523 |
int itemIndex = mFocusIndex; |
524 |
if ( mFocusIndex == -1 ) { |
|
525 |
itemIndex = mMLWrapper->getFocusIndex(); |
|
526 |
} |
|
527 |
||
528 |
return index( itemIndex, 0 ); |
|
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
529 |
} |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
530 |
|
69 | 531 |
void GlxMediaModel::setSelectedIndex( const QModelIndex &index ) |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
532 |
{ |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
533 |
int itemIndex = index.row(); |
69 | 534 |
qDebug( "GlxMediaModel::setSelectedIndex()%d", itemIndex ); |
535 |
mMLWrapper->setSelectedIndex( itemIndex ); |
|
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
536 |
} |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
537 |
|
50 | 538 |
HbIcon * GlxMediaModel::getCorruptDefaultIcon( const QModelIndex &index ) const |
539 |
{ |
|
540 |
if ( mMLWrapper->isCorruptedImage( index.row() ) ) { |
|
69 | 541 |
return m_CorruptIcon; |
50 | 542 |
} |
69 | 543 |
return m_DefaultIcon; |
50 | 544 |
} |
545 |
||
54 | 546 |
void GlxMediaModel::thumbnailPopulatedCheck( int index ) |
547 |
{ |
|
69 | 548 |
int count = rowCount() - DELTA_IMAGE; |
549 |
int maxRange = INITIAL_POPULATE_IMAGE_COUNT + DELTA_IMAGE; |
|
550 |
if ( index >= count || ( index >= INITIAL_POPULATE_IMAGE_COUNT && index < maxRange ) ) { |
|
54 | 551 |
thumbnailPopulatedFlag = TRUE; |
552 |
emit thumbnailPopulated(); |
|
553 |
} |
|
554 |
} |
|
555 |
||
69 | 556 |
bool GlxMediaModel::setData( const QModelIndex & idx, const QVariant & value, int role ) |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
557 |
{ |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
558 |
Q_UNUSED( idx ) |
69 | 559 |
|
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
560 |
if ( GlxContextRole == role ) { |
69 | 561 |
if ( value.isValid() && value.canConvert<int> () ) { |
562 |
setContextMode( (GlxContextMode) value.value<int> () ); |
|
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
563 |
return TRUE; |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
564 |
} |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
565 |
} |
69 | 566 |
|
44 | 567 |
if ( GlxRemoveContextRole == role ) { |
69 | 568 |
if ( value.isValid() && value.canConvert<int> () ) { |
569 |
removeContextMode( (GlxContextMode) value.value<int> () ); |
|
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
570 |
return TRUE; |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
571 |
} |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
572 |
} |
69 | 573 |
|
574 |
if ( GlxFocusIndexRole == role ) { |
|
575 |
if ( value.isValid() && value.canConvert<int> () ) { |
|
576 |
setFocusIndex( index( value.value<int> (), 0 ) ); |
|
577 |
return TRUE; |
|
578 |
} |
|
579 |
} |
|
580 |
||
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
581 |
if ( GlxVisualWindowIndex == role ) { |
69 | 582 |
if ( value.isValid() && value.canConvert<int> () ) { |
583 |
mMLWrapper->setVisibleWindowIndex( value.value<int> () ); |
|
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
584 |
return TRUE; |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
585 |
} |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
586 |
} |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
587 |
|
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
588 |
if ( GlxSelectedIndexRole == role ) { |
69 | 589 |
qDebug( "GlxMediaModel::setData::GlxSelectedIndexRole()::BEFORE%d", idx.row() ); |
590 |
if ( value.isValid() && value.canConvert<int> () ) { |
|
591 |
qDebug( "GlxMediaModel::setData()::GlxSelectedIndexRole%d", idx.row() ); |
|
592 |
setSelectedIndex( index( value.value<int> (), 0 ) ); |
|
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
593 |
return TRUE; |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
594 |
} |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
595 |
} |
69 | 596 |
|
597 |
if ( role == GlxSubStateRole && value.isValid() && value.canConvert<int> () ) { |
|
598 |
mSubState = value.value<int> (); |
|
24
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
599 |
return TRUE; |
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
600 |
} |
45 | 601 |
if ( GlxTempVisualWindowIndex == role ) { |
69 | 602 |
if ( value.isValid() && value.canConvert<int> () ) { |
603 |
mTempVisibleWindowIndex = value.value<int> (); |
|
45 | 604 |
return TRUE; |
69 | 605 |
} |
45 | 606 |
} |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
607 |
|
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
608 |
return FALSE; |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
609 |
} |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
610 |
|
69 | 611 |
QModelIndex GlxMediaModel::index( int row, int column, const QModelIndex &parent ) const |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
612 |
{ |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
613 |
Q_UNUSED(parent) |
69 | 614 |
qDebug( "GlxMediaModel::index row %d column %d", row, column ); |
615 |
||
616 |
if ( ( row < 0 ) || ( row >= rowCount() ) || ( column < 0 ) || ( column >= columnCount() ) ) { |
|
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
617 |
return QModelIndex(); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
618 |
} |
69 | 619 |
|
620 |
return QAbstractItemModel::createIndex( row, column ); |
|
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
621 |
} |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
622 |