author | hgs |
Fri, 11 Jun 2010 19:36:32 -0500 | |
changeset 37 | eb79a7c355bf |
parent 36 | a0afa279b8fe |
child 43 | 0f32e550d9d8 |
child 48 | af3740e3753f |
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. |
36 | 4 |
* This component and the accompanying materials are made available |
20
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 details view. |
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 |
*/ |
35 | 17 |
#include <QWebSettings> |
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
18 |
#include <QGraphicsWidget> |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
19 |
#include <QGraphicsLayoutItem> |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
20 |
#include <QUrl> |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
21 |
#include <QDomElement> |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
22 |
#include <QList> |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
23 |
#include <QFile> |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
24 |
#include <QGraphicsLinearLayout> |
35 | 25 |
#include <QSizeF> |
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
26 |
|
36 | 27 |
|
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
28 |
|
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
29 |
#include <hbinstance.h> |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
30 |
#include <hbmainwindow.h> |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
31 |
#include <hbaction.h> |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
32 |
#include <hblabel.h> |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
33 |
#include <hbgroupbox.h> |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
34 |
#include <hbdocumentloader.h> |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
35 |
#include <hbwidget.h> |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
36 |
#include <hbpushbutton.h> |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
37 |
#include <hbpopup.h> |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
38 |
#include <hbdialog.h> |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
39 |
#include <hblistwidget.h> |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
40 |
#include <hblistwidgetitem.h> |
35 | 41 |
#include <hblistviewitem.h> |
42 |
#include <hbprogressbar.h> |
|
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
43 |
|
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
44 |
#include "mpdetailsview.h" |
35 | 45 |
#include "mpenginefactory.h" |
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
46 |
#include "mpcommondefs.h" |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
47 |
#include "mpsongdata.h" |
35 | 48 |
#include "mpsettingsmanager.h" |
49 |
#include "mpquerymanager.h" |
|
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
50 |
#include "mptrace.h" |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
51 |
|
35 | 52 |
#ifdef SHARE_FUNC_ENABLED |
53 |
#include "mpdetailssharedialog.h" |
|
54 |
#endif |
|
55 |
||
36 | 56 |
|
35 | 57 |
const int KRecommendationCount = 2; |
58 |
||
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
59 |
|
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 |
Constructor |
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 |
MpDetailsView::MpDetailsView() |
35 | 64 |
: mMpEngine( 0 ), |
65 |
mSongData( 0 ), |
|
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
66 |
mActivated( false ), |
35 | 67 |
mSoftKeyBack( 0 ), |
36 | 68 |
mSongText( 0 ), |
69 |
mAlbumText( 0 ), |
|
70 |
mArtistText( 0 ), |
|
71 |
mAlbumArt( 0 ), |
|
72 |
mSongDetailsGroupBox(0), |
|
73 |
mInspireMeGroupBox(0), |
|
74 |
mShareButton(0), |
|
75 |
mDocumentLoader( 0 ), |
|
76 |
mDetailList(0), |
|
77 |
mInspireList(0), |
|
78 |
mInspireMeProgressBar(0), |
|
35 | 79 |
mMpQueryManager( 0 ), |
80 |
mInspireMeQueryOngoing( false ), |
|
81 |
mInspireMeQueryRendered( false ), |
|
82 |
mInspireMeOpen(true), |
|
83 |
mSongDetailsGbOpen(false) |
|
84 |
#ifdef SHARE_FUNC_ENABLED |
|
85 |
, mSharePopup( 0 ) |
|
86 |
#endif |
|
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
87 |
{ |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
88 |
TX_ENTRY |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
89 |
bool widgetsOk = false; |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
90 |
HbMainWindow *mainWindow = hbInstance->allMainWindows()[0]; |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
91 |
mDocumentLoader = new HbDocumentLoader(); |
36 | 92 |
|
35 | 93 |
TX_LOG_ARGS("Document loader created") |
94 |
if(!mDocumentLoader) { |
|
95 |
TX_LOG_ARGS( "MpDetailsView() Error: HbDocumentLoader not constructed" ); |
|
36 | 96 |
return; |
35 | 97 |
} |
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
98 |
|
35 | 99 |
TX_LOG_ARGS("Loading :/mpdetailsviewdocml/mpdetailsview.docml") |
100 |
mDocumentLoader->load( QString(":/mpdetailsviewdocml/mpdetailsview.docml"), &widgetsOk ); |
|
101 |
if(!widgetsOk) { |
|
102 |
TX_LOG_ARGS( "MpDetailsView() Error: invalid mpdetailsview.docml" ); |
|
36 | 103 |
return; |
35 | 104 |
} |
36 | 105 |
|
35 | 106 |
TX_LOG_ARGS("Loaded :/mpdetailsviewdocml/mpdetailsview.docml") |
36 | 107 |
QGraphicsWidget *widget = 0; |
108 |
||
35 | 109 |
widget = mDocumentLoader->findWidget( QString("content") ); |
110 |
TX_LOG_ARGS( "MpDetailsView() mDocumentLoader->findWidget for <content>: " << (int)(widget) ); |
|
36 | 111 |
setWidget( qobject_cast<HbWidget *>(widget) ); |
35 | 112 |
|
113 |
widget = mDocumentLoader->findWidget( QString("shareButton") ); |
|
114 |
mShareButton = qobject_cast<HbPushButton *>(widget); |
|
115 |
TX_LOG_ARGS("MpDetailsView() <shareButton> widget found mShareButton: " << (int)(mShareButton) ); |
|
116 |
||
117 |
widget = mDocumentLoader->findWidget( QString("trackTitle") ); |
|
118 |
mSongText = qobject_cast<HbLabel *>(widget); |
|
119 |
TX_LOG_ARGS("MpDetailsView() <trackTitle> widget found mSongText: " << (int)(mSongText) ); |
|
36 | 120 |
|
35 | 121 |
widget = mDocumentLoader->findWidget( QString("artist") ); |
122 |
mArtistText = qobject_cast<HbLabel *>(widget); |
|
123 |
TX_LOG_ARGS("MpDetailsView() <artist> widget found mArtistText: " << (int)(mArtistText) ); |
|
36 | 124 |
|
35 | 125 |
widget = mDocumentLoader->findWidget( QString("albumName") ); |
126 |
mAlbumText = qobject_cast<HbLabel *>(widget); |
|
127 |
TX_LOG_ARGS("MpDetailsView() <albumName> widget found mAlbumText: " << (int)(mAlbumText) ); |
|
128 |
||
129 |
widget = mDocumentLoader->findWidget( QString("albumArt") ); |
|
130 |
mAlbumArt = qobject_cast<HbLabel *>(widget); |
|
131 |
TX_LOG_ARGS("MpDetailsView() <albumArt> widget found mAlbumArt: " << (int)(mAlbumArt) ); |
|
36 | 132 |
|
35 | 133 |
widget = mDocumentLoader->findWidget( QString("songDetails") ); |
134 |
mSongDetailsGroupBox = qobject_cast<HbGroupBox *>(widget); |
|
135 |
TX_LOG_ARGS("MpDetailsView() <songDetails> widget found mSongDetailsGroupBox: " << (int)(mSongDetailsGroupBox) ); |
|
36 | 136 |
|
35 | 137 |
widget = mDocumentLoader->findWidget( QString("songDetailsListWidget") ); |
138 |
mDetailList = qobject_cast<HbListWidget *>(widget); |
|
139 |
TX_LOG_ARGS("MpDetailsView() <songDetailsListWidget> widget found mDetailList: " << (int)(mDetailList) ); |
|
36 | 140 |
|
35 | 141 |
widget = mDocumentLoader->findWidget( QString("inspireMeGroupBox") ); |
142 |
mInspireMeGroupBox = qobject_cast<HbGroupBox *>(widget); |
|
143 |
TX_LOG_ARGS("MpDetailsView() <inspireMeGroupBox> widget found mInspireMeGroupBox: " << (int)(mInspireMeGroupBox) ); |
|
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
144 |
|
35 | 145 |
widget = mDocumentLoader->findWidget( QString("inspireListWidget") ); |
146 |
mInspireList = qobject_cast<HbListWidget *>(widget); |
|
147 |
TX_LOG_ARGS("MpDetailsView() <inspireListWidget> widget found mInspireList: " << (int)(mInspireList) ); |
|
36 | 148 |
|
35 | 149 |
widget = mDocumentLoader->findWidget( QString("inspireMeProgressBar") ); |
150 |
mInspireMeProgressBar = qobject_cast<HbProgressBar *>(widget); |
|
151 |
TX_LOG_ARGS("MpDetailsView() <inspireMeProgressBar> widget found mInspireMeProgressBar: " << (int)(mInspireMeProgressBar) ); |
|
36 | 152 |
|
153 |
// load section HideInspireMe if no ovi store suport |
|
154 |
bool loadingSectionOk = false; |
|
155 |
mDocumentLoader->load( QString(":/mpdetailsviewdocml/mpdetailsview.docml"), QString( "ShowInspireMe" ), &loadingSectionOk ); |
|
156 |
if( loadingSectionOk ) { |
|
157 |
TX_LOG_ARGS( "Loading ShowInspireMe section is successful." ); |
|
158 |
} else { |
|
159 |
TX_LOG_ARGS( "Loading ShowInspireMe section fails." ); |
|
160 |
} |
|
161 |
||
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
162 |
TX_EXIT |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
163 |
} |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
164 |
|
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
165 |
/*! |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
166 |
Destructs the details view. |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
167 |
*/ |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
168 |
MpDetailsView::~MpDetailsView() |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
169 |
{ |
36 | 170 |
TX_ENTRY |
171 |
delete mSoftKeyBack; |
|
172 |
delete mDocumentLoader; |
|
35 | 173 |
delete mMpQueryManager; |
174 |
||
175 |
#ifdef SHARE_FUNC_ENABLED |
|
176 |
closeShareDialog(); |
|
177 |
#endif |
|
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
178 |
TX_EXIT |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
179 |
} |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
180 |
|
35 | 181 |
|
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
182 |
/*! |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
183 |
Initializes the details view. Allocates all resources needed by the view. |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
184 |
*/ |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
185 |
void MpDetailsView::initializeView() |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
186 |
{ |
36 | 187 |
TX_ENTRY |
188 |
||
189 |
mSoftKeyBack = new HbAction( Hb::BackNaviAction, this ); |
|
190 |
||
35 | 191 |
mMpEngine = MpEngineFactory::sharedEngine(); |
192 |
mSongData = mMpEngine->songData(); |
|
36 | 193 |
|
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
194 |
// TODO: might need later |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
195 |
setupMenu(); |
36 | 196 |
mMpQueryManager = new MpQueryManager(); |
197 |
||
35 | 198 |
connect( mSoftKeyBack, SIGNAL( triggered() ), this, SLOT( back() ) ); |
36 | 199 |
connect( mSongData, SIGNAL( albumArtReady() ), this, SLOT( albumArtChanged() ) ); |
35 | 200 |
connect( mSongData, SIGNAL( playbackInfoChanged() ), this, SLOT( handlePlaybackInfoChanged() ) ); |
36 | 201 |
connect( mSongData, SIGNAL( songDetailInfoChanged() ), this, SLOT( songDetailInfoChanged() ) ); |
202 |
connect( mSongDetailsGroupBox, SIGNAL( toggled( bool ) ), this, SLOT( handleDetailsGroupBoxToggled( bool ) ) ); |
|
203 |
connect( mInspireMeGroupBox, SIGNAL( toggled( bool ) ), this, SLOT( handleInspireMeGroupBoxToggled( bool ) ) ); |
|
35 | 204 |
connect( mMpQueryManager, SIGNAL( networkError() ), this ,SLOT( handleNetworkError() ) ); |
205 |
connect( mMpQueryManager, SIGNAL(searchUrlRetrieved(const QString&)), this, SLOT(updateSharedData(const QString&))); |
|
36 | 206 |
connect( mMpQueryManager, SIGNAL(recommendationAlbumArtsReady()), this, SLOT(RenderInspireMeGroupBox())); |
35 | 207 |
|
36 | 208 |
#ifdef SHARE_FUNC_ENABLED |
35 | 209 |
connect( mShareButton, SIGNAL( clicked() ), this, SLOT( share() ) ); |
36 | 210 |
|
35 | 211 |
// Preload the share popup |
36 | 212 |
preloadShareDialog(); |
35 | 213 |
#endif |
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
214 |
TX_EXIT |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
215 |
} |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
216 |
|
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
217 |
/*! |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
218 |
Activates the details view. |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
219 |
*/ |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
220 |
void MpDetailsView::activateView() |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
221 |
{ |
36 | 222 |
TX_ENTRY |
35 | 223 |
setNavigationAction( mSoftKeyBack ); |
224 |
mMpEngine->retrieveSong(); |
|
36 | 225 |
|
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
226 |
mActivated = true; |
35 | 227 |
mInspireMeOpen = MpSettingsManager::inspireMe(); |
228 |
mSongDetailsGbOpen = MpSettingsManager::songDetailsGb(); |
|
229 |
TX_LOG_ARGS( "InspireMeVal: " << mInspireMeOpen ); |
|
230 |
TX_LOG_ARGS( "SongDetailsGbVal: " << mSongDetailsGbOpen ); |
|
231 |
mInspireMeGroupBox->setCollapsed(!mInspireMeOpen); |
|
232 |
mSongDetailsGroupBox->setCollapsed(!mSongDetailsGbOpen); |
|
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
233 |
TX_EXIT |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
234 |
} |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
235 |
|
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
236 |
/*! |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
237 |
Deactivates the details view. |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
238 |
*/ |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
239 |
void MpDetailsView::deactivateView() |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
240 |
{ |
36 | 241 |
TX_ENTRY |
35 | 242 |
if (mInspireMeGroupBox->isCollapsed() ) { |
243 |
MpSettingsManager::setInspireMe(false); |
|
244 |
} else { |
|
245 |
MpSettingsManager::setInspireMe(true); |
|
246 |
} |
|
36 | 247 |
|
35 | 248 |
if (mSongDetailsGroupBox->isCollapsed() ) { |
249 |
MpSettingsManager::setSongDetailsGb(false); |
|
250 |
} else { |
|
251 |
MpSettingsManager::setSongDetailsGb(true); |
|
252 |
} |
|
36 | 253 |
|
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
254 |
setNavigationAction( 0 ); |
36 | 255 |
mActivated = false; |
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
256 |
TX_EXIT |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
257 |
} |
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 |
/*! |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
260 |
Setup the menu. |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
261 |
*/ |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
262 |
void MpDetailsView::setupMenu() |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
263 |
{ |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
264 |
TX_ENTRY |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
265 |
|
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
266 |
TX_EXIT |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
267 |
} |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
268 |
|
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
269 |
/*! |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
270 |
Slot to handle back command from softkey. |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
271 |
*/ |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
272 |
void MpDetailsView::back() |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
273 |
{ |
36 | 274 |
TX_ENTRY |
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
275 |
emit command( MpCommon::ActivatePlaybackView ); |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
276 |
TX_EXIT |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
277 |
} |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
278 |
|
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
279 |
/*! |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
280 |
Slot to handle Album art changed. |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
281 |
*/ |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
282 |
void MpDetailsView::albumArtChanged( ) |
36 | 283 |
{ |
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
284 |
TX_ENTRY |
35 | 285 |
HbIcon icon; |
286 |
mSongData->albumArt( icon ); |
|
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
287 |
mAlbumArt->setIcon( icon ); |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
288 |
TX_EXIT |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
289 |
} |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
290 |
|
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
291 |
/*! |
35 | 292 |
Slot to handle network error. |
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
293 |
*/ |
35 | 294 |
void MpDetailsView::handleNetworkError() |
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
295 |
{ |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
296 |
TX_ENTRY |
35 | 297 |
mInspireMeQueryOngoing = false; |
298 |
mInspireMeQueryRendered = false; |
|
36 | 299 |
clearInspireMe(); |
35 | 300 |
mInspireMeGroupBox->setCollapsed( true ); |
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
301 |
TX_EXIT |
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 |
|
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
304 |
/*! |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
305 |
Render inspireme groupbox after album arts downloaded |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
306 |
*/ |
36 | 307 |
void MpDetailsView::RenderInspireMeGroupBox() |
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
308 |
{ |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
309 |
TX_ENTRY |
35 | 310 |
mInspireMeQueryOngoing = false; |
311 |
mInspireMeQueryRendered = true; |
|
312 |
mInspireMeProgressBar->hide(); |
|
313 |
if( mMpQueryManager->recommendationAlbumArtsMap().count() ) { |
|
314 |
TX_LOG_ARGS( "There are recommendations." ) |
|
315 |
// we have recommendations |
|
316 |
for ( int i = 0; i < KRecommendationCount; i++ ) { |
|
317 |
// configure the layout properties |
|
318 |
if(!mInspireList->count()) { |
|
36 | 319 |
// we havent configured the prototype before |
35 | 320 |
HbListViewItem *prototype = mInspireList->listItemPrototype(); |
321 |
prototype->setGraphicsSize( HbListViewItem::LargeIcon ); |
|
322 |
} |
|
323 |
// create the item |
|
324 |
HbListWidgetItem *inspireMeItem = new HbListWidgetItem(); |
|
36 | 325 |
HbIcon icon( QIcon( mMpQueryManager->recommendationAlbumArtsMap().value(mMpQueryManager->recommendationAlbumArtsLink().at( i ) ) ) ); |
35 | 326 |
inspireMeItem->setIcon( icon ); |
327 |
inspireMeItem->setText( mMpQueryManager->recommendationSongs().at( i ) ); |
|
328 |
inspireMeItem->setSecondaryText( mMpQueryManager->recommendationArtists().at( i ) ); |
|
329 |
mInspireList->addItem( inspireMeItem ); |
|
330 |
} |
|
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
331 |
} |
35 | 332 |
else { |
333 |
TX_LOG_ARGS( "There is NO recommendation." ) |
|
334 |
// we dont have recommendations |
|
36 | 335 |
// we havent configured the prototype before |
35 | 336 |
HbListViewItem *prototype = mInspireList->listItemPrototype(); |
337 |
const int maxTextRowCount = 20; |
|
338 |
const int minTextRowCount = 1; |
|
339 |
prototype->setSecondaryTextRowCount(minTextRowCount,maxTextRowCount); |
|
36 | 340 |
|
35 | 341 |
HbListWidgetItem *inspireMeItem = new HbListWidgetItem(); |
342 |
QString info(tr("There are no recommendations for this track, but you can always discover new music on Ovi")); |
|
343 |
inspireMeItem->setText( QString( " " ) ); |
|
344 |
inspireMeItem->setSecondaryText( info ); |
|
345 |
mInspireList->addItem( inspireMeItem ); |
|
346 |
} |
|
36 | 347 |
|
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
348 |
TX_EXIT |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
349 |
} |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
350 |
|
35 | 351 |
bool MpDetailsView::canQueryRecommendations() const |
352 |
{ |
|
353 |
bool result = ( ( !mSongData->album().isEmpty() ) || |
|
36 | 354 |
( !mSongData->artist().isEmpty() ) ) && |
35 | 355 |
!( mInspireMeGroupBox->isCollapsed() ); |
356 |
TX_LOG_ARGS( "Can query recommendations:" << result ); |
|
357 |
return result; |
|
358 |
} |
|
359 |
||
360 |
bool MpDetailsView::canQuerySharePlayerLink() const |
|
361 |
{ |
|
362 |
bool result = ( !mSongData->title().isEmpty() ) && |
|
363 |
( !mSongData->artist().isEmpty() ) ; |
|
364 |
TX_LOG_ARGS( "Can query share player link:" << result ); |
|
365 |
return result; |
|
366 |
} |
|
367 |
||
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
368 |
/*! |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
369 |
Slot to handle basic song information |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
370 |
*/ |
35 | 371 |
void MpDetailsView::handlePlaybackInfoChanged() |
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
372 |
{ |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
373 |
TX_ENTRY |
35 | 374 |
mMpQueryManager->clearNetworkReplies(); |
375 |
clearInspireMe(); |
|
376 |
mInspireMeQueryRendered = false; |
|
36 | 377 |
|
378 |
// Clear the song data link until new query has been made. |
|
379 |
mSongData->setLink( "" ); |
|
380 |
||
35 | 381 |
if ( !mSongData->title().isEmpty () ) { |
382 |
mSongText->setPlainText( mSongData->title() ); |
|
383 |
} else { |
|
384 |
mSongText->setPlainText( mSongData->fileName() ); |
|
385 |
} |
|
36 | 386 |
|
35 | 387 |
if ( !mSongData->album().isEmpty () ) { |
388 |
mAlbumText->setPlainText( mSongData->album() ); |
|
389 |
} else { |
|
36 | 390 |
mAlbumText->setPlainText( tr( "Unknown") ); |
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
391 |
} |
36 | 392 |
|
35 | 393 |
if ( !mSongData->artist().isEmpty() ) { |
394 |
mArtistText->setPlainText( mSongData->artist() ); |
|
395 |
} else { |
|
36 | 396 |
mArtistText->setPlainText( tr( "Unknown") ); |
35 | 397 |
} |
36 | 398 |
|
399 |
if (canQuerySharePlayerLink() ) { |
|
400 |
mMpQueryManager->queryLocalMusicStore(mSongData->artist(),mSongData->album(),mSongData->title()); |
|
401 |
} |
|
402 |
||
35 | 403 |
if (canQueryRecommendations()) { |
404 |
// start inspire me area progress bar |
|
405 |
// TODO: currently, till we get to this callback from MPX the bar not shown |
|
406 |
// TODO: check if inspireMe is ON, if not, dont show |
|
407 |
mInspireMeProgressBar->show(); |
|
408 |
mMpQueryManager->queryInspireMeItems(mSongData->artist(),mSongData->album(),mSongData->title()); |
|
409 |
mInspireMeQueryOngoing = true; |
|
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
410 |
} |
35 | 411 |
else { |
412 |
// metadata to query for inspire me items not available |
|
413 |
// show information note |
|
414 |
if (!mInspireMeGroupBox->isCollapsed()) |
|
415 |
RenderInspireMeGroupBox(); |
|
416 |
} |
|
36 | 417 |
TX_EXIT |
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
418 |
} |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
419 |
|
35 | 420 |
void MpDetailsView::clearInspireMe() |
421 |
{ |
|
36 | 422 |
TX_ENTRY |
35 | 423 |
mInspireList->clear(); |
36 | 424 |
mMpQueryManager->clearRecommendations(); |
425 |
TX_EXIT |
|
35 | 426 |
} |
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
427 |
/*! |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
428 |
Slot to handle detail song information |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
429 |
*/ |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
430 |
void MpDetailsView::songDetailInfoChanged() |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
431 |
{ |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
432 |
TX_ENTRY |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
433 |
mDetailList->clear(); |
36 | 434 |
|
35 | 435 |
if ( !mSongData->albumTrack().isNull() ) { |
36 | 436 |
HbListWidgetItem *item = new HbListWidgetItem(); |
35 | 437 |
item->setText( tr( "Song number" ) ); |
438 |
item->setSecondaryText( mSongData->albumTrack() ); |
|
439 |
item->setEnabled( false ); |
|
440 |
mDetailList->addItem( item ); |
|
441 |
} |
|
36 | 442 |
|
35 | 443 |
if ( !mSongData->year().isNull() ) { |
444 |
HbListWidgetItem *item = new HbListWidgetItem(); |
|
445 |
item->setText( tr( "Year" ) ); |
|
446 |
item->setSecondaryText( mSongData->year() ); |
|
447 |
item->setEnabled( false ); |
|
448 |
mDetailList->addItem( item ); |
|
449 |
} |
|
36 | 450 |
|
35 | 451 |
if ( !mSongData->genre().isNull() ) { |
452 |
HbListWidgetItem *item = new HbListWidgetItem(); |
|
453 |
item->setText( tr( "Genre" ) ); |
|
454 |
item->setSecondaryText( mSongData->genre() ); |
|
455 |
item->setEnabled( false ); |
|
456 |
mDetailList->addItem( item ); |
|
457 |
} |
|
36 | 458 |
|
35 | 459 |
if ( !mSongData->composer().isNull() ) { |
460 |
HbListWidgetItem *item = new HbListWidgetItem(); |
|
461 |
item->setText( tr( "Composer" ) ); |
|
462 |
item->setSecondaryText( mSongData->composer() ); |
|
463 |
item->setEnabled( false ); |
|
464 |
mDetailList->addItem( item ); |
|
465 |
} |
|
466 |
||
467 |
if ( !mSongData->fileName().isNull() ) { |
|
468 |
HbListWidgetItem *item = new HbListWidgetItem(); |
|
469 |
item->setText( tr( "File name" ) ); |
|
470 |
item->setSecondaryText( mSongData->fileName() ); |
|
471 |
item->setEnabled( false ); |
|
472 |
mDetailList->addItem( item ); |
|
473 |
} |
|
36 | 474 |
|
35 | 475 |
if ( !mSongData->mimeType().isNull() ) { |
476 |
HbListWidgetItem *item = new HbListWidgetItem(); |
|
477 |
item->setText( tr( "Format" ) ); |
|
478 |
item->setSecondaryText( mSongData->mimeType() ); |
|
479 |
item->setEnabled( false ); |
|
480 |
mDetailList->addItem( item ); |
|
481 |
} |
|
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
482 |
|
35 | 483 |
if ( !mSongData->duration().isNull() ) { |
484 |
HbListWidgetItem *item = new HbListWidgetItem(); |
|
485 |
item->setText( tr( "Duration" ) ); |
|
486 |
item->setSecondaryText( mSongData->duration() ); |
|
487 |
item->setEnabled( false ); |
|
488 |
mDetailList->addItem( item ); |
|
489 |
} |
|
36 | 490 |
|
35 | 491 |
if ( !mSongData->bitRate().isNull() ) { |
492 |
HbListWidgetItem *item = new HbListWidgetItem(); |
|
493 |
item->setText( tr( "Bitrate" ) ); |
|
494 |
item->setSecondaryText( mSongData->bitRate().append( " Kbps" ) ); |
|
495 |
item->setEnabled( false ); |
|
496 |
mDetailList->addItem( item ); |
|
497 |
} |
|
36 | 498 |
|
35 | 499 |
if ( !mSongData->sampleRate().isNull() ) { |
500 |
HbListWidgetItem *item = new HbListWidgetItem(); |
|
501 |
item->setText( tr( "Sampling rate" ) ); |
|
502 |
item->setSecondaryText( mSongData->sampleRate().append( " hz" ) ); |
|
503 |
item->setEnabled( false ); |
|
504 |
mDetailList->addItem( item ); |
|
505 |
} |
|
36 | 506 |
|
35 | 507 |
if ( !mSongData->size().isNull() ) { |
508 |
HbListWidgetItem *item = new HbListWidgetItem(); |
|
509 |
item->setText( tr( "Size" ) ); |
|
510 |
item->setSecondaryText( mSongData->size().append( " MB" ) ); |
|
511 |
item->setEnabled( false ); |
|
512 |
mDetailList->addItem( item ); |
|
513 |
} |
|
36 | 514 |
|
35 | 515 |
if ( !mSongData->modified().isNull() ) { |
516 |
HbListWidgetItem *item = new HbListWidgetItem(); |
|
517 |
item->setText( tr( "Modified" ) ); |
|
518 |
item->setSecondaryText( mSongData->modified() ); |
|
519 |
item->setEnabled( false ); |
|
520 |
mDetailList->addItem( item ); |
|
521 |
} |
|
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
522 |
|
35 | 523 |
if ( !mSongData->copyright().isNull() ) { |
524 |
HbListWidgetItem *item = new HbListWidgetItem(); |
|
525 |
item->setText( tr( "Copyright" ) ); |
|
526 |
item->setSecondaryText( mSongData->copyright() ); |
|
527 |
item->setEnabled( false ); |
|
528 |
mDetailList->addItem( item ); |
|
529 |
} |
|
36 | 530 |
|
35 | 531 |
if ( !mSongData->musicURL().isNull() ) { |
532 |
HbListWidgetItem *item = new HbListWidgetItem(); |
|
533 |
item->setText( tr( "Web site" ) ); |
|
534 |
item->setSecondaryText( mSongData->musicURL() ); |
|
535 |
item->setEnabled( true ); |
|
536 |
mDetailList->addItem( item ); |
|
537 |
} |
|
36 | 538 |
|
35 | 539 |
if ( mSongData->isDrmProtected() ) { |
540 |
HbListWidgetItem *item = new HbListWidgetItem(); |
|
541 |
item->setText( tr( "Licences" ) ); |
|
542 |
item->setSecondaryText( tr( "Click for details" ) ); |
|
543 |
item->setEnabled( true ); |
|
544 |
mDetailList->addItem( item ); |
|
545 |
} |
|
546 |
||
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
547 |
TX_EXIT |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
548 |
} |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
549 |
|
36 | 550 |
void MpDetailsView::handleDetailsGroupBoxToggled(bool /*state*/) |
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
551 |
{ |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
552 |
TX_ENTRY |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
553 |
if ( !mSongDetailsGroupBox->isCollapsed() ) { |
35 | 554 |
mInspireMeGroupBox->setCollapsed( true ); |
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
555 |
} |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
556 |
TX_EXIT |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
557 |
} |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
558 |
|
35 | 559 |
void MpDetailsView::handleInspireMeGroupBoxToggled(bool /*state*/) |
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
560 |
{ |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
561 |
TX_ENTRY |
35 | 562 |
if ( !mInspireMeGroupBox->isCollapsed() ) { |
563 |
TX_LOG_ARGS( "InspireMe is expanded." ) |
|
36 | 564 |
mSongDetailsGroupBox->setCollapsed( true ); |
35 | 565 |
if ( mInspireMeQueryOngoing ) { |
566 |
TX_LOG_ARGS( "Query is ongoing " ) |
|
567 |
mInspireMeProgressBar->show(); |
|
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
568 |
} else { |
35 | 569 |
TX_LOG_ARGS( "Query is NOT ongoing " ) |
570 |
if ( mInspireMeQueryRendered ) { |
|
571 |
TX_LOG_ARGS( "InspireMe is rendered already. " ) |
|
572 |
mInspireMeProgressBar->hide(); |
|
573 |
} else { |
|
574 |
if ( canQueryRecommendations() ) { |
|
575 |
TX_LOG_ARGS( "InspireMe is NOT rendered yet but can query for recommendations. " ) |
|
576 |
mMpQueryManager->queryInspireMeItems(mSongData->artist(),mSongData->album(),mSongData->title()); |
|
577 |
mInspireMeProgressBar->show(); |
|
578 |
mInspireMeQueryOngoing = true; |
|
579 |
} else { |
|
580 |
TX_LOG_ARGS( "InspireMe is NOT rendered yet and CANNOT query for recommendations either. " ) |
|
581 |
RenderInspireMeGroupBox(); |
|
582 |
} |
|
36 | 583 |
} |
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
584 |
} |
35 | 585 |
} else { |
586 |
TX_LOG_ARGS( "InspireMe is collapsed." ) |
|
587 |
mInspireMeProgressBar->hide(); |
|
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
588 |
} |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
589 |
TX_EXIT |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
590 |
} |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
591 |
|
35 | 592 |
#ifdef SHARE_FUNC_ENABLED |
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
593 |
/*! |
35 | 594 |
Slot to be called when share button is clicked |
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
595 |
*/ |
35 | 596 |
void MpDetailsView::share() |
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
597 |
{ |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
598 |
TX_ENTRY |
35 | 599 |
createShareDialog(); |
600 |
if (canQuerySharePlayerLink() ) |
|
601 |
{ |
|
602 |
mMpQueryManager->queryLocalMusicStore(mSongData->artist(),mSongData->album(),mSongData->title() ); |
|
603 |
} |
|
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
604 |
TX_EXIT |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
605 |
} |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
606 |
|
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
607 |
/*! |
35 | 608 |
Method to create the share dialog on demand. |
36 | 609 |
This will cause the share web view to be created and start loading. |
35 | 610 |
*/ |
611 |
void MpDetailsView::createShareDialog() |
|
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
612 |
{ |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
613 |
TX_ENTRY |
35 | 614 |
if ( !mSharePopup ) |
615 |
{ |
|
616 |
mSharePopup = new MpDetailsShareDialog(); |
|
36 | 617 |
} |
618 |
if ( !mSharePopup->isInitialized() ) |
|
619 |
{ |
|
620 |
connect( mSharePopup, SIGNAL( closeShareDialog() ), this, SLOT( closeShareDialog() ) ); |
|
621 |
mSharePopup->initialize( mSongData, tr( "Unknown" ) ); |
|
35 | 622 |
} |
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
623 |
TX_EXIT |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
624 |
} |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
625 |
|
35 | 626 |
/*! |
36 | 627 |
Method to create the share dialog on demand and preload publishing player files. |
628 |
This will construct the share dialog but it will still be in "uninitialized" state. |
|
629 |
*/ |
|
630 |
void MpDetailsView::preloadShareDialog() |
|
631 |
{ |
|
632 |
TX_ENTRY |
|
633 |
if ( !mSharePopup ) |
|
634 |
{ |
|
635 |
mSharePopup = new MpDetailsShareDialog(); |
|
636 |
} |
|
637 |
mSharePopup->cachePublishingPlayerFiles(); |
|
638 |
TX_EXIT |
|
639 |
} |
|
640 |
||
641 |
/*! |
|
35 | 642 |
Slot to be called when ok/close button in share dialog is pressed. |
643 |
*/ |
|
644 |
void MpDetailsView::closeShareDialog() |
|
645 |
{ |
|
646 |
TX_ENTRY |
|
647 |
if ( mSharePopup ) |
|
648 |
{ |
|
36 | 649 |
// Dialog uses WA_DeleteOnClose so no need to delete it explicitely here, just close it. |
35 | 650 |
mSharePopup->close(); |
651 |
mSharePopup = NULL; |
|
652 |
} |
|
653 |
TX_EXIT |
|
654 |
} |
|
655 |
#endif |
|
656 |
||
657 |
/*! |
|
658 |
Slot to handle the music store URL retrieval from the query manager. |
|
659 |
*/ |
|
660 |
void MpDetailsView::updateSharedData(const QString& url) |
|
661 |
{ |
|
662 |
TX_ENTRY |
|
663 |
mSongData->setLink( url ); |
|
664 |
#ifdef SHARE_FUNC_ENABLED |
|
665 |
if ( mSharePopup ) |
|
666 |
{ |
|
667 |
mSharePopup->updateSharedData(); |
|
668 |
} |
|
669 |
#endif |
|
670 |
TX_EXIT |
|
671 |
} |