108 |
108 |
109 /*! |
109 /*! |
110 * Private slot |
110 * Private slot |
111 * |
111 * |
112 */ |
112 */ |
113 void RadioHistoryView::deckButtonPressed() |
113 void RadioHistoryView::updateViewMode() |
114 { |
114 { |
|
115 QString section = DOCML::HV_SECTION_HISTORY_MODE; |
|
116 bool showTagged = false; |
|
117 |
115 if ( sender() == mTaggedSongsButton ) { |
118 if ( sender() == mTaggedSongsButton ) { |
116 loadSection( DOCML::FILE_HISTORYVIEW, DOCML::HV_SECTION_FAVORITE_MODE ); |
119 section = DOCML::HV_SECTION_FAVORITE_MODE; |
117 } else { |
120 showTagged = true; |
118 loadSection( DOCML::FILE_HISTORYVIEW, DOCML::HV_SECTION_HISTORY_MODE ); |
121 } |
119 } |
122 |
120 |
123 loadSection( DOCML::FILE_HISTORYVIEW, section ); |
121 const bool showTagged = mTaggedSongsButton->isChecked(); |
|
122 historyModel().setShowTagged( showTagged ); |
124 historyModel().setShowTagged( showTagged ); |
123 |
125 |
124 updateVisibilities(); |
126 updateVisibilities(); |
125 } |
127 } |
126 |
128 |
179 |
181 |
180 /*! |
182 /*! |
181 * Private slot |
183 * Private slot |
182 * |
184 * |
183 */ |
185 */ |
|
186 void RadioHistoryView::handleLongPress( HbAbstractViewItem* item ) |
|
187 { |
|
188 showContextMenu( item->modelIndex() ); |
|
189 } |
|
190 |
|
191 /*! |
|
192 * Private slot |
|
193 * |
|
194 */ |
184 void RadioHistoryView::toggleTagging() |
195 void RadioHistoryView::toggleTagging() |
185 { |
196 { |
186 historyModel().toggleTagging( *mSelectedItem, mCurrentRow ); |
197 historyModel().toggleTagging( *mSelectedItem, mCurrentRow ); |
187 mSelectedItem->reset(); |
198 mSelectedItem->reset(); |
188 mCurrentRow = -1; |
199 mCurrentRow = -1; |
|
200 updateVisibilities(); |
189 } |
201 } |
190 |
202 |
191 /*! |
203 /*! |
192 * Private slot |
204 * Private slot |
193 * |
205 * |
194 */ |
206 */ |
195 void RadioHistoryView::openOviStore() |
207 void RadioHistoryView::openOviStore() |
196 { |
208 { |
197 QString msg = "To be implemented: Open ovi store. Artist: %1, Title: %2"; |
209 QString msg = "To be implemented: Open ovi store. Artist: %1, Title: %2"; |
198 HbMessageBox::information( msg.arg( mSelectedItem->artist() ).arg( mSelectedItem->title() ) ); |
210 HbMessageBox::information( msg.arg( mSelectedItem->artist() ).arg( mSelectedItem->title() ) ); |
199 mMainWindow->uiEngine().openMusicStore( *mSelectedItem ); |
211 mUiEngine->openMusicStore( *mSelectedItem ); |
200 } |
212 } |
201 |
213 |
202 /*! |
214 /*! |
203 * Private slot |
215 * Private slot |
204 * |
216 * |
205 */ |
217 */ |
206 void RadioHistoryView::openOtherStore() |
218 void RadioHistoryView::openOtherStore() |
207 { |
219 { |
208 QString msg = "To be implemented: Open other store. Artist: %1, Title: %2"; |
220 mUiEngine->openMusicStore( *mSelectedItem, RadioUiEngine::OtherStore ); |
209 HbMessageBox::information( msg.arg( mSelectedItem->artist() ).arg( mSelectedItem->title() ) ); |
|
210 mMainWindow->uiEngine().openMusicStore( *mSelectedItem, RadioUiEngine::OtherStore ); |
|
211 } |
221 } |
212 |
222 |
213 /*! |
223 /*! |
214 * Private slot |
224 * Private slot |
215 * TEMPORARY TEST CODE |
225 * TEMPORARY TEST CODE |
228 void RadioHistoryView::addOneSong() |
238 void RadioHistoryView::addOneSong() |
229 { |
239 { |
230 Song song = KRecognizedSongs[mSongIndex++]; |
240 Song song = KRecognizedSongs[mSongIndex++]; |
231 mSongIndex %= KSongsCount; |
241 mSongIndex %= KSongsCount; |
232 |
242 |
233 RadioStation station = mMainWindow->uiEngine().stationModel().currentStation(); |
243 RadioStation station = mUiEngine->stationModel().currentStation(); |
234 mMainWindow->uiEngine().historyModel().addItem( song.mArtist, song.mTitle, station ); |
244 mUiEngine->historyModel().addItem( song.mArtist, song.mTitle, station ); |
235 } |
245 } |
236 |
246 |
237 /*! |
247 /*! |
238 * \reimp |
248 * \reimp |
239 * |
249 * |
240 */ |
250 */ |
241 void RadioHistoryView::init() |
251 void RadioHistoryView::init() |
242 { |
252 { |
243 LOG_METHOD; |
253 LOG_METHOD; |
244 mInitialized = true; |
254 loadSection( DOCML::FILE_HISTORYVIEW, DOCML::SECTION_LAZY_LOAD ); |
245 |
255 |
246 RadioHistoryModel* historyModel = &mMainWindow->uiEngine().historyModel(); |
256 RadioHistoryModel* historyModel = &mUiEngine->historyModel(); |
247 historyModel->setShowDetails( mOrientation == Qt::Horizontal ); |
257 historyModel->setShowDetails( mOrientation == Qt::Horizontal ); |
248 |
258 |
249 if ( !mNonTaggedIcon.isNull() && !mTaggedIcon.isNull() ) { |
259 if ( !mNonTaggedIcon.isNull() && !mTaggedIcon.isNull() ) { |
250 historyModel->setIcons( mNonTaggedIcon.qicon(), mTaggedIcon.qicon() ); |
260 historyModel->setIcons( mNonTaggedIcon.qicon(), mTaggedIcon.qicon() ); |
251 } |
261 } |
258 |
268 |
259 mAllSongsButton = mUiLoader->findObject<HbAction>( DOCML::HV_NAME_ALL_SONGS_BUTTON ); |
269 mAllSongsButton = mUiLoader->findObject<HbAction>( DOCML::HV_NAME_ALL_SONGS_BUTTON ); |
260 mTaggedSongsButton = mUiLoader->findObject<HbAction>( DOCML::HV_NAME_TAGGED_SONGS_BUTTON ); |
270 mTaggedSongsButton = mUiLoader->findObject<HbAction>( DOCML::HV_NAME_TAGGED_SONGS_BUTTON ); |
261 |
271 |
262 if ( HbAction* clearListAction = mUiLoader->findObject<HbAction>( DOCML::HV_NAME_CLEAR_LIST_ACTION ) ) { |
272 if ( HbAction* clearListAction = mUiLoader->findObject<HbAction>( DOCML::HV_NAME_CLEAR_LIST_ACTION ) ) { |
263 connectAndTest( clearListAction, SIGNAL(triggered()), |
273 Radio::connect( clearListAction, SIGNAL(triggered()), |
264 this, SLOT(clearList()) ); |
274 this, SLOT(clearList()) ); |
265 } |
275 } |
266 |
276 |
267 connectAndTest( mTaggedSongsButton, SIGNAL(triggered() ), |
277 Radio::connect( mTaggedSongsButton, SIGNAL(triggered()), |
268 this, SLOT(deckButtonPressed() ) ); |
278 this, SLOT(updateViewMode()) ); |
269 connectAndTest( mAllSongsButton, SIGNAL(triggered() ), |
279 Radio::connect( mAllSongsButton, SIGNAL(triggered()), |
270 this, SLOT(deckButtonPressed() ) ); |
280 this, SLOT(updateViewMode()) ); |
271 connectAndTest( historyModel, SIGNAL(itemAdded() ), |
281 Radio::connect( historyModel, SIGNAL(itemAdded()), |
272 this, SLOT(updateVisibilities() ) ); |
282 this, SLOT(updateVisibilities()) ); |
273 |
283 Radio::connect( mHistoryList, SIGNAL(activated(QModelIndex)), |
274 loadSection( DOCML::FILE_HISTORYVIEW, DOCML::HV_SECTION_HISTORY_MODE ); |
284 this, SLOT(showContextMenu(QModelIndex)) ); |
275 updateVisibilities(); |
285 Radio::connect( mHistoryList, SIGNAL(longPressed(HbAbstractViewItem*,QPointF)), |
276 |
286 this, SLOT(handleLongPress(HbAbstractViewItem*)) ); |
|
287 |
|
288 connectCommonMenuItem( MenuItem::Exit ); |
277 connectCommonMenuItem( MenuItem::UseLoudspeaker ); |
289 connectCommonMenuItem( MenuItem::UseLoudspeaker ); |
278 |
290 |
|
291 // Context menu actions |
|
292 connectXmlElement( DOCML::HV_NAME_TOGGLE_TAG_ACTION, SIGNAL(triggered()), |
|
293 this, SLOT(toggleTagging()) ); |
|
294 connectXmlElement( DOCML::HV_NAME_OVI_STORE_ACTION, SIGNAL(triggered()), |
|
295 this, SLOT(openOviStore()) ); |
|
296 connectXmlElement( DOCML::HV_NAME_OTHER_STORE_ACTION, SIGNAL(triggered()), |
|
297 this, SLOT(openOtherStore()) ); |
279 initBackAction(); |
298 initBackAction(); |
|
299 |
|
300 updateViewMode(); |
280 |
301 |
281 // BEGIN TEMPORARY TEST CODE |
302 // BEGIN TEMPORARY TEST CODE |
282 if ( HbAction* addSongsAction = mUiLoader->findObject<HbAction>( "hv:add_songs_action" ) ) { |
303 if ( HbAction* addSongsAction = mUiLoader->findObject<HbAction>( "hv:add_songs_action" ) ) { |
283 connectAndTest( addSongsAction, SIGNAL(triggered()), |
304 Radio::connect( addSongsAction, SIGNAL(triggered()), |
284 this, SLOT(addSongs()) ); |
305 this, SLOT(addSongs()) ); |
285 } |
306 } |
286 // END TEMPORARY TEST CODE |
307 // END TEMPORARY TEST CODE |
287 } |
308 } |
288 |
309 |