author | Pat Downey <patd@symbian.org> |
Wed, 23 Jun 2010 17:20:24 +0100 | |
changeset 29 | 29ba091146f4 |
parent 28 | 075425b8d9a4 |
child 32 | 189d20c34778 |
child 34 | bc10a61bd7d3 |
permissions | -rw-r--r-- |
24 | 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: |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
#ifndef RADIOUIENGINE_H_ |
|
20 |
#define RADIOUIENGINE_H_ |
|
21 |
||
22 |
// System includes |
|
23 |
#include <QObject> |
|
24 |
#include <QString> |
|
25 |
||
26 |
// User includes |
|
27 |
#include "radiouiengineexport.h" |
|
28 |
#include "radio_global.h" |
|
29 |
||
30 |
// Forward declarations |
|
31 |
class RadioUiEnginePrivate; |
|
32 |
class RadioStationModel; |
|
33 |
class RadioSettingsIf; |
|
34 |
class RadioStation; |
|
35 |
class RadioHistoryModel; |
|
36 |
class RadioHistoryItem; |
|
37 |
class RadioScannerEngine; |
|
38 |
class RadioMonitorService; |
|
39 |
||
40 |
class UI_ENGINE_DLL_EXPORT RadioUiEngine : public QObject |
|
41 |
{ |
|
42 |
Q_OBJECT |
|
43 |
Q_DECLARE_PRIVATE_D( d_ptr, RadioUiEngine ) |
|
44 |
Q_DISABLE_COPY( RadioUiEngine ) |
|
45 |
||
46 |
friend class RadioScannerEngine; |
|
47 |
||
48 |
public: |
|
49 |
||
50 |
/** |
|
51 |
* Static functions that are used before the ui engine is created |
|
52 |
*/ |
|
53 |
static uint lastTunedFrequency(); |
|
54 |
||
55 |
RadioUiEngine( QObject* parent = 0 ); |
|
56 |
~RadioUiEngine(); |
|
57 |
||
58 |
bool isInitialized() const; |
|
59 |
||
60 |
bool init(); |
|
61 |
||
62 |
bool isFirstTimeStart(); |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
63 |
void setFirstTimeStartPerformed( bool firstTimeStartPerformed ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
64 |
|
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
65 |
void setPowerOn(); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
66 |
void setPowerOff( int delay = 0 ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
67 |
bool isPoweringOff() const; |
24 | 68 |
|
69 |
/** |
|
70 |
* Getters for things owned by the engine |
|
71 |
*/ |
|
72 |
RadioSettingsIf& settings(); |
|
73 |
RadioStationModel& stationModel(); |
|
74 |
RadioHistoryModel& historyModel(); |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
75 |
RadioScannerEngine* createScannerEngine(); |
24 | 76 |
RadioScannerEngine* scannerEngine(); |
77 |
||
78 |
bool isRadioOn() const; |
|
79 |
bool isScanning() const; |
|
80 |
bool isMuted() const; |
|
81 |
bool isAntennaAttached() const; |
|
82 |
bool isUsingLoudspeaker() const; |
|
83 |
||
84 |
RadioRegion::Region region() const; |
|
85 |
uint currentFrequency() const; |
|
86 |
uint minFrequency() const; |
|
87 |
uint maxFrequency() const; |
|
88 |
uint frequencyStepSize() const; |
|
89 |
||
90 |
void setMute( bool muted ); |
|
91 |
||
92 |
QList<RadioStation> stationsInRange( uint minFrequency, uint maxFrequency ); |
|
93 |
||
94 |
QString genreToString( int genre, GenreTarget::Target target ); |
|
95 |
||
96 |
bool isSongRecognitionAppAvailable(); |
|
97 |
||
98 |
void addRecognizedSong( const QString& artist, const QString& title, const RadioStation& station ); |
|
99 |
||
100 |
uint skipStation( StationSkip::Mode mode, uint startFrequency = 0 ); |
|
101 |
||
102 |
enum MusicStore{ OviStore, OtherStore }; |
|
103 |
void openMusicStore( const RadioHistoryItem& item, MusicStore store = OviStore ); |
|
104 |
||
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
105 |
void setManualSeekMode( bool manualSeek ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
106 |
bool isInManualSeekMode() const; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
107 |
|
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
108 |
/** |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
109 |
* Tunes the radio engine to given frequency |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
110 |
*/ |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
111 |
void setFrequency( uint frequency, const int reason = TuneReason::Unspecified ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
112 |
|
24 | 113 |
signals: |
114 |
||
115 |
void tunedToFrequency( uint frequency, int commandSender ); |
|
116 |
void seekingStarted( int direction ); |
|
117 |
void radioStatusChanged( bool radioIsOn ); |
|
118 |
||
119 |
void rdsAvailabilityChanged( bool available ); |
|
120 |
||
121 |
void volumeChanged( int volume ); |
|
122 |
void muteChanged( bool muted ); |
|
123 |
||
124 |
void audioRouteChanged( bool loudspeaker ); |
|
125 |
void antennaStatusChanged( bool connected ); |
|
126 |
||
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
127 |
void powerOffRequested(); |
24 | 128 |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
129 |
public slots: |
24 | 130 |
|
131 |
/*! |
|
132 |
* volume update command slot for the engine |
|
133 |
*/ |
|
134 |
void setVolume( int volume ); |
|
135 |
void toggleMute(); |
|
136 |
void toggleAudioRoute(); |
|
137 |
||
138 |
void seekStation( int seekDirection ); |
|
139 |
||
140 |
void launchSongRecognition(); |
|
141 |
||
142 |
private: |
|
143 |
||
144 |
/** |
|
145 |
* functions used only by the private class to get signals emitted |
|
146 |
*/ |
|
147 |
void emitTunedToFrequency( uint frequency, int commandSender ); |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
148 |
void emitSeekingStarted( Seek::Direction direction ); |
24 | 149 |
void emitRadioStatusChanged( bool radioIsOn ); |
150 |
void emitRdsAvailabilityChanged( bool available ); |
|
151 |
void emitVolumeChanged( int volume ); |
|
152 |
void emitMuteChanged( bool muted ); |
|
153 |
void emitAudioRouteChanged( bool loudspeaker ); |
|
154 |
void emitAntennaStatusChanged( bool connected ); |
|
155 |
||
156 |
private: // data |
|
157 |
||
158 |
/** |
|
159 |
* Unmodifiable pointer to the private implementation |
|
160 |
*/ |
|
161 |
RadioUiEnginePrivate* const d_ptr; |
|
162 |
||
163 |
}; |
|
164 |
||
165 |
||
166 |
#endif // RADIOUIENGINE_H_ |