46 Constructs the collection container. |
47 Constructs the collection container. |
47 This container handles the both the auto playlists and user created playlists. |
48 This container handles the both the auto playlists and user created playlists. |
48 */ |
49 */ |
49 MpCollectionContainerPlaylists::MpCollectionContainerPlaylists( HbDocumentLoader *loader, QGraphicsItem *parent ) |
50 MpCollectionContainerPlaylists::MpCollectionContainerPlaylists( HbDocumentLoader *loader, QGraphicsItem *parent ) |
50 : MpCollectionListContainer(loader, parent), |
51 : MpCollectionListContainer(loader, parent), |
51 mInfoBar(0) |
52 mInfoBar(0), |
|
53 mCurrentPlaylistIndex(0) |
52 { |
54 { |
53 TX_LOG |
55 TX_LOG |
|
56 mCollectionContext = ECollectionContextPlaylists; |
|
57 |
54 } |
58 } |
55 |
59 |
56 /*! |
60 /*! |
57 Destructs the collection container. |
61 Destructs the collection container. |
58 */ |
62 */ |
59 MpCollectionContainerPlaylists::~MpCollectionContainerPlaylists() |
63 MpCollectionContainerPlaylists::~MpCollectionContainerPlaylists() |
60 { |
64 { |
61 TX_ENTRY |
65 TX_ENTRY |
62 delete mInfoBar; |
66 delete mInfoBar; |
63 delete mList; |
67 delete mList; |
|
68 TX_EXIT |
|
69 } |
|
70 |
|
71 /*! |
|
72 Sets the data model for the container. |
|
73 */ |
|
74 void MpCollectionContainerPlaylists::setDataModel( MpCollectionDataModel *dataModel ) |
|
75 { |
|
76 TX_ENTRY |
|
77 MpCollectionListContainer::setDataModel(dataModel); |
|
78 if ( mCollectionContext == ECollectionContextPlaylists ) { |
|
79 if ( mList ) { |
|
80 if ( mCollectionData->count() ) { |
|
81 mList->scrollTo( dataModel->index(mCurrentPlaylistIndex, 0) ); |
|
82 } |
|
83 } |
|
84 } |
|
85 TX_EXIT |
|
86 } |
|
87 |
|
88 /*! |
|
89 Slot to be called when an item is selected by the user. |
|
90 */ |
|
91 void MpCollectionContainerPlaylists::itemActivated( const QModelIndex &index ) |
|
92 { |
|
93 if ( mCollectionContext == ECollectionContextPlaylists ) { |
|
94 mCurrentPlaylistIndex = index.row(); |
|
95 TX_ENTRY_ARGS("mCurrentPlaylistIndex=" << mCurrentPlaylistIndex); |
|
96 } |
|
97 MpCollectionListContainer::itemActivated(index); |
|
98 TX_EXIT |
|
99 } |
|
100 |
|
101 /*! |
|
102 Slot to be called data model has new data. |
|
103 */ |
|
104 void MpCollectionContainerPlaylists::dataReloaded() |
|
105 { |
|
106 TX_ENTRY |
|
107 MpCollectionListContainer::dataReloaded(); |
|
108 if ( mCollectionContext == ECollectionContextPlaylistSongs ) { |
|
109 // Playlist could have been renamed. |
|
110 QString details = mCollectionData->collectionTitle(); |
|
111 mInfoBar->setHeading(details); |
|
112 } |
64 TX_EXIT |
113 TX_EXIT |
65 } |
114 } |
66 |
115 |
67 /*! |
116 /*! |
68 Sets up the container by organizing widgets according to its layout. |
117 Sets up the container by organizing widgets according to its layout. |
101 widget = mDocumentLoader->findWidget(QString("playlistSongsDetail")); |
150 widget = mDocumentLoader->findWidget(QString("playlistSongsDetail")); |
102 mInfoBar = qobject_cast<HbGroupBox*>(widget); |
151 mInfoBar = qobject_cast<HbGroupBox*>(widget); |
103 |
152 |
104 QString details; |
153 QString details; |
105 if ( mViewMode == MpCommon::FetchView ) { |
154 if ( mViewMode == MpCommon::FetchView ) { |
106 details = "Select a song"; |
155 details = hbTrId("txt_mus_subtitle_select_a_song"); |
107 } |
156 } |
108 else { |
157 else { |
109 details = mCollectionData->collectionTitle(); |
158 details = mCollectionData->collectionTitle(); |
110 } |
159 } |
111 mInfoBar->setHeading(details); |
160 mInfoBar->setHeading(details); |