92 mTBone->setModel(dataModel); |
92 mTBone->setModel(dataModel); |
93 mTBone->scrollTo( dataModel->index(mCurrentAlbumIndex, 0) ); |
93 mTBone->scrollTo( dataModel->index(mCurrentAlbumIndex, 0) ); |
94 if ( mTBoneListModel == 0 ) { |
94 if ( mTBoneListModel == 0 ) { |
95 mTBoneListModel = new MpCollectionTBoneListDataModel(mCollectionData); |
95 mTBoneListModel = new MpCollectionTBoneListDataModel(mCollectionData); |
96 connect( mTBoneListModel, SIGNAL(albumDataChanged()), this, SLOT(albumDataChanged()) ); |
96 connect( mTBoneListModel, SIGNAL(albumDataChanged()), this, SLOT(albumDataChanged()) ); |
|
97 connect( mTBoneListModel, SIGNAL(albumDataAvailable()), this, SLOT(albumDataAvailable()) ); |
97 } |
98 } |
98 mList->setModel(mTBoneListModel); |
99 mList->setModel(mTBoneListModel); |
99 if ( !mCollectionData->setCurrentAlbum(mCurrentAlbumIndex) ) { |
100 if ( mCollectionData->setCurrentAlbum(mCurrentAlbumIndex) ) { |
|
101 if ( mCollectionData->albumSongsCount() > 1 ) { |
|
102 emit shuffleEnabled(true); |
|
103 } |
|
104 else { |
|
105 emit shuffleEnabled(false); |
|
106 } |
|
107 } |
|
108 else { |
100 emit findAlbumSongs(mCurrentAlbumIndex); |
109 emit findAlbumSongs(mCurrentAlbumIndex); |
|
110 emit shuffleEnabled(false); |
101 } |
111 } |
102 } |
112 } |
103 } |
113 } |
104 TX_EXIT |
114 TX_EXIT |
105 } |
115 } |
137 if ( mCurrentAlbumIndex != index.row() ) { |
147 if ( mCurrentAlbumIndex != index.row() ) { |
138 // Prevent reloading if user just moves the center album a little |
148 // Prevent reloading if user just moves the center album a little |
139 // and the same album re-centers. |
149 // and the same album re-centers. |
140 mCurrentAlbumIndex = index.row(); |
150 mCurrentAlbumIndex = index.row(); |
141 TX_LOG_ARGS("mCurrentAlbumIndex=" << mCurrentAlbumIndex); |
151 TX_LOG_ARGS("mCurrentAlbumIndex=" << mCurrentAlbumIndex); |
142 if ( !mCollectionData->setCurrentAlbum(mCurrentAlbumIndex) ) { |
152 if ( mCollectionData->setCurrentAlbum(mCurrentAlbumIndex) ) { |
|
153 if ( mCollectionData->albumSongsCount() > 1 ) { |
|
154 emit shuffleEnabled(true); |
|
155 } |
|
156 // Enable context menu |
|
157 mLongPressEnabled = true; |
|
158 } |
|
159 else { |
143 emit findAlbumSongs(mCurrentAlbumIndex); |
160 emit findAlbumSongs(mCurrentAlbumIndex); |
144 } |
161 } |
|
162 } |
|
163 else { |
|
164 // Landed on the same album. Just update menu. |
|
165 if ( mCollectionData->albumSongsCount() > 1 ) { |
|
166 emit shuffleEnabled(true); |
|
167 } |
|
168 // Enable context menu |
|
169 mLongPressEnabled = true; |
145 } |
170 } |
146 TX_EXIT |
171 TX_EXIT |
147 } |
172 } |
148 |
173 |
149 /*! |
174 /*! |
158 if ( mCollectionContext == ECollectionContextAlbumsTBone ) { |
183 if ( mCollectionContext == ECollectionContextAlbumsTBone ) { |
159 if ( mCurrentAlbumIndex > 0 ) { |
184 if ( mCurrentAlbumIndex > 0 ) { |
160 --mCurrentAlbumIndex; |
185 --mCurrentAlbumIndex; |
161 } |
186 } |
162 mTBone->scrollTo( mDataModel->index(mCurrentAlbumIndex, 0) ); |
187 mTBone->scrollTo( mDataModel->index(mCurrentAlbumIndex, 0) ); |
163 if ( !mCollectionData->setCurrentAlbum(mCurrentAlbumIndex) ) { |
188 if ( mCollectionData->setCurrentAlbum(mCurrentAlbumIndex) ) { |
|
189 if ( mCollectionData->albumSongsCount() == 1 ) { |
|
190 emit shuffleEnabled(false); |
|
191 } |
|
192 } |
|
193 else { |
164 emit findAlbumSongs(mCurrentAlbumIndex); |
194 emit findAlbumSongs(mCurrentAlbumIndex); |
165 } |
195 } |
166 } |
196 } |
167 else { |
197 else { |
168 MpCollectionListContainer::dataReloaded(); |
198 MpCollectionListContainer::dataReloaded(); |
176 */ |
206 */ |
177 void MpCollectionContainerAlbums::albumDataChanged() |
207 void MpCollectionContainerAlbums::albumDataChanged() |
178 { |
208 { |
179 TX_ENTRY |
209 TX_ENTRY |
180 emit findAlbumSongs(mCurrentAlbumIndex); |
210 emit findAlbumSongs(mCurrentAlbumIndex); |
|
211 emit shuffleEnabled(false); |
|
212 TX_EXIT |
|
213 } |
|
214 |
|
215 /*! |
|
216 Slot to be called TBone starts scrolling. |
|
217 */ |
|
218 void MpCollectionContainerAlbums::scrollingStarted() |
|
219 { |
|
220 TX_ENTRY |
|
221 // Disable shuffle action from the menu |
|
222 emit shuffleEnabled(false); |
|
223 // Disable context menu |
|
224 mLongPressEnabled = false; |
|
225 TX_EXIT |
|
226 } |
|
227 |
|
228 /*! |
|
229 Slot to be called album data is available. This is a result of findAlbumSongs signal. |
|
230 */ |
|
231 void MpCollectionContainerAlbums::albumDataAvailable() |
|
232 { |
|
233 TX_ENTRY |
|
234 int count = mCollectionData->albumSongsCount(); |
|
235 if ( count > 1 ) { |
|
236 emit shuffleEnabled(true); |
|
237 } |
|
238 // Enable context menu |
|
239 mLongPressEnabled = true; |
181 TX_EXIT |
240 TX_EXIT |
182 } |
241 } |
183 |
242 |
184 /*! |
243 /*! |
185 Sets up the container by organizing widgets according to its layout. |
244 Sets up the container by organizing widgets according to its layout. |
238 mTBone->setDefaultImage( defaultIcon.pixmap().toImage() ); |
297 mTBone->setDefaultImage( defaultIcon.pixmap().toImage() ); |
239 mTBone->setTitleFontSpec( HbFontSpec(HbFontSpec::Primary) ); |
298 mTBone->setTitleFontSpec( HbFontSpec(HbFontSpec::Primary) ); |
240 mTBone->setDescriptionFontSpec( HbFontSpec(HbFontSpec::Secondary) ); |
299 mTBone->setDescriptionFontSpec( HbFontSpec(HbFontSpec::Secondary) ); |
241 mTBone->setScrollBarPolicy( HgWidget::ScrollBarAlwaysOff ); |
300 mTBone->setScrollBarPolicy( HgWidget::ScrollBarAlwaysOff ); |
242 mTBone->enableReflections(true); |
301 mTBone->enableReflections(true); |
|
302 connect( mTBone, SIGNAL(scrollingStarted()), this, SLOT(scrollingStarted()) ); |
243 connect( mTBone, SIGNAL(scrollingEnded()), this, SLOT(albumCentered()) ); |
303 connect( mTBone, SIGNAL(scrollingEnded()), this, SLOT(albumCentered()) ); |
244 } |
304 } |
245 } |
305 } |
246 else { |
306 else { |
247 // Must delete widgets when last song is deleted and view is reloaded. |
307 // Must delete widgets when last song is deleted and view is reloaded. |