author | hgs |
Fri, 09 Jul 2010 16:27:03 -0500 | |
changeset 43 | 0f32e550d9d8 |
parent 37 | eb79a7c355bf |
child 51 | 560ce2306a17 |
permissions | -rw-r--r-- |
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1 |
/* |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
3 |
* All rights reserved. |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
4 |
* This component and the accompanying materials are made available |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
5 |
* under the terms of "Eclipse Public License v1.0" |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
6 |
* which accompanies this distribution, and is available |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
8 |
* |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
9 |
* Initial Contributors: |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
10 |
* Nokia Corporation - initial contribution. |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
11 |
* |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
12 |
* Contributors: |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
13 |
* |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
14 |
* Description: Music Player collection container definition - Albums. |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
15 |
* |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
16 |
*/ |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
17 |
|
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
18 |
#include <QtCore> |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
19 |
|
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
20 |
#include <hbdocumentloader.h> |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
21 |
#include <hblistview.h> |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
22 |
#include <hbgroupbox.h> |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
23 |
#include <hbindexfeedback.h> |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
24 |
|
35 | 25 |
#include <hgmediawall.h> |
26 |
||
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
27 |
#include "mpcollectioncontaineralbums.h" |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
28 |
#include "mpmpxcollectiondata.h" |
35 | 29 |
#include "mpcollectiondatamodel.h" |
30 |
#include "mpcollectiontbonelistdatamodel.h" |
|
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
31 |
#include "mptrace.h" |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
32 |
|
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
33 |
/*! |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
34 |
\class MpCollectionContainerAlbums |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
35 |
\brief Music Player collection container definition - Albums. |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
36 |
|
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
37 |
'Albums' collection container implements the interface specified |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
38 |
by MpCollectionContainer. It provides a layout and widgets for the |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
39 |
'Albums' view. |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
40 |
|
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
41 |
This container handles the following contexts: |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
42 |
\li ECollectionContextAlbums |
35 | 43 |
\li ECollectionContextAlbumsTBone |
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
44 |
|
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
45 |
\sa MpCollectionContainer |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
46 |
*/ |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
47 |
|
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
48 |
/*! |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
49 |
Constructs the collection container. |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
50 |
*/ |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
51 |
MpCollectionContainerAlbums::MpCollectionContainerAlbums( HbDocumentLoader *loader, QGraphicsItem *parent ) |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
52 |
: MpCollectionListContainer(loader, parent), |
35 | 53 |
mInfoBar(0), |
54 |
mTBone(0), |
|
55 |
mTBoneListModel(0), |
|
56 |
mCurrentAlbumIndex(0) |
|
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
57 |
{ |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
58 |
TX_LOG |
35 | 59 |
mCollectionContext = ECollectionContextAlbums; |
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
60 |
} |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
61 |
|
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
62 |
/*! |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
63 |
Destructs the collection container. |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
64 |
*/ |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
65 |
MpCollectionContainerAlbums::~MpCollectionContainerAlbums() |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
66 |
{ |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
67 |
TX_ENTRY |
35 | 68 |
delete mInfoBar; |
69 |
delete mTBone; |
|
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
70 |
delete mList; |
35 | 71 |
delete mTBoneListModel; |
72 |
TX_EXIT |
|
73 |
} |
|
74 |
||
75 |
/*! |
|
76 |
Sets the data model for the container. |
|
77 |
*/ |
|
78 |
void MpCollectionContainerAlbums::setDataModel( MpCollectionDataModel *dataModel ) |
|
79 |
{ |
|
80 |
TX_ENTRY |
|
81 |
MpCollectionContainer::setDataModel(dataModel); |
|
82 |
if ( mCollectionContext == ECollectionContextAlbums ) { |
|
83 |
if ( mList ) { |
|
84 |
mList->setModel(dataModel); |
|
85 |
if ( mCollectionData->count() ) { |
|
86 |
mList->scrollTo( dataModel->index(mCurrentAlbumIndex, 0) ); |
|
87 |
} |
|
88 |
} |
|
89 |
} |
|
90 |
else if ( mCollectionContext == ECollectionContextAlbumsTBone ) { |
|
91 |
if ( mTBone ) { |
|
92 |
mTBone->setModel(dataModel); |
|
93 |
mTBone->scrollTo( dataModel->index(mCurrentAlbumIndex, 0) ); |
|
94 |
if ( mTBoneListModel == 0 ) { |
|
95 |
mTBoneListModel = new MpCollectionTBoneListDataModel(mCollectionData); |
|
96 |
connect( mTBoneListModel, SIGNAL(albumDataChanged()), this, SLOT(albumDataChanged()) ); |
|
36 | 97 |
connect( mTBoneListModel, SIGNAL(albumDataAvailable()), this, SLOT(albumDataAvailable()) ); |
35 | 98 |
} |
99 |
mList->setModel(mTBoneListModel); |
|
36 | 100 |
if ( mCollectionData->setCurrentAlbum(mCurrentAlbumIndex) ) { |
101 |
if ( mCollectionData->albumSongsCount() > 1 ) { |
|
102 |
emit shuffleEnabled(true); |
|
103 |
} |
|
104 |
else { |
|
105 |
emit shuffleEnabled(false); |
|
106 |
} |
|
107 |
} |
|
108 |
else { |
|
35 | 109 |
emit findAlbumSongs(mCurrentAlbumIndex); |
36 | 110 |
emit shuffleEnabled(false); |
35 | 111 |
} |
112 |
} |
|
113 |
} |
|
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
114 |
TX_EXIT |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
115 |
} |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
116 |
|
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
117 |
/*! |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
118 |
Slot to be called when an item is selected by the user. |
35 | 119 |
*/ |
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
120 |
void MpCollectionContainerAlbums::itemActivated( const QModelIndex &index ) |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
121 |
{ |
35 | 122 |
if ( mCollectionContext == ECollectionContextAlbums ) { |
123 |
mCurrentAlbumIndex = index.row(); |
|
124 |
TX_ENTRY_ARGS("mCurrentAlbumIndex=" << mCurrentAlbumIndex); |
|
125 |
MpCollectionListContainer::itemActivated(index); |
|
126 |
} |
|
127 |
else if ( mCollectionContext == ECollectionContextAlbumsTBone ) { |
|
128 |
int row = index.row(); |
|
129 |
TX_ENTRY_ARGS("index=" << row); |
|
130 |
if ( mViewMode == MpCommon::FetchView ) { |
|
131 |
MpCollectionListContainer::itemActivated(index); |
|
132 |
} |
|
133 |
else { |
|
134 |
emit playAlbumSongs(mCurrentAlbumIndex, row); |
|
135 |
} |
|
136 |
} |
|
137 |
TX_EXIT |
|
138 |
} |
|
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
139 |
|
35 | 140 |
/*! |
141 |
Slot to be called when scrolling ends in media wall and an album is centered. |
|
142 |
*/ |
|
43 | 143 |
void MpCollectionContainerAlbums::albumCentered( const QModelIndex &index ) |
35 | 144 |
{ |
145 |
TX_ENTRY |
|
146 |
if ( mCurrentAlbumIndex != index.row() ) { |
|
147 |
// Prevent reloading if user just moves the center album a little |
|
148 |
// and the same album re-centers. |
|
149 |
mCurrentAlbumIndex = index.row(); |
|
150 |
TX_LOG_ARGS("mCurrentAlbumIndex=" << mCurrentAlbumIndex); |
|
36 | 151 |
if ( mCollectionData->setCurrentAlbum(mCurrentAlbumIndex) ) { |
152 |
if ( mCollectionData->albumSongsCount() > 1 ) { |
|
153 |
emit shuffleEnabled(true); |
|
154 |
} |
|
155 |
// Enable context menu |
|
156 |
mLongPressEnabled = true; |
|
157 |
} |
|
158 |
else { |
|
35 | 159 |
emit findAlbumSongs(mCurrentAlbumIndex); |
160 |
} |
|
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
161 |
} |
36 | 162 |
else { |
163 |
// Landed on the same album. Just update menu. |
|
164 |
if ( mCollectionData->albumSongsCount() > 1 ) { |
|
165 |
emit shuffleEnabled(true); |
|
166 |
} |
|
167 |
// Enable context menu |
|
168 |
mLongPressEnabled = true; |
|
169 |
} |
|
35 | 170 |
TX_EXIT |
171 |
} |
|
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
172 |
|
35 | 173 |
/*! |
174 |
Slot to be called data model has new data. |
|
175 |
Two cases: |
|
176 |
1) User deleted an album. |
|
177 |
2) User deleted last song in an album. |
|
178 |
*/ |
|
179 |
void MpCollectionContainerAlbums::dataReloaded() |
|
180 |
{ |
|
181 |
TX_ENTRY |
|
182 |
if ( mCollectionContext == ECollectionContextAlbumsTBone ) { |
|
183 |
if ( mCurrentAlbumIndex > 0 ) { |
|
184 |
--mCurrentAlbumIndex; |
|
185 |
} |
|
186 |
mTBone->scrollTo( mDataModel->index(mCurrentAlbumIndex, 0) ); |
|
36 | 187 |
if ( mCollectionData->setCurrentAlbum(mCurrentAlbumIndex) ) { |
188 |
if ( mCollectionData->albumSongsCount() == 1 ) { |
|
189 |
emit shuffleEnabled(false); |
|
190 |
} |
|
191 |
} |
|
192 |
else { |
|
35 | 193 |
emit findAlbumSongs(mCurrentAlbumIndex); |
194 |
} |
|
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
195 |
} |
35 | 196 |
else { |
197 |
MpCollectionListContainer::dataReloaded(); |
|
198 |
} |
|
199 |
TX_EXIT |
|
200 |
} |
|
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
201 |
|
35 | 202 |
/*! |
203 |
Slot to be called data model has new data. |
|
204 |
User has deleted one of the songs from TBone list. |
|
205 |
*/ |
|
206 |
void MpCollectionContainerAlbums::albumDataChanged() |
|
207 |
{ |
|
208 |
TX_ENTRY |
|
209 |
emit findAlbumSongs(mCurrentAlbumIndex); |
|
36 | 210 |
emit shuffleEnabled(false); |
211 |
TX_EXIT |
|
212 |
} |
|
213 |
||
214 |
/*! |
|
215 |
Slot to be called TBone starts scrolling. |
|
216 |
*/ |
|
217 |
void MpCollectionContainerAlbums::scrollingStarted() |
|
218 |
{ |
|
219 |
TX_ENTRY |
|
220 |
// Disable shuffle action from the menu |
|
221 |
emit shuffleEnabled(false); |
|
222 |
// Disable context menu |
|
223 |
mLongPressEnabled = false; |
|
224 |
TX_EXIT |
|
225 |
} |
|
226 |
||
227 |
/*! |
|
228 |
Slot to be called album data is available. This is a result of findAlbumSongs signal. |
|
229 |
*/ |
|
230 |
void MpCollectionContainerAlbums::albumDataAvailable() |
|
231 |
{ |
|
232 |
TX_ENTRY |
|
233 |
int count = mCollectionData->albumSongsCount(); |
|
234 |
if ( count > 1 ) { |
|
235 |
emit shuffleEnabled(true); |
|
236 |
} |
|
237 |
// Enable context menu |
|
238 |
mLongPressEnabled = true; |
|
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
239 |
TX_EXIT |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
240 |
} |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
241 |
|
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
242 |
/*! |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
243 |
Sets up the container by organizing widgets according to its layout. |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
244 |
|
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
245 |
\reimp |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
246 |
*/ |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
247 |
void MpCollectionContainerAlbums::setupContainer() |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
248 |
{ |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
249 |
TX_ENTRY_ARGS("mCollectionContext=" << mCollectionContext); |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
250 |
if ( mCollectionData->count() ) { |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
251 |
bool ok = false; |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
252 |
QGraphicsWidget *widget; |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
253 |
if ( mCollectionContext == ECollectionContextAlbums ) { |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
254 |
mDocumentLoader->load(QString(":/docml/musiccollection.docml"), "albums", &ok); |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
255 |
if ( !ok ) { |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
256 |
TX_LOG_ARGS("Error: invalid xml file."); |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
257 |
Q_ASSERT_X(ok, "MpCollectionContainerAlbums::setupContainer", "invalid xml file"); |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
258 |
} |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
259 |
if ( !mList ) { |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
260 |
widget = mDocumentLoader->findWidget(QString("albumsList")); |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
261 |
mList = qobject_cast<HbListView*>(widget); |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
262 |
mIndexFeedback->setItemView(mList); |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
263 |
initializeList(); |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
264 |
} |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
265 |
if ( mInfoBar ) { |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
266 |
delete mInfoBar; |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
267 |
mInfoBar = 0; |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
268 |
} |
35 | 269 |
if ( mTBone ) { |
270 |
delete mTBone; |
|
271 |
mTBone = 0; |
|
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
272 |
} |
35 | 273 |
} |
274 |
else if ( mCollectionContext == ECollectionContextAlbumsTBone ) { |
|
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
275 |
if ( mViewMode == MpCommon::FetchView ) { |
35 | 276 |
mDocumentLoader->load(QString(":/docml/musiccollection.docml"), "albumTBoneFetcher", &ok); |
277 |
if ( !ok ) { |
|
278 |
TX_LOG_ARGS("Error: invalid xml file."); |
|
279 |
Q_ASSERT_X(ok, "MpCollectionContainerAlbums::setupContainer", "invalid xml file"); |
|
280 |
} |
|
281 |
widget = mDocumentLoader->findWidget(QString("albumTBoneDetail")); |
|
282 |
mInfoBar = qobject_cast<HbGroupBox*>(widget); |
|
283 |
mInfoBar->setHeading( hbTrId("txt_mus_subtitle_select_a_song") ); |
|
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
284 |
} |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
285 |
else { |
35 | 286 |
mDocumentLoader->load(QString(":/docml/musiccollection.docml"), "albumTBone", &ok); |
287 |
if ( !ok ) { |
|
288 |
TX_LOG_ARGS("Error: invalid xml file."); |
|
289 |
Q_ASSERT_X(ok, "MpCollectionContainerAlbums::setupContainer", "invalid xml file"); |
|
290 |
} |
|
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
291 |
} |
35 | 292 |
widget = mDocumentLoader->findWidget(QString("albumWall")); |
293 |
mTBone = qobject_cast<HgMediawall*>(widget); |
|
37 | 294 |
HbIcon defaultIcon( "qtg_large_album_art" ); |
35 | 295 |
defaultIcon.setSize(mTBone->itemSize()); |
296 |
mTBone->setDefaultImage( defaultIcon.pixmap().toImage() ); |
|
297 |
mTBone->setScrollBarPolicy( HgWidget::ScrollBarAlwaysOff ); |
|
298 |
mTBone->enableReflections(true); |
|
36 | 299 |
connect( mTBone, SIGNAL(scrollingStarted()), this, SLOT(scrollingStarted()) ); |
43 | 300 |
connect( mTBone, SIGNAL(animationAboutToEnd(QModelIndex)), this, SLOT(albumCentered(QModelIndex)) ); |
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
301 |
} |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
302 |
} |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
303 |
else { |
35 | 304 |
// Must delete widgets when last song is deleted and view is reloaded. |
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
305 |
if ( mInfoBar ) { |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
306 |
delete mInfoBar; |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
307 |
mInfoBar = 0; |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
308 |
} |
35 | 309 |
if ( mTBone ) { |
310 |
delete mTBone; |
|
311 |
mTBone = 0; |
|
312 |
} |
|
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
313 |
// Call empty list from base class |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
314 |
setupEmptyListContainer(); |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
315 |
} |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
316 |
TX_EXIT |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
317 |
} |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
318 |