author | hgs |
Fri, 06 Aug 2010 16:51:36 -0500 | |
changeset 47 | 4cc1412daed0 |
parent 45 | 612c4815aebe |
child 51 | 560ce2306a17 |
permissions | -rw-r--r-- |
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1 |
/* |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
3 |
* All rights reserved. |
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> |
47 | 26 |
#include <QDesktopServices> |
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 |
|
45 | 53 |
const int KOneKiloByteInBytes = 1024; |
54 |
const int KOneMegabyteInBytes = 1048576; |
|
55 |
const int KOneGigaByteInBytes = 134217728; |
|
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
56 |
|
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
57 |
/*! |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
58 |
Constructor |
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 |
MpDetailsView::MpDetailsView() |
35 | 61 |
: mMpEngine( 0 ), |
62 |
mSongData( 0 ), |
|
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
63 |
mActivated( false ), |
35 | 64 |
mSoftKeyBack( 0 ), |
36 | 65 |
mSongText( 0 ), |
66 |
mAlbumText( 0 ), |
|
67 |
mArtistText( 0 ), |
|
68 |
mAlbumArt( 0 ), |
|
69 |
mSongDetailsGroupBox(0), |
|
70 |
mInspireMeGroupBox(0), |
|
71 |
mDocumentLoader( 0 ), |
|
72 |
mDetailList(0), |
|
73 |
mInspireList(0), |
|
74 |
mInspireMeProgressBar(0), |
|
35 | 75 |
mMpQueryManager( 0 ), |
76 |
mInspireMeQueryOngoing( false ), |
|
47 | 77 |
mInspireMeQueryRendered( false ) |
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
78 |
{ |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
79 |
TX_ENTRY |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
80 |
bool widgetsOk = false; |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
81 |
HbMainWindow *mainWindow = hbInstance->allMainWindows()[0]; |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
82 |
mDocumentLoader = new HbDocumentLoader(); |
36 | 83 |
|
35 | 84 |
TX_LOG_ARGS("Document loader created") |
85 |
if(!mDocumentLoader) { |
|
86 |
TX_LOG_ARGS( "MpDetailsView() Error: HbDocumentLoader not constructed" ); |
|
36 | 87 |
return; |
35 | 88 |
} |
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
89 |
|
35 | 90 |
TX_LOG_ARGS("Loading :/mpdetailsviewdocml/mpdetailsview.docml") |
91 |
mDocumentLoader->load( QString(":/mpdetailsviewdocml/mpdetailsview.docml"), &widgetsOk ); |
|
92 |
if(!widgetsOk) { |
|
93 |
TX_LOG_ARGS( "MpDetailsView() Error: invalid mpdetailsview.docml" ); |
|
36 | 94 |
return; |
35 | 95 |
} |
36 | 96 |
|
35 | 97 |
TX_LOG_ARGS("Loaded :/mpdetailsviewdocml/mpdetailsview.docml") |
36 | 98 |
QGraphicsWidget *widget = 0; |
99 |
||
35 | 100 |
widget = mDocumentLoader->findWidget( QString("content") ); |
101 |
TX_LOG_ARGS( "MpDetailsView() mDocumentLoader->findWidget for <content>: " << (int)(widget) ); |
|
36 | 102 |
setWidget( qobject_cast<HbWidget *>(widget) ); |
35 | 103 |
|
104 |
widget = mDocumentLoader->findWidget( QString("trackTitle") ); |
|
105 |
mSongText = qobject_cast<HbLabel *>(widget); |
|
106 |
TX_LOG_ARGS("MpDetailsView() <trackTitle> widget found mSongText: " << (int)(mSongText) ); |
|
36 | 107 |
|
35 | 108 |
widget = mDocumentLoader->findWidget( QString("artist") ); |
109 |
mArtistText = qobject_cast<HbLabel *>(widget); |
|
110 |
TX_LOG_ARGS("MpDetailsView() <artist> widget found mArtistText: " << (int)(mArtistText) ); |
|
36 | 111 |
|
35 | 112 |
widget = mDocumentLoader->findWidget( QString("albumName") ); |
113 |
mAlbumText = qobject_cast<HbLabel *>(widget); |
|
114 |
TX_LOG_ARGS("MpDetailsView() <albumName> widget found mAlbumText: " << (int)(mAlbumText) ); |
|
115 |
||
116 |
widget = mDocumentLoader->findWidget( QString("albumArt") ); |
|
117 |
mAlbumArt = qobject_cast<HbLabel *>(widget); |
|
118 |
TX_LOG_ARGS("MpDetailsView() <albumArt> widget found mAlbumArt: " << (int)(mAlbumArt) ); |
|
36 | 119 |
|
35 | 120 |
widget = mDocumentLoader->findWidget( QString("songDetails") ); |
121 |
mSongDetailsGroupBox = qobject_cast<HbGroupBox *>(widget); |
|
122 |
TX_LOG_ARGS("MpDetailsView() <songDetails> widget found mSongDetailsGroupBox: " << (int)(mSongDetailsGroupBox) ); |
|
36 | 123 |
|
35 | 124 |
widget = mDocumentLoader->findWidget( QString("songDetailsListWidget") ); |
125 |
mDetailList = qobject_cast<HbListWidget *>(widget); |
|
126 |
TX_LOG_ARGS("MpDetailsView() <songDetailsListWidget> widget found mDetailList: " << (int)(mDetailList) ); |
|
36 | 127 |
|
35 | 128 |
widget = mDocumentLoader->findWidget( QString("inspireMeGroupBox") ); |
129 |
mInspireMeGroupBox = qobject_cast<HbGroupBox *>(widget); |
|
130 |
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
|
131 |
|
35 | 132 |
widget = mDocumentLoader->findWidget( QString("inspireListWidget") ); |
133 |
mInspireList = qobject_cast<HbListWidget *>(widget); |
|
134 |
TX_LOG_ARGS("MpDetailsView() <inspireListWidget> widget found mInspireList: " << (int)(mInspireList) ); |
|
36 | 135 |
|
35 | 136 |
widget = mDocumentLoader->findWidget( QString("inspireMeProgressBar") ); |
137 |
mInspireMeProgressBar = qobject_cast<HbProgressBar *>(widget); |
|
138 |
TX_LOG_ARGS("MpDetailsView() <inspireMeProgressBar> widget found mInspireMeProgressBar: " << (int)(mInspireMeProgressBar) ); |
|
36 | 139 |
|
140 |
// load section HideInspireMe if no ovi store suport |
|
141 |
bool loadingSectionOk = false; |
|
142 |
mDocumentLoader->load( QString(":/mpdetailsviewdocml/mpdetailsview.docml"), QString( "ShowInspireMe" ), &loadingSectionOk ); |
|
143 |
if( loadingSectionOk ) { |
|
144 |
TX_LOG_ARGS( "Loading ShowInspireMe section is successful." ); |
|
47 | 145 |
} |
146 |
else { |
|
36 | 147 |
TX_LOG_ARGS( "Loading ShowInspireMe section fails." ); |
148 |
} |
|
149 |
||
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
150 |
TX_EXIT |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
151 |
} |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
152 |
|
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
153 |
/*! |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
154 |
Destructs the details view. |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
155 |
*/ |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
156 |
MpDetailsView::~MpDetailsView() |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
157 |
{ |
36 | 158 |
TX_ENTRY |
47 | 159 |
saveGroupBoxStates(); |
36 | 160 |
delete mSoftKeyBack; |
161 |
delete mDocumentLoader; |
|
35 | 162 |
delete mMpQueryManager; |
163 |
||
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
164 |
TX_EXIT |
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 |
|
35 | 167 |
|
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
168 |
/*! |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
169 |
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
|
170 |
*/ |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
171 |
void MpDetailsView::initializeView() |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
172 |
{ |
36 | 173 |
TX_ENTRY |
174 |
||
175 |
mSoftKeyBack = new HbAction( Hb::BackNaviAction, this ); |
|
176 |
||
35 | 177 |
mMpEngine = MpEngineFactory::sharedEngine(); |
178 |
mSongData = mMpEngine->songData(); |
|
36 | 179 |
|
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
180 |
// TODO: might need later |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
181 |
setupMenu(); |
36 | 182 |
mMpQueryManager = new MpQueryManager(); |
183 |
||
35 | 184 |
connect( mSoftKeyBack, SIGNAL( triggered() ), this, SLOT( back() ) ); |
36 | 185 |
connect( mSongData, SIGNAL( albumArtReady() ), this, SLOT( albumArtChanged() ) ); |
35 | 186 |
connect( mSongData, SIGNAL( playbackInfoChanged() ), this, SLOT( handlePlaybackInfoChanged() ) ); |
36 | 187 |
connect( mSongData, SIGNAL( songDetailInfoChanged() ), this, SLOT( songDetailInfoChanged() ) ); |
47 | 188 |
connect( mDetailList, SIGNAL( pressed( HbListWidgetItem * ) ), this, SLOT( handleListItemSelected( HbListWidgetItem * ) ) ); |
36 | 189 |
connect( mSongDetailsGroupBox, SIGNAL( toggled( bool ) ), this, SLOT( handleDetailsGroupBoxToggled( bool ) ) ); |
190 |
connect( mInspireMeGroupBox, SIGNAL( toggled( bool ) ), this, SLOT( handleInspireMeGroupBoxToggled( bool ) ) ); |
|
47 | 191 |
connect( mMpQueryManager, SIGNAL(inspireMeItemsMetadataRetrieved()), this, SLOT(renderInspireMeMetadata())); |
192 |
connect( mMpQueryManager, SIGNAL(inspireMeItemAlbumArtReady()), this, SLOT(renderInspireMeAlbumArts())); |
|
193 |
connect( mMpQueryManager, SIGNAL(localMusicStoreRetrieved(bool)), this, SLOT(queryInspireMe(bool)), Qt::QueuedConnection); |
|
194 |
connect( mMpQueryManager, SIGNAL(localMusicStoreRetrievalError()), this, SLOT(abortInspireMeProcess())); |
|
195 |
connect( mMpQueryManager, SIGNAL(inspireMeItemsRetrievalError()), this, SLOT(queryLocalMusicStore()), Qt::QueuedConnection); |
|
35 | 196 |
|
47 | 197 |
TX_EXIT |
198 |
} |
|
36 | 199 |
|
47 | 200 |
void MpDetailsView::queryLocalMusicStore() |
201 |
{ |
|
202 |
TX_ENTRY |
|
203 |
mMpQueryManager->reset(); |
|
204 |
mMpQueryManager->queryLocalMusicStore(); |
|
205 |
TX_EXIT |
|
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
206 |
} |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
207 |
|
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
208 |
/*! |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
209 |
Activates the details view. |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
210 |
*/ |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
211 |
void MpDetailsView::activateView() |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
212 |
{ |
36 | 213 |
TX_ENTRY |
35 | 214 |
setNavigationAction( mSoftKeyBack ); |
36 | 215 |
|
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
216 |
mActivated = true; |
47 | 217 |
TX_LOG_ARGS( "InspireMeVal: " << MpSettingsManager::inspireMe() ); |
218 |
TX_LOG_ARGS( "SongDetailsGbVal: " << MpSettingsManager::songDetailsGb() ); |
|
219 |
mInspireMeGroupBox->setCollapsed(!MpSettingsManager::inspireMe()); |
|
220 |
mSongDetailsGroupBox->setCollapsed(!MpSettingsManager::songDetailsGb()); |
|
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
221 |
TX_EXIT |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
222 |
} |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
223 |
|
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
224 |
/*! |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
225 |
Deactivates the details view. |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
226 |
*/ |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
227 |
void MpDetailsView::deactivateView() |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
228 |
{ |
36 | 229 |
TX_ENTRY |
47 | 230 |
saveGroupBoxStates(); |
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
231 |
setNavigationAction( 0 ); |
36 | 232 |
mActivated = false; |
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 |
|
47 | 236 |
void MpDetailsView::saveGroupBoxStates() |
237 |
{ |
|
238 |
TX_ENTRY |
|
239 |
if (mInspireMeGroupBox->isCollapsed() ) { |
|
240 |
MpSettingsManager::setInspireMe(false); |
|
241 |
} |
|
242 |
else { |
|
243 |
MpSettingsManager::setInspireMe(true); |
|
244 |
} |
|
245 |
||
246 |
if (mSongDetailsGroupBox->isCollapsed() ) { |
|
247 |
MpSettingsManager::setSongDetailsGb(false); |
|
248 |
} |
|
249 |
else { |
|
250 |
MpSettingsManager::setSongDetailsGb(true); |
|
251 |
} |
|
252 |
TX_EXIT |
|
253 |
} |
|
254 |
||
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
255 |
/*! |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
256 |
Setup the menu. |
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 |
void MpDetailsView::setupMenu() |
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 |
TX_ENTRY |
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 |
TX_EXIT |
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 |
|
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 |
Slot to handle back command from softkey. |
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 |
void MpDetailsView::back() |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
269 |
{ |
36 | 270 |
TX_ENTRY |
43 | 271 |
emit command( MpCommon::ActivatePreviousView ); |
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
272 |
TX_EXIT |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
273 |
} |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
274 |
|
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
275 |
/*! |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
276 |
Slot to handle Album art changed. |
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 |
void MpDetailsView::albumArtChanged( ) |
36 | 279 |
{ |
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
280 |
TX_ENTRY |
35 | 281 |
HbIcon icon; |
282 |
mSongData->albumArt( icon ); |
|
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
283 |
mAlbumArt->setIcon( icon ); |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
284 |
TX_EXIT |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
285 |
} |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
286 |
|
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
287 |
/*! |
35 | 288 |
Slot to handle network error. |
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
289 |
*/ |
47 | 290 |
void MpDetailsView::abortInspireMeProcess() |
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
291 |
{ |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
292 |
TX_ENTRY |
47 | 293 |
mInspireMeProgressBar->hide(); |
294 |
mInspireMeGroupBox->setCollapsed( true ); |
|
35 | 295 |
mInspireMeQueryOngoing = false; |
296 |
mInspireMeQueryRendered = false; |
|
47 | 297 |
// ensure that we dont get callbacks from previous queries. Especially true, |
298 |
// if details view is actived with a quick song change again |
|
299 |
mMpQueryManager->reset(); |
|
300 |
mInspireList->clear(); |
|
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 |
*/ |
47 | 307 |
void MpDetailsView::renderInspireMeMetadata() |
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(); |
|
47 | 313 |
if( mMpQueryManager->recommendationsCount() ) { |
35 | 314 |
TX_LOG_ARGS( "There are recommendations." ) |
315 |
// we have recommendations |
|
47 | 316 |
for ( int i = 0; i < mMpQueryManager->recommendationsCount(); ++i ) { |
35 | 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(); |
|
47 | 325 |
inspireMeItem->setIcon( mMpQueryManager->recommendedAlbumArt( i )); |
326 |
inspireMeItem->setText( mMpQueryManager->recommendedSong( i ) ); |
|
327 |
inspireMeItem->setSecondaryText( mMpQueryManager->recommendedArtist( i ) ); |
|
35 | 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 { |
47 | 332 |
TX_LOG_ARGS( "There are NO recommendations" ) |
35 | 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(); |
45 | 341 |
inspireMeItem->setSecondaryText( hbTrId( "txt_mus_dblist_val_there_are_no_recommendations" ) ); |
35 | 342 |
mInspireList->addItem( inspireMeItem ); |
343 |
} |
|
36 | 344 |
|
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
345 |
TX_EXIT |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
346 |
} |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
347 |
|
47 | 348 |
void MpDetailsView::renderInspireMeAlbumArts() |
349 |
{ |
|
350 |
TX_ENTRY |
|
351 |
for( int i = 0; i < mInspireList->count(); ++i) { |
|
352 |
mInspireList->item(i)->setIcon( mMpQueryManager->recommendedAlbumArt( i ) ); |
|
353 |
} |
|
354 |
TX_EXIT |
|
355 |
} |
|
356 |
||
357 |
bool MpDetailsView::isMetadata() const |
|
35 | 358 |
{ |
359 |
bool result = ( ( !mSongData->album().isEmpty() ) || |
|
47 | 360 |
( !mSongData->artist().isEmpty() ) ); |
361 |
TX_LOG_ARGS( "Inspire Me Query metadata available:" << result ); |
|
35 | 362 |
return result; |
363 |
} |
|
364 |
||
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
365 |
/*! |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
366 |
Slot to handle basic song information |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
367 |
*/ |
35 | 368 |
void MpDetailsView::handlePlaybackInfoChanged() |
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
369 |
{ |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
370 |
TX_ENTRY |
47 | 371 |
// ensure that we dont get callbacks from previous queries. Especially true, |
372 |
// if details view is actived with a quick song change again |
|
373 |
mMpQueryManager->reset(); |
|
374 |
mInspireList->clear(); |
|
35 | 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() ); |
|
47 | 382 |
} |
383 |
else { |
|
35 | 384 |
mSongText->setPlainText( mSongData->fileName() ); |
385 |
} |
|
36 | 386 |
|
35 | 387 |
if ( !mSongData->album().isEmpty () ) { |
388 |
mAlbumText->setPlainText( mSongData->album() ); |
|
47 | 389 |
} |
390 |
else { |
|
45 | 391 |
mAlbumText->setPlainText( hbTrId( "txt_mus_other_unknown7") ); |
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
392 |
} |
36 | 393 |
|
35 | 394 |
if ( !mSongData->artist().isEmpty() ) { |
395 |
mArtistText->setPlainText( mSongData->artist() ); |
|
47 | 396 |
} |
397 |
else { |
|
45 | 398 |
mArtistText->setPlainText( hbTrId( "txt_mus_other_unknown6") ); |
35 | 399 |
} |
36 | 400 |
|
47 | 401 |
if(!mInspireMeGroupBox->isCollapsed()) { |
402 |
startInspireMe(); |
|
35 | 403 |
} |
36 | 404 |
TX_EXIT |
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
405 |
} |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
406 |
|
47 | 407 |
void MpDetailsView::startInspireMe() |
35 | 408 |
{ |
47 | 409 |
TX_ENTRY |
410 |
if(isMetadata()) { |
|
411 |
// show progress bar, start store query or inspire me query process |
|
412 |
mInspireMeProgressBar->show(); |
|
413 |
mInspireMeQueryOngoing = true; |
|
414 |
if( mMpQueryManager->isLocalMusicStore() ) { |
|
415 |
mMpQueryManager->queryInspireMeItems(mSongData->artist(),mSongData->album(),mSongData->title()); |
|
416 |
} |
|
417 |
else { |
|
418 |
// no local store information present |
|
419 |
mMpQueryManager->queryLocalMusicStore(); |
|
420 |
} |
|
421 |
} |
|
422 |
else { |
|
423 |
// no metadata. show no recommendations |
|
424 |
renderInspireMeMetadata(); |
|
425 |
} |
|
426 |
TX_EXIT |
|
35 | 427 |
} |
47 | 428 |
|
20
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 |
Slot to handle detail song information |
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 |
void MpDetailsView::songDetailInfoChanged() |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
433 |
{ |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
434 |
TX_ENTRY |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
435 |
mDetailList->clear(); |
36 | 436 |
|
35 | 437 |
if ( !mSongData->albumTrack().isNull() ) { |
36 | 438 |
HbListWidgetItem *item = new HbListWidgetItem(); |
45 | 439 |
item->setText( hbTrId( "txt_mus_dblist_song_number" ) ); |
35 | 440 |
item->setSecondaryText( mSongData->albumTrack() ); |
441 |
item->setEnabled( false ); |
|
442 |
mDetailList->addItem( item ); |
|
443 |
} |
|
36 | 444 |
|
35 | 445 |
if ( !mSongData->year().isNull() ) { |
446 |
HbListWidgetItem *item = new HbListWidgetItem(); |
|
45 | 447 |
item->setText( hbTrId( "txt_mus_dblist_year" ) ); |
35 | 448 |
item->setSecondaryText( mSongData->year() ); |
449 |
item->setEnabled( false ); |
|
450 |
mDetailList->addItem( item ); |
|
451 |
} |
|
36 | 452 |
|
35 | 453 |
if ( !mSongData->genre().isNull() ) { |
454 |
HbListWidgetItem *item = new HbListWidgetItem(); |
|
45 | 455 |
item->setText( hbTrId( "txt_mus_dblist_genre" ) ); |
35 | 456 |
item->setSecondaryText( mSongData->genre() ); |
457 |
item->setEnabled( false ); |
|
458 |
mDetailList->addItem( item ); |
|
459 |
} |
|
36 | 460 |
|
35 | 461 |
if ( !mSongData->composer().isNull() ) { |
462 |
HbListWidgetItem *item = new HbListWidgetItem(); |
|
45 | 463 |
item->setText( hbTrId( "txt_mus_dblist_composer" ) ); |
35 | 464 |
item->setSecondaryText( mSongData->composer() ); |
465 |
item->setEnabled( false ); |
|
466 |
mDetailList->addItem( item ); |
|
467 |
} |
|
468 |
||
469 |
if ( !mSongData->fileName().isNull() ) { |
|
470 |
HbListWidgetItem *item = new HbListWidgetItem(); |
|
45 | 471 |
item->setText( hbTrId( "txt_mus_dblist_file_name" ) ); |
35 | 472 |
item->setSecondaryText( mSongData->fileName() ); |
473 |
item->setEnabled( false ); |
|
474 |
mDetailList->addItem( item ); |
|
475 |
} |
|
36 | 476 |
|
35 | 477 |
if ( !mSongData->mimeType().isNull() ) { |
478 |
HbListWidgetItem *item = new HbListWidgetItem(); |
|
45 | 479 |
item->setText( hbTrId( "txt_mus_dblist_format" ) ); |
35 | 480 |
item->setSecondaryText( mSongData->mimeType() ); |
481 |
item->setEnabled( false ); |
|
482 |
mDetailList->addItem( item ); |
|
483 |
} |
|
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
484 |
|
35 | 485 |
if ( !mSongData->duration().isNull() ) { |
486 |
HbListWidgetItem *item = new HbListWidgetItem(); |
|
45 | 487 |
item->setText( hbTrId( "txt_mus_dblist_duration" ) ); |
35 | 488 |
item->setSecondaryText( mSongData->duration() ); |
489 |
item->setEnabled( false ); |
|
490 |
mDetailList->addItem( item ); |
|
491 |
} |
|
36 | 492 |
|
35 | 493 |
if ( !mSongData->bitRate().isNull() ) { |
494 |
HbListWidgetItem *item = new HbListWidgetItem(); |
|
45 | 495 |
item->setText( hbTrId( "txt_mus_dblist_bitrate" ) ); |
496 |
bool ok = false; |
|
497 |
int bitRate = mSongData->bitRate().toInt(&ok); |
|
498 |
TX_LOG_ARGS("Warning: If zero, bitrate is not read correctly. It wont show up in details" << ok); |
|
499 |
if(ok) { |
|
500 |
item->setSecondaryText( hbTrId("txt_mus_dblist_bitrate_val_ln_kbps", bitRate) ); |
|
47 | 501 |
} |
35 | 502 |
item->setEnabled( false ); |
503 |
mDetailList->addItem( item ); |
|
504 |
} |
|
36 | 505 |
|
35 | 506 |
if ( !mSongData->sampleRate().isNull() ) { |
507 |
HbListWidgetItem *item = new HbListWidgetItem(); |
|
45 | 508 |
item->setText( hbTrId( "txt_mus_dblist_sampling_rate" ) ); |
509 |
bool ok = false; |
|
510 |
int samplingRate = mSongData->sampleRate().toInt(&ok); |
|
511 |
TX_LOG_ARGS("Warning: If zero, sampling rate is not read correctly. It wont show up in details" << ok); |
|
512 |
if(ok) { |
|
513 |
item->setSecondaryText( hbTrId("txt_mus_dblist_sampling_rate_val_ln_hz", samplingRate) ); |
|
47 | 514 |
} |
35 | 515 |
item->setEnabled( false ); |
516 |
mDetailList->addItem( item ); |
|
517 |
} |
|
36 | 518 |
|
35 | 519 |
if ( !mSongData->size().isNull() ) { |
520 |
HbListWidgetItem *item = new HbListWidgetItem(); |
|
45 | 521 |
item->setText( hbTrId( "txt_mus_dblist_size" ) ); |
522 |
bool ok = false; |
|
523 |
long size = mSongData->size().toLong(&ok); // in bytes |
|
524 |
TX_LOG_ARGS("WARNING: If zero, Cant get song data size right. You wont see the size in details groupbox correctly" << ok ); |
|
525 |
if( size < KOneKiloByteInBytes) { |
|
526 |
// under 1 KB |
|
527 |
item->setSecondaryText( hbTrId("txt_mus_dblist_size_val_ln_b", size) ); |
|
47 | 528 |
} |
529 |
else if( size < KOneMegabyteInBytes ) { |
|
45 | 530 |
// under 1 MB |
531 |
size /= KOneKiloByteInBytes; // turn size into KB |
|
532 |
item->setSecondaryText( hbTrId("txt_mus_dblist_size_val_ln_kb", size) ); |
|
47 | 533 |
} |
534 |
else if( size < KOneGigaByteInBytes ) { |
|
45 | 535 |
// under 1 GB |
536 |
size /= KOneMegabyteInBytes; // turn size to MB |
|
537 |
item->setSecondaryText( hbTrId("txt_mus_dblist_size_val_ln_mb", size) ); |
|
47 | 538 |
} |
539 |
else { |
|
45 | 540 |
// 1 GB or higher |
541 |
size /= KOneGigaByteInBytes; // turn size to GB |
|
542 |
item->setSecondaryText( hbTrId("txt_mus_dblist_size_val_ln_gb", size) ); |
|
543 |
} |
|
35 | 544 |
item->setEnabled( false ); |
545 |
mDetailList->addItem( item ); |
|
546 |
} |
|
36 | 547 |
|
35 | 548 |
if ( !mSongData->modified().isNull() ) { |
549 |
HbListWidgetItem *item = new HbListWidgetItem(); |
|
45 | 550 |
item->setText( hbTrId( "txt_mus_dblist_modified" ) ); |
35 | 551 |
item->setSecondaryText( mSongData->modified() ); |
552 |
item->setEnabled( false ); |
|
553 |
mDetailList->addItem( item ); |
|
554 |
} |
|
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
555 |
|
35 | 556 |
if ( !mSongData->copyright().isNull() ) { |
557 |
HbListWidgetItem *item = new HbListWidgetItem(); |
|
45 | 558 |
item->setText( hbTrId( "txt_mus_dblist_copyright" ) ); |
35 | 559 |
item->setSecondaryText( mSongData->copyright() ); |
560 |
item->setEnabled( false ); |
|
561 |
mDetailList->addItem( item ); |
|
562 |
} |
|
36 | 563 |
|
35 | 564 |
if ( !mSongData->musicURL().isNull() ) { |
565 |
HbListWidgetItem *item = new HbListWidgetItem(); |
|
45 | 566 |
item->setText( hbTrId( "txt_mus_dblist_web_site" ) ); |
35 | 567 |
item->setSecondaryText( mSongData->musicURL() ); |
568 |
item->setEnabled( true ); |
|
569 |
mDetailList->addItem( item ); |
|
570 |
} |
|
36 | 571 |
|
35 | 572 |
if ( mSongData->isDrmProtected() ) { |
573 |
HbListWidgetItem *item = new HbListWidgetItem(); |
|
45 | 574 |
item->setText( hbTrId( "txt_mus_dblist_licences" ) ); |
575 |
item->setSecondaryText( hbTrId( "txt_mus_dblist_licences_val_click_for_details" ) ); |
|
35 | 576 |
item->setEnabled( true ); |
577 |
mDetailList->addItem( item ); |
|
578 |
} |
|
579 |
||
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
580 |
TX_EXIT |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
581 |
} |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
582 |
|
36 | 583 |
void MpDetailsView::handleDetailsGroupBoxToggled(bool /*state*/) |
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
584 |
{ |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
585 |
TX_ENTRY |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
586 |
if ( !mSongDetailsGroupBox->isCollapsed() ) { |
35 | 587 |
mInspireMeGroupBox->setCollapsed( true ); |
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 |
void MpDetailsView::handleInspireMeGroupBoxToggled(bool /*state*/) |
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
593 |
{ |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
594 |
TX_ENTRY |
35 | 595 |
if ( !mInspireMeGroupBox->isCollapsed() ) { |
596 |
TX_LOG_ARGS( "InspireMe is expanded." ) |
|
36 | 597 |
mSongDetailsGroupBox->setCollapsed( true ); |
35 | 598 |
if ( mInspireMeQueryOngoing ) { |
599 |
TX_LOG_ARGS( "Query is ongoing " ) |
|
600 |
mInspireMeProgressBar->show(); |
|
47 | 601 |
} |
602 |
else { |
|
35 | 603 |
TX_LOG_ARGS( "Query is NOT ongoing " ) |
604 |
if ( mInspireMeQueryRendered ) { |
|
605 |
TX_LOG_ARGS( "InspireMe is rendered already. " ) |
|
606 |
mInspireMeProgressBar->hide(); |
|
47 | 607 |
} |
608 |
else { |
|
609 |
startInspireMe(); |
|
36 | 610 |
} |
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
611 |
} |
47 | 612 |
} |
613 |
else { |
|
35 | 614 |
TX_LOG_ARGS( "InspireMe is collapsed." ) |
615 |
mInspireMeProgressBar->hide(); |
|
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
616 |
} |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
617 |
TX_EXIT |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
618 |
} |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
619 |
|
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
620 |
/*! |
47 | 621 |
Slot to call when URL item in song details is pressed |
622 |
*/ |
|
623 |
void MpDetailsView::handleListItemSelected( HbListWidgetItem *item) |
|
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
624 |
{ |
47 | 625 |
TX_ENTRY_ARGS( "URL: " << item->secondaryText() ); |
626 |
QDesktopServices::openUrl( item->secondaryText() ); |
|
20
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
627 |
TX_EXIT |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
628 |
} |
82baf59ce8dd
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
629 |
|
35 | 630 |
/*! |
47 | 631 |
Slot to call when MusicStore Info is Received |
632 |
*/ |
|
633 |
void MpDetailsView::queryInspireMe(bool storeUpdated) |
|
36 | 634 |
{ |
635 |
TX_ENTRY |
|
47 | 636 |
// we asked query manager to update its local store information |
637 |
// if that store info didnt change (i.e. from empty string to "fi" or |
|
638 |
// from "bad old store" to "good new store") then we dont need to pursue a query |
|
639 |
if( storeUpdated ) { |
|
640 |
mMpQueryManager->queryInspireMeItems(mSongData->artist(),mSongData->album(),mSongData->title()); |
|
641 |
mInspireMeQueryOngoing = true; |
|
36 | 642 |
} |
47 | 643 |
else { |
644 |
mInspireMeQueryOngoing = false; |
|
645 |
mInspireMeProgressBar->hide(); |
|
646 |
} |
|
36 | 647 |
TX_EXIT |
648 |
} |
|
649 |