author | hgs |
Fri, 09 Jul 2010 16:27:03 -0500 | |
changeset 43 | 0f32e550d9d8 |
parent 37 | eb79a7c355bf |
child 45 | 612c4815aebe |
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 ); |
36 | 224 |
|
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
225 |
mActivated = true; |
35 | 226 |
mInspireMeOpen = MpSettingsManager::inspireMe(); |
227 |
mSongDetailsGbOpen = MpSettingsManager::songDetailsGb(); |
|
228 |
TX_LOG_ARGS( "InspireMeVal: " << mInspireMeOpen ); |
|
229 |
TX_LOG_ARGS( "SongDetailsGbVal: " << mSongDetailsGbOpen ); |
|
230 |
mInspireMeGroupBox->setCollapsed(!mInspireMeOpen); |
|
231 |
mSongDetailsGroupBox->setCollapsed(!mSongDetailsGbOpen); |
|
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
232 |
TX_EXIT |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
233 |
} |
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 |
Deactivates the details view. |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
237 |
*/ |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
238 |
void MpDetailsView::deactivateView() |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
239 |
{ |
36 | 240 |
TX_ENTRY |
35 | 241 |
if (mInspireMeGroupBox->isCollapsed() ) { |
242 |
MpSettingsManager::setInspireMe(false); |
|
243 |
} else { |
|
244 |
MpSettingsManager::setInspireMe(true); |
|
245 |
} |
|
36 | 246 |
|
35 | 247 |
if (mSongDetailsGroupBox->isCollapsed() ) { |
248 |
MpSettingsManager::setSongDetailsGb(false); |
|
249 |
} else { |
|
250 |
MpSettingsManager::setSongDetailsGb(true); |
|
251 |
} |
|
36 | 252 |
|
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
253 |
setNavigationAction( 0 ); |
36 | 254 |
mActivated = false; |
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
255 |
TX_EXIT |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
256 |
} |
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 |
Setup the menu. |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
260 |
*/ |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
261 |
void MpDetailsView::setupMenu() |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
262 |
{ |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
263 |
TX_ENTRY |
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 |
TX_EXIT |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
266 |
} |
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 |
Slot to handle back command from softkey. |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
270 |
*/ |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
271 |
void MpDetailsView::back() |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
272 |
{ |
36 | 273 |
TX_ENTRY |
43 | 274 |
emit command( MpCommon::ActivatePreviousView ); |
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
275 |
TX_EXIT |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
276 |
} |
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 |
Slot to handle Album art changed. |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
280 |
*/ |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
281 |
void MpDetailsView::albumArtChanged( ) |
36 | 282 |
{ |
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
283 |
TX_ENTRY |
35 | 284 |
HbIcon icon; |
285 |
mSongData->albumArt( icon ); |
|
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
286 |
mAlbumArt->setIcon( icon ); |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
287 |
TX_EXIT |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
288 |
} |
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 |
/*! |
35 | 291 |
Slot to handle network error. |
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
292 |
*/ |
35 | 293 |
void MpDetailsView::handleNetworkError() |
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
294 |
{ |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
295 |
TX_ENTRY |
35 | 296 |
mInspireMeQueryOngoing = false; |
297 |
mInspireMeQueryRendered = false; |
|
36 | 298 |
clearInspireMe(); |
35 | 299 |
mInspireMeGroupBox->setCollapsed( true ); |
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
300 |
TX_EXIT |
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 |
/*! |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
304 |
Render inspireme groupbox after album arts downloaded |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
305 |
*/ |
36 | 306 |
void MpDetailsView::RenderInspireMeGroupBox() |
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
307 |
{ |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
308 |
TX_ENTRY |
35 | 309 |
mInspireMeQueryOngoing = false; |
310 |
mInspireMeQueryRendered = true; |
|
311 |
mInspireMeProgressBar->hide(); |
|
312 |
if( mMpQueryManager->recommendationAlbumArtsMap().count() ) { |
|
313 |
TX_LOG_ARGS( "There are recommendations." ) |
|
314 |
// we have recommendations |
|
315 |
for ( int i = 0; i < KRecommendationCount; i++ ) { |
|
316 |
// configure the layout properties |
|
317 |
if(!mInspireList->count()) { |
|
36 | 318 |
// we havent configured the prototype before |
35 | 319 |
HbListViewItem *prototype = mInspireList->listItemPrototype(); |
320 |
prototype->setGraphicsSize( HbListViewItem::LargeIcon ); |
|
321 |
} |
|
322 |
// create the item |
|
323 |
HbListWidgetItem *inspireMeItem = new HbListWidgetItem(); |
|
36 | 324 |
HbIcon icon( QIcon( mMpQueryManager->recommendationAlbumArtsMap().value(mMpQueryManager->recommendationAlbumArtsLink().at( i ) ) ) ); |
35 | 325 |
inspireMeItem->setIcon( icon ); |
326 |
inspireMeItem->setText( mMpQueryManager->recommendationSongs().at( i ) ); |
|
327 |
inspireMeItem->setSecondaryText( mMpQueryManager->recommendationArtists().at( i ) ); |
|
328 |
mInspireList->addItem( inspireMeItem ); |
|
329 |
} |
|
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
330 |
} |
35 | 331 |
else { |
332 |
TX_LOG_ARGS( "There is NO recommendation." ) |
|
333 |
// we dont have recommendations |
|
36 | 334 |
// we havent configured the prototype before |
35 | 335 |
HbListViewItem *prototype = mInspireList->listItemPrototype(); |
336 |
const int maxTextRowCount = 20; |
|
337 |
const int minTextRowCount = 1; |
|
338 |
prototype->setSecondaryTextRowCount(minTextRowCount,maxTextRowCount); |
|
36 | 339 |
|
35 | 340 |
HbListWidgetItem *inspireMeItem = new HbListWidgetItem(); |
341 |
QString info(tr("There are no recommendations for this track, but you can always discover new music on Ovi")); |
|
342 |
inspireMeItem->setText( QString( " " ) ); |
|
343 |
inspireMeItem->setSecondaryText( info ); |
|
344 |
mInspireList->addItem( inspireMeItem ); |
|
345 |
} |
|
36 | 346 |
|
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
347 |
TX_EXIT |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
348 |
} |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
349 |
|
35 | 350 |
bool MpDetailsView::canQueryRecommendations() const |
351 |
{ |
|
352 |
bool result = ( ( !mSongData->album().isEmpty() ) || |
|
36 | 353 |
( !mSongData->artist().isEmpty() ) ) && |
35 | 354 |
!( mInspireMeGroupBox->isCollapsed() ); |
355 |
TX_LOG_ARGS( "Can query recommendations:" << result ); |
|
356 |
return result; |
|
357 |
} |
|
358 |
||
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 |
||
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
367 |
/*! |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
368 |
Slot to handle basic song information |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
369 |
*/ |
35 | 370 |
void MpDetailsView::handlePlaybackInfoChanged() |
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
371 |
{ |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
372 |
TX_ENTRY |
35 | 373 |
mMpQueryManager->clearNetworkReplies(); |
374 |
clearInspireMe(); |
|
375 |
mInspireMeQueryRendered = false; |
|
36 | 376 |
|
377 |
// Clear the song data link until new query has been made. |
|
378 |
mSongData->setLink( "" ); |
|
379 |
||
35 | 380 |
if ( !mSongData->title().isEmpty () ) { |
381 |
mSongText->setPlainText( mSongData->title() ); |
|
382 |
} else { |
|
383 |
mSongText->setPlainText( mSongData->fileName() ); |
|
384 |
} |
|
36 | 385 |
|
35 | 386 |
if ( !mSongData->album().isEmpty () ) { |
387 |
mAlbumText->setPlainText( mSongData->album() ); |
|
388 |
} else { |
|
36 | 389 |
mAlbumText->setPlainText( tr( "Unknown") ); |
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
390 |
} |
36 | 391 |
|
35 | 392 |
if ( !mSongData->artist().isEmpty() ) { |
393 |
mArtistText->setPlainText( mSongData->artist() ); |
|
394 |
} else { |
|
36 | 395 |
mArtistText->setPlainText( tr( "Unknown") ); |
35 | 396 |
} |
36 | 397 |
|
398 |
if (canQuerySharePlayerLink() ) { |
|
399 |
mMpQueryManager->queryLocalMusicStore(mSongData->artist(),mSongData->album(),mSongData->title()); |
|
400 |
} |
|
401 |
||
35 | 402 |
if (canQueryRecommendations()) { |
403 |
// start inspire me area progress bar |
|
404 |
// TODO: currently, till we get to this callback from MPX the bar not shown |
|
405 |
// TODO: check if inspireMe is ON, if not, dont show |
|
406 |
mInspireMeProgressBar->show(); |
|
407 |
mMpQueryManager->queryInspireMeItems(mSongData->artist(),mSongData->album(),mSongData->title()); |
|
408 |
mInspireMeQueryOngoing = true; |
|
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
409 |
} |
35 | 410 |
else { |
411 |
// metadata to query for inspire me items not available |
|
412 |
// show information note |
|
413 |
if (!mInspireMeGroupBox->isCollapsed()) |
|
414 |
RenderInspireMeGroupBox(); |
|
415 |
} |
|
36 | 416 |
TX_EXIT |
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
417 |
} |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
418 |
|
35 | 419 |
void MpDetailsView::clearInspireMe() |
420 |
{ |
|
36 | 421 |
TX_ENTRY |
35 | 422 |
mInspireList->clear(); |
36 | 423 |
mMpQueryManager->clearRecommendations(); |
424 |
TX_EXIT |
|
35 | 425 |
} |
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
426 |
/*! |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
427 |
Slot to handle detail song information |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
428 |
*/ |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
429 |
void MpDetailsView::songDetailInfoChanged() |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
430 |
{ |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
431 |
TX_ENTRY |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
432 |
mDetailList->clear(); |
36 | 433 |
|
35 | 434 |
if ( !mSongData->albumTrack().isNull() ) { |
36 | 435 |
HbListWidgetItem *item = new HbListWidgetItem(); |
35 | 436 |
item->setText( tr( "Song number" ) ); |
437 |
item->setSecondaryText( mSongData->albumTrack() ); |
|
438 |
item->setEnabled( false ); |
|
439 |
mDetailList->addItem( item ); |
|
440 |
} |
|
36 | 441 |
|
35 | 442 |
if ( !mSongData->year().isNull() ) { |
443 |
HbListWidgetItem *item = new HbListWidgetItem(); |
|
444 |
item->setText( tr( "Year" ) ); |
|
445 |
item->setSecondaryText( mSongData->year() ); |
|
446 |
item->setEnabled( false ); |
|
447 |
mDetailList->addItem( item ); |
|
448 |
} |
|
36 | 449 |
|
35 | 450 |
if ( !mSongData->genre().isNull() ) { |
451 |
HbListWidgetItem *item = new HbListWidgetItem(); |
|
452 |
item->setText( tr( "Genre" ) ); |
|
453 |
item->setSecondaryText( mSongData->genre() ); |
|
454 |
item->setEnabled( false ); |
|
455 |
mDetailList->addItem( item ); |
|
456 |
} |
|
36 | 457 |
|
35 | 458 |
if ( !mSongData->composer().isNull() ) { |
459 |
HbListWidgetItem *item = new HbListWidgetItem(); |
|
460 |
item->setText( tr( "Composer" ) ); |
|
461 |
item->setSecondaryText( mSongData->composer() ); |
|
462 |
item->setEnabled( false ); |
|
463 |
mDetailList->addItem( item ); |
|
464 |
} |
|
465 |
||
466 |
if ( !mSongData->fileName().isNull() ) { |
|
467 |
HbListWidgetItem *item = new HbListWidgetItem(); |
|
468 |
item->setText( tr( "File name" ) ); |
|
469 |
item->setSecondaryText( mSongData->fileName() ); |
|
470 |
item->setEnabled( false ); |
|
471 |
mDetailList->addItem( item ); |
|
472 |
} |
|
36 | 473 |
|
35 | 474 |
if ( !mSongData->mimeType().isNull() ) { |
475 |
HbListWidgetItem *item = new HbListWidgetItem(); |
|
476 |
item->setText( tr( "Format" ) ); |
|
477 |
item->setSecondaryText( mSongData->mimeType() ); |
|
478 |
item->setEnabled( false ); |
|
479 |
mDetailList->addItem( item ); |
|
480 |
} |
|
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
481 |
|
35 | 482 |
if ( !mSongData->duration().isNull() ) { |
483 |
HbListWidgetItem *item = new HbListWidgetItem(); |
|
484 |
item->setText( tr( "Duration" ) ); |
|
485 |
item->setSecondaryText( mSongData->duration() ); |
|
486 |
item->setEnabled( false ); |
|
487 |
mDetailList->addItem( item ); |
|
488 |
} |
|
36 | 489 |
|
35 | 490 |
if ( !mSongData->bitRate().isNull() ) { |
491 |
HbListWidgetItem *item = new HbListWidgetItem(); |
|
492 |
item->setText( tr( "Bitrate" ) ); |
|
493 |
item->setSecondaryText( mSongData->bitRate().append( " Kbps" ) ); |
|
494 |
item->setEnabled( false ); |
|
495 |
mDetailList->addItem( item ); |
|
496 |
} |
|
36 | 497 |
|
35 | 498 |
if ( !mSongData->sampleRate().isNull() ) { |
499 |
HbListWidgetItem *item = new HbListWidgetItem(); |
|
500 |
item->setText( tr( "Sampling rate" ) ); |
|
501 |
item->setSecondaryText( mSongData->sampleRate().append( " hz" ) ); |
|
502 |
item->setEnabled( false ); |
|
503 |
mDetailList->addItem( item ); |
|
504 |
} |
|
36 | 505 |
|
35 | 506 |
if ( !mSongData->size().isNull() ) { |
507 |
HbListWidgetItem *item = new HbListWidgetItem(); |
|
508 |
item->setText( tr( "Size" ) ); |
|
509 |
item->setSecondaryText( mSongData->size().append( " MB" ) ); |
|
510 |
item->setEnabled( false ); |
|
511 |
mDetailList->addItem( item ); |
|
512 |
} |
|
36 | 513 |
|
35 | 514 |
if ( !mSongData->modified().isNull() ) { |
515 |
HbListWidgetItem *item = new HbListWidgetItem(); |
|
516 |
item->setText( tr( "Modified" ) ); |
|
517 |
item->setSecondaryText( mSongData->modified() ); |
|
518 |
item->setEnabled( false ); |
|
519 |
mDetailList->addItem( item ); |
|
520 |
} |
|
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
521 |
|
35 | 522 |
if ( !mSongData->copyright().isNull() ) { |
523 |
HbListWidgetItem *item = new HbListWidgetItem(); |
|
524 |
item->setText( tr( "Copyright" ) ); |
|
525 |
item->setSecondaryText( mSongData->copyright() ); |
|
526 |
item->setEnabled( false ); |
|
527 |
mDetailList->addItem( item ); |
|
528 |
} |
|
36 | 529 |
|
35 | 530 |
if ( !mSongData->musicURL().isNull() ) { |
531 |
HbListWidgetItem *item = new HbListWidgetItem(); |
|
532 |
item->setText( tr( "Web site" ) ); |
|
533 |
item->setSecondaryText( mSongData->musicURL() ); |
|
534 |
item->setEnabled( true ); |
|
535 |
mDetailList->addItem( item ); |
|
536 |
} |
|
36 | 537 |
|
35 | 538 |
if ( mSongData->isDrmProtected() ) { |
539 |
HbListWidgetItem *item = new HbListWidgetItem(); |
|
540 |
item->setText( tr( "Licences" ) ); |
|
541 |
item->setSecondaryText( tr( "Click for details" ) ); |
|
542 |
item->setEnabled( true ); |
|
543 |
mDetailList->addItem( item ); |
|
544 |
} |
|
545 |
||
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
546 |
TX_EXIT |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
547 |
} |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
548 |
|
36 | 549 |
void MpDetailsView::handleDetailsGroupBoxToggled(bool /*state*/) |
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
550 |
{ |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
551 |
TX_ENTRY |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
552 |
if ( !mSongDetailsGroupBox->isCollapsed() ) { |
35 | 553 |
mInspireMeGroupBox->setCollapsed( true ); |
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
554 |
} |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
555 |
TX_EXIT |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
556 |
} |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
557 |
|
35 | 558 |
void MpDetailsView::handleInspireMeGroupBoxToggled(bool /*state*/) |
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
559 |
{ |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
560 |
TX_ENTRY |
35 | 561 |
if ( !mInspireMeGroupBox->isCollapsed() ) { |
562 |
TX_LOG_ARGS( "InspireMe is expanded." ) |
|
36 | 563 |
mSongDetailsGroupBox->setCollapsed( true ); |
35 | 564 |
if ( mInspireMeQueryOngoing ) { |
565 |
TX_LOG_ARGS( "Query is ongoing " ) |
|
566 |
mInspireMeProgressBar->show(); |
|
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
567 |
} else { |
35 | 568 |
TX_LOG_ARGS( "Query is NOT ongoing " ) |
569 |
if ( mInspireMeQueryRendered ) { |
|
570 |
TX_LOG_ARGS( "InspireMe is rendered already. " ) |
|
571 |
mInspireMeProgressBar->hide(); |
|
572 |
} else { |
|
573 |
if ( canQueryRecommendations() ) { |
|
574 |
TX_LOG_ARGS( "InspireMe is NOT rendered yet but can query for recommendations. " ) |
|
575 |
mMpQueryManager->queryInspireMeItems(mSongData->artist(),mSongData->album(),mSongData->title()); |
|
576 |
mInspireMeProgressBar->show(); |
|
577 |
mInspireMeQueryOngoing = true; |
|
578 |
} else { |
|
579 |
TX_LOG_ARGS( "InspireMe is NOT rendered yet and CANNOT query for recommendations either. " ) |
|
580 |
RenderInspireMeGroupBox(); |
|
581 |
} |
|
36 | 582 |
} |
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
583 |
} |
35 | 584 |
} else { |
585 |
TX_LOG_ARGS( "InspireMe is collapsed." ) |
|
586 |
mInspireMeProgressBar->hide(); |
|
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
587 |
} |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
588 |
TX_EXIT |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
589 |
} |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
590 |
|
35 | 591 |
#ifdef SHARE_FUNC_ENABLED |
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
592 |
/*! |
35 | 593 |
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
|
594 |
*/ |
35 | 595 |
void MpDetailsView::share() |
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
596 |
{ |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
597 |
TX_ENTRY |
35 | 598 |
createShareDialog(); |
599 |
if (canQuerySharePlayerLink() ) |
|
600 |
{ |
|
601 |
mMpQueryManager->queryLocalMusicStore(mSongData->artist(),mSongData->album(),mSongData->title() ); |
|
602 |
} |
|
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
603 |
TX_EXIT |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
604 |
} |
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 |
/*! |
35 | 607 |
Method to create the share dialog on demand. |
36 | 608 |
This will cause the share web view to be created and start loading. |
35 | 609 |
*/ |
610 |
void MpDetailsView::createShareDialog() |
|
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
611 |
{ |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
612 |
TX_ENTRY |
35 | 613 |
if ( !mSharePopup ) |
614 |
{ |
|
615 |
mSharePopup = new MpDetailsShareDialog(); |
|
36 | 616 |
} |
617 |
if ( !mSharePopup->isInitialized() ) |
|
618 |
{ |
|
619 |
connect( mSharePopup, SIGNAL( closeShareDialog() ), this, SLOT( closeShareDialog() ) ); |
|
620 |
mSharePopup->initialize( mSongData, tr( "Unknown" ) ); |
|
35 | 621 |
} |
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
622 |
TX_EXIT |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
623 |
} |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
624 |
|
35 | 625 |
/*! |
36 | 626 |
Method to create the share dialog on demand and preload publishing player files. |
627 |
This will construct the share dialog but it will still be in "uninitialized" state. |
|
628 |
*/ |
|
629 |
void MpDetailsView::preloadShareDialog() |
|
630 |
{ |
|
631 |
TX_ENTRY |
|
632 |
if ( !mSharePopup ) |
|
633 |
{ |
|
634 |
mSharePopup = new MpDetailsShareDialog(); |
|
635 |
} |
|
636 |
mSharePopup->cachePublishingPlayerFiles(); |
|
637 |
TX_EXIT |
|
638 |
} |
|
639 |
||
640 |
/*! |
|
35 | 641 |
Slot to be called when ok/close button in share dialog is pressed. |
642 |
*/ |
|
643 |
void MpDetailsView::closeShareDialog() |
|
644 |
{ |
|
645 |
TX_ENTRY |
|
646 |
if ( mSharePopup ) |
|
647 |
{ |
|
36 | 648 |
// Dialog uses WA_DeleteOnClose so no need to delete it explicitely here, just close it. |
35 | 649 |
mSharePopup->close(); |
650 |
mSharePopup = NULL; |
|
651 |
} |
|
652 |
TX_EXIT |
|
653 |
} |
|
654 |
#endif |
|
655 |
||
656 |
/*! |
|
657 |
Slot to handle the music store URL retrieval from the query manager. |
|
658 |
*/ |
|
659 |
void MpDetailsView::updateSharedData(const QString& url) |
|
660 |
{ |
|
661 |
TX_ENTRY |
|
662 |
mSongData->setLink( url ); |
|
663 |
#ifdef SHARE_FUNC_ENABLED |
|
664 |
if ( mSharePopup ) |
|
665 |
{ |
|
666 |
mSharePopup->updateSharedData(); |
|
667 |
} |
|
668 |
#endif |
|
669 |
TX_EXIT |
|
670 |
} |