|
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: Playback Data provider for playback view. |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <QIcon> |
|
19 #include <QString> |
|
20 #include <QPixmap> |
|
21 #include <QPainter> |
|
22 #include <hbicon.h> |
|
23 |
|
24 #include "mpplaybackdata.h" |
|
25 #include "mptrace.h" |
|
26 |
|
27 const int KUndefined = -1; |
|
28 |
|
29 |
|
30 /*! |
|
31 Constructs a new MpPlaybackData. |
|
32 */ |
|
33 MpPlaybackData::MpPlaybackData( QObject *parent ) |
|
34 : QObject( parent ), |
|
35 mReqId( KUndefined ), |
|
36 mDuration(20000), |
|
37 mPosition(10000), |
|
38 mTitle( QString( "title" ) ), |
|
39 mAlbum( QString( "album" ) ), |
|
40 mArtist( QString( "artist" ) ), |
|
41 mAlbumId(0), |
|
42 mId(0), |
|
43 mAlbumArt( "qtg_large_music_album" ), |
|
44 mPlaybackState( NotPlaying ), |
|
45 mRealAudio( false ) |
|
46 { |
|
47 TX_ENTRY |
|
48 |
|
49 TX_EXIT |
|
50 } |
|
51 |
|
52 /*! |
|
53 Constructs a new MpPlaybackData. |
|
54 */ |
|
55 MpPlaybackData::~MpPlaybackData() |
|
56 { |
|
57 TX_ENTRY |
|
58 TX_EXIT |
|
59 } |
|
60 |
|
61 |
|
62 |
|
63 /*! |
|
64 Returns the song duration. |
|
65 */ |
|
66 int MpPlaybackData::duration() const |
|
67 { |
|
68 TX_LOG_ARGS( "mDuration = " << mDuration ) |
|
69 return mDuration; |
|
70 } |
|
71 |
|
72 |
|
73 /*! |
|
74 Returns the song position. |
|
75 */ |
|
76 int MpPlaybackData::position() const |
|
77 { |
|
78 TX_ENTRY_ARGS( "mPosition = " << mPosition ) |
|
79 return mPosition; |
|
80 } |
|
81 |
|
82 /*! |
|
83 Returns the song title. |
|
84 */ |
|
85 const QString& MpPlaybackData::title() const |
|
86 { |
|
87 TX_ENTRY_ARGS( "mTitle = " << mTitle ) |
|
88 return mTitle; |
|
89 } |
|
90 |
|
91 |
|
92 |
|
93 /*! |
|
94 Returns the song artist. |
|
95 */ |
|
96 const QString& MpPlaybackData::artist() const |
|
97 { |
|
98 TX_ENTRY_ARGS( "mArtist = " << mArtist ) |
|
99 return mArtist; |
|
100 } |
|
101 |
|
102 |
|
103 |
|
104 /*! |
|
105 Returns the song album. |
|
106 */ |
|
107 const QString& MpPlaybackData::album() const |
|
108 { |
|
109 TX_ENTRY_ARGS( "mAlbum = " << mAlbum ) |
|
110 return mAlbum; |
|
111 } |
|
112 |
|
113 |
|
114 /*! |
|
115 Returns the song uri. |
|
116 */ |
|
117 const QString& MpPlaybackData::uri() const |
|
118 { |
|
119 TX_ENTRY_ARGS( "mUri = " << mUri ) |
|
120 return mUri; |
|
121 } |
|
122 |
|
123 |
|
124 /*! |
|
125 Returns the song album art on \a icon. |
|
126 */ |
|
127 void MpPlaybackData::albumArt( HbIcon& icon ) const |
|
128 { |
|
129 TX_ENTRY |
|
130 icon = mAlbumArt ; |
|
131 TX_EXIT |
|
132 } |
|
133 |
|
134 |
|
135 /*! |
|
136 Returns the id of the album to which the song belongs. |
|
137 */ |
|
138 int MpPlaybackData::albumId() |
|
139 { |
|
140 return mAlbumId; |
|
141 } |
|
142 |
|
143 |
|
144 |
|
145 /*! |
|
146 Returns the id the song. |
|
147 */ |
|
148 int MpPlaybackData::id() |
|
149 { |
|
150 return mId; |
|
151 } |
|
152 |
|
153 |
|
154 /*! |
|
155 Returns the mode of Real Audio. |
|
156 */ |
|
157 bool MpPlaybackData::realAudio() |
|
158 { |
|
159 return mRealAudio; |
|
160 } |
|
161 |
|
162 |
|
163 |
|
164 /*! |
|
165 Returns the playback state. |
|
166 */ |
|
167 MpPlaybackData::SimplifiedState MpPlaybackData::playbackState() const |
|
168 { |
|
169 TX_LOG_ARGS( "mPlaybackState = " << mPlaybackState ) |
|
170 return mPlaybackState; |
|
171 } |
|
172 |