author | hgs |
Fri, 25 Jun 2010 19:09:05 +0300 | |
changeset 34 | bc10a61bd7d3 |
parent 28 | 075425b8d9a4 |
child 36 | ba22309243a1 |
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 |
// System includes |
|
19 |
#include <HbListView> |
|
20 |
#include <HbAbstractViewItem> |
|
21 |
#include <HbPushButton> |
|
22 |
#include <HbEffect> |
|
23 |
#include <HbAction> |
|
24 |
#include <HbInputDialog> |
|
25 |
#include <HbMenu> |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
26 |
#include <QSortFilterProxyModel> |
24 | 27 |
|
28 |
// User includes |
|
29 |
#include "radiostationsview.h" |
|
30 |
#include "radiologger.h" |
|
31 |
#include "radiowindow.h" |
|
32 |
#include "radiouiengine.h" |
|
33 |
#include "radiofrequencyscanner.h" |
|
34 |
#include "radiouiloader.h" |
|
35 |
#include "radiostationmodel.h" |
|
36 |
#include "radiostation.h" |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
37 |
|
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
38 |
// Constants |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
39 |
const char* REGEX_SHOW_FAVORITES = "true"; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
40 |
const char* REGEX_SHOW_ALL = ".+"; |
24 | 41 |
|
42 |
/*! |
|
43 |
* |
|
44 |
*/ |
|
45 |
RadioStationsView::RadioStationsView() : |
|
46 |
RadioViewBase( false ), |
|
47 |
mModel( 0 ), |
|
48 |
mScanStationsAction( 0 ), |
|
49 |
mClearListAction( 0 ), |
|
50 |
mStationsList( 0 ), |
|
51 |
mFavoritesButton( 0 ), |
|
52 |
mLocalStationsButton( 0 ), |
|
53 |
mSelectedStation( new RadioStation ), |
|
54 |
mCurrentQuestion( NoQuestion ) |
|
55 |
{ |
|
56 |
} |
|
57 |
||
58 |
/*! |
|
59 |
* |
|
60 |
*/ |
|
61 |
RadioStationsView::~RadioStationsView() |
|
62 |
{ |
|
63 |
} |
|
64 |
||
65 |
/*! |
|
66 |
* |
|
67 |
*/ |
|
68 |
void RadioStationsView::setNowPlayingIcon( const HbIcon& nowPlayingIcon ) |
|
69 |
{ |
|
70 |
mNowPlayingIcon = nowPlayingIcon; |
|
71 |
} |
|
72 |
||
73 |
/*! |
|
74 |
* |
|
75 |
*/ |
|
76 |
HbIcon RadioStationsView::nowPlayingIcon() const |
|
77 |
{ |
|
78 |
return mNowPlayingIcon; |
|
79 |
} |
|
80 |
||
81 |
/*! |
|
82 |
* |
|
83 |
*/ |
|
84 |
void RadioStationsView::setFavoriteIcon( const HbIcon& favoriteIcon ) |
|
85 |
{ |
|
86 |
mFavoriteIcon = favoriteIcon; |
|
87 |
} |
|
88 |
||
89 |
/*! |
|
90 |
* |
|
91 |
*/ |
|
92 |
HbIcon RadioStationsView::favoriteIcon() const |
|
93 |
{ |
|
94 |
return mFavoriteIcon; |
|
95 |
} |
|
96 |
||
97 |
/*! |
|
98 |
* Private slot |
|
99 |
* |
|
100 |
*/ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
101 |
void RadioStationsView::handleClick( const QModelIndex& index ) |
24 | 102 |
{ |
103 |
LOG_TIMESTAMP( "Channel change started" ); |
|
104 |
QModelIndex sourceIndex = mFilterModel->mapToSource( index ); |
|
105 |
*mSelectedStation = mModel->stationAt( sourceIndex.row() ); |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
106 |
mUiEngine->setFrequency( mSelectedStation->frequency(), TuneReason::StationsList ); |
24 | 107 |
} |
108 |
||
109 |
/*! |
|
110 |
* Private slot |
|
111 |
* |
|
112 |
*/ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
113 |
void RadioStationsView::handleLongPress( HbAbstractViewItem* item, const QPointF& coords ) |
24 | 114 |
{ |
115 |
Q_UNUSED( item ); |
|
116 |
||
117 |
HbMenu* menu = mUiLoader->findObject<HbMenu>( DOCML::NAME_CONTEXT_MENU ); |
|
118 |
||
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
119 |
*mSelectedStation = mFilterModel->data( item->modelIndex(), RadioRole::RadioStationRole ).value<RadioStation>(); |
24 | 120 |
|
121 |
HbAction* favoriteAction = mUiLoader->findObject<HbAction>( DOCML::NAME_CONTEXT_FAVORITE ); |
|
34 | 122 |
|
24 | 123 |
if ( mSelectedStation->isFavorite() ) { |
124 |
favoriteAction->setText( hbTrId( "txt_rad_menu_remove_favourite" ) ); |
|
125 |
} else { |
|
126 |
favoriteAction->setText( hbTrId( "txt_rad_menu_add_to_favourites" ) ); |
|
127 |
} |
|
128 |
||
34 | 129 |
HbAction* playAction = mUiLoader->findObject<HbAction>( DOCML::SV_NAME_PLAY_ACTION ); |
130 |
||
131 |
if ( mSelectedStation->frequency() == mUiEngine->currentFrequency() ) { |
|
132 |
playAction->setVisible( false ); |
|
133 |
} else { |
|
134 |
playAction->setVisible( true ); |
|
135 |
} |
|
136 |
||
24 | 137 |
menu->setPreferredPos( QPointF( size().width() / 2 - menu->size().width() / 2, coords.y() - menu->size().height() / 2 ) ); |
138 |
menu->show(); |
|
139 |
} |
|
140 |
||
141 |
/*! |
|
142 |
* Private slot |
|
143 |
* |
|
144 |
*/ |
|
145 |
void RadioStationsView::updateAntennaStatus( bool connected ) |
|
146 |
{ |
|
147 |
Q_UNUSED( connected ); |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
148 |
updateVisibilities(); |
24 | 149 |
} |
150 |
||
151 |
/*! |
|
152 |
* Private slot |
|
153 |
* |
|
154 |
*/ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
155 |
void RadioStationsView::updateViewMode() |
24 | 156 |
{ |
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
157 |
QString section = DOCML::SV_SECTION_SHOW_ALL_STATIONS; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
158 |
QString filter = REGEX_SHOW_ALL; |
24 | 159 |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
160 |
if ( sender() == mFavoritesButton ) { |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
161 |
section = DOCML::SV_SECTION_SHOW_FAVORITES; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
162 |
filter = REGEX_SHOW_FAVORITES; |
24 | 163 |
} |
164 |
||
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
165 |
loadSection( DOCML::FILE_STATIONSVIEW, section ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
166 |
mFilterModel->setFilterRegExp( filter ); |
24 | 167 |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
168 |
updateVisibilities(); |
24 | 169 |
} |
170 |
||
171 |
/*! |
|
172 |
* Private slot |
|
173 |
* |
|
174 |
*/ |
|
175 |
void RadioStationsView::startScanning() |
|
176 |
{ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
177 |
const int rowCount = mUiEngine->stationModel().rowCount(); |
24 | 178 |
mCurrentQuestion = StartScanning; |
179 |
if ( rowCount > 0 ) { |
|
180 |
askQuestion( hbTrId( "txt_rad_info_all_stations_in_stations_list_will_be" ) ); |
|
181 |
} else { |
|
182 |
userAccepted(); |
|
183 |
} |
|
184 |
} |
|
185 |
||
186 |
/*! |
|
187 |
* Private slot |
|
188 |
* |
|
189 |
*/ |
|
190 |
void RadioStationsView::finishScanning() |
|
191 |
{ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
192 |
updateVisibilities(); |
24 | 193 |
mFrequencyScanner.take(); |
194 |
} |
|
195 |
||
196 |
/*! |
|
197 |
* Private slot |
|
198 |
* |
|
199 |
*/ |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
200 |
void RadioStationsView::updateVisibilities() |
24 | 201 |
{ |
202 |
LOG_SLOT_CALLER; |
|
203 |
bool listEmpty = mModel->rowCount() == 0; |
|
204 |
const bool localStationsMode = !mFavoritesButton->isChecked(); |
|
205 |
||
206 |
if ( !localStationsMode ) { |
|
207 |
listEmpty = mModel->favoriteCount() == 0; |
|
208 |
} |
|
209 |
||
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
210 |
mClearListAction->setEnabled( !listEmpty ); |
24 | 211 |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
212 |
const bool scanAvailable = mUiEngine->isAntennaAttached() && localStationsMode; |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
213 |
mScanStationsAction->setEnabled( scanAvailable ); |
24 | 214 |
HbPushButton* scanButton = mUiLoader->findWidget<HbPushButton>( DOCML::SV_NAME_SCAN_BUTTON ); |
215 |
scanButton->setEnabled( scanAvailable ); |
|
216 |
||
217 |
loadSection( DOCML::FILE_STATIONSVIEW, listEmpty ? DOCML::SV_SECTION_SHOW_SCAN_TEXT : DOCML::SV_SECTION_HIDE_SCAN_TEXT ); |
|
218 |
} |
|
219 |
||
220 |
/*! |
|
221 |
* Private slot |
|
222 |
* |
|
223 |
*/ |
|
224 |
void RadioStationsView::clearList() |
|
225 |
{ |
|
226 |
const bool favoriteMode = mFavoritesButton->isChecked(); |
|
227 |
mCurrentQuestion = ClearList; |
|
228 |
askQuestion( hbTrId( favoriteMode ? "txt_rad_info_clear_favourite_stations_list" |
|
229 |
: "txt_rad_info_clear_all_stations_list" ) ); |
|
230 |
} |
|
231 |
||
232 |
/*! |
|
233 |
* Private slot |
|
234 |
* |
|
235 |
*/ |
|
34 | 236 |
void RadioStationsView::play() |
237 |
{ |
|
238 |
LOG("Play from context menu"); |
|
239 |
mUiEngine->setFrequency( mSelectedStation->frequency(), TuneReason::StationsList ); |
|
240 |
} |
|
241 |
||
242 |
/*! |
|
243 |
* Private slot |
|
244 |
* |
|
245 |
*/ |
|
24 | 246 |
void RadioStationsView::rename() |
247 |
{ |
|
248 |
HbInputDialog* nameQuery = new HbInputDialog(); |
|
249 |
nameQuery->setAttribute( Qt::WA_DeleteOnClose, true ); |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
250 |
nameQuery->setDismissPolicy( HbDialog::TapOutside ); |
24 | 251 |
nameQuery->setPromptText( hbTrId( "txt_rad_dialog_new_name" ) ); |
252 |
nameQuery->setInputMode( HbInputDialog::TextInput ); |
|
253 |
nameQuery->setValue( mSelectedStation->name() ); |
|
254 |
nameQuery->setObjectName( DOCML::NAME_INPUT_QUERY ); |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
255 |
nameQuery->open( this, SLOT(renameDone(HbAction*)) ); |
24 | 256 |
} |
257 |
||
258 |
/*! |
|
259 |
* Private slot |
|
260 |
* |
|
261 |
*/ |
|
262 |
void RadioStationsView::toggleFavorite() |
|
263 |
{ |
|
264 |
mModel->setFavoriteByPreset( mSelectedStation->presetIndex(), !mSelectedStation->isFavorite() ); |
|
265 |
} |
|
266 |
||
267 |
/*! |
|
268 |
* Private slot |
|
269 |
* |
|
270 |
*/ |
|
271 |
void RadioStationsView::deleteStation() |
|
272 |
{ |
|
273 |
mCurrentQuestion = DeleteStation; |
|
274 |
askQuestion( hbTrId( "txt_rad_menu_delete_station" ) ); |
|
275 |
} |
|
276 |
||
277 |
/*! |
|
278 |
* Private slot |
|
279 |
* |
|
280 |
*/ |
|
281 |
void RadioStationsView::renameDone( HbAction* action ) |
|
282 |
{ |
|
283 |
HbInputDialog* dlg = static_cast<HbInputDialog*>( sender() ); |
|
284 |
||
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
285 |
if( action ) { |
24 | 286 |
mModel->renameStation( mSelectedStation->presetIndex(), dlg->value().toString() ); |
287 |
} |
|
288 |
} |
|
289 |
||
290 |
/*! |
|
291 |
* From RadioViewBase |
|
292 |
* |
|
293 |
*/ |
|
294 |
void RadioStationsView::init() |
|
295 |
{ |
|
296 |
LOG_METHOD; |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
297 |
mModel = &mUiEngine->stationModel(); |
24 | 298 |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
299 |
mFilterModel = new QSortFilterProxyModel( this ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
300 |
mFilterModel->setDynamicSortFilter( true ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
301 |
mFilterModel->setFilterRole( RadioRole::IsFavoriteRole ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
302 |
mFilterModel->setSourceModel( &mUiEngine->stationModel() ); |
24 | 303 |
|
304 |
loadSection( DOCML::FILE_STATIONSVIEW, DOCML::SV_SECTION_SHOW_ALL_STATIONS ); |
|
305 |
||
306 |
if ( !mFavoriteIcon.isNull() && !mNowPlayingIcon.isNull() ) { |
|
307 |
mModel->setIcons( mFavoriteIcon.qicon(), mNowPlayingIcon.qicon() ); |
|
308 |
} |
|
309 |
mModel->setDetail( RadioStationModel::ShowIcons | RadioStationModel::ShowGenre ); |
|
310 |
||
311 |
mStationsList = mUiLoader->findObject<HbListView>( DOCML::SV_NAME_STATIONS_LIST ); |
|
312 |
mFavoritesButton = mUiLoader->findObject<HbAction>( DOCML::SV_NAME_FAVORITES_BUTTON ); |
|
313 |
mLocalStationsButton = mUiLoader->findObject<HbAction>( DOCML::SV_NAME_LOCALS_BUTTON ); |
|
314 |
||
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
315 |
Radio::connect( mUiEngine.data(), SIGNAL(antennaStatusChanged(bool)), |
24 | 316 |
this, SLOT(updateAntennaStatus(bool)) ); |
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
317 |
Radio::connect( mModel, SIGNAL(rowsInserted(QModelIndex,int,int)), |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
318 |
this, SLOT(updateVisibilities()) ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
319 |
Radio::connect( mModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
320 |
this, SLOT(updateVisibilities()) ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
321 |
Radio::connect( mModel, SIGNAL(modelReset()), |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
322 |
this, SLOT(updateVisibilities()) ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
323 |
Radio::connect( mFavoritesButton, SIGNAL(triggered()), |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
324 |
this, SLOT(updateViewMode()) ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
325 |
Radio::connect( mLocalStationsButton, SIGNAL(triggered() ), |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
326 |
this, SLOT(updateViewMode()) ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
327 |
Radio::connect( mStationsList, SIGNAL(activated(QModelIndex)), |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
328 |
this, SLOT(handleClick(QModelIndex)) ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
329 |
Radio::connect( mStationsList, SIGNAL(longPressed(HbAbstractViewItem*,QPointF)), |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
330 |
this, SLOT(handleLongPress(HbAbstractViewItem*,QPointF)) ); |
24 | 331 |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
332 |
connectCommonMenuItem( MenuItem::Exit ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
333 |
connectXmlElement( DOCML::SV_NAME_SCAN_BUTTON, SIGNAL(clicked()), |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
334 |
this, SLOT(startScanning()) ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
335 |
|
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
336 |
// Context menu actions |
34 | 337 |
connectXmlElement( DOCML::SV_NAME_PLAY_ACTION, SIGNAL(triggered()), |
338 |
this, SLOT(play()) ); |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
339 |
connectXmlElement( DOCML::SV_NAME_RENAME_ACTION, SIGNAL(triggered()), |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
340 |
this, SLOT(rename()) ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
341 |
connectXmlElement( DOCML::SV_NAME_FAVORITE_ACTION, SIGNAL(triggered()), |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
342 |
this, SLOT(toggleFavorite()) ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
343 |
connectXmlElement( DOCML::SV_NAME_DELETE_ACTION, SIGNAL(triggered()), |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
344 |
this, SLOT(deleteStation()) ); |
24 | 345 |
|
346 |
// "Scan local stations" menu item |
|
347 |
mScanStationsAction = mUiLoader->findObject<HbAction>( DOCML::SV_NAME_SCAN_ACTION ); |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
348 |
Radio::connect( mScanStationsAction, SIGNAL(triggered() ), |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
349 |
this, SLOT(startScanning() ) ); |
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
350 |
|
24 | 351 |
// "Remove all presets" menu item |
352 |
mClearListAction = mUiLoader->findObject<HbAction>( DOCML::SV_NAME_CLEAR_LIST_ACTION ); |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
353 |
Radio::connect( mClearListAction, SIGNAL(triggered() ), |
24 | 354 |
this, SLOT(clearList() ) ); |
355 |
||
356 |
connectCommonMenuItem( MenuItem::UseLoudspeaker ); |
|
357 |
||
358 |
initListView(); |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
359 |
|
24 | 360 |
initBackAction(); |
361 |
||
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
362 |
updateViewMode(); |
24 | 363 |
} |
364 |
||
365 |
/*! |
|
366 |
* \reimp |
|
367 |
*/ |
|
368 |
void RadioStationsView::userAccepted() |
|
369 |
{ |
|
370 |
if ( mCurrentQuestion == StartScanning ) { |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
371 |
mFrequencyScanner.reset( new RadioFrequencyScanner( *mUiEngine, this ) ); |
24 | 372 |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
373 |
Radio::connect( mFrequencyScanner.data(), SIGNAL(frequencyScannerFinished()), |
24 | 374 |
this, SLOT(finishScanning()) ); |
375 |
||
376 |
mFrequencyScanner->startScanning(); |
|
377 |
} else if ( mCurrentQuestion == ClearList ){ |
|
378 |
const bool favoriteMode = mFavoritesButton->isChecked(); |
|
379 |
mModel->removeAll( favoriteMode ? RadioStationModel::RemoveFavorites : RadioStationModel::RemoveAll ); |
|
28
075425b8d9a4
Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
24
diff
changeset
|
380 |
updateVisibilities(); |
24 | 381 |
} else if ( mCurrentQuestion == DeleteStation ) { |
34 | 382 |
mModel->removeStation( *mSelectedStation ); |
24 | 383 |
} |
384 |
||
385 |
mCurrentQuestion = NoQuestion; |
|
386 |
} |
|
387 |
||
388 |
/*! |
|
389 |
* |
|
390 |
*/ |
|
391 |
void RadioStationsView::initListView() |
|
392 |
{ |
|
393 |
mStationsList->setScrollingStyle( HbListView::PanOrFlick ); |
|
394 |
mStationsList->setModel( mFilterModel ); |
|
395 |
mStationsList->setSelectionMode( HbListView::NoSelection ); |
|
396 |
mStationsList->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ); |
|
397 |
} |