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