radioapp/radiowidgets/src/radiohistoryview.cpp
changeset 51 bbebb0235466
parent 36 ba22309243a1
child 54 a8ba0c289b44
equal deleted inserted replaced
47:74b7c6e79031 51:bbebb0235466
    40     const char* mArtist;
    40     const char* mArtist;
    41     const char* mTitle;
    41     const char* mTitle;
    42 };
    42 };
    43 const Song KRecognizedSongs[] = {
    43 const Song KRecognizedSongs[] = {
    44     { "Red Hot Chili Peppers", "Under The Bridge" },
    44     { "Red Hot Chili Peppers", "Under The Bridge" },
    45     { "Queens Of The Stone Age", "No One Knows" },
    45     { "", "No One Knows" },
    46     { "The Presidents of the United States of America", "Dune Buggy" },
    46     { "The Presidents of the United States of America", "Dune Buggy" },
    47     { "System of a Down", "Aerials" },
    47     { "System of a Down", "Aerials" },
    48     { "The White Stripes", "Seven Nation Army" },
    48     { "The White Stripes", "Seven Nation Army" },
    49     { "Alice In Chains", "When The Sun Rose Again" },
    49     { "Alice In Chains", "When The Sun Rose Again" },
    50     { "Bullet For My Valentine", "Tears Don't Fall" }
    50     { "Bullet For My Valentine", "Tears Don't Fall" }
   263     mHistoryList = mUiLoader->findObject<HbListView>( DOCML::HV_NAME_HISTORY_LIST );
   263     mHistoryList = mUiLoader->findObject<HbListView>( DOCML::HV_NAME_HISTORY_LIST );
   264     mHistoryList->setScrollingStyle( HbListView::PanOrFlick );
   264     mHistoryList->setScrollingStyle( HbListView::PanOrFlick );
   265     mHistoryList->setModel( historyModel );
   265     mHistoryList->setModel( historyModel );
   266     mHistoryList->setSelectionMode( HbListView::NoSelection );
   266     mHistoryList->setSelectionMode( HbListView::NoSelection );
   267     mHistoryList->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
   267     mHistoryList->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
   268     //TODO: Uncomment after MCL wk28 release to improve scrolling FPS rate
   268     mHistoryList->setItemPixmapCacheEnabled( true ); // Improves scrolling FPS rate
   269     //mHistoryList->setItemPixmapCacheEnabled( true );
       
   270 
   269 
   271     mAllSongsButton = mUiLoader->findObject<HbAction>( DOCML::HV_NAME_ALL_SONGS_BUTTON );
   270     mAllSongsButton = mUiLoader->findObject<HbAction>( DOCML::HV_NAME_ALL_SONGS_BUTTON );
   272     mTaggedSongsButton = mUiLoader->findObject<HbAction>( DOCML::HV_NAME_TAGGED_SONGS_BUTTON );
   271     mTaggedSongsButton = mUiLoader->findObject<HbAction>( DOCML::HV_NAME_TAGGED_SONGS_BUTTON );
   273 
   272 
   274     if ( HbAction* clearListAction = mUiLoader->findObject<HbAction>( DOCML::HV_NAME_CLEAR_LIST_ACTION ) ) {
   273     if ( HbAction* clearListAction = mUiLoader->findObject<HbAction>( DOCML::HV_NAME_CLEAR_LIST_ACTION ) ) {
   288                     this,                   SLOT(handleLongPress(HbAbstractViewItem*)) );
   287                     this,                   SLOT(handleLongPress(HbAbstractViewItem*)) );
   289 
   288 
   290     connectCommonMenuItem( MenuItem::Exit );
   289     connectCommonMenuItem( MenuItem::Exit );
   291     connectCommonMenuItem( MenuItem::UseLoudspeaker );
   290     connectCommonMenuItem( MenuItem::UseLoudspeaker );
   292 
   291 
       
   292     initContextMenu();
       
   293 
       
   294     initBackAction();
       
   295 
       
   296     updateViewMode();
       
   297 
       
   298     // BEGIN TEMPORARY TEST CODE
       
   299     if ( HbAction* addSongsAction = mUiLoader->findObject<HbAction>( "hv:add_songs_action" ) ) {
       
   300         Radio::connect( addSongsAction,     SIGNAL(triggered()),
       
   301                         this,               SLOT(addSongs()) );
       
   302     }
       
   303     // END TEMPORARY TEST CODE
       
   304 }
       
   305 
       
   306 /*!
       
   307  * \reimp
       
   308  *
       
   309  */
       
   310 void RadioHistoryView::setOrientation()
       
   311 {
       
   312     if ( mUiEngine ) {
       
   313         RadioHistoryModel& model = mUiEngine->historyModel();
       
   314         model.setShowDetails( mOrientation == Qt::Horizontal );
       
   315     }
       
   316 }
       
   317 
       
   318 /*!
       
   319  * \reimp
       
   320  *
       
   321  */
       
   322 void RadioHistoryView::userAccepted()
       
   323 {
       
   324     const bool removeTagged = mTaggedSongsButton->isChecked();
       
   325     mUiEngine->historyModel().removeAll( removeTagged );
       
   326     updateVisibilities();
       
   327 }
       
   328 
       
   329 /*!
       
   330  *
       
   331  */
       
   332 void RadioHistoryView::initContextMenu()
       
   333 {
   293     // Context menu actions
   334     // Context menu actions
   294     connectXmlElement( DOCML::HV_NAME_TOGGLE_TAG_ACTION,    SIGNAL(triggered()),
   335     connectXmlElement( DOCML::HV_NAME_TOGGLE_TAG_ACTION,    SIGNAL(triggered()),
   295                        this,                                SLOT(toggleTagging()) );
   336                        this,                                SLOT(toggleTagging()) );
   296     connectXmlElement( DOCML::HV_NAME_OVI_STORE_ACTION,     SIGNAL(triggered()),
   337     connectXmlElement( DOCML::HV_NAME_OVI_STORE_ACTION,     SIGNAL(triggered()),
   297                        this,                                SLOT(openOviStore()) );
   338                        this,                                SLOT(openOviStore()) );
   298     connectXmlElement( DOCML::HV_NAME_OTHER_STORE_ACTION,   SIGNAL(triggered()),
   339 
   299                        this,                                SLOT(openOtherStore()) );
   340     // TODO: Get additional music stores. For now use "Amazon" for demonstration purposes
   300     initBackAction();
   341     const QString otherStoreFormatter = hbTrId( "txt_rad_menu_search_from_other_store" );
   301 
   342     if ( HbMenu* contextMenu = mUiLoader->findObject<HbMenu>( DOCML::HV_NAME_CONTEXT_MENU ) ) {
   302     updateViewMode();
   343         contextMenu->addAction( otherStoreFormatter.arg( "Amazon" ), this, SLOT(openOtherStore()) );
   303 
   344     }
   304     // BEGIN TEMPORARY TEST CODE
       
   305     if ( HbAction* addSongsAction = mUiLoader->findObject<HbAction>( "hv:add_songs_action" ) ) {
       
   306         Radio::connect( addSongsAction,     SIGNAL(triggered()),
       
   307                         this,               SLOT(addSongs()) );
       
   308     }
       
   309     // END TEMPORARY TEST CODE
       
   310 }
       
   311 
       
   312 /*!
       
   313  * \reimp
       
   314  *
       
   315  */
       
   316 void RadioHistoryView::setOrientation()
       
   317 {
       
   318     if ( mUiEngine ) {
       
   319         RadioHistoryModel& model = mUiEngine->historyModel();
       
   320         model.setShowDetails( mOrientation == Qt::Horizontal );
       
   321     }
       
   322 }
       
   323 
       
   324 /*!
       
   325  * \reimp
       
   326  *
       
   327  */
       
   328 void RadioHistoryView::userAccepted()
       
   329 {
       
   330     const bool removeTagged = mTaggedSongsButton->isChecked();
       
   331     mUiEngine->historyModel().removeAll( removeTagged );
       
   332     updateVisibilities();
       
   333 }
   345 }
   334 
   346 
   335 /*!
   347 /*!
   336  *
   348  *
   337  */
   349  */