71 mAlbumText( 0 ), |
66 mAlbumText( 0 ), |
72 mArtistText( 0 ), |
67 mArtistText( 0 ), |
73 mAlbumArt( 0 ), |
68 mAlbumArt( 0 ), |
74 mSongDetailsGroupBox(0), |
69 mSongDetailsGroupBox(0), |
75 mInspireMeGroupBox(0), |
70 mInspireMeGroupBox(0), |
76 mShareButton(0), |
|
77 mDocumentLoader( 0 ), |
71 mDocumentLoader( 0 ), |
78 mDetailList(0), |
72 mDetailList(0), |
79 mInspireList(0), |
73 mInspireList(0), |
80 mInspireMeProgressBar(0), |
74 mInspireMeProgressBar(0), |
81 mMpQueryManager( 0 ), |
75 mMpQueryManager( 0 ), |
82 mInspireMeQueryOngoing( false ), |
76 mInspireMeQueryOngoing( false ), |
83 mInspireMeQueryRendered( false ), |
77 mInspireMeQueryRendered( false ) |
84 mInspireMeOpen(true), |
|
85 mSongDetailsGbOpen(false) |
|
86 #ifdef SHARE_FUNC_ENABLED |
|
87 , mSharePopup( 0 ) |
|
88 #endif |
|
89 { |
78 { |
90 TX_ENTRY |
79 TX_ENTRY |
91 bool widgetsOk = false; |
80 bool widgetsOk = false; |
92 HbMainWindow *mainWindow = hbInstance->allMainWindows()[0]; |
81 HbMainWindow *mainWindow = hbInstance->allMainWindows()[0]; |
93 mDocumentLoader = new HbDocumentLoader(); |
82 mDocumentLoader = new HbDocumentLoader(); |
109 QGraphicsWidget *widget = 0; |
98 QGraphicsWidget *widget = 0; |
110 |
99 |
111 widget = mDocumentLoader->findWidget( QString("content") ); |
100 widget = mDocumentLoader->findWidget( QString("content") ); |
112 TX_LOG_ARGS( "MpDetailsView() mDocumentLoader->findWidget for <content>: " << (int)(widget) ); |
101 TX_LOG_ARGS( "MpDetailsView() mDocumentLoader->findWidget for <content>: " << (int)(widget) ); |
113 setWidget( qobject_cast<HbWidget *>(widget) ); |
102 setWidget( qobject_cast<HbWidget *>(widget) ); |
114 |
|
115 widget = mDocumentLoader->findWidget( QString("shareButton") ); |
|
116 mShareButton = qobject_cast<HbPushButton *>(widget); |
|
117 TX_LOG_ARGS("MpDetailsView() <shareButton> widget found mShareButton: " << (int)(mShareButton) ); |
|
118 |
103 |
119 widget = mDocumentLoader->findWidget( QString("trackTitle") ); |
104 widget = mDocumentLoader->findWidget( QString("trackTitle") ); |
120 mSongText = qobject_cast<HbLabel *>(widget); |
105 mSongText = qobject_cast<HbLabel *>(widget); |
121 TX_LOG_ARGS("MpDetailsView() <trackTitle> widget found mSongText: " << (int)(mSongText) ); |
106 TX_LOG_ARGS("MpDetailsView() <trackTitle> widget found mSongText: " << (int)(mSongText) ); |
122 |
107 |
199 |
183 |
200 connect( mSoftKeyBack, SIGNAL( triggered() ), this, SLOT( back() ) ); |
184 connect( mSoftKeyBack, SIGNAL( triggered() ), this, SLOT( back() ) ); |
201 connect( mSongData, SIGNAL( albumArtReady() ), this, SLOT( albumArtChanged() ) ); |
185 connect( mSongData, SIGNAL( albumArtReady() ), this, SLOT( albumArtChanged() ) ); |
202 connect( mSongData, SIGNAL( playbackInfoChanged() ), this, SLOT( handlePlaybackInfoChanged() ) ); |
186 connect( mSongData, SIGNAL( playbackInfoChanged() ), this, SLOT( handlePlaybackInfoChanged() ) ); |
203 connect( mSongData, SIGNAL( songDetailInfoChanged() ), this, SLOT( songDetailInfoChanged() ) ); |
187 connect( mSongData, SIGNAL( songDetailInfoChanged() ), this, SLOT( songDetailInfoChanged() ) ); |
|
188 connect( mDetailList, SIGNAL( pressed( HbListWidgetItem * ) ), this, SLOT( handleListItemSelected( HbListWidgetItem * ) ) ); |
204 connect( mSongDetailsGroupBox, SIGNAL( toggled( bool ) ), this, SLOT( handleDetailsGroupBoxToggled( bool ) ) ); |
189 connect( mSongDetailsGroupBox, SIGNAL( toggled( bool ) ), this, SLOT( handleDetailsGroupBoxToggled( bool ) ) ); |
205 connect( mInspireMeGroupBox, SIGNAL( toggled( bool ) ), this, SLOT( handleInspireMeGroupBoxToggled( bool ) ) ); |
190 connect( mInspireMeGroupBox, SIGNAL( toggled( bool ) ), this, SLOT( handleInspireMeGroupBoxToggled( bool ) ) ); |
206 connect( mMpQueryManager, SIGNAL( networkError() ), this ,SLOT( handleNetworkError() ) ); |
191 connect( mMpQueryManager, SIGNAL(inspireMeItemsMetadataRetrieved()), this, SLOT(renderInspireMeMetadata())); |
207 connect( mMpQueryManager, SIGNAL(searchUrlRetrieved(const QString&)), this, SLOT(updateSharedData(const QString&))); |
192 connect( mMpQueryManager, SIGNAL(inspireMeItemAlbumArtReady()), this, SLOT(renderInspireMeAlbumArts())); |
208 connect( mMpQueryManager, SIGNAL(recommendationAlbumArtsReady()), this, SLOT(RenderInspireMeGroupBox())); |
193 connect( mMpQueryManager, SIGNAL(localMusicStoreRetrieved(bool)), this, SLOT(queryInspireMe(bool)), Qt::QueuedConnection); |
209 |
194 connect( mMpQueryManager, SIGNAL(localMusicStoreRetrievalError()), this, SLOT(abortInspireMeProcess())); |
210 #ifdef SHARE_FUNC_ENABLED |
195 connect( mMpQueryManager, SIGNAL(inspireMeItemsRetrievalError()), this, SLOT(queryLocalMusicStore()), Qt::QueuedConnection); |
211 connect( mShareButton, SIGNAL( clicked() ), this, SLOT( share() ) ); |
196 |
212 |
197 TX_EXIT |
213 // Preload the share popup |
198 } |
214 preloadShareDialog(); |
199 |
215 #endif |
200 void MpDetailsView::queryLocalMusicStore() |
216 TX_EXIT |
201 { |
|
202 TX_ENTRY |
|
203 mMpQueryManager->reset(); |
|
204 mMpQueryManager->queryLocalMusicStore(); |
|
205 TX_EXIT |
217 } |
206 } |
218 |
207 |
219 /*! |
208 /*! |
220 Activates the details view. |
209 Activates the details view. |
221 */ |
210 */ |
223 { |
212 { |
224 TX_ENTRY |
213 TX_ENTRY |
225 setNavigationAction( mSoftKeyBack ); |
214 setNavigationAction( mSoftKeyBack ); |
226 |
215 |
227 mActivated = true; |
216 mActivated = true; |
228 mInspireMeOpen = MpSettingsManager::inspireMe(); |
217 TX_LOG_ARGS( "InspireMeVal: " << MpSettingsManager::inspireMe() ); |
229 mSongDetailsGbOpen = MpSettingsManager::songDetailsGb(); |
218 TX_LOG_ARGS( "SongDetailsGbVal: " << MpSettingsManager::songDetailsGb() ); |
230 TX_LOG_ARGS( "InspireMeVal: " << mInspireMeOpen ); |
219 mInspireMeGroupBox->setCollapsed(!MpSettingsManager::inspireMe()); |
231 TX_LOG_ARGS( "SongDetailsGbVal: " << mSongDetailsGbOpen ); |
220 mSongDetailsGroupBox->setCollapsed(!MpSettingsManager::songDetailsGb()); |
232 mInspireMeGroupBox->setCollapsed(!mInspireMeOpen); |
|
233 mSongDetailsGroupBox->setCollapsed(!mSongDetailsGbOpen); |
|
234 TX_EXIT |
221 TX_EXIT |
235 } |
222 } |
236 |
223 |
237 /*! |
224 /*! |
238 Deactivates the details view. |
225 Deactivates the details view. |
239 */ |
226 */ |
240 void MpDetailsView::deactivateView() |
227 void MpDetailsView::deactivateView() |
241 { |
228 { |
242 TX_ENTRY |
229 TX_ENTRY |
243 if (mInspireMeGroupBox->isCollapsed() ) { |
230 saveGroupBoxStates(); |
244 MpSettingsManager::setInspireMe(false); |
|
245 } else { |
|
246 MpSettingsManager::setInspireMe(true); |
|
247 } |
|
248 |
|
249 if (mSongDetailsGroupBox->isCollapsed() ) { |
|
250 MpSettingsManager::setSongDetailsGb(false); |
|
251 } else { |
|
252 MpSettingsManager::setSongDetailsGb(true); |
|
253 } |
|
254 |
|
255 setNavigationAction( 0 ); |
231 setNavigationAction( 0 ); |
256 mActivated = false; |
232 mActivated = false; |
257 TX_EXIT |
233 TX_EXIT |
258 } |
234 } |
259 |
235 |
|
236 void MpDetailsView::saveGroupBoxStates() |
|
237 { |
|
238 TX_ENTRY |
|
239 if (mInspireMeGroupBox->isCollapsed() ) { |
|
240 MpSettingsManager::setInspireMe(false); |
|
241 } |
|
242 else { |
|
243 MpSettingsManager::setInspireMe(true); |
|
244 } |
|
245 |
|
246 if (mSongDetailsGroupBox->isCollapsed() ) { |
|
247 MpSettingsManager::setSongDetailsGb(false); |
|
248 } |
|
249 else { |
|
250 MpSettingsManager::setSongDetailsGb(true); |
|
251 } |
|
252 TX_EXIT |
|
253 } |
|
254 |
260 /*! |
255 /*! |
261 Setup the menu. |
256 Setup the menu. |
262 */ |
257 */ |
263 void MpDetailsView::setupMenu() |
258 void MpDetailsView::setupMenu() |
264 { |
259 { |
290 } |
285 } |
291 |
286 |
292 /*! |
287 /*! |
293 Slot to handle network error. |
288 Slot to handle network error. |
294 */ |
289 */ |
295 void MpDetailsView::handleNetworkError() |
290 void MpDetailsView::abortInspireMeProcess() |
296 { |
291 { |
297 TX_ENTRY |
292 TX_ENTRY |
|
293 mInspireMeProgressBar->hide(); |
|
294 mInspireMeGroupBox->setCollapsed( true ); |
298 mInspireMeQueryOngoing = false; |
295 mInspireMeQueryOngoing = false; |
299 mInspireMeQueryRendered = false; |
296 mInspireMeQueryRendered = false; |
300 clearInspireMe(); |
297 // ensure that we dont get callbacks from previous queries. Especially true, |
301 mInspireMeGroupBox->setCollapsed( true ); |
298 // if details view is actived with a quick song change again |
|
299 mMpQueryManager->reset(); |
|
300 mInspireList->clear(); |
302 TX_EXIT |
301 TX_EXIT |
303 } |
302 } |
304 |
303 |
305 /*! |
304 /*! |
306 Render inspireme groupbox after album arts downloaded |
305 Render inspireme groupbox after album arts downloaded |
307 */ |
306 */ |
308 void MpDetailsView::RenderInspireMeGroupBox() |
307 void MpDetailsView::renderInspireMeMetadata() |
309 { |
308 { |
310 TX_ENTRY |
309 TX_ENTRY |
311 mInspireMeQueryOngoing = false; |
310 mInspireMeQueryOngoing = false; |
312 mInspireMeQueryRendered = true; |
311 mInspireMeQueryRendered = true; |
313 mInspireMeProgressBar->hide(); |
312 mInspireMeProgressBar->hide(); |
314 if( mMpQueryManager->recommendationAlbumArtsMap().count() ) { |
313 if( mMpQueryManager->recommendationsCount() ) { |
315 TX_LOG_ARGS( "There are recommendations." ) |
314 TX_LOG_ARGS( "There are recommendations." ) |
316 // we have recommendations |
315 // we have recommendations |
317 for ( int i = 0; i < KRecommendationCount; i++ ) { |
316 for ( int i = 0; i < mMpQueryManager->recommendationsCount(); ++i ) { |
318 // configure the layout properties |
317 // configure the layout properties |
319 if(!mInspireList->count()) { |
318 if(!mInspireList->count()) { |
320 // we havent configured the prototype before |
319 // we havent configured the prototype before |
321 HbListViewItem *prototype = mInspireList->listItemPrototype(); |
320 HbListViewItem *prototype = mInspireList->listItemPrototype(); |
322 prototype->setGraphicsSize( HbListViewItem::LargeIcon ); |
321 prototype->setGraphicsSize( HbListViewItem::LargeIcon ); |
323 } |
322 } |
324 // create the item |
323 // create the item |
325 HbListWidgetItem *inspireMeItem = new HbListWidgetItem(); |
324 HbListWidgetItem *inspireMeItem = new HbListWidgetItem(); |
326 HbIcon icon( QIcon( mMpQueryManager->recommendationAlbumArtsMap().value(mMpQueryManager->recommendationAlbumArtsLink().at( i ) ) ) ); |
325 inspireMeItem->setIcon( mMpQueryManager->recommendedAlbumArt( i )); |
327 inspireMeItem->setIcon( icon ); |
326 inspireMeItem->setText( mMpQueryManager->recommendedSong( i ) ); |
328 inspireMeItem->setText( mMpQueryManager->recommendationSongs().at( i ) ); |
327 inspireMeItem->setSecondaryText( mMpQueryManager->recommendedArtist( i ) ); |
329 inspireMeItem->setSecondaryText( mMpQueryManager->recommendationArtists().at( i ) ); |
|
330 mInspireList->addItem( inspireMeItem ); |
328 mInspireList->addItem( inspireMeItem ); |
331 } |
329 } |
332 } |
330 } |
333 else { |
331 else { |
334 TX_LOG_ARGS( "There is NO recommendation." ) |
332 TX_LOG_ARGS( "There are NO recommendations" ) |
335 // we dont have recommendations |
333 // we dont have recommendations |
336 // we havent configured the prototype before |
334 // we havent configured the prototype before |
337 HbListViewItem *prototype = mInspireList->listItemPrototype(); |
335 HbListViewItem *prototype = mInspireList->listItemPrototype(); |
338 const int maxTextRowCount = 20; |
336 const int maxTextRowCount = 20; |
339 const int minTextRowCount = 1; |
337 const int minTextRowCount = 1; |
345 } |
343 } |
346 |
344 |
347 TX_EXIT |
345 TX_EXIT |
348 } |
346 } |
349 |
347 |
350 bool MpDetailsView::canQueryRecommendations() const |
348 void MpDetailsView::renderInspireMeAlbumArts() |
|
349 { |
|
350 TX_ENTRY |
|
351 for( int i = 0; i < mInspireList->count(); ++i) { |
|
352 mInspireList->item(i)->setIcon( mMpQueryManager->recommendedAlbumArt( i ) ); |
|
353 } |
|
354 TX_EXIT |
|
355 } |
|
356 |
|
357 bool MpDetailsView::isMetadata() const |
351 { |
358 { |
352 bool result = ( ( !mSongData->album().isEmpty() ) || |
359 bool result = ( ( !mSongData->album().isEmpty() ) || |
353 ( !mSongData->artist().isEmpty() ) ) && |
360 ( !mSongData->artist().isEmpty() ) ); |
354 !( mInspireMeGroupBox->isCollapsed() ); |
361 TX_LOG_ARGS( "Inspire Me Query metadata available:" << result ); |
355 TX_LOG_ARGS( "Can query recommendations:" << result ); |
|
356 return result; |
362 return result; |
357 } |
363 } |
358 |
364 |
359 bool MpDetailsView::canQuerySharePlayerLink() const |
|
360 { |
|
361 bool result = ( !mSongData->title().isEmpty() ) && |
|
362 ( !mSongData->artist().isEmpty() ) ; |
|
363 TX_LOG_ARGS( "Can query share player link:" << result ); |
|
364 return result; |
|
365 } |
|
366 |
|
367 /*! |
365 /*! |
368 Slot to handle basic song information |
366 Slot to handle basic song information |
369 */ |
367 */ |
370 void MpDetailsView::handlePlaybackInfoChanged() |
368 void MpDetailsView::handlePlaybackInfoChanged() |
371 { |
369 { |
372 TX_ENTRY |
370 TX_ENTRY |
373 mMpQueryManager->clearNetworkReplies(); |
371 // ensure that we dont get callbacks from previous queries. Especially true, |
374 clearInspireMe(); |
372 // if details view is actived with a quick song change again |
|
373 mMpQueryManager->reset(); |
|
374 mInspireList->clear(); |
375 mInspireMeQueryRendered = false; |
375 mInspireMeQueryRendered = false; |
376 |
376 |
377 // Clear the song data link until new query has been made. |
377 // Clear the song data link until new query has been made. |
378 mSongData->setLink( "" ); |
378 mSongData->setLink( "" ); |
379 |
379 |
380 if ( !mSongData->title().isEmpty () ) { |
380 if ( !mSongData->title().isEmpty () ) { |
381 mSongText->setPlainText( mSongData->title() ); |
381 mSongText->setPlainText( mSongData->title() ); |
382 } else { |
382 } |
|
383 else { |
383 mSongText->setPlainText( mSongData->fileName() ); |
384 mSongText->setPlainText( mSongData->fileName() ); |
384 } |
385 } |
385 |
386 |
386 if ( !mSongData->album().isEmpty () ) { |
387 if ( !mSongData->album().isEmpty () ) { |
387 mAlbumText->setPlainText( mSongData->album() ); |
388 mAlbumText->setPlainText( mSongData->album() ); |
388 } else { |
389 } |
|
390 else { |
389 mAlbumText->setPlainText( hbTrId( "txt_mus_other_unknown7") ); |
391 mAlbumText->setPlainText( hbTrId( "txt_mus_other_unknown7") ); |
390 } |
392 } |
391 |
393 |
392 if ( !mSongData->artist().isEmpty() ) { |
394 if ( !mSongData->artist().isEmpty() ) { |
393 mArtistText->setPlainText( mSongData->artist() ); |
395 mArtistText->setPlainText( mSongData->artist() ); |
394 } else { |
396 } |
|
397 else { |
395 mArtistText->setPlainText( hbTrId( "txt_mus_other_unknown6") ); |
398 mArtistText->setPlainText( hbTrId( "txt_mus_other_unknown6") ); |
396 } |
399 } |
397 |
400 |
398 if (canQuerySharePlayerLink() ) { |
401 if(!mInspireMeGroupBox->isCollapsed()) { |
399 mMpQueryManager->queryLocalMusicStore(mSongData->artist(),mSongData->album(),mSongData->title()); |
402 startInspireMe(); |
400 } |
403 } |
401 |
404 TX_EXIT |
402 if (canQueryRecommendations()) { |
405 } |
403 // start inspire me area progress bar |
406 |
404 // TODO: currently, till we get to this callback from MPX the bar not shown |
407 void MpDetailsView::startInspireMe() |
405 // TODO: check if inspireMe is ON, if not, dont show |
408 { |
|
409 TX_ENTRY |
|
410 if(isMetadata()) { |
|
411 // show progress bar, start store query or inspire me query process |
406 mInspireMeProgressBar->show(); |
412 mInspireMeProgressBar->show(); |
407 mMpQueryManager->queryInspireMeItems(mSongData->artist(),mSongData->album(),mSongData->title()); |
|
408 mInspireMeQueryOngoing = true; |
413 mInspireMeQueryOngoing = true; |
409 } |
414 if( mMpQueryManager->isLocalMusicStore() ) { |
410 else { |
415 mMpQueryManager->queryInspireMeItems(mSongData->artist(),mSongData->album(),mSongData->title()); |
411 // metadata to query for inspire me items not available |
416 } |
412 // show information note |
417 else { |
413 if (!mInspireMeGroupBox->isCollapsed()) |
418 // no local store information present |
414 RenderInspireMeGroupBox(); |
419 mMpQueryManager->queryLocalMusicStore(); |
415 } |
420 } |
416 TX_EXIT |
421 } |
417 } |
422 else { |
418 |
423 // no metadata. show no recommendations |
419 void MpDetailsView::clearInspireMe() |
424 renderInspireMeMetadata(); |
420 { |
425 } |
421 TX_ENTRY |
426 TX_EXIT |
422 mInspireList->clear(); |
427 } |
423 mMpQueryManager->clearRecommendations(); |
428 |
424 TX_EXIT |
|
425 } |
|
426 /*! |
429 /*! |
427 Slot to handle detail song information |
430 Slot to handle detail song information |
428 */ |
431 */ |
429 void MpDetailsView::songDetailInfoChanged() |
432 void MpDetailsView::songDetailInfoChanged() |
430 { |
433 { |
520 long size = mSongData->size().toLong(&ok); // in bytes |
523 long size = mSongData->size().toLong(&ok); // in bytes |
521 TX_LOG_ARGS("WARNING: If zero, Cant get song data size right. You wont see the size in details groupbox correctly" << ok ); |
524 TX_LOG_ARGS("WARNING: If zero, Cant get song data size right. You wont see the size in details groupbox correctly" << ok ); |
522 if( size < KOneKiloByteInBytes) { |
525 if( size < KOneKiloByteInBytes) { |
523 // under 1 KB |
526 // under 1 KB |
524 item->setSecondaryText( hbTrId("txt_mus_dblist_size_val_ln_b", size) ); |
527 item->setSecondaryText( hbTrId("txt_mus_dblist_size_val_ln_b", size) ); |
525 } else if( size < KOneMegabyteInBytes ) { |
528 } |
|
529 else if( size < KOneMegabyteInBytes ) { |
526 // under 1 MB |
530 // under 1 MB |
527 size /= KOneKiloByteInBytes; // turn size into KB |
531 size /= KOneKiloByteInBytes; // turn size into KB |
528 item->setSecondaryText( hbTrId("txt_mus_dblist_size_val_ln_kb", size) ); |
532 item->setSecondaryText( hbTrId("txt_mus_dblist_size_val_ln_kb", size) ); |
529 } else if( size < KOneGigaByteInBytes ) { |
533 } |
|
534 else if( size < KOneGigaByteInBytes ) { |
530 // under 1 GB |
535 // under 1 GB |
531 size /= KOneMegabyteInBytes; // turn size to MB |
536 size /= KOneMegabyteInBytes; // turn size to MB |
532 item->setSecondaryText( hbTrId("txt_mus_dblist_size_val_ln_mb", size) ); |
537 item->setSecondaryText( hbTrId("txt_mus_dblist_size_val_ln_mb", size) ); |
533 } else { |
538 } |
|
539 else { |
534 // 1 GB or higher |
540 // 1 GB or higher |
535 size /= KOneGigaByteInBytes; // turn size to GB |
541 size /= KOneGigaByteInBytes; // turn size to GB |
536 item->setSecondaryText( hbTrId("txt_mus_dblist_size_val_ln_gb", size) ); |
542 item->setSecondaryText( hbTrId("txt_mus_dblist_size_val_ln_gb", size) ); |
537 } |
543 } |
538 item->setEnabled( false ); |
544 item->setEnabled( false ); |
590 TX_LOG_ARGS( "InspireMe is expanded." ) |
596 TX_LOG_ARGS( "InspireMe is expanded." ) |
591 mSongDetailsGroupBox->setCollapsed( true ); |
597 mSongDetailsGroupBox->setCollapsed( true ); |
592 if ( mInspireMeQueryOngoing ) { |
598 if ( mInspireMeQueryOngoing ) { |
593 TX_LOG_ARGS( "Query is ongoing " ) |
599 TX_LOG_ARGS( "Query is ongoing " ) |
594 mInspireMeProgressBar->show(); |
600 mInspireMeProgressBar->show(); |
595 } else { |
601 } |
|
602 else { |
596 TX_LOG_ARGS( "Query is NOT ongoing " ) |
603 TX_LOG_ARGS( "Query is NOT ongoing " ) |
597 if ( mInspireMeQueryRendered ) { |
604 if ( mInspireMeQueryRendered ) { |
598 TX_LOG_ARGS( "InspireMe is rendered already. " ) |
605 TX_LOG_ARGS( "InspireMe is rendered already. " ) |
599 mInspireMeProgressBar->hide(); |
606 mInspireMeProgressBar->hide(); |
600 } else { |
|
601 if ( canQueryRecommendations() ) { |
|
602 TX_LOG_ARGS( "InspireMe is NOT rendered yet but can query for recommendations. " ) |
|
603 mMpQueryManager->queryInspireMeItems(mSongData->artist(),mSongData->album(),mSongData->title()); |
|
604 mInspireMeProgressBar->show(); |
|
605 mInspireMeQueryOngoing = true; |
|
606 } else { |
|
607 TX_LOG_ARGS( "InspireMe is NOT rendered yet and CANNOT query for recommendations either. " ) |
|
608 RenderInspireMeGroupBox(); |
|
609 } |
|
610 } |
607 } |
611 } |
608 else { |
612 } else { |
609 startInspireMe(); |
|
610 } |
|
611 } |
|
612 } |
|
613 else { |
613 TX_LOG_ARGS( "InspireMe is collapsed." ) |
614 TX_LOG_ARGS( "InspireMe is collapsed." ) |
614 mInspireMeProgressBar->hide(); |
615 mInspireMeProgressBar->hide(); |
615 } |
616 } |
616 TX_EXIT |
617 TX_EXIT |
617 } |
618 } |
618 |
619 |
619 #ifdef SHARE_FUNC_ENABLED |
620 /*! |
620 /*! |
621 Slot to call when URL item in song details is pressed |
621 Slot to be called when share button is clicked |
|
622 */ |
|
623 void MpDetailsView::share() |
|
624 { |
|
625 TX_ENTRY |
|
626 createShareDialog(); |
|
627 if (canQuerySharePlayerLink() ) |
|
628 { |
|
629 mMpQueryManager->queryLocalMusicStore(mSongData->artist(),mSongData->album(),mSongData->title() ); |
|
630 } |
|
631 TX_EXIT |
|
632 } |
|
633 |
|
634 /*! |
|
635 Method to create the share dialog on demand. |
|
636 This will cause the share web view to be created and start loading. |
|
637 */ |
|
638 void MpDetailsView::createShareDialog() |
|
639 { |
|
640 TX_ENTRY |
|
641 if ( !mSharePopup ) |
|
642 { |
|
643 mSharePopup = new MpDetailsShareDialog(); |
|
644 } |
|
645 if ( !mSharePopup->isInitialized() ) |
|
646 { |
|
647 connect( mSharePopup, SIGNAL( closeShareDialog() ), this, SLOT( closeShareDialog() ) ); |
|
648 // TODO: Ask for a localization string for this, there is none in text map |
|
649 mSharePopup->initialize( mSongData, tr( "Unknown" ) ); |
|
650 } |
|
651 TX_EXIT |
|
652 } |
|
653 |
|
654 /*! |
|
655 Method to create the share dialog on demand and preload publishing player files. |
|
656 This will construct the share dialog but it will still be in "uninitialized" state. |
|
657 */ |
|
658 void MpDetailsView::preloadShareDialog() |
|
659 { |
|
660 TX_ENTRY |
|
661 if ( !mSharePopup ) |
|
662 { |
|
663 mSharePopup = new MpDetailsShareDialog(); |
|
664 } |
|
665 mSharePopup->cachePublishingPlayerFiles(); |
|
666 TX_EXIT |
|
667 } |
|
668 |
|
669 /*! |
|
670 Slot to be called when ok/close button in share dialog is pressed. |
|
671 */ |
|
672 void MpDetailsView::closeShareDialog() |
|
673 { |
|
674 TX_ENTRY |
|
675 if ( mSharePopup ) |
|
676 { |
|
677 // Dialog uses WA_DeleteOnClose so no need to delete it explicitely here, just close it. |
|
678 mSharePopup->close(); |
|
679 mSharePopup = NULL; |
|
680 } |
|
681 TX_EXIT |
|
682 } |
|
683 #endif |
|
684 |
|
685 /*! |
|
686 Slot to handle the music store URL retrieval from the query manager. |
|
687 */ |
622 */ |
688 void MpDetailsView::updateSharedData(const QString& url) |
623 void MpDetailsView::handleListItemSelected( HbListWidgetItem *item) |
689 { |
624 { |
690 TX_ENTRY |
625 TX_ENTRY_ARGS( "URL: " << item->secondaryText() ); |
691 mSongData->setLink( url ); |
626 QDesktopServices::openUrl( item->secondaryText() ); |
692 #ifdef SHARE_FUNC_ENABLED |
627 TX_EXIT |
693 if ( mSharePopup ) |
628 } |
694 { |
629 |
695 mSharePopup->updateSharedData(); |
630 /*! |
696 } |
631 Slot to call when MusicStore Info is Received |
697 #endif |
632 */ |
698 TX_EXIT |
633 void MpDetailsView::queryInspireMe(bool storeUpdated) |
699 } |
634 { |
|
635 TX_ENTRY |
|
636 // we asked query manager to update its local store information |
|
637 // if that store info didnt change (i.e. from empty string to "fi" or |
|
638 // from "bad old store" to "good new store") then we dont need to pursue a query |
|
639 if( storeUpdated ) { |
|
640 mMpQueryManager->queryInspireMeItems(mSongData->artist(),mSongData->album(),mSongData->title()); |
|
641 mInspireMeQueryOngoing = true; |
|
642 } |
|
643 else { |
|
644 mInspireMeQueryOngoing = false; |
|
645 mInspireMeProgressBar->hide(); |
|
646 } |
|
647 TX_EXIT |
|
648 } |
|
649 |