35
|
1 |
/*
|
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description: Music Player Query Manager.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#include "mpquerymanager.h"
|
|
19 |
#include <QObject>
|
|
20 |
#include <QList>
|
|
21 |
#include <QFile>
|
|
22 |
#include <QUrl>
|
|
23 |
|
|
24 |
#include "mptrace.h"
|
|
25 |
|
|
26 |
const int KRecommendationNum = 2;
|
|
27 |
|
|
28 |
MpQueryManager::MpQueryManager(QObject *parent)
|
|
29 |
:QObject(parent)
|
|
30 |
{
|
|
31 |
TX_ENTRY_ARGS("STUB")
|
|
32 |
mRecommendationAlbumArtsName << "C:\\Data\\albumOne.png" << "C:\\Data\\albumTwo.png";
|
|
33 |
TX_EXIT_ARGS("STUB")
|
|
34 |
}
|
|
35 |
|
|
36 |
MpQueryManager::~MpQueryManager()
|
|
37 |
{
|
|
38 |
TX_ENTRY_ARGS("STUB")
|
|
39 |
TX_EXIT_ARGS("STUB")
|
|
40 |
}
|
|
41 |
|
|
42 |
|
|
43 |
void MpQueryManager::clearNetworkReplies()
|
|
44 |
{
|
|
45 |
TX_ENTRY_ARGS("STUB Reply count = ");
|
|
46 |
TX_EXIT_ARGS("STUB")
|
|
47 |
}
|
|
48 |
|
|
49 |
|
|
50 |
void MpQueryManager::queryLocalMusicStore(QString artist,QString album,QString title)
|
|
51 |
{
|
|
52 |
TX_ENTRY_ARGS("STUB")
|
|
53 |
mArtist=artist;
|
|
54 |
mAlbum=album;
|
|
55 |
mTitle=title;
|
|
56 |
TX_EXIT_ARGS("STUB")
|
|
57 |
}
|
47
|
58 |
|
|
59 |
void MpQueryManager::queryLocalMusicStore()
|
|
60 |
{
|
|
61 |
TX_ENTRY_ARGS("STUB")
|
|
62 |
TX_EXIT_ARGS("STUB")
|
|
63 |
}
|
|
64 |
|
|
65 |
void MpQueryManager::reset()
|
|
66 |
{
|
|
67 |
TX_ENTRY_ARGS("STUB")
|
|
68 |
TX_EXIT_ARGS("STUB")
|
|
69 |
}
|
|
70 |
|
|
71 |
bool MpQueryManager::isLocalMusicStore() const
|
|
72 |
{
|
|
73 |
TX_ENTRY_ARGS("STUB - will always return TRUE")
|
|
74 |
TX_EXIT_ARGS("STUB")
|
|
75 |
return true;
|
|
76 |
}
|
|
77 |
|
35
|
78 |
|
|
79 |
void MpQueryManager::queryInspireMeItems(QString artist,QString album,QString title)
|
|
80 |
{
|
|
81 |
TX_ENTRY_ARGS("STUB")
|
|
82 |
mArtist=artist;
|
|
83 |
mAlbum=album;
|
|
84 |
mTitle=title;
|
|
85 |
TX_EXIT_ARGS("STUB")
|
|
86 |
}
|
|
87 |
|
|
88 |
void MpQueryManager::clearRecommendations()
|
|
89 |
{
|
|
90 |
TX_ENTRY_ARGS("STUB")
|
|
91 |
mDownloadedAlbumArts = 0;
|
|
92 |
mAlbumArtsReadyCount = 0;
|
|
93 |
for ( int i = 0; i < KRecommendationNum; i++ ) {
|
|
94 |
mRecommendationSongs.clear();
|
|
95 |
mRecommendationArtists.clear();
|
|
96 |
mRecommendationAlbumArtsLink.clear();
|
|
97 |
mRecommendationAlbumArtsMap.clear();
|
|
98 |
QFile file( mRecommendationAlbumArtsName.at( i ) );
|
|
99 |
if ( file.exists() ) {
|
|
100 |
if ( file.remove() ) {
|
|
101 |
TX_LOG_ARGS( "File removed - " << file.fileName() );
|
|
102 |
}
|
|
103 |
else {
|
|
104 |
TX_LOG_ARGS( "Cannot remove file - " << file.fileName() );
|
|
105 |
}
|
|
106 |
} else {
|
|
107 |
TX_LOG_ARGS( "File doesn't exist - " << file.fileName() );
|
|
108 |
}
|
|
109 |
}
|
|
110 |
TX_EXIT_ARGS("STUB")
|
|
111 |
}
|
|
112 |
|
|
113 |
|
|
114 |
/*!
|
|
115 |
Return recommendation artists
|
|
116 |
*/
|
47
|
117 |
QString MpQueryManager::recommendedArtist(int index) const
|
35
|
118 |
{
|
47
|
119 |
QString result;
|
|
120 |
if( (0 <= index) && (index < mRecommendationArtists.count())) {
|
|
121 |
result = mRecommendationArtists.at(index);
|
|
122 |
}
|
|
123 |
TX_LOG_ARGS ("recommendedArtist: " << result);
|
|
124 |
return result;
|
35
|
125 |
}
|
|
126 |
|
|
127 |
/*!
|
|
128 |
Return the number of ready album arts
|
|
129 |
*/
|
|
130 |
int &MpQueryManager::albumArtsReadyCount()
|
|
131 |
{
|
|
132 |
TX_LOG
|
|
133 |
return mAlbumArtsReadyCount;
|
|
134 |
}
|
|
135 |
|
47
|
136 |
int MpQueryManager::recommendationsCount() const
|
35
|
137 |
{
|
47
|
138 |
TX_LOG_ARGS ("count: " << mRecommendationSongs.count());
|
|
139 |
return mRecommendationSongs.count();
|
35
|
140 |
}
|
|
141 |
|
47
|
142 |
QString MpQueryManager::recommendedSong(int index) const
|
|
143 |
{
|
|
144 |
QString result;
|
|
145 |
if( (0 <= index) && (index < mRecommendationSongs.count())) {
|
|
146 |
result = mRecommendationSongs.at(index);
|
|
147 |
}
|
|
148 |
return result;
|
|
149 |
}
|
|
150 |
|
|
151 |
HbIcon MpQueryManager::recommendedAlbumArt(int index) const
|
|
152 |
{
|
|
153 |
TX_LOG_ARGS( "index = " << index )
|
|
154 |
return mRecommendationAlbumArtsMap.value( mRecommendationAlbumArtsLink.at( index ) );
|
|
155 |
}
|