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 #ifndef RADIOSTATIONMODEL_P_H_ |
|
19 #define RADIOSTATIONMODEL_P_H_ |
|
20 |
|
21 // System includes |
|
22 #include <QList> |
|
23 #include <QMap> |
|
24 #include <QScopedPointer> |
|
25 #include <QIcon> |
|
26 |
|
27 // User includes |
|
28 #include "radioenginewrapperobserver.h" |
|
29 #include "radiostationhandlerif.h" |
|
30 |
|
31 // Forward declarations |
|
32 class RadioUiEnginePrivate; |
|
33 class RadioPresetStorage; |
|
34 class RadioEngineWrapper; |
|
35 class QTimer; |
|
36 |
|
37 // Class declaration |
|
38 class RadioStationModelPrivate : public RadioStationHandlerIf |
|
39 , public RadioEngineWrapperObserver |
|
40 { |
|
41 Q_DECLARE_PUBLIC( RadioStationModel ) |
|
42 Q_DISABLE_COPY( RadioStationModelPrivate ) |
|
43 |
|
44 public: |
|
45 |
|
46 explicit RadioStationModelPrivate( RadioStationModel* model, RadioUiEnginePrivate& uiEngine ); |
|
47 |
|
48 virtual ~RadioStationModelPrivate(); |
|
49 |
|
50 private: |
|
51 |
|
52 // from base class RadioStationHandlerIf |
|
53 |
|
54 uint currentFrequency() const; |
|
55 int currentPresetIndex() const; |
|
56 void setCurrentStation( uint frequency ); |
|
57 bool containsFrequency( uint frequency ); |
|
58 bool containsPresetIndex( int presetIndex ); |
|
59 void startDynamicPsCheck(); |
|
60 void addScannedFrequency( uint frequency ); |
|
61 void setCurrentPsName( uint frequency, const QString& name ); |
|
62 void setCurrentRadioText( uint frequency, const QString& radioText ); |
|
63 void setCurrentRadioTextPlus( uint frequency, int rtClass, const QString& rtItem ); |
|
64 void setCurrentPiCode( uint frequency, int piCode ); |
|
65 void setCurrentGenre( uint frequency, int genre ); |
|
66 |
|
67 // from base class RadioEngineWrapperObserver |
|
68 |
|
69 void tunedToFrequency( uint frequency, int reason ); |
|
70 |
|
71 // New functions |
|
72 |
|
73 void doSaveStation( RadioStation& station, bool persistentSave = true ); |
|
74 |
|
75 QList<RadioStation> favorites() const; |
|
76 |
|
77 private: // data |
|
78 |
|
79 /** |
|
80 * Pointer to the public class |
|
81 * Not own. |
|
82 */ |
|
83 RadioStationModel* q_ptr; |
|
84 |
|
85 /** |
|
86 * Reference to the ui engine |
|
87 */ |
|
88 RadioUiEnginePrivate& mUiEngine; |
|
89 |
|
90 /** |
|
91 * Pointer to the preset storage |
|
92 */ |
|
93 RadioPresetStorage* mPresetStorage; |
|
94 |
|
95 /** |
|
96 * Pointer to the radio engine wrapper |
|
97 */ |
|
98 RadioEngineWrapper* mWrapper; |
|
99 |
|
100 /** |
|
101 * List of station items |
|
102 */ |
|
103 Stations mStations; |
|
104 |
|
105 /** |
|
106 * Station used to store information of manually tuned frequencies |
|
107 */ |
|
108 RadioStation mManualStation; |
|
109 |
|
110 /** |
|
111 * Pointer to the current station |
|
112 * Not own. |
|
113 */ |
|
114 RadioStation* mCurrentStation; |
|
115 |
|
116 /** |
|
117 * Dynamic PS timer |
|
118 * Own. |
|
119 */ |
|
120 QScopedPointer<QTimer> mDynamicPsTimer; |
|
121 |
|
122 /** |
|
123 * Level of detail shown in Qt::DisplayRole and Qt::DecorationRole roles |
|
124 */ |
|
125 RadioStationModel::Detail mDetailLevel; |
|
126 |
|
127 /** |
|
128 * Pointer to favorite icon. |
|
129 * Not own. |
|
130 */ |
|
131 QIcon mFavoriteIcon; |
|
132 |
|
133 /** |
|
134 * Pointer to the now playing marker icon |
|
135 * Not own. |
|
136 */ |
|
137 QIcon mNowPlayingIcon; |
|
138 |
|
139 }; |
|
140 |
|
141 #endif // RADIOSTATIONMODEL_P_H_ |
|