47 Constructs the collection container. |
47 Constructs the collection container. |
48 This container handles the both the auto playlists and user created playlists. |
48 This container handles the both the auto playlists and user created playlists. |
49 */ |
49 */ |
50 MpCollectionContainerPlaylists::MpCollectionContainerPlaylists( HbDocumentLoader *loader, QGraphicsItem *parent ) |
50 MpCollectionContainerPlaylists::MpCollectionContainerPlaylists( HbDocumentLoader *loader, QGraphicsItem *parent ) |
51 : MpCollectionListContainer(loader, parent), |
51 : MpCollectionListContainer(loader, parent), |
52 mInfoBar(0), |
|
53 mCurrentPlaylistIndex(0) |
52 mCurrentPlaylistIndex(0) |
54 { |
53 { |
55 TX_LOG |
54 TX_LOG |
56 mCollectionContext = ECollectionContextPlaylists; |
55 mCollectionContext = ECollectionContextPlaylists; |
57 |
56 |
128 \reimp |
126 \reimp |
129 */ |
127 */ |
130 void MpCollectionContainerPlaylists::setupContainer() |
128 void MpCollectionContainerPlaylists::setupContainer() |
131 { |
129 { |
132 TX_ENTRY_ARGS("mCollectionContext=" << mCollectionContext); |
130 TX_ENTRY_ARGS("mCollectionContext=" << mCollectionContext); |
|
131 |
|
132 mDocumentLoader->load(QString(":/docml/musiccollection.docml"), "showInfoBar"); |
|
133 |
133 if ( mCollectionData->count() ) { |
134 if ( mCollectionData->count() ) { |
134 bool ok = false; |
135 bool ok = false; |
135 QGraphicsWidget *widget; |
136 QGraphicsWidget *widget; |
136 if ( mCollectionContext == ECollectionContextPlaylists ) { |
137 if ( mCollectionContext == ECollectionContextPlaylists ) { |
137 mDocumentLoader->load(QString(":/docml/musiccollection.docml"), "playlists", &ok); |
138 mDocumentLoader->load(QString(":/docml/musiccollection.docml"), "playlists", &ok); |
142 if ( !mList ) { |
143 if ( !mList ) { |
143 widget = mDocumentLoader->findWidget(QString("playlistsList")); |
144 widget = mDocumentLoader->findWidget(QString("playlistsList")); |
144 mList = qobject_cast<HbListView*>(widget); |
145 mList = qobject_cast<HbListView*>(widget); |
145 initializeList(); |
146 initializeList(); |
146 } |
147 } |
147 if ( mInfoBar ) { |
148 |
148 delete mInfoBar; |
149 mInfoBar->setHeading(hbTrId("txt_mus_subhead_playlists_1l").arg(mCollectionData->count())); |
149 mInfoBar = 0; |
|
150 } |
|
151 } |
150 } |
152 else if ( mCollectionContext == ECollectionContextPlaylistSongs ) { |
151 else if ( mCollectionContext == ECollectionContextPlaylistSongs ) { |
153 mDocumentLoader->load(QString(":/docml/musiccollection.docml"), "playlistSongs", &ok); |
152 mDocumentLoader->load(QString(":/docml/musiccollection.docml"), "playlistSongs", &ok); |
154 if ( !ok ) { |
153 if ( !ok ) { |
155 TX_LOG_ARGS("Error: invalid xml file."); |
154 TX_LOG_ARGS("Error: invalid xml file."); |
156 Q_ASSERT_X(ok, "MpCollectionContainerPlaylists::setupContainer", "invalid xml file"); |
155 Q_ASSERT_X(ok, "MpCollectionContainerPlaylists::setupContainer", "invalid xml file"); |
157 } |
156 } |
158 |
157 |
159 widget = mDocumentLoader->findWidget(QString("playlistSongsDetail")); |
|
160 mInfoBar = qobject_cast<HbGroupBox*>(widget); |
|
161 |
|
162 QString details; |
158 QString details; |
163 if ( mViewMode == MpCommon::FetchView ) { |
159 if ( mViewMode == MpCommon::FetchView ) { |
164 details = hbTrId("txt_mus_subtitle_select_a_song"); |
160 details = hbTrId("txt_mus_subtitle_select_song"); |
165 } |
161 } |
166 else { |
162 else { |
167 details = mCollectionData->collectionTitle(); |
163 details = hbTrId("txt_mus_subhead_1_2l").arg(mCollectionData->collectionTitle()).arg(mCollectionData->count()); |
168 } |
164 } |
169 mInfoBar->setHeading(details); |
165 mInfoBar->setHeading(details); |
170 } |
166 } |
171 if ( mNoMusic ) { |
167 if ( mNoMusic ) { |
172 delete mNoMusic; |
168 delete mNoMusic; |
173 mNoMusic = 0; |
169 mNoMusic = 0; |
174 } |
170 } |
175 } |
171 } |
176 else { |
172 else { |
177 if ( mInfoBar ) { |
173 |
178 delete mInfoBar; |
174 mInfoBar->setHeading(hbTrId("txt_mus_subhead_1_2l").arg(mCollectionData->collectionTitle()).arg(0)); |
179 mInfoBar = 0; |
175 |
180 } |
176 // Call empty list from base class |
181 // Call empty list from base class |
|
182 setupEmptyListContainer(); |
177 setupEmptyListContainer(); |
183 } |
178 } |
184 TX_EXIT |
179 TX_EXIT |
185 } |
180 } |
186 |
181 |