36
|
1 |
/*
|
|
2 |
* Copyright (c) 2010 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 home screen widget
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#ifndef MUSICWIDGET_H
|
|
19 |
#define MUSICWIDGET_H
|
|
20 |
|
59
|
21 |
// includes
|
36
|
22 |
#include <hbwidget.h>
|
|
23 |
#include <xqappmgr.h>
|
|
24 |
|
|
25 |
// Forward declarations
|
|
26 |
class HbLabel;
|
|
27 |
class HbPushButton;
|
|
28 |
class HbIcon;
|
|
29 |
class HbMarqueeItem;
|
|
30 |
class MpEngine;
|
43
|
31 |
class MpAlbumCoverWidget;
|
59
|
32 |
class MpApplicationMonitor;
|
|
33 |
class MpPlaybackData;
|
36
|
34 |
|
|
35 |
/**
|
|
36 |
* Media key identifier for push button events
|
|
37 |
*/
|
59
|
38 |
enum MediaKeyIdentifier {
|
36
|
39 |
EPrevious = 1,
|
|
40 |
EPlayPause,
|
|
41 |
ENext
|
|
42 |
};
|
|
43 |
|
|
44 |
/**
|
|
45 |
* Music Player launch source identifier
|
|
46 |
*/
|
59
|
47 |
enum LaunchIdentifier {
|
|
48 |
ELaunchToMainView,
|
|
49 |
ELaunchToNowPlayingView,
|
|
50 |
ELaunchToNowPlayingViewWithShuffle
|
36
|
51 |
};
|
|
52 |
|
|
53 |
class MusicWidget: public HbWidget
|
|
54 |
{
|
|
55 |
Q_OBJECT
|
|
56 |
|
|
57 |
public:
|
|
58 |
MusicWidget(QGraphicsItem *parent = 0, Qt::WindowFlags flags = 0);
|
|
59 |
~MusicWidget();
|
|
60 |
|
|
61 |
private:
|
|
62 |
|
|
63 |
/**
|
|
64 |
* Setup graphics
|
|
65 |
*/
|
|
66 |
void setupUi();
|
|
67 |
|
|
68 |
/**
|
|
69 |
* Get latest song data, player state and album art
|
|
70 |
*/
|
|
71 |
void refreshData();
|
|
72 |
|
|
73 |
/**
|
|
74 |
* Launch Music Player to view
|
|
75 |
*/
|
59
|
76 |
void launchMusicPlayer( int launchMode );
|
36
|
77 |
|
|
78 |
/**
|
59
|
79 |
* Update widget buttons according to Music Player state
|
|
80 |
*/
|
|
81 |
void updateButtons();
|
|
82 |
|
|
83 |
/**
|
|
84 |
* Connect/disconnect Music Player engine and playback data
|
|
85 |
*/
|
|
86 |
void connectMusicPlayerEngine( bool connect );
|
36
|
87 |
|
|
88 |
/**
|
59
|
89 |
* Get the playback state
|
|
90 |
*/
|
|
91 |
int getPlaybackState();
|
|
92 |
|
|
93 |
/**
|
|
94 |
* Clear the song data
|
|
95 |
*/
|
|
96 |
void clearData();
|
36
|
97 |
|
|
98 |
public slots:
|
|
99 |
|
|
100 |
/**
|
59
|
101 |
* Widget related
|
36
|
102 |
*/
|
|
103 |
void onInitialize();
|
|
104 |
void onShow();
|
|
105 |
void onHide();
|
|
106 |
void onUninitialize();
|
|
107 |
|
|
108 |
/**
|
59
|
109 |
* MpEngine related
|
|
110 |
*/
|
55
|
111 |
void libraryUpdateStarted();
|
36
|
112 |
void libraryUpdated();
|
|
113 |
void usbBlocked( bool blocked );
|
|
114 |
|
|
115 |
/**
|
59
|
116 |
* MpPlaybackData related
|
36
|
117 |
*/
|
|
118 |
void albumArtReady();
|
|
119 |
void playbackStateChanged();
|
|
120 |
void playbackInfoChanged();
|
|
121 |
|
|
122 |
private slots:
|
|
123 |
|
|
124 |
/**
|
|
125 |
* Slots to be called after button press
|
|
126 |
*/
|
59
|
127 |
void handlePrevButtonClicked();
|
|
128 |
void handlePlayButtonClicked();
|
|
129 |
void handleNextButtonClicked();
|
|
130 |
void handleAlbumArtClicked();
|
|
131 |
|
|
132 |
/**
|
|
133 |
* MpApplicationMonitor related
|
|
134 |
*/
|
|
135 |
void applicationStatusChanged( bool isrunning );
|
36
|
136 |
|
|
137 |
private:
|
|
138 |
//mSongDataLayout items
|
59
|
139 |
HbLabel *mSongDataBackground;
|
36
|
140 |
HbMarqueeItem *mMarqueeText;
|
|
141 |
|
|
142 |
// mControlButtonsLayout items
|
|
143 |
HbPushButton *mPreviousPushButton;
|
|
144 |
HbPushButton *mPlayPushButton;
|
|
145 |
HbPushButton *mNextPushButton;
|
|
146 |
|
|
147 |
// MusicPlayer related state identifiers
|
|
148 |
bool mMusicPlayerUpdating;
|
|
149 |
bool mMusicPlayerBlocked;
|
59
|
150 |
bool mMusicPlayerRunning;
|
36
|
151 |
|
|
152 |
// Album art for background
|
43
|
153 |
MpAlbumCoverWidget *mAlbumArt;
|
36
|
154 |
|
|
155 |
// Used to launch MusicPlayer
|
|
156 |
XQApplicationManager mApplicationManager;
|
|
157 |
|
|
158 |
// MusicPlayer control and state updates
|
59
|
159 |
MpEngine *mMpEngine;
|
|
160 |
MpPlaybackData *mMpPlaybackData;
|
|
161 |
|
|
162 |
// Music Player observer
|
|
163 |
MpApplicationMonitor *mMpApplicationMonitor;
|
36
|
164 |
};
|
|
165 |
|
|
166 |
#endif // MUSICWIDGET_H
|